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)
elif ev[0] == 'REG_AGENT':
con.sendRegInfo(ev[2])
#('NEW_ACC', (hostname, login, password, name, ressource, use_proxy\
#, proxyhost, proxyport))
#('NEW_ACC', (hostname, login, password, name, ressource, prio, \
# use_proxy, proxyhost, proxyport))
elif ev[0] == 'NEW_ACC':
if ev[2][5]:
proxy = {'host': ev[2][6], 'port': ev[2][7]}
if ev[2][6]:
proxy = {'host': ev[2][7], 'port': ev[2][8]}
else:
proxy = None
c = common.jabber.Client(host = ev[2][0], debug = [], \

View File

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

View File

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