Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2004-01-14 04:06:27 +0300
committerYann Leboulanger <asterix@lagaule.org>2004-01-14 04:06:27 +0300
commit194f989f1c71f6705cf52f177f3b24c3f6cda2e8 (patch)
treeee40e3e160ea8f4d6c6f8146da4144e20ac470e5 /core
parent3fc824f87b781332965e95d2de50ee5cde4f335a (diff)
information window
away messages support new jabberpy library
Diffstat (limited to 'core')
-rw-r--r--core/core.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/core/core.py b/core/core.py
index 6df1c45cc..686284fd0 100644
--- a/core/core.py
+++ b/core/core.py
@@ -58,23 +58,25 @@ class GajimCore:
else:
show = 'online'
self.hub.sendPlugin('NOTIFY', \
- (prs.getFrom().getBasic(), show, prs.getStatus()))
+ (prs.getFrom().getBasic(), show, prs.getStatus(), prs.getFrom().getResource()))
elif type == 'unavailable':
self.hub.sendPlugin('NOTIFY', \
- (prs.getFrom().getBasic(), 'offline', prs.getStatus()))
+ (prs.getFrom().getBasic(), 'offline', prs.getStatus(), prs.getFrom().getResource()))
elif type == 'subscribe':
log.debug("subscribe request from %s" % who)
if self.cfgParser.Core_alwaysauth == 1 or string.find(who, "@") <= 0:
self.con.send(common.jabber.Presence(who, 'subscribed'))
if string.find(who, "@") <= 0:
- self.hub.sendPlugin('NOTIFY', (who, 'offline', 'offline'))
+ self.hub.sendPlugin('NOTIFY', (who, 'offline', 'offline', prs.getFrom().getResource()))
else:
self.hub.sendPlugin('SUBSCRIBE', who)
elif type == 'subscribed':
jid = prs.getFrom()
self.hub.sendPlugin('SUBSCRIBED', {'jid':jid.getBasic(), \
- 'nom':jid.getNode()})
- self.con.updateRosterItem(jid=jid.getBasic(), name=jid.getNode())
+ 'nom':jid.getNode(), 'ressource':jid.getResource()})
+ self.hub.queueIn.put(('UPDUSER', (jid.getBasic(), \
+ jid.getNode(), ['general'])))
+# self.con.updateRosterItem(jid=jid.getBasic(), name=jid.getNode(), groups=['general'])
log.debug("we are now subscribed to %s" % who)
elif type == 'unsubscribe':
log.debug("unsubscribe request from %s" % who)
@@ -97,7 +99,10 @@ class GajimCore:
def disconnectedCB(self, con):
log.debug("disconnectedCB")
- self.con.disconnect()
+ if self.connected == 1:
+ self.connected = 0
+ self.con.disconnect()
+# self.con.disconnect()
# END disconenctedCB
def connect(self, account):
@@ -107,7 +112,7 @@ class GajimCore:
password = self.cfgParser.__getattr__("%s" % account+"_password")
ressource = self.cfgParser.__getattr__("%s" % account+"_ressource")
self.con = common.jabber.Client(host = \
- hostname, debug = False, log = sys.stderr)
+ hostname, debug = [common.jabber.DBG_ALWAYS], log = sys.stderr)
try:
self.con.connect()
except IOError, e:
@@ -118,9 +123,12 @@ class GajimCore:
else:
log.debug("Connected to server")
- self.con.setMessageHandler(self.messageCB)
- self.con.setPresenceHandler(self.presenceCB)
+ self.con.registerHandler('message', self.messageCB)
+ self.con.registerHandler('presence', self.presenceCB)
self.con.setDisconnectHandler(self.disconnectedCB)
+# self.con.setMessageHandler(self.messageCB)
+# self.con.setPresenceHandler(self.presenceCB)
+# self.con.setDisconnectHandler(self.disconnectedCB)
#BUG in jabberpy library : if hostname is wrong : "boucle"
if self.con.auth(name, password, ressource):
self.con.requestRoster()
@@ -144,20 +152,22 @@ class GajimCore:
ev = self.hub.queueIn.get()
if ev[0] == 'QUIT':
if self.connected == 1:
+ self.connected = 0
self.con.disconnect()
self.hub.sendPlugin('QUIT', ())
return
- #('STATUS', (status, account))
+ #('STATUS', (status, msg, account))
elif ev[0] == 'STATUS':
if (ev[1][0] != 'offline') and (self.connected == 0):
- self.connect(ev[1][1])
+ self.connect(ev[1][2])
elif (ev[1][0] == 'offline') and (self.connected == 1):
+ self.connected = 0
self.con.disconnect()
self.hub.sendPlugin('STATUS', 'offline')
- self.connected = 0
if ev[1][0] != 'offline' and self.connected == 1:
p = common.jabber.Presence()
p.setShow(ev[1][0])
+ p.setStatus(ev[1][1])
self.con.send(p)
self.hub.sendPlugin('STATUS', ev[1][0])
#('MSG', (jid, msg))