| ... |
... |
@@ -25,6 +25,7 @@ from nbxmpp.protocol import DataForm |
|
25
|
25
|
from nbxmpp.protocol import DataField
|
|
26
|
26
|
from nbxmpp.protocol import NodeProcessed
|
|
27
|
27
|
from nbxmpp.protocol import StanzaMalformed
|
|
|
28
|
+from nbxmpp.structs import MucSubject
|
|
28
|
29
|
from nbxmpp.structs import StanzaHandler
|
|
29
|
30
|
from nbxmpp.const import InviteType
|
|
30
|
31
|
from nbxmpp.const import MessageType
|
| ... |
... |
@@ -79,9 +80,13 @@ class MUC(BaseModule): |
|
79
|
80
|
ns=Namespace.MUC_USER,
|
|
80
|
81
|
priority=11),
|
|
81
|
82
|
StanzaHandler(name='message',
|
|
82
|
|
- callback=self._process_groupchat_message,
|
|
|
83
|
+ callback=self._process_message_before_decryption,
|
|
83
|
84
|
typ='groupchat',
|
|
84
|
85
|
priority=6),
|
|
|
86
|
+ StanzaHandler(name='message',
|
|
|
87
|
+ callback=self._process_message_after_decryption,
|
|
|
88
|
+ typ='groupchat',
|
|
|
89
|
+ priority=16),
|
|
85
|
90
|
StanzaHandler(name='message',
|
|
86
|
91
|
callback=self._process_mediated_invite,
|
|
87
|
92
|
typ='normal',
|
| ... |
... |
@@ -182,7 +187,7 @@ class MUC(BaseModule): |
|
182
|
187
|
self._log.warning(stanza)
|
|
183
|
188
|
raise NodeProcessed
|
|
184
|
189
|
|
|
185
|
|
- def _process_groupchat_message(self, _client, stanza, properties):
|
|
|
190
|
+ def _process_message_before_decryption(self, _client, stanza, properties):
|
|
186
|
191
|
properties.from_muc = True
|
|
187
|
192
|
properties.muc_jid = properties.jid.new_as_bare()
|
|
188
|
193
|
properties.muc_nickname = properties.jid.resource
|
| ... |
... |
@@ -203,6 +208,13 @@ class MUC(BaseModule): |
|
203
|
208
|
if address is not None:
|
|
204
|
209
|
properties.muc_ofrom = JID.from_string(address.getAttr('jid'))
|
|
205
|
210
|
|
|
|
211
|
+ def _process_message_after_decryption(self, _client, stanza, properties):
|
|
|
212
|
+ if properties.body is None and properties.subject:
|
|
|
213
|
+ properties.muc_subject = MucSubject(
|
|
|
214
|
+ text=properties.subject,
|
|
|
215
|
+ author=properties.muc_nickname,
|
|
|
216
|
+ timestamp=properties.user_timestamp)
|
|
|
217
|
+
|
|
206
|
218
|
def _process_message(self, _client, stanza, properties):
|
|
207
|
219
|
muc_user = stanza.getTag('x', namespace=Namespace.MUC_USER)
|
|
208
|
220
|
if muc_user is None:
|