fix some stuff, maybe

This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-12-31 11:23:56 +00:00
parent 3b2d28e6ee
commit b815cbf055
4 changed files with 12 additions and 11 deletions

View file

@ -490,7 +490,7 @@ class Core(object):
if not conversation:
# We create the conversation with the bare Jid if nothing was found
conversation = self.open_conversation_window(jid.bare, False)
conversation.get_room().add_message(body, None, jid.full, False, curses.color_pair(theme.COLOR_REMOTE_USER))
conversation.get_room().add_message(body, None, jid.full, False, 5)
if self.current_tab() is not conversation:
conversation.set_color_state(theme.COLOR_TAB_PRIVATE)
self.refresh_window()

View file

@ -116,7 +116,8 @@ class Room(TextBuffer):
if time: # History messages are colored to be distinguished
color = theme.COLOR_INFORMATION_TEXT
time = time if time is not None else datetime.now()
message = Message(txt, time, nickname, nick_color or user.color, color, colorized)
nick_color = nick_color or user.color if user else None
message = Message(txt, time, nickname, nick_color, color, colorized)
while len(self.messages) > MESSAGE_NB_LIMIT:
self.messages.pop(0)
self.messages.append(message)

View file

@ -36,6 +36,7 @@ import theme
import curses
import difflib
import shlex
import text_buffer
from sleekxmpp.xmlstream.stanzabase import JID
from config import config
@ -191,21 +192,20 @@ class InfoTab(Tab):
The information tab, used to display global informations
when using a anonymous account
"""
def __init__(self, core, name):
def __init__(self, core):
Tab.__init__(self, core)
self.tab_win = windows.GlobalInfoBar()
self.text_win = windows.TextWin()
self.info_win = windows.TextWin()
self.core.information_buffer.add_window(self.info_win)
self.input = windows.Input()
self.name = name
self.name = "Info"
self.color_state = theme.COLOR_TAB_NORMAL
self.resize()
def resize(self):
Tab.resize(self)
self.tab_win.resize(1, self.width, self.height-2, 0, self.core.stdscr)
self.tab_win.resize(1, self.width, self.height-2, 0, self.core.stdscr)
self.text_win.resize(self.height-2, self.width, 0, 0, self.core.stdscr)
self.text_win.rebuild_everything(self._room)
self.input.resize(1, self.width, self.height-1, 0, self.core.stdscr)
def refresh(self, tabs, informations, _):
@ -863,12 +863,12 @@ class ConversationTab(ChatTab):
The tab containg a normal conversation (not from a MUC)
"""
def __init__(self, core, jid):
text_buffer = windows.TextBuffer()
ChatTab.__init__(self, core, text_buffer)
txt_buff = text_buffer.TextBuffer()
ChatTab.__init__(self, core, txt_buff)
self.color_state = theme.COLOR_TAB_NORMAL
self._name = jid # a conversation tab is linked to one specific full jid OR bare jid
self.text_win = windows.TextWin()
text_buffer.add_window(self.text_win)
txt_buff.add_window(self.text_win)
self.upper_bar = windows.ConversationStatusMessageWin()
self.info_header = windows.ConversationInfoWin()
self.info_win = windows.TextWin()

View file

@ -41,7 +41,7 @@ COLOR_USER_NONE = 0
COLOR_USER_MODERATOR = 1
# nickname colors
COLOR_REMOTE_USER = 23
COLOR_REMOTE_USER = 5
# The character printed in color (COLOR_STATUS_*) before the nickname
# in the user list