Skip to content

Commit

Permalink
Fix channel mode +P (Permanent) not working if you have set::modes-on…
Browse files Browse the repository at this point in the history
…-join, reported by blank (#4426).
  • Loading branch information
syzop committed Oct 17, 2015
1 parent 7637517 commit f1426e0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/modules/m_join.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ DLLFUNC void _join_channel(aChannel *chptr, aClient *cptr, aClient *sptr, int fl
}
#endif
}

if (chptr->topic)
{
sendto_one(sptr, rpl_str(RPL_TOPIC),
Expand All @@ -281,7 +282,13 @@ DLLFUNC void _join_channel(aChannel *chptr, aClient *cptr, aClient *sptr, int fl
sptr->name, chptr->chname, chptr->topic_nick,
chptr->topic_time);
}
if (chptr->users == 1 && (MODES_ON_JOIN || iConf.modes_on_join.extmodes))

/* Set default channel modes (set::modes-on-join).
* Set only if it's the 1st user and only if no other modes have been set
* already (eg: +P, permanent).
*/
if ((chptr->users == 1) && !chptr->mode.mode && !chptr->mode.extmode &&
(MODES_ON_JOIN || iConf.modes_on_join.extmodes))
{
int i;
chptr->mode.extmode = iConf.modes_on_join.extmodes;
Expand All @@ -303,9 +310,11 @@ DLLFUNC void _join_channel(aChannel *chptr, aClient *cptr, aClient *sptr, int fl
me.name, chptr->chname, modebuf, parabuf, chptr->creationtime);
sendto_one(sptr, ":%s MODE %s %s %s", me.name, chptr->chname, modebuf, parabuf);
}

parv[0] = sptr->name;
parv[1] = chptr->chname;
(void)do_cmd(cptr, sptr, "NAMES", 2, parv);

RunHook4(HOOKTYPE_LOCAL_JOIN, cptr, sptr,chptr,parv);
} else {
RunHook4(HOOKTYPE_REMOTE_JOIN, cptr, sptr, chptr, parv); /* (rarely used) */
Expand Down

0 comments on commit f1426e0

Please sign in to comment.