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/chat_control.py

    r9761 r9771  
    11361136                self.status_tooltip = gtk.Tooltips() 
    11371137 
    1138                 if gajim.otr_module: 
    1139                         self.update_otr(True) 
    1140  
    11411138                self.update_ui() 
    11421139                # restore previous conversation 
     
    12071204                # The name banner is drawn here 
    12081205                ChatControlBase.update_ui(self) 
    1209  
    1210         def get_otr_status(self): 
    1211                 if not self.session: 
    1212                         return 0 
    1213  
    1214                 ctx = gajim.otr_module.otrl_context_find( 
    1215                         self.session.conn.otr_userstates, 
    1216                         self.contact.get_full_jid().encode(), 
    1217                         gajim.get_jid_from_account(self.account).encode(), 
    1218                         gajim.OTR_PROTO, 1, (gajim.otr_add_appdata, 
    1219                         self.account))[0] 
    1220  
    1221                 if ctx.msgstate == gajim.otr_module.OTRL_MSGSTATE_ENCRYPTED: 
    1222                         if ctx.active_fingerprint.trust: 
    1223                                 return 2 
    1224                         else: 
    1225                                 return 1 
    1226                 elif ctx.msgstate == gajim.otr_module.OTRL_MSGSTATE_FINISHED: 
    1227                         return 3 
    1228                 return 0 
    1229  
    1230         def update_otr(self, print_status=False): 
    1231                 otr_status_text = '' 
    1232                 otr_status = self.get_otr_status() 
    1233                 authenticated = False 
    1234  
    1235                 if otr_status > 0: 
    1236                         enc_status = True 
    1237                 else: 
    1238                         enc_status = False 
    1239  
    1240                 if otr_status == 1: 
    1241                         otr_status_text = u'*unauthenticated* secure OTR ' + \ 
    1242                                 u'connection' 
    1243                 elif otr_status == 2: 
    1244                         otr_status_text = u'authenticated secure OTR ' + \ 
    1245                                 u'connection' 
    1246                         authenticated = True 
    1247                 elif otr_status == 3: 
    1248                         otr_status_text = u'finished OTR connection' 
    1249  
    1250                 self._show_lock_image(enc_status, u'OTR', enc_status, True, 
    1251                         authenticated) 
    1252                 if print_status and otr_status_text != '': 
    1253                         self.print_conversation_line(u'[OTR] %s' % \ 
    1254                                 otr_status_text, 'status', '', None) 
    12551206 
    12561207        def _update_banner_state_image(self): 
     
    16591610                                # ESessions 
    16601611                                if not encrypted: 
    1661                                         msg = _('The following message was ' + \ 
    1662                                                 'NOT encrypted') 
    1663                                         ChatControlBase.print_conversation_line( 
    1664                                                 self, msg, 'status', '', tim) 
    1665                         elif gajim.otr_module and self.get_otr_status() > 0: 
    1666                                 # OTR 
    1667                                 # TODO: This is not shown when the window 
    1668                                 #       isn't open - needs fixing! 
    1669                                 if not encrypted and frm == '': 
    16701612                                        msg = _('The following message was ' + \ 
    16711613                                                'NOT encrypted') 
     
    17971739                toggle_gpg_menuitem = xml.get_widget('toggle_gpg_menuitem') 
    17981740                toggle_e2e_menuitem = xml.get_widget('toggle_e2e_menuitem') 
    1799                 otr_submenu = xml.get_widget('otr_submenu') 
    1800                 otr_settings_menuitem = xml.get_widget('otr_settings_menuitem') 
    1801                 smp_otr_menuitem = xml.get_widget('smp_otr_menuitem') 
    1802                 start_otr_menuitem = xml.get_widget('start_otr_menuitem') 
    1803                 end_otr_menuitem = xml.get_widget('end_otr_menuitem') 
    18041741                send_file_menuitem = xml.get_widget('send_file_menuitem') 
    18051742                information_menuitem = xml.get_widget('information_menuitem') 
     
    18941831                self.handlers[id] = convert_to_gc_menuitem 
    18951832 
    1896                 if gajim.otr_module: 
    1897                         otr_submenu.set_sensitive(True) 
    1898                         id = otr_settings_menuitem.connect('activate', 
    1899                                 self._on_otr_settings_menuitem_activate) 
    1900                         self.handlers[id] = otr_settings_menuitem 
    1901                         id = start_otr_menuitem.connect('activate', 
    1902                                 self._on_start_otr_menuitem_activate) 
    1903                         self.handlers[id] = start_otr_menuitem 
    1904                         id = end_otr_menuitem.connect('activate', 
    1905                                 self._on_end_otr_menuitem_activate) 
    1906                         self.handlers[id] = end_otr_menuitem 
    1907                         id = smp_otr_menuitem.connect('activate', 
    1908                                 self._on_smp_otr_menuitem_activate) 
    1909                         self.handlers[id] = smp_otr_menuitem 
    1910  
    1911                         ctx = gajim.otr_module.otrl_context_find(gajim.connections[self.account].otr_userstates, 
    1912                                 self.contact.get_full_jid().encode(), 
    1913                                 gajim.get_jid_from_account(self.account).encode(), gajim.OTR_PROTO, 1, 
    1914                                 (gajim.otr_add_appdata, self.account))[0] 
    1915                         # can end only when PLAINTEXT 
    1916                         end_otr_menuitem.set_sensitive(ctx.msgstate != 
    1917                                 gajim.otr_module.OTRL_MSGSTATE_PLAINTEXT) 
    1918                         # can SMP only when ENCRYPTED 
    1919                         smp_otr_menuitem.set_sensitive(ctx.msgstate == 
    1920                                 gajim.otr_module.OTRL_MSGSTATE_ENCRYPTED) 
    1921  
    19221833                menu.connect('selection-done', self.destroy_menu, 
    19231834                        send_file_menuitem, convert_to_gc_menuitem, 
     
    24072318                        self.session.negotiate_e2e(False) 
    24082319 
    2409         def _on_start_otr_menuitem_activate(self, widget): 
    2410                 # ?OTR? gets replaced with a better message internally in otrl_message_sending 
    2411                 MessageControl.send_message(self, u'?OTR?', type='chat') 
    2412         def _on_end_otr_menuitem_activate(self, widget): 
    2413                 fjid = self.contact.get_full_jid() 
    2414                 gajim.otr_module.otrl_message_disconnect( 
    2415                         self.session.conn.otr_userstates, (gajim.otr_ui_ops, 
    2416                         {'account': self.account, 'urgent': True}), 
    2417                         gajim.get_jid_from_account(self.account).encode(), 
    2418                         gajim.OTR_PROTO, fjid.encode()) 
    2419                 gajim.otr_ui_ops.gajim_log(_('Private conversation with ' \ 
    2420                         '%s lost.') % fjid, self.account, fjid.encode()) 
    2421                 self.update_otr() 
    2422         def _on_otr_settings_menuitem_activate(self, widget): 
    2423                 gajim.otr_windows.ContactOtrWindow(self.contact, self.account, self) 
    2424         def _on_smp_otr_menuitem_activate(self, widget): 
    2425                 ctx = gajim.otr_module.otrl_context_find(gajim.connections[self.account].otr_userstates, 
    2426                         self.contact.get_full_jid().encode(), 
    2427                         gajim.get_jid_from_account(self.account).encode(), gajim.OTR_PROTO, 1, 
    2428                         (gajim.otr_add_appdata, self.account))[0] 
    2429                 ctx.app_data.show(False) 
    2430  
    24312320        def got_connected(self): 
    24322321                ChatControlBase.got_connected(self)