Philipp Hörist pushed to branch mainwindow at gajim / gajim


Commits:
359b5f22 by lovetox at 2021-03-20T08:07:22+01:00
Remove obsolete methods

- - - - -
029c0d2d by lovetox at 2021-03-20T09:24:33+01:00
Fix PresenceShow comparison

- - - - -


2 changed files:

- gajim/common/const.py
- gajim/gui_interface.py


Changes:

=====================================
gajim/common/const.py
=====================================
@@ -1132,6 +1132,8 @@ def is_offline(self):
         return self == PresenceShowExt.OFFLINE
 
     def __lt__(self, other):
+        if isinstance(other, PresenceShowExt):
+            return False
         if not isinstance(other, PresenceShow):
             return NotImplemented
         return True


=====================================
gajim/gui_interface.py
=====================================
@@ -301,53 +301,6 @@ def handle_event_msgnotsent(obj):
         obj.session.roster_message(obj.jid, msg, obj.time_, obj.conn.name,
             msg_type='error')
 
-    def handle_event_subscribe_presence(self, event):
-        # ('SUBSCRIBE', account, (jid, text, user_nick)) user_nick is XEP-0172
-        account = event.conn.name
-        event = events.SubscriptionRequestEvent(event.status, event.user_nick)
-
-        self.add_event(account, str(event.jid), event)
-
-        if helpers.allow_showing_notification(account):
-            event_type = _('Subscription request')
-            app.notification.popup(
-                event_type, str(event.jid), account, 'subscription_request',
-                'gajim-subscription_request', event_type, str(event.jid))
-
-    def handle_event_subscribed_presence(self, event):
-        bare_jid = event.jid.bare
-        resource = event.jid.resource
-        if bare_jid in app.contacts.get_jid_list(event.account):
-            contact = app.contacts.get_first_contact_from_jid(event.account,
-                                                              bare_jid)
-            contact.resource = resource
-            self.roster.remove_contact_from_groups(contact.jid,
-                                                   event.account,
-                                                   [_('Not in contact list'),
-                                                    _('Observers')],
-                                                   update=False)
-        else:
-            name = event.jid.localpart
-            name = name.split('%', 1)[0]
-            contact = app.contacts.create_contact(jid=bare_jid,
-                                                  account=event.account,
-                                                  name=name,
-                                                  groups=[],
-                                                  show='online',
-                                                  status='online',
-                                                  ask='to',
-                                                  resource=resource)
-            app.contacts.add_contact(event.account, contact)
-            self.roster.add_contact(bare_jid, event.account)
-
-        app.notification.popup(
-            None,
-            bare_jid,
-            event.account,
-            title=_('Authorization accepted'),
-            text=_('The contact "%(jid)s" has authorized you'
-                   ' to see their status.') % {'jid': event.jid})
-
     def show_unsubscribed_dialog(self, account, contact):
         def _remove():
             self.roster.on_req_usub(None, [(contact, account)])
@@ -368,27 +321,6 @@ def _remove():
         # FIXME: Per RFC 3921, we can "deny" ack as well, but the GUI does
         # not show deny
 
-    def handle_event_unsubscribed_presence(self, obj):
-        #('UNSUBSCRIBED', account, jid)
-        account = obj.conn.name
-        contact = app.contacts.get_first_contact_from_jid(account, obj.jid)
-        if not contact:
-            return
-
-        if helpers.allow_popup_window(account) or not self.systray_enabled:
-            self.show_unsubscribed_dialog(account, contact)
-            return
-
-        event = events.UnsubscribedEvent(contact)
-        self.add_event(account, obj.jid, event)
-
-        if helpers.allow_showing_notification(account):
-            event_type = _('Unsubscribed')
-            app.notification.popup(
-                event_type, obj.jid, account,
-                'unsubscribed', 'gajim-unsubscribed',
-                event_type, obj.jid)
-
     def handle_event_gc_decline(self, event):
         gc_control = self.msg_win_mgr.get_gc_control(str(event.muc),
                                                      event.account)
@@ -1106,12 +1038,6 @@ def create_core_handlers_list(self):
             'roster-item-exchange-received': \
                 [self.handle_event_roster_item_exchange],
             'signed-in': [self.handle_event_signed_in],
-            'subscribe-presence-received': [
-                self.handle_event_subscribe_presence],
-            'subscribed-presence-received': [
-                self.handle_event_subscribed_presence],
-            'unsubscribed-presence-received': [
-                self.handle_event_unsubscribed_presence],
             'zeroconf-name-conflict': [self.handle_event_zc_name_conflict],
             'read-state-sync': [self.handle_event_read_state_sync],
         }



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/f495405db3c0ce066153d12c27527220e6c217a2...029c0d2d863538cae8ec9c4bc14ea7f307152eb9

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/f495405db3c0ce066153d12c27527220e6c217a2...029c0d2d863538cae8ec9c4bc14ea7f307152eb9
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to