Changeset 9657 for trunk/src/session.py

Show
Ignore:
Timestamp:
05/18/08 21:11:13 (6 months ago)
Author:
js
Message:

Renable OTR. I found a way no messages will get lost, but it's more
or less a workaround. We never let libotr handle unencrypted messages
now and handle notifying the user about the message not being encrypted
ourself.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/session.py

    r9637 r9657  
    8282 
    8383                        log_type = 'chat_msg_recv' 
     84 
     85                        if gajim.otr_module and \ 
     86                        isinstance(msgtxt, unicode) and \ 
     87                        msgtxt.find('?OTR') != -1: 
     88                                # TODO: Do we really need .encode()? 
     89                                otr_msg_tuple = \ 
     90                                        gajim.otr_module.otrl_message_receiving( 
     91                                        self.conn.otr_userstates, 
     92                                        (gajim.otr_ui_ops, 
     93                                        {'account': self.conn.name}), 
     94                                        gajim.get_jid_from_account( 
     95                                        self.conn.name).encode(), 
     96                                        gajim.OTR_PROTO, 
     97                                        full_jid_with_resource.encode(), 
     98                                        msgtxt.encode(), 
     99                                        (gajim.otr_add_appdata, self.conn.name)) 
     100                                msgtxt = unicode(otr_msg_tuple[1]) 
     101                                xhtml = None 
     102 
     103                                if gajim.otr_module.otrl_tlv_find( 
     104                                otr_msg_tuple[2], 
     105                                gajim.otr_module.OTRL_TLV_DISCONNECTED) != None: 
     106                                        gajim.otr_ui_ops.gajim_log(_("%s " + \ 
     107                                                "has ended his/her private " + \ 
     108                                                "conversation with you; " + \ 
     109                                                "should do the same.") % \ 
     110                                                full_jid_with_resource, 
     111                                                self.conn.name, 
     112                                                full_jid_with_resource.encode()) 
     113 
     114                                        if self.control: 
     115                                                control.update_ui() 
     116 
     117                                        ctx = gajim.otr_module. \ 
     118                                                otrl_context_find( 
     119                                                self.conn.otr_userstates, 
     120                                                full_jid_with_resource.encode(), 
     121                                                gajim.get_jid_from_account( 
     122                                                self.conn.name).encode(), 
     123                                                gajim.OTR_PROTO, 1, 
     124                                                (gajim.otr_add_appdata, 
     125                                                self.conn.name))[0] 
     126                                        tlvs = otr_msg_tuple[2] 
     127                                        ctx.app_data.handle_tlv(tlvs) 
     128 
     129                                encrypted = True 
     130 
     131                                if msgtxt == '': 
     132                                        return 
    84133                else: 
    85134                        log_type = 'single_msg_recv'