diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/mucwin.c | 21 | ||||
-rw-r--r-- | src/ui/ui.h | 2 | ||||
-rw-r--r-- | src/ui/win_types.h | 3 | ||||
-rw-r--r-- | src/ui/window.c | 13 | ||||
-rw-r--r-- | src/ui/window.h | 2 |
5 files changed, 34 insertions, 7 deletions
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index b501af76..dddcb825 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -50,6 +50,8 @@ #include "omemo/omemo.h" #endif +static void _mucwin_set_last_message(ProfMucWin *mucwin, const char *const id, const char *const message); + ProfMucWin* mucwin_new(const char *const barejid) { @@ -501,7 +503,7 @@ _mucwin_print_triggers(ProfWin *window, const char *const message, GList *trigge } void -mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode) +mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode, const char *const replace_id) { assert(mucwin != NULL); @@ -519,7 +521,12 @@ mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *c ch = prefs_get_omemo_char(); } - win_println_me_message(window, ch, mynick, "%s", message); + win_print_outgoing_muc_msg(window, ch, mynick, id, replace_id, "%s", message); + + // save last id and message for LMC + if (id) { + _mucwin_set_last_message(mucwin, id, message); + } } void @@ -951,3 +958,13 @@ mucwin_unset_message_char(ProfMucWin *mucwin) mucwin->message_char = NULL; } } + +static void +_mucwin_set_last_message(ProfMucWin *mucwin, const char *const id, const char *const message) +{ + free(mucwin->last_message); + mucwin->last_message = strdup(message); + + free(mucwin->last_msg_id); + mucwin->last_msg_id = strdup(id); +} diff --git a/src/ui/ui.h b/src/ui/ui.h index c1c2b6cf..addb50b2 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -158,7 +158,7 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char 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 char *const nick, GDateTime *timestamp, const char *const message); -void mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode); +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, ProfMessage *message, GSList *mentions, GList *triggers); void mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject); void mucwin_requires_config(ProfMucWin *mucwin); diff --git a/src/ui/win_types.h b/src/ui/win_types.h index 0a0545bd..81944bc0 100644 --- a/src/ui/win_types.h +++ b/src/ui/win_types.h @@ -178,6 +178,9 @@ typedef struct prof_muc_win_t { char *enctext; char *message_char; GDateTime *last_msg_timestamp; + // For LMC + char *last_message; + char *last_msg_id; } ProfMucWin; typedef struct prof_conf_win_t ProfConfWin; diff --git a/src/ui/window.c b/src/ui/window.c index 0e7dbded..8181d473 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -203,6 +203,8 @@ win_create_muc(const char *const roomjid) new_win->enctext = NULL; new_win->message_char = NULL; new_win->is_omemo = FALSE; + new_win->last_message = NULL; + new_win->last_msg_id = NULL; new_win->memcheck = PROFMUCWIN_MEMCHECK; @@ -1169,7 +1171,7 @@ win_println_them_message(ProfWin *window, char ch, int flags, const char *const } void -win_println_me_message(ProfWin *window, char ch, const char *const me, const char *const message, ...) +win_print_outgoing_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, const char *const message, ...) { GDateTime *timestamp = g_date_time_new_now_local(); @@ -1178,8 +1180,13 @@ win_println_me_message(ProfWin *window, char ch, const char *const me, const cha GString *fmt_msg = g_string_new(NULL); g_string_vprintf(fmt_msg, message, arg); - buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, me, fmt_msg->str, NULL, NULL); - _win_print_internal(window, ch, 0, timestamp, 0, THEME_TEXT_ME, me, fmt_msg->str, NULL); + if (replace_id) { + _win_correct(window, fmt_msg->str, id, replace_id); + } else { + _win_printf(window, ch, 0, timestamp, 0, THEME_TEXT_ME, me, id, "%s", fmt_msg->str); + } +// buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, me, fmt_msg->str, NULL, NULL); +// _win_print_internal(window, ch, 0, timestamp, 0, THEME_TEXT_ME, me, 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 8db2c2a7..66c6e5ff 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -63,7 +63,7 @@ void win_show_status_string(ProfWin *window, const char *const from, 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 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_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, 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, ...); void win_print_incoming(ProfWin *window, const char *const from, ProfMessage *message); |