Show
Ignore:
Timestamp:
05/09/08 14:35:25 (4 months ago)
Author:
js
Message:

Added OTR support.
Work done by Kjell Braden <fnord@…>.
Some fixes done by me.

Files:
1 modified

Legend:

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

    r9585 r9602  
    16781678                        return 
    16791679                elif mtype == 'chat': # it's type 'chat' 
     1680 
     1681                        if gajim.otr_module and isinstance(msgtxt, unicode): 
     1682                                otr_msg_tuple = gajim.otr_module.otrl_message_receiving( 
     1683                                        gajim.otr_userstates[self.name], 
     1684                                        (gajim.otr_ui_ops, {'account':self.name}), 
     1685                                        gajim.get_jid_from_account(self.name).encode(), 
     1686                                        gajim.OTR_PROTO, frm.encode(), msgtxt.encode(), 
     1687                                        (gajim.otr_add_appdata, self.name)) 
     1688                                msgtxt = unicode(otr_msg_tuple[1]) 
     1689                                # OTR messages are unformatted, or rather contain the same 
     1690                                # text in <body> and <html> 
     1691                                msghtml = msgtxt 
     1692 
     1693                                if gajim.otr_module.otrl_tlv_find(otr_msg_tuple[2], 
     1694                                                gajim.otr_module.OTRL_TLV_DISCONNECTED) != None: 
     1695                                        gajim.otr_ui_ops.gajim_log("%s has ended his/her private conversation" 
     1696                                                        " with you; you should do the same."%frm, self.name, 
     1697                                                        frm) 
     1698                                        ctrl = gajim.interface.msg_win_mgr.get_control(frm, self.name) 
     1699                                        if ctrl: 
     1700                                                ctrl.update_ui() 
     1701 
     1702                                ctx = gajim.otr_module.otrl_context_find(gajim.otr_userstates[self.name], frm.encode(), 
     1703                                                gajim.get_jid_from_account(self.name).encode(), gajim.OTR_PROTO, 1, 
     1704                                                (gajim.otr_add_appdata, self.name))[0] 
     1705                                tlvs = otr_msg_tuple[2] 
     1706                                ctx.app_data.handle_tlv(tlvs) 
     1707 
    16801708                        if not msg.getTag('body') and chatstate is None: #no <body> 
    16811709                                return