Mercurial > libervia-backend
changeset 1466:2184d5f496b5
plugin XEP-0045: added disco announce
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 18 Aug 2015 09:01:18 +0200 (2015-08-18) |
parents | cbf38047ca60 |
children | ceba6fd77739 |
files | src/plugins/plugin_xep_0045.py |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 []