summaryrefslogtreecommitdiff
path: root/src/channels.c
diff options
context:
space:
mode:
authorrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-12 22:34:17 +0000
committerrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-12 22:34:17 +0000
commitb75fadf73d7c6d1126a0226c7598d9ac9a070f44 (patch)
treeca9a6b05e630c6537e725f85f0eb46aaec72d382 /src/channels.c
parentb0535c77602f81cf85858585c9b9863ee9eeadc4 (diff)
Correctly lower TS (if the ircd provided it) on reciept of JOIN messages. This fixes dropped mode changes coming from services on TS6 (and TS6-alike) ircds for channels where TS is dropped elsewhere on the network.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2028 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/channels.c')
-rw-r--r--src/channels.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/channels.c b/src/channels.c
index ee8985c33..85f17785e 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1814,6 +1814,32 @@ Channel *join_user_update(User * user, Channel * chan, const char *name,
/* If it's a new channel, so we need to create it first. */
if (!chan)
chan = chan_create(name, chants);
+ else
+ {
+ // Check chants against 0, as not every ircd sends JOIN with a TS.
+ if (chan->creation_time > chants && chants != 0)
+ {
+ struct c_userlist *cu;
+ const char *modes[6];
+
+ chan->creation_time = chants;
+ for (cu = chan->users; cu; cu = cu->next)
+ {
+ /* XXX */
+ modes[0] = "-ov";
+ modes[1] = cu->user->nick;
+ modes[2] = cu->user->nick;
+ chan_set_modes(s_OperServ, chan, 3, modes, 2);
+ }
+ if (chan->ci && chan->ci->bi)
+ {
+ /* This is ugly, but it always works */
+ ircdproto->SendPart(chan->ci->bi, chan->name, "TS reop");
+ bot_join(chan->ci);
+ }
+ /* XXX simple modes and bans */
+ }
+ }
if (debug)
alog("debug: %s joins %s", user->nick, chan->name);