# HG changeset patch # User Goffi # Date 1439881278 -7200 # Node ID 2184d5f496b5ddbf3aadd426ac47acb3cc7c9f83 # Parent cbf38047ca60d9ab7f3518be1973069e550cae18 plugin XEP-0045: added disco announce diff -r cbf38047ca60 -r 2184d5f496b5 src/plugins/plugin_xep_0045.py --- a/src/plugins/plugin_xep_0045.py Tue Aug 18 09:01:18 2015 +0200 +++ b/src/plugins/plugin_xep_0045.py Tue Aug 18 09:01:18 2015 +0200 @@ -30,9 +30,11 @@ import uuid import copy -from wokkel import muc +from wokkel import muc, disco, iwokkel from sat.tools import xml_tools +from zope.interface import implements + PLUGIN_INFO = { "name": "XEP 0045 Plugin", @@ -46,6 +48,7 @@ "description": _("""Implementation of Multi-User Chat""") } +NS_MUC = 'http://jabber.org/protocol/muc' AFFILIATIONS = ('owner', 'admin', 'member', 'none', 'outcast') CONFIG_SECTION = u'plugin muc' @@ -663,7 +666,7 @@ class SatMUCClient (muc.MUCClient): - # implements(iwokkel.IDisco) + implements(iwokkel.IDisco) def __init__(self, plugin_parent): self.plugin_parent = plugin_parent @@ -749,3 +752,11 @@ log.debug(_(u"New subject for room (%(room_id)s): %(subject)s") % {'room_id': room.roomJID.full(), 'subject': subject}) self.rec_subjects[room.roomJID.userhost()] = (room.roomJID.userhost(), subject) self.host.bridge.roomNewSubject(room.roomJID.userhost(), subject, self.parent.profile) + + def getDiscoInfo(self, requestor, target, nodeIdentifier=''): + return [disco.DiscoFeature(NS_MUC)] + + def getDiscoItems(self, requestor, target, nodeIdentifier=''): + # TODO: manage room queries ? Bad for privacy, must be disabled by default + # see XEP-0045 ยง 6.7 + return []