Philipp Hörist pushed to branch master at gajim / gajim


Commits:
5e3e0ad3 by lovetox at 2020-10-26T08:40:48+01:00
MAM: Handle errors better

- - - - -


2 changed files:

- gajim/common/modules/mam.py
- gajim/groupchat_control.py


Changes:

=====================================
gajim/common/modules/mam.py
=====================================
@@ -341,11 +341,17 @@ def request_archive_on_signin(self):
         mam_id, start_date = self._get_query_params()
 
         result = yield self._execute_query(own_jid, mam_id, start_date)
-        if is_error(result) and result.condition == 'item-not-found':
+        if is_error(result):
+            if result.condition != 'item-not-found':
+                self._log.warning(result)
+                return
+
             app.storage.archive.reset_archive_infos(result.jid)
             _, start_date = self._get_query_params()
             result = yield self._execute_query(result.jid, None, start_date)
-            raise_if_error(result)
+            if is_error(result):
+                self._log.warning(result)
+                return
 
         if result.rsm.last is not None:
             # <last> is not provided if the requested page was empty
@@ -386,11 +392,17 @@ def request_archive_on_muc_join(self, jid):
         mam_id, start_date = self._get_muc_query_params(jid, threshold)
 
         result = yield self._execute_query(jid, mam_id, start_date)
-        if is_error(result) and result.condition == 'item-not-found':
+        if is_error(result):
+            if result.condition != 'item-not-found':
+                self._log.warning(result)
+                return
+
             app.storage.archive.reset_archive_infos(result.jid)
             _, start_date = self._get_muc_query_params(jid, threshold)
             result = yield self._execute_query(result.jid, None, start_date)
-            raise_if_error(result)
+            if is_error(result):
+                self._log.warning(result)
+                return
 
         if result.rsm.last is not None:
             # <last> is not provided if the requested page was empty


=====================================
gajim/groupchat_control.py
=====================================
@@ -1095,7 +1095,7 @@ def is_connected(self, value: bool) -> None:
     def got_connected(self):
         self.roster.initial_draw()
 
-        if self.disco_info.has_mam:
+        if self.disco_info.has_mam_2:
             # Request MAM
             con = app.connections[self.account]
             con.get_module('MAM').request_archive_on_muc_join(



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/5e3e0ad3905f4987a3bb83de30781d0561aae275

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/5e3e0ad3905f4987a3bb83de30781d0561aae275
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to