comparison frontends/src/quick_frontend/quick_chat.py @ 1224:f0c9b149ed99

bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern)
author souliane <souliane@mailoo.org>
date Sat, 04 Oct 2014 10:25:32 +0200
parents 802b7e6bf098
children e3a9ea76de35
comparison
equal deleted inserted replaced
1223:802b7e6bf098 1224:f0c9b149ed99
98 98
99 def afterHistoryPrint(self): 99 def afterHistoryPrint(self):
100 """Refresh or scroll down the focus after the history is printed""" 100 """Refresh or scroll down the focus after the history is printed"""
101 pass 101 pass
102 102
103 def historyPrint(self, size=C.HISTORY_LIMIT_DEFAULT, profile='@NONE@'): 103 def historyPrint(self, size=C.HISTORY_LIMIT_DEFAULT, search='', profile='@NONE@'):
104 """Print the current history 104 """Print the current history
105 @param size (int): number of messages 105 @param size (int): number of messages
106 @param search (str): pattern to filter the history results
106 @param profile (str): %(doc_profile)s 107 @param profile (str): %(doc_profile)s
107 """ 108 """
108 log.debug(_("now we print the history (%d messages)") % size) 109 log.debug(_("now we print the history (%d messages)") % size)
109 110
110 def onHistory(history): 111 def onHistory(history):
122 if self.target.startswith(C.PRIVATE_PREFIX): 123 if self.target.startswith(C.PRIVATE_PREFIX):
123 target = unescapePrivate(self.target) 124 target = unescapePrivate(self.target)
124 else: 125 else:
125 target = self.target.bare 126 target = self.target.bare
126 127
127 return self.host.bridge.getHistory(self.host.profiles[profile]['whoami'].bare, target, size, profile=profile, callback=onHistory, errback=onHistoryError) 128 return self.host.bridge.getHistory(self.host.profiles[profile]['whoami'].bare, target, size, search=search, profile=profile, callback=onHistory, errback=onHistoryError)
128 129
129 def _get_nick(self, jid): 130 def _get_nick(self, jid):
130 """Return nick of this jid when possible""" 131 """Return nick of this jid when possible"""
131 if self.target.startswith(C.PRIVATE_PREFIX): 132 if self.target.startswith(C.PRIVATE_PREFIX):
132 unescaped = unescapePrivate(self.target) 133 unescaped = unescapePrivate(self.target)