* note: it is guaranteed that parv[0]..parv[parc-1] are all
* non-NULL pointers.
*/
-#if 0
-/*
- * No need to include handlers.h here the signatures must match
- * and we don't need to force a rebuild of all the handlers everytime
- * we add a new one to the list. --Bleep
- */
-#include "handlers.h"
-#endif /* 0 */
+#include "config.h"
+
#include "channel.h"
#include "client.h"
#include "gline.h"
#include "hash.h"
#include "ircd.h"
#include "ircd_chattr.h"
+#include "ircd_features.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
struct Channel *chptr;
struct JoinBuf join;
struct JoinBuf create;
-#ifdef BADCHAN
struct Gline *gline;
-#endif
unsigned int flags = 0;
int i;
char *p = 0;
continue;
}
-#ifdef BADCHAN
/* BADCHANed channel */
if ((gline = gline_find(name, GLINE_BADCHAN | GLINE_EXACT)) &&
GlineIsActive(gline) && !IsAnOper(sptr)) {
send_reply(sptr, ERR_BANNEDFROMCHAN, name);
continue;
}
-#endif
if ((chptr = FindChannel(name))) {
if (find_member_link(chptr, sptr))
} else
flags = IsModelessChannel(name) ? CHFL_DEOPPED : CHFL_CHANOP;
- if (cli_user(sptr)->joined >= MAXCHANNELSPERUSER
-#ifdef OPER_NO_CHAN_LIMIT
- /* Opers are allowed to join any number of channels */
- && !IsAnOper(sptr)
-#endif
- ) {
+ if (cli_user(sptr)->joined >= feature_int(FEAT_MAXCHANNELSPERUSER) &&
+ !HasPriv(sptr, PRIV_CHAN_LIMIT)) {
send_reply(sptr, ERR_TOOMANYCHANNELS, chptr ? chptr->chname : name);
break; /* no point processing the other channels */
}
if (check_target_limit(sptr, chptr, chptr->chname, 0))
continue; /* exceeded target limit */
else if ((i = can_join(sptr, chptr, keys))) {
-#ifdef OPER_WALK_THROUGH_LMODES
if (i > MAGIC_OPER_OVERRIDE) { /* oper overrode mode */
switch (i - MAGIC_OPER_OVERRIDE) {
case ERR_CHANNELISFULL: /* figure out which mode */
send_reply(sptr, i, chptr->chname);
continue;
}
-#else
- send_reply(sptr, i, chptr->chname);
- continue;
-#endif
- } /* else if ((i = can_join(sptr, chptr, keys))) { */
+ } /* else if ((i = can_join(sptr, chptr, keys))) */
joinbuf_join(&join, chptr, flags);
} else if (!(chptr = get_channel(sptr, name, CGT_CREATE)))
continue; /* couldn't get channel */
else if (check_target_limit(sptr, chptr, chptr->chname, 1)) {
/* Note: check_target_limit will only ever return 0 here */
- sub1_from_channel(chptr); /* created it... */
+ chptr->members = 0;
+ destruct_channel(chptr); /* created it... */
continue;
} else
joinbuf_join(&create, chptr, flags);
if (join0(&join, cptr, sptr, name)) /* did client do a JOIN 0? */
continue;
- if (IsLocalChannel(name) || !IsChannelName(name))
+ if (IsLocalChannel(name) || !IsChannelName(name)) {
+ protocol_violation(sptr,"%s tried to join %s",cli_name(cptr),name);
continue;
+ }
- if ((chptr = FindChannel(name))) {
+ if (!(chptr = FindChannel(name))) {
+ /* No channel exists, so create one */
+ if (!(chptr = get_channel(sptr, name, CGT_CREATE))) {
+ protocol_violation(sptr,"couldn't get channel %s for %s",
+ name,cli_name(sptr));
+ continue;
+ }
+ flags = CHFL_DEOPPED | ((cli_flags(sptr) & FLAGS_TS8) ? CHFL_SERVOPOK : 0);
+
+ /* when the network is 2.10.11+ then remove MAGIC_REMOTE_JOIN_TS */
+ chptr->creationtime = creation ? creation : MAGIC_REMOTE_JOIN_TS;
+ }
+ else { /* We have a valid channel? */
if ((member = find_member_link(chptr, sptr))) {
if (!IsZombie(member)) /* already on channel */
continue;
chptr = FindChannel(name);
} else
flags = CHFL_DEOPPED | ((cli_flags(sptr) & FLAGS_TS8) ? CHFL_SERVOPOK : 0);
- } else {
- flags = CHFL_DEOPPED | ((cli_flags(sptr) & FLAGS_TS8) ? CHFL_SERVOPOK : 0);
-
- if ((chptr = get_channel(sptr, name, CGT_CREATE)))
- chptr->creationtime = creation ? creation : MAGIC_REMOTE_JOIN_TS;
- else
- continue; /* couldn't get channel */
- }
+ }
joinbuf_join(&join, chptr, flags);
}