summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-12 22:15:58 +0000
committerrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-12 22:15:58 +0000
commit60c88393a01470375ad978c3323f1f8e2b52e7ad (patch)
tree8e08aa743a9390097ed6c612a0b894c9bca71a0e
parent07892e8b4b0df3cd8a14c9c3cd60f7e1df48deb3 (diff)
Backport: 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/stable@2024 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--src/channels.c65
1 files changed, 46 insertions, 19 deletions
diff --git a/src/channels.c b/src/channels.c
index bb23d45a7..c77ac6e22 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1808,25 +1808,52 @@ char *get_redirect(Channel * chan)
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 (!chan)
- chan = chan_create(name, chants);
-
- if (debug)
- alog("debug: %s joins %s", user->nick, chan->name);
-
- c = scalloc(sizeof(*c), 1);
- c->next = user->chans;
- if (user->chans)
- user->chans->prev = c;
- user->chans = c;
- c->chan = chan;
-
- chan_adduser2(user, chan);
-
- return chan;
+ struct u_chanlist *c;
+
+ /* 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);
+
+ c = scalloc(sizeof(*c), 1);
+ c->next = user->chans;
+ if (user->chans)
+ user->chans->prev = c;
+ user->chans = c;
+ c->chan = chan;
+
+ chan_adduser2(user, chan);
+
+ return chan;
}
/*************************************************************************/