minor changes
This commit is contained in:
parent
ed9f70e62d
commit
3fc824f87b
11
core/core.py
11
core/core.py
|
@ -112,6 +112,8 @@ class GajimCore:
|
|||
self.con.connect()
|
||||
except IOError, e:
|
||||
log.debug("Couldn't connect to %s %s" % (hostname, e))
|
||||
self.hub.sendPlugin('STATUS', 'offline')
|
||||
self.hub.sendPlugin('WARNING', "Couldn't connect to %s" % hostname)
|
||||
return 0
|
||||
else:
|
||||
log.debug("Connected to server")
|
||||
|
@ -127,9 +129,12 @@ class GajimCore:
|
|||
roster = {}
|
||||
self.hub.sendPlugin('ROSTER', roster)
|
||||
self.con.sendInitPresence()
|
||||
self.hub.sendPlugin('STATUS', 'online')
|
||||
self.connected = 1
|
||||
else:
|
||||
log.debug("Couldn't authentificate to %s" % hostname)
|
||||
self.hub.sendPlugin('STATUS', 'offline')
|
||||
self.hub.sendPlugin('WARNING', 'Authentification failed, check your login and password')
|
||||
return 0
|
||||
# END connect
|
||||
|
||||
|
@ -148,11 +153,13 @@ class GajimCore:
|
|||
self.connect(ev[1][1])
|
||||
elif (ev[1][0] == 'offline') and (self.connected == 1):
|
||||
self.con.disconnect()
|
||||
self.hub.sendPlugin('STATUS', 'offline')
|
||||
self.connected = 0
|
||||
if ev[1][0] != 'offline':
|
||||
if ev[1][0] != 'offline' and self.connected == 1:
|
||||
p = common.jabber.Presence()
|
||||
p.setShow(ev[1][0])
|
||||
self.con.send(p)
|
||||
self.hub.sendPlugin('STATUS', ev[1][0])
|
||||
#('MSG', (jid, msg))
|
||||
elif ev[0] == 'MSG':
|
||||
msg = common.jabber.Message(ev[1][0], ev[1][1])
|
||||
|
@ -227,6 +234,8 @@ def loadPlugins(gc):
|
|||
for mod in mods:
|
||||
modObj = gc.hub.newPlugin(mod)
|
||||
gc.hub.register(mod, 'ROSTER')
|
||||
gc.hub.register(mod, 'WARNING')
|
||||
gc.hub.register(mod, 'STATUS')
|
||||
gc.hub.register(mod, 'NOTIFY')
|
||||
gc.hub.register(mod, 'MSG')
|
||||
gc.hub.register(mod, 'MSGSENT')
|
||||
|
|
|
@ -2884,6 +2884,7 @@ messages</property>
|
|||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_autopopup_not_online">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Allow AutoPopup
|
||||
when NOT onlie</property>
|
||||
|
@ -2903,6 +2904,7 @@ when NOT onlie</property>
|
|||
<child>
|
||||
<widget class="GtkCheckButton" id="checkbutton5">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">checkbutton5</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
|
|
@ -826,16 +826,6 @@ class roster:
|
|||
self.queueOUT.put(('STATUS',(widget.name, accounts[0])))
|
||||
# if (not self.showOffline) and widget.name == 'offline':
|
||||
# self.treestore.clear()
|
||||
if widget.name == 'offline':
|
||||
self.connected = 0
|
||||
self.plugin.sleeper = None
|
||||
for j in self.l_contact.keys():
|
||||
self.chg_status(j, 'offline', 'Disconnected')
|
||||
elif self.connected == 0:
|
||||
self.tree
|
||||
self.connected = 1
|
||||
self.plugin.sleeper = common.sleepy.Sleepy(\
|
||||
self.plugin.autoawaytime*60, self.plugin.autoxatime*60)
|
||||
|
||||
def on_prefs(self, widget):
|
||||
window = prefs(self)
|
||||
|
@ -1013,6 +1003,26 @@ class plugin:
|
|||
self.r.init_tree()
|
||||
self.r.mklists(ev[1])
|
||||
self.r.draw_roster()
|
||||
elif ev[0] == 'WARNING':
|
||||
warning(ev[1])
|
||||
elif ev[0] == 'STATUS':
|
||||
st = ""
|
||||
for i in range(7):
|
||||
if self.r.optionmenu.get_menu().get_children()[i].name == ev[1]:
|
||||
st = self.r.optionmenu.get_menu().get_children()[i].name
|
||||
self.r.optionmenu.set_history(i)
|
||||
break
|
||||
if st == 'offline':
|
||||
self.r.connected = 0
|
||||
self.sleeper = None
|
||||
for j in self.r.l_contact.keys():
|
||||
self.r.chg_status(j, 'offline', 'Disconnected')
|
||||
elif self.r.connected == 0:
|
||||
# self.tree
|
||||
self.r.connected = 1
|
||||
self.r.plugin.sleeper = common.sleepy.Sleepy(\
|
||||
self.autoawaytime*60, self.autoxatime*60)
|
||||
|
||||
elif ev[0] == 'NOTIFY':
|
||||
jid = string.split(ev[1][0], '/')[0]
|
||||
if string.find(jid, "@") <= 0:
|
||||
|
@ -1094,8 +1104,6 @@ class plugin:
|
|||
Wreg = agent_reg(ev[1][0], ev[1][1], self.r)
|
||||
#('ACC_OK', (hostname, login, pasword, name, ressource))
|
||||
elif ev[0] == 'ACC_OK':
|
||||
print "acc_ok"
|
||||
print ev[1]
|
||||
self.r.cfgParser.add_section(ev[1][3])
|
||||
self.r.accounts.append(ev[1][3])
|
||||
accountsStr = string.join(self.r.accounts)
|
||||
|
|
Loading…
Reference in New Issue