From c2cb61da06b3c5a3acff152e28bfc5cccda1fd93 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 29 Mar 2011 14:15:02 +0200 Subject: Cleanup some code not used anymore --- src/core.py | 3 +-- src/room.py | 1 - src/tabs.py | 10 +++++----- src/windows.py | 36 ------------------------------------ 4 files changed, 6 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/core.py b/src/core.py index 46e10793..c6b2942b 100644 --- a/src/core.py +++ b/src/core.py @@ -426,7 +426,7 @@ class Core(object): def on_user_changed_status_in_private(self, jid, msg): tab = self.get_tab_by_name(jid) if tab: # display the message in private - tab.get_room().add_message(msg, colorized=True) + tab.get_room().add_message(msg) def on_message(self, message): """ @@ -459,7 +459,6 @@ class Core(object): return body = message['body'] room.add_message(body, time=None, nickname=nick_from, - colorized=False, forced_user=self.get_room_by_name(room_from).get_user_by_name(nick_from)) conversation = self.get_tab_by_name(jid.full, tabs.PrivateTab) if conversation and conversation.remote_wants_chatstates is None: diff --git a/src/room.py b/src/room.py index d062e29c..ace0ee44 100644 --- a/src/room.py +++ b/src/room.py @@ -114,7 +114,6 @@ class Room(TextBuffer): time = time or datetime.now() message = Message(txt=txt, nick_color=nick_color, time=time, nickname=nickname, user=user) - # message = Message(txt, time, nickname, nick_color, color, colorized, user=user) while len(self.messages) > self.messages_nb_limit: self.messages.pop(0) self.messages.append(message) diff --git a/src/tabs.py b/src/tabs.py index ccafe881..f0440102 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -802,7 +802,7 @@ class MucTab(ChatTab): kick_msg = _('\x191%(spec)s \x193%(nick)s \x195has been banned') % {'spec':theme.CHAR_KICK, 'nick':from_nick.replace('"', '\\"')} if reason is not None and reason.text: kick_msg += _(' Reason: \x196%(reason)s') % {'reason': reason.text} - room.add_message(kick_msg, colorized=True) + room.add_message(kick_msg) def on_user_kicked(self, room, presence, user, from_nick): """ @@ -882,7 +882,7 @@ class MucTab(ChatTab): show != user.show or\ status != user.status): # display the message in the room - room.add_message(msg, colorized=True) + room.add_message(msg) self.core.on_user_changed_status_in_private('%s/%s' % (from_room, from_nick), msg) # finally, effectively change the user status user.update(affiliation, show, status, role) @@ -1009,7 +1009,7 @@ class PrivateTab(ChatTab): The user changed her nick in the corresponding muc: update the tab’s name and display a message. """ - self.get_room().add_message(_('"[%(old_nick)s]" is now known as "[%(new_nick)s]"') % {'old_nick':old_nick.replace('"', '\\"'), 'new_nick':new_nick.replace('"', '\\"')}, colorized=True) + self.get_room().add_message(_('"[%(old_nick)s]" is now known as "[%(new_nick)s]"') % {'old_nick':old_nick.replace('"', '\\"'), 'new_nick':new_nick.replace('"', '\\"')}) new_jid = JID(self.get_room().name).bare+'/'+new_nick self.get_room().name = new_jid @@ -1018,9 +1018,9 @@ class PrivateTab(ChatTab): The user left the associated MUC """ if not status_message: - self.get_room().add_message(_('%(spec)s "[%(nick)s]" has left the room') % {'nick':from_nick.replace('"', '\\"'), 'spec':theme.CHAR_QUIT.replace('"', '\\"')}, colorized=True) + self.get_room().add_message(_('%(spec)s "[%(nick)s]" has left the room') % {'nick':from_nick.replace('"', '\\"'), 'spec':theme.CHAR_QUIT.replace('"', '\\"')}) else: - self.get_room().add_message(_('%(spec)s "[%(nick)s]" has left the room "(%(status)s)"') % {'nick':from_nick.replace('"', '\\"'), 'spec':theme.CHAR_QUIT, 'status': status_message.replace('"', '\\"')}, colorized=True) + self.get_room().add_message(_('%(spec)s "[%(nick)s]" has left the room "(%(status)s)"') % {'nick':from_nick.replace('"', '\\"'), 'spec':theme.CHAR_QUIT, 'status': status_message.replace('"', '\\"')}) class RosterInfoTab(Tab): """ diff --git a/src/windows.py b/src/windows.py index 0bad8c26..786eaf82 100644 --- a/src/windows.py +++ b/src/windows.py @@ -621,42 +621,6 @@ class TextWin(Win): write the text of a line. """ self.addstr_colored(txt, y, x) - return - if not colorized: - if color: - self._win.attron(common.curses_color_pair(color)) - self.addstr(y, x, txt) - if color: - self._win.attroff(common.curses_color_pair(color)) - - else: # Special messages like join or quit - special_words = { - theme.CHAR_JOIN: theme.COLOR_JOIN_CHAR, - theme.CHAR_QUIT: theme.COLOR_QUIT_CHAR, - theme.CHAR_KICK: theme.COLOR_KICK_CHAR, - } - try: - splitted = shlex.split(txt) - except ValueError: - # FIXME colors are disabled on too long words - txt = txt.replace('"[', '').replace(']"', '')\ - .replace('"{', '').replace('}"', '')\ - .replace('"(', '').replace(')"', '') - splitted = txt.split() - for word in splitted: - if word in special_words.keys(): - self.addstr(word, common.curses_color_pair(special_words[word])) - elif word.startswith('(') and word.endswith(')'): - self.addstr('(', common.curses_color_pair(color)) - self.addstr(word[1:-1], common.curses_color_pair(theme.COLOR_CURLYBRACKETED_WORD)) - self.addstr(')', common.curses_color_pair(color)) - elif word.startswith('{') and word.endswith('}'): - self.addstr(word[1:-1], common.curses_color_pair(theme.COLOR_ACCOLADE_WORD)) - elif word.startswith('[') and word.endswith(']'): - self.addstr(word[1:-1], common.curses_color_pair(theme.COLOR_BRACKETED_WORD)) - else: - self.addstr(word, common.curses_color_pair(color)) - self.addstr(' ') def write_nickname(self, nickname, color): """ -- cgit v1.2.3