First buggy commit

This commit is contained in:
Piotr Gaczkowski 2007-03-25 22:16:48 +00:00
parent ada5753cb9
commit 5f9eab3c62
3 changed files with 62 additions and 0 deletions

View File

@ -34,6 +34,7 @@ from common import GnuPG
from common import helpers
from common import gajim
from common import atom
from common import pep
from common.commands import ConnectionCommands
from common.pubsub import ConnectionPubSub
@ -1504,8 +1505,19 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
''' Called when we receive <message/> with pubsub event. '''
# TODO: Logging? (actually services where logging would be useful, should
# TODO: allow to access archives remotely...)
jid = msg.getAttr('from')
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')
if items is None: return

View File

@ -43,6 +43,49 @@ class ConnectionPubSub:
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):
try:
cb, args, kwargs = self.__callbacks.pop(stanza.getID())

View File

@ -478,6 +478,13 @@ class RosterTooltip(NotificationAreaTooltip):
show = '<i>' + show + '</i>'
# 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:
status = contact.status.strip()
if status: