Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurstsalat <mailtrash@posteo.de>2021-08-24 00:28:13 +0300
committerlovetox <philipp@hoerist.com>2021-12-03 00:19:17 +0300
commit11d246901107b671c5ddb7ceacc949d94f25f3d7 (patch)
treeca22c7f6d1be75ff1ebd7e388e6d8e574310bf7f
parent12be6737ceceb8bd088e4ba05fc3559f4f7b7055 (diff)
Events: Remove obsolete GcInvitationEvent
-rw-r--r--gajim/common/events.py16
-rw-r--r--gajim/gtk/notification.py4
-rw-r--r--gajim/gtk/notification_manager.py20
-rw-r--r--gajim/gui_interface.py41
4 files changed, 24 insertions, 57 deletions
diff --git a/gajim/common/events.py b/gajim/common/events.py
index c7cb9a893..6cb2026fe 100644
--- a/gajim/common/events.py
+++ b/gajim/common/events.py
@@ -29,7 +29,7 @@ class Event:
type_ in chat, normal, file-request, file-error, file-completed,
file-request-error, file-send-error, file-stopped, gc_msg, pm,
printed_chat, printed_gc_msg, printed_marked_gc_msg, printed_pm,
- gc-invitation, jingle-incoming
+ jingle-incoming
parameters is (per type_):
chat, normal, pm: [message, subject, kind, time, encrypted,
@@ -39,7 +39,6 @@ class Event:
printed_chat: [message, subject, control, msg_log_id]
printed_*: None
messages that are already printed in chat, but not read
- gc-invitation: [room_jid, reason, password, jid_from]
jingle-incoming: (fulljid, sessionid, content_types)
"""
if time_:
@@ -138,19 +137,6 @@ class PrintedPmEvent(PrintedChatEvent):
type_ = 'printed_pm'
-class GcInvitationEvent(Event):
-
- type_ = 'gc-invitation'
-
- def __init__(self, event):
- Event.__init__(self,
- None,
- show_in_roster=False,
- show_in_systray=True)
- for key, value in vars(event).items():
- setattr(self, key, value)
-
-
class FileRequestEvent(Event):
type_ = 'file-request'
diff --git a/gajim/gtk/notification.py b/gajim/gtk/notification.py
index ab8aac7f3..f0e293d50 100644
--- a/gajim/gtk/notification.py
+++ b/gajim/gtk/notification.py
@@ -130,8 +130,6 @@ class Notification(EventHelper):
def _on_event_removed(self, event_list):
for event in event_list:
- if event.type_ == 'gc-invitation':
- self._withdraw('gc-invitation', event.account, event.muc)
if event.type_ in ('normal', 'printed_chat', 'chat',
'printed_pm', 'pm', 'printed_marked_gc_msg',
'printed_gc_msg', 'jingle-incoming'):
@@ -215,8 +213,6 @@ class Notification(EventHelper):
# Only one notification per JID
if event_type == _('Contact Changed Status'):
notif_id = self._make_id('contact-status-changed', account, jid)
- elif event_type == _('Group Chat Invitation'):
- notif_id = self._make_id('gc-invitation', account, room_jid)
elif event_type == _('Connection Failed'):
notif_id = self._make_id('connection-failed', account)
elif event_type in (_('New Message'),
diff --git a/gajim/gtk/notification_manager.py b/gajim/gtk/notification_manager.py
index cbd23a43d..182f28c49 100644
--- a/gajim/gtk/notification_manager.py
+++ b/gajim/gtk/notification_manager.py
@@ -180,6 +180,26 @@ class NotificationManager(Gtk.ListBox):
if row is None:
self.add(InvitationReceivedRow(self._account, event))
+ if allow_showing_notification(self._account):
+ if get_muc_context(event.muc) == 'public':
+ jid = event.from_
+ else:
+ jid = event.from_.bare
+ contact = self._client.get_module('Contacts').get_contact(jid)
+ event_type = _('Group Chat Invitation')
+ text = _('%(contact)s invited you to %(chat)s') % {
+ 'contact': contact.name,
+ 'chat': event.info.muc_name}
+ app.notification.popup(
+ event_type,
+ str(jid),
+ self._account,
+ 'gc-invitation',
+ 'gajim-gc_invitation',
+ event_type,
+ text,
+ room_jid=event.muc)
+
def add_invitation_declined(self, event):
row = self._get_notification_row(event.muc)
if row is None:
diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py
index e7f41cfd9..956810be9 100644
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -220,7 +220,6 @@ class Interface:
# 'roster-info': [self.handle_event_roster_info],
'metacontacts-received': [self.handle_event_metacontacts],
'roster-item-exchange-received': [self.handle_event_roster_item_exchange],
- 'muc-invitation': [self.handle_event_gc_invitation],
'file-send-error': [self.handle_event_file_send_error],
'file-request-error': [self.handle_event_file_request_error],
'file-request-received': [self.handle_event_file_request],
@@ -274,10 +273,6 @@ class Interface:
# if not has_queue: # We didn't have a queue: we change icons
# if app.contacts.get_contact_with_highest_priority(account, jid):
# self.roster.draw_contact(jid, account)
- # else:
- # groupchat = event.type_ == 'gc-invitation'
- # self.roster.add_to_not_in_the_roster(
- # account, jid, groupchat=groupchat)
def handle_event(self, account, jid, type_):
jid = JID.from_string(jid)
@@ -311,13 +306,9 @@ class Interface:
app.window.select_chat(account, jid.bare)
elif type_ in file_event_types:
self._handle_event_jingle_file(account, jid, type_)
- elif type_ == 'gc-invitation':
- event = app.events.get_first_event(account, jid, type_)
- if event is None:
- return
- app.window.show_account_page(account)
- app.events.remove_events(account, jid, event)
- elif type_ in ('subscription-request', 'unsubscribed'):
+ elif type_ in ('subscription-request',
+ 'unsubscribed',
+ 'gc-invitation'):
app.window.show_account_page(account)
app.window.present()
@@ -724,32 +715,6 @@ class Interface:
event.exchange_items_list,
event.fjid)
- def handle_event_gc_invitation(self, event):
- event = events.GcInvitationEvent(event)
-
- client = app.get_client(event.account)
- if get_muc_context(event.muc) == 'public':
- jid = event.from_
- else:
- jid = event.from_.bare
-
- self.add_event(event.account, jid, event)
-
- if helpers.allow_showing_notification(event.account):
- contact = client.get_module('Contacts').get_contact(jid)
- event_type = _('Group Chat Invitation')
- text = _('%(contact)s invited you to %(chat)s') % {
- 'contact': contact.name,
- 'chat': event.info.muc_name}
- app.notification.popup(event_type,
- str(jid),
- event.account,
- 'gc-invitation',
- 'gajim-gc_invitation',
- event_type,
- text,
- room_jid=event.muc)
-
# Jingle File Transfer
def handle_event_file_send_error(self, event):
file_transfers = self.instances['file_transfers']