diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2015-11-09 16:45:19 +0100 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2015-11-09 16:45:19 +0100 |
commit | 6d6e672e8e27469bd08704edb96c3e0fa9ef898f (patch) | |
tree | 08feb06a1f5316661b614e18f32878c8404e3a78 /src/core | |
parent | 0188c1fb5d85fa0dc05114afaff44ff0aa9d7f87 (diff) | |
parent | ef1a09b87d5df7fcaeced70e09312c225d99c4b6 (diff) | |
download | irssi-6d6e672e8e27469bd08704edb96c3e0fa9ef898f.zip |
Merge pull request #313 from isundil/master
Fix #45 Make it easy to delete default channels, servers and networks
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/channels-setup.c | 15 | ||||
-rw-r--r-- | src/core/channels-setup.h | 3 | ||||
-rw-r--r-- | src/core/servers-setup.c | 15 | ||||
-rw-r--r-- | src/core/servers-setup.h | 3 |
4 files changed, 36 insertions, 0 deletions
diff --git a/src/core/channels-setup.c b/src/core/channels-setup.c index b2d971dd..2902ef8e 100644 --- a/src/core/channels-setup.c +++ b/src/core/channels-setup.c @@ -86,6 +86,21 @@ static void channel_setup_destroy(CHANNEL_SETUP_REC *channel) g_free(channel); } +void channel_setup_remove_chatnet(const char *chatnet) +{ + GSList *tmp, *next; + + g_return_if_fail(chatnet != NULL); + + for (tmp = setupchannels; tmp != NULL; tmp = next) { + CHANNEL_SETUP_REC *rec = tmp->data; + + next = tmp->next; + if (g_ascii_strcasecmp(rec->chatnet, chatnet) == 0) + channel_setup_remove(rec); + } +} + void channel_setup_remove(CHANNEL_SETUP_REC *channel) { channel_config_remove(channel); diff --git a/src/core/channels-setup.h b/src/core/channels-setup.h index 61b828b2..3bb7da7f 100644 --- a/src/core/channels-setup.h +++ b/src/core/channels-setup.h @@ -21,6 +21,9 @@ void channels_setup_deinit(void); void channel_setup_create(CHANNEL_SETUP_REC *channel); void channel_setup_remove(CHANNEL_SETUP_REC *channel); +/* Remove channels attached to chatnet */ +void channel_setup_remove_chatnet(const char *chatnet); + CHANNEL_SETUP_REC *channel_setup_find(const char *channel, const char *chatnet); diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 90a447d4..771e3999 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -505,6 +505,21 @@ void server_setup_add(SERVER_SETUP_REC *rec) signal_emit("server setup updated", 1, rec); } +void server_setup_remove_chatnet(const char *chatnet) +{ + GSList *tmp, *next; + + g_return_if_fail(chatnet != NULL); + + for (tmp = setupservers; tmp != NULL; tmp = next) { + SERVER_SETUP_REC *rec = tmp->data; + + next = tmp->next; + if (g_ascii_strcasecmp(rec->chatnet, chatnet) == 0) + server_setup_remove(rec); + } +} + void server_setup_remove(SERVER_SETUP_REC *rec) { server_setup_remove_config(rec); diff --git a/src/core/servers-setup.h b/src/core/servers-setup.h index f7601a68..e7ff7abf 100644 --- a/src/core/servers-setup.h +++ b/src/core/servers-setup.h @@ -39,6 +39,9 @@ SERVER_SETUP_REC *server_setup_find(const char *address, int port, void server_setup_add(SERVER_SETUP_REC *rec); void server_setup_remove(SERVER_SETUP_REC *rec); +/* Remove servers attached to chatne */ +void server_setup_remove_chatnet(const char *chatnet); + void servers_setup_init(void); void servers_setup_deinit(void); |