annotate sat_pubsub/mam.py @ 281:30895c49ebd2

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