@@ -46,9 +46,12 @@ class RegisterBot(sleekxmpp.ClientXMPP):
4646 workflows will need to check for data forms, etc.
4747 """
4848
49- def __init__ (self , jid , password ):
49+ def __init__ (self , jid , password , name = None , email = None ):
5050 sleekxmpp .ClientXMPP .__init__ (self , jid , password )
5151
52+ self .name = name
53+ self .email = email
54+
5255 # The session_start event will be triggered when
5356 # the bot establishes its connection with the server
5457 # and the XML streams are ready for use. We want to
@@ -102,11 +105,18 @@ def register(self, iq):
102105 To get the list of basic registration fields, you can use:
103106 iq['register']['fields']
104107 """
108+
105109 resp = self .Iq ()
106110 resp ['type' ] = 'set'
107111 resp ['register' ]['username' ] = self .boundjid .user
108112 resp ['register' ]['password' ] = self .password
109113
114+ if self .name :
115+ resp ['register' ]['name' ] = self .name
116+
117+ if self .email :
118+ resp ['register' ]['email' ] = self .email
119+
110120 # TODO: Raise exception if fails
111121 try :
112122 resp .send (now = True )
@@ -120,11 +130,11 @@ def register(self, iq):
120130 self .disconnect ()
121131
122132
123- def register_account (jid , password ):
133+ def register_account (jid , password , name = None , email = None ):
124134 # Setup the RegisterBot and register plugins. Note that while plugins may
125135 # have interdependencies, the order in which you register them does
126136 # not matter.
127- xmpp = RegisterBot (jid , password )
137+ xmpp = RegisterBot (jid , password , name , email )
128138 xmpp .register_plugin ('xep_0030' ) # Service Discovery
129139 xmpp .register_plugin ('xep_0004' ) # Data forms
130140 xmpp .register_plugin ('xep_0066' ) # Out-of-band Data
0 commit comments