plugin XEP-0277: added microblog namespace to disco info
This commit is contained in:
parent
2964a74dda
commit
6ad80151f9
1 changed files with 17 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ from sat.core.constants import Const as C
|
|||
from sat.core.log import getLogger
|
||||
log = getLogger(__name__)
|
||||
from twisted.words.protocols.jabber import jid, error
|
||||
from twisted.words.protocols.jabber.xmlstream import XMPPHandler
|
||||
from twisted.words.xish import domish
|
||||
from twisted.internet import defer
|
||||
from twisted.python import failure
|
||||
|
|
@ -33,6 +34,8 @@ from sat.tools.common import data_format
|
|||
|
||||
# XXX: tmp.pubsub is actually used instead of wokkel version
|
||||
from wokkel import pubsub
|
||||
from wokkel import disco, iwokkel
|
||||
from zope.interface import implements
|
||||
import uuid
|
||||
import time
|
||||
import dateutil
|
||||
|
|
@ -53,7 +56,7 @@ PLUGIN_INFO = {
|
|||
C.PI_DEPENDENCIES: ["XEP-0163", "XEP-0060", "TEXT-SYNTAXES"],
|
||||
C.PI_RECOMMENDATIONS: ["XEP-0059", "EXTRA-PEP"],
|
||||
C.PI_MAIN: "XEP_0277",
|
||||
C.PI_HANDLER: "no",
|
||||
C.PI_HANDLER: "yes",
|
||||
C.PI_DESCRIPTION: _("""Implementation of microblogging Protocol""")
|
||||
}
|
||||
|
||||
|
|
@ -98,6 +101,9 @@ class XEP_0277(object):
|
|||
host.bridge.addMethod("mbGetFromManyWithComments", ".plugin", in_sign='sasiia{ss}a{ss}s', out_sign='s',
|
||||
method=self._mbGetFromManyWithComments)
|
||||
|
||||
def getHandler(self, client):
|
||||
return XEP_0277_handler()
|
||||
|
||||
def _checkFeaturesCb(self, available):
|
||||
return {'available': C.BOOL_TRUE}
|
||||
|
||||
|
|
@ -934,3 +940,13 @@ class XEP_0277(object):
|
|||
d.addErrback(lambda failure: (unicode(failure.value), ([],{})))
|
||||
|
||||
return self.rt_sessions.newSession(deferreds, client.profile)
|
||||
|
||||
|
||||
class XEP_0277_handler(XMPPHandler):
|
||||
implements(iwokkel.IDisco)
|
||||
|
||||
def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
|
||||
return [disco.DiscoFeature(NS_MICROBLOG)]
|
||||
|
||||
def getDiscoItems(self, requestor, target, nodeIdentifier=''):
|
||||
return []
|
||||
|
|
|
|||
Loading…
Reference in a new issue