Rename method get_search_results_for_query to search_log

This commit is contained in:
Markus Böhme 2017-03-23 23:30:51 +01:00
parent d612e80a47
commit 08f4e17158
3 changed files with 4 additions and 9 deletions

View file

@ -87,8 +87,7 @@ class StandardCommonCommands(CommandContainer):
@command('lastlog', overlap=True) @command('lastlog', overlap=True)
@doc(_("Show logged messages which mention given text")) @doc(_("Show logged messages which mention given text"))
def grep(self, text, limit=None): def grep(self, text, limit=None):
results = gajim.logger.get_search_results_for_query(self.contact.jid, results = gajim.logger.search_log(self.contact.jid, text, self.account)
text, self.account)
if not results: if not results:
raise CommandError(_("%s: Nothing found") % text) raise CommandError(_("%s: Nothing found") % text)

View file

@ -676,8 +676,7 @@ class Logger:
['contact_name', 'time', 'kind', 'show', 'message', 'subject', ['contact_name', 'time', 'kind', 'show', 'message', 'subject',
'log_line_id']) 'log_line_id'])
def get_search_results_for_query(self, jid, query, account, year=False, def search_log(self, jid, query, account, year=None, month=None, day=None):
month=False, day=False):
""" """
Search the conversation log for messages containing the `query` string. Search the conversation log for messages containing the `query` string.
@ -697,7 +696,7 @@ class Logger:
where_sql, jid_tuple = self._build_contact_where(account, jid) where_sql, jid_tuple = self._build_contact_where(account, jid)
like_sql = '%' + query.replace("'", "''") + '%' like_sql = '%' + query.replace("'", "''") + '%'
if year: if year and month and day:
start_of_day = self.get_unix_time_from_date(year, month, day) start_of_day = self.get_unix_time_from_date(year, month, day)
seconds_in_a_day = 86400 # 60 * 60 * 24 seconds_in_a_day = 86400 # 60 * 60 * 24
last_second_of_day = start_of_day + seconds_in_a_day - 1 last_second_of_day = start_of_day + seconds_in_a_day - 1

View file

@ -541,10 +541,7 @@ class HistoryWindow:
month = gtkgui_helpers.make_gtk_month_python_month(month) month = gtkgui_helpers.make_gtk_month_python_month(month)
show_status = self.show_status_checkbutton.get_active() show_status = self.show_status_checkbutton.get_active()
results = gajim.logger.search_log(jid, text, account, year, month, day)
# contact_name, time, kind, show, message, subject
results = gajim.logger.get_search_results_for_query(
jid, text, account, year, month, day)
#FIXME: #FIXME:
# add "subject: | message: " in message column if kind is single # add "subject: | message: " in message column if kind is single
# also do we need show at all? (we do not search on subject) # also do we need show at all? (we do not search on subject)