* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
-static int m_join(struct Client *, struct Client *, int, const char **);
-static int ms_join(struct Client *, struct Client *, int, const char **);
-static int ms_sjoin(struct Client *, struct Client *, int, const char **);
+static void m_join(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void ms_join(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void ms_sjoin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
{mg_unreg, {m_join, 2}, {ms_join, 2}, mg_ignore, mg_ignore, {m_join, 2}}
};
struct Message sjoin_msgtab = {
{mg_unreg, {m_join, 2}, {ms_join, 2}, mg_ignore, mg_ignore, {m_join, 2}}
};
struct Message sjoin_msgtab = {
{mg_unreg, mg_ignore, mg_ignore, {ms_sjoin, 4}, mg_ignore, mg_ignore}
};
{mg_unreg, mg_ignore, mg_ignore, {ms_sjoin, 4}, mg_ignore, mg_ignore}
};
mapi_hlist_av1 join_hlist[] = {
{ "can_create_channel", &h_can_create_channel },
{ "channel_join", &h_channel_join },
mapi_hlist_av1 join_hlist[] = {
{ "can_create_channel", &h_can_create_channel },
{ "channel_join", &h_channel_join },
-DECLARE_MODULE_AV1(join, NULL, NULL, join_clist, join_hlist, NULL, "$Revision: 3494 $");
+DECLARE_MODULE_AV2(join, NULL, NULL, join_clist, join_hlist, NULL, NULL, NULL, join_desc);
static void remove_our_modes(struct Channel *chptr, struct Client *source_p);
static void remove_ban_list(struct Channel *chptr, struct Client *source_p,
rb_dlink_list * list, char c, int mems);
static void remove_our_modes(struct Channel *chptr, struct Client *source_p);
static void remove_ban_list(struct Channel *chptr, struct Client *source_p,
rb_dlink_list * list, char c, int mems);
- /* Already on there, show original error message */
+ /* Already on there... but don't send the original reason for
+ * being unable to join. It isn't their fault they're already
+ * on the channel, and it looks hostile otherwise.
+ * --Elizafox
+ */
/* Juped. Sending a warning notice would be unfair */
if (hash_find_resv(chptr->chname))
return NULL;
/* Don't forward to +Q channel */
if (chptr->mode.mode & MODE_DISFORWARD)
return NULL;
/* Juped. Sending a warning notice would be unfair */
if (hash_find_resv(chptr->chname))
return NULL;
/* Don't forward to +Q channel */
if (chptr->mode.mode & MODE_DISFORWARD)
return NULL;
i = can_join(source_p, chptr, key, &next);
if (i == 0)
return chptr;
i = can_join(source_p, chptr, key, &next);
if (i == 0)
return chptr;
-static int
-m_join(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static char jbuf[BUFSIZE];
struct Channel *chptr = NULL, *chptr2 = NULL;
{
static char jbuf[BUFSIZE];
struct Channel *chptr = NULL, *chptr2 = NULL;
/* join 0 parts all channels */
if(*name == '0' && (name[1] == ',' || name[1] == '\0') && name == chanlist)
{
/* join 0 parts all channels */
if(*name == '0' && (name[1] == ',' || name[1] == '\0') && name == chanlist)
{
- /* check it begins with # or &, and local chans are disabled */
- else if(!IsChannelName(name) ||
- ( ConfigChannel.disable_local_channels && name[0] == '&'))
+ /* check it begins with a valid channel prefix per policy. */
+ else if (!IsChannelName(name))
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), name);
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), name);
ConfigChannel.no_join_on_split)
{
sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE),
ConfigChannel.no_join_on_split)
{
sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE),
ConfigChannel.no_create_on_split)
{
sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE),
ConfigChannel.no_create_on_split)
{
sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE),
- if(!(chptr2 = check_forward(source_p, chptr, key, &i)))
+ if((chptr2 = check_forward(source_p, chptr, key, &i)) == NULL)
{
/* might be wrong, but is there any other better location for such?
* see extensions/chm_operonly.c for other comments on this
{
/* might be wrong, but is there any other better location for such?
* see extensions/chm_operonly.c for other comments on this
check_spambot_warning(source_p, name);
/* add the user to the channel */
check_spambot_warning(source_p, name);
/* add the user to the channel */
chptr->mode.mode |= ConfigChannel.autochanmodes;
modes = channel_modes(chptr, &me);
chptr->mode.mode |= ConfigChannel.autochanmodes;
modes = channel_modes(chptr, &me);
- sendto_channel_local(ONLY_CHANOPS, chptr, ":%s MODE %s %s",
+ sendto_channel_local(&me, ONLY_CHANOPS, chptr, ":%s MODE %s %s",
me.name, chptr->chname, modes);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
me.name, chptr->chname, modes);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
sendto_one(source_p, form_str(RPL_TOPICWHOTIME),
me.name, source_p->name, chptr->chname,
chptr->topic_info,
sendto_one(source_p, form_str(RPL_TOPICWHOTIME),
me.name, source_p->name, chptr->chname,
chptr->topic_info,
* parv[3] = "+", formerly channel modes but now unused
* alternatively, a single "0" parameter parts all channels
*/
* parv[3] = "+", formerly channel modes but now unused
* alternatively, a single "0" parameter parts all channels
*/
-static int
-ms_join(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
/* special case for join 0 */
if((parv[1][0] == '0') && (parv[1][1] == '\0') && parc == 2)
{
do_join_0(client_p, source_p);
/* special case for join 0 */
if((parv[1][0] == '0') && (parv[1][1] == '\0') && parc == 2)
{
do_join_0(client_p, source_p);
mbuf = modebuf;
mode.key[0] = mode.forward[0] = '\0';
mode.mode = mode.limit = mode.join_num = mode.join_time = 0;
if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL)
mbuf = modebuf;
mode.key[0] = mode.forward[0] = '\0';
mode.mode = mode.limit = mode.join_num = mode.join_time = 0;
if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL)
-#ifdef IGNORE_BOGUS_TS
- if(newts < 800000000)
- {
- sendto_realops_snomask(SNO_DEBUG, L_ALL,
- "*** Bogus TS %ld on %s ignored from %s",
- (long) newts, chptr->chname, client_p->name);
- newts = (oldts == 0) ? oldts : 800000000;
- }
-#else
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to 0",
me.name, chptr->chname, chptr->chname, (long) oldts);
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Server %s changing TS on %s from %ld to 0",
source_p->name, chptr->chname, (long) oldts);
}
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to 0",
me.name, chptr->chname, chptr->chname, (long) oldts);
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Server %s changing TS on %s from %ld to 0",
source_p->name, chptr->chname, (long) oldts);
}
chptr->channelts = newts;
}
/* Lost the TS, other side wins, so remove modes on this side */
if(!keep_our_modes)
{
chptr->channelts = newts;
}
/* Lost the TS, other side wins, so remove modes on this side */
if(!keep_our_modes)
{
chptr->mode = mode;
remove_our_modes(chptr, source_p);
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head)
chptr->mode = mode;
remove_our_modes(chptr, source_p);
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head)
}
/* If setting -j, clear join throttle state -- jilles */
chptr->join_count = chptr->join_delta = 0;
}
/* If setting -j, clear join throttle state -- jilles */
chptr->join_count = chptr->join_delta = 0;
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to %ld",
me.name, chptr->chname, chptr->chname,
(long) oldts, (long) newts);
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to %ld",
me.name, chptr->chname, chptr->chname,
(long) oldts, (long) newts);
* capitalization timestamped like modes are -- jilles */
strcpy(chptr->chname, parv[2]);
if(*modebuf != '\0')
* capitalization timestamped like modes are -- jilles */
strcpy(chptr->chname, parv[2]);
if(*modebuf != '\0')
- sendto_channel_local(ALL_MEMBERS, chptr,
+ sendto_channel_local(source_p->servptr, ALL_MEMBERS, chptr,
":%s MODE %s %s %s",
source_p->servptr->name,
chptr->chname, modebuf, parabuf);
*modebuf = *parabuf = '\0';
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
":%s MODE %s %s %s",
source_p->servptr->name,
chptr->chname, modebuf, parabuf);
*modebuf = *parabuf = '\0';
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
- set_channel_mlock(client_p, source_p, chptr, NULL, FALSE);
+ set_channel_mlock(client_p, source_p, chptr, NULL, false);
+
+ hook_data_channel hookdata;
+ hookdata.client = source_p;
+ hookdata.chptr = chptr;
+
+ call_hook(h_channel_lowerts, &hookdata);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s JOIN %ld %s +",
source_p->id, (long) chptr->channelts, chptr->chname);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s JOIN %ld %s +",
source_p->id, (long) chptr->channelts, chptr->chname);
-static int
-ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
int i, joinc = 0, timeslice = 0;
static char empty[] = "";
rb_dlink_node *ptr, *next_ptr;
int i, joinc = 0, timeslice = 0;
static char empty[] = "";
rb_dlink_node *ptr, *next_ptr;
modebuf[0] = parabuf[0] = mode.key[0] = mode.forward[0] = '\0';
pargs = mode.mode = mode.limit = mode.join_num = mode.join_time = 0;
modebuf[0] = parabuf[0] = mode.key[0] = mode.forward[0] = '\0';
pargs = mode.mode = mode.limit = mode.join_num = mode.join_time = 0;
break;
case 'j':
sscanf(parv[4 + args], "%d:%d", &joinc, ×lice);
break;
case 'j':
sscanf(parv[4 + args], "%d:%d", &joinc, ×lice);
-#ifdef IGNORE_BOGUS_TS
- if(newts < 800000000)
- {
- sendto_realops_snomask(SNO_DEBUG, L_ALL,
- "*** Bogus TS %ld on %s ignored from %s",
- (long) newts, chptr->chname, client_p->name);
-
- newts = (oldts == 0) ? oldts : 800000000;
- }
-#else
":%s NOTICE %s :*** Notice -- TS for %s "
"changed from %ld to 0",
me.name, chptr->chname, chptr->chname, (long) oldts);
":%s NOTICE %s :*** Notice -- TS for %s "
"changed from %ld to 0",
me.name, chptr->chname, chptr->chname, (long) oldts);
"Server %s changing TS on %s from %ld to 0",
source_p->name, chptr->chname, (long) oldts);
}
"Server %s changing TS on %s from %ld to 0",
source_p->name, chptr->chname, (long) oldts);
}
{
/* Channel was emptied, create a new one */
if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL)
{
/* Channel was emptied, create a new one */
if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL)
if(oldmode->limit > mode.limit)
mode.limit = oldmode->limit;
if(strcmp(mode.key, oldmode->key) < 0)
if(oldmode->limit > mode.limit)
mode.limit = oldmode->limit;
if(strcmp(mode.key, oldmode->key) < 0)
if(oldmode->join_num > mode.join_num ||
(oldmode->join_num == mode.join_num &&
oldmode->join_time > mode.join_time))
if(oldmode->join_num > mode.join_num ||
(oldmode->join_num == mode.join_num &&
oldmode->join_time > mode.join_time))
mode.join_time = oldmode->join_time;
}
if(irccmp(mode.forward, oldmode->forward) < 0)
mode.join_time = oldmode->join_time;
}
if(irccmp(mode.forward, oldmode->forward) < 0)
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to %ld",
me.name, chptr->chname, chptr->chname,
(long) oldts, (long) newts);
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to %ld",
me.name, chptr->chname, chptr->chname,
(long) oldts, (long) newts);
strcpy(chptr->chname, parv[2]);
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
strcpy(chptr->chname, parv[2]);
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
- set_channel_mlock(client_p, source_p, chptr, NULL, FALSE);
+ set_channel_mlock(client_p, source_p, chptr, NULL, false);
- sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s %s %s",
+ sendto_channel_local(fakesource_p, ALL_MEMBERS, chptr, ":%s MODE %s %s %s",
fakesource_p->name, chptr->chname, modebuf, parabuf);
*modebuf = *parabuf = '\0';
fakesource_p->name, chptr->chname, modebuf, parabuf);
*modebuf = *parabuf = '\0';
":%s MODE %s %s %s %s %s %s",
fakesource_p->name, chptr->chname,
modebuf,
":%s MODE %s %s %s %s %s %s",
fakesource_p->name, chptr->chname,
modebuf,
":%s MODE %s %s %s %s %s %s",
fakesource_p->name, chptr->chname, modebuf,
para[0], CheckEmpty(para[1]),
":%s MODE %s %s %s %s %s %s",
fakesource_p->name, chptr->chname, modebuf,
para[0], CheckEmpty(para[1]),
}
sendto_server(client_p->from, NULL, CAP_TS6, NOCAPS, "%s", buf_uid);
}
sendto_server(client_p->from, NULL, CAP_TS6, NOCAPS, "%s", buf_uid);
- sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
+ sendto_channel_local(source_p, ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
remove_user_from_channel(msptr);
}
}
source_p->name,
source_p->username, source_p->host, chptr->chname);
remove_user_from_channel(msptr);
}
}
+ case ERR_USERONCHANNEL:
+ sendto_one_numeric(source_p, ERR_USERONCHANNEL,
+ form_str(ERR_USERONCHANNEL), source_p->name, name);
+ break;
default:
sendto_one_numeric(source_p, numeric,
"%s :Cannot join channel", name);
default:
sendto_one_numeric(source_p, numeric,
"%s :Cannot join channel", name);
":%s MODE %s %s %s %s %s %s",
source_p->name, chptr->chname,
lmodebuf, lpara[0], lpara[1],
":%s MODE %s %s %s %s %s %s",
source_p->name, chptr->chname,
lmodebuf, lpara[0], lpara[1],
":%s MODE %s %s %s %s %s %s",
source_p->name, chptr->chname, lmodebuf,
lpara[0], lpara[1], lpara[2], lpara[3]);
":%s MODE %s %s %s %s %s %s",
source_p->name, chptr->chname, lmodebuf,
lpara[0], lpara[1], lpara[2], lpara[3]);
":%s MODE %s %s %s %s %s %s",
source_p->name, chptr->chname, lmodebuf,
EmptyString(lpara[0]) ? "" : lpara[0],
":%s MODE %s %s %s %s %s %s",
source_p->name, chptr->chname, lmodebuf,
EmptyString(lpara[0]) ? "" : lpara[0],
- sendto_channel_local(mems, chptr, "%s %s", lmodebuf, lparabuf);
+ sendto_channel_local(source_p, mems, chptr, "%s %s", lmodebuf, lparabuf);
- sendto_channel_local(mems, chptr, "%s %s", lmodebuf, lparabuf);
+ sendto_channel_local(source_p, mems, chptr, "%s %s", lmodebuf, lparabuf);