Mercurial > sat_tmp
annotate wokkel/delay.py @ 6:dc3a3f454f39
tmp (wokkel): licenses fixes:
the licenses headers were wrong, it was fixed: original work from Adrien Cossa is directly under AGPL v3 (with his agreement), work derivated from Wokkel is sublicensed to AGPL v3 as allowed by the original license, to stay consistent with the rest of the code base.
Theses files (and only these ones) can be relicensed again to fill Wokkel license if Ralph plan to merge them upstream...
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 23 Apr 2015 10:57:40 +0200 |
parents | 09e7c32a6a00 |
children | a07bf3fb4b54 |
rev | line source |
---|---|
0
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1 # -*- test-case-name: wokkel.test.test_delay -*- |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
2 # |
6 | 3 # SàT adaptation for wokkel.delay |
4 # Copyright (C) 2015 Adien Cossa (souliane@mailoo.org) | |
5 # Copyright (c) 2003-2012 Ralph Meijer. | |
6 | |
7 # This program is free software: you can redistribute it and/or modify | |
8 # it under the terms of the GNU Affero General Public License as published by | |
9 # the Free Software Foundation, either version 3 of the License, or | |
10 # (at your option) any later version. | |
11 | |
12 # This program is distributed in the hope that it will be useful, | |
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 # GNU Affero General Public License for more details. | |
16 | |
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/>. | |
19 # -- | |
20 | |
21 # This program is based on wokkel (https://wokkel.ik.nu/), | |
22 # originaly written by Ralph Meijer | |
23 # It is sublicensed under AGPL v3 (or any later version) as allowed by the original | |
24 # license. | |
25 | |
26 # -- | |
27 | |
28 # Here is a copy of the original license: | |
29 | |
30 # Copyright (c) 2003-2012 Ralph Meijer. | |
31 # | |
32 # Permission is hereby granted, free of charge, to any person obtaining | |
33 # a copy of this software and associated documentation files (the | |
34 # "Software"), to deal in the Software without restriction, including | |
35 # without limitation the rights to use, copy, modify, merge, publish, | |
36 # distribute, sublicense, and/or sell copies of the Software, and to | |
37 # permit persons to whom the Software is furnished to do so, subject to | |
38 # the following conditions: | |
39 # | |
40 # The above copyright notice and this permission notice shall be | |
41 # included in all copies or substantial portions of the Software. | |
42 # | |
43 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
44 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
45 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
46 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
47 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
48 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
49 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
50 # | |
0
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
51 # Copyright (c) Ralph Meijer. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
52 # See LICENSE for details. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
53 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
54 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
55 Delayed Delivery. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
56 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
57 Support for comunicating Delayed Delivery information as specified by |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
58 U{XEP-0203<http://xmpp.org/extensions/xep-0203.html>} and its predecessor |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
59 U{XEP-0091<http://xmpp.org/extensions/xep-0091.html>}. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
60 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
61 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
62 from dateutil.parser import parse |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
63 from dateutil.tz import tzutc |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
64 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
65 from twisted.words.protocols.jabber.jid import InvalidFormat, JID |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
66 from twisted.words.xish import domish |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
67 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
68 NS_DELAY = 'urn:xmpp:delay' |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
69 NS_JABBER_DELAY = 'jabber:x:delay' |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
70 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
71 class Delay(object): |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
72 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
73 Delayed Delivery information. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
74 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
75 Instances of this class represent delayed delivery information that can be |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
76 parsed from and rendered into both XEP-0203 and legacy XEP-0091 formats. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
77 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
78 @ivar stamp: The timestamp the stanza was originally sent. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
79 @type stamp: L{datetime.datetime} |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
80 @ivar sender: The optional entity that originally sent the stanza or |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
81 delayed its delivery. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
82 @type sender: L{JID} |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
83 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
84 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
85 def __init__(self, stamp, sender=None): |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
86 self.stamp = stamp |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
87 self.sender = sender |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
88 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
89 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
90 def toElement(self, legacy=False): |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
91 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
92 Render this instance into a domish Element. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
93 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
94 @param legacy: If C{True}, use the legacy XEP-0091 format. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
95 @type legacy: C{bool} |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
96 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
97 if not self.stamp: |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
98 raise ValueError("stamp is required") |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
99 if self.stamp.tzinfo is None: |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
100 raise ValueError("stamp is not offset-aware") |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
101 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
102 if legacy: |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
103 element = domish.Element((NS_JABBER_DELAY, 'x')) |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
104 stampFormat = '%Y%m%dT%H:%M:%S' |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
105 else: |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
106 element = domish.Element((NS_DELAY, 'delay')) |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
107 stampFormat = '%Y-%m-%dT%H:%M:%SZ' |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
108 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
109 stamp = self.stamp.astimezone(tzutc()) |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
110 element['stamp'] = stamp.strftime(stampFormat) |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
111 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
112 if self.sender: |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
113 element['from'] = self.sender.full() |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
114 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
115 return element |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
116 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
117 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
118 @staticmethod |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
119 def fromElement(element): |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
120 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
121 Create an instance from a domish Element. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
122 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
123 try: |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
124 stamp = parse(element[u'stamp']) |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
125 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
126 # Assume UTC if no timezone was given |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
127 if stamp.tzinfo is None: |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
128 stamp = stamp.replace(tzinfo=tzutc()) |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
129 except (KeyError, ValueError, TypeError): |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
130 stamp = None |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
131 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
132 try: |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
133 sender = JID(element[u'from']) |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
134 except (KeyError, InvalidFormat): |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
135 sender = None |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
136 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
137 delay = Delay(stamp, sender) |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
138 return delay |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
139 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
140 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
141 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
142 class DelayMixin(object): |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
143 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
144 Mixin for parsing delayed delivery information from stanzas. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
145 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
146 This can be used as a mixin for subclasses of L{wokkel.generic.Stanza} |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
147 for parsing delayed delivery information. If both XEP-0203 and XEP-0091 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
148 formats are present, the former takes precedence. |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
149 """ |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
150 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
151 delay = None |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
152 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
153 childParsers = { |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
154 (NS_DELAY, 'delay'): '_childParser_delay', |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
155 (NS_JABBER_DELAY, 'x'): '_childParser_legacyDelay', |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
156 } |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
157 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
158 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
159 def _childParser_delay(self, element): |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
160 self.delay = Delay.fromElement(element) |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
161 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
162 |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
163 def _childParser_legacyDelay(self, element): |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
164 if not self.delay: |
09e7c32a6a00
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
165 self.delay = Delay.fromElement(element) |