Commit Diff
Diff:
557be8c56b652751a1797f1ac1365f1ace38146a
c5342fb4670387fb7f7335e36ac3260c1e8ab514
Commit:
c5342fb4670387fb7f7335e36ac3260c1e8ab514
Tree:
68d34be00d7d1c0ecb000d069ac99a4e65ab8d8b
Author:
Alexander Barton <alex@barton.de>
Committer:
Alexander Barton <alex@barton.de>
Date:
Tue Sep 23 09:47:17 2008 UTC
Message:
Centralize logging functions in Introduce_Client().
blob - 0f3b83a962a069d47f6035dca15e4deb8269088a
blob + 85d95022c74ed1f85ea5f6ec874af1ef919a0b48
--- src/ngircd/irc-login.c
+++ src/ngircd/irc-login.c
@@ -367,18 +367,12 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
* other servers about the new user.
* RFC 1459: announce the new client only after receiving the
* USER command, first we need more information! */
- if (Req->argc >= 7) {
- modes = Client_Modes(c);
- LogDebug("User \"%s\" (+%s) registered (via %s, on %s, %d hop%s).",
- Client_Mask(c), modes, Client_ID(Client),
- Client_ID(intr_c), Client_Hops(c),
- Client_Hops(c) > 1 ? "s": "");
- Introduce_Client(Client, c);
- } else {
+ if (Req->argc < 7) {
LogDebug("User \"%s\" is beeing registered (RFC 1459) ...",
Client_Mask(c));
Client_SetType(c, CLIENT_GOTNICK);
- }
+ } else
+ Introduce_Client(Client, c);
return CONNECTED;
}
@@ -459,15 +453,10 @@ IRC_USER(CLIENT * Client, REQUEST * Req)
LogDebug("Connection %d: got valid USER command for \"%s\".",
Client_Conn(Client), Client_Mask(c));
- /* RFC 1459 style user registration? Inform other servers! */
- if (Client_Type(c) == CLIENT_GOTNICK) {
- LogDebug("User \"%s\" (+%s) registered (via %s, on %s, %d hop%s).",
- Client_Mask(c), Client_Modes(c), Client_ID(Client),
- Client_ID(Client_Introducer(c)), Client_Hops(c),
- Client_Hops(c) > 1 ? "s": "");
- Client_SetType(c, CLIENT_USER);
+ /* RFC 1459 style user registration?
+ * Introduce client to network: */
+ if (Client_Type(c) == CLIENT_GOTNICK)
Introduce_Client(Client, c);
- }
return CONNECTED;
} else if (Client_Type(Client) == CLIENT_USER) {
@@ -697,11 +686,6 @@ Hello_User(CLIENT * Client)
return DISCONNECTED;
}
- Client_SetType(Client, CLIENT_USER);
- Log(LOG_NOTICE, "User \"%s\" registered (connection %d).",
- Client_Mask(Client), Client_Conn(Client));
-
- /* Inform other servers */
Introduce_Client(NULL, Client);
if (!IRC_WriteStrClient
@@ -759,6 +743,18 @@ Kill_Nick( char *Nick, char *Reason )
static void
Introduce_Client(CLIENT *From, CLIENT *Client)
{
+ Client_SetType(Client, CLIENT_USER);
+
+ if (From) {
+ LogDebug("User \"%s\" (+%s) registered (via %s, on %s, %d hop%s).",
+ Client_Mask(Client), Client_Modes(Client),
+ Client_ID(From), Client_ID(Client_Introducer(Client)),
+ Client_Hops(Client), Client_Hops(Client) > 1 ? "s": "");
+ } else
+ Log(LOG_NOTICE, "User \"%s\" registered (connection %d).",
+ Client_Mask(Client), Client_Conn(Client));
+
+ /* Inform other servers */
IRC_WriteStrServersPrefixFlag_CB(From,
From != NULL ? From : Client_ThisServer(),
'\0', cb_introduceClient, (void *)Client);
IRCNow