Do not show "[#channel (500,)]" in a !myaccess list.
[srvx.git] / src / proto-common.c
index 967cb77f2ed823f0b31f678b7621baf5e32b1d29..4fa2d2b49f5758258911794d5815136703f0893a 100644 (file)
@@ -430,6 +430,7 @@ struct privmsg_desc {
 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;
@@ -443,7 +444,8 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
     /* 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);
 
     /* This catches *all* text sent to the channel that the services server sees */
@@ -735,6 +737,8 @@ generate_hostmask(struct userNode *user, int options)
         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] = '*';
@@ -758,7 +762,7 @@ generate_hostmask(struct userNode *user, int options)
             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);