some bugfixes

This commit is contained in:
Yann Leboulanger 2004-08-02 09:11:50 +00:00
parent 337174a2eb
commit c573d07086

View file

@ -191,21 +191,21 @@ class GajimCore:
prio = prs.getPriority() prio = prs.getPriority()
if not prio: if not prio:
prio = 0 prio = 0
type = prs.getType() typ = prs.getType()
if type == None: type = 'available' if typ == None: typ = 'available'
log.debug("PresenceCB : %s" % type) log.debug("PresenceCB : %s" % typ)
if type == 'available': if typ == 'available':
show = prs.getShow() show = prs.getShow()
if not show: if not show:
show = 'online' show = 'online'
self.hub.sendPlugin('NOTIFY', self.connexions[con], \ self.hub.sendPlugin('NOTIFY', self.connexions[con], \
(prs.getFrom().getBasic(), show, prs.getStatus(), \ (prs.getFrom().getBasic(), show, prs.getStatus(), \
prs.getFrom().getResource(), prio)) prs.getFrom().getResource(), prio))
elif type == 'unavailable': elif typ == 'unavailable':
self.hub.sendPlugin('NOTIFY', self.connexions[con], \ self.hub.sendPlugin('NOTIFY', self.connexions[con], \
(prs.getFrom().getBasic(), 'offline', prs.getStatus(), \ (prs.getFrom().getBasic(), 'offline', prs.getStatus(), \
prs.getFrom().getResource(), prio)) prs.getFrom().getResource(), prio))
elif type == 'subscribe': elif typ == 'subscribe':
log.debug("subscribe request from %s" % who) log.debug("subscribe request from %s" % who)
if self.cfgParser.Core['alwaysauth'] == 1 or \ if self.cfgParser.Core['alwaysauth'] == 1 or \
string.find(who, "@") <= 0: string.find(who, "@") <= 0:
@ -218,8 +218,8 @@ class GajimCore:
txt = prs.getStatus() txt = prs.getStatus()
if not txt: if not txt:
txt = _("I would like to add you to my roster.") txt = _("I would like to add you to my roster.")
self.hub.sendPlugin('SUBSCRIBE', self.connexions[con], (who, 'txt')) self.hub.sendPlugin('SUBSCRIBE', self.connexions[con], (who, txt))
elif type == 'subscribed': elif typ == 'subscribed':
jid = prs.getFrom() jid = prs.getFrom()
self.hub.sendPlugin('SUBSCRIBED', self.connexions[con],\ self.hub.sendPlugin('SUBSCRIBED', self.connexions[con],\
(jid.getBasic(), jid.getNode(), jid.getResource())) (jid.getBasic(), jid.getNode(), jid.getResource()))
@ -227,13 +227,13 @@ class GajimCore:
(jid.getBasic(), jid.getNode(), ['general']))) (jid.getBasic(), jid.getNode(), ['general'])))
#BE CAREFUL : no con.updateRosterItem() in a callback #BE CAREFUL : no con.updateRosterItem() in a callback
log.debug("we are now subscribed to %s" % who) log.debug("we are now subscribed to %s" % who)
elif type == 'unsubscribe': elif typ == 'unsubscribe':
log.debug("unsubscribe request from %s" % who) log.debug("unsubscribe request from %s" % who)
elif type == 'unsubscribed': elif typ == 'unsubscribed':
log.debug("we are now unsubscribed to %s" % who) log.debug("we are now unsubscribed to %s" % who)
self.hub.sendPlugin('UNSUBSCRIBED', self.connexions[con], \ self.hub.sendPlugin('UNSUBSCRIBED', self.connexions[con], \
prs.getFrom().getBasic()) prs.getFrom().getBasic())
elif type == 'error': elif typ == 'error':
errmsg = '' errmsg = ''
for child in prs._node.getChildren(): for child in prs._node.getChildren():
if child.getName() == 'error': if child.getName() == 'error':
@ -415,13 +415,13 @@ class GajimCore:
'invisible'] 'invisible']
self.connected[ev[1]] = statuss.index(ev[2][0]) self.connected[ev[1]] = statuss.index(ev[2][0])
#send our presence #send our presence
type = 'available' typ = 'available'
if ev[2][0] == 'invisible': if ev[2][0] == 'invisible':
type = 'invisible' typ = 'invisible'
prio = 0 prio = 0
if self.cfgParser.tab[ev[1]].has_key('priority'): if self.cfgParser.tab[ev[1]].has_key('priority'):
prio = str(self.cfgParser.tab[ev[1]]['priority']) prio = str(self.cfgParser.tab[ev[1]]['priority'])
con.sendPresence(type, prio, ev[2][0], ev[2][1]) con.sendPresence(typ, prio, ev[2][0], ev[2][1])
self.hub.sendPlugin('STATUS', ev[1], ev[2][0]) self.hub.sendPlugin('STATUS', ev[1], ev[2][0])
#ask our VCard #ask our VCard
iq = common.jabber.Iq(type="get") iq = common.jabber.Iq(type="get")
@ -438,13 +438,13 @@ class GajimCore:
statuss = ['offline', 'online', 'away', 'xa', 'dnd', \ statuss = ['offline', 'online', 'away', 'xa', 'dnd', \
'invisible'] 'invisible']
self.connected[ev[1]] = statuss.index(ev[2][0]) self.connected[ev[1]] = statuss.index(ev[2][0])
type = 'available' typ = 'available'
if ev[2][0] == 'invisible': if ev[2][0] == 'invisible':
type = 'invisible' typ = 'invisible'
prio = 0 prio = 0
if self.cfgParser.tab[ev[1]].has_key('priority'): if self.cfgParser.tab[ev[1]].has_key('priority'):
prio = str(self.cfgParser.tab[ev[1]]['priority']) prio = str(self.cfgParser.tab[ev[1]]['priority'])
con.sendPresence(type, prio, ev[2][0], ev[2][1]) con.sendPresence(typ, prio, ev[2][0], ev[2][1])
self.hub.sendPlugin('STATUS', ev[1], ev[2][0]) self.hub.sendPlugin('STATUS', ev[1], ev[2][0])
#('MSG', account, (jid, msg)) #('MSG', account, (jid, msg))
elif ev[0] == 'MSG': elif ev[0] == 'MSG':
@ -560,7 +560,7 @@ class GajimCore:
else: else:
iq2.insertTag(i).putData(ev[2][i]) iq2.insertTag(i).putData(ev[2][i])
con.send(iq) con.send(iq)
#('AGENT_LOGGING', account, (agent, type)) #('AGENT_LOGGING', account, (agent, typ))
elif ev[0] == 'AGENT_LOGGING': elif ev[0] == 'AGENT_LOGGING':
t = ev[2][1]; t = ev[2][1];
if not t: if not t: