Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
bodqhrohro
gajim
Commits
11ff1e70
Commit
11ff1e70
authored
Jun 21, 2022
by
Daniel Brötzmann
Browse files
fix: Chat: Display corrections for /me messages correctly
Fixes #10933
parent
5462da5a
Changes
9
Hide whitespace changes
Inline
Side-by-side
gajim/common/events.py
View file @
11ff1e70
...
...
@@ -349,6 +349,7 @@ class MessageUpdated(ApplicationEvent):
account
:
str
jid
:
JID
msgtxt
:
str
nickname
:
Optional
[
str
]
properties
:
Any
correct_id
:
str
...
...
gajim/common/modules/mam.py
View file @
11ff1e70
...
...
@@ -313,9 +313,11 @@ def _mam_message_received(self,
correct_id
=
parse_correction
(
properties
)
if
correct_id
is
not
None
:
nickname
=
properties
.
muc_nickname
or
properties
.
nickname
app
.
ged
.
raise_event
(
MessageUpdated
(
account
=
self
.
_account
,
jid
=
jid
,
msgtxt
=
properties
.
body
,
nickname
=
nickname
,
properties
=
properties
,
correct_id
=
correct_id
))
app
.
storage
.
archive
.
store_message_correction
(
...
...
gajim/common/modules/message.py
View file @
11ff1e70
...
...
@@ -192,9 +192,11 @@ def _message_received(self,
correct_id
=
parse_correction
(
properties
)
if
correct_id
is
not
None
:
nickname
=
properties
.
muc_nickname
or
properties
.
nickname
event
=
MessageUpdated
(
account
=
self
.
_account
,
jid
=
event_attr
[
'jid'
],
msgtxt
=
msgtxt
,
nickname
=
nickname
,
properties
=
properties
,
correct_id
=
correct_id
)
...
...
gajim/gtk/chat_list.py
View file @
11ff1e70
...
...
@@ -433,7 +433,7 @@ def _on_message_updated(self, event: events.MessageUpdated) -> None:
return
if
event
.
correct_id
==
row
.
message_id
:
row
.
set_message_text
(
event
.
msgtxt
)
row
.
set_message_text
(
event
.
msgtxt
,
event
.
nickname
)
def
_on_message_moderated
(
self
,
event
:
events
.
MessageModerated
)
->
None
:
row
=
self
.
_chats
.
get
((
event
.
account
,
event
.
jid
))
...
...
gajim/gtk/controls/base.py
View file @
11ff1e70
...
...
@@ -327,7 +327,8 @@ def process_event(self, event: events.ApplicationEvent) -> None:
getattr
(
self
,
method_name
)(
event
)
def
_on_message_updated
(
self
,
event
:
events
.
MessageUpdated
)
->
None
:
self
.
conversation_view
.
correct_message
(
event
.
correct_id
,
event
.
msgtxt
)
self
.
conversation_view
.
correct_message
(
event
.
correct_id
,
event
.
msgtxt
,
event
.
nickname
)
def
_on_message_moderated
(
self
,
event
:
events
.
MessageModerated
)
->
None
:
text
=
get_retraction_text
(
...
...
gajim/gtk/controls/chat.py
View file @
11ff1e70
...
...
@@ -415,7 +415,7 @@ def _on_message_sent(self, event: events.MessageSent) -> None:
if
event
.
correct_id
:
self
.
conversation_view
.
correct_message
(
event
.
correct_id
,
event
.
message
)
event
.
correct_id
,
event
.
message
,
self
.
get_our_nick
()
)
return
self
.
add_message
(
event
.
message
,
...
...
gajim/gtk/conversation/message_widget.py
View file @
11ff1e70
...
...
@@ -60,8 +60,10 @@ def add_with_styling(self,
self
.
add_content
(
result
)
def
_add_action_phrase
(
self
,
text
:
str
,
nickname
:
str
):
self
.
clear
()
widget
=
PlainWidget
(
self
.
_account
,
self
.
_selectable
)
widget
.
add_action_phrase
(
text
,
nickname
)
widget
.
show_all
()
self
.
add
(
widget
)
def
add_content
(
self
,
content
:
ContentT
)
->
None
:
...
...
gajim/gtk/conversation/rows/message.py
View file @
11ff1e70
...
...
@@ -417,9 +417,9 @@ def set_retracted(self, text: str) -> None:
self
.
_message_widget
.
add_with_styling
(
text
)
self
.
get_style_context
().
add_class
(
'retracted-message'
)
def
set_correction
(
self
,
text
:
str
)
->
None
:
def
set_correction
(
self
,
text
:
str
,
nickname
:
Optional
[
str
]
)
->
None
:
if
not
isinstance
(
self
.
_message_widget
,
PreviewWidget
):
self
.
_message_widget
.
add_with_styling
(
text
)
self
.
_message_widget
.
add_with_styling
(
text
,
nickname
)
self
.
_has_receipt
=
False
self
.
_message_icons
.
set_receipt_icon_visible
(
False
)
...
...
gajim/gtk/conversation/view.py
View file @
11ff1e70
...
...
@@ -487,10 +487,14 @@ def scroll_to_end(self, force: bool = False) -> None:
if
self
.
autoscroll
or
force
:
GLib
.
idle_add
(
self
.
emit
,
'scroll-to-end'
)
def
correct_message
(
self
,
correct_id
:
str
,
text
:
str
)
->
None
:
def
correct_message
(
self
,
correct_id
:
str
,
text
:
str
,
nickname
:
Optional
[
str
]
)
->
None
:
message_row
=
self
.
_get_row_by_message_id
(
correct_id
)
if
message_row
is
not
None
:
message_row
.
set_correction
(
text
)
message_row
.
set_correction
(
text
,
nickname
)
message_row
.
set_merged
(
False
)
def
show_message_retraction
(
self
,
stanza_id
:
str
,
text
:
str
)
->
None
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment