Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
77be67f6
by Philipp Hörist at 2018-02-25T22:02:39+01:00
-
c6e39309
by Philipp Hörist at 2018-02-26T20:49:01+01:00
3 changed files:
Changes:
| ... | ... | @@ -238,7 +238,7 @@ class ChatControl(ChatControlBase): |
| 238 | 238 |
self._nec_chatstate_received)
|
| 239 | 239 |
app.ged.register_event_handler('caps-received', ged.GUI1,
|
| 240 | 240 |
self._nec_caps_received)
|
| 241 |
- app.ged.register_event_handler('stanza-message-outgoing', ged.OUT_POSTCORE,
|
|
| 241 |
+ app.ged.register_event_handler('message-sent', ged.OUT_POSTCORE,
|
|
| 242 | 242 |
self._message_sent)
|
| 243 | 243 |
app.ged.register_event_handler(
|
| 244 | 244 |
'mam-decrypted-message-received',
|
| ... | ... | @@ -1160,7 +1160,7 @@ class ChatControl(ChatControlBase): |
| 1160 | 1160 |
self._nec_chatstate_received)
|
| 1161 | 1161 |
app.ged.remove_event_handler('caps-received', ged.GUI1,
|
| 1162 | 1162 |
self._nec_caps_received)
|
| 1163 |
- app.ged.remove_event_handler('stanza-message-outgoing', ged.OUT_POSTCORE,
|
|
| 1163 |
+ app.ged.remove_event_handler('message-sent', ged.OUT_POSTCORE,
|
|
| 1164 | 1164 |
self._message_sent)
|
| 1165 | 1165 |
|
| 1166 | 1166 |
self.unsubscribe_events()
|
| ... | ... | @@ -2075,10 +2075,7 @@ class Connection(CommonConnection, ConnectionHandlers): |
| 2075 | 2075 |
obj.timestamp = time.time()
|
| 2076 | 2076 |
obj.stanza_id = self.connection.send(obj.msg_iq, now=obj.now)
|
| 2077 | 2077 |
|
| 2078 |
- app.nec.push_incoming_event(MessageSentEvent(
|
|
| 2079 |
- None, conn=self, jid=obj.jid, message=obj.message, keyID=obj.keyID,
|
|
| 2080 |
- chatstate=obj.chatstate, automatic_message=obj.automatic_message,
|
|
| 2081 |
- stanza_id=obj.stanza_id, additional_data=obj.additional_data))
|
|
| 2078 |
+ app.nec.push_incoming_event(MessageSentEvent(None, **vars(obj)))
|
|
| 2082 | 2079 |
|
| 2083 | 2080 |
if isinstance(obj.jid, list):
|
| 2084 | 2081 |
for j in obj.jid:
|
| ... | ... | @@ -200,13 +200,19 @@ class ConnectionArchive313: |
| 200 | 200 |
def _nec_mam_decrypted_message_received(self, obj):
|
| 201 | 201 |
if obj.conn.name != self.name:
|
| 202 | 202 |
return
|
| 203 |
- # if self.archiving_namespace != nbxmpp.NS_MAM_2:
|
|
| 204 |
- # Fallback duplicate search without stanza-id
|
|
| 205 |
- duplicate = app.logger.search_for_duplicate(
|
|
| 206 |
- self.name, obj.with_, obj.timestamp, obj.msgtxt)
|
|
| 207 |
- if duplicate:
|
|
| 208 |
- # dont propagate the event further
|
|
| 209 |
- return True
|
|
| 203 |
+ |
|
| 204 |
+ namespace = self.archiving_namespace
|
|
| 205 |
+ if obj.groupchat:
|
|
| 206 |
+ namespace = muc_caps_cache.get_mam_namespace(obj.room_jid)
|
|
| 207 |
+ |
|
| 208 |
+ if namespace != nbxmpp.NS_MAM_2:
|
|
| 209 |
+ # Fallback duplicate search without stanza-id
|
|
| 210 |
+ duplicate = app.logger.search_for_duplicate(
|
|
| 211 |
+ self.name, obj.with_, obj.timestamp, obj.msgtxt)
|
|
| 212 |
+ if duplicate:
|
|
| 213 |
+ # dont propagate the event further
|
|
| 214 |
+ return True
|
|
| 215 |
+ |
|
| 210 | 216 |
app.logger.insert_into_logs(self.name,
|
| 211 | 217 |
obj.with_,
|
| 212 | 218 |
obj.timestamp,
|