+ snprintf(msg, sizeof(msg), "Got SQUIT from %s",
+ Client_ID(from));
+
+ if (con > NONE) {
+ /* We are directly connected to the target server, so we
+ * have to tear down the connection and to inform all the
+ * other remaining servers in the network */
+ IRC_SendWallops(Client_ThisServer(), Client_ThisServer(),
+ "Received SQUIT %s from %s: %s",
+ Req->argv[0], Client_ID(from),
+ Req->argv[1][0] ? Req->argv[1] : "-");
+ Conn_Close(con, NULL, msg, true);
+ if (con == Client_Conn(Client))
+ return DISCONNECTED;
+ } else {
+ /* This server is not directly connected, so the SQUIT must
+ * be forwarded ... */
+ if (Client_Type(from) != CLIENT_SERVER) {
+ /* The origin is not an IRC server, so don't evaluate
+ * this SQUIT but simply forward it */
+ IRC_WriteStrClientPrefix(Client_NextHop(target),
+ from, "SQUIT %s :%s", Req->argv[0], Req->argv[1]);
+ } else {
+ /* SQUIT has been generated by another server, so
+ * remove the target server from the network! */
+ logmsg[0] = '\0';
+ if (!strchr(msg, '('))
+ snprintf(logmsg, sizeof(logmsg),
+ "%s (SQUIT from %s)", Req->argv[1],
+ Client_ID(from));
+ Client_Destroy(target, logmsg[0] ? logmsg : msg,
+ msg, false);
+ }