Ticket #1347: version_checking.diff

File version_checking.diff, 1.6 KB (added by Andrew Sayman <lorien420@…>, 4 years ago)

Looks at version numbers rather than just the error

  • src/notify.py

     
    213213                if self.notif is None: 
    214214                        raise dbus.dbus_bindings.DBusException() 
    215215                timeout = gajim.config.get('notification_timeout') # in seconds 
     216                # Determine the version of notifications 
     217                # FIXME: This code is blocking, as is the next set. That should be fixed 
     218                # now that we have a class to encapsulate this behavior 
    216219                try: 
     220                        (name, vendor, version) = self.notif.GetServerInfo() 
     221                except: 
     222                        # No way to determine the version number, set it to the latest 
     223                        # since it doesn't properly support the version number 
     224                        version = '0.3.1' 
     225                if version.startswith('0.2'): 
     226                        try: 
     227                                self.id = self.notif.Notify(dbus.String(_('Gajim')), 
     228                                        dbus.String(path), dbus.UInt32(0), ntype, dbus.Byte(0), 
     229                                        dbus.String(event_type), dbus.String(txt), 
     230                                        [dbus.String(path)], {'default': 0}, [''], True, dbus.UInt32( 
     231                                        timeout)) 
     232                        except AttributeError: 
     233                                version = '0.3.1' # we're actually dealing with the newer version 
     234                if version.startswith('0.3'): 
    217235                        self.id = self.notif.Notify(dbus.String(_('Gajim')), 
    218                                 dbus.String(path), dbus.UInt32(0), ntype, dbus.Byte(0), 
    219                                 dbus.String(event_type), dbus.String(txt), 
    220                                 [dbus.String(path)], {'default': 0}, [''], True, dbus.UInt32( 
    221                                 timeout)) 
    222                 except AttributeError: # For libnotify 0.3.x 
    223                         self.id = self.notif.Notify(dbus.String(_('Gajim')), 
    224236                                dbus.String(path), dbus.UInt32(0), dbus.String(event_type), 
    225237                                dbus.String(txt), dbus.String(''), {}, dbus.UInt32(timeout*1000)) 
    226238                notification_response_manager.attach_to_interface()