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
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor 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
mesonium
gajim
Commits
dd2d0f32
Commit
dd2d0f32
authored
3 years ago
by
Daniel Brötzmann
Committed by
Philipp Hörist
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
StartChat: Remove history when forgetting group chat
parent
767cd908
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
gajim/app_actions.py
+10
-3
10 additions, 3 deletions
gajim/app_actions.py
gajim/common/storage/archive.py
+21
-0
21 additions, 0 deletions
gajim/common/storage/archive.py
with
31 additions
and
3 deletions
gajim/app_actions.py
+
10
−
3
View file @
dd2d0f32
...
...
@@ -28,6 +28,7 @@
from
gajim.gui.about
import
AboutDialog
from
gajim.gui.discovery
import
ServiceDiscoveryWindow
from
gajim.gui.util
import
open_window
from
gajim.gui.util
import
get_app_window
# General Actions
...
...
@@ -266,10 +267,16 @@ def start_chat(_action, param):
def
forget_groupchat
(
_action
,
param
):
account
,
jid
=
param
.
unpack
()
room_jid
=
JID
.
from_string
(
jid
)
window
=
get_app_window
(
'
StartChatDialog
'
)
window
.
remove_row
(
account
,
str
(
room_jid
))
client
=
app
.
get_client
(
account
)
client
.
get_module
(
'
Bookmarks
'
).
remove
(
JID
.
from_string
(
jid
))
window
=
open_window
(
'
StartChatDialog
'
)
window
.
remove_row
(
account
,
jid
)
client
.
get_module
(
'
MUC
'
).
leave
(
room_jid
)
client
.
get_module
(
'
Bookmarks
'
).
remove
(
room_jid
)
app
.
storage
.
archive
.
remove_chat_history
(
account
,
str
(
room_jid
),
groupchat
=
True
)
def
on_groupchat_join
(
_action
,
param
):
account
,
jid
=
param
.
get_strv
()
...
...
This diff is collapsed.
Click to expand it.
gajim/common/storage/archive.py
+
21
−
0
View file @
dd2d0f32
...
...
@@ -1192,6 +1192,27 @@ def reset_archive_infos(self, jid):
log
.
info
(
'
Reset message archive info: %s
'
,
jid
)
self
.
_delayed_commit
()
def
remove_chat_history
(
self
,
account
:
str
,
jid
:
str
,
groupchat
:
bool
=
False
)
->
None
:
"""
Remove chat history for a specific chat.
If it
'
s a group chat, remove last MAM ID as well.
"""
account_id
=
self
.
get_account_id
(
account
)
jid_id
=
self
.
get_jid_id
(
jid
)
sql
=
'
DELETE FROM logs WHERE account_id = ? AND jid_id = ?
'
self
.
_con
.
execute
(
sql
,
(
account_id
,
jid_id
))
sql
=
'
DELETE FROM jids WHERE jid_id = ?
'
self
.
_con
.
execute
(
sql
,
(
jid_id
,))
if
groupchat
:
sql
=
'
DELETE FROM last_archive_message WHERE jid_id = ?
'
self
.
_con
.
execute
(
sql
,
(
jid_id
,))
self
.
_delayed_commit
()
log
.
info
(
'
Removed chat history for: %s
'
,
jid
)
def
_cleanup_chat_history
(
self
):
"""
Remove messages from account where messages are older than max_age
...
...
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