}
}
+void
+irc_rpong(const char *from1, const char *from2, const char *pingtime, const char *clientinfo)
+{
+ putsock("%s " P10_RPONG " %s %s %s :%s", self->numeric, from1, from2, pingtime, clientinfo);
+}
+
void
irc_ping(const char *payload)
{
irc_mark(struct userNode *user, char *mark)
{
char *host = user->hostname;
+
+ /* TODO: Allow mark overwrite. If they are marked, and their fakehost is oldmark.hostname, update it to newmark.hostname so mark can be called multiple times. Probably requires ircd modification also */
+ if(user->mark)
+ return;
+
/* if the mark will put us over the host length, clip some off the left hand side
* to make room...
*/
host += 1 + ( (strlen(host) + 1 + strlen(mark)) - HOSTLEN );
putsock("%s " CMD_MARK " %s DNSBL +m %s.%s", self->numeric, user->nick, mark, host);
putsock("%s " CMD_MARK " %s DNSBL_DATA %s", self->numeric, user->nick, mark);
+
+ /* Save it in the user */
+ user->mark = strdup(mark);
+
/* If they are not otherwise marked, mark their host with fakehost */
if(!IsFakeHost(user) && !IsSetHost(user) && !(IsHiddenHost(user) && user->handle_info) )
{
return 1;
}
+static CMD_FUNC(cmd_rping)
+{
+ struct server *dest;
+
+ if (!(dest = GetServerN(argv[1])))
+ return 0;
+
+ if (dest == self)
+ irc_rpong(argv[2], argv[3], argv[4], argv[5]);
+
+ return 1;
+}
+
static CMD_FUNC(cmd_ping)
{
struct server *srv;
}
else if(!strcasecmp(argv[2], "DNSBL_DATA")) {
/* DNSBL_DATA name */
+ target->mark = strdup(argv[3]);
return 1;
}
if (argc < 3)
return 0;
- user = GetUserH(argv[1]);
+ user = GetUserN(argv[1]);
if (!user)
return 0;
parse_foreach(argv[2], part_helper, NULL, NULL, NULL, user);
dict_insert(irc_func_dict, CMD_ADMIN, cmd_admin);
dict_insert(irc_func_dict, TOK_ADMIN, cmd_admin);
+ dict_insert(irc_func_dict, CMD_RPING, cmd_rping);
+ dict_insert(irc_func_dict, TOK_RPING, cmd_rping);
+ dict_insert(irc_func_dict, CMD_RPONG, cmd_dummy);
+ dict_insert(irc_func_dict, TOK_RPONG, cmd_dummy);
+
/* In P10, DESTRUCT doesn't do anything except be broadcast to servers.
* Apparently to obliterate channels from any servers that think they
* exist?
user->version_reply = NULL;
}
+ /* clean up mark */
+ if(user->mark) {
+ free(user->mark);
+ user->mark = NULL;
+ }
+
/* clean up geoip data if any */
if(user->country_code) free(user->country_code);
if(user->city) free(user->city);