*
* This file is part of x3.
*
- * srvx is free software; you can redistribute it and/or modify
+ * x3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
#include "nickserv.h"
#include "chanserv.h"
+#include "hosthiding.h"
#include "proto-common.c"
/* Full commands. */
#define CMD_SQUIT "SQUIT"
#define CMD_STATS "STATS"
#define CMD_SVSNICK "SVSNICK"
+#define CMD_SWHOIS "SWHOIS"
#define CMD_TIME "TIME"
#define CMD_TOPIC "TOPIC"
#define CMD_TRACE "TRACE"
#define TOK_SQUIT "SQ"
#define TOK_STATS "R"
#define TOK_SVSNICK "SN"
+#define TOK_SWHOIS "SW"
#define TOK_TIME "TI"
#define TOK_TOPIC "T"
#define TOK_TRACE "TR"
#define P10_SQUIT TYPE(SQUIT)
#define P10_STATS TYPE(STATS)
#define P10_SVSNICK TYPE(SVSNICK)
+#define P10_SWHOIS TYPE(SWHOIS)
#define P10_TIME TYPE(TIME)
#define P10_TOPIC TYPE(TOPIC)
#define P10_TRACE TYPE(TRACE)
putsock("%s " P10_INVITE " %s %s", from->numeric, who->nick, to->name);
}
+void
+irc_silence(struct userNode *who, const char *mask, int add)
+{
+ putsock("%s " P10_SILENCE " %s %s%s", self->numeric, who->numeric, add ? "" : "-", mask);
+}
+
void
irc_join(struct userNode *who, struct chanNode *what)
{
putsock("%s " P10_SVSNICK " %s %s "FMT_TIME_T, from->uplink->numeric, target->numeric, newnick, now);
}
+void
+irc_swhois(struct userNode *from, struct userNode *target, const char *message)
+{
+ putsock("%s " P10_SWHOIS " %s %s%s", from->uplink->numeric, target->numeric, message ? ":" : "",
+ message ? message : "");
+
+}
+
void
irc_part(struct userNode *who, struct chanNode *what, const char *reason)
{
void
irc_topic(struct userNode *service, struct userNode *who, struct chanNode *what, const char *topic)
{
-/* UNCOMMENT FOR NEFARIOUS 0.5.0 TOPIC SUPPORT
- * putsock("%s " P10_TOPIC " %s %s " FMT_TIME_T " " FMT_TIME_T " :%s", service->numeric, what->name, who->nick, what->timestamp, now, topic);
- * UNCOMMENT FOR NEFARIOUS 0.5.0 TOPIC SUPPORT */
- who = service; /* REMOVE LINE FOR NEFARIOUS 0.5.0 */
+ int type = 4;
+ const char *str;
+ str = conf_get_data("server/type", RECDB_QSTRING);
+ if(str)
+ type = atoi(str);
+ else
+ type = 4;/* default to 040 style topics */
- putsock("%s " P10_TOPIC " %s :%s", who->numeric, what->name, topic);
+ if (type == 5) {
+ putsock("%s " P10_TOPIC " %s %s " FMT_TIME_T " " FMT_TIME_T " :%s", service->numeric, what->name, who->nick, what->timestamp, now, topic);
+ } else {
+ who = service;
+ putsock("%s " P10_TOPIC " %s :%s", who->numeric, what->name, topic);
+ }
}
void
dict_insert(irc_func_dict, TOK_STATS, cmd_stats);
dict_insert(irc_func_dict, CMD_SVSNICK, cmd_svsnick);
dict_insert(irc_func_dict, TOK_SVSNICK, cmd_svsnick);
+ dict_insert(irc_func_dict, CMD_SWHOIS, cmd_dummy);
+ dict_insert(irc_func_dict, TOK_SWHOIS, cmd_dummy);
dict_insert(irc_func_dict, CMD_WHOIS, cmd_whois);
dict_insert(irc_func_dict, TOK_WHOIS, cmd_whois);
dict_insert(irc_func_dict, CMD_GLINE, cmd_gline);
/* We have reliable clock! Always! Wraaa! */
dict_insert(irc_func_dict, CMD_SETTIME, cmd_dummy);
dict_insert(irc_func_dict, TOK_SETTIME, cmd_dummy);
+
+ /* ignore /trace and /motd commands targetted at us */
+ dict_insert(irc_func_dict, TOK_TRACE, cmd_dummy);
+ dict_insert(irc_func_dict, TOK_MOTD, cmd_dummy);
+
/* handle topics */
dict_insert(irc_func_dict, "331", cmd_num_topic);
dict_insert(irc_func_dict, "332", cmd_num_topic);
safestrncpy(uNode->hostname, hostname, sizeof(uNode->hostname));
safestrncpy(uNode->numeric, numeric, sizeof(uNode->numeric));
irc_p10_pton(&uNode->ip, realip);
+
+ if (irc_in_addr_is_ipv4(uNode->ip)) {
+ make_virtip((char*)irc_ntoa(&uNode->ip), (char*)irc_ntoa(&uNode->ip), uNode->cryptip);
+ make_virthost((char*)irc_ntoa(&uNode->ip), uNode->hostname, uNode->crypthost);
+ } else if (irc_in_addr_is_ipv6(uNode->ip)) {
+ make_ipv6virthost((char*)irc_ntoa(&uNode->ip), uNode->hostname, uNode->crypthost);
+ }
+
uNode->timestamp = timestamp;
modeList_init(&uNode->channels);
uNode->uplink = uplink;