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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Peter Shkenev
gajim
Commits
f77d2840
Commit
f77d2840
authored
19 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
[nkour] don't logger groupchat messages that are older that now and already in logs
parent
9f0033f2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/logger.py
+15
-0
15 additions, 0 deletions
src/common/logger.py
with
15 additions
and
0 deletions
src/common/logger.py
+
15
−
0
View file @
f77d2840
...
...
@@ -209,6 +209,9 @@ def write(self, kind, jid, message = None, show = None, tim = None, subject = No
jids.jid text column will hold JID if TC-related, room_jid if GC-related,
ROOM_JID/nick if pm-related.
'''
# check_unique if True will not write a second log line that has
# same time, same msg, same jid and same kind
check_unique
=
False
if
self
.
jids_already_in
==
[]:
# only happens if we just created the db
self
.
con
=
sqlite
.
connect
(
LOG_DB_PATH
,
timeout
=
20.0
,
isolation_level
=
'
IMMEDIATE
'
)
...
...
@@ -222,6 +225,9 @@ def write(self, kind, jid, message = None, show = None, tim = None, subject = No
subject_col
=
subject
if
tim
:
time_col
=
int
(
float
(
time
.
mktime
(
tim
)))
now
=
int
(
float
(
time
.
time
()))
if
kind
==
'
gc_msg
'
and
time_col
<
now
:
check_unique
=
True
else
:
time_col
=
int
(
float
(
time
.
time
()))
...
...
@@ -252,6 +258,15 @@ def write(self, kind, jid, message = None, show = None, tim = None, subject = No
nick
=
None
jid_id
=
self
.
get_jid_id
(
jid
,
'
ROOM
'
)
# re-get jid_id for the new jid
contact_name_col
=
nick
if
check_unique
:
# check for same time, same msg, same jid, same kind
self
.
cur
.
execute
(
'''
SELECT message FROM logs
WHERE time = ? AND message = ? AND jid_id = ?
AND kind = ?
'''
,
(
time_col
,
message_col
,
jid_id
,
constants
.
KIND_GC_MSG
))
row
=
self
.
cur
.
fetchone
()
if
row
:
return
# do not add the same log line
else
:
jid_id
=
self
.
get_jid_id
(
jid
)
...
...
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