plugins groupblog (xep-0060, xep-0277): added blog item modification/deletion

This commit is contained in:
souliane 2013-12-10 09:02:20 +01:00
commit 481bee01c2

View file

@ -18,9 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from logging import debug, info, error
from wokkel.pubsub import PubSubRequest
from wokkel import disco, pubsub
from zope.interface import implements
PLUGIN_INFO = {
@ -119,6 +118,10 @@ class XEP_0060(object):
profile, client = self.__getClientNProfile(profile_key, 'delete node')
return client.deleteNode(service, nodeIdentifier)
def retractItems(self, service, nodeIdentifier, itemIdentifiers, profile_key='@DEFAULT@'):
profile, client = self.__getClientNProfile(profile_key, 'retract items')
return client.retractItems(service, nodeIdentifier, itemIdentifiers)
def subscribe(self, service, nodeIdentifier, sub_jid=None, options=None, profile_key='@DEFAULT@'):
profile, client = self.__getClientNProfile(profile_key, 'subscribe node')
return client.subscribe(service, nodeIdentifier, sub_jid or client.parent.jid.userhostJID(), options=options)
@ -135,6 +138,25 @@ class SatPubSubClient(pubsub.PubSubClient):
def connectionInitialized(self):
pubsub.PubSubClient.connectionInitialized(self)
# XXX: this should be done in wokkel
def retractItems(self, service, nodeIdentifier, itemIdentifiers, sender=None):
"""
Retract items from a publish subscribe node.
@param service: The publish subscribe service to delete the node from.
@type service: L{JID<twisted.words.protocols.jabber.jid.JID>}
@param nodeIdentifier: The identifier of the node.
@type nodeIdentifier: C{unicode}
@param itemIdentifiers: Identifiers of the items to be retracted.
@type itemIdentifiers: C{set}
"""
request = PubSubRequest('retract')
request.recipient = service
request.nodeIdentifier = nodeIdentifier
request.itemIdentifiers = itemIdentifiers
request.sender = sender
return request.send(self.xmlstream)
def itemsReceived(self, event):
if not self.host.trigger.point("PubSubItemsReceived", event, self.parent.profile):
return