summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-03-25 14:37:40 +0200
committermathieui <mathieui@mathieui.net>2012-03-25 14:37:40 +0200
commit418b800ad704922462d7df0a735633a644720986 (patch)
treec1ea40b50929810551e23ef952229dcc86a17a36 /src
parent3734304091cc492b2fe7bfc04525339d89ec41c0 (diff)
downloadpoezio-418b800ad704922462d7df0a735633a644720986.tar.gz
poezio-418b800ad704922462d7df0a735633a644720986.tar.bz2
poezio-418b800ad704922462d7df0a735633a644720986.tar.xz
poezio-418b800ad704922462d7df0a735633a644720986.zip
Do not add stanzas to the xml_tab buffer unless there an is active one
Diffstat (limited to 'src')
-rw-r--r--src/core.py8
-rw-r--r--src/tabs.py3
2 files changed, 9 insertions, 2 deletions
diff --git a/src/core.py b/src/core.py
index 2e920508..09766852 100644
--- a/src/core.py
+++ b/src/core.py
@@ -104,6 +104,7 @@ class Core(object):
self.tab_win = windows.GlobalInfoBar()
self.information_buffer.add_window(self.information_win)
self.tabs = []
+ self.xml_tabs = 0
self.previous_tab_nb = 0
self.own_nick = config.get('default_nick', '') or self.xmpp.boundjid.user
# global commands, available from all tabs
@@ -285,19 +286,22 @@ class Core(object):
tabs.Tab.height - 1 - self.information_win_size - tabs.Tab.tab_win_height(), 0)
def outgoing_stanza(self, stanza):
- self.add_message_to_text_buffer(self.xml_buffer, '\x191}<--\x19o %s' % stanza)
+ if self.xml_tabs:
+ self.add_message_to_text_buffer(self.xml_buffer, '\x191}<--\x19o %s' % stanza)
if isinstance(self.current_tab(), tabs.XMLTab):
self.current_tab().refresh()
self.doupdate()
def incoming_stanza(self, stanza):
- self.add_message_to_text_buffer(self.xml_buffer, '\x192}-->\x19o %s' % stanza)
+ if self.xml_tabs:
+ self.add_message_to_text_buffer(self.xml_buffer, '\x192}-->\x19o %s' % stanza)
if isinstance(self.current_tab(), tabs.XMLTab):
self.current_tab().refresh()
self.doupdate()
def command_xml_tab(self, arg):
"""/xml_tab"""
+ self.xml_tabs += 1
tab = tabs.XMLTab()
self.add_tab(tab, True)
diff --git a/src/tabs.py b/src/tabs.py
index afe77274..39541b04 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -2719,6 +2719,9 @@ class XMLTab(Tab):
self.state = 'current'
curses.curs_set(0)
+ def on_close(self):
+ self.core.xml_tabs -= 1
+
class SimpleTextTab(Tab):
"""
A very simple tab, with just a text displaying some