summaryrefslogtreecommitdiff
path: root/src/core/channels.c
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2016-01-24 23:02:40 +0100
committerLemonBoy <thatlemon@gmail.com>2016-01-24 23:02:40 +0100
commiteba160ca6df194913d80df67c19e929b9428d77e (patch)
treef61bcf4e9321dd4c28b8241e5c089ffa1f8998ec /src/core/channels.c
parent25020808710f359e75a85a5252bf0f72443d09ee (diff)
downloadirssi-eba160ca6df194913d80df67c19e929b9428d77e.zip
Duplicate the code paths for autocommands.
Diffstat (limited to 'src/core/channels.c')
-rw-r--r--src/core/channels.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/core/channels.c b/src/core/channels.c
index bfde605e..9c3b92ba 100644
--- a/src/core/channels.c
+++ b/src/core/channels.c
@@ -233,6 +233,31 @@ static int match_nick_flags(SERVER_REC *server, NICK_REC *nick, char flag)
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;
NICK_REC *nick;
char **bots, **bot;
@@ -245,20 +270,9 @@ void channel_send_autocommands(CHANNEL_REC *channel)
if (rec == NULL || rec->autosendcmd == NULL || !*rec->autosendcmd)
return;
- if (channel->wholist == FALSE) {
- /* 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);
- }
-
+ /* this case has already been handled by channel_send_autocommands */
+ if (rec->botmasks == NULL || !*rec->botmasks)
return;
- }
/* find first available bot.. */
bots = g_strsplit(rec->botmasks, " ", -1);