summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-08-09 11:17:31 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-08-09 11:17:31 +0000
commit2ad623acd0ae1e5bca04fd2e21cfc0749c46059c (patch)
tree4921661c07c0c257b0c42d451e326314d8d43215 /src/core
parent452db286da579b163b65d964c452c0d73de21637 (diff)
downloadirssi-2ad623acd0ae1e5bca04fd2e21cfc0749c46059c.zip
/DISCONNECT <tag> works again for not-yet-connected servers.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2874 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r--src/core/chat-commands.c5
-rw-r--r--src/core/servers.c17
-rw-r--r--src/core/servers.h1
3 files changed, 22 insertions, 1 deletions
diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c
index cc44a213..4bc931dc 100644
--- a/src/core/chat-commands.c
+++ b/src/core/chat-commands.c
@@ -245,8 +245,11 @@ static void cmd_disconnect(const char *data, SERVER_REC *server)
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &tag, &msg))
return;
- if (*tag != '\0' && strcmp(tag, "*") != 0)
+ if (*tag != '\0' && strcmp(tag, "*") != 0) {
server = server_find_tag(tag);
+ if (server == NULL)
+ server = server_find_lookup_tag(tag);
+ }
if (server == NULL) cmd_param_error(CMDERR_NOT_CONNECTED);
if (*msg == '\0') msg = (char *) settings_get_str("quit_message");
diff --git a/src/core/servers.c b/src/core/servers.c
index 47dc688c..e2972ddd 100644
--- a/src/core/servers.c
+++ b/src/core/servers.c
@@ -481,6 +481,23 @@ SERVER_REC *server_find_tag(const char *tag)
return NULL;
}
+SERVER_REC *server_find_lookup_tag(const char *tag)
+{
+ GSList *tmp;
+
+ g_return_val_if_fail(tag != NULL, NULL);
+ if (*tag == '\0') return NULL;
+
+ for (tmp = lookup_servers; tmp != NULL; tmp = tmp->next) {
+ SERVER_REC *server = tmp->data;
+
+ if (g_strcasecmp(server->tag, tag) == 0)
+ return server;
+ }
+
+ return NULL;
+}
+
SERVER_REC *server_find_chatnet(const char *chatnet)
{
GSList *tmp;
diff --git a/src/core/servers.h b/src/core/servers.h
index 3c2c8634..d6afbdf5 100644
--- a/src/core/servers.h
+++ b/src/core/servers.h
@@ -46,6 +46,7 @@ void server_ref(SERVER_REC *server);
int server_unref(SERVER_REC *server);
SERVER_REC *server_find_tag(const char *tag);
+SERVER_REC *server_find_lookup_tag(const char *tag);
SERVER_REC *server_find_chatnet(const char *chatnet);
/* starts connecting to server */