From 08f4e171586da0bf07a1f722cf3bbd2dc1937ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20B=C3=B6hme?= Date: Thu, 23 Mar 2017 23:30:51 +0100 Subject: [PATCH] Rename method get_search_results_for_query to search_log --- src/command_system/implementation/standard.py | 3 +-- src/common/logger.py | 5 ++--- src/history_window.py | 5 +---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/command_system/implementation/standard.py b/src/command_system/implementation/standard.py index 2c0ef5bba..f7e1daa91 100644 --- a/src/command_system/implementation/standard.py +++ b/src/command_system/implementation/standard.py @@ -87,8 +87,7 @@ class StandardCommonCommands(CommandContainer): @command('lastlog', overlap=True) @doc(_("Show logged messages which mention given text")) def grep(self, text, limit=None): - results = gajim.logger.get_search_results_for_query(self.contact.jid, - text, self.account) + results = gajim.logger.search_log(self.contact.jid, text, self.account) if not results: raise CommandError(_("%s: Nothing found") % text) diff --git a/src/common/logger.py b/src/common/logger.py index 2ba3879b1..bb68149e4 100644 --- a/src/common/logger.py +++ b/src/common/logger.py @@ -676,8 +676,7 @@ class Logger: ['contact_name', 'time', 'kind', 'show', 'message', 'subject', 'log_line_id']) - def get_search_results_for_query(self, jid, query, account, year=False, - month=False, day=False): + def search_log(self, jid, query, account, year=None, month=None, day=None): """ 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) like_sql = '%' + query.replace("'", "''") + '%' - if year: + if year and month and day: start_of_day = self.get_unix_time_from_date(year, month, day) seconds_in_a_day = 86400 # 60 * 60 * 24 last_second_of_day = start_of_day + seconds_in_a_day - 1 diff --git a/src/history_window.py b/src/history_window.py index 40f8bd23b..1635cdb8a 100644 --- a/src/history_window.py +++ b/src/history_window.py @@ -541,10 +541,7 @@ class HistoryWindow: month = gtkgui_helpers.make_gtk_month_python_month(month) show_status = self.show_status_checkbutton.get_active() - - # contact_name, time, kind, show, message, subject - results = gajim.logger.get_search_results_for_query( - jid, text, account, year, month, day) + results = gajim.logger.search_log(jid, text, account, year, month, day) #FIXME: # add "subject: | message: " in message column if kind is single # also do we need show at all? (we do not search on subject)