about summary refs log tree commit diff stats
path: root/src/tools
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-05-25 13:49:24 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-05-25 13:49:24 +0200
commit438552c14cd5fc32adcc39f5a88fd2c0a17242b2 (patch)
treeff8dd55c149e46ebdbb9818e23934c0df0d0272e /src/tools
parent1cfab017a44b3059dc811eebd1d92edf794defb4 (diff)
downloadprofani-tty-438552c14cd5fc32adcc39f5a88fd2c0a17242b2.tar.gz
Save bookmark ignore list
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/bookmark_ignore.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/bookmark_ignore.c b/src/tools/bookmark_ignore.c
index 2be65d5f..5e6a43c5 100644
--- a/src/tools/bookmark_ignore.c
+++ b/src/tools/bookmark_ignore.c
@@ -63,6 +63,22 @@ _bookmark_ignore_load()
     free(bi_loc);
 }
 
+static void
+_bookmark_save()
+{
+    gsize g_data_size;
+    gchar *g_bookmark_ignore_data = g_key_file_to_data(bookmark_ignore_keyfile, &g_data_size, NULL);
+
+    char *bi_loc;
+    bi_loc = files_get_data_path(FILE_BOOKMARK_AUTOJOIN_IGNORE);
+
+    g_file_set_contents(bi_loc, g_bookmark_ignore_data, g_data_size, NULL);
+    g_chmod(bi_loc, S_IRUSR | S_IWUSR);
+
+    free(bi_loc);
+    g_free(g_bookmark_ignore_data);
+}
+
 void
 bookmark_ignore_on_connect(const char *const barejid)
 {
@@ -96,10 +112,12 @@ void
 bookmark_ignore_add(const char *const barejid)
 {
     g_key_file_set_boolean(bookmark_ignore_keyfile, account_jid, barejid, TRUE);
+    _bookmark_save();
 }
 
 void
 bookmark_ignore_remove(const char *const barejid)
 {
     g_key_file_remove_key(bookmark_ignore_keyfile, account_jid, barejid, NULL);
+    _bookmark_save();
 }