mirror of
https://github.com/irssi/irssi.git
synced 2024-09-08 04:26:01 -04:00
Updated server removal
Removing network will also remove attached channels
This commit is contained in:
parent
2ad6bb1295
commit
6ca7dc6847
@ -86,6 +86,21 @@ static void channel_setup_destroy(CHANNEL_SETUP_REC *channel)
|
|||||||
g_free(channel);
|
g_free(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void channel_setup_remove_chatnet(const char *chatnet)
|
||||||
|
{
|
||||||
|
GSList *tmp, *next;
|
||||||
|
|
||||||
|
g_return_if_fail(chatnet != NULL);
|
||||||
|
|
||||||
|
for (tmp = setupchannels; tmp != NULL; tmp = next) {
|
||||||
|
CHANNEL_SETUP_REC *rec = tmp->data;
|
||||||
|
|
||||||
|
next = tmp->next;
|
||||||
|
if (g_ascii_strcasecmp(rec->chatnet, chatnet) == 0)
|
||||||
|
channel_setup_remove(rec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void channel_setup_remove(CHANNEL_SETUP_REC *channel)
|
void channel_setup_remove(CHANNEL_SETUP_REC *channel)
|
||||||
{
|
{
|
||||||
channel_config_remove(channel);
|
channel_config_remove(channel);
|
||||||
|
@ -21,6 +21,9 @@ void channels_setup_deinit(void);
|
|||||||
void channel_setup_create(CHANNEL_SETUP_REC *channel);
|
void channel_setup_create(CHANNEL_SETUP_REC *channel);
|
||||||
void channel_setup_remove(CHANNEL_SETUP_REC *channel);
|
void channel_setup_remove(CHANNEL_SETUP_REC *channel);
|
||||||
|
|
||||||
|
/* Remove channels attached to chatnet */
|
||||||
|
void channel_setup_remove_chatnet(const char *chatnet);
|
||||||
|
|
||||||
CHANNEL_SETUP_REC *channel_setup_find(const char *channel,
|
CHANNEL_SETUP_REC *channel_setup_find(const char *channel,
|
||||||
const char *chatnet);
|
const char *chatnet);
|
||||||
|
|
||||||
|
@ -333,24 +333,6 @@ server_create_conn(int chat_type, const char *dest, int port,
|
|||||||
chatnet, password, nick);
|
chatnet, password, nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
GSList *server_setup_find_chatnet(const char *chatnet)
|
|
||||||
{
|
|
||||||
GSList *servers;
|
|
||||||
GSList *tmp;
|
|
||||||
|
|
||||||
g_return_val_if_fail(chatnet != NULL, NULL);
|
|
||||||
|
|
||||||
servers = NULL;
|
|
||||||
for (tmp = setupservers; tmp != NULL; tmp = tmp->next) {
|
|
||||||
SERVER_SETUP_REC *rec = tmp->data;
|
|
||||||
|
|
||||||
if (g_ascii_strcasecmp(rec->chatnet, chatnet) == 0)
|
|
||||||
servers = g_slist_append(servers, rec);
|
|
||||||
}
|
|
||||||
|
|
||||||
return servers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find matching server from setup. Try to find record with a same port,
|
/* Find matching server from setup. Try to find record with a same port,
|
||||||
but fallback to any server with the same address. */
|
but fallback to any server with the same address. */
|
||||||
SERVER_SETUP_REC *server_setup_find(const char *address, int port,
|
SERVER_SETUP_REC *server_setup_find(const char *address, int port,
|
||||||
@ -523,6 +505,21 @@ void server_setup_add(SERVER_SETUP_REC *rec)
|
|||||||
signal_emit("server setup updated", 1, rec);
|
signal_emit("server setup updated", 1, rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void server_setup_remove_chatnet(const char *chatnet)
|
||||||
|
{
|
||||||
|
GSList *tmp, *next;
|
||||||
|
|
||||||
|
g_return_val_if_fail(chatnet != NULL, NULL);
|
||||||
|
|
||||||
|
for (tmp = setupservers; tmp != NULL; tmp = next) {
|
||||||
|
SERVER_SETUP_REC *rec = tmp->data;
|
||||||
|
|
||||||
|
next = tmp->next;
|
||||||
|
if (g_ascii_strcasecmp(rec->chatnet, chatnet) == 0)
|
||||||
|
server_setup_remove(rec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void server_setup_remove(SERVER_SETUP_REC *rec)
|
void server_setup_remove(SERVER_SETUP_REC *rec)
|
||||||
{
|
{
|
||||||
server_setup_remove_config(rec);
|
server_setup_remove_config(rec);
|
||||||
|
@ -36,13 +36,12 @@ server_create_conn(int chat_type, const char *dest, int port,
|
|||||||
SERVER_SETUP_REC *server_setup_find(const char *address, int port,
|
SERVER_SETUP_REC *server_setup_find(const char *address, int port,
|
||||||
const char *chatnet);
|
const char *chatnet);
|
||||||
|
|
||||||
/* Find all servers matching chatnet.
|
|
||||||
Return a list of SERVER_SETUP_REC */
|
|
||||||
GSList *server_setup_find_chatnet(const char *chatnet);
|
|
||||||
|
|
||||||
void server_setup_add(SERVER_SETUP_REC *rec);
|
void server_setup_add(SERVER_SETUP_REC *rec);
|
||||||
void server_setup_remove(SERVER_SETUP_REC *rec);
|
void server_setup_remove(SERVER_SETUP_REC *rec);
|
||||||
|
|
||||||
|
/* Remove servers attached to chatne */
|
||||||
|
void server_setup_remove_chatnet(const char *chatnet);
|
||||||
|
|
||||||
void servers_setup_init(void);
|
void servers_setup_init(void);
|
||||||
void servers_setup_deinit(void);
|
void servers_setup_deinit(void);
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "irc-servers.h"
|
#include "irc-servers.h"
|
||||||
#include "irc-chatnets.h"
|
#include "irc-chatnets.h"
|
||||||
#include "printtext.h"
|
#include "printtext.h"
|
||||||
|
#include "servers-setup.h"
|
||||||
|
#include "channels-setup.h"
|
||||||
|
|
||||||
static void cmd_network_list(void)
|
static void cmd_network_list(void)
|
||||||
{
|
{
|
||||||
@ -176,8 +178,6 @@ static void cmd_network_add(const char *data)
|
|||||||
static void cmd_network_remove(const char *data)
|
static void cmd_network_remove(const char *data)
|
||||||
{
|
{
|
||||||
IRC_CHATNET_REC *rec;
|
IRC_CHATNET_REC *rec;
|
||||||
GSList *servers;
|
|
||||||
GSList *tmp;
|
|
||||||
|
|
||||||
if (*data == '\0') cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
|
if (*data == '\0') cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||||
|
|
||||||
@ -185,10 +185,8 @@ static void cmd_network_remove(const char *data)
|
|||||||
if (rec == NULL)
|
if (rec == NULL)
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_NOT_FOUND, data);
|
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_NOT_FOUND, data);
|
||||||
else {
|
else {
|
||||||
servers = server_setup_find_chatnet(data);
|
server_setup_remove_chatnet(data);
|
||||||
|
channel_setup_remove_chatnet(data);
|
||||||
for (tmp = servers; tmp != NULL; tmp = tmp->next)
|
|
||||||
server_setup_remove((SERVER_SETUP_REC *) tmp->data);
|
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_REMOVED, data);
|
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_REMOVED, data);
|
||||||
chatnet_remove(CHATNET(rec));
|
chatnet_remove(CHATNET(rec));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user