From 82971299a7cd45a5dd57f1427cfafb84a1efaf19 Mon Sep 17 00:00:00 2001 From: mjentsch Date: Thu, 12 Nov 2015 20:20:27 +0100 Subject: [PATCH] Do not write to secret file when reading a secret chat from it --- telegram-purple.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/telegram-purple.c b/telegram-purple.c index 15156c1..e97fe9b 100644 --- a/telegram-purple.c +++ b/telegram-purple.c @@ -174,6 +174,10 @@ static void update_secret_chat_handler (struct tgl_state *TLS, struct tgl_secret if (flags & TGL_UPDATE_CREATED) { tgp_blist_peer_add_purple_name (TLS, U->id, U->print_name); + } else { + if (flags & TGL_UPDATE_WORKING || flags & TGL_UPDATE_DELETED) { + write_secret_chat_file (TLS); + } } if (!(flags & TGL_UPDATE_DELETED)) { @@ -184,11 +188,7 @@ static void update_secret_chat_handler (struct tgl_state *TLS, struct tgl_secret } purple_prpl_got_user_status (tg_get_acc (TLS), tgp_blist_peer_get_purple_name (TLS, U->id), "mobile", NULL); } - - if (flags & TGL_UPDATE_WORKING || flags & TGL_UPDATE_DELETED) { - write_secret_chat_file (TLS); - } - + if (flags & TGL_UPDATE_REQUESTED) { const char* choice = purple_account_get_string (conn->pa, "accept-secret-chats", "ask"); if (! strcmp (choice, "always")) {