X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fclient.c;h=1a6ad931f8b128604296c17c2b3ebbac64bb7bc3;hp=033478356ea2e9ddadc963fc2493476ad0b86810;hb=71d8c371711f70e2d4b7ef9c908443a018cd6701;hpb=cd954ee7e902743cd679b418edf1630225c512c4 diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 03347835..1a6ad931 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -7,16 +7,17 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. - * - * Client management. */ - #define __client_c__ - #include "portab.h" +/** + * @file + * Client management. + */ + #include "imp.h" #include #include @@ -43,10 +44,8 @@ #include - #define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1 - static CLIENT *This_Server, *My_Clients; static WHOWAS My_Whowas[MAX_WHOWAS]; @@ -93,7 +92,7 @@ Client_Init( void ) This_Server->hops = 0; gethostname( This_Server->host, CLIENT_HOST_LEN ); - if (!Conf_NoDNS) { + if (Conf_DNS) { h = gethostbyname( This_Server->host ); if (h) strlcpy(This_Server->host, h->h_name, sizeof(This_Server->host)); } @@ -320,7 +319,11 @@ Client_SetHostname( CLIENT *Client, const char *Hostname ) assert( Client != NULL ); assert( Hostname != NULL ); - strlcpy( Client->host, Hostname, sizeof( Client->host )); + if (strlen(Conf_ClientHost)) { + strlcpy( Client->host, Conf_ClientHost, sizeof( Client->host )); + } else { + strlcpy( Client->host, Hostname, sizeof( Client->host )); + } } /* Client_SetHostname */ @@ -332,6 +335,9 @@ Client_SetID( CLIENT *Client, const char *ID ) strlcpy( Client->id, ID, sizeof( Client->id )); + if (Conf_ClientUserNick) + strlcpy( Client->user, ID, sizeof( Client->user )); + /* Hash */ Client->hash = Hash( Client->id ); } /* Client_SetID */ @@ -345,6 +351,8 @@ Client_SetUser( CLIENT *Client, const char *User, bool Idented ) assert( Client != NULL ); assert( User != NULL ); + if (Conf_ClientUserNick) return; + if (Idented) { strlcpy(Client->user, User, sizeof(Client->user)); } else { @@ -363,7 +371,8 @@ Client_SetUser( CLIENT *Client, const char *User, bool Idented ) * @param User User name to set. */ GLOBAL void -Client_SetOrigUser(CLIENT UNUSED *Client, const char UNUSED *User) { +Client_SetOrigUser(CLIENT UNUSED *Client, const char UNUSED *User) +{ assert(Client != NULL); assert(User != NULL); @@ -552,17 +561,19 @@ Client_Search( const char *Nick ) } /* Client_Search */ +/** + * Get client structure ("introducer") identfied by a server token. + * @return CLIENT structure or NULL if none could be found. + */ GLOBAL CLIENT * Client_GetFromToken( CLIENT *Client, int Token ) { - /* Client-Struktur, die den entsprechenden Introducer (=Client) - * und das gegebene Token hat, liefern. Wird keine gefunden, - * so wird NULL geliefert. */ - CLIENT *c; assert( Client != NULL ); - assert( Token > 0 ); + + if (!Token) + return NULL; c = My_Clients; while (c) {