diff --git a/configure.ac b/configure.ac index 7545378a6..cc04ee34b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([Gajim - A Jabber Instant Messager], - [0.12.5.1-dev],[http://trac.gajim.org/],[gajim]) + [0.12.5.2-dev],[http://trac.gajim.org/],[gajim]) AC_PREREQ([2.59]) AC_CONFIG_HEADER(config.h) diff --git a/src/chat_control.py b/src/chat_control.py index 6c4d613e3..dc8dc10ed 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -76,6 +76,9 @@ if gajim.config.get('use_speller') and HAS_GTK_SPELL: spell.set_language(langs[lang]) except OSError: del langs[lang] + if spell: + spell.detach() + del tv ################################################################################ class ChatControlBase(MessageControl, CommonCommands): @@ -1469,6 +1472,19 @@ class ChatControl(ChatControlBase, ChatCommands): else: self._tune_image.hide() + def change_resource(self, resource): + old_full_jid = self.get_full_jid() + self.resource = resource + new_full_jid = self.get_full_jid() + # update gajim.last_message_time + if old_full_jid in gajim.last_message_time[self.account]: + gajim.last_message_time[self.account][new_full_jid] = \ + gajim.last_message_time[self.account][old_full_jid] + # update events + gajim.events.change_jid(self.account, old_full_jid, new_full_jid) + # update MessageWindow._controls + self.parent_win.change_jid(self.account, old_full_jid, new_full_jid) + def on_avatar_eventbox_enter_notify_event(self, widget, event): ''' we enter the eventbox area so we under conditions add a timeout @@ -2299,6 +2315,10 @@ class ChatControl(ChatControlBase, ChatCommands): self.handlers[i].disconnect(i) del self.handlers[i] self.conv_textview.del_handlers() + if gajim.config.get('use_speller') and HAS_GTK_SPELL: + spell_obj = gtkspell.get_from_text_view(self.msg_textview) + if spell_obj: + spell_obj.detach() self.msg_textview.destroy() def minimizable(self): diff --git a/src/common/config.py b/src/common/config.py index 1f99ef702..f2277f93e 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -67,7 +67,6 @@ class Config: __options = { # name: [ type, default_value, help_string ] 'verbose': [ opt_bool, False, '', True ], - 'alwaysauth': [ opt_bool, False ], 'autopopup': [ opt_bool, False ], 'notify_on_signin': [ opt_bool, True ], 'notify_on_signout': [ opt_bool, False ], @@ -287,6 +286,7 @@ class Config: 'autoconnect_as': [ opt_str, 'online', _('Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible. NOTE: this option is used only if restore_last_status is disabled'), True ], 'restore_last_status': [ opt_bool, False, _('If enabled, restore the last status that was used.') ], 'autoreconnect': [ opt_bool, True ], + 'autoauth': [ opt_bool, False, _('If True, Contacts requesting authorization will be automatically accepted.')], 'active': [ opt_bool, True], 'proxy': [ opt_str, '', '', True ], 'keyid': [ opt_str, '', '', True ], diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index b4576a455..60c9fbb5c 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -2353,13 +2353,14 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, if ptype == 'subscribe': log.debug('subscribe request from %s' % who) - if gajim.config.get('alwaysauth') or who.find("@") <= 0 or \ - jid_stripped in self.jids_for_auto_auth or transport_auto_auth: + if gajim.config.get_per('accounts', self.name, 'autoauth') or \ + who.find('@') <= 0 or jid_stripped in self.jids_for_auto_auth or \ + transport_auto_auth: if self.connection: p = common.xmpp.Presence(who, 'subscribed') p = self.add_sha(p) self.connection.send(p) - if who.find("@") <= 0 or transport_auto_auth: + if who.find('@') <= 0 or transport_auto_auth: self.dispatch('NOTIFY', (jid_stripped, 'offline', 'offline', resource, prio, keyID, timestamp, None)) if transport_auto_auth: diff --git a/src/common/defs.py b/src/common/defs.py index e213fdab1..83ef075a3 100644 --- a/src/common/defs.py +++ b/src/common/defs.py @@ -27,7 +27,7 @@ docdir = '../' datadir = '../' localedir = '../po' -version = '0.12.5.1-dev' +version = '0.12.5.2-dev' import sys, os.path for base in ('.', 'common'): diff --git a/src/common/latex.py b/src/common/latex.py index 2d783726d..777577d1c 100644 --- a/src/common/latex.py +++ b/src/common/latex.py @@ -114,6 +114,12 @@ def latex_to_image(str_): result = None exitcode = 0 + try: + bg_str, fg_str = gajim.interface.get_bg_fg_colors() + except: + # interface may not be available when we test latext at startup + bg_str, fg_str = 'rgb 1.0 1.0 1.0', 'rgb 0.0 0.0 0.0' + # filter latex code with bad commands if check_blacklist(str_): # we triggered the blacklist, immediately return None @@ -131,7 +137,7 @@ def latex_to_image(str_): if exitcode == 0: # convert dvi to png latex_png_dpi = gajim.config.get('latex_png_dpi') - exitcode = try_run(['dvipng', '-bg', 'rgb 1.0 1.0 1.0', '-T', + exitcode = try_run(['dvipng', '-bg', bg_str, '-fg', fg_str, '-T', 'tight', '-D', latex_png_dpi, tmpfile + '.dvi', '-o', tmpfile + '.png']) diff --git a/src/common/optparser.py b/src/common/optparser.py index bc455e1f6..5cedeeaca 100644 --- a/src/common/optparser.py +++ b/src/common/optparser.py @@ -202,6 +202,8 @@ class OptionsParser: self.update_config_to_01231() if old < [0, 12, 5, 1] and new >= [0, 12, 5, 1]: self.update_config_to_01251() + if old < [0, 12, 5, 2] and new >= [0, 12, 5, 2]: + self.update_config_to_01252() gajim.logger.init_vars() gajim.config.set('version', new_version) @@ -727,4 +729,11 @@ class OptionsParser: con.close() gajim.config.set('version', '0.12.5.1') + def update_config_to_01252(self): + if 'alwaysauth' in self.old_values: + val = self.old_values['alwaysauth'] + for account in gajim.config.get_per('accounts'): + gajim.config.set_per('accounts', account, 'autoauth', val) + gajim.config.set('version', '0.12.5.2') + # vim: se ts=3: diff --git a/src/config.py b/src/config.py index 8d36742e2..7aea772a7 100644 --- a/src/config.py +++ b/src/config.py @@ -1077,6 +1077,7 @@ class ManageProxiesWindow: self.proxytype_combobox = self.xml.get_widget('proxytype_combobox') self.init_list() + self.block_signal = False self.xml.signal_autoconnect(self) self.window.show_all() # hide the BOSH fields by default @@ -1134,6 +1135,7 @@ class ManageProxiesWindow: iter_ = model.append() model.set(iter_, 0, 'proxy' + unicode(i)) gajim.config.add_per('proxies', 'proxy' + unicode(i)) + self.proxies_treeview.set_cursor(model.get_path(iter_)) def on_remove_proxy_button_clicked(self, widget): (model, iter_) = self.proxies_treeview.get_selection().get_selected() @@ -1143,11 +1145,16 @@ class ManageProxiesWindow: model.remove(iter_) gajim.config.del_per('proxies', proxy) self.xml.get_widget('remove_proxy_button').set_sensitive(False) + self.block_signal = True + self.on_proxies_treeview_cursor_changed(self.proxies_treeview) + self.block_signal = False def on_close_button_clicked(self, widget): self.window.destroy() def on_useauth_checkbutton_toggled(self, widget): + if self.block_signal: + return act = widget.get_active() proxy = self.proxyname_entry.get_text().decode('utf-8') gajim.config.set_per('proxies', proxy, 'useauth', act) @@ -1155,6 +1162,8 @@ class ManageProxiesWindow: self.xml.get_widget('proxypass_entry').set_sensitive(act) def on_boshuseproxy_checkbutton_toggled(self, widget): + if self.block_signal: + return act = widget.get_active() proxy = self.proxyname_entry.get_text().decode('utf-8') gajim.config.set_per('proxies', proxy, 'bosh_useproxy', act) @@ -1164,11 +1173,6 @@ class ManageProxiesWindow: def on_proxies_treeview_cursor_changed(self, widget): #FIXME: check if off proxy settings are correct (see # http://trac.gajim.org/changeset/1921#file2 line 1221 - (model, iter_) = widget.get_selection().get_selected() - if not iter_: - return - proxy = model[iter_][0] - self.xml.get_widget('proxyname_entry').set_text(proxy) proxyhost_entry = self.xml.get_widget('proxyhost_entry') proxyport_entry = self.xml.get_widget('proxyport_entry') proxyuser_entry = self.xml.get_widget('proxyuser_entry') @@ -1176,6 +1180,7 @@ class ManageProxiesWindow: boshuri_entry = self.xml.get_widget('boshuri_entry') useauth_checkbutton = self.xml.get_widget('useauth_checkbutton') boshuseproxy_checkbutton = self.xml.get_widget('boshuseproxy_checkbutton') + self.block_signal = True proxyhost_entry.set_text('') proxyport_entry.set_text('') proxyuser_entry.set_text('') @@ -1188,6 +1193,17 @@ class ManageProxiesWindow: #useauth_checkbutton.set_active(False) #self.on_useauth_checkbutton_toggled(useauth_checkbutton) + (model, iter_) = widget.get_selection().get_selected() + if not iter_: + self.xml.get_widget('proxyname_entry').set_text('') + self.xml.get_widget('proxytype_combobox').set_sensitive(False) + self.xml.get_widget('proxy_table').set_sensitive(False) + self.block_signal = False + return + + proxy = model[iter_][0] + self.xml.get_widget('proxyname_entry').set_text(proxy) + if proxy == _('None'): # special proxy None self.show_bosh_fields(False) self.proxyname_entry.set_editable(False) @@ -1219,12 +1235,15 @@ class ManageProxiesWindow: gajim.config.get_per('proxies', proxy, 'bosh_useproxy')) useauth_checkbutton.set_active( gajim.config.get_per('proxies', proxy, 'useauth')) + self.block_signal = False def on_proxies_treeview_key_press_event(self, widget, event): if event.keyval == gtk.keysyms.Delete: self.on_remove_proxy_button_clicked(widget) def on_proxyname_entry_changed(self, widget): + if self.block_signal: + return (model, iter_) = self.proxies_treeview.get_selection().get_selected() if not iter_: return @@ -1243,6 +1262,8 @@ class ManageProxiesWindow: model.set_value(iter_, 0, new_name) def on_proxytype_combobox_changed(self, widget): + if self.block_signal: + return types = ['http', 'socks5', 'bosh'] type_ = self.proxytype_combobox.get_active() self.show_bosh_fields(types[type_]=='bosh') @@ -1250,26 +1271,36 @@ class ManageProxiesWindow: gajim.config.set_per('proxies', proxy, 'type', types[type_]) def on_proxyhost_entry_changed(self, widget): + if self.block_signal: + return value = widget.get_text().decode('utf-8') proxy = self.proxyname_entry.get_text().decode('utf-8') gajim.config.set_per('proxies', proxy, 'host', value) def on_proxyport_entry_changed(self, widget): + if self.block_signal: + return value = widget.get_text().decode('utf-8') proxy = self.proxyname_entry.get_text().decode('utf-8') gajim.config.set_per('proxies', proxy, 'port', value) def on_proxyuser_entry_changed(self, widget): + if self.block_signal: + return value = widget.get_text().decode('utf-8') proxy = self.proxyname_entry.get_text().decode('utf-8') gajim.config.set_per('proxies', proxy, 'user', value) def on_boshuri_entry_changed(self, widget): + if self.block_signal: + return value = widget.get_text().decode('utf-8') proxy = self.proxyname_entry.get_text().decode('utf-8') gajim.config.set_per('proxies', proxy, 'bosh_uri', value) def on_proxypass_entry_changed(self, widget): + if self.block_signal: + return value = widget.get_text().decode('utf-8') proxy = self.proxyname_entry.get_text().decode('utf-8') gajim.config.set_per('proxies', proxy, 'pass', value) diff --git a/src/dialogs.py b/src/dialogs.py index a12ceee8a..d67d85ee2 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -1698,7 +1698,8 @@ class ChangeNickDialog(InputDialogCheck): if len(self.room_queue) == 0: self.cancel_handler = None self.dialog.destroy() - del gajim.interface.instances['change_nick_dialog'] + if 'change_nick_dialog' in gajim.interface.instances: + del gajim.interface.instances['change_nick_dialog'] return self.account, self.room_jid, self.prompt = self.room_queue.pop(0) self.setup_dialog() diff --git a/src/gajim.py b/src/gajim.py index fc7f581f7..95a7473a3 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -3045,6 +3045,25 @@ class Interface: pep.user_send_tune(acct, artist, title, source) gajim.connections[acct].music_track_info = music_track_info + def get_bg_fg_colors(self): + def gdkcolor_to_rgb (gdkcolor): + return [c / 65535. for c in (gdkcolor.red, gdkcolor.green, + gdkcolor.blue)] + + def format_rgb (r, g, b): + return ' '.join([str(c) for c in ('rgb', r, g, b)]) + + def format_gdkcolor (gdkcolor): + return format_rgb (*gdkcolor_to_rgb (gdkcolor)) + + # get style colors and create string for dvipng + dummy = gtk.Invisible() + dummy.ensure_style() + style = dummy.get_style() + bg_str = format_gdkcolor(style.base[gtk.STATE_NORMAL]) + fg_str = format_gdkcolor(style.text[gtk.STATE_NORMAL]) + return (bg_str, fg_str) + def read_sleepy(self): '''Check idle status and change that status if needed''' if not self.sleeper.poll(): diff --git a/src/message_window.py b/src/message_window.py index 7d227206c..9e4bc725c 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -158,6 +158,15 @@ class MessageWindow(object): if self.account == old_name: self.account = new_name + def change_jid(self, account, old_jid, new_jid): + ''' call then when the full jid of a contral change''' + if account not in self._controls: + return + if old_jid not in self._controls[account]: + return + self._controls[account][new_jid] = self._controls[account][old_jid] + del self._controls[account][old_jid] + def get_num_controls(self): return sum(len(d) for d in self._controls.values()) diff --git a/src/session.py b/src/session.py index f68d7c2dc..f23f3fe9f 100644 --- a/src/session.py +++ b/src/session.py @@ -88,8 +88,8 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession): subject = msg.getSubject() if self.jid != full_jid_with_resource: self.resource = gajim.get_nick_from_fjid(full_jid_with_resource) - if self.control: - self.control.resource = self.resource + if self.control and self.control.resource: + self.control.change_resource(self.resource) if not msg_type or msg_type not in ('chat', 'groupchat', 'error'): msg_type = 'normal'