unsigned int value;
memset(ip, 0, 6 * sizeof(ip->in6[0]));
value = base64toint(input, 6);
+ if (value)
+ ip->in6[5] = htons(65535);
ip->in6[6] = htons(value >> 16);
ip->in6[7] = htons(value & 65535);
} else {
static void
irc_p10_ntop(char *output, const irc_in_addr_t *ip)
{
- if (irc_in_addr_is_ipv4(*ip)) {
+ if (!irc_in_addr_is_valid(*ip)) {
+ strcpy(output, "AAAAAA");
+ } else if (irc_in_addr_is_ipv4(*ip)) {
unsigned int in4;
in4 = (ntohs(ip->in6[6]) << 16) | ntohs(ip->in6[7]);
inttobase64(output, in4, 6);
putsock("%s " P10_PONG " %s :%s", self->numeric, who, data);
}
+void
+irc_pong_asll(const char *who, const char *orig_ts)
+{
+ char *delim;
+ struct timeval orig;
+ struct timeval now;
+ int diff;
+
+ orig.tv_sec = strtoul(orig_ts, &delim, 10);
+ orig.tv_usec = (*delim == '.') ? strtoul(delim + 1, NULL, 10) : 0;
+ gettimeofday(&now, NULL);
+ diff = (now.tv_sec - orig.tv_sec) * 1000 + (now.tv_usec - orig.tv_usec) / 1000;
+ putsock("%s " P10_PONG " %s %s %d " FMT_TIME_T ".%06u", self->numeric, who, orig_ts, diff, now.tv_sec, (unsigned)now.tv_usec);
+}
+
void
irc_pass(const char *passwd)
{
struct server *srv;
struct userNode *un;
- if(argc > 3)
- irc_pong(argv[2], argv[1]);
+ if (argc > 3)
+ irc_pong_asll(argv[2], argv[3]);
else if ((srv = GetServerH(origin)))
irc_pong(self->name, srv->numeric);
else if ((un = GetUserH(origin)))
char *oplevel_str;
int oplevel;
+ if (in_arg >= argc)
+ goto error;
oplevel_str = strchr(modes[in_arg], ':');
if (oplevel_str)
{