Show
Ignore:
Timestamp:
06/25/08 11:25:43 (5 months ago)
Author:
asterix
Message:

don't try the old (XEP-018) way to go invisible. It's not XMPP complient. That prevent to show the we are invisible but we are not. Fixes #4012

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/connection.py

    r9836 r9839  
    812812                if not self.connection: 
    813813                        return 
     814                if not self.privacy_rules_supported: 
     815                        self.dispatch('STATUS', gajim.SHOW_LIST[self.connected]) 
     816                        self.dispatch('ERROR', (_('Invisibility not supported'), 
     817                                _('Account %s doesn\'t support invisibility.') % self.name)) 
     818                        return 
    814819                # If we are already connected, and privacy rules are supported, send 
    815820                # offline presence first as it's required by XEP-0126 
     
    829834 
    830835        def _continue_invisible(self, con, iq_obj, msg, signed, initial): 
    831                 ptype = '' 
    832                 show = '' 
    833836                if iq_obj.getType() == 'error': # server doesn't support privacy lists 
    834                         # We use the old way which is not xmpp complient 
    835                         ptype = 'invisible' 
    836                         show = 'invisible' 
    837                 else: 
    838                         # active the privacy rule 
    839                         self.privacy_rules_supported = True 
    840                         self.activate_privacy_rule('invisible') 
    841                 priority = unicode(gajim.get_priority(self.name, show)) 
    842                 p = common.xmpp.Presence(typ = ptype, priority = priority, show = show) 
    843                 p = self.add_sha(p, ptype != 'unavailable') 
     837                        return 
     838                # active the privacy rule 
     839                self.privacy_rules_supported = True 
     840                self.activate_privacy_rule('invisible') 
     841                self.connected = STATUS_LIST.index('invisible') 
     842                self.status = msg 
     843                priority = unicode(gajim.get_priority(self.name, 'invisible')) 
     844                p = common.xmpp.Presence(priority = priority) 
     845                p = self.add_sha(p, True) 
    844846                if msg: 
    845847                        p.setStatus(msg) 
     
    954956                if not auto and not show == 'offline': 
    955957                        sign_msg = True 
    956                 self.status = msg 
     958                if show != 'invisible': 
     959                        # We save it only when privacy list is accepted 
     960                        self.status = msg 
    957961                if show != 'offline' and self.connected < 1: 
    958962                        # set old_show to requested 'show' in case we need to 
     
    994998                        if self.connected == 1: 
    995999                                return 
    996                         was_invisible = self.connected == STATUS_LIST.index('invisible') 
    997                         self.connected = STATUS_LIST.index(show) 
    9981000                        if show == 'invisible': 
    9991001                                signed = self.get_signed_presence(msg) 
    10001002                                self.send_invisible_presence(msg, signed) 
    10011003                                return 
     1004                        was_invisible = self.connected == STATUS_LIST.index('invisible') 
     1005                        self.connected = STATUS_LIST.index(show) 
    10021006                        if was_invisible and self.privacy_rules_supported: 
    10031007                                iq = self.build_privacy_rule('visible', 'allow')