Fix parsing MAM IQs

prosody includes the supplied queryid in the `<fin>` tag, but this is not XEP compliant.

We set the queryid attr so we can match the MAM Messages to our query.
Thats the only purpose, it is not used to identify the iq result at the end of the query.
For that purpose is the `id` attr on the `<iq>` node.

So dont try to parse `queryid` from the `<fin>` tag.
This commit is contained in:
Philipp Hörist 2018-01-17 23:52:19 +01:00
parent 67a008ea80
commit 5ef1813405
1 changed files with 4 additions and 8 deletions

View File

@ -96,7 +96,7 @@ class ConnectionArchive313:
del self.mam_awaiting_disco_result[obj.jid]
@staticmethod
def parse_iq(stanza, query_id):
def parse_iq(stanza):
if not nbxmpp.isResultNode(stanza):
log.error('Error on MAM query: %s', stanza.getError())
raise InvalidMamIQ
@ -106,10 +106,6 @@ class ConnectionArchive313:
log.error('Malformed MAM query result received: %s', stanza)
raise InvalidMamIQ
if fin.getAttr('queryid') != query_id:
log.error('Result with unknown query id received')
raise InvalidMamIQ
set_ = fin.getTag('set', namespace=nbxmpp.NS_RSM)
if set_ is None:
log.error(
@ -129,7 +125,7 @@ class ConnectionArchive313:
def _result_finished(self, conn, stanza, query_id, start_date, groupchat):
try:
fin, set_ = self.parse_iq(stanza, query_id)
fin, set_ = self.parse_iq(stanza)
except InvalidMamIQ:
return
@ -158,7 +154,7 @@ class ConnectionArchive313:
def _intervall_result_finished(self, conn, stanza, query_id,
start_date, end_date, event_id):
try:
fin, set_ = self.parse_iq(stanza, query_id)
fin, set_ = self.parse_iq(stanza)
except InvalidMamIQ:
return
@ -190,7 +186,7 @@ class ConnectionArchive313:
def _received_count(self, conn, stanza, query_id, event_id):
try:
_, set_ = self.parse_iq(stanza, query_id)
_, set_ = self.parse_iq(stanza)
except InvalidMamIQ:
return