Skip to content

Commit

Permalink
Improve XEP-0308 compliance
Browse files Browse the repository at this point in the history
Disallow correcting historical MUC messages, as the XEP-308 requires.

Previous changes introduce problem with
"Illicit LMC attempt from conference@server/user for message from user"

During investigation it was revealed that XEP does not recommend support
of historical MUC messages correction.

```
When used in a Multi-User Chat (XEP-0045) context,
corrections must not be allowed (by the receiver)
for messages received before the sender joined the room -
particularly a full JID leaving the room
then rejoining and correcting a message SHOULD be disallowed,
as the entity behind the full JID in the MUC may have changed.
```
https://xmpp.org/extensions/xep-0308.html#rules

Mentioned by @jubalh
Bug discovered by @jaeckel
  • Loading branch information
H3rnand3zzz committed Nov 6, 2023
1 parent 89dc7a4 commit 6c5e79e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/ui/mucwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ mucwin_nick_change(ProfMucWin* mucwin, const char* const nick)
}

void
mucwin_history(ProfMucWin* mucwin, const ProfMessage* const message)
mucwin_history(ProfMucWin* mucwin, ProfMessage* const message)
{
assert(mucwin != NULL);

Expand All @@ -372,6 +372,9 @@ mucwin_history(ProfMucWin* mucwin, const ProfMessage* const message)
GSList* mentions = get_mentions(prefs_get_boolean(PREF_NOTIFY_MENTION_WHOLE_WORD), prefs_get_boolean(PREF_NOTIFY_MENTION_CASE_SENSITIVE), message->plain, mynick);
GList* triggers = prefs_message_get_triggers(message->plain);

// XEP-0308 states: `corrections must not be allowed (by the receiver) for messages received before the sender joined the room`
message->replace_id = NULL;

mucwin_incoming_msg(mucwin, message, mentions, triggers, FALSE);

g_slist_free(mentions);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void mucwin_occupant_affiliation_change(ProfMucWin* mucwin, const char* const ni
void mucwin_occupant_role_and_affiliation_change(ProfMucWin* mucwin, const char* const nick,
const char* const role, const char* const affiliation, const char* const actor, const char* const reason);
void mucwin_roster(ProfMucWin* mucwin, GList* occupants, const char* const presence);
void mucwin_history(ProfMucWin* mucwin, const ProfMessage* const message);
void mucwin_history(ProfMucWin* mucwin, ProfMessage* const message);
void mucwin_outgoing_msg(ProfMucWin* mucwin, const char* const message, const char* const id, prof_enc_t enc_mode, const char* const replace_id);
void mucwin_incoming_msg(ProfMucWin* mucwin, const ProfMessage* const message, GSList* mentions, GList* triggers, gboolean filter_reflection);
void mucwin_subject(ProfMucWin* mucwin, const char* const nick, const char* const subject);
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/ui/stub_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ mucwin_roster(ProfMucWin* mucwin, GList* occupants, const char* const presence)
{
}
void
mucwin_history(ProfMucWin* mucwin, const ProfMessage* const message)
mucwin_history(ProfMucWin* mucwin, ProfMessage* const message)
{
}
void
Expand Down

0 comments on commit 6c5e79e

Please sign in to comment.