diff --git a/src/check_for_new_version.py b/src/check_for_new_version.py index 3128a75f9e5d54cb54782e14994f74286f72b824..82710c976d465e263c840d92fe4faed6d2691962 100644 --- a/src/check_for_new_version.py +++ b/src/check_for_new_version.py @@ -1,4 +1,4 @@ -## common/check_for_new_version.py +## check_for_new_version.py ## ## Gajim Team: ## - Yann Le Boulanger <asterix@lagaule.org> diff --git a/src/common/logger.py b/src/common/logger.py index c56843c24abe75cedc7af8c7b04180cb61d0cfbb..a867fefb2ad76f16cfe937b866f0ab4f9599f6be 100644 --- a/src/common/logger.py +++ b/src/common/logger.py @@ -62,6 +62,7 @@ def write(self, kind, msg, jid, show = None, tim = None): if not msg: msg = '' + msg = helpers.to_one_line(msg) if len(jid.split('/')) > 1: ji, nick = jid.split('/', 1) diff --git a/src/dialogs.py b/src/dialogs.py index 89488dac565980e0f1446b070ff9a4eef8d073e7..a8a2f7d0186919b17989071b5a533f51c326532c 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -22,6 +22,8 @@ import gobject import os +import gtkgui_helpers.py + from vcard import VcardWindow from gajim_themes_window import GajimThemesWindow from advanced import AdvancedConfigurationWindow @@ -592,12 +594,8 @@ def add_status(self, file_path, resource, priority, show, status): str_status += ' - ' + status status_label = gtk.Label(str_status) status_label.set_alignment(00, 0) - self.table.attach(status_label, 3, 4, self.current_row, self.current_row + 1, - gtk.EXPAND | gtk.FILL, 0, 0, 0) - - def escape_entities(self, text): - # escapes markup entities - return text.replace('&', '&').replace('>','>').replace('<','<') + self.table.attach(status_label, 3, 4, self.current_row, + self.current_row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0) def populate(self, contacts): if not contacts or len(contacts) == 0: @@ -645,9 +643,9 @@ def populate(self, contacts): info = '<span size="large" weight="bold">' + prim_contact.jid + '</span>' info += '\n<span weight="bold">' + _('Name: ') + '</span>' + \ - self.escape_entities(prim_contact.name) + gtkgui_helpers.escape_for_pango_markup(prim_contact.name) info += '\n<span weight="bold">' + _('Subscription: ') + '</span>' + \ - self.escape_entities(prim_contact.sub) + gtkgui_helpers.escape_for_pango_markup(prim_contact.sub) if prim_contact.keyID: keyID = None @@ -657,7 +655,7 @@ def populate(self, contacts): keyID = prim_contact.keyID[8:] if keyID: info += '\n<span weight="bold">' + _('OpenPGP: ') + \ - '</span>' + self.escape_entities(keyID ) + '</span>' + gtkgui_helpers.escape_for_pango_markup(keyID) single_line, resource_str, multiple_resource= '', '', False num_resources = 0 @@ -676,7 +674,7 @@ def populate(self, contacts): else: # only one resource if contact.resource: info += '\n<span weight="bold">' + _('Resource: ') + \ - '</span>' + self.escape_entities(contact.resource) + ' (' + str(contact.priority) + ')' + '</span>' + gtkgui_helpers.escape_for_pango_markup(contact.resource) + ' (' + str(contact.priority) + ')' if contact.show: info += '\n<span weight="bold">' + _('Status: ') + \ '</span>' + helpers.get_uf_show(contact.show) @@ -684,7 +682,7 @@ def populate(self, contacts): status = contact.status.strip() if status != '': # escape markup entities. Is it posible to have markup in status? - info += ' - ' + self.escape_entities(status) + info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status) self.account.set_markup(info) diff --git a/src/gtkgui.glade b/src/gtkgui.glade index 2cf848c15f272a2f19db03f8d35c8b3ef58dfabc..6050b8872268370a566ad7156660b5b31eeccb00 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -10008,8 +10008,8 @@ Custom</property> <child> <widget class="GtkLabel" id="banner_name_label"> <property name="visible">True</property> - <property name="label"><span weight="heavy" size="large">Contact: name</span> -JID: whatever@jabber.org</property> + <property name="label"><span weight="heavy" size="large">Contact name</span> +Status message</property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 24a45a8f998c22eaf79f62be50a650519452472e..751f6fc4669bae2ab9c2de0d0d9de4e3c5dac11e 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -1,3 +1,27 @@ +## gtkgui_helpers.py +## +## Gajim Team: +## - Yann Le Boulanger <asterix@lagaule.org> +## - Vincent Hanquez <tab@snarc.org> +## - Nikos Kouremenos <kourem@gmail.com> +## - Dimitur Kirov <dkirov@gmail.com> +## +## This file was initially written by Dimitur Kirov +## +## Copyright (C) 2003-2005 Gajim Team +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation; version 2 only. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## + +import cgi + from common import gajim def get_contact_instances_from_jid(account, jid): @@ -12,3 +36,7 @@ def get_first_contact_instance_from_jid(account, jid): def get_contact_name_from_jid(account, jid): contact_instances = get_contact_instances_from_jid(account, jid) return contact_instances[0].name + +def escape_for_pango_markup(string): + # escapes chars for pango markup not to break + return cgi.escape(string) diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index ca8bdf72caa02da4502ac0377cd895fc136d7657..19509db0182f53fcb5f9d922e7e9a8bd17adcdb9 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -113,8 +113,7 @@ def draw_name_banner(self, contact, chatstate = None): houses the status icon, name, jid, and avatar''' # this is the text for the big brown bar # some chars need to be escaped.. - name = contact.name.replace('&', '&').replace('>','>').replace( - '<','<') + name = gtkgui_helpers.escape_for_pango_markup(contact.name) jid = contact.jid status = contact.status