Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
norstbox
gajim
Commits
e162e5da
Commit
e162e5da
authored
19 years ago
by
nkour
Browse files
Options
Downloads
Patches
Plain Diff
select last day we have logs for in history browser
parent
f9543aed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/logger.py
+19
-4
19 additions, 4 deletions
src/common/logger.py
src/history_window.py
+9
-1
9 additions, 1 deletion
src/history_window.py
with
28 additions
and
5 deletions
src/common/logger.py
+
19
−
4
View file @
e162e5da
...
...
@@ -339,13 +339,14 @@ class Logger:
SELECT contact_name, time, kind, show, message, subject FROM logs
WHERE jid_id = ? AND message LIKE ?
ORDER BY time
'''
,
(
jid_id
,
like_sql
))
'''
,
(
jid_id
,
like_sql
))
results
=
cur
.
fetchall
()
return
results
def
date_has_logs
(
self
,
jid
,
year
,
month
,
day
):
'''
returns True if we have logs for given day, else False
'''
'''
returns True if we have logs (excluding statuses) for given date,
else False
'''
jid
=
jid
.
lower
()
jid_id
=
self
.
get_jid_id
(
jid
)
...
...
@@ -362,8 +363,22 @@ class Logger:
LIMIT 1
'''
%
(
jid_id
,
start_of_day
,
last_second_of_day
,
constants
.
KIND_STATUS
,
constants
.
KIND_GCSTATUS
))
result
s
=
cur
.
fetchone
()
if
result
s
:
result
=
cur
.
fetchone
()
if
result
:
return
True
else
:
return
False
def
get_last_date_that_has_logs
(
self
,
jid
):
'''
returns last time (in seconds since EPOCH) for which
we had logs (excluding statuses)
'''
jid
=
jid
.
lower
()
jid_id
=
self
.
get_jid_id
(
jid
)
cur
.
execute
(
'''
SELECT time FROM logs
WHERE jid_id = ?
AND kind NOT IN (?, ?)
ORDER BY time DESC LIMIT 1
'''
,
(
jid_id
,
constants
.
KIND_STATUS
,
constants
.
KIND_GCSTATUS
))
result
=
cur
.
fetchone
()
return
result
This diff is collapsed.
Click to expand it.
src/history_window.py
+
9
−
1
View file @
e162e5da
...
...
@@ -117,8 +117,16 @@ class HistoryWindow:
tag
.
set_property
(
'
foreground
'
,
'
grey
'
)
tag
.
set_property
(
'
justification
'
,
gtk
.
JUSTIFY_CENTER
)
date
=
time
.
localtime
()
# select and show logs for last date we have logs with contact
# and if we don't have logs at all, default to today
result
=
gajim
.
logger
.
get_last_date_that_has_logs
(
self
.
jid
)
tim
=
result
[
0
]
if
tim
!=
''
:
date
=
time
.
localtime
(
tim
)
else
:
date
=
time
.
localtime
()
y
,
m
,
d
=
date
[
0
],
date
[
1
],
date
[
2
]
self
.
calendar
.
select_day
(
d
)
self
.
add_lines_for_date
(
y
,
m
,
d
)
self
.
window
.
show_all
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment