1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 03:23:13 +02:00

BUILD : 1.7.19 (1322) BUGS : 685 NOTES : Applied a patch by Jilles which should fix SJOIN not always sending the correct TS

git-svn-id: svn://svn.anope.org/anope/trunk@1322 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1040 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b
2007-12-28 19:12:02 +00:00
parent f8f64944c2
commit 4a5cf6e1e3
17 changed files with 80 additions and 67 deletions
+3
View File
@@ -64,6 +64,9 @@ Provided by Trystan <trystan@nomadirc.net> - 2007
Provided by nenolod <nenolod@nenolod.net> - 2007
08/29 F TS6 UID generation for Charybdis. [#731]
Provided by Jilles Tjoelker <jilles+anope@stack.nl> - 2007
12/28 F Wrong TS sometimes sent in SJOIN. [#685]
Anope Version 1.7.19
--------------------
01/01 A Support for InspIRCd 1.1. [ #00]
+3 -3
View File
@@ -97,8 +97,8 @@ E void set_limit(Channel * chan, char *value);
E void del_invite(Channel * chan, char *mask);
E char *get_key(Channel * chan);
E char *get_limit(Channel * chan);
E Channel *chan_create(char *chan);
E Channel *join_user_update(User * user, Channel * chan, char *name);
E Channel *chan_create(char *chan, time_t ts);
E Channel *join_user_update(User * user, Channel * chan, char *name, time_t chants);
E void add_exception(Channel * chan, char *mask);
E void del_exception(Channel * chan, char *mask);
@@ -174,7 +174,7 @@ E int check_should_voice(User * user, char *chan);
E int check_should_halfop(User * user, char *chan);
E int check_should_owner(User * user, char *chan);
E int check_should_protect(User * user, char *chan);
E int check_kick(User * user, char *chan);
E int check_kick(User * user, char *chan, time_t chants);
E void record_topic(const char *chan);
E void restore_topic(char *chan);
E int check_topiclock(Channel * c, time_t topic_time);
+49 -38
View File
@@ -575,11 +575,13 @@ void do_join(const char *source, int ac, char **av)
/* Make sure check_kick comes before chan_adduser, so banned users
* don't get to see things like channel keys. */
if (check_kick(user, s))
/* If channel already exists, check_kick() will use correct TS.
* Otherwise, we lose. */
if (check_kick(user, s, time(NULL)))
continue;
chan = findchan(s);
chan = join_user_update(user, chan, s);
chan = join_user_update(user, chan, s, time(NULL));
chan_set_correct_modes(user, chan, 1);
send_event(EVENT_JOIN_CHANNEL, 3, EVENT_STOP, source, s);
@@ -756,11 +758,13 @@ void do_sjoin(const char *source, int ac, char **av)
void do_sjoin(const char *source, int ac, char **av)
{
Channel *c;
User *user;
Server *serv;
struct c_userlist *cu;
char *s = NULL;
char *end, cubuf[7], *end2, *cumodes[6];
int is_sqlined = 0;
int ts = 0;
int is_created = 0;
int keep_their_modes = 1;
@@ -769,10 +773,32 @@ void do_sjoin(const char *source, int ac, char **av)
if (ircd->sjb64) {
ts = base64dects(av[0]);
} else {
ts = strtoul(av[0], NULL, 10);
}
c = findchan(av[1]);
if (c != NULL) {
if (c->creation_time == 0 || ts == 0)
c->creation_time = 0;
else if (c->creation_time > ts) {
c->creation_time = ts;
for (cu = c->users; cu; cu = cu->next) {
/* XXX */
cumodes[0] = "-ov";
cumodes[1] = user->nick;
cumodes[2] = user->nick;
chan_set_modes(source, c, 3, cumodes, 2);
}
if (c->ci && c->ci->bi) {
/* This is ugly, but it always works */
anope_cmd_part(c->ci->bi->nick, c->name, "TS reop");
bot_join(c->ci);
}
/* XXX simple modes and bans */
} else if (c->creation_time < ts)
keep_their_modes = 0;
} else
is_created = 1;
/* Double check to avoid unknown modes that need parameters */
/* Double check to avoid unknown modes that need parameters */
if (ac >= 4) {
if (ircd->chansqline) {
@@ -793,7 +819,7 @@ void do_sjoin(const char *source, int ac, char **av)
end2 = cubuf + 1;
if (ircd->sjoinbanchar) {
if (*s == ircd->sjoinbanchar && keep_their_modes) {
add_ban(c, myStrGetToken(s, ircd->sjoinbanchar, 1));
@@ -802,7 +828,7 @@ void do_sjoin(const char *source, int ac, char **av)
s = end + 1;
continue;
}
}
}
if (ircd->sjoinexchar) {
if (*s == ircd->sjoinexchar && keep_their_modes) {
add_exception(c,
@@ -813,7 +839,7 @@ void do_sjoin(const char *source, int ac, char **av)
continue;
}
}
if (ircd->sjoininvchar) {
if (*s == ircd->sjoininvchar && keep_their_modes) {
add_invite(c, myStrGetToken(s, ircd->sjoininvchar, 1));
@@ -846,7 +872,7 @@ void do_sjoin(const char *source, int ac, char **av)
}
if (is_sqlined && !is_oper(user)) {
anope_cmd_kick(s_OperServ, av[1], s, "Q-Lined");
anope_cmd_kick(s_OperServ, av[1], s, "Q-Lined");
} else {
if (!check_kick(user, av[1], ts)) {
send_event(EVENT_JOIN_CHANNEL, 3, EVENT_START,
@@ -856,10 +882,10 @@ void do_sjoin(const char *source, int ac, char **av)
* will be created there. This ensures that the channel
* is not created to be immediately destroyed, and
* that the locked key or topic is not shown to anyone
* who joins the channel when empty.
* who joins the channel when empty.
*/
c = join_user_update(user, c, av[1], ts);
/* We update user mode on the channel */
if (end2 - cubuf > 1 && keep_their_modes) {
int i;
@@ -883,16 +909,13 @@ void do_sjoin(const char *source, int ac, char **av)
if (!end)
break;
s = end + 1;
}
if (c) {
}
if (c && keep_their_modes) {
/* We now update the channel mode. */
chan_set_modes(source, c, ac - 3, &av[2], 2);
}
/* Unreal just had to be different */
/* Unreal just had to be different */
} else if (ac == 3 && !ircd->ts6) {
if (ircd->chansqline) {
@@ -934,7 +957,7 @@ void do_sjoin(const char *source, int ac, char **av)
}
if (is_sqlined && !is_oper(user)) {
anope_cmd_kick(s_OperServ, av[1], s, "Q-Lined");
anope_cmd_kick(s_OperServ, av[1], s, "Q-Lined");
} else {
if (!check_kick(user, av[1], ts)) {
send_event(EVENT_JOIN_CHANNEL, 3, EVENT_START,
@@ -944,10 +967,10 @@ void do_sjoin(const char *source, int ac, char **av)
* will be created there. This ensures that the channel
* is not created to be immediately destroyed, and
* that the locked key or topic is not shown to anyone
* who joins the channel when empty.
* who joins the channel when empty.
*/
c = join_user_update(user, c, av[1], ts);
/* We update user mode on the channel */
if (end2 - cubuf > 1 && keep_their_modes) {
int i;
@@ -967,12 +990,7 @@ void do_sjoin(const char *source, int ac, char **av)
if (!end)
break;
s = end + 1;
}
if (c) {
s = end + 1;
}
}
} else if (ac == 3 && ircd->ts6) {
if (ircd->chansqline) {
@@ -1014,7 +1032,7 @@ void do_sjoin(const char *source, int ac, char **av)
}
if (is_sqlined && !is_oper(user)) {
anope_cmd_kick(s_OperServ, av[1], s, "Q-Lined");
anope_cmd_kick(s_OperServ, av[1], s, "Q-Lined");
} else {
if (!check_kick(user, av[1], ts)) {
send_event(EVENT_JOIN_CHANNEL, 3, EVENT_START,
@@ -1024,10 +1042,10 @@ void do_sjoin(const char *source, int ac, char **av)
* will be created there. This ensures that the channel
* is not created to be immediately destroyed, and
* that the locked key or topic is not shown to anyone
* who joins the channel when empty.
* who joins the channel when empty.
*/
c = join_user_update(user, c, av[1], ts);
/* We update user mode on the channel */
if (end2 - cubuf > 1 && keep_their_modes) {
int i;
@@ -1047,10 +1065,6 @@ void do_sjoin(const char *source, int ac, char **av)
if (!end)
break;
s = end + 1;
}
if (c) {
s = end + 1;
}
free(s);
@@ -1068,12 +1082,9 @@ void do_sjoin(const char *source, int ac, char **av)
av[1]);
}
return;
}
}
if (check_kick(user, av[1], ts))
return;
c = findchan(av[1]);
return;
if (ircd->chansqline) {
@@ -1085,8 +1096,7 @@ void do_sjoin(const char *source, int ac, char **av)
anope_cmd_kick(s_OperServ, av[1], user->nick, "Q-Lined");
} else {
send_event(EVENT_JOIN_CHANNEL, 3, EVENT_START, user->nick,
av[1]);
av[1]);
c = join_user_update(user, c, av[1], ts);
if (is_created && c->ci)
@@ -1559,7 +1569,7 @@ void chan_adduser2(User * user, Channel * c)
/* This creates the channel structure (was originally in
chan_adduser, but splitted to make it more efficient to use for
SJOINs). */
SJOINs). */
Channel *chan_create(char *chan, time_t ts)
{
@@ -1574,7 +1584,7 @@ Channel *chan_create(char *chan)
list = &chanlist[HASH(c->name)];
c->next = *list;
if (*list)
(*list)->prev = c;
(*list)->prev = c;
*list = c;
c->creation_time = ts;
/* Store ChannelInfo pointer in channel record */
@@ -1798,13 +1808,14 @@ char *get_redirect(Channel * chan)
return chan->redirect;
}
/*************************************************************************/
/*************************************************************************/
Channel *join_user_update(User * user, Channel * chan, char *name,
time_t chants)
{
struct u_chanlist *c;
/* If it's a new channel, so we need to create it first. */
/* If it's a new channel, so we need to create it first. */
if (!chan)
chan = chan_create(name, chants);
+5 -6
View File
@@ -1466,10 +1466,10 @@ static void timeout_leave(Timeout * to)
* else, kickban the user with an appropriate message (could be either
* AKICK or restricted access) and return 1. Note that this is called
* _before_ the user is added to internal channel lists (so do_kick() is
* not called).
* not called). The channel TS must be given for a new channel.
*/
int check_kick(User * user, char *chan)
int check_kick(User * user, char *chan, time_t chants)
{
ChannelInfo *ci = cs_findchan(chan);
Channel *c;
@@ -1563,8 +1563,7 @@ int check_kick(User * user, char *chan)
* c may be NULL even if it exists */
if ((!(c = findchan(chan)) || c->usercount == 0)
&& !(ci->flags & CI_INHABIT)) {
anope_cmd_join(s_ChanServ, chan,
(c ? c->creation_time : time(NULL)));
anope_cmd_join(s_ChanServ, chan, (c ? c->creation_time : chants));
t = add_timeout(CSInhabit, timeout_leave, 0);
t->data = sstrdup(chan);
ci->flags |= CI_INHABIT;
@@ -1646,7 +1645,7 @@ void restore_topic(char *chan)
}
if (ircd->join2set) {
if (whosends(ci) == s_ChanServ) {
anope_cmd_join(s_ChanServ, chan, time(NULL));
anope_cmd_join(s_ChanServ, chan, c->creation_time);
anope_cmd_mode(NULL, chan, "+o %s", s_ChanServ);
}
}
@@ -1708,7 +1707,7 @@ int check_topiclock(Channel * c, time_t topic_time)
if (ircd->join2set) {
if (whosends(ci) == s_ChanServ) {
anope_cmd_join(s_ChanServ, c->name, time(NULL));
anope_cmd_join(s_ChanServ, c->name, c->creation_time);
anope_cmd_mode(NULL, c->name, "+o %s", s_ChanServ);
}
}
+2 -2
View File
@@ -284,7 +284,7 @@ int do_akick(User * u)
cu = c->users;
while (cu) {
next = cu->next;
if (check_kick(cu->user, c->name)) {
if (check_kick(cu->user, c->name, c->creation_time)) {
argv[0] = sstrdup(c->name);
argv[1] = sstrdup(cu->user->nick);
if (akick->reason)
@@ -553,7 +553,7 @@ int do_akick(User * u)
while (cu) {
next = cu->next;
if (check_kick(cu->user, c->name)) {
if (check_kick(cu->user, c->name, c->creation_time)) {
argv[0] = sstrdup(c->name);
argv[1] = sstrdup(cu->user->nick);
argv[2] = sstrdup(CSAutokickReason);
+1 -1
View File
@@ -103,7 +103,7 @@ int do_cs_topic(User * u)
s_ChanServ, u->nick, u->username, u->host, c->name);
if (ircd->join2set) {
if (whosends(ci) == s_ChanServ) {
anope_cmd_join(s_ChanServ, c->name, time(NULL));
anope_cmd_join(s_ChanServ, c->name, c->creation_time);
anope_cmd_mode(NULL, c->name, "+o %s", s_ChanServ);
}
}
+3 -1
View File
@@ -97,6 +97,7 @@ int do_set(User * u)
char *option = strtok(NULL, " ");
char *setting = strtok(NULL, " ");
int index;
Channel *c;
if (!option) {
syntax_error(s_OperServ, u, "SET", OPER_SET_SYNTAX);
@@ -185,7 +186,8 @@ int do_set(User * u)
*/
if (LogChannel && (stricmp(setting, "on") == 0)) {
if (ircd->join2msg) {
anope_cmd_join(s_GlobalNoticer, LogChannel, time(NULL));
c = findchan(LogChannel);
anope_cmd_join(s_GlobalNoticer, LogChannel, c ? c->creation_time : time(NULL));
}
logchan = 1;
alog("Now sending log messages to %s", LogChannel);
+1
View File
@@ -761,6 +761,7 @@ int init_secondary(int ac, char **av)
/* And hybrid needs Global joined in the logchan */
if (logchan && ircd->join2msg) {
/* XXX might desync */
anope_cmd_join(s_GlobalNoticer, LogChannel, time(NULL));
}
+1 -1
View File
@@ -147,7 +147,7 @@ int my_cs_appendtopic(User * u)
s_ChanServ, u->nick, u->username, u->host, c->name);
if (ircd->join2set) {
if (whosends(ci) == s_ChanServ) {
anope_cmd_join(s_ChanServ, c->name, time(NULL));
anope_cmd_join(s_ChanServ, c->name, c->creation_time);
anope_cmd_mode(NULL, c->name, "+o %s", s_ChanServ);
}
}
+1 -8
View File
@@ -907,16 +907,9 @@ void charybdis_cmd_unsqline(char *user)
void charybdis_cmd_join(char *user, char *channel, time_t chantime)
{
Uid *ud;
time_t tstosend;
/* Working around anope's TS brokenness, also making sure
* to *never* send an SJOIN with TS zero -- jilles */
if (chantime == 0 || chantime == time(NULL))
tstosend = 0x7FFFFFFF;
else
tstosend = chantime;
ud = find_uid(user);
send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) tstosend,
send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime,
channel, (UseTS6 ? (ud ? ud->uid : user) : user));
}
+1 -1
View File
@@ -714,7 +714,7 @@ void hybrid_cmd_unsqline(char *user)
void hybrid_cmd_join(char *user, char *channel, time_t chantime)
{
send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) time(NULL), channel,
send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime, channel,
user);
}
+1 -1
View File
@@ -866,7 +866,7 @@ plexus_cmd_unsqline (char *user)
void
plexus_cmd_join (char *user, char *channel, time_t chantime)
{
send_cmd (ServerName, "SJOIN %ld %s + :%s", (long int) time (NULL), channel,
send_cmd (ServerName, "SJOIN %ld %s + :%s", (long int) chantime, channel,
user);
}
+1 -1
View File
@@ -843,7 +843,7 @@ plexus_cmd_unsqline (char *user)
void
plexus_cmd_join (char *user, char *channel, time_t chantime)
{
send_cmd (ServerName, "SJOIN %ld %s + :%s", (long int) time (NULL), channel,
send_cmd (ServerName, "SJOIN %ld %s + :%s", (long int) chantime, channel,
user);
}
+1 -1
View File
@@ -723,7 +723,7 @@ void ptlink_cmd_unsqline(char *user)
void ptlink_cmd_join(char *user, char *channel, time_t chantime)
{
send_cmd(ServerName, "SJOIN %ld %s + :%s", (long int) time(NULL),
send_cmd(ServerName, "SJOIN %ld %s + :%s", (long int) chantime,
channel, user);
}
+1 -1
View File
@@ -854,7 +854,7 @@ void ratbox_cmd_join(char *user, char *channel, time_t chantime)
Uid *ud;
ud = find_uid(user);
send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) time(NULL),
send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime,
channel, (UseTS6 ? (ud ? ud->uid : user) : user));
}
+1 -1
View File
@@ -888,7 +888,7 @@ void shadowircd_cmd_join(char *user, char *channel, time_t chantime)
Uid *ud;
ud = find_uid(user);
send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) time(NULL),
send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime,
channel, (ud ? ud->uid : user));
}
+5 -1
View File
@@ -9,10 +9,14 @@ VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="19"
VERSION_EXTRA="-svn"
VERSION_BUILD="1321"
VERSION_BUILD="1322"
# $Log$
#
# BUILD : 1.7.19 (1322)
# BUGS : 685
# NOTES : Applied a patch by Jilles which should fix SJOIN not always sending the correct TS
#
# BUILD : 1.7.19 (1321)
# BUGS : 810
# NOTES : Fixed outdated module error strings in ModuleGetErrStr