]> arthur.barton.de Git - ngircd.git/commitdiff
cleanups [from HEAD]
authorFlorian Westphal <fw@strlen.de>
Sat, 2 Dec 2006 14:21:26 +0000 (14:21 +0000)
committerFlorian Westphal <fw@strlen.de>
Sat, 2 Dec 2006 14:21:26 +0000 (14:21 +0000)
src/ngircd/irc-mode.c
src/ngircd/irc-op.c
src/ngircd/irc-server.c
src/ngircd/messages.h

index 1bfa9e15622c2999a86624992010e52a32777921..8f4dfae5f62bf604ad9929ef7ec51612eb373bb0 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-mode.c,v 1.45 2006/05/10 21:24:01 alex Exp $";
+static char UNUSED id[] = "$Id: irc-mode.c,v 1.45.2.1 2006/12/02 14:21:26 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -69,7 +69,7 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
                if( ! origin ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
        }
        else origin = Client;
-       
+
        /* Channel or user mode? */
        cl = NULL; chan = NULL;
        if (Client_IsValidNick(Req->argv[0]))
@@ -268,7 +268,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
                        switch( *mode_ptr )
                        {
                                case 'l':
-                                       snprintf( argadd, sizeof( argadd ), " %ld", Channel_MaxUsers( Channel ));
+                                       snprintf( argadd, sizeof( argadd ), " %lu", Channel_MaxUsers( Channel ));
                                        strlcat( the_args, argadd, sizeof( the_args ));
                                        break;
                                case 'k':
index 587c4c606b987c199098e3fd6e2d1ab2b4fcf8ac..f05f91f78cb8956977b0111b8f7ae136bd78cd5d 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-op.c,v 1.15 2005/04/27 07:39:18 alex Exp $";
+static char UNUSED id[] = "$Id: irc-op.c,v 1.15.4.1 2006/12/02 14:21:26 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -101,15 +101,14 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
                /* If the target user is banned on that channel: remember invite */
                if( Lists_CheckBanned( target, chan )) remember = true;
 
-               if( remember )
-               {
-                       /* We must memember this invite */
+               if (remember) {
+                       /* We must remember this invite */
                        if( ! Lists_AddInvited( Client_Mask( target ), chan, true)) return CONNECTED;
                }
        }
 
-       Log( LOG_DEBUG, "User \"%s\" invites \"%s\" to \"%s\" ...", Client_Mask( from ), Req->argv[0], Req->argv[1] );
-       
+       LogDebug("User \"%s\" invites \"%s\" to \"%s\" ...", Client_Mask(from), Req->argv[0], Req->argv[1]);
+
        /* Inform target client */
        IRC_WriteStrClientPrefix( target, from, "INVITE %s %s", Req->argv[0], Req->argv[1] );
 
index 2c153064b11306d385e463ebdd938a970a089fa3..1da5c2cc55c6fd39a4b4273efe1e515d34037e96 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-server.c,v 1.39 2006/04/30 21:31:43 alex Exp $";
+static char UNUSED id[] = "$Id: irc-server.c,v 1.39.2.1 2006/12/02 14:21:26 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -41,6 +41,10 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.39 2006/04/30 21:31:43 alex Exp
 #include "irc-server.h"
 
 
+/**
+ * Handler for the IRC command "SERVER".
+ * See RFC 2813 section 4.1.2.
+ */
 GLOBAL bool
 IRC_SERVER( CLIENT *Client, REQUEST *Req )
 {
@@ -55,13 +59,16 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
        assert( Client != NULL );
        assert( Req != NULL );
 
-       /* Fehler liefern, wenn kein lokaler Client */
-       if( Client_Conn( Client ) <= NONE ) return IRC_WriteStrClient( Client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( Client ), Req->command );
+       /* Return an error if this is not a local client */
+       if (Client_Conn(Client) <= NONE)
+               return IRC_WriteStrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
+                                         Client_ID(Client), Req->command);
 
-       if( Client_Type( Client ) == CLIENT_GOTPASSSERVER )
-       {
-               /* Verbindung soll als Server-Server-Verbindung registriert werden */
-               Log( LOG_DEBUG, "Connection %d: got SERVER command (new server link) ...", Client_Conn( Client ));
+       if (Client_Type(Client) == CLIENT_GOTPASSSERVER) {
+               /* We got a PASS command from the peer, and now a SERVER
+                * command: the peer tries to register itself as a server. */
+               LogDebug("Connection %d: got SERVER command (new server link) ...",
+                       Client_Conn(Client));
 
                /* Falsche Anzahl Parameter? */
                if(( Req->argc != 2 ) && ( Req->argc != 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -207,7 +214,13 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
                                        else
                                        {
                                                /* "CHANINFO <chan> +<modes> <key> <limit> :<topic>" */
-                                               if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s %s %ld :%s", Channel_Name( chan ), modes, strchr( Channel_Modes( chan ), 'k' ) ? Channel_Key( chan ) : "*", strchr( Channel_Modes( chan ), 'l' ) ? Channel_MaxUsers( chan ) : 0L, topic )) return DISCONNECTED;
+                                               if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s %s %lu :%s",
+                                                       Channel_Name( chan ), modes,
+                                                       strchr( Channel_Modes( chan ), 'k' ) ? Channel_Key( chan ) : "*",
+                                                       strchr( Channel_Modes( chan ), 'l' ) ? Channel_MaxUsers( chan ) : 0UL, topic ))
+                                               {
+                                                       return DISCONNECTED;
+                                               }
                                        }
                                }
                        }
index ee1eff67711c895defa38a56bd1e534df4f96a4f..1d8288d895c189ad6b41ad1adabfc5a862178ae6 100644 (file)
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: messages.h,v 1.67 2005/09/02 12:50:25 alex Exp $
+ * $Id: messages.h,v 1.67.2.1 2006/12/02 14:21:26 fw Exp $
  *
  * IRC numerics (Header)
  */
 #define RPL_ENDOFSTATS_MSG             "219 %s %c :End of STATS report"
 #define RPL_UMODEIS_MSG                        "221 %s +%s"
 #define RPL_LUSERCLIENT_MSG            "251 %s :There are %ld users and %ld services on %ld servers"
-#define RPL_LUSEROP_MSG                        "252 %s %ld :operator(s) online"
-#define RPL_LUSERUNKNOWN_MSG           "253 %s %ld :unknown connection(s)"
-#define RPL_LUSERCHANNELS_MSG          "254 %s %ld :channels formed"
-#define RPL_LUSERME_MSG                        "255 %s :I have %ld users, %ld services and %ld servers"
+#define RPL_LUSEROP_MSG                        "252 %s %lu :operator(s) online"
+#define RPL_LUSERUNKNOWN_MSG           "253 %s %lu :unknown connection(s)"
+#define RPL_LUSERCHANNELS_MSG          "254 %s %lu :channels formed"
+#define RPL_LUSERME_MSG                        "255 %s :I have %lu users, %lu services and %lu servers"
 #define RPL_ADMINME_MSG                        "256 %s %s :Administrative info"
 #define RPL_ADMINLOC1_MSG              "257 %s :%s"
 #define RPL_ADMINLOC2_MSG              "258 %s :%s"
 #define RPL_ADMINEMAIL_MSG             "259 %s :%s"
 #define RPL_TRACEEND_MSG               "262 %s %s %s-%s.%s :End of TRACE"
-#define RPL_LOCALUSERS_MSG             "265 %s :Current local users: %ld, Max: %ld"
-#define RPL_NETUSERS_MSG               "266 %s :Current global users: %ld, Max: %ld"
+#define RPL_LOCALUSERS_MSG             "265 %s :Current local users: %lu, Max: %lu"
+#define RPL_NETUSERS_MSG               "266 %s :Current global users: %lu, Max: %lu"
 
 #define RPL_AWAY_MSG                   "301 %s %s :%s"
 #define RPL_USERHOST_MSG               "302 %s :"