diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/mucwin.c | 2 | ||||
-rw-r--r-- | src/ui/window.c | 12 | ||||
-rw-r--r-- | src/ui/window.h | 2 | ||||
-rw-r--r-- | src/xmpp/message.c | 10 |
4 files changed, 21 insertions, 5 deletions
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 0179c22b..b501af76 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -559,7 +559,7 @@ mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions, win_print_them(window, THEME_ROOMTRIGGER, ch, flags, message->jid->resourcepart); _mucwin_print_triggers(window, message->plain, triggers); } else { - win_println_them_message(window, ch, flags, message->jid->resourcepart, "%s", message->plain); + win_println_them_message(window, ch, flags, message->jid->resourcepart, message->id, message->replace_id, "%s", message->plain); } } diff --git a/src/ui/window.c b/src/ui/window.c index 48a2b179..0e7dbded 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1143,8 +1143,9 @@ win_print_them(ProfWin *window, theme_item_t theme_item, char ch, int flags, con } void -win_println_them_message(ProfWin *window, char ch, int flags, const char *const them, const char *const message, ...) +win_println_them_message(ProfWin *window, char ch, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message, ...) { + //TODO: we always use current timestamp here. instead of the message->timestamp one if available. i think somewhere else we check whether it exists first. GDateTime *timestamp = g_date_time_new_now_local(); va_list arg; @@ -1152,8 +1153,13 @@ win_println_them_message(ProfWin *window, char ch, int flags, const char *const GString *fmt_msg = g_string_new(NULL); g_string_vprintf(fmt_msg, message, arg); - buffer_append(window->layout->buffer, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, fmt_msg->str, NULL, NULL); - _win_print_internal(window, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, fmt_msg->str, NULL); + if (replace_id) { + _win_correct(window, fmt_msg->str, id, replace_id); + } else { + _win_printf(window, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, id, "%s", fmt_msg->str); + } +// buffer_append(window->layout->buffer, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, fmt_msg->str, NULL, NULL); + // _win_print_internal(window, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, fmt_msg->str, NULL); inp_nonblocking(TRUE); g_date_time_unref(timestamp); diff --git a/src/ui/window.h b/src/ui/window.h index 40e58d7a..8db2c2a7 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -62,7 +62,7 @@ void win_show_status_string(ProfWin *window, const char *const from, const char *const default_show); void win_print_them(ProfWin *window, theme_item_t theme_item, char ch, int flags, const char *const them); -void win_println_them_message(ProfWin *window, char ch, int flags, const char *const them, const char *const message, ...); +void win_println_them_message(ProfWin *window, char ch, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message, ...); void win_println_me_message(ProfWin *window, char ch, const char *const me, const char *const message, ...); void win_print_outgoing(ProfWin *window, const char ch, const char *const id, const char *const replace_id, const char *const message, ...); diff --git a/src/xmpp/message.c b/src/xmpp/message.c index b1dc829e..7b10376e 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -827,13 +827,23 @@ _handle_groupchat(xmpp_stanza_t *const stanza) ProfMessage *message = message_init(); message->jid = jid; + if (id) { message->id = strdup(id); } + if (originid) { message->originid = strdup(originid); } + xmpp_stanza_t *replace_id_stanza = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_LAST_MESSAGE_CORRECTION); + if (replace_id_stanza) { + const char *replace_id = xmpp_stanza_get_id(replace_id_stanza); + if (replace_id) { + message->replace_id = strdup(replace_id); + } + } + message->body = xmpp_message_get_body(stanza); // check omemo encryption |