summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorisundil <isundill@gmail.com>2015-10-01 21:14:30 +0200
committerisundil <isundill@gmail.com>2015-10-01 21:14:30 +0200
commit2ad6bb12955b3e9bfa43628e6dbfc984537f8b26 (patch)
tree2463c677cd24953f368b762af646d09d8473644b /src/core
parent8217147a805af081010578b0dcd7fe42fede1425 (diff)
downloadirssi-2ad6bb12955b3e9bfa43628e6dbfc984537f8b26.zip
Fix #45 Make it easy to delete default channels, servers and networks
Removing network will now also remove all attached servers
Diffstat (limited to 'src/core')
-rw-r--r--src/core/servers-setup.c18
-rw-r--r--src/core/servers-setup.h4
2 files changed, 22 insertions, 0 deletions
diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c
index 90a447d4..74b818e7 100644
--- a/src/core/servers-setup.c
+++ b/src/core/servers-setup.c
@@ -333,6 +333,24 @@ server_create_conn(int chat_type, const char *dest, int port,
chatnet, password, nick);
}
+GSList *server_setup_find_chatnet(const char *chatnet)
+{
+ GSList *servers;
+ GSList *tmp;
+
+ g_return_val_if_fail(chatnet != NULL, NULL);
+
+ servers = NULL;
+ for (tmp = setupservers; tmp != NULL; tmp = tmp->next) {
+ SERVER_SETUP_REC *rec = tmp->data;
+
+ if (g_ascii_strcasecmp(rec->chatnet, chatnet) == 0)
+ servers = g_slist_append(servers, rec);
+ }
+
+ return servers;
+}
+
/* Find matching server from setup. Try to find record with a same port,
but fallback to any server with the same address. */
SERVER_SETUP_REC *server_setup_find(const char *address, int port,
diff --git a/src/core/servers-setup.h b/src/core/servers-setup.h
index f7601a68..dffaec02 100644
--- a/src/core/servers-setup.h
+++ b/src/core/servers-setup.h
@@ -36,6 +36,10 @@ server_create_conn(int chat_type, const char *dest, int port,
SERVER_SETUP_REC *server_setup_find(const char *address, int port,
const char *chatnet);
+/* Find all servers matching chatnet.
+ Return a list of SERVER_SETUP_REC */
+GSList *server_setup_find_chatnet(const char *chatnet);
+
void server_setup_add(SERVER_SETUP_REC *rec);
void server_setup_remove(SERVER_SETUP_REC *rec);