#include "packet.h"
#include "chmode.h"
#include "ratelimit.h"
+#include "s_assert.h"
static int m_join(struct Client *, struct Client *, int, const char **);
static int ms_join(struct Client *, struct Client *, int, const char **);
static void do_join_0(struct Client *client_p, struct Client *source_p);
static int check_channel_name_loc(struct Client *source_p, const char *name);
+static void send_join_error(struct Client *source_p, int numeric, const char *name);
static void set_final_mode(struct Mode *mode, struct Mode *oldmode);
static void remove_our_modes(struct Channel *chptr, struct Client *source_p);
if(moduledata.approved != 0)
{
-#ifdef XXX_NOTYET
- sendto_one(source_p, form_str(moduledata.approved),
- me.name, source_p->name, name);
-#endif
+ if(moduledata.approved != ERR_CUSTOM)
+ send_join_error(source_p,
+ moduledata.approved,
+ name);
continue;
}
* see extensions/chm_operonly.c for other comments on this
* -- dwr
*/
-#ifdef XXX_NOTYET
if(i != ERR_CUSTOM)
- sendto_one(source_p, form_str(i), me.name, source_p->name, name);
-#endif
+ send_join_error(source_p, i, name);
continue;
}
else if(chptr != chptr2)
if(flags & CHFL_CHANOP)
{
chptr->channelts = rb_current_time();
- chptr->mode.mode |= MODE_TOPICLIMIT;
- chptr->mode.mode |= MODE_NOPRIVMSGS;
+ chptr->mode.mode |= ConfigChannel.autochanmodes;
modes = channel_modes(chptr, &me);
sendto_channel_local(ONLY_CHANOPS, chptr, ":%s MODE %s %s",
int fl;
int isnew;
int mlen_uid;
- int len_nick;
int len_uid;
int len;
int joins = 0;
static char empty[] = "";
rb_dlink_node *ptr, *next_ptr;
+ if(parc < 5)
+ return 0;
+
if(!IsChannelName(parv[2]) || !check_channel_name(parv[2]))
return 0;
if(isnew)
chptr->channelts = newts;
-
+
else if(newts == 0 || oldts == 0)
chptr->channelts = 0;
else if(newts == oldts)
mbuf = modebuf;
para[0] = para[1] = para[2] = para[3] = empty;
pargs = 0;
- len_nick = len_uid = 0;
+ len_uid = 0;
/* if theres a space, theres going to be more than one nick, change the
* first space to \0, so s is just the first nick, and point p to the
if(fl & CHFL_CHANOP)
{
*ptr_uid++ = '@';
- len_nick++;
len_uid++;
}
if(fl & CHFL_VOICE)
{
*ptr_uid++ = '+';
- len_nick++;
len_uid++;
}
}
return 1;
}
+/* send_join_error()
+ *
+ * input - client to send to, reason, channel name
+ * output - none
+ * side effects - error message sent to client
+ */
+static void
+send_join_error(struct Client *source_p, int numeric, const char *name)
+{
+ /* This stuff is necessary because the form_str macro only
+ * accepts constants.
+ */
+ switch (numeric)
+ {
+#define NORMAL_NUMERIC(i) \
+ case i: \
+ sendto_one(source_p, form_str(i), \
+ me.name, source_p->name, name); \
+ break
+
+ NORMAL_NUMERIC(ERR_BANNEDFROMCHAN);
+ NORMAL_NUMERIC(ERR_INVITEONLYCHAN);
+ NORMAL_NUMERIC(ERR_BADCHANNELKEY);
+ NORMAL_NUMERIC(ERR_CHANNELISFULL);
+ NORMAL_NUMERIC(ERR_NEEDREGGEDNICK);
+ NORMAL_NUMERIC(ERR_THROTTLE);
+
+ default:
+ sendto_one_numeric(source_p, numeric,
+ "%s :Cannot join channel", name);
+ break;
+ }
+}
+
static void
set_final_mode(struct Mode *mode, struct Mode *oldmode)
{
* remove_our_modes
*
* inputs -
- * output -
- * side effects -
+ * output -
+ * side effects -
*/
static void
remove_our_modes(struct Channel *chptr, struct Client *source_p)