core: added plugins for PubSub et PEP (first drafts)

- plugin for XEP 0060, 0163 and 0107, based on Wokkel's pubsub
- XEP 0115 plugin has been fixed, so generateHash can be called when features have changed (can be usefull to filter PEP)
This commit is contained in:
Goffi 2011-02-03 18:06:25 +01:00
commit c71fc3ab02

View file

@ -96,17 +96,20 @@ class XEP_0115():
"""modify SatPresenceProtocol to add capabilities data"""
client=self.host.getClient(profile)
presenceInst = client.presence
c_elt = domish.Element((NS_ENTITY_CAPABILITY,'c'))
c_elt['hash']='sha-1'
c_elt['node']='http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi'
c_elt['ver']=XEP_0115.cap_hash
presenceInst._c_elt = c_elt
if "_legacy_send" in dir(presenceInst):
debug('capabilities already added to presence instance')
return
def hacked_send(self, obj):
obj.addChild(self._c_elt)
self._legacy_send(obj)
new_send = types.MethodType(hacked_send, presenceInst, presenceInst.__class__)
presenceInst._legacy_send = presenceInst.send
presenceInst.send = new_send
c_elt = domish.Element((NS_ENTITY_CAPABILITY,'c'))
c_elt['hash']='sha-1'
c_elt['node']='http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi'
c_elt['ver']=XEP_0115.cap_hash
presenceInst._c_elt = c_elt
def generateHash(self, profile_key="@DEFAULT@"):