comparison sat_pubsub/mam.py @ 280:798cb8962c0b

MAM (XEP-0313) support: first draft
author souliane <souliane@mailoo.org>
date Fri, 09 Jan 2015 10:57:10 +0100
parents
children 30895c49ebd2
comparison
equal deleted inserted replaced
279:7c820a8e4b00 280:798cb8962c0b
1 #!/usr/bin/python
2 #-*- coding: utf-8 -*-
3
4 """
5 XMPP Message Archive Management protocol.
6
7 This protocol is specified in
8 U{XEP-0313<http://xmpp.org/extensions/xep-0313.html>}.
9 """
10
11 from zope.interface import implements
12 from wokkel.mam import MAMPrefs, IMAMResource
13 from wokkel.rsm import RSMResponse
14
15
16 class MAMResource(object):
17
18 implements(IMAMResource)
19
20 def onArchiveRequest(self, mam, rsm, requestor):
21 """
22
23 @param mam: The MAM <query/> request.
24 @type mam: L{MAMQueryReques<wokkel.mam.MAMQueryRequest>}
25
26 @param rsm: The RSM request.
27 @type rsm: L{RSMRequest<wokkel.rsm.RSMRequest>}
28
29 @param requestor: JID of the requestor.
30 @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}
31
32 @return: The RSM answer.
33 @rtype: L{RSMResponse<wokkel.rsm.RSMResponse>}
34 """
35 # TODO: send the archived messages
36 return RSMResponse()
37
38 def onPrefsGetRequest(self, requestor):
39 """
40
41 @param requestor: JID of the requestor.
42 @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}
43
44 @return: The current settings.
45 @rtype: L{wokkel.mam.MAMPrefs}
46 """
47 # TODO: return the actual current settings
48 return MAMPrefs()
49
50 def onPrefsSetRequest(self, prefs, requestor):
51 """
52
53 @param prefs: The new settings to set.
54 @type prefs: L{wokkel.mam.MAMPrefs}
55
56 @param requestor: JID of the requestor.
57 @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}
58
59 @return: The settings that have actually been set.
60 @rtype: L{wokkel.mam.MAMPrefs}
61 """
62 # TODO: set the new settings and return them
63 return MAMPrefs()