mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Merge pull request #313 from isundil/master
Fix #45 Make it easy to delete default channels, servers and networks
This commit is contained in:
commit
6d6e672e8e
@ -86,6 +86,21 @@ static void channel_setup_destroy(CHANNEL_SETUP_REC *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)
|
||||
{
|
||||
channel_config_remove(channel);
|
||||
|
@ -21,6 +21,9 @@ void channels_setup_deinit(void);
|
||||
void channel_setup_create(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,
|
||||
const char *chatnet);
|
||||
|
||||
|
@ -505,6 +505,21 @@ void server_setup_add(SERVER_SETUP_REC *rec)
|
||||
signal_emit("server setup updated", 1, rec);
|
||||
}
|
||||
|
||||
void server_setup_remove_chatnet(const char *chatnet)
|
||||
{
|
||||
GSList *tmp, *next;
|
||||
|
||||
g_return_if_fail(chatnet != 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)
|
||||
{
|
||||
server_setup_remove_config(rec);
|
||||
|
@ -39,6 +39,9 @@ SERVER_SETUP_REC *server_setup_find(const char *address, int port,
|
||||
void server_setup_add(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_deinit(void);
|
||||
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "irc-servers.h"
|
||||
#include "irc-chatnets.h"
|
||||
#include "printtext.h"
|
||||
#include "servers-setup.h"
|
||||
#include "channels-setup.h"
|
||||
|
||||
static void cmd_network_list(void)
|
||||
{
|
||||
@ -183,6 +185,8 @@ static void cmd_network_remove(const char *data)
|
||||
if (rec == NULL)
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_NOT_FOUND, data);
|
||||
else {
|
||||
server_setup_remove_chatnet(data);
|
||||
channel_setup_remove_chatnet(data);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_REMOVED, data);
|
||||
chatnet_remove(CHATNET(rec));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user