2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2005 by Alexander Barton (alex@barton.de)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * Please read the file COPYING, README and AUTHORS for more information.
20 static char UNUSED id[] = "$Id: client.c,v 1.84 2005/06/12 16:39:42 alex Exp $";
43 #include "irc-write.h"
50 #define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1
53 LOCAL CLIENT *This_Server, *My_Clients;
54 LOCAL char GetID_Buffer[GETID_LEN];
56 LOCAL WHOWAS My_Whowas[MAX_WHOWAS];
57 LOCAL int Last_Whowas = -1;
60 LOCAL long Count PARAMS(( CLIENT_TYPE Type ));
61 LOCAL long MyCount PARAMS(( CLIENT_TYPE Type ));
63 LOCAL CLIENT *New_Client_Struct PARAMS(( void ));
64 LOCAL void Generate_MyToken PARAMS(( CLIENT *Client ));
65 LOCAL void Adjust_Counters PARAMS(( CLIENT *Client ));
67 #ifndef Client_DestroyNow
68 GLOBAL void Client_DestroyNow PARAMS((CLIENT *Client ));
72 long Max_Users = 0, My_Max_Users = 0;
80 This_Server = New_Client_Struct( );
83 Log( LOG_EMERG, "Can't allocate client structure for server! Going down." );
84 Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );
88 /* Client-Struktur dieses Servers */
89 This_Server->next = NULL;
90 This_Server->type = CLIENT_SERVER;
91 This_Server->conn_id = NONE;
92 This_Server->introducer = This_Server;
93 This_Server->mytoken = 1;
94 This_Server->hops = 0;
96 gethostname( This_Server->host, CLIENT_HOST_LEN );
97 h = gethostbyname( This_Server->host );
98 if( h ) strlcpy( This_Server->host, h->h_name, sizeof( This_Server->host ));
100 Client_SetID( This_Server, Conf_ServerName );
101 Client_SetInfo( This_Server, Conf_ServerInfo );
103 My_Clients = This_Server;
105 memset( &My_Whowas, 0, sizeof( My_Whowas ));
115 if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, false );
116 else Client_Destroy( This_Server, "Server going down.", NULL, false );
123 next = (CLIENT *)c->next;
127 if( cnt ) Log( LOG_INFO, "Freed %d client structure%s.", cnt, cnt == 1 ? "" : "s" );
132 Client_ThisServer( void )
135 } /* Client_ThisServer */
139 Client_NewLocal( CONN_ID Idx, char *Hostname, int Type, bool Idented )
141 /* Neuen lokalen Client erzeugen: Wrapper-Funktion fuer Client_New(). */
142 return Client_New( Idx, This_Server, NULL, Type, NULL, NULL, Hostname, NULL, 0, 0, NULL, Idented );
143 } /* Client_NewLocal */
147 Client_NewRemoteServer( CLIENT *Introducer, char *Hostname, CLIENT *TopServer, int Hops, int Token, char *Info, bool Idented )
149 /* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
150 return Client_New( NONE, Introducer, TopServer, CLIENT_SERVER, Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented );
151 } /* Client_NewRemoteServer */
155 Client_NewRemoteUser( CLIENT *Introducer, char *Nick, int Hops, char *User, char *Hostname, int Token, char *Modes, char *Info, bool Idented )
157 /* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
158 return Client_New( NONE, Introducer, NULL, CLIENT_USER, Nick, User, Hostname, Info, Hops, Token, Modes, Idented );
159 } /* Client_NewRemoteUser */
163 Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, int Type, char *ID, char *User, char *Hostname, char *Info, int Hops, int Token, char *Modes, bool Idented )
167 assert( Idx >= NONE );
168 assert( Introducer != NULL );
169 assert( Hostname != NULL );
171 client = New_Client_Struct( );
172 if( ! client ) return NULL;
175 client->starttime = time(NULL);
176 client->conn_id = Idx;
177 client->introducer = Introducer;
178 client->topserver = TopServer;
180 if( ID ) Client_SetID( client, ID );
181 if( User ) Client_SetUser( client, User, Idented );
182 if( Hostname ) Client_SetHostname( client, Hostname );
183 if( Info ) Client_SetInfo( client, Info );
185 client->token = Token;
186 if( Modes ) Client_SetModes( client, Modes );
187 if( Type == CLIENT_SERVER ) Generate_MyToken( client );
189 /* ist der User away? */
190 if( strchr( client->modes, 'a' )) strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away ));
193 client->next = (POINTER *)My_Clients;
196 /* Adjust counters */
197 Adjust_Counters( client );
204 Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
206 /* Client entfernen. */
209 char msg[LINE_LEN], *txt;
211 assert( Client != NULL );
213 if( LogMsg ) txt = LogMsg;
215 if( ! txt ) txt = "Reason unknown.";
217 /* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */
218 if( Client->type == CLIENT_SERVER ) {
219 strlcpy(msg, This_Server->id, sizeof (msg));
220 strlcat(msg, " ", sizeof (msg));
221 strlcat(msg, Client->id, sizeof (msg));
228 if(( Client->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c != Client ))
230 /* der Client, der geloescht wird ist ein Server. Der Client, den wir gerade
231 * pruefen, ist ein Child von diesem und muss daher auch entfernt werden */
232 Client_Destroy( c, NULL, msg, false );
239 /* Wir haben den Client gefunden: entfernen */
240 if( last ) last->next = c->next;
241 else My_Clients = (CLIENT *)c->next;
243 if( c->type == CLIENT_USER )
245 if( c->conn_id != NONE )
247 /* Ein lokaler User */
248 Log( LOG_NOTICE, "User \"%s\" unregistered (connection %d): %s", Client_Mask( c ), c->conn_id, txt );
252 /* Alle andere Server informieren! */
253 if( FwdMsg ) IRC_WriteStrServersPrefix( NULL, c, "QUIT :%s", FwdMsg );
254 else IRC_WriteStrServersPrefix( NULL, c, "QUIT :" );
260 Log( LOG_DEBUG, "User \"%s\" unregistered: %s", Client_Mask( c ), txt );
264 /* Andere Server informieren, ausser denen, die "in
265 * Richtung dem liegen", auf dem der User registriert
266 * ist. Von denen haben wir das QUIT ja wohl bekommen. */
267 if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "QUIT :%s", FwdMsg );
268 else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "QUIT :" );
272 /* Unregister client from channels */
273 Channel_Quit( c, FwdMsg ? FwdMsg : c->id );
275 /* Register client in My_Whowas structure */
276 Client_RegisterWhowas( c );
278 else if( c->type == CLIENT_SERVER )
280 if( c != This_Server )
282 if( c->conn_id != NONE ) Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
283 else Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered: %s", c->id, txt );
286 /* andere Server informieren */
287 if( ! NGIRCd_SignalQuit )
289 if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg );
290 else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :", c->id );
295 if( c->conn_id != NONE )
297 if( c->id[0] ) Log( LOG_NOTICE, "Client \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
298 else Log( LOG_NOTICE, "Client unregistered (connection %d): %s", c->conn_id, txt );
302 if( c->id[0] ) Log( LOG_WARNING, "Unregistered unknown client \"%s\": %s", c->id, txt );
303 else Log( LOG_WARNING, "Unregistered unknown client: %s", c->id, txt );
311 c = (CLIENT *)c->next;
313 } /* Client_Destroy */
317 Client_DestroyNow( CLIENT *Client )
319 /* Destroy client structure immediately. This function is only
320 * intended for the connection layer to remove client structures
321 * of connections that can't be established! */
325 assert( Client != NULL );
333 /* Wir haben den Client gefunden: entfernen */
334 if( last ) last->next = c->next;
335 else My_Clients = (CLIENT *)c->next;
340 c = (CLIENT *)c->next;
342 } /* Client_DestroyNow */
346 Client_SetHostname( CLIENT *Client, char *Hostname )
348 /* Hostname eines Clients setzen */
350 assert( Client != NULL );
351 assert( Hostname != NULL );
353 strlcpy( Client->host, Hostname, sizeof( Client->host ));
354 } /* Client_SetHostname */
358 Client_SetID( CLIENT *Client, char *ID )
360 /* Hostname eines Clients setzen, Hash-Wert berechnen */
362 assert( Client != NULL );
363 assert( ID != NULL );
365 strlcpy( Client->id, ID, sizeof( Client->id ));
368 Client->hash = Hash( Client->id );
373 Client_SetUser( CLIENT *Client, char *User, bool Idented )
375 /* Username eines Clients setzen */
377 assert( Client != NULL );
378 assert( User != NULL );
380 if( Idented ) strlcpy( Client->user, User, sizeof( Client->user ));
383 Client->user[0] = '~';
384 strlcpy( Client->user + 1, User, sizeof( Client->user ) - 1 );
386 } /* Client_SetUser */
390 Client_SetInfo( CLIENT *Client, char *Info )
392 /* Hostname eines Clients setzen */
394 assert( Client != NULL );
395 assert( Info != NULL );
397 strlcpy( Client->info, Info, sizeof( Client->info ));
398 } /* Client_SetInfo */
402 Client_SetModes( CLIENT *Client, char *Modes )
404 /* Modes eines Clients setzen */
406 assert( Client != NULL );
407 assert( Modes != NULL );
409 strlcpy( Client->modes, Modes, sizeof( Client->modes ));
410 } /* Client_SetModes */
414 Client_SetFlags( CLIENT *Client, char *Flags )
416 /* Flags eines Clients setzen */
418 assert( Client != NULL );
419 assert( Flags != NULL );
421 strlcpy( Client->flags, Flags, sizeof( Client->flags ));
422 } /* Client_SetFlags */
426 Client_SetPassword( CLIENT *Client, char *Pwd )
428 /* Von einem Client geliefertes Passwort */
430 assert( Client != NULL );
431 assert( Pwd != NULL );
433 strlcpy( Client->pwd, Pwd, sizeof( Client->pwd ));
434 } /* Client_SetPassword */
438 Client_SetAway( CLIENT *Client, char *Txt )
440 /* Set AWAY reason of client */
442 assert( Client != NULL );
443 assert( Txt != NULL );
445 strlcpy( Client->away, Txt, sizeof( Client->away ));
446 Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
447 } /* Client_SetAway */
451 Client_SetType( CLIENT *Client, int Type )
453 assert( Client != NULL );
455 if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
456 Adjust_Counters( Client );
457 } /* Client_SetType */
461 Client_SetHops( CLIENT *Client, int Hops )
463 assert( Client != NULL );
465 } /* Client_SetHops */
469 Client_SetToken( CLIENT *Client, int Token )
471 assert( Client != NULL );
472 Client->token = Token;
473 } /* Client_SetToken */
477 Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer )
479 assert( Client != NULL );
480 assert( Introducer != NULL );
481 Client->introducer = Introducer;
482 } /* Client_SetIntroducer */
486 Client_SetOperByMe( CLIENT *Client, bool OperByMe )
488 assert( Client != NULL );
489 Client->oper_by_me = OperByMe;
490 } /* Client_SetOperByMe */
494 Client_ModeAdd( CLIENT *Client, char Mode )
497 * If Client already alread had Mode, return false.
498 * If the Mode was newly set, return true.
503 assert( Client != NULL );
505 x[0] = Mode; x[1] = '\0';
506 if( ! strchr( Client->modes, x[0] ))
508 /* Client hat den Mode noch nicht -> setzen */
509 strlcat( Client->modes, x, sizeof( Client->modes ));
513 } /* Client_ModeAdd */
517 Client_ModeDel( CLIENT *Client, char Mode )
520 * If Mode was removed, return true.
521 * If Client did not have Mode, return false.
526 assert( Client != NULL );
528 x[0] = Mode; x[1] = '\0';
530 p = strchr( Client->modes, x[0] );
531 if( ! p ) return false;
533 /* Client has Mode -> delete */
540 } /* Client_ModeDel */
544 Client_GetFromConn( CONN_ID Idx )
546 /* return Client-Structure that belongs to the local Connection Idx gehoert.
547 * If none is found, return NULL.
557 if( c->conn_id == Idx ) return c;
558 c = (CLIENT *)c->next;
561 } /* Client_GetFromConn */
565 Client_Search( char *Nick )
567 /* return Client-Structure that has the corresponding Nick.
568 * If none is found, return NULL.
571 char search_id[CLIENT_ID_LEN], *ptr;
575 assert( Nick != NULL );
577 /* copy Nick and truncate hostmask if necessary */
578 strlcpy( search_id, Nick, sizeof( search_id ));
579 ptr = strchr( search_id, '!' );
580 if( ptr ) *ptr = '\0';
582 search_hash = Hash( search_id );
587 if( c->hash == search_hash )
589 /* lt. Hash-Wert: Treffer! */
590 if( strcasecmp( c->id, search_id ) == 0 ) return c;
592 c = (CLIENT *)c->next;
595 } /* Client_Search */
599 Client_GetFromToken( CLIENT *Client, int Token )
601 /* Client-Struktur, die den entsprechenden Introducer (=Client)
602 * und das gegebene Token hat, liefern. Wird keine gefunden,
603 * so wird NULL geliefert. */
607 assert( Client != NULL );
613 if(( c->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c->token == Token )) return c;
614 c = (CLIENT *)c->next;
617 } /* Client_GetFromToken */
621 Client_Type( CLIENT *Client )
623 assert( Client != NULL );
629 Client_Conn( CLIENT *Client )
631 assert( Client != NULL );
632 return Client->conn_id;
637 Client_ID( CLIENT *Client )
639 assert( Client != NULL );
642 if( Client->type == CLIENT_USER ) assert( strlen( Client->id ) < CLIENT_NICK_LEN );
645 if( Client->id[0] ) return Client->id;
651 Client_Info( CLIENT *Client )
653 assert( Client != NULL );
659 Client_User( CLIENT *Client )
661 assert( Client != NULL );
662 if( Client->user[0] ) return Client->user;
668 Client_Hostname( CLIENT *Client )
670 assert( Client != NULL );
672 } /* Client_Hostname */
676 Client_Password( CLIENT *Client )
678 assert( Client != NULL );
680 } /* Client_Password */
684 Client_Modes( CLIENT *Client )
686 assert( Client != NULL );
687 return Client->modes;
692 Client_Flags( CLIENT *Client )
694 assert( Client != NULL );
695 return Client->flags;
700 Client_OperByMe( CLIENT *Client )
702 assert( Client != NULL );
703 return Client->oper_by_me;
704 } /* Client_OperByMe */
708 Client_Hops( CLIENT *Client )
710 assert( Client != NULL );
716 Client_Token( CLIENT *Client )
718 assert( Client != NULL );
719 return Client->token;
724 Client_MyToken( CLIENT *Client )
726 assert( Client != NULL );
727 return Client->mytoken;
728 } /* Client_MyToken */
732 Client_NextHop( CLIENT *Client )
736 assert( Client != NULL );
739 while( c->introducer && ( c->introducer != c ) && ( c->introducer != This_Server )) c = c->introducer;
741 } /* Client_NextHop */
745 Client_Mask( CLIENT *Client )
747 /* Client-"ID" liefern, wie sie z.B. fuer
748 * Prefixe benoetigt wird. */
750 assert( Client != NULL );
752 if( Client->type == CLIENT_SERVER ) return Client->id;
754 snprintf( GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host );
760 Client_Introducer( CLIENT *Client )
762 assert( Client != NULL );
763 return Client->introducer;
764 } /* Client_Introducer */
768 Client_TopServer( CLIENT *Client )
770 assert( Client != NULL );
771 return Client->topserver;
772 } /* Client_TopServer */
776 Client_HasMode( CLIENT *Client, char Mode )
778 assert( Client != NULL );
779 return strchr( Client->modes, Mode ) != NULL;
780 } /* Client_HasMode */
784 Client_Away( CLIENT *Client )
786 /* AWAY-Text liefern */
788 assert( Client != NULL );
794 Client_CheckNick( CLIENT *Client, char *Nick )
796 /* Nick ueberpruefen */
798 assert( Client != NULL );
799 assert( Nick != NULL );
801 /* Nick ungueltig? */
802 if( ! Client_IsValidNick( Nick ))
804 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), Nick );
808 /* Nick bereits vergeben? */
809 if( Client_Search( Nick ))
811 /* den Nick gibt es bereits */
812 IRC_WriteStrClient( Client, ERR_NICKNAMEINUSE_MSG, Client_ID( Client ), Nick );
817 } /* Client_CheckNick */
821 Client_CheckID( CLIENT *Client, char *ID )
823 /* Nick ueberpruefen */
825 char str[COMMAND_LEN];
828 assert( Client != NULL );
829 assert( Client->conn_id > NONE );
830 assert( ID != NULL );
833 if( strlen( ID ) > CLIENT_ID_LEN )
835 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), ID );
839 /* ID bereits vergeben? */
843 if( strcasecmp( c->id, ID ) == 0 )
845 /* die Server-ID gibt es bereits */
846 snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID );
847 if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
848 else Log( LOG_ERR, "%s (via network)!", str );
849 Conn_Close( Client->conn_id, str, str, true);
852 c = (CLIENT *)c->next;
856 } /* Client_CheckID */
862 /* Ersten Client liefern. */
869 Client_Next( CLIENT *c )
871 /* Naechsten Client liefern. Existiert keiner,
872 * so wird NULL geliefert. */
875 return (CLIENT *)c->next;
880 Client_UserCount( void )
882 return Count( CLIENT_USER );
883 } /* Client_UserCount */
887 Client_ServiceCount( void )
889 return Count( CLIENT_SERVICE );;
890 } /* Client_ServiceCount */
894 Client_ServerCount( void )
896 return Count( CLIENT_SERVER );
897 } /* Client_ServerCount */
901 Client_MyUserCount( void )
903 return MyCount( CLIENT_USER );
904 } /* Client_MyUserCount */
908 Client_MyServiceCount( void )
910 return MyCount( CLIENT_SERVICE );
911 } /* Client_MyServiceCount */
915 Client_MyServerCount( void )
924 if(( c->type == CLIENT_SERVER ) && ( c->hops == 1 )) cnt++;
925 c = (CLIENT *)c->next;
928 } /* Client_MyServerCount */
932 Client_OperCount( void )
941 if( c && ( c->type == CLIENT_USER ) && ( strchr( c->modes, 'o' ))) cnt++;
942 c = (CLIENT *)c->next;
945 } /* Client_OperCount */
949 Client_UnknownCount( void )
958 if( c && ( c->type != CLIENT_USER ) && ( c->type != CLIENT_SERVICE ) && ( c->type != CLIENT_SERVER )) cnt++;
959 c = (CLIENT *)c->next;
962 } /* Client_UnknownCount */
966 Client_MaxUserCount( void )
969 } /* Client_MaxUserCount */
973 Client_MyMaxUserCount( void )
976 } /* Client_MyMaxUserCount */
980 Client_IsValidNick( char *Nick )
982 /* Ist der Nick gueltig? */
984 char *ptr, goodchars[20];
986 assert( Nick != NULL );
988 strcpy( goodchars, ";0123456789-" );
990 if( Nick[0] == '#' ) return false;
991 if( strchr( goodchars, Nick[0] )) return false;
992 if( strlen( Nick ) >= CLIENT_NICK_LEN ) return false;
997 if(( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false;
998 if(( *ptr > '}' ) && ( ! strchr( goodchars, *ptr ))) return false;
1003 } /* Client_IsValidNick */
1007 * Return pointer to "My_Whowas" structure.
1010 Client_GetWhowas( void )
1013 } /* Client_GetWhowas */
1016 * Return the index of the last used WHOWAS entry.
1019 Client_GetLastWhowasIndex( void )
1022 } /* Client_GetLastWhowasIndex */
1026 * Get the start time of this client.
1027 * The result is the start time in seconds since 1970-01-01, as reported
1028 * by the C function time(NULL).
1031 Client_StartTime(CLIENT *Client)
1033 assert( Client != NULL );
1034 return Client->starttime;
1035 } /* Client_Uptime */
1039 Count( CLIENT_TYPE Type )
1048 if( c->type == Type ) cnt++;
1049 c = (CLIENT *)c->next;
1056 MyCount( CLIENT_TYPE Type )
1065 if(( c->introducer == This_Server ) && ( c->type == Type )) cnt++;
1066 c = (CLIENT *)c->next;
1073 New_Client_Struct( void )
1075 /* Neue CLIENT-Struktur pre-initialisieren */
1079 c = (CLIENT *)malloc( sizeof( CLIENT ));
1082 Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" );
1086 memset( c, 0, sizeof ( CLIENT ));
1088 c->type = CLIENT_UNKNOWN;
1090 c->oper_by_me = false;
1100 Generate_MyToken( CLIENT *Client )
1109 if( c->mytoken == token )
1111 /* Das Token wurde bereits vergeben */
1116 else c = (CLIENT *)c->next;
1118 Client->mytoken = token;
1119 Log( LOG_DEBUG, "Assigned token %d to server \"%s\".", token, Client->id );
1120 } /* Generate_MyToken */
1124 Adjust_Counters( CLIENT *Client )
1128 assert( Client != NULL );
1130 if( Client->type != CLIENT_USER ) return;
1132 if( Client->conn_id != NONE )
1134 /* Local connection */
1135 count = Client_MyUserCount( );
1136 if( count > My_Max_Users ) My_Max_Users = count;
1138 count = Client_UserCount( );
1139 if( count > Max_Users ) Max_Users = count;
1140 } /* Adjust_Counters */
1144 * Register client in My_Whowas structure for further recall by WHOWAS.
1145 * Note: Only clients that have been connected at least 30 seconds will be
1146 * registered to prevent automated IRC bots to "destroy" a nice server
1150 Client_RegisterWhowas( CLIENT *Client )
1154 assert( Client != NULL );
1156 /* Don't register clients that were connected less than 30 seconds. */
1157 if( time(NULL) - Client->starttime < 30 )
1160 slot = Last_Whowas + 1;
1161 if( slot >= MAX_WHOWAS || slot < 0 ) slot = 0;
1164 Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot );
1167 My_Whowas[slot].time = time( NULL );
1168 strlcpy( My_Whowas[slot].id, Client_ID( Client ),
1169 sizeof( My_Whowas[slot].id ));
1170 strlcpy( My_Whowas[slot].user, Client_User( Client ),
1171 sizeof( My_Whowas[slot].user ));
1172 strlcpy( My_Whowas[slot].host, Client_Hostname( Client ),
1173 sizeof( My_Whowas[slot].host ));
1174 strlcpy( My_Whowas[slot].info, Client_Info( Client ),
1175 sizeof( My_Whowas[slot].info ));
1176 strlcpy( My_Whowas[slot].server, Client_ID( Client_Introducer( Client )),
1177 sizeof( My_Whowas[slot].server ));
1180 } /* Client_RegisterWhowas */