Skip to content
Snippets Groups Projects
Commit 5e47ab69 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

we can now set our priority

parent f518f2c6
No related branches found
No related tags found
No related merge requests found
......@@ -305,12 +305,11 @@ class GajimCore:
con = self.connect(ev[1])
if self.connected[ev[1]]:
#send our presence
p = common.jabber.Presence()
p.setShow(ev[2][0])
p.setStatus(ev[2][1])
type = 'available'
if ev[2][0] == 'invisible':
p.setType('invisible')
con.send(p)
type = 'invisible'
prio = str(self.cfgParser.tab[ev[1]]['priority'])
con.sendPresence(type, prio, ev[2][0], ev[2][1])
self.hub.sendPlugin('STATUS', ev[1], ev[2][0])
#ask our VCard
iq = common.jabber.Iq(type="get")
......
......@@ -354,6 +354,8 @@ class accountPreference_Window:
self.xml.get_widget("entry_password").set_text(infos['password'])
if infos.has_key('ressource'):
self.xml.get_widget("entry_ressource").set_text(infos['ressource'])
if infos.has_key('priority'):
self.xml.get_widget("entry_priority").set_text(str(infos['priority']))
if infos.has_key('use_proxy'):
self.xml.get_widget("checkbutton_proxy").set_active(infos['use_proxy'])
if infos.has_key('proxyhost'):
......@@ -367,6 +369,8 @@ class accountPreference_Window:
"""When save button is clicked : Save informations in config file"""
entryPass = self.xml.get_widget("entry_password")
entryRessource = self.xml.get_widget("entry_ressource")
entryPriority = self.xml.get_widget("entry_priority")
prio = entryPriority.get_text()
check = self.xml.get_widget("checkbutton")
entryName = self.xml.get_widget("entry_name")
entryJid = self.xml.get_widget("entry_jid")
......@@ -395,6 +399,12 @@ class accountPreference_Window:
except ValueError:
warning_Window(_("Proxy Port must be a port number"))
return 0
if prio != '':
try:
prio = string.atoi(prio)
except ValueError:
warning_Window(_("Priority must be a number"))
return 0
(login, hostname) = string.split(jid, '@')
#if we are modifying an account
if self.modify:
......@@ -419,8 +429,9 @@ class accountPreference_Window:
self.plugin.send('ACC_CHG', self.account, name)
self.plugin.accounts[name] = {'name': login, 'hostname': hostname,\
'password': entryPass.get_text(), 'ressource': \
entryRessource.get_text(), 'use_proxy': useProxy, 'proxyhost': \
entryProxyhost.get_text(), 'proxyport': proxyPort}
entryRessource.get_text(), 'priority' : prio, 'use_proxy': \
useProxy, 'proxyhost': entryProxyhost.get_text(), 'proxyport': \
proxyPort}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts))
#refresh accounts window
if self.plugin.windows.has_key('accounts'):
......@@ -437,15 +448,15 @@ class accountPreference_Window:
#if we neeed to register a new account
if check.get_active():
self.plugin.send('NEW_ACC', None, (hostname, login, \
entryPass.get_text(), name, entryRessource.get_text(), \
entryPass.get_text(), name, entryRessource.get_text(), prio, \
checkProxy.get_active(), entryProxyhost.get_text(), \
entryProxyport.get_text()))
check.set_active(FALSE)
return
self.plugin.accounts[name] = {'name': login, 'hostname': hostname,\
'password': entryPass.get_text(), 'ressource': \
entryRessource.get_text(), 'use_proxy': useProxy, 'proxyhost': \
entryProxyhost.get_text(), 'proxyport': proxyPort}
entryRessource.get_text(), 'priority' : prio, 'use_proxy': useProxy, \
'proxyhost': entryProxyhost.get_text(), 'proxyport': proxyPort}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts))
#update variables
self.plugin.windows[name] = {'infos': {}, 'chats': {}}
......@@ -557,6 +568,8 @@ class accounts_Window:
infos['password'] = self.plugin.accounts[account]["password"]
if self.plugin.accounts[account].has_key("ressource"):
infos['ressource'] = self.plugin.accounts[account]["ressource"]
if self.plugin.accounts[account].has_key("priority"):
infos['priority'] = self.plugin.accounts[account]["priority"]
if self.plugin.accounts[account].has_key("use_proxy"):
infos['use_proxy'] = self.plugin.accounts[account]["use_proxy"]
if self.plugin.accounts[account].has_key("proxyhost"):
......
This diff is collapsed.
......@@ -690,6 +690,8 @@ class roster_Window:
infos['password'] = self.plugin.accounts[account]["password"]
if self.plugin.accounts[account].has_key("ressource"):
infos['ressource'] = self.plugin.accounts[account]["ressource"]
if self.plugin.accounts[account].has_key("priority"):
infos['priority'] = self.plugin.accounts[account]["priority"]
if self.plugin.accounts[account].has_key("use_proxy"):
infos['use_proxy'] = self.plugin.accounts[account]["use_proxy"]
if self.plugin.accounts[account].has_key("proxyhost"):
......@@ -1280,7 +1282,7 @@ class plugin:
#It must be an agent
if not self.roster.contacts[ev[1]].has_key(ji):
user1 = user(ji, ji, ['Agents'], ev[2][1], \
ev[2][2], 'from', resource)
ev[2][2], 'from', resource, 0)
self.roster.contacts[ev[1]][ji] = [user1]
self.roster.add_user_to_roster(ji, ev[1])
else:
......@@ -1328,10 +1330,13 @@ class plugin:
warning_Window(_("error contacting %s") % ev[2][0])
else:
agentRegistration_Window(ev[2][0], ev[2][1], self, ev[1])
#('ACC_OK', account, (hostname, login, pasword, name, ressource))
#('ACC_OK', account, (hostname, login, pasword, name, ressource, prio,
#use_proxy, proxyhost, proxyport))
elif ev[0] == 'ACC_OK':
self.accounts[ev[2][3]] = {'ressource': ev[2][4], \
'password': ev[2][2], 'hostname': ev[2][0], 'name': ev[2][1]}
self.accounts[ev[2][3]] = {'name': ev[2][1], 'hostname': ev[2][0],\
'password': ev[2][2], 'ressource': ev[2][4], 'priority': \
ev[2][5], 'use_proxy': ev[2][6], 'proxyhost': ev[2][7], \
'proxyport': ev[2][8]}
self.send('CONFIG', None, ('accounts', self.accounts))
self.windows[name] = {'infos': {}, 'chats': {}}
self.queues[name] = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment