commit 298158501dd928954fa542b9a2ee0ccc9b0ab2ac from: Alexander Barton date: Tue Aug 06 22:13:08 2013 UTC IRC_SERVER(): Code cleanup commit - 904c8a4375cb9deed64007b06c6a7ba42313d93d commit + 298158501dd928954fa542b9a2ee0ccc9b0ab2ac blob - 72acf79cdf593b0e3f132a789dcfccf3691359a2 blob + d1df18acf1e794ea76c957bd297141036cf98b56 --- src/ngircd/irc-server.c +++ src/ngircd/irc-server.c @@ -188,30 +188,47 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req ) Client_ID(Client), Req->command); /* check for existing server with same ID */ - if( ! Client_CheckID( Client, Req->argv[0] )) return DISCONNECTED; + if (!Client_CheckID(Client, Req->argv[0])) + return DISCONNECTED; from = Client_Search( Req->prefix ); - if( ! from ) - { + if (! from) { /* Uh, Server, that introduced the new server is unknown?! */ - Log( LOG_ALERT, "Unknown ID in prefix of SERVER: \"%s\"! (on connection %d)", Req->prefix, Client_Conn( Client )); - Conn_Close( Client_Conn( Client ), NULL, "Unknown ID in prefix of SERVER", true); + Log(LOG_ALERT, + "Unknown ID in prefix of SERVER: \"%s\"! (on connection %d)", + Req->prefix, Client_Conn(Client)); + Conn_Close(Client_Conn(Client), NULL, + "Unknown ID in prefix of SERVER", true); return DISCONNECTED; } - c = Client_NewRemoteServer(Client, Req->argv[0], from, atoi(Req->argv[1]), atoi(Req->argv[2]), Req->argv[3], true); + c = Client_NewRemoteServer(Client, Req->argv[0], from, + atoi(Req->argv[1]), atoi(Req->argv[2]), + Req->argv[3], true); if (!c) { - Log( LOG_ALERT, "Can't create client structure for server! (on connection %d)", Client_Conn( Client )); - Conn_Close( Client_Conn( Client ), NULL, "Can't allocate client structure for remote server", true); + Log(LOG_ALERT, + "Can't create client structure for server! (on connection %d)", + Client_Conn(Client)); + Conn_Close(Client_Conn(Client), NULL, + "Can't allocate client structure for remote server", + true); return DISCONNECTED; } - if(( Client_Hops( c ) > 1 ) && ( Req->prefix[0] )) snprintf( str, sizeof( str ), "connected to %s, ", Client_ID( from )); - else strcpy( str, "" ); - Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (via %s, %s%d hop%s).", Client_ID( c ), Client_ID( Client ), str, Client_Hops( c ), Client_Hops( c ) > 1 ? "s": "" ); + if (Client_Hops(c) > 1 && Req->prefix[0]) + snprintf(str, sizeof(str), "connected to %s, ", + Client_ID(from)); + else + strcpy(str, ""); + Log(LOG_NOTICE|LOG_snotice, + "Server \"%s\" registered (via %s, %s%d hop%s).", + Client_ID(c), Client_ID(Client), str, Client_Hops(c), + Client_Hops(c) > 1 ? "s": "" ); /* notify other servers */ - IRC_WriteStrServersPrefix( Client, from, "SERVER %s %d %d :%s", Client_ID( c ), Client_Hops( c ) + 1, Client_MyToken( c ), Client_Info( c )); + IRC_WriteStrServersPrefix(Client, from, "SERVER %s %d %d :%s", + Client_ID(c), Client_Hops(c) + 1, + Client_MyToken(c), Client_Info(c)); return CONNECTED; } else