Show
Ignore:
Timestamp:
06/08/08 17:27:05 (6 months ago)
Author:
js
Message:

Completely remove OTR.

Sorry, it just wasn't maintainable. The problem is the current libotr
API. I'm sick of working around the strange libotr API, sick of getting
HTML messages, sick of losing messages. The final argument for
completely removing it was that we can't get the message ID of a sent
msg anymore - which we need. I tried to work around this as well, but
there seems to be no way to wait for a signal in glib the way I would
need it for the workaround (I wanted to emit a signal in inject_message
and then wait for it after the call to otr_message_fragment_and_send
so the signal can pass us the message id). And the last reason is that
we're heading towards a new release and thus want to stabilize the code,
thus don't have time to work around even more libotr API strangeness.
I will give feedback to the libotr developers, who are currently
planning a new API, so that we can hopefully see OTR support once again
as soon as libotr4 is released.

Kjell already announced that he will continue his branch:
https://code.launchpad.net/~afflux/gajim/otr

I really hope the libotr devs will provide a sane API with libotr4 so
we can integrate OTR support again.

Oh, and I added one more try/except block for OS X.

Files:
1 modified

Legend:

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

    r9764 r9771  
    12191219                self.sessions = {} 
    12201220 
    1221                 if gajim.otr_module: 
    1222                         self.otr_userstates = gajim.otr_module.otrl_userstate_create() 
    1223  
    12241221        def _FeatureNegCB(self, con, stanza, session): 
    12251222                gajim.log.debug('FeatureNegCB') 
     
    17051702                        receipt.setThread(thread_id) 
    17061703                        con.send(receipt) 
    1707  
    1708                 # We don't trust libotr, that's why we only pass the message 
    1709                 # to it if necessary. otrl_proto_message_type does this check. 
    1710                 if gajim.otr_module and not xep_200_encrypted \ 
    1711                 and isinstance(msgtxt, unicode) and \ 
    1712                 gajim.otr_module.otrl_proto_message_type(msgtxt.encode()) != \ 
    1713                 gajim.otr_module.OTRL_MSGTYPE_NOTOTR: 
    1714                         # set to encrypted if it's really encrypted. 
    1715                         if gajim.otr_module.otrl_proto_message_type( 
    1716                         msgtxt.encode()) != \ 
    1717                         gajim.otr_module.OTRL_MSGTYPE_TAGGEDPLAINTEXT: 
    1718                                 encrypted = True 
    1719  
    1720                         # TODO: Do we really need .encode()? 
    1721                         # yes we do. OTR can't handle unicode. 
    1722                         otr_msg_tuple = \ 
    1723                                 gajim.otr_module.otrl_message_receiving( 
    1724                                 self.otr_userstates, 
    1725                                 (gajim.otr_ui_ops, {'account': self.name}), 
    1726                                 gajim.get_jid_from_account(self.name).encode(), 
    1727                                 gajim.OTR_PROTO, 
    1728                                 frm.encode(), 
    1729                                 msgtxt.encode(), 
    1730                                 (gajim.otr_add_appdata, self.name)) 
    1731                         msgtxt = unicode(otr_msg_tuple[1]) 
    1732  
    1733                         html_node = msg.getTag('html') 
    1734                         if html_node: 
    1735                                 msg.delChild(html_node) 
    1736                         msg.setBody(msgtxt) 
    1737  
    1738                         if gajim.otr_module.otrl_tlv_find( 
    1739                         otr_msg_tuple[2], 
    1740                         gajim.otr_module.OTRL_TLV_DISCONNECTED) != None: 
    1741                                 gajim.otr_ui_ops.gajim_log(_('%s ' \ 
    1742                                         'has ended his/her private ' \ 
    1743                                         'conversation with you. You should ' \ 
    1744                                         'do the same.') % frm, 
    1745                                         self.name, 
    1746                                         frm.encode()) 
    1747  
    1748                                 ctrls = gajim.interface.msg_win_mgr.get_chat_controls(jid, self.name) 
    1749                                 for ctrl in ctrls: 
    1750                                         ctrl.update_otr() 
    1751  
    1752                         ctx = gajim.otr_module. \ 
    1753                                 otrl_context_find( 
    1754                                 self.otr_userstates, 
    1755                                 frm.encode(), 
    1756                                 gajim.get_jid_from_account( 
    1757                                 self.name).encode(), 
    1758                                 gajim.OTR_PROTO, 1, 
    1759                                 (gajim.otr_add_appdata, 
    1760                                 self.name))[0] 
    1761                         tlvs = otr_msg_tuple[2] 
    1762                         ctx.app_data.handle_tlv(tlvs) 
    1763  
    1764                         if msgtxt == '': 
    1765                                 return 
    1766                 elif msgtxt != None and msgtxt != '': 
    1767                         gajim.otr_dont_append_tag[frm] = True 
    1768  
    1769                         # We're also here if we just don't 
    1770                         # support OTR. Thus, we should strip 
    1771                         # the tags from plaintext messages 
    1772                         # since they look ugly. 
    1773                         msgtxt = msgtxt.replace('\x20\x09\x20' \ 
    1774                                 '\x20\x09\x09\x09\x09\x20\x09' \ 
    1775                                 '\x20\x09\x20\x09\x20\x20', '') 
    1776                         msgtxt = msgtxt.replace('\x20\x09\x20' \ 
    1777                                 '\x09\x20\x20\x09\x20', '') 
    1778                         msgtxt = msgtxt.replace('\x20\x20\x09' \ 
    1779                                 '\x09\x20\x20\x09\x20', '') 
    17801704 
    17811705                if mtype != 'groupchat':