typ -> ptype/mtype
This commit is contained in:
parent
51003f4712
commit
119ac50004
1 changed files with 26 additions and 26 deletions
|
@ -131,7 +131,7 @@ class connection:
|
||||||
|
|
||||||
def _messageCB(self, con, msg):
|
def _messageCB(self, con, msg):
|
||||||
"""Called when we recieve a message"""
|
"""Called when we recieve a message"""
|
||||||
typ = msg.getType()
|
mtype = msg.getType()
|
||||||
tim = msg.getTimestamp()
|
tim = msg.getTimestamp()
|
||||||
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S')
|
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S')
|
||||||
msgtxt = msg.getBody()
|
msgtxt = msg.getBody()
|
||||||
|
@ -151,10 +151,10 @@ class connection:
|
||||||
decmsg = self.gpg.decrypt(encmsg, keyID)
|
decmsg = self.gpg.decrypt(encmsg, keyID)
|
||||||
if decmsg:
|
if decmsg:
|
||||||
msgtxt = decmsg
|
msgtxt = decmsg
|
||||||
if typ == 'error':
|
if mtype == 'error':
|
||||||
self.dispatch('MSGERROR', (str(msg.getFrom()), \
|
self.dispatch('MSGERROR', (str(msg.getFrom()), \
|
||||||
msg.getErrorCode(), msg.getError(), msgtxt, tim))
|
msg.getErrorCode(), msg.getError(), msgtxt, tim))
|
||||||
elif typ == 'groupchat':
|
elif mtype == 'groupchat':
|
||||||
subject = msg.getSubject()
|
subject = msg.getSubject()
|
||||||
if subject:
|
if subject:
|
||||||
self.dispatch('GC_SUBJECT', (str(msg.getFrom()), subject))
|
self.dispatch('GC_SUBJECT', (str(msg.getFrom()), subject))
|
||||||
|
@ -171,9 +171,9 @@ class connection:
|
||||||
prio = prs.getPriority()
|
prio = prs.getPriority()
|
||||||
if not prio:
|
if not prio:
|
||||||
prio = 0
|
prio = 0
|
||||||
typ = prs.getType()
|
ptype = prs.getType()
|
||||||
if typ == None: typ = 'available'
|
if ptype == None: ptype = 'available'
|
||||||
gajim.log.debug('PresenceCB : %s' % typ)
|
gajim.log.debug('PresenceCB : %s' % ptype)
|
||||||
xtags = prs.getXNodes()
|
xtags = prs.getXNodes()
|
||||||
sigTag = None
|
sigTag = None
|
||||||
keyID = ''
|
keyID = ''
|
||||||
|
@ -186,7 +186,7 @@ class connection:
|
||||||
#verify
|
#verify
|
||||||
sigmsg = sigTag.getData()
|
sigmsg = sigTag.getData()
|
||||||
keyID = self.gpg.verify(status, sigmsg)
|
keyID = self.gpg.verify(status, sigmsg)
|
||||||
if typ == 'available':
|
if ptype == 'available':
|
||||||
show = prs.getShow()
|
show = prs.getShow()
|
||||||
if not show:
|
if not show:
|
||||||
show = 'online'
|
show = 'online'
|
||||||
|
@ -194,12 +194,12 @@ class connection:
|
||||||
prs.getFrom().getResource(), prio, keyID, prs.getRole(), \
|
prs.getFrom().getResource(), prio, keyID, prs.getRole(), \
|
||||||
prs.getAffiliation(), prs.getJid(), prs.getReason(), \
|
prs.getAffiliation(), prs.getJid(), prs.getReason(), \
|
||||||
prs.getActor(), prs.getStatusCode()))
|
prs.getActor(), prs.getStatusCode()))
|
||||||
elif typ == 'unavailable':
|
elif ptype == 'unavailable':
|
||||||
self.dispatch('NOTIFY', (prs.getFrom().getStripped(), 'offline', \
|
self.dispatch('NOTIFY', (prs.getFrom().getStripped(), 'offline', \
|
||||||
status, prs.getFrom().getResource(), prio, keyID, prs.getRole(), \
|
status, prs.getFrom().getResource(), prio, keyID, prs.getRole(), \
|
||||||
prs.getAffiliation(), prs.getJid(), prs.getReason(), \
|
prs.getAffiliation(), prs.getJid(), prs.getReason(), \
|
||||||
prs.getActor(), prs.getStatusCode()))
|
prs.getActor(), prs.getStatusCode()))
|
||||||
elif typ == 'subscribe':
|
elif ptype == 'subscribe':
|
||||||
gajim.log.debug('subscribe request from %s' % who)
|
gajim.log.debug('subscribe request from %s' % who)
|
||||||
if gajim.config.get('alwaysauth') or who.find("@") <= 0:
|
if gajim.config.get('alwaysauth') or who.find("@") <= 0:
|
||||||
if self.connection:
|
if self.connection:
|
||||||
|
@ -212,19 +212,19 @@ class connection:
|
||||||
if not status:
|
if not status:
|
||||||
status = _('I would like to add you to my roster.')
|
status = _('I would like to add you to my roster.')
|
||||||
self.dispatch('SUBSCRIBE', (who, status))
|
self.dispatch('SUBSCRIBE', (who, status))
|
||||||
elif typ == 'subscribed':
|
elif ptype == 'subscribed':
|
||||||
jid = prs.getFrom()
|
jid = prs.getFrom()
|
||||||
self.dispatch('SUBSCRIBED', (jid.getStripped(), jid.getResource()))
|
self.dispatch('SUBSCRIBED', (jid.getStripped(), jid.getResource()))
|
||||||
self.dispatch('UPDUSER', (jid.getStripped(), jid.getNode(), \
|
self.dispatch('UPDUSER', (jid.getStripped(), jid.getNode(), \
|
||||||
['General'])))
|
['General'])))
|
||||||
#BE CAREFUL : no con.updateRosterItem() in a callback
|
#BE CAREFUL : no con.updateRosterItem() in a callback
|
||||||
gajim.log.debug('we are now subscribed to %s' % who)
|
gajim.log.debug('we are now subscribed to %s' % who)
|
||||||
elif typ == 'unsubscribe':
|
elif ptype == 'unsubscribe':
|
||||||
gajim.log.debug('unsubscribe request from %s' % who)
|
gajim.log.debug('unsubscribe request from %s' % who)
|
||||||
elif typ == 'unsubscribed':
|
elif ptype == 'unsubscribed':
|
||||||
gajim.log.debug('we are now unsubscribed to %s' % who)
|
gajim.log.debug('we are now unsubscribed to %s' % who)
|
||||||
self.dispatch('UNSUBSCRIBED', prs.getFrom().getStripped())
|
self.dispatch('UNSUBSCRIBED', prs.getFrom().getStripped())
|
||||||
elif typ == 'error':
|
elif ptype == 'error':
|
||||||
errmsg = prs.getError()
|
errmsg = prs.getError()
|
||||||
errcode = prs.getErrorCode()
|
errcode = prs.getErrorCode()
|
||||||
if errcode == '400': #Bad Request: JID Malformed or Private message when not allowed
|
if errcode == '400': #Bad Request: JID Malformed or Private message when not allowed
|
||||||
|
@ -474,11 +474,11 @@ class connection:
|
||||||
if self.connected == 2:
|
if self.connected == 2:
|
||||||
self.connected = STATUS_LIST.index(status)
|
self.connected = STATUS_LIST.index(status)
|
||||||
#send our presence
|
#send our presence
|
||||||
typ = 'available'
|
ptype = 'available'
|
||||||
if status == 'invisible':
|
if status == 'invisible':
|
||||||
typ = 'invisible'
|
ptype = 'invisible'
|
||||||
prio = gajim.config.get_per('accounts', self.name, 'priority')
|
prio = gajim.config.get_per('accounts', self.name, 'priority')
|
||||||
self.connection.sendPresence(typ, prio, status, msg, signed)
|
self.connection.sendPresence(ptype, prio, status, msg, signed)
|
||||||
self.dispatch('STATUS', status)
|
self.dispatch('STATUS', status)
|
||||||
#ask our VCard
|
#ask our VCard
|
||||||
iq = common.jabber.Iq(type='get')
|
iq = common.jabber.Iq(type='get')
|
||||||
|
@ -493,11 +493,11 @@ class connection:
|
||||||
self.dispatch('STATUS', 'offline')
|
self.dispatch('STATUS', 'offline')
|
||||||
elif status != 'offline' and self.connected:
|
elif status != 'offline' and self.connected:
|
||||||
self.connected = STATUS_LIST.index(status)
|
self.connected = STATUS_LIST.index(status)
|
||||||
typ = 'available'
|
ptype = 'available'
|
||||||
if status == 'invisible':
|
if status == 'invisible':
|
||||||
typ = 'invisible'
|
ptype = 'invisible'
|
||||||
prio = gajim.config.get_per('accounts', self.name, 'priority')
|
prio = gajim.config.get_per('accounts', self.name, 'priority')
|
||||||
self.connection.sendPresence(typ, prio, status, msg, signed)
|
self.connection.sendPresence(ptype, prio, status, msg, signed)
|
||||||
self.dispatch('STATUS', status)
|
self.dispatch('STATUS', status)
|
||||||
|
|
||||||
def send_message(jid, msg, keyID)
|
def send_message(jid, msg, keyID)
|
||||||
|
@ -653,12 +653,12 @@ class connection:
|
||||||
iq2.insertTag(i).putData(vcard[i])
|
iq2.insertTag(i).putData(vcard[i])
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
|
||||||
def send_agent_status(self, agent, typ):
|
def send_agent_status(self, agent, ptype):
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
return
|
return
|
||||||
if not typ:
|
if not ptype:
|
||||||
typ = 'available';
|
ptype = 'available';
|
||||||
p = common.jabber.Presence(to = agent, type = typ)
|
p = common.jabber.Presence(to = agent, type = ptype)
|
||||||
self.connection.send(p)
|
self.connection.send(p)
|
||||||
|
|
||||||
def join_gc(self, nick, room, server, passwd):
|
def join_gc(self, nick, room, server, passwd):
|
||||||
|
@ -687,12 +687,12 @@ class connection:
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
return
|
return
|
||||||
if show == 'offline':
|
if show == 'offline':
|
||||||
typ = 'unavailable'
|
ptype = 'unavailable'
|
||||||
show = None
|
show = None
|
||||||
else:
|
else:
|
||||||
typ = 'available'
|
ptype = 'available'
|
||||||
self.connection.send(common.jabber.Presence(to = '%s/%s' % (jid, nick), \
|
self.connection.send(common.jabber.Presence(to = '%s/%s' % (jid, nick), \
|
||||||
type = typ, show = show, status = status))
|
type = ptype, show = show, status = status))
|
||||||
|
|
||||||
def gc_set_role(self, room_jid, nick, role):
|
def gc_set_role(self, room_jid, nick, role):
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
|
|
Loading…
Add table
Reference in a new issue