Mercurial > libervia-pubsub
comparison idavoll/pubsub.py @ 122:8527bce09862
Changed to adapt to new API of backend's add_subscription.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Tue, 12 Apr 2005 12:27:17 +0000 |
parents | 7043839982ba |
children | 3d77f3808bfa |
comparison
equal
deleted
inserted
replaced
121:4f0113adb7ed | 122:8527bce09862 |
---|---|
266 except KeyError: | 266 except KeyError: |
267 raise BadRequest | 267 raise BadRequest |
268 | 268 |
269 requestor = jid.JID(iq["from"]).userhostJID() | 269 requestor = jid.JID(iq["from"]).userhostJID() |
270 d = self.backend.subscribe(node_id, subscriber, requestor) | 270 d = self.backend.subscribe(node_id, subscriber, requestor) |
271 d.addCallback(self.return_subscription) | 271 d.addCallback(self.return_subscription, subscriber) |
272 return d | 272 return d |
273 | 273 |
274 def return_subscription(self, result): | 274 def return_subscription(self, result, subscriber): |
275 reply = domish.Element((NS_PUBSUB, "pubsub")) | 275 reply = domish.Element((NS_PUBSUB, "pubsub")) |
276 entity = reply.addElement("entity") | 276 entity = reply.addElement("entity") |
277 entity["node"] = result["node"] | 277 entity["node"] = result["node"] |
278 entity["jid"] = result["jid"].full() | 278 entity["jid"] = subscriber.full() |
279 entity["affiliation"] = result["affiliation"] or 'none' | 279 entity["affiliation"] = result["affiliation"] or 'none' |
280 entity["subscription"] = result["subscription"] | 280 entity["subscription"] = result["subscription"] |
281 return [reply] | 281 return [reply] |
282 | 282 |
283 def onUnsubscribe(self, iq): | 283 def onUnsubscribe(self, iq): |