Skip to content
Snippets Groups Projects
Commit 5f9eab3c authored by Piotr Gaczkowski's avatar Piotr Gaczkowski
Browse files

First buggy commit

parent ada5753c
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ from common import GnuPG ...@@ -34,6 +34,7 @@ from common import GnuPG
from common import helpers from common import helpers
from common import gajim from common import gajim
from common import atom from common import atom
from common import pep
from common.commands import ConnectionCommands from common.commands import ConnectionCommands
from common.pubsub import ConnectionPubSub from common.pubsub import ConnectionPubSub
...@@ -1504,8 +1505,19 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, ...@@ -1504,8 +1505,19 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
''' Called when we receive <message/> with pubsub event. ''' ''' Called when we receive <message/> with pubsub event. '''
# TODO: Logging? (actually services where logging would be useful, should # TODO: Logging? (actually services where logging would be useful, should
# TODO: allow to access archives remotely...) # TODO: allow to access archives remotely...)
jid = msg.getAttr('from')
event = msg.getTag('event') event = msg.getTag('event')
# XEP-0107: User Mood
items = event.getTag('items', {'node': 'http://jabber.org/protocol/mood'})
if items: pep.user_mood(items, self.name, jid)
# XEP-0118: User Tune
items = event.getTag('items', {'node': 'http://jabber.org/protocol/tune'})
if items: pep.user_tune(items, self.name, jid)
# XEP-0080: User Geolocation
items = event.getTag('items', {'node': 'http://jabber.org/protocol/geoloc'})
if items: pep.user_geoloc(items, self.name, jid)
items = event.getTag('items') items = event.getTag('items')
if items is None: return if items is None: return
......
...@@ -43,6 +43,49 @@ class ConnectionPubSub: ...@@ -43,6 +43,49 @@ class ConnectionPubSub:
self.connection.send(query) self.connection.send(query)
def send_pb_delete(self, jid, node):
'''Deletes node.'''
query = xmpp.Iq('set', to=jid)
d = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
d = d.addChild('delete', {'node': node})
self.connection.send(query)
def send_pb_create(self, jid, node, configure = False, configure_form = None):
'''Creates new node.'''
query = xmpp.Iq('set', to=jid)
c = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
c = c.addChild('create', {'node': node})
if configure:
conf = c.addChild('configure')
if configure_form is not None:
conf.addChild(node=configuration_form)
self.connection.send(query)
def send_pb_configure(self, jid, node, cb, *cbargs, **cbkwargs):
query = xmpp.Iq('set', to=jid)
c = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
c = c.addChild('configure', {'node': node})
id = self.connection.send(query)
def on_configure(self, connection, query):
try:
filledform = cb(stanza['pubsub']['configure']['x'], *cbargs, **cbkwargs)
#TODO: Build a form
#TODO: Send it
except CancelConfigure:
cancel = xmpp.Iq('set', to=jid)
ca = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
ca = ca.addChild('configure', {'node': node})
#ca = ca.addChild('x', namespace=xmpp.NS_DATA, {'type': 'cancel'})
self.connection.send(cancel)
self.__callbacks[id] = (on_configure, (), {})
def _PubSubCB(self, conn, stanza): def _PubSubCB(self, conn, stanza):
try: try:
cb, args, kwargs = self.__callbacks.pop(stanza.getID()) cb, args, kwargs = self.__callbacks.pop(stanza.getID())
......
...@@ -478,6 +478,13 @@ class RosterTooltip(NotificationAreaTooltip): ...@@ -478,6 +478,13 @@ class RosterTooltip(NotificationAreaTooltip):
show = '<i>' + show + '</i>' show = '<i>' + show + '</i>'
# we append show below # we append show below
if contact.mood:
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.status: if contact.status:
status = contact.status.strip() status = contact.status.strip()
if status: if status:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment