summaryrefslogtreecommitdiff
path: root/src/core/servers.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-09-02 18:53:58 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-09-02 18:53:58 +0000
commit755a8d40eb5f9e0a12b98e4f84332891a3d63b1a (patch)
treeb96a317a11affdb428a121176836cf48e707c286 /src/core/servers.c
parent28a7908e7372fe0e81dd439b6559bc2abe3ea6e8 (diff)
downloadirssi-755a8d40eb5f9e0a12b98e4f84332891a3d63b1a.zip
Updates.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@641 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/servers.c')
-rw-r--r--src/core/servers.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/core/servers.c b/src/core/servers.c
index b8168f05..2abc7434 100644
--- a/src/core/servers.c
+++ b/src/core/servers.c
@@ -20,6 +20,7 @@
#include "module.h"
#include "signals.h"
+#include "commands.h"
#include "line-split.h"
#include "net-nonblock.h"
#include "net-sendbuffer.h"
@@ -28,6 +29,7 @@
#include "settings.h"
#include "servers.h"
+#include "servers-reconnect.h"
#include "servers-redirect.h"
#include "servers-setup.h"
#include "channels.h"
@@ -397,10 +399,49 @@ void server_connect_free(SERVER_CONNECT_REC *conn)
g_free(conn);
}
+/* `optlist' should contain only one key - the server tag.
+ returns NULL if there was unknown -option */
+SERVER_REC *cmd_options_get_server(const char *cmd,
+ GHashTable *optlist,
+ SERVER_REC *defserver)
+{
+ SERVER_REC *server;
+ GSList *list, *tmp, *next;
+
+ /* get all the options, then remove the known ones. there should
+ be only one left - the server tag. */
+ list = hashtable_get_keys(optlist);
+ for (tmp = list; tmp != NULL; tmp = next) {
+ char *option = tmp->data;
+ next = tmp->next;
+
+ if (command_have_option(cmd, option))
+ list = g_slist_remove(list, option);
+ }
+
+ if (list == NULL)
+ return defserver;
+
+ server = server_find_tag(list->data);
+ if (server == NULL || list->next != NULL) {
+ /* unknown option (not server tag) */
+ signal_emit("error command", 2,
+ GINT_TO_POINTER(CMDERR_OPTION_UNKNOWN),
+ server == NULL ? list->data : list->next->data);
+ signal_stop();
+
+ server = NULL;
+ }
+
+ g_slist_free(list);
+ return server;
+}
+
void servers_init(void)
{
lookup_servers = servers = NULL;
+ servers_reconnect_init();
servers_redirect_init();
servers_setup_init();
}
@@ -414,6 +455,7 @@ void servers_deinit(void)
servers_setup_deinit();
servers_redirect_deinit();
+ servers_reconnect_deinit();
module_uniq_destroy("SERVER");
module_uniq_destroy("SERVER CONNECT");