Philipp Hörist pushed to branch master at gajim / gajim
Commits:
75b5ec5e by lovetox at 2022-01-23T12:10:34+01:00
Interface: Handle roster-item-exchange event in MainWindow
- - - - -
cd5c2899 by lovetox at 2022-01-23T12:11:19+01:00
Remove unused import
- - - - -
5 changed files:
- gajim/common/events.py
- gajim/common/modules/roster_item_exchange.py
- gajim/gtk/application.py
- gajim/gtk/main.py
- gajim/gui_interface.py
Changes:
=====================================
gajim/common/events.py
=====================================
@@ -402,9 +402,9 @@ class MessageError(ApplicationEvent):
@dataclass
class RosterItemExchangeEvent(ApplicationEvent):
- name: str = field(init=False, default='roster-item-exchange-received')
- conn: 'Client'
- fjid: str
+ name: str = field(init=False, default='roster-item-exchange')
+ client: 'Client'
+ jid: JID
exchange_items_list: list[str]
action: str
=====================================
gajim/common/modules/roster_item_exchange.py
=====================================
@@ -39,7 +39,7 @@ def __init__(self, con):
ns=Namespace.ROSTERX),
]
- def received_item(self, _con, stanza, _properties):
+ def received_item(self, _con, stanza, properties):
# stanza can be a message or a iq
self._log.info('Received roster items from %s', stanza.getFrom())
@@ -87,8 +87,8 @@ def received_item(self, _con, stanza, _properties):
self._log.info('Items: %s', exchange_items_list)
app.ged.raise_event(RosterItemExchangeEvent(
- conn=self._con,
- fjid=str(stanza.getFrom()),
+ client=self._con,
+ jid=properties.jid,
exchange_items_list=exchange_items_list,
action=action))
=====================================
gajim/gtk/application.py
=====================================
@@ -62,7 +62,6 @@
from gajim.common.application import CoreApplication
from gajim.common.const import GAJIM_FAQ_URI
from gajim.common.const import GAJIM_WIKI_URI
-from gajim.common.dbus import logind
from gajim.common.dbus import music_track
from gajim.common.events import ApplicationEvent
from gajim.common.exceptions import GajimGeneralException
=====================================
gajim/gtk/main.py
=====================================
@@ -32,6 +32,7 @@
from gajim.common import ged
from gajim.common.const import Direction
from gajim.common.events import ApplicationEvent
+from gajim.common.events import RosterItemExchangeEvent
from gajim.common.events import AllowGajimUpdateCheck
from gajim.common.events import GajimUpdateAvailable
from gajim.common.events import AccountEnabled
@@ -128,6 +129,7 @@ def __init__(self) -> None:
('account-disabled', ged.GUI1, self._on_account_disabled),
('allow-gajim-update-check', ged.GUI1,
self._on_allow_gajim_update),
('gajim-update-available', ged.GUI1,
self._on_gajim_update_available),
+ ('roster-item-exchange', ged.GUI1, self._on_roster_item_exchange),
])
self._check_for_account()
@@ -196,6 +198,14 @@ def _on_allow_gajim_update(self, event:
AllowGajimUpdateCheck) -> None:
def _on_gajim_update_available(self, event: GajimUpdateAvailable) -> None:
self.add_app_message(event.name, event.version)
+ @staticmethod
+ def _on_roster_item_exchange(event: RosterItemExchangeEvent) -> None:
+ open_window('RosterItemExchange',
+ account=event.client.account,
+ action=event.action,
+ exchange_list=event.exchange_items_list,
+ jid_from=event.jid)
+
def _add_actions(self) -> None:
actions = [
('add-workspace', 's', self._add_workspace),
=====================================
gajim/gui_interface.py
=====================================
@@ -154,7 +154,6 @@ def _create_core_handlers_list(self) -> None:
'message-sent': [self.handle_event_msgsent],
'message-not-sent': [self.handle_event_msgnotsent],
'read-state-sync': [self.handle_event_read_state_sync],
- 'roster-item-exchange-received':
[self.handle_event_roster_item_exchange],
}
# pylint: enable=line-too-long
@@ -356,15 +355,6 @@ def handle_event_read_state_sync(event):
app.window.mark_as_read(event.account, jid, send_marker=False)
- @staticmethod
- def handle_event_roster_item_exchange(event):
- # data = (action in [add, delete, modify], exchange_list, jid_from)
- open_window('RosterItemExchange',
- account=event.conn.name,
- action=event.action,
- exchange_list=event.exchange_items_list,
- jid_from=event.fjid)
-
# Jingle File Transfer
@staticmethod
def handle_event_file_error(title: str, message: str) -> None:
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/20d651f8c2cf2bd235d8145f07394d3d053506f0...cd5c2899651383d864c2bbe463ced4ac9ed1d28b
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/20d651f8c2cf2bd235d8145f07394d3d053506f0...cd5c2899651383d864c2bbe463ced4ac9ed1d28b
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