return (HUNTED_PASS);
}
+int hunt_server_cmd(struct Client *from, const char *cmd, const char *tok,
+ struct Client *one, int MustBeOper, const char *pattern,
+ int server, int parc, char *parv[])
+{
+ struct Client *acptr;
+ char *to;
+
+ /* Assume it's me, if no server or an unregistered client */
+ if (parc <= server || EmptyString((to = parv[server])) || IsUnknown(from))
+ return (HUNTED_ISME);
+
+ /* Make sure it's a server */
+ if (MyUser(from)) {
+ /* Make sure it's a server */
+ if (!strchr(to, '*')) {
+ if (0 == (acptr = FindClient(to)))
+ return HUNTED_NOSUCH;
+
+ if (acptr->user)
+ acptr = acptr->user->server;
+ } else if (!(acptr = find_match_server(to))) {
+ send_reply(from, ERR_NOSUCHSERVER, to);
+ return (HUNTED_NOSUCH);
+ }
+ } else if (!(acptr = FindNServer(to)))
+ return (HUNTED_NOSUCH); /* Server broke off in the meantime */
+
+ if (IsMe(acptr))
+ return (HUNTED_ISME);
+
+ if (MustBeOper && !IsPrivileged(from)) {
+ send_reply(from, ERR_NOPRIVILEGES);
+ return HUNTED_NOSUCH;
+ }
+
+ assert(!IsServer(from));
+
+ parv[server] = (char *) acptr; /* HACK! HACK! HACK! ARGH! */
+
+ sendcmdto_one(from, cmd, tok, acptr, pattern, parv[1], parv[2], parv[3],
+ parv[4], parv[5], parv[6], parv[7], parv[8]);
+
+ return (HUNTED_PASS);
+}
+
/*
* 'do_nick_name' ensures that the given parameter (nick) is really a proper
* string for a nickname (note, the 'nick' may be modified in the process...)
strcmp(sptr->username, username) != 0))
{
ServerStats->is_ref++;
- /* XXX sendto_one used with ERR_INVALIDUSERNAME--explanations */
- sendto_one(cptr, ":%s %d %s :Your username is invalid.",
- me.name, ERR_INVALIDUSERNAME, cptr->name);
- sendto_one(cptr,
- ":%s %d %s :Connect with your real username, in lowercase.",
- me.name, ERR_INVALIDUSERNAME, cptr->name);
- sendto_one(cptr, ":%s %d %s :If your mail address were foo@bar.com, "
- "your username would be foo.",
- me.name, ERR_INVALIDUSERNAME, cptr->name);
+
+ send_reply(cptr, SND_EXPLICIT | ERR_INVALIDUSERNAME,
+ ":Your username is invalid.");
+ send_reply(cptr, SND_EXPLICIT | ERR_INVALIDUSERNAME,
+ ":Connect with your real username, in lowercase.");
+ send_reply(cptr, SND_EXPLICIT | ERR_INVALIDUSERNAME,
+ ":If your mail address were foo@bar.com, your username "
+ "would be foo.");
return exit_client(cptr, sptr, &me, "USER: Bad username");
}
Count_unknownbecomesclient(sptr, UserStats);
nextping = CurrentTime;
if (sptr->snomask & SNO_NOISY)
set_snomask(sptr, sptr->snomask & SNO_NOISY, SNO_ADD);
-#ifdef ALLOW_SNO_CONNEXIT
-#ifdef SNO_CONNEXIT_IP
- sendto_opmask_butone(0, SNO_CONNEXIT, "Client connecting: %s (%s@%s) "
- "[%s] {%d}", nick, user->username, user->host,
- cptr->sock_ip, get_client_class(sptr));
-#else /* SNO_CONNEXIT_IP */
- sendto_opmask_butone(0, SNO_CONEXIT, "Client connecting: %s (%s@%s)",
- nick, user->username, user->host);
-#endif /* SNO_CONNEXIT_IP */
-#endif /* ALLOW_SNO_CONNEXIT */
IPcheck_connect_succeeded(sptr);
}
else
do {
sptr->cookie = (ircrandom() & 0x7fffffff);
} while (!sptr->cookie);
- /* XXX sendto_one used to send PING--must be very careful! */
- sendto_one(cptr, "PING :%u", sptr->cookie);
+ sendrawto_one(cptr, MSG_PING " :%u", sptr->cookie);
}
else if (*sptr->user->host && sptr->cookie == COOKIE_VERIFIED) {
/*
else {
#ifdef GODMODE
/* XXX Let's get rid of GODMODE */
- sendto_one(sptr, ":%s NOTICE %s :New target: %s; ft " TIME_T_FMT,
+ sendto_one(sptr, ":%s NOTICE %s :New target: %s; ft " TIME_T_FMT, /* XXX Possibly DEAD */
me.name, sptr->name, name, (CurrentTime - sptr->nexttarget) / TARGET_DELAY);
#endif
sptr->nexttarget += TARGET_DELAY;