aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-connection.c
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2015-11-02 16:19:26 +0000
committerRichard van der Hoff <richard@matrix.org>2015-11-02 16:19:26 +0000
commitc0b7ecec629c6b31cac5782c8c9b0bcdf5b62772 (patch)
treedf8b21884a076d2d16362f22b1abc9900824a522 /matrix-connection.c
parenta380e96fd91837834fbd729515778656fca86566 (diff)
downloadpurple-matrix-c0b7ecec629c6b31cac5782c8c9b0bcdf5b62772.tar.gz
Reload old messages on first connection
The Pidgin UI is crappy for finding old messages, so reload them from the server on startup.
Diffstat (limited to 'matrix-connection.c')
-rw-r--r--matrix-connection.c12
1 files changed, 11 insertions, 1 deletions
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);
}