summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-08-20 21:10:23 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-08-20 21:10:23 +0200
commit7feba5d370a3ce04f45491442c55dfde978bec1f (patch)
tree88eaaf5d7962610ea306beb149b09bf805aabf9a
parent06e7eb858bffbaf85e91d41825834b38dd0837be (diff)
Implemented server_remove().
-rw-r--r--servers.c12
-rw-r--r--servers.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/servers.c b/servers.c
index 2efd6d4..554bfcc 100644
--- a/servers.c
+++ b/servers.c
@@ -18,6 +18,18 @@ gboolean server_add(const gchar *host, const guint16 port) {
return TRUE;
}
+gboolean server_remove(struct server *server) {
+ gint pos = g_slist_index(servers, server);
+
+ if(pos == -1) {
+ return FALSE;
+ }
+
+ servers = g_slist_remove(servers, server);
+
+ return TRUE;
+}
+
void server_clear() {
for(GSList *node = servers; node; node = g_slist_next(node)) {
struct server *s = node->data;
diff --git a/servers.h b/servers.h
index 2f23090..11dc3af 100644
--- a/servers.h
+++ b/servers.h
@@ -9,6 +9,7 @@ struct server {
};
gboolean server_add(const gchar *host, const guint16 port);
+gboolean server_remove(struct server *server);
void server_clear();
#endif