From 8c0b3f8ae5ef6d61eefd9cdd9c6acec5a32fd7f9 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 5 Aug 2012 13:08:06 +0200 Subject: Add a filter_info_messages option - This option takes a list of words separated by colons - All the messages containing those words will not be shown --- data/default_config.cfg | 4 ++++ doc/en/configure.txt | 6 ++++++ src/core.py | 7 ++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/data/default_config.cfg b/data/default_config.cfg index ff73ecc4..834c629c 100644 --- a/data/default_config.cfg +++ b/data/default_config.cfg @@ -143,6 +143,10 @@ information_buffer_popup_on = error roster warning help info # one line, the popup will stay visible two second per additional lines popup_time = 4 +# A list of words (or sentences) separated by colons (":"). All the +# informational messages (described above) containing at least one of those +# values will not be shown. +filter_info_messages = # Set to 'true' if you want to automatically rejoin the # rooms when you're kicked or banned diff --git a/doc/en/configure.txt b/doc/en/configure.txt index dc802690..479f5a06 100644 --- a/doc/en/configure.txt +++ b/doc/en/configure.txt @@ -195,6 +195,12 @@ section of this documentation. If the message takes more than one line, the popup will stay visible two more second per additional lines +*filter_info_messages*:: [empty] + + A list of words or sentences separated by colons (":"). All the + informational mesages (described above) containing at least one of those + values will not be shown. + *autorejoin*:: false set to 'true' if you want to automatically rejoin the diff --git a/src/core.py b/src/core.py index f34a97af..b06d0009 100644 --- a/src/core.py +++ b/src/core.py @@ -884,6 +884,11 @@ class Core(object): """ Displays an informational message in the "Info" buffer """ + filter_messages = config.get('filter_info_messages', '').split(':') + for words in filter_messages: + if words and words in msg: + log.debug('Did not show the message:\n\t%s> %s', typ, msg) + return False nb_lines = self.information_buffer.add_message(msg, nickname=typ) if isinstance(self.current_tab(), tabs.RosterInfoTab): self.refresh_window() @@ -895,7 +900,7 @@ class Core(object): if self.information_win_size != 0: self.information_win.refresh() self.current_tab().input.refresh() - + return True def init_curses(self, stdscr): """ -- cgit v1.2.3