add gajim caps, fixes #608
This commit is contained in:
parent
1e6c848761
commit
36426778f0
2 changed files with 15 additions and 5 deletions
|
@ -463,7 +463,7 @@ class Connection(ConnectionHandlers):
|
|||
self.activate_privacy_rule('invisible')
|
||||
prio = unicode(gajim.config.get_per('accounts', self.name, 'priority'))
|
||||
p = common.xmpp.Presence(typ = ptype, priority = prio, show = show)
|
||||
p = self.add_sha(p)
|
||||
p = self.add_sha(p, ptype != 'unavailable')
|
||||
if msg:
|
||||
p.setStatus(msg)
|
||||
if signed:
|
||||
|
@ -553,7 +553,7 @@ class Connection(ConnectionHandlers):
|
|||
if self.connection:
|
||||
self.on_purpose = True
|
||||
p = common.xmpp.Presence(typ = 'unavailable')
|
||||
p = self.add_sha(p)
|
||||
p = self.add_sha(p, False)
|
||||
if msg:
|
||||
p.setStatus(msg)
|
||||
self.remove_all_transfers()
|
||||
|
@ -865,7 +865,7 @@ class Connection(ConnectionHandlers):
|
|||
if not self.connection:
|
||||
return
|
||||
p = common.xmpp.Presence(to = agent, typ = ptype)
|
||||
p = self.add_sha(p)
|
||||
p = self.add_sha(p, ptype != 'unavailable')
|
||||
self.connection.send(p)
|
||||
|
||||
def join_gc(self, nick, room, server, password):
|
||||
|
@ -928,7 +928,7 @@ class Connection(ConnectionHandlers):
|
|||
p = common.xmpp.Presence(to = '%s/%s' % (jid, nick), typ = ptype,
|
||||
show = show, status = status)
|
||||
if gajim.config.get('send_sha_in_gc_presence'):
|
||||
p = self.add_sha(p)
|
||||
p = self.add_sha(p, ptype != 'unavailable')
|
||||
# send instantly so when we go offline, status is sent to gc before we
|
||||
# disconnect from jabber server
|
||||
self.connection.send(p)
|
||||
|
|
|
@ -752,10 +752,20 @@ class ConnectionVcard:
|
|||
self.vcard_shas = {} # sha of contacts
|
||||
self.room_jids = [] # list of gc jids so that vcard are saved in a folder
|
||||
|
||||
def add_sha(self, p):
|
||||
def add_sha(self, p, send_caps = True):
|
||||
c = p.setTag('x', namespace = common.xmpp.NS_VCARD_UPDATE)
|
||||
if self.vcard_sha is not None:
|
||||
c.setTagData('photo', self.vcard_sha)
|
||||
if send_caps:
|
||||
return self.add_caps(p)
|
||||
return p
|
||||
|
||||
def add_caps(self, p):
|
||||
''' advertise our capabilities in presence stanza (jep-0115)'''
|
||||
c = p.setTag('c', namespace = common.xmpp.NS_CAPS)
|
||||
c.setAttr('node', 'http://gajim.org/caps')
|
||||
c.setAttr('ext', 'ftrans')
|
||||
c.setAttr('ver', gajim.version)
|
||||
return p
|
||||
|
||||
def node_to_dict(self, node):
|
||||
|
|
Loading…
Add table
Reference in a new issue