mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #399 from LemonBoy/bots
Change when the autocmds are sent.
This commit is contained in:
commit
c7a3d2822c
@ -231,6 +231,31 @@ static int match_nick_flags(SERVER_REC *server, NICK_REC *nick, char flag)
|
|||||||
|
|
||||||
/* Send the auto send command to channel */
|
/* Send the auto send command to channel */
|
||||||
void channel_send_autocommands(CHANNEL_REC *channel)
|
void channel_send_autocommands(CHANNEL_REC *channel)
|
||||||
|
{
|
||||||
|
CHANNEL_SETUP_REC *rec;
|
||||||
|
|
||||||
|
g_return_if_fail(IS_CHANNEL(channel));
|
||||||
|
|
||||||
|
if (channel->session_rejoin)
|
||||||
|
return;
|
||||||
|
|
||||||
|
rec = channel_setup_find(channel->name, channel->server->connrec->chatnet);
|
||||||
|
if (rec == NULL || rec->autosendcmd == NULL || !*rec->autosendcmd)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* if the autosendcmd alone (with no -bots parameter) has been
|
||||||
|
* specified then send it right after joining the channel, when
|
||||||
|
* the WHO list hasn't been yet retrieved.
|
||||||
|
* Depending on the value of the 'channel_max_who_sync' option
|
||||||
|
* the WHO list might not be retrieved after the join event. */
|
||||||
|
|
||||||
|
if (rec->botmasks == NULL || !*rec->botmasks) {
|
||||||
|
/* just send the command. */
|
||||||
|
eval_special_string(rec->autosendcmd, "", channel->server, channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void channel_send_botcommands(CHANNEL_REC *channel)
|
||||||
{
|
{
|
||||||
CHANNEL_SETUP_REC *rec;
|
CHANNEL_SETUP_REC *rec;
|
||||||
NICK_REC *nick;
|
NICK_REC *nick;
|
||||||
@ -245,11 +270,9 @@ void channel_send_autocommands(CHANNEL_REC *channel)
|
|||||||
if (rec == NULL || rec->autosendcmd == NULL || !*rec->autosendcmd)
|
if (rec == NULL || rec->autosendcmd == NULL || !*rec->autosendcmd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (rec->botmasks == NULL || !*rec->botmasks) {
|
/* this case has already been handled by channel_send_autocommands */
|
||||||
/* just send the command. */
|
if (rec->botmasks == NULL || !*rec->botmasks)
|
||||||
eval_special_string(rec->autosendcmd, "", channel->server, channel);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* find first available bot.. */
|
/* find first available bot.. */
|
||||||
bots = g_strsplit(rec->botmasks, " ", -1);
|
bots = g_strsplit(rec->botmasks, " ", -1);
|
||||||
|
@ -31,6 +31,7 @@ void channel_change_visible_name(CHANNEL_REC *channel, const char *name);
|
|||||||
|
|
||||||
/* Send the auto send command to channel */
|
/* Send the auto send command to channel */
|
||||||
void channel_send_autocommands(CHANNEL_REC *channel);
|
void channel_send_autocommands(CHANNEL_REC *channel);
|
||||||
|
void channel_send_botcommands(CHANNEL_REC *channel);
|
||||||
|
|
||||||
void channels_init(void);
|
void channels_init(void);
|
||||||
void channels_deinit(void);
|
void channels_deinit(void);
|
||||||
|
@ -24,10 +24,12 @@
|
|||||||
|
|
||||||
void irc_channels_setup_init(void)
|
void irc_channels_setup_init(void)
|
||||||
{
|
{
|
||||||
signal_add("channel wholist", (SIGNAL_FUNC) channel_send_autocommands);
|
signal_add("channel wholist", (SIGNAL_FUNC) channel_send_botcommands);
|
||||||
|
signal_add("channel joined", (SIGNAL_FUNC) channel_send_autocommands);
|
||||||
}
|
}
|
||||||
|
|
||||||
void irc_channels_setup_deinit(void)
|
void irc_channels_setup_deinit(void)
|
||||||
{
|
{
|
||||||
signal_remove("channel wholist", (SIGNAL_FUNC) channel_send_autocommands);
|
signal_remove("channel wholist", (SIGNAL_FUNC) channel_send_botcommands);
|
||||||
|
signal_remove("channel joined", (SIGNAL_FUNC) channel_send_autocommands);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user