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)
@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)

View File

@ -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

View File

@ -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)