diff options
-rw-r--r-- | src/core/chat-commands.c | 5 | ||||
-rw-r--r-- | src/core/servers.c | 17 | ||||
-rw-r--r-- | src/core/servers.h | 1 |
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 */ |