summaryrefslogtreecommitdiff
path: root/src/protocol/inspircd20.c
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-07-26 12:35:55 -0400
committerAdam <Adam@anope.org>2013-07-26 12:35:55 -0400
commitf7b1b1907c6ad0540e320733175eb5db7e97a3d3 (patch)
tree070f44188ebb8eb6b6873f2e9c6e6180553c1038 /src/protocol/inspircd20.c
parenta563c8fb2f3b92de6b3f7a0417f213036f7000e6 (diff)
Properly jupe servers on inspircd by using RSQUIT, waiting for the corresponding SQUIT, and then introducing the new server
Diffstat (limited to 'src/protocol/inspircd20.c')
-rw-r--r--src/protocol/inspircd20.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/protocol/inspircd20.c b/src/protocol/inspircd20.c
index 3b773ed54..0630a6600 100644
--- a/src/protocol/inspircd20.c
+++ b/src/protocol/inspircd20.c
@@ -1459,9 +1459,25 @@ int anope_event_topic(char *source, int ac, char **av)
int anope_event_squit(char *source, int ac, char **av)
{
+ Server *s;
+
if (ac != 2)
return MOD_CONT;
- do_squit(source, ac, av);
+
+ s = findserver(servlist, av[0]);
+ if (!s)
+ s = findserver_uid(servlist, av[0]);
+ if (s && (s->flags & SERVER_JUPED))
+ {
+ /* a squit for a juped server is not possible, this is an squit for a
+ * server we have just juped and already internally quit. introduce the
+ * new server now.
+ */
+ inspircd_cmd_server(s->name, s->hops, s->desc, s->suid);
+ }
+ else
+ do_squit(source, ac, av);
+
return MOD_CONT;
}
@@ -2419,15 +2435,23 @@ void inspircd_cmd_jupe(char *jserver, char *who, char *reason)
{
char rbuf[256];
char *sid;
+ boolean found = false;
+ Server *s;
+
+ for (sid = ts6_sid_retrieve(); findserver_uid(servlist, sid); sid = ts6_sid_retrieve());
snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who,
reason ? ": " : "", reason ? reason : "");
if (findserver(servlist, jserver))
- inspircd_cmd_squit(jserver, rbuf);
- for (sid = ts6_sid_retrieve(); findserver_uid(servlist, sid); sid = ts6_sid_retrieve());
- inspircd_cmd_server(jserver, 1, rbuf, sid);
- new_server(me_server, jserver, rbuf, SERVER_JUPED, sid);
+ {
+ send_cmd(TS6SID, "RSQUIT %s :%s", jserver, rbuf);
+ do_squit(who, 1, &jserver);
+ found = true;
+ }
+ s = new_server(me_server, jserver, rbuf, SERVER_JUPED, sid);
+ if (!found)
+ inspircd_cmd_server(s->name, s->hops, s->desc, s->suid);
}
/* GLOBOPS - to handle old WALLOPS */