Fix LMC autocompletion to suggest corrected message content #25
@@ -424,9 +424,11 @@ chatwin_outgoing_msg(ProfChatWin* chatwin, const char* const message, const char
|
||||
win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, display_message);
|
||||
}
|
||||
|
||||
// save last id and message for LMC in case if it's not LMC message
|
||||
if (id && !replace_id) {
|
||||
_chatwin_set_last_message(chatwin, id, display_message);
|
||||
// Save last id and message for LMC
|
||||
// Note: if the same message is to be corrected several times, the id of the original message is used in each case
|
||||
// https://xmpp.org/extensions/xep-0308.html#rules
|
||||
if (id) {
|
||||
_chatwin_set_last_message(chatwin, replace_id ?: id, display_message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,9 +627,13 @@ chatwin_db_history(ProfChatWin* chatwin, const gchar* start_time, const gchar* e
|
||||
static void
|
||||
_chatwin_set_last_message(ProfChatWin* chatwin, const char* const id, const char* const message)
|
||||
{
|
||||
free(chatwin->last_message);
|
||||
chatwin->last_message = strdup(message);
|
||||
if (message && chatwin->last_message != message) {
|
||||
free(chatwin->last_message);
|
||||
chatwin->last_message = strdup(message);
|
||||
}
|
||||
|
||||
free(chatwin->last_msg_id);
|
||||
chatwin->last_msg_id = strdup(id);
|
||||
if (id && chatwin->last_msg_id != id) {
|
||||
free(chatwin->last_msg_id);
|
||||
chatwin->last_msg_id = strdup(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ message_send(void **state)
|
||||
assert_true(prof_output_regex("me: .+Hi there"));
|
||||
}
|
||||
|
||||
// TODO: `/message correct` XEP-0308 compliance (whether each correction links to the original message ID)
|
||||
// https://xmpp.org/extensions/xep-0308.html#rules
|
||||
|
||||
void
|
||||
message_receive_console(void **state)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user