diff frontends/src/primitivus/chat.py @ 2013:b536dd121da1

backend (memory), frontends: improved history filtering: a "filters" dictionnary is now use to filter, it can have, for now, filtering on: - "body": filter only on the body (equivalent to former "search" parameter, but not case sensitive) - "search": fitler on body + source resource - "types": allowed types - "not_types": forbidden types primitivus now do searching using "search", i.e. source resource is now taken into account (and search is now case insensitive)
author Goffi <goffi@goffi.org>
date Mon, 18 Jul 2016 00:52:02 +0200
parents d2144d04065e
children 20fb71b656e3
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Sun Jul 17 19:44:15 2016 +0200
+++ b/frontends/src/primitivus/chat.py	Mon Jul 18 00:52:02 2016 +0200
@@ -540,12 +540,12 @@
             except AttributeError:
                 pass
 
-    def updateHistory(self, size=C.HISTORY_LIMIT_DEFAULT, search='', profile='@NONE@'):
+    def updateHistory(self, size=C.HISTORY_LIMIT_DEFAULT, filters=None, profile='@NONE@'):
         del self.mess_walker[:]
-        if search:
-            self.mess_walker.append(urwid.Text(_(u"Results for searching the globbing pattern: {}").format(search)))
-            self.mess_walker.append(urwid.Text(_(u"Type ':history <lines>' to reset the chat history").format(search)))
-        super(Chat, self).updateHistory(size, search, profile)
+        if filters and 'search' in filters:
+            self.mess_walker.append(urwid.Text(_(u"Results for searching the globbing pattern: {}").format(filters['search'])))
+            self.mess_walker.append(urwid.Text(_(u"Type ':history <lines>' to reset the chat history")))
+        super(Chat, self).updateHistory(size, filters, profile)
 
     def _onHistoryPrinted(self):
         """Refresh or scroll down the focus after the history is printed"""