Changeset 10354

Show
Ignore:
Timestamp:
08/30/08 03:31:25 (3 months ago)
Author:
bct
Message:

move most of is_loggable out of the session object. fixes #4103

Location:
trunk/src
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chat_control.py

    r10300 r10354  
    15311531                                'status', '', None) 
    15321532 
     1533                        loggable = gajim.config.get('log_encrypted_sessions') 
     1534 
    15331535                        if self.session: 
    1534                                 self.session.loggable = gajim.config.get( 
    1535                                         'log_encrypted_sessions'); 
    1536                         if self.session and not self.session.is_loggable(): 
     1536                                self.session.loggable = loggable 
     1537 
     1538                                loggable = self.session.is_loggable() 
     1539                        else: 
     1540                                loggable = loggable and gajim.config.should_log(self.account, 
     1541                                        self.contact.jid) 
     1542 
     1543                        if loggable: 
     1544                                msg = _('Session WILL be logged') 
     1545                        else: 
    15371546                                msg = _('Session WILL NOT be logged') 
    1538                         else: 
    1539                                 msg = _('Session WILL be logged') 
     1547 
    15401548                        ChatControlBase.print_conversation_line(self, msg, 
    15411549                                'status', '', None) 
     
    15491557 
    15501558                self._show_lock_image(self.gpg_is_active, 'GPG', 
    1551                         self.gpg_is_active, 
    1552                         self.session and self.session.is_loggable(), True) 
     1559                        self.gpg_is_active, loggable, True) 
    15531560 
    15541561        def _show_lock_image(self, visible, enc_type = '', enc_enabled = False, chat_logged = False, authenticated = False): 
  • trunk/src/common/config.py

    r10295 r10354  
    643643                return False 
    644644 
     645        def should_log(self, account, jid): 
     646                '''should conversations between a local account and a remote jid be 
     647                logged?''' 
     648                no_log_for = self.get_per('accounts', account, 'no_log_for') 
     649 
     650                if not no_log_for: 
     651                        no_log_for = '' 
     652 
     653                no_log_for = no_log_for.split() 
     654 
     655                return (account not in no_log_for) and (jid not in no_log_for) 
     656 
    645657        def __init__(self): 
    646658                #init default values 
  • trunk/src/common/connection_handlers.py

    r10346 r10354  
    18421842                        statusCode)) 
    18431843 
    1844                 no_log_for = gajim.config.get_per('accounts', self.name, 'no_log_for')  
    1845  
    1846                 if not no_log_for:  
    1847                         no_log_for = ''  
    1848  
    1849                 no_log_for = no_log_for.split() 
    18501844                tim_int = int(float(mktime(tim))) 
    1851  
    1852                 if self.name not in no_log_for and jid not in no_log_for and not \ 
     1845                if gajim.config.should_log(self.name, jid) and not \ 
    18531846                tim_int <= self.last_history_time[jid] and msgtxt and frm.find('/') >= 0: 
    18541847                        # if frm.find('/') < 0, it means message comes from room itself 
     
    19641957                                        transport_auto_auth = True 
    19651958 
    1966                 no_log_for = gajim.config.get_per('accounts', self.name, 
    1967                         'no_log_for').split() 
    19681959                status = prs.getStatus() or '' 
    19691960                show = prs.getShow() 
     
    20212012                                                errmsg, errcode)) 
    20222013                        if not ptype or ptype == 'unavailable': 
    2023                                 if gajim.config.get('log_contact_status_changes') and self.name\ 
    2024                                 not in no_log_for and jid_stripped not in no_log_for: 
     2014                                if gajim.config.get('log_contact_status_changes') and \ 
     2015                                gajim.config.should_log(self.name, jid_stripped): 
    20252016                                        gc_c = gajim.contacts.get_gc_contact(self.name, jid_stripped, 
    20262017                                                resource) 
     
    21502141                                self.request_vcard(jid_stripped) 
    21512142                if not ptype or ptype == 'unavailable': 
    2152                         if gajim.config.get('log_contact_status_changes') and self.name \ 
    2153                         not in no_log_for and jid_stripped not in no_log_for: 
     2143                        if gajim.config.get('log_contact_status_changes') and \ 
     2144                        gajim.config.should_log(self.name, jid_stripped): 
    21542145                                try: 
    21552146                                        gajim.logger.write('status', jid_stripped, status, show) 
  • trunk/src/common/connection.py

    r10250 r10354  
    11831183                msg_id = self.connection.send(msg_iq) 
    11841184                if not forward_from and session and session.is_loggable(): 
    1185                         no_log_for = gajim.config.get_per('accounts', self.name, 'no_log_for')\ 
    1186                                 .split() 
    11871185                        ji = gajim.get_jid_without_resource(jid) 
    1188                         if self.name not in no_log_for and ji not in no_log_for: 
     1186                        if gajim.config.should_log(self.name, ji): 
    11891187                                log_msg = msg 
    11901188                                if original_message != None: 
     
    15161514                if not self.last_history_time.has_key(room_jid): 
    15171515                        # Not in memory, get it from DB 
    1518                         no_log_for = gajim.config.get_per('accounts', self.name, 'no_log_for')\ 
    1519                                 .split() 
    15201516                        last_log = None 
    15211517                        # Do not check if we are not logging for this room 
    1522                         if self.name not in no_log_for and room_jid not in no_log_for: 
     1518                        if gajim.config.should_log(self.name, room_jid): 
    15231519                                # Check time first in the FAST table 
    15241520                                last_log = gajim.logger.get_room_last_message_time(room_jid) 
  • trunk/src/common/stanza_session.py

    r10337 r10354  
    6767 
    6868        def is_loggable(self): 
    69                 account = self.conn.name 
    70                 no_log_for = gajim.config.get_per('accounts', account, 'no_log_for') 
    71  
    72                 if not no_log_for: 
    73                         no_log_for = '' 
    74  
    75                 no_log_for = no_log_for.split() 
    76  
    77                 return self.loggable and account not in no_log_for and self.jid not in no_log_for 
     69                return self.loggable and gajim.config.should_log(self.conn.name, self.jid) 
    7870 
    7971        # remove events associated with this session from the queue