now we can register a new account

This commit is contained in:
Yann Leboulanger 2004-07-01 19:49:26 +00:00
parent 3c7326e482
commit 58d6f0d15e
3 changed files with 23 additions and 11 deletions

View file

@ -409,11 +409,11 @@ class GajimCore:
#('REG_AGENT', account, infos) #('REG_AGENT', account, infos)
elif ev[0] == 'REG_AGENT': elif ev[0] == 'REG_AGENT':
con.sendRegInfo(ev[2]) con.sendRegInfo(ev[2])
#('NEW_ACC', (hostname, login, password, name, ressource, use_proxy\ #('NEW_ACC', (hostname, login, password, name, ressource, prio, \
#, proxyhost, proxyport)) # use_proxy, proxyhost, proxyport))
elif ev[0] == 'NEW_ACC': elif ev[0] == 'NEW_ACC':
if ev[2][5]: if ev[2][6]:
proxy = {'host': ev[2][6], 'port': ev[2][7]} proxy = {'host': ev[2][7], 'port': ev[2][8]}
else: else:
proxy = None proxy = None
c = common.jabber.Client(host = ev[2][0], debug = [], \ c = common.jabber.Client(host = ev[2][0], debug = [], \

View file

@ -351,6 +351,9 @@ class accountPreference_Window:
"""When Close button is clicked""" """When Close button is clicked"""
widget.get_toplevel().destroy() widget.get_toplevel().destroy()
def destroy(self):
self.xml.get_widget("Account").destroy()
def init_account(self, infos): def init_account(self, infos):
"""Initialize window with defaults values""" """Initialize window with defaults values"""
if infos.has_key('name'): if infos.has_key('name'):
@ -388,6 +391,7 @@ class accountPreference_Window:
entryProxyhost = self.xml.get_widget("entry_proxyhost") entryProxyhost = self.xml.get_widget("entry_proxyhost")
entryProxyport = self.xml.get_widget("entry_proxyport") entryProxyport = self.xml.get_widget("entry_proxyport")
proxyPort = entryProxyport.get_text() proxyPort = entryProxyport.get_text()
proxyHost = entryProxyhost.get_text()
name = entryName.get_text() name = entryName.get_text()
jid = entryJid.get_text() jid = entryJid.get_text()
if (name == ''): if (name == ''):
@ -399,12 +403,15 @@ class accountPreference_Window:
if (jid == '') or (string.count(jid, '@') != 1): if (jid == '') or (string.count(jid, '@') != 1):
warning_Window(_("You must enter a Jabber ID for this account\nFor example : login@hostname")) warning_Window(_("You must enter a Jabber ID for this account\nFor example : login@hostname"))
return 0 return 0
if proxyPort != '': if useProxy:
try: if proxyPort != '':
proxyPort = string.atoi(proxyPort) try:
except ValueError: proxyPort = string.atoi(proxyPort)
warning_Window(_("Proxy Port must be a port number")) except ValueError:
return 0 warning_Window(_("Proxy Port must be a port number"))
return 0
if proxyHost == '':
warning_Window(_("You must enter a proxy host to use proxy"))
if prio != '': if prio != '':
try: try:
prio = string.atoi(prio) prio = string.atoi(prio)
@ -455,7 +462,7 @@ class accountPreference_Window:
if check.get_active(): if check.get_active():
self.plugin.send('NEW_ACC', None, (hostname, login, \ self.plugin.send('NEW_ACC', None, (hostname, login, \
entryPass.get_text(), name, entryRessource.get_text(), prio, \ entryPass.get_text(), name, entryRessource.get_text(), prio, \
checkProxy.get_active(), entryProxyhost.get_text(), proxyPort)) useProxy, proxyHost, proxyPort))
check.set_active(FALSE) check.set_active(FALSE)
return return
self.plugin.accounts[name] = {'name': login, 'hostname': hostname,\ self.plugin.accounts[name] = {'name': login, 'hostname': hostname,\

View file

@ -1628,6 +1628,9 @@ class plugin:
def handle_event_acc_ok(self, account, array): def handle_event_acc_ok(self, account, array):
#('ACC_OK', account, (hostname, login, pasword, name, ressource, prio, #('ACC_OK', account, (hostname, login, pasword, name, ressource, prio,
#use_proxy, proxyhost, proxyport)) #use_proxy, proxyhost, proxyport))
if self.windows['accountPreference']:
self.windows['accountPreference'].destroy()
name = array[3]
self.accounts[array[3]] = {'name': array[1], \ self.accounts[array[3]] = {'name': array[1], \
'hostname': array[0],\ 'hostname': array[0],\
'password': array[2],\ 'password': array[2],\
@ -1642,8 +1645,10 @@ class plugin:
self.connected[name] = 0 self.connected[name] = 0
self.roster.groups[name] = {} self.roster.groups[name] = {}
self.roster.contacts[name] = {} self.roster.contacts[name] = {}
self.sleeper_state[a] = 0
if self.windows.has_key('accounts'): if self.windows.has_key('accounts'):
self.windows['accounts'].init_accounts() self.windows['accounts'].init_accounts()
self.roster.draw_roster()
def handle_event_quit(self, p1, p2): def handle_event_quit(self, p1, p2):
self.roster.on_quit(self) self.roster.on_quit(self)