1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Save bookmark ignore list

This commit is contained in:
Michael Vetter 2020-05-25 13:49:24 +02:00
parent 1cfab017a4
commit 438552c14c
2 changed files with 19 additions and 1 deletions

View File

@ -4780,7 +4780,7 @@ cmd_bookmark_ignore(ProfWin *window, const char *const command, gchar **args)
// `/bookmark ignore` lists them // `/bookmark ignore` lists them
if (args[1] == NULL) { if (args[1] == NULL) {
gsize len; gsize len = 0;
gchar **list = bookmark_ignore_list(&len); gchar **list = bookmark_ignore_list(&len);
cons_show_bookmarks_ignore(list, len); cons_show_bookmarks_ignore(list, len);
g_strfreev(list); g_strfreev(list);

View File

@ -63,6 +63,22 @@ _bookmark_ignore_load()
free(bi_loc); 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 void
bookmark_ignore_on_connect(const char *const barejid) bookmark_ignore_on_connect(const char *const barejid)
{ {
@ -96,10 +112,12 @@ void
bookmark_ignore_add(const char *const barejid) bookmark_ignore_add(const char *const barejid)
{ {
g_key_file_set_boolean(bookmark_ignore_keyfile, account_jid, barejid, TRUE); g_key_file_set_boolean(bookmark_ignore_keyfile, account_jid, barejid, TRUE);
_bookmark_save();
} }
void void
bookmark_ignore_remove(const char *const barejid) bookmark_ignore_remove(const char *const barejid)
{ {
g_key_file_remove_key(bookmark_ignore_keyfile, account_jid, barejid, NULL); g_key_file_remove_key(bookmark_ignore_keyfile, account_jid, barejid, NULL);
_bookmark_save();
} }