comparison src/plugins/plugin_xep_0060.py @ 615:6f4c31192c7c

plugins XEP-0060, XEP-0277, groupblog: comments implementation (first draft, not finished yet): - PubSub options constants are moved to XEP-0060 - comments url are generated/parsed according to XEP-0277 - microblog data can now have the following keys: - "comments", with the url as given in the <link> tag - "comments_service", with the jid of the PubSub service hosting the comments - "comments_node", with the parsed node - comments nodes use different access_model according to parent microblog item access - publisher is not verified yet, see FIXME warning - so far, comments node are automatically subscribed - some bug fixes
author Goffi <goffi@goffi.org>
date Mon, 20 May 2013 23:21:29 +0200
parents 84a6e83157c2
children 3c304929af74
comparison
equal deleted inserted replaced
614:bef0f893482f 615:6f4c31192c7c
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from logging import debug, info, error 20 from logging import debug, info, error
21 from twisted.internet import protocol
22 from twisted.words.protocols.jabber import client, jid
23 from twisted.words.protocols.jabber import error as jab_error
24 import twisted.internet.error
25 21
26 from wokkel import disco, iwokkel, pubsub 22 from wokkel import disco, pubsub
27 23
28 from zope.interface import implements 24 from zope.interface import implements
29 25
30 PLUGIN_INFO = { 26 PLUGIN_INFO = {
31 "name": "Publish-Subscribe", 27 "name": "Publish-Subscribe",
38 "description": _("""Implementation of PubSub Protocol""") 34 "description": _("""Implementation of PubSub Protocol""")
39 } 35 }
40 36
41 37
42 class XEP_0060(object): 38 class XEP_0060(object):
39 OPT_ACCESS_MODEL = 'pubsub#access_model'
40 OPT_PERSIST_ITEMS = 'pubsub#persist_items'
41 OPT_MAX_ITEMS = 'pubsub#max_items'
42 OPT_DELIVER_PAYLOADS = 'pubsub#deliver_payloads'
43 OPT_SEND_ITEM_SUBSCRIBE = 'pubsub#send_item_subscribe'
44 OPT_NODE_TYPE = 'pubsub#node_type'
45 OPT_SUBSCRIPTION_TYPE = 'pubsub#subscription_type'
46 OPT_SUBSCRIPTION_DEPTH = 'pubsub#subscription_depth'
47 OPT_ROSTER_GROUPS_ALLOWED = 'pubsub#roster_groups_allowed'
48 OPT_PUBLISH_MODEL = 'pubsub#publish_model'
43 49
44 def __init__(self, host): 50 def __init__(self, host):
45 info(_("PubSub plugin initialization")) 51 info(_("PubSub plugin initialization"))
46 self.host = host 52 self.host = host
47 self.managedNodes = [] 53 self.managedNodes = []
138 144
139 def deleteReceived(self, event): 145 def deleteReceived(self, event):
140 #TODO: manage delete event 146 #TODO: manage delete event
141 debug(_("Publish node deleted")) 147 debug(_("Publish node deleted"))
142 148
143 def purgeReceived(self, event): 149 # def purgeReceived(self, event):
144 import pdb 150
145 pdb.set_trace() 151
146 152
147 def getDiscoInfo(self, requestor, target, nodeIdentifier=''): 153 def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
148 _disco_info = [] 154 _disco_info = []
149 self.host.trigger.point("PubSub Disco Info", _disco_info, self.parent.profile) 155 self.host.trigger.point("PubSub Disco Info", _disco_info, self.parent.profile)
150 return _disco_info 156 return _disco_info