diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 2 | ||||
-rw-r--r-- | src/logger.py | 2 | ||||
-rw-r--r-- | src/room.py | 3 | ||||
-rw-r--r-- | src/tabs.py | 2 | ||||
-rw-r--r-- | src/xhtml.py | 8 |
5 files changed, 14 insertions, 3 deletions
diff --git a/src/core.py b/src/core.py index f4cca7e3..44c967ca 100644 --- a/src/core.py +++ b/src/core.py @@ -931,7 +931,7 @@ class Core(object): self.add_message_to_text_buffer(room, _("%(nick)s set the subject to: %(subject)s") % {'nick':nick_from, 'subject':subject}, time=None) else: self.add_message_to_text_buffer(room, _("The subject is: %(subject)s") % {'subject':subject}, time=None) - room.topic = subject.replace('\n', '|') + room.topic = subject if self.get_tab_by_name(room_from, tabs.MucTab) is self.current_tab(): self.refresh_window() diff --git a/src/logger.py b/src/logger.py index 4078c46a..ad615f9b 100644 --- a/src/logger.py +++ b/src/logger.py @@ -19,6 +19,7 @@ from os import environ, makedirs import os from datetime import datetime from config import config +from xhtml import clean_text import logging @@ -70,6 +71,7 @@ class Logger(object): if not fd: return try: + msg = clean_text(msg) if nick: fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+nick+': '+msg+'\n') else: diff --git a/src/room.py b/src/room.py index 3ff655fb..a5a05845 100644 --- a/src/room.py +++ b/src/room.py @@ -45,6 +45,9 @@ class Room(TextBuffer): self.users = [] self.joined = False + def get_single_line_topic(self): + return self.topic.replace('\n', '|') + def log_message(self, txt, time, nickname): """ Log the messages in the archives, if it needs diff --git a/src/tabs.py b/src/tabs.py index 0bcc95e9..3c8bfdff 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -709,7 +709,7 @@ class MucTab(ChatTab): if self.need_resize: self.resize() log.debug(' TAB Refresh: %s'%self.__class__.__name__) - self.topic_win.refresh(self._room.topic) + self.topic_win.refresh(self._room.get_single_line_topic()) self.text_win.refresh(self._room) self.v_separator.refresh() self.user_win.refresh(self._room.users) diff --git a/src/xhtml.py b/src/xhtml.py index 29017be3..d755229f 100644 --- a/src/xhtml.py +++ b/src/xhtml.py @@ -71,7 +71,13 @@ def convert_links_to_plaintext(text): previous_child = None for child in parent: if child.tag == '{http://www.w3.org/1999/xhtml}a': - link_text = '\n%s (%s)'%(child.attrib['href'], child.text) + if child.attrib['href'] != child.text: + if child.text is None and 'title' in child.attrib: + link_text = '\n%s (%s)'%(child.attrib['href'], child.attrib['title']) + else: + link_text = '\n%s (%s)'%(child.attrib['href'], child.text) + else: + link_text = child.text if previous_child is not None: if previous_child.tail is None: previous_child.tail = link_text |