Lame Mood and Activity support. Announcing caps.
This commit is contained in:
parent
e0c9b6309f
commit
512db7618b
|
@ -717,6 +717,7 @@ class ConnectionDisco:
|
|||
iq = iq_obj.buildReply('result')
|
||||
q = iq.getTag('query')
|
||||
if node:
|
||||
print node
|
||||
q.setAttr('node', node)
|
||||
q.addChild('identity', attrs = {'type': 'pc', 'category': 'client',
|
||||
'name': 'Gajim'})
|
||||
|
@ -732,6 +733,12 @@ class ConnectionDisco:
|
|||
q.addChild('feature', attrs = {'var': common.xmpp.NS_MUC})
|
||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_COMMANDS})
|
||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_DISCO_INFO})
|
||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_ACTIVITY})
|
||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_ACTIVITY + '+notify'})
|
||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_TUNE})
|
||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_TUNE + '+notify'})
|
||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_MOOD})
|
||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_MOOD + '+notify'})
|
||||
|
||||
if (node is None or extension == 'cstates') and gajim.config.get('outgoing_chat_state_notifactions') != 'disabled':
|
||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_CHATSTATES})
|
||||
|
@ -1509,14 +1516,17 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
|||
event = msg.getTag('event')
|
||||
|
||||
# XEP-0107: User Mood
|
||||
items = event.getTag('items', {'node': 'http://jabber.org/protocol/mood'})
|
||||
items = event.getTag('items', {'node': common.xmpp.NS_MOOD})
|
||||
if items: pep.user_mood(items, self.name, jid)
|
||||
# XEP-0118: User Tune
|
||||
items = event.getTag('items', {'node': 'http://jabber.org/protocol/tune'})
|
||||
items = event.getTag('items', {'node': common.xmpp.NS_TUNE})
|
||||
if items: pep.user_tune(items, self.name, jid)
|
||||
# XEP-0080: User Geolocation
|
||||
items = event.getTag('items', {'node': 'http://jabber.org/protocol/geoloc'})
|
||||
items = event.getTag('items', {'node': common.xmpp.NS_GEOLOC})
|
||||
if items: pep.user_geoloc(items, self.name, jid)
|
||||
# XEP-0108: User Activity
|
||||
items = event.getTag('items', {'node': common.xmpp.NS_ACTIVITY})
|
||||
if items: pep.user_activity(items, self.name, jid)
|
||||
|
||||
items = event.getTag('items')
|
||||
if items is None: return
|
||||
|
|
|
@ -18,7 +18,7 @@ import common.gajim
|
|||
|
||||
class Contact:
|
||||
'''Information concerning each contact'''
|
||||
def __init__(self, jid='', name='', groups=[], show='', status='', mood='', sub='',
|
||||
def __init__(self, jid='', name='', groups=[], show='', status='', mood='', activity='', sub='',
|
||||
ask='', resource='', priority=0, keyID='', our_chatstate=None,
|
||||
chatstate=None, last_status_time=None, msg_id = None, composing_jep = None):
|
||||
self.jid = jid
|
||||
|
@ -27,6 +27,7 @@ class Contact:
|
|||
self.show = show
|
||||
self.status = status
|
||||
self.mood = mood
|
||||
self.activity = activity
|
||||
self.sub = sub
|
||||
self.ask = ask
|
||||
self.resource = resource
|
||||
|
@ -140,18 +141,19 @@ class Contacts:
|
|||
del self._gc_contacts[account]
|
||||
del self._metacontacts_tags[account]
|
||||
|
||||
def create_contact(self, jid='', name='', groups=[], show='', status='', mood='',
|
||||
def create_contact(self, jid='', name='', groups=[], show='', status='', mood='', activity='',
|
||||
sub='', ask='', resource='', priority=0, keyID='', our_chatstate=None,
|
||||
chatstate=None, last_status_time=None, composing_jep=None):
|
||||
return Contact(jid, name, groups, show, status, mood, sub, ask, resource,
|
||||
return Contact(jid, name, groups, show, status, mood,
|
||||
activity, sub, ask, resource,
|
||||
priority, keyID, our_chatstate, chatstate, last_status_time,
|
||||
composing_jep)
|
||||
|
||||
def copy_contact(self, contact):
|
||||
return self.create_contact(jid = contact.jid, name = contact.name,
|
||||
groups = contact.groups, show = contact.show, status =
|
||||
contact.status, mood = contact.mood,
|
||||
sub = contact.sub, ask = contact.ask, resource = contact.resource,
|
||||
contact.status, mood = contact.mood, activity =
|
||||
contact.activity, sub = contact.sub, ask = contact.ask, resource = contact.resource,
|
||||
priority = contact.priority, keyID = contact.keyID,
|
||||
our_chatstate = contact.our_chatstate, chatstate = contact.chatstate,
|
||||
last_status_time = contact.last_status_time)
|
||||
|
|
|
@ -18,3 +18,16 @@ def user_tune(items, name, jid):
|
|||
|
||||
def user_geoloc(items, name, jid):
|
||||
pass
|
||||
|
||||
def user_activity(items, name, jid):
|
||||
contacts = gajim.contacts.get_contact(name, jid)
|
||||
for item in items.getTags('item'):
|
||||
child = item.getTag('activity')
|
||||
if child is not None:
|
||||
for ch in child.getChildren():
|
||||
if ch.getName() != 'text':
|
||||
for contact in contacts:
|
||||
contact.activity = ch.getName()
|
||||
else:
|
||||
for contact in contacts:
|
||||
contact.activity_text = ch.getData()
|
||||
|
|
|
@ -27,11 +27,14 @@ NS_AGENTS ='jabber:iq:agents'
|
|||
NS_AMP ='http://jabber.org/protocol/amp'
|
||||
NS_AMP_ERRORS =NS_AMP+'#errors'
|
||||
NS_AUTH ='jabber:iq:auth'
|
||||
NS_AVATAR ='http://www.xmpp.org/extensions/xep-0084.html#ns-metadata'
|
||||
NS_BIND ='urn:ietf:params:xml:ns:xmpp-bind'
|
||||
NS_BROWSE ='jabber:iq:browse'
|
||||
NS_BROWSING ='http://jabber.org/protocol/browsing' # XEP-0195
|
||||
NS_BYTESTREAM ='http://jabber.org/protocol/bytestreams' # JEP-0065
|
||||
NS_CAPS ='http://jabber.org/protocol/caps' # JEP-0115
|
||||
NS_CHATSTATES ='http://jabber.org/protocol/chatstates' # JEP-0085
|
||||
NS_CHATTING ='http://jabber.org/protocol/chatting' # XEP-0194
|
||||
NS_CLIENT ='jabber:client'
|
||||
NS_COMMANDS ='http://jabber.org/protocol/commands'
|
||||
NS_COMPONENT_ACCEPT='jabber:component:accept'
|
||||
|
@ -48,6 +51,7 @@ NS_ENCRYPTED ='jabber:x:encrypted' # JEP-00
|
|||
NS_EVENT ='jabber:x:event' # JEP-0022
|
||||
NS_FEATURE ='http://jabber.org/protocol/feature-neg'
|
||||
NS_FILE ='http://jabber.org/protocol/si/profile/file-transfer' # JEP-0096
|
||||
NS_GAMING ='http://jabber.org/protocol/gaming' # XEP-0196
|
||||
NS_GEOLOC ='http://jabber.org/protocol/geoloc' # JEP-0080
|
||||
NS_GROUPCHAT ='gc-1.0'
|
||||
NS_HTTP_AUTH ='http://jabber.org/protocol/http-auth' # JEP-0070
|
||||
|
@ -87,12 +91,14 @@ NS_STREAMS ='http://etherx.jabber.org/streams'
|
|||
NS_TIME ='jabber:iq:time' # JEP-0900
|
||||
NS_TIME_REVISED ='http://www.xmpp.org/extensions/xep-0202.html#ns' # JEP-0202
|
||||
NS_TLS ='urn:ietf:params:xml:ns:xmpp-tls'
|
||||
NS_TUNE ='http://jabber.org/protocol/tune' # XEP-0118
|
||||
NS_VACATION ='http://jabber.org/protocol/vacation'
|
||||
NS_VCARD ='vcard-temp'
|
||||
NS_GMAILNOTIFY ='google:mail:notify'
|
||||
NS_GTALKSETTING ='google:setting'
|
||||
NS_VCARD_UPDATE =NS_VCARD+':x:update'
|
||||
NS_VERSION ='jabber:iq:version'
|
||||
NS_VIEWING ='http://jabber.org/protocol/viewing' # XEP--197
|
||||
NS_PING ='urn:xmpp:ping' # XEP-0199
|
||||
NS_WAITINGLIST ='http://jabber.org/protocol/waitinglist' # JEP-0130
|
||||
NS_XHTML_IM ='http://jabber.org/protocol/xhtml-im' # JEP-0071
|
||||
|
|
|
@ -482,9 +482,14 @@ class RosterTooltip(NotificationAreaTooltip):
|
|||
mood = contact.mood.strip()
|
||||
mood_text = contact.mood_text.strip()
|
||||
if mood:
|
||||
#print mood
|
||||
properties.append(('<b>%s:</b> %s' % (mood, mood_text), None))
|
||||
|
||||
if contact.activity:
|
||||
activity = contact.activity.strip()
|
||||
activity_text = contact.activity_text.strip()
|
||||
if activity:
|
||||
properties.append(('<b>%s:</b> %s' % (activity, activity_text), None))
|
||||
|
||||
if contact.status:
|
||||
status = contact.status.strip()
|
||||
if status:
|
||||
|
|
Loading…
Reference in New Issue