diff options
-rw-r--r-- | src/config/preferences.c | 3 | ||||
-rw-r--r-- | src/config/preferences.h | 1 | ||||
-rw-r--r-- | src/ui/chatwin.c | 21 |
3 files changed, 17 insertions, 8 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c index ba3b08e9..0ec5a0c0 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -1799,6 +1799,7 @@ _get_group(preference_t pref) case PREF_REVEAL_OS: case PREF_TLS_CERTPATH: case PREF_CORRECTION_ALLOW: + case PREF_MAM: return PREF_GROUP_CONNECTION; case PREF_OTR_LOG: case PREF_OTR_POLICY: @@ -2070,6 +2071,8 @@ _get_key(preference_t pref) return "avatar.cmd"; case PREF_SLASH_GUARD: return "slashguard"; + case PREF_MAM: + return "mam"; default: return NULL; } diff --git a/src/config/preferences.h b/src/config/preferences.h index ffc93a52..f3c32ebd 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -170,6 +170,7 @@ typedef enum { PREF_HISTORY_COLOR_MUC, PREF_AVATAR_CMD, PREF_SLASH_GUARD, + PREF_MAM, } preference_t; typedef struct prof_alias_t { diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index 1c04432c..22992ecd 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -57,7 +57,7 @@ #include "omemo/omemo.h" #endif -/*static void _chatwin_history(ProfChatWin *chatwin, const char *const contact_barejid);*/ +static void _chatwin_history(ProfChatWin *chatwin, const char *const contact_barejid); static void _chatwin_set_last_message(ProfChatWin *chatwin, const char *const id, const char *const message); ProfChatWin* @@ -66,8 +66,8 @@ chatwin_new(const char *const barejid) ProfWin *window = wins_new_chat(barejid); ProfChatWin *chatwin = (ProfChatWin *)window; - if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) { - //_chatwin_history(chatwin, barejid); + if (!prefs_get_boolean(PREF_MAM) && prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) { + _chatwin_history(chatwin, barejid); } // if the contact is offline, show a message @@ -87,7 +87,9 @@ chatwin_new(const char *const barejid) } #endif - iq_mam_request(chatwin); + if (prefs_get_boolean(PREF_MAM)) { + iq_mam_request(chatwin); + } return chatwin; } @@ -285,8 +287,13 @@ chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_cr chatwin->unread++; - if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) { -// _chatwin_history(chatwin, chatwin->barejid); + //TODO: so far we don't ask for MAM when incoming message occurs. + //Need to figure out: + //1) only send IQ once + //2) sort incoming messages on timestamp + //for now if experimental MAM is enabled we dont show no history from sql either + if (!prefs_get_boolean(PREF_MAM) && prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) { + _chatwin_history(chatwin, chatwin->barejid); } // show users status first, when receiving message via delayed delivery @@ -485,7 +492,6 @@ chatwin_unset_outgoing_char(ProfChatWin *chatwin) } } -/* static void _chatwin_history(ProfChatWin *chatwin, const char *const contact_barejid) { @@ -503,7 +509,6 @@ _chatwin_history(ProfChatWin *chatwin, const char *const contact_barejid) g_slist_free_full(history, (GDestroyNotify)message_free); } } -*/ static void _chatwin_set_last_message(ProfChatWin *chatwin, const char *const id, const char *const message) |