]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc.c
Enhance "NOTICE AUTH": show hostname and IDENT reply
[ngircd-alex.git] / src / ngircd / irc.c
index 10e3e45656bdb1cc996ef0d92ad2c0a1cd8fab2f..efc34d4b2e087f8e3742c1d44ea6a820e2073f92 100644 (file)
@@ -327,12 +327,18 @@ IRC_HELP( CLIENT *Client, REQUEST *Req )
 
 
 static char *
-Option_String( CONN_ID Idx )
+#ifdef ZLIB
+Option_String(CONN_ID Idx)
+#else
+Option_String(UNUSED CONN_ID Idx)
+#endif
 {
        static char option_txt[8];
+#ifdef ZLIB
        UINT16 options;
 
        options = Conn_Options(Idx);
+#endif
 
        strcpy(option_txt, "F");        /* No idea what this means, but the
                                         * original ircd sends it ... */
@@ -349,6 +355,7 @@ static bool
 Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
 {
        CLIENT *cl, *from;
+       CL2CHAN *cl2chan;
        CHANNEL *chan;
        char *currentTarget = Req->argv[0];
        char *lastCurrentTarget = NULL;
@@ -439,8 +446,8 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
                                    Client_Type(cl) != CLIENT_SERVICE)
                                        continue;
                                if (nick != NULL && host != NULL) {
-                                       if (strcmp(nick, Client_ID(cl)) == 0 &&
-                                           strcmp(user, Client_User(cl)) == 0 &&
+                                       if (strcasecmp(nick, Client_ID(cl)) == 0 &&
+                                           strcasecmp(user, Client_User(cl)) == 0 &&
                                            strcasecmp(host, Client_HostnameCloaked(cl)) == 0)
                                                break;
                                        else
@@ -468,11 +475,11 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
 #else
                        if (Client_Type(cl) != ForceType) {
 #endif
-                               if (!SendErrors)
-                                       return CONNECTED;
-                               return IRC_WriteStrClient(from, ERR_NOSUCHNICK_MSG,
-                                                         Client_ID(from),
-                                                         currentTarget);
+                               if (SendErrors && !IRC_WriteStrClient(
+                                   from, ERR_NOSUCHNICK_MSG,Client_ID(from),
+                                   currentTarget))
+                                       return DISCONNECTED;
+                               goto send_next_target;
                        }
 
 #ifndef STRICT_RFC
@@ -485,6 +492,23 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
                        }
 #endif
 
+                       if (Client_HasMode(cl, 'C')) {
+                               cl2chan = Channel_FirstChannelOf(cl);
+                               while (cl2chan) {
+                                       chan = Channel_GetChannel(cl2chan);
+                                       if (Channel_IsMemberOf(chan, from))
+                                               break;
+                                       cl2chan = Channel_NextChannelOf(cl, cl2chan);
+                               }
+                               if (!cl2chan) {
+                                       if (SendErrors && !IRC_WriteStrClient(
+                                           from, ERR_NOTONSAMECHANNEL_MSG,
+                                           Client_ID(from), Client_ID(cl)))
+                                               return DISCONNECTED;
+                                       goto send_next_target;
+                               }
+                       }
+
                        if (SendErrors && (Client_Type(Client) != CLIENT_SERVER)
                            && strchr(Client_Modes(cl), 'a')) {
                                /* Target is away */
@@ -522,6 +546,7 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
                                return DISCONNECTED;
                }
 
+       send_next_target:
                currentTarget = strtok_r(NULL, ",", &lastCurrentTarget);
                if (currentTarget)
                        Conn_SetPenalty(Client_Conn(Client), 1);