mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Add /channel modify
This commit is contained in:
parent
66e9c4bb39
commit
92a2384ab0
@ -246,9 +246,7 @@ static void cmd_channel(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SYNTAX: CHANNEL ADD [-auto | -noauto] [-bots <masks>] [-botcmd <command>]
|
static void cmd_channel_add_modify(const char *data, gboolean add)
|
||||||
<channel> <network> [<password>] */
|
|
||||||
static void cmd_channel_add(const char *data)
|
|
||||||
{
|
{
|
||||||
GHashTable *optlist;
|
GHashTable *optlist;
|
||||||
CHATNET_REC *chatnetrec;
|
CHATNET_REC *chatnetrec;
|
||||||
@ -257,18 +255,19 @@ static void cmd_channel_add(const char *data)
|
|||||||
void *free_arg;
|
void *free_arg;
|
||||||
|
|
||||||
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTIONS,
|
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTIONS,
|
||||||
"channel add", &optlist, &channel, &chatnet, &password))
|
"channel add", &optlist, &channel, &chatnet, &password))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (*chatnet == '\0' || *channel == '\0')
|
if (*chatnet == '\0' || *channel == '\0') {
|
||||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||||
|
}
|
||||||
|
|
||||||
chatnetrec = chatnet_find(chatnet);
|
chatnetrec = chatnet_find(chatnet);
|
||||||
if (chatnetrec == NULL) {
|
if (chatnetrec == NULL) {
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||||
TXT_UNKNOWN_CHATNET, chatnet);
|
TXT_UNKNOWN_CHATNET, chatnet);
|
||||||
cmd_params_free(free_arg);
|
cmd_params_free(free_arg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
botarg = g_hash_table_lookup(optlist, "bots");
|
botarg = g_hash_table_lookup(optlist, "bots");
|
||||||
@ -276,10 +275,17 @@ static void cmd_channel_add(const char *data)
|
|||||||
|
|
||||||
rec = channel_setup_find(channel, chatnet);
|
rec = channel_setup_find(channel, chatnet);
|
||||||
if (rec == NULL) {
|
if (rec == NULL) {
|
||||||
|
if (!add) {
|
||||||
|
cmd_params_free(free_arg);
|
||||||
|
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||||
|
TXT_CHANSETUP_NOT_FOUND, channel, chatnet);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rec = CHAT_PROTOCOL(chatnetrec)->create_channel_setup();
|
rec = CHAT_PROTOCOL(chatnetrec)->create_channel_setup();
|
||||||
rec->name = g_strdup(channel);
|
rec->name = g_strdup(channel);
|
||||||
rec->chatnet = g_strdup(chatnet);
|
rec->chatnet = g_strdup(chatnet);
|
||||||
} else {
|
} else if (!add) {
|
||||||
if (g_hash_table_lookup(optlist, "bots")) g_free_and_null(rec->botmasks);
|
if (g_hash_table_lookup(optlist, "bots")) g_free_and_null(rec->botmasks);
|
||||||
if (g_hash_table_lookup(optlist, "botcmd")) g_free_and_null(rec->autosendcmd);
|
if (g_hash_table_lookup(optlist, "botcmd")) g_free_and_null(rec->autosendcmd);
|
||||||
if (*password != '\0') g_free_and_null(rec->password);
|
if (*password != '\0') g_free_and_null(rec->password);
|
||||||
@ -299,6 +305,20 @@ static void cmd_channel_add(const char *data)
|
|||||||
cmd_params_free(free_arg);
|
cmd_params_free(free_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SYNTAX: CHANNEL ADD [-auto | -noauto] [-bots <masks>] [-botcmd <command>]
|
||||||
|
<channel> <network> [<password>] */
|
||||||
|
static void cmd_channel_add(const char *data)
|
||||||
|
{
|
||||||
|
cmd_channel_add_modify(data, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SYNTAX: CHANNEL MODIFY [-auto | -noauto] [-bots <masks>] [-botcmd <command>]
|
||||||
|
<channel> <network> [<password>] */
|
||||||
|
static void cmd_channel_modify(const char *data)
|
||||||
|
{
|
||||||
|
cmd_channel_add_modify(data, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* SYNTAX: CHANNEL REMOVE <channel> <network> */
|
/* SYNTAX: CHANNEL REMOVE <channel> <network> */
|
||||||
static void cmd_channel_remove(const char *data)
|
static void cmd_channel_remove(const char *data)
|
||||||
{
|
{
|
||||||
@ -622,6 +642,7 @@ void fe_channels_init(void)
|
|||||||
command_bind("join", NULL, (SIGNAL_FUNC) cmd_join);
|
command_bind("join", NULL, (SIGNAL_FUNC) cmd_join);
|
||||||
command_bind("channel", NULL, (SIGNAL_FUNC) cmd_channel);
|
command_bind("channel", NULL, (SIGNAL_FUNC) cmd_channel);
|
||||||
command_bind("channel add", NULL, (SIGNAL_FUNC) cmd_channel_add);
|
command_bind("channel add", NULL, (SIGNAL_FUNC) cmd_channel_add);
|
||||||
|
command_bind("channel modify", NULL, (SIGNAL_FUNC) cmd_channel_modify);
|
||||||
command_bind("channel remove", NULL, (SIGNAL_FUNC) cmd_channel_remove);
|
command_bind("channel remove", NULL, (SIGNAL_FUNC) cmd_channel_remove);
|
||||||
command_bind("channel list", NULL, (SIGNAL_FUNC) cmd_channel_list);
|
command_bind("channel list", NULL, (SIGNAL_FUNC) cmd_channel_list);
|
||||||
command_bind("names", NULL, (SIGNAL_FUNC) cmd_names);
|
command_bind("names", NULL, (SIGNAL_FUNC) cmd_names);
|
||||||
@ -643,6 +664,7 @@ void fe_channels_deinit(void)
|
|||||||
command_unbind("join", (SIGNAL_FUNC) cmd_join);
|
command_unbind("join", (SIGNAL_FUNC) cmd_join);
|
||||||
command_unbind("channel", (SIGNAL_FUNC) cmd_channel);
|
command_unbind("channel", (SIGNAL_FUNC) cmd_channel);
|
||||||
command_unbind("channel add", (SIGNAL_FUNC) cmd_channel_add);
|
command_unbind("channel add", (SIGNAL_FUNC) cmd_channel_add);
|
||||||
|
command_unbind("channel modify", (SIGNAL_FUNC) cmd_channel_modify);
|
||||||
command_unbind("channel remove", (SIGNAL_FUNC) cmd_channel_remove);
|
command_unbind("channel remove", (SIGNAL_FUNC) cmd_channel_remove);
|
||||||
command_unbind("channel list", (SIGNAL_FUNC) cmd_channel_list);
|
command_unbind("channel list", (SIGNAL_FUNC) cmd_channel_list);
|
||||||
command_unbind("names", (SIGNAL_FUNC) cmd_names);
|
command_unbind("names", (SIGNAL_FUNC) cmd_names);
|
||||||
|
Loading…
Reference in New Issue
Block a user