2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2008 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.
41 #include "irc-write.h"
48 #define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1
51 static CLIENT *This_Server, *My_Clients;
52 static char GetID_Buffer[GETID_LEN];
54 static WHOWAS My_Whowas[MAX_WHOWAS];
55 static int Last_Whowas = -1;
56 static long Max_Users, My_Max_Users;
59 static unsigned long Count PARAMS(( CLIENT_TYPE Type ));
60 static unsigned long MyCount PARAMS(( CLIENT_TYPE Type ));
62 static CLIENT *New_Client_Struct PARAMS(( void ));
63 static void Generate_MyToken PARAMS(( CLIENT *Client ));
64 static void Adjust_Counters PARAMS(( CLIENT *Client ));
66 static CLIENT *Init_New_Client PARAMS((CONN_ID Idx, CLIENT *Introducer,
67 CLIENT *TopServer, int Type, char *ID,
68 char *User, char *Hostname, char *Info,
69 int Hops, int Token, char *Modes,
72 static void Destroy_UserOrService PARAMS((CLIENT *Client, char *Txt, char *FwdMsg,
81 This_Server = New_Client_Struct( );
84 Log( LOG_EMERG, "Can't allocate client structure for server! Going down." );
85 Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );
89 /* Client-Struktur dieses Servers */
90 This_Server->next = NULL;
91 This_Server->type = CLIENT_SERVER;
92 This_Server->conn_id = NONE;
93 This_Server->introducer = This_Server;
94 This_Server->mytoken = 1;
95 This_Server->hops = 0;
97 gethostname( This_Server->host, CLIENT_HOST_LEN );
99 h = gethostbyname( This_Server->host );
100 if (h) strlcpy(This_Server->host, h->h_name, sizeof(This_Server->host));
102 Client_SetID( This_Server, Conf_ServerName );
103 Client_SetInfo( This_Server, Conf_ServerInfo );
105 My_Clients = This_Server;
107 memset( &My_Whowas, 0, sizeof( My_Whowas ));
117 if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, false );
118 else Client_Destroy( This_Server, "Server going down.", NULL, false );
125 next = (CLIENT *)c->next;
129 if( cnt ) Log( LOG_INFO, "Freed %d client structure%s.", cnt, cnt == 1 ? "" : "s" );
134 Client_ThisServer( void )
137 } /* Client_ThisServer */
141 * Initialize new local client; wrapper function for Init_New_Client().
142 * @return New CLIENT structure.
145 Client_NewLocal(CONN_ID Idx, char *Hostname, int Type, bool Idented)
147 return Init_New_Client(Idx, This_Server, NULL, Type, NULL, NULL,
148 Hostname, NULL, 0, 0, NULL, Idented);
149 } /* Client_NewLocal */
153 * Initialize new remote server; wrapper function for Init_New_Client().
154 * @return New CLIENT structure.
157 Client_NewRemoteServer(CLIENT *Introducer, char *Hostname, CLIENT *TopServer,
158 int Hops, int Token, char *Info, bool Idented)
160 return Init_New_Client(NONE, Introducer, TopServer, CLIENT_SERVER,
161 Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented);
162 } /* Client_NewRemoteServer */
166 * Initialize new remote client; wrapper function for Init_New_Client().
167 * @return New CLIENT structure.
170 Client_NewRemoteUser(CLIENT *Introducer, char *Nick, int Hops, char *User,
171 char *Hostname, int Token, char *Modes, char *Info, bool Idented)
173 return Init_New_Client(NONE, Introducer, NULL, CLIENT_USER, Nick,
174 User, Hostname, Info, Hops, Token, Modes, Idented);
175 } /* Client_NewRemoteUser */
179 * Initialize new client and set up the given parameters like client type,
180 * user name, host name, introducing server etc. ...
181 * @return New CLIENT structure.
184 Init_New_Client(CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer,
185 int Type, char *ID, char *User, char *Hostname, char *Info, int Hops,
186 int Token, char *Modes, bool Idented)
190 assert( Idx >= NONE );
191 assert( Introducer != NULL );
192 assert( Hostname != NULL );
194 client = New_Client_Struct( );
195 if( ! client ) return NULL;
198 client->starttime = time(NULL);
199 client->conn_id = Idx;
200 client->introducer = Introducer;
201 client->topserver = TopServer;
203 if( ID ) Client_SetID( client, ID );
204 if( User ) Client_SetUser( client, User, Idented );
205 if( Hostname ) Client_SetHostname( client, Hostname );
206 if( Info ) Client_SetInfo( client, Info );
208 client->token = Token;
209 if( Modes ) Client_SetModes( client, Modes );
210 if( Type == CLIENT_SERVER ) Generate_MyToken( client );
212 if( strchr( client->modes, 'a' ))
213 strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away ));
216 client->next = (POINTER *)My_Clients;
219 /* Adjust counters */
220 Adjust_Counters( client );
223 } /* Init_New_Client */
227 Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
229 /* Client entfernen. */
232 char msg[LINE_LEN], *txt;
234 assert( Client != NULL );
236 if( LogMsg ) txt = LogMsg;
238 if( ! txt ) txt = "Reason unknown.";
240 /* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */
241 if( Client->type == CLIENT_SERVER ) {
242 strlcpy(msg, This_Server->id, sizeof (msg));
243 strlcat(msg, " ", sizeof (msg));
244 strlcat(msg, Client->id, sizeof (msg));
251 if(( Client->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c != Client ))
253 /* der Client, der geloescht wird ist ein Server. Der Client, den wir gerade
254 * pruefen, ist ein Child von diesem und muss daher auch entfernt werden */
255 Client_Destroy( c, NULL, msg, false );
262 /* Wir haben den Client gefunden: entfernen */
263 if( last ) last->next = c->next;
264 else My_Clients = (CLIENT *)c->next;
266 if(c->type == CLIENT_USER || c->type == CLIENT_SERVICE)
267 Destroy_UserOrService(c, txt, FwdMsg, SendQuit);
268 else if( c->type == CLIENT_SERVER )
270 if( c != This_Server )
272 if( c->conn_id != NONE ) Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
273 else Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered: %s", c->id, txt );
276 /* andere Server informieren */
277 if( ! NGIRCd_SignalQuit )
279 if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg );
280 else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :", c->id );
285 if( c->conn_id != NONE )
287 if( c->id[0] ) Log( LOG_NOTICE, "Client \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
288 else Log( LOG_NOTICE, "Client unregistered (connection %d): %s", c->conn_id, txt );
290 Log(LOG_WARNING, "Unregistered unknown client \"%s\": %s",
291 c->id[0] ? c->id : "(No Nick)", txt );
299 c = (CLIENT *)c->next;
301 } /* Client_Destroy */
305 Client_SetHostname( CLIENT *Client, char *Hostname )
307 /* Hostname eines Clients setzen */
309 assert( Client != NULL );
310 assert( Hostname != NULL );
312 strlcpy( Client->host, Hostname, sizeof( Client->host ));
313 } /* Client_SetHostname */
317 Client_SetID( CLIENT *Client, char *ID )
319 /* Hostname eines Clients setzen, Hash-Wert berechnen */
321 assert( Client != NULL );
322 assert( ID != NULL );
324 strlcpy( Client->id, ID, sizeof( Client->id ));
327 Client->hash = Hash( Client->id );
332 Client_SetUser( CLIENT *Client, char *User, bool Idented )
334 /* Username eines Clients setzen */
336 assert( Client != NULL );
337 assert( User != NULL );
339 if( Idented ) strlcpy( Client->user, User, sizeof( Client->user ));
342 Client->user[0] = '~';
343 strlcpy( Client->user + 1, User, sizeof( Client->user ) - 1 );
345 } /* Client_SetUser */
349 Client_SetInfo( CLIENT *Client, char *Info )
351 /* Hostname eines Clients setzen */
353 assert( Client != NULL );
354 assert( Info != NULL );
356 strlcpy( Client->info, Info, sizeof( Client->info ));
357 } /* Client_SetInfo */
361 Client_SetModes( CLIENT *Client, char *Modes )
363 /* Modes eines Clients setzen */
365 assert( Client != NULL );
366 assert( Modes != NULL );
368 strlcpy( Client->modes, Modes, sizeof( Client->modes ));
369 } /* Client_SetModes */
373 Client_SetFlags( CLIENT *Client, char *Flags )
375 /* Flags eines Clients setzen */
377 assert( Client != NULL );
378 assert( Flags != NULL );
380 strlcpy( Client->flags, Flags, sizeof( Client->flags ));
381 } /* Client_SetFlags */
385 Client_SetPassword( CLIENT *Client, char *Pwd )
387 /* Von einem Client geliefertes Passwort */
389 assert( Client != NULL );
390 assert( Pwd != NULL );
392 strlcpy( Client->pwd, Pwd, sizeof( Client->pwd ));
393 } /* Client_SetPassword */
397 Client_SetAway( CLIENT *Client, char *Txt )
399 /* Set AWAY reason of client */
401 assert( Client != NULL );
402 assert( Txt != NULL );
404 strlcpy( Client->away, Txt, sizeof( Client->away ));
405 LogDebug("%s \"%s\" is away: %s", Client_TypeText(Client),
406 Client_Mask(Client), Txt);
407 } /* Client_SetAway */
411 Client_SetType( CLIENT *Client, int Type )
413 assert( Client != NULL );
415 if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
416 Adjust_Counters( Client );
417 } /* Client_SetType */
421 Client_SetHops( CLIENT *Client, int Hops )
423 assert( Client != NULL );
425 } /* Client_SetHops */
429 Client_SetToken( CLIENT *Client, int Token )
431 assert( Client != NULL );
432 Client->token = Token;
433 } /* Client_SetToken */
437 Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer )
439 assert( Client != NULL );
440 assert( Introducer != NULL );
441 Client->introducer = Introducer;
442 } /* Client_SetIntroducer */
446 Client_SetOperByMe( CLIENT *Client, bool OperByMe )
448 assert( Client != NULL );
449 Client->oper_by_me = OperByMe;
450 } /* Client_SetOperByMe */
454 Client_ModeAdd( CLIENT *Client, char Mode )
457 * If Client already alread had Mode, return false.
458 * If the Mode was newly set, return true.
463 assert( Client != NULL );
465 x[0] = Mode; x[1] = '\0';
466 if( ! strchr( Client->modes, x[0] ))
468 /* Client hat den Mode noch nicht -> setzen */
469 strlcat( Client->modes, x, sizeof( Client->modes ));
473 } /* Client_ModeAdd */
477 Client_ModeDel( CLIENT *Client, char Mode )
480 * If Mode was removed, return true.
481 * If Client did not have Mode, return false.
486 assert( Client != NULL );
488 x[0] = Mode; x[1] = '\0';
490 p = strchr( Client->modes, x[0] );
491 if( ! p ) return false;
493 /* Client has Mode -> delete */
500 } /* Client_ModeDel */
504 Client_Search( const char *Nick )
506 /* return Client-Structure that has the corresponding Nick.
507 * If none is found, return NULL.
510 char search_id[CLIENT_ID_LEN], *ptr;
514 assert( Nick != NULL );
516 /* copy Nick and truncate hostmask if necessary */
517 strlcpy( search_id, Nick, sizeof( search_id ));
518 ptr = strchr( search_id, '!' );
519 if( ptr ) *ptr = '\0';
521 search_hash = Hash( search_id );
526 if( c->hash == search_hash )
528 /* lt. Hash-Wert: Treffer! */
529 if( strcasecmp( c->id, search_id ) == 0 ) return c;
531 c = (CLIENT *)c->next;
534 } /* Client_Search */
538 Client_GetFromToken( CLIENT *Client, int Token )
540 /* Client-Struktur, die den entsprechenden Introducer (=Client)
541 * und das gegebene Token hat, liefern. Wird keine gefunden,
542 * so wird NULL geliefert. */
546 assert( Client != NULL );
552 if(( c->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c->token == Token )) return c;
553 c = (CLIENT *)c->next;
556 } /* Client_GetFromToken */
560 Client_Type( CLIENT *Client )
562 assert( Client != NULL );
568 Client_Conn( CLIENT *Client )
570 assert( Client != NULL );
571 return Client->conn_id;
576 Client_ID( CLIENT *Client )
578 assert( Client != NULL );
581 if(Client->type == CLIENT_USER)
582 assert(strlen(Client->id) < Conf_MaxNickLength);
585 if( Client->id[0] ) return Client->id;
591 Client_Info( CLIENT *Client )
593 assert( Client != NULL );
599 Client_User( CLIENT *Client )
601 assert( Client != NULL );
602 return Client->user[0] ? Client->user : "~";
607 Client_Hostname( CLIENT *Client )
609 assert( Client != NULL );
611 } /* Client_Hostname */
615 Client_Password( CLIENT *Client )
617 assert( Client != NULL );
619 } /* Client_Password */
623 Client_Modes( CLIENT *Client )
625 assert( Client != NULL );
626 return Client->modes;
631 Client_Flags( CLIENT *Client )
633 assert( Client != NULL );
634 return Client->flags;
639 Client_OperByMe( CLIENT *Client )
641 assert( Client != NULL );
642 return Client->oper_by_me;
643 } /* Client_OperByMe */
647 Client_Hops( CLIENT *Client )
649 assert( Client != NULL );
655 Client_Token( CLIENT *Client )
657 assert( Client != NULL );
658 return Client->token;
663 Client_MyToken( CLIENT *Client )
665 assert( Client != NULL );
666 return Client->mytoken;
667 } /* Client_MyToken */
671 Client_NextHop( CLIENT *Client )
675 assert( Client != NULL );
678 while( c->introducer && ( c->introducer != c ) && ( c->introducer != This_Server ))
682 } /* Client_NextHop */
686 Client_Mask( CLIENT *Client )
688 /* Client-"ID" liefern, wie sie z.B. fuer
689 * Prefixe benoetigt wird. */
691 assert( Client != NULL );
693 if( Client->type == CLIENT_SERVER ) return Client->id;
695 snprintf( GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host );
701 Client_Introducer( CLIENT *Client )
703 assert( Client != NULL );
704 return Client->introducer;
705 } /* Client_Introducer */
709 Client_TopServer( CLIENT *Client )
711 assert( Client != NULL );
712 return Client->topserver;
713 } /* Client_TopServer */
717 Client_HasMode( CLIENT *Client, char Mode )
719 assert( Client != NULL );
720 return strchr( Client->modes, Mode ) != NULL;
721 } /* Client_HasMode */
725 Client_Away( CLIENT *Client )
727 /* AWAY-Text liefern */
729 assert( Client != NULL );
735 Client_CheckNick( CLIENT *Client, char *Nick )
737 assert( Client != NULL );
738 assert( Nick != NULL );
740 if( ! Client_IsValidNick( Nick ))
742 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), Nick );
746 /* Nick bereits vergeben? */
747 if( Client_Search( Nick ))
749 /* den Nick gibt es bereits */
750 IRC_WriteStrClient( Client, ERR_NICKNAMEINUSE_MSG, Client_ID( Client ), Nick );
755 } /* Client_CheckNick */
759 Client_CheckID( CLIENT *Client, char *ID )
761 /* Nick ueberpruefen */
763 char str[COMMAND_LEN];
766 assert( Client != NULL );
767 assert( Client->conn_id > NONE );
768 assert( ID != NULL );
771 if( strlen( ID ) > CLIENT_ID_LEN )
773 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), ID );
777 /* ID bereits vergeben? */
781 if( strcasecmp( c->id, ID ) == 0 )
783 /* die Server-ID gibt es bereits */
784 snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID );
785 if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
786 else Log( LOG_ERR, "%s (via network)!", str );
787 Conn_Close( Client->conn_id, str, str, true);
790 c = (CLIENT *)c->next;
794 } /* Client_CheckID */
800 /* Ersten Client liefern. */
807 Client_Next( CLIENT *c )
809 /* Naechsten Client liefern. Existiert keiner,
810 * so wird NULL geliefert. */
813 return (CLIENT *)c->next;
818 Client_UserCount( void )
820 return Count( CLIENT_USER );
821 } /* Client_UserCount */
825 Client_ServiceCount( void )
827 return Count( CLIENT_SERVICE );;
828 } /* Client_ServiceCount */
832 Client_ServerCount( void )
834 return Count( CLIENT_SERVER );
835 } /* Client_ServerCount */
839 Client_MyUserCount( void )
841 return MyCount( CLIENT_USER );
842 } /* Client_MyUserCount */
846 Client_MyServiceCount( void )
848 return MyCount( CLIENT_SERVICE );
849 } /* Client_MyServiceCount */
853 Client_MyServerCount( void )
856 unsigned long cnt = 0;
861 if(( c->type == CLIENT_SERVER ) && ( c->hops == 1 )) cnt++;
862 c = (CLIENT *)c->next;
865 } /* Client_MyServerCount */
869 Client_OperCount( void )
872 unsigned long cnt = 0;
877 if( c && ( c->type == CLIENT_USER ) && ( strchr( c->modes, 'o' ))) cnt++;
878 c = (CLIENT *)c->next;
881 } /* Client_OperCount */
885 Client_UnknownCount( void )
888 unsigned long cnt = 0;
893 if( c && ( c->type != CLIENT_USER ) && ( c->type != CLIENT_SERVICE ) && ( c->type != CLIENT_SERVER )) cnt++;
894 c = (CLIENT *)c->next;
898 } /* Client_UnknownCount */
902 Client_MaxUserCount( void )
905 } /* Client_MaxUserCount */
909 Client_MyMaxUserCount( void )
912 } /* Client_MyMaxUserCount */
916 Client_IsValidNick( const char *Nick )
919 static const char goodchars[] = ";0123456789-";
921 assert( Nick != NULL );
923 if( Nick[0] == '#' ) return false;
924 if( strchr( goodchars, Nick[0] )) return false;
925 if( strlen( Nick ) >= Conf_MaxNickLength) return false;
930 if (( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false;
931 if ( *ptr > '}' ) return false;
936 } /* Client_IsValidNick */
940 * Return pointer to "My_Whowas" structure.
943 Client_GetWhowas( void )
946 } /* Client_GetWhowas */
949 * Return the index of the last used WHOWAS entry.
952 Client_GetLastWhowasIndex( void )
955 } /* Client_GetLastWhowasIndex */
959 * Get the start time of this client.
960 * The result is the start time in seconds since 1970-01-01, as reported
961 * by the C function time(NULL).
964 Client_StartTime(CLIENT *Client)
966 assert( Client != NULL );
967 return Client->starttime;
968 } /* Client_Uptime */
972 Count( CLIENT_TYPE Type )
975 unsigned long cnt = 0;
980 if( c->type == Type ) cnt++;
981 c = (CLIENT *)c->next;
988 MyCount( CLIENT_TYPE Type )
991 unsigned long cnt = 0;
996 if(( c->introducer == This_Server ) && ( c->type == Type )) cnt++;
997 c = (CLIENT *)c->next;
1004 New_Client_Struct( void )
1006 /* Neue CLIENT-Struktur pre-initialisieren */
1010 c = (CLIENT *)malloc( sizeof( CLIENT ));
1013 Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" );
1017 memset( c, 0, sizeof ( CLIENT ));
1019 c->type = CLIENT_UNKNOWN;
1021 c->oper_by_me = false;
1031 Generate_MyToken( CLIENT *Client )
1040 if( c->mytoken == token )
1042 /* Das Token wurde bereits vergeben */
1047 else c = (CLIENT *)c->next;
1049 Client->mytoken = token;
1050 Log( LOG_DEBUG, "Assigned token %d to server \"%s\".", token, Client->id );
1051 } /* Generate_MyToken */
1055 Adjust_Counters( CLIENT *Client )
1059 assert( Client != NULL );
1061 if( Client->type != CLIENT_USER ) return;
1063 if( Client->conn_id != NONE )
1065 /* Local connection */
1066 count = Client_MyUserCount( );
1067 if( count > My_Max_Users ) My_Max_Users = count;
1069 count = Client_UserCount( );
1070 if( count > Max_Users ) Max_Users = count;
1071 } /* Adjust_Counters */
1075 * Register client in My_Whowas structure for further recall by WHOWAS.
1076 * Note: Only clients that have been connected at least 30 seconds will be
1077 * registered to prevent automated IRC bots to "destroy" a nice server
1081 Client_RegisterWhowas( CLIENT *Client )
1086 assert( Client != NULL );
1089 /* Don't register clients that were connected less than 30 seconds. */
1090 if( now - Client->starttime < 30 )
1093 slot = Last_Whowas + 1;
1094 if( slot >= MAX_WHOWAS || slot < 0 ) slot = 0;
1097 Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot );
1100 My_Whowas[slot].time = now;
1101 strlcpy( My_Whowas[slot].id, Client_ID( Client ),
1102 sizeof( My_Whowas[slot].id ));
1103 strlcpy( My_Whowas[slot].user, Client_User( Client ),
1104 sizeof( My_Whowas[slot].user ));
1105 strlcpy( My_Whowas[slot].host, Client_Hostname( Client ),
1106 sizeof( My_Whowas[slot].host ));
1107 strlcpy( My_Whowas[slot].info, Client_Info( Client ),
1108 sizeof( My_Whowas[slot].info ));
1109 strlcpy( My_Whowas[slot].server, Client_ID( Client_Introducer( Client )),
1110 sizeof( My_Whowas[slot].server ));
1113 } /* Client_RegisterWhowas */
1117 Client_TypeText(CLIENT *Client)
1119 assert(Client != NULL);
1120 switch (Client_Type(Client)) {
1124 case CLIENT_SERVICE:
1133 } /* Client_TypeText */
1137 * Destroy user or service client.
1140 Destroy_UserOrService(CLIENT *Client, char *Txt, char *FwdMsg, bool SendQuit)
1142 if(Client->conn_id != NONE) {
1143 /* Local (directly connected) client */
1145 "%s \"%s\" unregistered (connection %d): %s",
1146 Client_TypeText(Client), Client_Mask(Client),
1147 Client->conn_id, Txt);
1150 /* Inforam all the other servers */
1152 IRC_WriteStrServersPrefix(NULL,
1153 Client, "QUIT :%s", FwdMsg );
1155 IRC_WriteStrServersPrefix(NULL,
1160 LogDebug("%s \"%s\" unregistered: %s",
1161 Client_TypeText(Client), Client_Mask(Client), Txt);
1164 /* Inform all the other servers, but the ones in the
1165 * direction we got the QUIT from */
1167 IRC_WriteStrServersPrefix(Client_NextHop(Client),
1168 Client, "QUIT :%s", FwdMsg );
1170 IRC_WriteStrServersPrefix(Client_NextHop(Client),
1175 /* Unregister client from channels */
1176 Channel_Quit(Client, FwdMsg ? FwdMsg : Client->id);
1178 /* Register client in My_Whowas structure */
1179 Client_RegisterWhowas(Client);
1180 } /* Destroy_UserOrService */