mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Add hidden MAM setting and trigger MAM retrievel when opening new window
Only when we start the conversation. Not yet when we get messaged and a new window is opened. Need to have sorting of messages in the window buffer then, I guess. Also MAM IQ should only be send one time in such a case. If MAM is enabled history from sql backend will not be shown. `mam` in profrc enables experimental MAM. Can change soon again. Don't rely on stuff in this stage ;)
This commit is contained in:
parent
98200ebd43
commit
51518497e5
@ -1799,6 +1799,7 @@ _get_group(preference_t pref)
|
|||||||
case PREF_REVEAL_OS:
|
case PREF_REVEAL_OS:
|
||||||
case PREF_TLS_CERTPATH:
|
case PREF_TLS_CERTPATH:
|
||||||
case PREF_CORRECTION_ALLOW:
|
case PREF_CORRECTION_ALLOW:
|
||||||
|
case PREF_MAM:
|
||||||
return PREF_GROUP_CONNECTION;
|
return PREF_GROUP_CONNECTION;
|
||||||
case PREF_OTR_LOG:
|
case PREF_OTR_LOG:
|
||||||
case PREF_OTR_POLICY:
|
case PREF_OTR_POLICY:
|
||||||
@ -2070,6 +2071,8 @@ _get_key(preference_t pref)
|
|||||||
return "avatar.cmd";
|
return "avatar.cmd";
|
||||||
case PREF_SLASH_GUARD:
|
case PREF_SLASH_GUARD:
|
||||||
return "slashguard";
|
return "slashguard";
|
||||||
|
case PREF_MAM:
|
||||||
|
return "mam";
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,7 @@ typedef enum {
|
|||||||
PREF_HISTORY_COLOR_MUC,
|
PREF_HISTORY_COLOR_MUC,
|
||||||
PREF_AVATAR_CMD,
|
PREF_AVATAR_CMD,
|
||||||
PREF_SLASH_GUARD,
|
PREF_SLASH_GUARD,
|
||||||
|
PREF_MAM,
|
||||||
} preference_t;
|
} preference_t;
|
||||||
|
|
||||||
typedef struct prof_alias_t {
|
typedef struct prof_alias_t {
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
#include "omemo/omemo.h"
|
#include "omemo/omemo.h"
|
||||||
#endif
|
#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);
|
static void _chatwin_set_last_message(ProfChatWin *chatwin, const char *const id, const char *const message);
|
||||||
|
|
||||||
ProfChatWin*
|
ProfChatWin*
|
||||||
@ -66,8 +66,8 @@ chatwin_new(const char *const barejid)
|
|||||||
ProfWin *window = wins_new_chat(barejid);
|
ProfWin *window = wins_new_chat(barejid);
|
||||||
ProfChatWin *chatwin = (ProfChatWin *)window;
|
ProfChatWin *chatwin = (ProfChatWin *)window;
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
|
if (!prefs_get_boolean(PREF_MAM) && prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
|
||||||
//_chatwin_history(chatwin, barejid);
|
_chatwin_history(chatwin, barejid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the contact is offline, show a message
|
// if the contact is offline, show a message
|
||||||
@ -87,7 +87,9 @@ chatwin_new(const char *const barejid)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
iq_mam_request(chatwin);
|
if (prefs_get_boolean(PREF_MAM)) {
|
||||||
|
iq_mam_request(chatwin);
|
||||||
|
}
|
||||||
return chatwin;
|
return chatwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,8 +287,13 @@ chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_cr
|
|||||||
|
|
||||||
chatwin->unread++;
|
chatwin->unread++;
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
|
//TODO: so far we don't ask for MAM when incoming message occurs.
|
||||||
// _chatwin_history(chatwin, chatwin->barejid);
|
//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
|
// show users status first, when receiving message via delayed delivery
|
||||||
@ -485,7 +492,6 @@ chatwin_unset_outgoing_char(ProfChatWin *chatwin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
static void
|
static void
|
||||||
_chatwin_history(ProfChatWin *chatwin, const char *const contact_barejid)
|
_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);
|
g_slist_free_full(history, (GDestroyNotify)message_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_chatwin_set_last_message(ProfChatWin *chatwin, const char *const id, const char *const message)
|
_chatwin_set_last_message(ProfChatWin *chatwin, const char *const id, const char *const message)
|
||||||
|
Loading…
Reference in New Issue
Block a user