CHANNEL_REC->get_join_data() - Returns the information needed to call

SERVER_REC->channels_join() for this channel. Usually just the channel name,
but may contain also the channel key.

If we receive PART-message to channel that hasn't received a JOIN yet,
don't destroy the channel. It's probably because we did quickly /PART +
/JOIN.

Moved /CYCLE to fe-common/core, it doesn't close the window for the cycled
channel anymore if you had autoclosing on.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1484 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-05-11 16:08:48 +00:00 committed by cras
commit 1f23c05ee7
7 changed files with 74 additions and 43 deletions

View file

@ -534,6 +534,36 @@ static void cmd_names(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
cmd_params_free(free_arg);
}
/* SYNTAX: CYCLE [<channel>] [<message>] */
static void cmd_cycle(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
{
CHANNEL_REC *chanrec;
char *channame, *msg, *joindata;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN,
item, &channame, &msg))
return;
if (*channame == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
chanrec = channel_find(server, channame);
if (chanrec == NULL) cmd_param_error(CMDERR_CHAN_NOT_FOUND);
joindata = chanrec->get_join_data(chanrec);
window_bind_add(window_item_window(chanrec),
chanrec->server->tag, chanrec->name);
channel_destroy(chanrec);
server->channels_join(server, joindata, FALSE);
g_free(joindata);
cmd_params_free(free_arg);
}
void fe_channels_init(void)
{
settings_add_bool("lookandfeel", "autoclose_windows", TRUE);
@ -554,6 +584,7 @@ void fe_channels_init(void)
command_bind("channel remove", NULL, (SIGNAL_FUNC) cmd_channel_remove);
command_bind("channel list", NULL, (SIGNAL_FUNC) cmd_channel_list);
command_bind("names", NULL, (SIGNAL_FUNC) cmd_names);
command_bind("cycle", NULL, (SIGNAL_FUNC) cmd_cycle);
command_set_options("channel add", "auto noauto -bots -botcmd");
command_set_options("names", "ops halfops voices normal");
@ -576,4 +607,5 @@ void fe_channels_deinit(void)
command_unbind("channel remove", (SIGNAL_FUNC) cmd_channel_remove);
command_unbind("channel list", (SIGNAL_FUNC) cmd_channel_list);
command_unbind("names", (SIGNAL_FUNC) cmd_names);
command_unbind("cycle", (SIGNAL_FUNC) cmd_cycle);
}

View file

@ -140,7 +140,7 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "ctcp_reply", "CTCP {hilight $0} reply from {nick $1}: $2", 3, { 0, 0, 0 } },
{ "ctcp_reply_channel", "CTCP {hilight $0} reply from {nick $1} in channel {channel $3}: $2", 4, { 0, 0, 0, 0 } },
{ "ctcp_ping_reply", "CTCP {hilight PING} reply from {nick $0}: $1.$[-3.0]2 seconds", 3, { 0, 2, 2 } },
{ "ctcp_requested", "{ctcp >>> {hilight $0} {comment $1} requested {hilight $2} from {nick $3}}", 4, { 0, 0, 0, 0 } },
{ "ctcp_requested", "{ctcp {hilight $0} {comment $1} requested {hilight $2} from {nick $3}}", 4, { 0, 0, 0, 0 } },
/* ---- */
{ NULL, "Other server events", 0 },