aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-connection.c
diff options
context:
space:
mode:
authorEion Robb <eion@robbmob.com>2017-03-12 12:52:15 +1300
committerEion Robb <eion@robbmob.com>2017-03-12 12:52:15 +1300
commit482e9d97fb02d1d332bea2c156b2f915779c6fd4 (patch)
treee7a936266ca4c760cfa0cb467fdf1298b6ebb268 /matrix-connection.c
parentccf49582556edc17c75df1073d61d8bebfede744 (diff)
downloadpurple-matrix-482e9d97fb02d1d332bea2c156b2f915779c6fd4.tar.gz
Re-use the device-id provided by the server
so we don't show up once for each login
Diffstat (limited to 'matrix-connection.c')
-rw-r--r--matrix-connection.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/matrix-connection.c b/matrix-connection.c
index 893e3db..91c660a 100644
--- a/matrix-connection.c
+++ b/matrix-connection.c
@@ -181,6 +181,8 @@ static void _login_completed(MatrixConnectionData *conn,
conn->access_token = g_strdup(access_token);
conn->user_id = g_strdup(matrix_json_object_get_string_member(root_obj,
"user_id"));
+ purple_account_set_string(pc->account, "device_id",
+ matrix_json_object_get_string_member(root_obj, "device_id"));
/* start the sync loop */
next_batch = purple_account_get_string(pc->account,
@@ -233,7 +235,9 @@ void matrix_connection_start_login(PurpleConnection *pc)
purple_connection_update_progress(pc, _("Logging in"), 0, 3);
matrix_api_password_login(conn, acct->username,
- purple_account_get_password(acct), _login_completed, conn);
+ purple_account_get_password(acct),
+ purple_account_get_string(acct, "device_id", NULL),
+ _login_completed, conn);
}