aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmatrix.c5
-rw-r--r--libmatrix.h1
-rw-r--r--matrix-connection.c12
3 files changed, 17 insertions, 1 deletions
diff --git a/libmatrix.c b/libmatrix.c
index 0e41493..ead6361 100644
--- a/libmatrix.c
+++ b/libmatrix.c
@@ -1030,6 +1030,11 @@ static void matrixprpl_init(PurplePlugin *plugin)
purple_account_option_string_new(
_("Home server URL"), PRPL_ACCOUNT_OPT_HOME_SERVER,
DEFAULT_HOME_SERVER));
+ protocol_options = g_list_append(protocol_options,
+ purple_account_option_bool_new(
+ _("On reconnect, replay recent messages from joined rooms"),
+ PRPL_ACCOUNT_OPT_REPLAY_OLD_MESSAGES, TRUE));
+
prpl_info.protocol_options = protocol_options;
diff --git a/libmatrix.h b/libmatrix.h
index e485512..486d0b3 100644
--- a/libmatrix.h
+++ b/libmatrix.h
@@ -43,6 +43,7 @@
*/
#define PRPL_ACCOUNT_OPT_HOME_SERVER "home_server"
#define PRPL_ACCOUNT_OPT_NEXT_BATCH "next_batch"
+#define PRPL_ACCOUNT_OPT_REPLAY_OLD_MESSAGES "replay_messages"
/* defaults for account options */
#define DEFAULT_HOME_SERVER "https://matrix.org"
diff --git a/matrix-connection.c b/matrix-connection.c
index c860ac6..f334a9d 100644
--- a/matrix-connection.c
+++ b/matrix-connection.c
@@ -190,8 +190,17 @@ static void _login_completed(MatrixConnectionData *conn,
* with this account, that is a pretty good indication that we have
* previously done a full_state sync.
*/
- if(_account_has_active_conversations(pc->account))
+ if(_account_has_active_conversations(pc->account)) {
needs_full_state_sync = FALSE;
+ } else {
+ /* this appears to be the first time we have connected to this account
+ * on this invocation of pidgin.
+ */
+ gboolean replay = purple_account_get_bool(pc->account,
+ PRPL_ACCOUNT_OPT_REPLAY_OLD_MESSAGES, TRUE);
+ if(replay)
+ next_batch = NULL;
+ }
}
if(needs_full_state_sync) {
@@ -200,6 +209,7 @@ static void _login_completed(MatrixConnectionData *conn,
purple_connection_update_progress(pc, _("Connected"), 2, 3);
purple_connection_set_state(pc, PURPLE_CONNECTED);
}
+
_start_next_sync(conn, next_batch, needs_full_state_sync);
}