Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
-
12bc0c21
by wurstsalat at 2021-11-13T20:59:05+01:00
-
256dd758
by wurstsalat at 2021-11-14T00:03:15+01:00
-
1d8eb84b
by wurstsalat at 2021-11-14T00:06:14+01:00
5 changed files:
- gajim/gtk/chat_list.py
- gajim/gtk/controls/base.py
- gajim/gtk/controls/chat.py
- gajim/gtk/controls/groupchat.py
- gajim/gtk/main.py
Changes:
| ... | ... | @@ -340,11 +340,13 @@ def _on_message_received(self, event): |
| 340 | 340 |
row.set_nick(nick)
|
| 341 | 341 |
if event.name == 'mam-message-received':
|
| 342 | 342 |
row.set_timestamp(event.properties.mam.timestamp)
|
| 343 |
+ row.set_stanza_id(event.stanza_id)
|
|
| 343 | 344 |
else:
|
| 344 | 345 |
row.set_timestamp(event.properties.timestamp)
|
| 346 |
+ row.set_stanza_id(event.properties.stanza_id.id)
|
|
| 345 | 347 |
row.set_message_text(
|
| 346 | 348 |
event.msgtxt, additional_data=event.additional_data)
|
| 347 |
- row.set_stanza_id(event.properties.stanza_id.id)
|
|
| 349 |
+ |
|
| 348 | 350 |
self._add_unread(row, event.properties)
|
| 349 | 351 |
self.invalidate_sort()
|
| 350 | 352 |
|
| ... | ... | @@ -1111,6 +1111,7 @@ def add_message(self, |
| 1111 | 1111 |
kind,
|
| 1112 | 1112 |
name,
|
| 1113 | 1113 |
tim,
|
| 1114 |
+ notify,
|
|
| 1114 | 1115 |
displaymarking=None,
|
| 1115 | 1116 |
msg_log_id=None,
|
| 1116 | 1117 |
message_id=None,
|
| ... | ... | @@ -1154,7 +1155,8 @@ def add_message(self, |
| 1154 | 1155 |
self.save_message(text, 'received')
|
| 1155 | 1156 |
|
| 1156 | 1157 |
# Issue notification
|
| 1157 |
- self._notify(name, text, tim)
|
|
| 1158 |
+ if notify:
|
|
| 1159 |
+ self._notify(name, text, tim)
|
|
| 1158 | 1160 |
|
| 1159 | 1161 |
# Send chat marker if we’re actively following the chat
|
| 1160 | 1162 |
chat_active = app.window.is_chat_active(
|
| ... | ... | @@ -415,7 +415,8 @@ def _on_mam_message_received(self, event): |
| 415 | 415 |
correct_id=event.correct_id,
|
| 416 | 416 |
message_id=event.properties.id,
|
| 417 | 417 |
stanza_id=event.stanza_id,
|
| 418 |
- additional_data=event.additional_data)
|
|
| 418 |
+ additional_data=event.additional_data,
|
|
| 419 |
+ notify=False)
|
|
| 419 | 420 |
|
| 420 | 421 |
def _on_message_received(self, event):
|
| 421 | 422 |
if not event.msgtxt:
|
| ... | ... | @@ -605,7 +606,8 @@ def add_message(self, |
| 605 | 606 |
stanza_id=None,
|
| 606 | 607 |
correct_id=None,
|
| 607 | 608 |
message_id=None,
|
| 608 |
- additional_data=None):
|
|
| 609 |
+ additional_data=None,
|
|
| 610 |
+ notify=True):
|
|
| 609 | 611 |
|
| 610 | 612 |
if additional_data is None:
|
| 611 | 613 |
additional_data = AdditionalDataDict()
|
| ... | ... | @@ -620,6 +622,7 @@ def add_message(self, |
| 620 | 622 |
kind,
|
| 621 | 623 |
name,
|
| 622 | 624 |
tim,
|
| 625 |
+ notify,
|
|
| 623 | 626 |
displaymarking=displaymarking,
|
| 624 | 627 |
msg_log_id=msg_log_id,
|
| 625 | 628 |
message_id=message_id,
|
| ... | ... | @@ -674,7 +674,8 @@ def _on_mam_message_received(self, event): |
| 674 | 674 |
correct_id=event.correct_id,
|
| 675 | 675 |
message_id=event.properties.id,
|
| 676 | 676 |
stanza_id=event.stanza_id,
|
| 677 |
- additional_data=event.additional_data)
|
|
| 677 |
+ additional_data=event.additional_data,
|
|
| 678 |
+ notify=False)
|
|
| 678 | 679 |
|
| 679 | 680 |
def _on_gc_message_received(self, event):
|
| 680 | 681 |
if event.properties.muc_nickname is None:
|
| ... | ... | @@ -710,7 +711,8 @@ def add_message(self, |
| 710 | 711 |
correct_id=None,
|
| 711 | 712 |
message_id=None,
|
| 712 | 713 |
stanza_id=None,
|
| 713 |
- additional_data=None):
|
|
| 714 |
+ additional_data=None,
|
|
| 715 |
+ notify=True):
|
|
| 714 | 716 |
|
| 715 | 717 |
if contact == self.contact.nickname:
|
| 716 | 718 |
kind = 'outgoing'
|
| ... | ... | @@ -729,6 +731,7 @@ def add_message(self, |
| 729 | 731 |
kind,
|
| 730 | 732 |
contact,
|
| 731 | 733 |
tim,
|
| 734 |
+ notify,
|
|
| 732 | 735 |
displaymarking=displaymarking,
|
| 733 | 736 |
correct_id=correct_id,
|
| 734 | 737 |
message_id=message_id,
|
| 1 |
+from typing import Optional
|
|
| 2 |
+ |
|
| 1 | 3 |
import logging
|
| 2 | 4 |
import os
|
| 3 | 5 |
|
| ... | ... | @@ -16,6 +18,7 @@ |
| 16 | 18 |
from .adhoc import AdHocCommand
|
| 17 | 19 |
from .account_side_bar import AccountSideBar
|
| 18 | 20 |
from .app_side_bar import AppSideBar
|
| 21 |
+from .workspace_side_bar import Workspace
|
|
| 19 | 22 |
from .workspace_side_bar import WorkspaceSideBar
|
| 20 | 23 |
from .main_stack import MainStack
|
| 21 | 24 |
from .dialogs import DialogButton
|
| ... | ... | @@ -323,7 +326,7 @@ def show_account_page(self, account): |
| 323 | 326 |
self._account_side_bar.activate_account_page(account)
|
| 324 | 327 |
self._main_stack.show_account(account)
|
| 325 | 328 |
|
| 326 |
- def get_active_workspace(self):
|
|
| 329 |
+ def get_active_workspace(self) -> Optional[Workspace]:
|
|
| 327 | 330 |
return self._workspace_side_bar.get_active_workspace()
|
| 328 | 331 |
|
| 329 | 332 |
def is_chat_active(self, account, jid):
|
| ... | ... | @@ -390,6 +393,8 @@ def _add_group_chat(self, _action, param): |
| 390 | 393 |
|
| 391 | 394 |
def add_group_chat(self, account, jid, select=False):
|
| 392 | 395 |
workspace_id = self.get_active_workspace()
|
| 396 |
+ if workspace_id is None:
|
|
| 397 |
+ workspace_id = self._workspace_side_bar.get_first_workspace()
|
|
| 393 | 398 |
self._chat_page.add_chat_for_workspace(workspace_id,
|
| 394 | 399 |
account,
|
| 395 | 400 |
jid,
|
| ... | ... | @@ -411,6 +416,8 @@ def add_chat(self, account, jid, type_, select=False): |
| 411 | 416 |
|
| 412 | 417 |
def add_private_chat(self, account, jid, select=False):
|
| 413 | 418 |
workspace_id = self.get_active_workspace()
|
| 419 |
+ if workspace_id is None:
|
|
| 420 |
+ workspace_id = self._workspace_side_bar.get_first_workspace()
|
|
| 414 | 421 |
self._chat_page.add_chat_for_workspace(workspace_id,
|
| 415 | 422 |
account,
|
| 416 | 423 |
jid,
|