diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-08-20 21:10:23 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-08-20 21:10:23 +0200 |
commit | 7feba5d370a3ce04f45491442c55dfde978bec1f (patch) | |
tree | 88eaaf5d7962610ea306beb149b09bf805aabf9a | |
parent | 06e7eb858bffbaf85e91d41825834b38dd0837be (diff) |
Implemented server_remove().
-rw-r--r-- | servers.c | 12 | ||||
-rw-r--r-- | servers.h | 1 |
2 files changed, 13 insertions, 0 deletions
@@ -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; @@ -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 |