plugin XEP-0045: added disco announce

This commit is contained in:
Goffi 2015-08-18 09:01:18 +02:00
commit d12df6c98e

View file

@ -30,9 +30,11 @@ from sat.memory import memory
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 @@ PLUGIN_INFO = {
"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 XEP_0045(object):
class SatMUCClient (muc.MUCClient):
# implements(iwokkel.IDisco)
implements(iwokkel.IDisco)
def __init__(self, plugin_parent):
self.plugin_parent = plugin_parent
@ -749,3 +752,11 @@ class SatMUCClient (muc.MUCClient):
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 []