Philipp Hörist pushed to branch mute-chat-notifications at gajim / gajim
Commits:
-
c4ee41b5
by Philipp Hörist at 2023-04-02T15:35:11+02:00
-
3cffc7b8
by Philipp Hörist at 2023-04-02T17:35:15+02:00
2 changed files:
Changes:
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | from datetime import timezone
|
| 25 | 25 | |
| 26 | 26 | import cairo
|
| 27 | +from gi.repository import GLib
|
|
| 27 | 28 | from nbxmpp.const import Affiliation
|
| 28 | 29 | from nbxmpp.const import Chatstate
|
| 29 | 30 | from nbxmpp.const import Role
|
| ... | ... | @@ -342,7 +343,11 @@ def is_muted(self) -> bool: |
| 342 | 343 | return False
|
| 343 | 344 | |
| 344 | 345 | until = datetime.fromisoformat(mute_until)
|
| 345 | - return until > datetime.now(timezone.utc)
|
|
| 346 | + is_muted = until > datetime.now(timezone.utc)
|
|
| 347 | + if not is_muted:
|
|
| 348 | + # Reset the setting to default
|
|
| 349 | + GLib.idle_add(self.settings.set, 'mute_until', None)
|
|
| 350 | + return is_muted
|
|
| 346 | 351 | |
| 347 | 352 | def __repr__(self) -> str:
|
| 348 | 353 | return f'{self.jid} ({self._account})'
|
| ... | ... | @@ -6,7 +6,6 @@ from gi.repository import Atk |
| 6 | 6 | from gi.repository import Gtk
|
| 7 | 7 | from gi.repository import GtkSource
|
| 8 | 8 | |
| 9 | - |
|
| 10 | 9 | class Builder(Gtk.Builder):
|
| 11 | 10 | ...
|
| 12 | 11 |