Save oob data also on MAM Messages
- add get_oob_data() so we can use it on more than one event - also remove a forgotten print call
This commit is contained in:
parent
cb1d8cc78c
commit
3c823d307d
|
@ -127,6 +127,18 @@ class HelperEvent:
|
||||||
self.chatstate = child.getName()
|
self.chatstate = child.getName()
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def get_oob_data(self, stanza):
|
||||||
|
oob_node = stanza.getTag('x', namespace=nbxmpp.NS_X_OOB)
|
||||||
|
if oob_node is not None:
|
||||||
|
if 'gajim' not in self.additional_data:
|
||||||
|
self.additional_data['gajim'] = {}
|
||||||
|
oob_url = oob_node.getTagData('url')
|
||||||
|
if oob_url is not None:
|
||||||
|
self.additional_data['gajim']['oob_url'] = oob_url
|
||||||
|
oob_desc = oob_node.getTagData('desc')
|
||||||
|
if oob_desc is not None:
|
||||||
|
self.additional_data['gajim']['oob_desc'] = oob_desc
|
||||||
|
|
||||||
class HttpAuthReceivedEvent(nec.NetworkIncomingEvent):
|
class HttpAuthReceivedEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'http-auth-received'
|
name = 'http-auth-received'
|
||||||
base_network_events = []
|
base_network_events = []
|
||||||
|
@ -1097,6 +1109,9 @@ class MamDecryptedMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
||||||
# For example Chatstates, Receipts, Chatmarkers
|
# For example Chatstates, Receipts, Chatmarkers
|
||||||
log.debug('Received MAM message without text')
|
log.debug('Received MAM message without text')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.get_oob_data(self.msg_)
|
||||||
|
|
||||||
self.is_pm = app.logger.jid_is_room_jid(self.with_.getStripped())
|
self.is_pm = app.logger.jid_is_room_jid(self.with_.getStripped())
|
||||||
if self.is_pm is None:
|
if self.is_pm is None:
|
||||||
# Check if this event is triggered after a disco, so we dont
|
# Check if this event is triggered after a disco, so we dont
|
||||||
|
@ -1451,14 +1466,7 @@ class DecryptedMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
||||||
|
|
||||||
self.get_chatstate()
|
self.get_chatstate()
|
||||||
|
|
||||||
oob_node = self.stanza.getTag('x', namespace=nbxmpp.NS_X_OOB)
|
self.get_oob_data(self.stanza)
|
||||||
if oob_node is not None:
|
|
||||||
self.oob_url = oob_node.getTagData('url')
|
|
||||||
if self.oob_url is not None:
|
|
||||||
self.additional_data['gajim'] = {'oob_url': self.oob_url}
|
|
||||||
self.oob_desc = oob_node.getTagData('desc')
|
|
||||||
if self.oob_desc is not None:
|
|
||||||
self.additional_data['gajim'] = {'oob_desc': self.oob_desc}
|
|
||||||
|
|
||||||
replace = self.stanza.getTag('replace', namespace=nbxmpp.NS_CORRECT)
|
replace = self.stanza.getTag('replace', namespace=nbxmpp.NS_CORRECT)
|
||||||
if replace:
|
if replace:
|
||||||
|
|
|
@ -133,7 +133,8 @@ class ConnectionArchive313:
|
||||||
app.logger.insert_into_logs(
|
app.logger.insert_into_logs(
|
||||||
obj.with_, obj.timestamp, obj.kind,
|
obj.with_, obj.timestamp, obj.kind,
|
||||||
unread=False,
|
unread=False,
|
||||||
message=obj.msgtxt)
|
message=obj.msgtxt,
|
||||||
|
additional_data=obj.additional_data)
|
||||||
|
|
||||||
def get_query_id(self):
|
def get_query_id(self):
|
||||||
self.mam_query_id = self.connection.getAnID()
|
self.mam_query_id = self.connection.getAnID()
|
||||||
|
|
|
@ -848,7 +848,6 @@ class ConversationTextview(GObject.GObject):
|
||||||
try:
|
try:
|
||||||
gajim_data = additional_data['gajim']
|
gajim_data = additional_data['gajim']
|
||||||
oob_url = gajim_data['oob_url']
|
oob_url = gajim_data['oob_url']
|
||||||
print(oob_url)
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue