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


Commits:
1128a3db by Philipp Hörist at 2023-05-14T13:37:45+02:00
new: MAM: Add sync state signals

- - - - -


1 changed file:

- gajim/common/modules/mam.py


Changes:

=====================================
gajim/common/modules/mam.py
=====================================
@@ -464,12 +464,16 @@ def request_archive_on_muc_join(self, jid: JID):
         if threshold == SyncThreshold.NO_SYNC:
             return
 
+        contact = self._get_contact(jid, groupchat=True)
+        contact.notify('mam-sync-started')
+
         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):
             if result.condition != 'item-not-found':
                 self._log.warning(result)
+                contact.notify('mam-sync-error', result.get_text())
                 return
 
             app.storage.archive.reset_archive_infos(result.jid)
@@ -477,6 +481,7 @@ def request_archive_on_muc_join(self, jid: JID):
             result = yield self._execute_query(result.jid, None, start_date)
             if is_error(result):
                 self._log.warning(result)
+                contact.notify('mam-sync-error', result.get_text())
                 return
 
         if result.rsm.last is not None:
@@ -488,6 +493,8 @@ def request_archive_on_muc_join(self, jid: JID):
                 last_mam_id=result.rsm.last,
                 last_muc_timestamp=time.time())
 
+        contact.notify('mam-sync-finished')
+
     @as_task
     def _execute_query(self,
                        jid: JID,



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/1128a3db45accf8f210dd907d0fba704fc41f449

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


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to