- CLIENT *target;
- char msg[LINE_LEN + 64];
-
- assert( Client != NULL );
- assert( Req != NULL );
-
- /* Falsche Anzahl Parameter? */
- if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
-
- Log( LOG_DEBUG, "Got SQUIT from %s for \"%s\": \"%s\" ...", Client_ID( Client ), Req->argv[0], Req->argv[1] );
-
- target = Client_Search( Req->argv[0] );
- if( ! target )
- {
- /* Den Server kennen wir nicht (mehr), also nichts zu tun. */
- Log( LOG_WARNING, "Got SQUIT from %s for unknown server \"%s\"!?", Client_ID( Client ), Req->argv[0] );
+ char msg[COMMAND_LEN], logmsg[COMMAND_LEN];
+ CLIENT *from, *target;
+ CONN_ID con;
+ int loglevel;
+
+ assert(Client != NULL);
+ assert(Req != NULL);
+
+ if (Client_Type(Client) != CLIENT_SERVER
+ && !Client_HasMode(Client, 'o'))
+ return Op_NoPrivileges(Client, Req);
+
+ /* Bad number of arguments? */
+ if (Req->argc != 2)
+ return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ Client_ID(Client), Req->command);
+
+ if (Client_Type(Client) == CLIENT_SERVER && Req->prefix) {
+ from = Client_Search(Req->prefix);
+ if (Client_Type(from) != CLIENT_SERVER
+ && !Op_Check(Client, Req))
+ return Op_NoPrivileges(Client, Req);
+ } else
+ from = Client;
+ if (!from)
+ return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ Client_ID(Client), Req->prefix);
+
+ if (Client_Type(Client) == CLIENT_USER)
+ loglevel = LOG_NOTICE | LOG_snotice;
+ else
+ loglevel = LOG_DEBUG;
+ Log(loglevel, "Got SQUIT from %s for \"%s\": \"%s\" ...",
+ Client_ID(from), Req->argv[0], Req->argv[1]);
+
+ target = Client_Search(Req->argv[0]);
+ if (Client_Type(Client) != CLIENT_SERVER &&
+ target == Client_ThisServer())
+ return Op_NoPrivileges(Client, Req);
+ if (!target) {
+ /* The server is (already) unknown */
+ Log(LOG_WARNING,
+ "Got SQUIT from %s for unknown server \"%s\"!?",
+ Client_ID(Client), Req->argv[0]);