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:12:15 +0300
committerlovetox <philipp@hoerist.com>2021-12-03 00:19:16 +0300
commit12be6737ceceb8bd088e4ba05fc3559f4f7b7055 (patch)
tree9cb104f16b3f60a38753754db414d6f11985a587
parenta73cab0e45c33d5847cdcd7ef0679411b04d1a90 (diff)
Events: Remove obsolete SubscriptionRequestEvent
-rw-r--r--gajim/common/events.py21
-rw-r--r--gajim/gtk/notification.py2
-rw-r--r--gajim/gtk/notification_manager.py17
-rw-r--r--gajim/gui_interface.py8
4 files changed, 18 insertions, 30 deletions
diff --git a/gajim/common/events.py b/gajim/common/events.py
index dc743ee20..c7cb9a893 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, subscription_request, jingle-incoming
+ gc-invitation, jingle-incoming
parameters is (per type_):
chat, normal, pm: [message, subject, kind, time, encrypted,
@@ -40,7 +40,6 @@ class Event:
printed_*: None
messages that are already printed in chat, but not read
gc-invitation: [room_jid, reason, password, jid_from]
- subscription_request: [text, nick]
jingle-incoming: (fulljid, sessionid, content_types)
"""
if time_:
@@ -139,24 +138,6 @@ class PrintedPmEvent(PrintedChatEvent):
type_ = 'printed_pm'
-class SubscriptionRequestEvent(Event):
-
- type_ = 'subscription_request'
-
- def __init__(self,
- text,
- nick,
- time_=None,
- show_in_roster=False,
- show_in_systray=True):
- Event.__init__(self,
- time_,
- show_in_roster=show_in_roster,
- show_in_systray=show_in_systray)
- self.text = text
- self.nick = nick
-
-
class GcInvitationEvent(Event):
type_ = 'gc-invitation'
diff --git a/gajim/gtk/notification.py b/gajim/gtk/notification.py
index d6b64bea9..ab8aac7f3 100644
--- a/gajim/gtk/notification.py
+++ b/gajim/gtk/notification.py
@@ -190,7 +190,7 @@ class Notification(EventHelper):
_('Contact Changed Status'), _('File Transfer Request'),
_('File Transfer Error'), _('File Transfer Completed'),
_('File Transfer Stopped'), _('Group Chat Invitation'),
- _('Connection Failed'), _('Subscription request'),
+ _('Connection Failed'), _('Subscription Request'),
_('Contact Unsubscribed'), _('Incoming Call')):
if 'actions' in self._daemon_capabilities:
# Create Variant Dict
diff --git a/gajim/gtk/notification_manager.py b/gajim/gtk/notification_manager.py
index 0d9ea9275..cbd23a43d 100644
--- a/gajim/gtk/notification_manager.py
+++ b/gajim/gtk/notification_manager.py
@@ -104,7 +104,6 @@ class NotificationManager(Gtk.ListBox):
def _on_subscription_block(self, _action, param):
jid = param.get_string()
- app.events.remove_events(self._account, jid)
self._deny_request(jid)
self._client.get_module('Blocking').block([jid])
row = self._get_notification_row(jid)
@@ -112,7 +111,6 @@ class NotificationManager(Gtk.ListBox):
def _on_subscription_report(self, _action, param):
jid = param.get_string()
- app.events.remove_events(self._account, jid)
self._deny_request(jid)
self._client.get_module('Blocking').block([jid], report='spam')
row = self._get_notification_row(jid)
@@ -138,6 +136,21 @@ class NotificationManager(Gtk.ListBox):
if row is None:
self.add(SubscriptionRequestRow(
self._account, event.jid, event.status, event.user_nick))
+
+ if allow_showing_notification(self._account):
+ event_type = _('Subscription Request')
+ contact = self._client.get_module('Contacts').get_contact(
+ event.jid)
+ text = _('%s asks you to share your status') % contact.name
+ app.notification.popup(
+ event_type,
+ event.jid,
+ self._account,
+ 'subscription-request',
+ 'gajim-subscription_request',
+ event_type,
+ text)
+
elif row.type == 'unsubscribed':
self.remove(row)
diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py
index f775dbe9e..e7f41cfd9 100644
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -317,13 +317,7 @@ class Interface:
return
app.window.show_account_page(account)
app.events.remove_events(account, jid, event)
- elif type_ == 'subscription_request':
- 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_ == 'unsubscribed':
+ elif type_ in ('subscription-request', 'unsubscribed'):
app.window.show_account_page(account)
app.window.present()