#include "ioset.h"
#include "log.h"
#include "nickserv.h"
+#include "spamserv.h"
#include "timeq.h"
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
while (!quit_services) {
if (!replay_connected) {
/* this time fudging is to get some of the logging right */
- self->link = self->boot = now;
+ self->link_time = self->boot = now;
cManager.uplink->state = AUTHENTICATING;
irc_introduce(cManager.uplink->password);
replay_connected = 1;
static void
privmsg_chan_helper(struct chanNode *cn, void *data)
{
+ extern unsigned short offchannel_allowed[256];
struct privmsg_desc *pd = data;
struct modeNode *mn;
struct chanmsg_func *cf;
/* Never send a NOTICE to a channel to one of the services */
cf = &chanmsg_funcs[(unsigned char)pd->text[0]];
if (cf->func && !pd->is_notice
- && GetUserMode(cn, cf->service) && !IsDeaf(cf->service))
+ && (offchannel_allowed[(unsigned char)pd->text[0]]
+ || (GetUserMode(cn, cf->service) && !IsDeaf(cf->service))))
cf->func(pd->user, cn, pd->text+1, cf->service, pd->is_notice);
+ else
+ spamserv_channel_message(cn, pd->user, pd->text);
/* This catches *all* text sent to the channel that the services server sees */
for (x = 0; x < ALLCHANMSG_FUNCS_MAX; x++) {
ident = user->ident;
else if (options & GENMASK_ANY_IDENT)
ident = "*";
+ else if (IsFakeIdent(user) && IsHiddenHost(user) && !(options & GENMASK_NO_HIDING))
+ ident = user->fakeident;
else {
ident = alloca(strlen(user->ident)+2);
ident[0] = '*';
sprintf(hostname, "%d.%d.*", user->ip.in6_8[12], user->ip.in6_8[13]);
} else if (irc_in_addr_is_ipv6(user->ip)) {
/* Who knows what the default mask should be? Use a /48 to start with. */
- sprintf(hostname, "%x:%x:%x:*", user->ip.in6[0], user->ip.in6[1], user->ip.in6[2]);
+ sprintf(hostname, "%x:%x:%x:*", ntohs(user->ip.in6[0]), ntohs(user->ip.in6[1]), ntohs(user->ip.in6[2]));
} else {
/* Unknown type; just copy IP directly. */
irc_ntop(hostname, IRC_NTOP_MAX_SIZE, &user->ip);
}
return 1;
}
+
+unsigned int
+irc_user_modes(const struct userNode *user, char modes[], size_t length)
+{
+ unsigned int ii, jj;
+
+ for (ii = jj = 0; (jj < length) && (irc_user_mode_chars[ii] != '\0'); ++ii) {
+ if ((user->modes & (1 << ii)) && (irc_user_mode_chars[ii] != ' '))
+ modes[jj++] = irc_user_mode_chars[ii];
+ }
+
+ ii = jj;
+ while (jj < length)
+ modes[jj++] = '\0';
+
+ return ii;
+}