Changeset 9617

Show
Ignore:
Timestamp:
05/11/08 15:20:22 (2 months ago)
Author:
js
Message:

[Kjell Braden] Fix OTR for chat and GC queries for real now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/gajim.py

    r9616 r9617  
    287287 
    288288                if not no_print: 
    289                         ctrl = gajim.interface.msg_win_mgr.get_control( 
    290                                         gajim.get_jid_without_resource(fjid), account) 
     289                        ctrl = self.get_control(fjid, account) 
    291290                        if ctrl: 
    292291                                ctrl.print_conversation_line(u" [OTR] %s"%msg, 'status', '', None) 
    293292                id = gajim.logger.write('chat_msg_recv', fjid, message=msg, tim=tim) 
     293                # gajim.logger.write() only marks a message as unread (and so only 
     294                # returns an id) when fjid is a real contact (NOT if it's a GC private 
     295                # chat) 
    294296                if id: 
    295297                        gajim.logger.set_read_messages([id]) 
     298         
     299        def get_control(self, fjid, account): 
     300                # first try to get the window with the full jid 
     301                ctrl = gajim.interface.msg_win_mgr.get_control(fjid, account) 
     302                if ctrl: 
     303                        # got one, be happy 
     304                        return ctrl 
     305                 
     306                # otherwise try without the resource 
     307                ctrl = gajim.interface.msg_win_mgr.get_control( 
     308                        gajim.get_jid_without_resource(fjid), account) 
     309                # but only use it when it is not a GC window 
     310                if ctrl and ctrl.TYPE_ID == message_control.TYPE_CHAT: 
     311                        return ctrl 
    296312 
    297313        def policy(self, opdata=None, context=None): 
    298                 policy = gajim.config.get_per("contacts", 
    299                         gajim.get_jid_without_resource(context.username), "otr_flags") 
     314                policy = gajim.config.get_per("contacts", context.username, 
     315                        "otr_flags") 
     316                if policy <= 0: 
     317                        policy = gajim.config.get_per("contacts", 
     318                                        gajim.get_jid_without_resource(context.username), 
     319                                        "otr_flags") 
    300320                if policy <= 0: 
    301321                        policy = gajim.config.get_per("accounts", opdata['account'], "otr_flags") 
  • trunk/src/otr_windows.py

    r9607 r9617  
    225225                        "otr_flags") 
    226226 
    227                 if otr_flags > 0: 
     227                if otr_flags >= 0: 
    228228                        self.gw("otr_default_checkbutton").set_active(0) 
    229229                        for w in self.gw("otr_settings_vbox").get_children():