summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core.py7
-rw-r--r--src/tabs.py35
2 files changed, 25 insertions, 17 deletions
diff --git a/src/core.py b/src/core.py
index 09766852..f06b7c83 100644
--- a/src/core.py
+++ b/src/core.py
@@ -1320,6 +1320,7 @@ class Core(object):
if message['type'] == 'error': # Check if it's an error
return self.room_error(message, room_from)
tab = self.get_tab_by_name(room_from, tabs.MucTab)
+ old_state = tab.state
if not tab:
self.information(_("message received for a non-existing room: %s") % (room_from))
return
@@ -1334,7 +1335,8 @@ class Core(object):
if tab is self.current_tab():
tab.text_win.refresh()
tab.info_header.refresh(tab, tab.text_win)
- self.refresh_tab_win()
+ elif tab.state != old_state:
+ self.refresh_tab_win()
if 'message' in config.get('beep_on', 'highlight private').split():
if config.get_by_tabname('disable_beep', 'false', jid.bare, False).lower() != 'true':
curses.beep()
@@ -2060,11 +2062,12 @@ class Core(object):
del tab.commands # and make the object collectable
tab.on_close()
self.tabs.remove(tab)
+ self.tabs[0].on_gain_focus()
+ self.refresh_window()
import gc
gc.collect()
log.debug('___ Referrers of closing tab:\n%s\n______', gc.get_referrers(tab))
del tab
- self.refresh_window()
def command_server_cycle(self, arg):
"""
diff --git a/src/tabs.py b/src/tabs.py
index 39541b04..c92d350c 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1153,6 +1153,10 @@ class MucTab(ChatTab):
self.add_message(_("\x19%(info_col)s}Your nickname is \x193}%(nick)s") % {'nick': from_nick, 'info_col': get_theme().COLOR_INFORMATION_TEXT[0]})
if '170' in status_codes:
self.add_message('\x191}Warning: \x19%(info_col)s}this room is publicly logged' % {'info_col': get_theme().COLOR_INFORMATION_TEXT[0]})
+ if self.core.current_tab() is not self:
+ self.refresh_tab_win()
+ self.core.current_tab().input.refresh()
+ self.core.doupdate()
else:
change_nick = '303' in status_codes
kick = '307' in status_codes and typ == 'unavailable'
@@ -1185,9 +1189,6 @@ class MucTab(ChatTab):
self.info_header.refresh(self, self.text_win)
self.input.refresh()
self.core.doupdate()
- else:
- self.core.current_tab().refresh_tab_win()
- self.core.doupdate()
def on_user_join(self, from_nick, affiliation, show, status, role, jid):
"""
@@ -1231,6 +1232,7 @@ class MucTab(ChatTab):
self.disconnect()
self.core.disable_private_tabs(self.name)
self.refresh_tab_win()
+ self.core.current_tab().input.refresh()
self.core.doupdate()
if by:
kick_msg = _('\x191}%(spec)s \x193}You\x19%(info_col)s} have been banned by \x194}%(by)s') % {'spec': get_theme().CHAR_KICK, 'by':by, 'info_col': get_theme().COLOR_INFORMATION_TEXT[0]}
@@ -1258,6 +1260,7 @@ class MucTab(ChatTab):
self.disconnect()
self.core.disable_private_tabs(self.name)
self.refresh_tab_win()
+ self.core.current_tab().input.refresh()
self.core.doupdate()
if by:
kick_msg = _('\x191}%(spec)s \x193}You\x19%(info_col)s} have been kicked by \x193}%(by)s') % {'spec': get_theme().CHAR_KICK, 'by':by, 'info_col': get_theme().COLOR_INFORMATION_TEXT[0]}
@@ -1286,6 +1289,7 @@ class MucTab(ChatTab):
self.disconnect()
self.core.disable_private_tabs(from_room)
self.refresh_tab_win()
+ self.core.current_tab().input.refresh()
self.core.doupdate()
hide_exit_join = config.get_by_tabname('hide_exit_join', -1, self.general_jid, True) if config.get_by_tabname('hide_exit_join', -1, self.general_jid, True) >= -1 else -1
if hide_exit_join == -1 or user.has_talked_since(hide_exit_join):
@@ -1297,7 +1301,6 @@ class MucTab(ChatTab):
if status:
leave_msg += ' (%s)' % status
self.add_message(leave_msg)
- self.core.refresh_window()
self.core.on_user_left_private_conversation(from_room, from_nick, status)
def on_user_change_status(self, user, from_nick, from_room, affiliation, role, show, status):
@@ -2058,8 +2061,10 @@ class RosterInfoTab(Tab):
if key == '^M':
selected_row = self.roster_win.get_selected_row()
res = self.input.do_command(key, raw=raw)
- if res:
+ if res and not isinstance(self.input, windows.CommandInput):
return True
+ elif res:
+ return False
if key == '^M':
self.core.on_roster_enter_key(selected_row)
return selected_row
@@ -2113,20 +2118,20 @@ class RosterInfoTab(Tab):
def move_cursor_down(self):
if isinstance(self.input, windows.CommandInput):
return
- self.roster_win.move_cursor_down()
- self.roster_win.refresh(roster)
- self.contact_info_win.refresh(self.roster_win.get_selected_row())
- self.input.refresh()
- self.core.doupdate()
+ if self.roster_win.move_cursor_down():
+ self.roster_win.refresh(roster)
+ self.contact_info_win.refresh(self.roster_win.get_selected_row())
+ self.input.refresh()
+ self.core.doupdate()
def move_cursor_up(self):
if isinstance(self.input, windows.CommandInput):
return
- self.roster_win.move_cursor_up()
- self.roster_win.refresh(roster)
- self.contact_info_win.refresh(self.roster_win.get_selected_row())
- self.input.refresh()
- self.core.doupdate()
+ if self.roster_win.move_cursor_up():
+ self.roster_win.refresh(roster)
+ self.contact_info_win.refresh(self.roster_win.get_selected_row())
+ self.input.refresh()
+ self.core.doupdate()
def move_cursor_to_prev_group(self):
self.roster_win.move_cursor_up()