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 Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
406 } /* Client_SetAway */
410 Client_SetType( CLIENT *Client, int Type )
412 assert( Client != NULL );
414 if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
415 Adjust_Counters( Client );
416 } /* Client_SetType */
420 Client_SetHops( CLIENT *Client, int Hops )
422 assert( Client != NULL );
424 } /* Client_SetHops */
428 Client_SetToken( CLIENT *Client, int Token )
430 assert( Client != NULL );
431 Client->token = Token;
432 } /* Client_SetToken */
436 Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer )
438 assert( Client != NULL );
439 assert( Introducer != NULL );
440 Client->introducer = Introducer;
441 } /* Client_SetIntroducer */
445 Client_SetOperByMe( CLIENT *Client, bool OperByMe )
447 assert( Client != NULL );
448 Client->oper_by_me = OperByMe;
449 } /* Client_SetOperByMe */
453 Client_ModeAdd( CLIENT *Client, char Mode )
456 * If Client already alread had Mode, return false.
457 * If the Mode was newly set, return true.
462 assert( Client != NULL );
464 x[0] = Mode; x[1] = '\0';
465 if( ! strchr( Client->modes, x[0] ))
467 /* Client hat den Mode noch nicht -> setzen */
468 strlcat( Client->modes, x, sizeof( Client->modes ));
472 } /* Client_ModeAdd */
476 Client_ModeDel( CLIENT *Client, char Mode )
479 * If Mode was removed, return true.
480 * If Client did not have Mode, return false.
485 assert( Client != NULL );
487 x[0] = Mode; x[1] = '\0';
489 p = strchr( Client->modes, x[0] );
490 if( ! p ) return false;
492 /* Client has Mode -> delete */
499 } /* Client_ModeDel */
503 Client_Search( const char *Nick )
505 /* return Client-Structure that has the corresponding Nick.
506 * If none is found, return NULL.
509 char search_id[CLIENT_ID_LEN], *ptr;
513 assert( Nick != NULL );
515 /* copy Nick and truncate hostmask if necessary */
516 strlcpy( search_id, Nick, sizeof( search_id ));
517 ptr = strchr( search_id, '!' );
518 if( ptr ) *ptr = '\0';
520 search_hash = Hash( search_id );
525 if( c->hash == search_hash )
527 /* lt. Hash-Wert: Treffer! */
528 if( strcasecmp( c->id, search_id ) == 0 ) return c;
530 c = (CLIENT *)c->next;
533 } /* Client_Search */
537 Client_GetFromToken( CLIENT *Client, int Token )
539 /* Client-Struktur, die den entsprechenden Introducer (=Client)
540 * und das gegebene Token hat, liefern. Wird keine gefunden,
541 * so wird NULL geliefert. */
545 assert( Client != NULL );
551 if(( c->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c->token == Token )) return c;
552 c = (CLIENT *)c->next;
555 } /* Client_GetFromToken */
559 Client_Type( CLIENT *Client )
561 assert( Client != NULL );
567 Client_Conn( CLIENT *Client )
569 assert( Client != NULL );
570 return Client->conn_id;
575 Client_ID( CLIENT *Client )
577 assert( Client != NULL );
580 if(Client->type == CLIENT_USER)
581 assert(strlen(Client->id) < Conf_MaxNickLength);
584 if( Client->id[0] ) return Client->id;
590 Client_Info( CLIENT *Client )
592 assert( Client != NULL );
598 Client_User( CLIENT *Client )
600 assert( Client != NULL );
601 return Client->user[0] ? Client->user : "~";
606 Client_Hostname( CLIENT *Client )
608 assert( Client != NULL );
610 } /* Client_Hostname */
614 Client_Password( CLIENT *Client )
616 assert( Client != NULL );
618 } /* Client_Password */
622 Client_Modes( CLIENT *Client )
624 assert( Client != NULL );
625 return Client->modes;
630 Client_Flags( CLIENT *Client )
632 assert( Client != NULL );
633 return Client->flags;
638 Client_OperByMe( CLIENT *Client )
640 assert( Client != NULL );
641 return Client->oper_by_me;
642 } /* Client_OperByMe */
646 Client_Hops( CLIENT *Client )
648 assert( Client != NULL );
654 Client_Token( CLIENT *Client )
656 assert( Client != NULL );
657 return Client->token;
662 Client_MyToken( CLIENT *Client )
664 assert( Client != NULL );
665 return Client->mytoken;
666 } /* Client_MyToken */
670 Client_NextHop( CLIENT *Client )
674 assert( Client != NULL );
677 while( c->introducer && ( c->introducer != c ) && ( c->introducer != This_Server ))
681 } /* Client_NextHop */
685 Client_Mask( CLIENT *Client )
687 /* Client-"ID" liefern, wie sie z.B. fuer
688 * Prefixe benoetigt wird. */
690 assert( Client != NULL );
692 if( Client->type == CLIENT_SERVER ) return Client->id;
694 snprintf( GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host );
700 Client_Introducer( CLIENT *Client )
702 assert( Client != NULL );
703 return Client->introducer;
704 } /* Client_Introducer */
708 Client_TopServer( CLIENT *Client )
710 assert( Client != NULL );
711 return Client->topserver;
712 } /* Client_TopServer */
716 Client_HasMode( CLIENT *Client, char Mode )
718 assert( Client != NULL );
719 return strchr( Client->modes, Mode ) != NULL;
720 } /* Client_HasMode */
724 Client_Away( CLIENT *Client )
726 /* AWAY-Text liefern */
728 assert( Client != NULL );
734 Client_CheckNick( CLIENT *Client, char *Nick )
736 assert( Client != NULL );
737 assert( Nick != NULL );
739 if( ! Client_IsValidNick( Nick ))
741 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), Nick );
745 /* Nick bereits vergeben? */
746 if( Client_Search( Nick ))
748 /* den Nick gibt es bereits */
749 IRC_WriteStrClient( Client, ERR_NICKNAMEINUSE_MSG, Client_ID( Client ), Nick );
754 } /* Client_CheckNick */
758 Client_CheckID( CLIENT *Client, char *ID )
760 /* Nick ueberpruefen */
762 char str[COMMAND_LEN];
765 assert( Client != NULL );
766 assert( Client->conn_id > NONE );
767 assert( ID != NULL );
770 if( strlen( ID ) > CLIENT_ID_LEN )
772 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), ID );
776 /* ID bereits vergeben? */
780 if( strcasecmp( c->id, ID ) == 0 )
782 /* die Server-ID gibt es bereits */
783 snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID );
784 if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
785 else Log( LOG_ERR, "%s (via network)!", str );
786 Conn_Close( Client->conn_id, str, str, true);
789 c = (CLIENT *)c->next;
793 } /* Client_CheckID */
799 /* Ersten Client liefern. */
806 Client_Next( CLIENT *c )
808 /* Naechsten Client liefern. Existiert keiner,
809 * so wird NULL geliefert. */
812 return (CLIENT *)c->next;
817 Client_UserCount( void )
819 return Count( CLIENT_USER );
820 } /* Client_UserCount */
824 Client_ServiceCount( void )
826 return Count( CLIENT_SERVICE );;
827 } /* Client_ServiceCount */
831 Client_ServerCount( void )
833 return Count( CLIENT_SERVER );
834 } /* Client_ServerCount */
838 Client_MyUserCount( void )
840 return MyCount( CLIENT_USER );
841 } /* Client_MyUserCount */
845 Client_MyServiceCount( void )
847 return MyCount( CLIENT_SERVICE );
848 } /* Client_MyServiceCount */
852 Client_MyServerCount( void )
855 unsigned long cnt = 0;
860 if(( c->type == CLIENT_SERVER ) && ( c->hops == 1 )) cnt++;
861 c = (CLIENT *)c->next;
864 } /* Client_MyServerCount */
868 Client_OperCount( void )
871 unsigned long cnt = 0;
876 if( c && ( c->type == CLIENT_USER ) && ( strchr( c->modes, 'o' ))) cnt++;
877 c = (CLIENT *)c->next;
880 } /* Client_OperCount */
884 Client_UnknownCount( void )
887 unsigned long cnt = 0;
892 if( c && ( c->type != CLIENT_USER ) && ( c->type != CLIENT_SERVICE ) && ( c->type != CLIENT_SERVER )) cnt++;
893 c = (CLIENT *)c->next;
897 } /* Client_UnknownCount */
901 Client_MaxUserCount( void )
904 } /* Client_MaxUserCount */
908 Client_MyMaxUserCount( void )
911 } /* Client_MyMaxUserCount */
915 Client_IsValidNick( const char *Nick )
918 static const char goodchars[] = ";0123456789-";
920 assert( Nick != NULL );
922 if( Nick[0] == '#' ) return false;
923 if( strchr( goodchars, Nick[0] )) return false;
924 if( strlen( Nick ) >= Conf_MaxNickLength) return false;
929 if (( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false;
930 if ( *ptr > '}' ) return false;
935 } /* Client_IsValidNick */
939 * Return pointer to "My_Whowas" structure.
942 Client_GetWhowas( void )
945 } /* Client_GetWhowas */
948 * Return the index of the last used WHOWAS entry.
951 Client_GetLastWhowasIndex( void )
954 } /* Client_GetLastWhowasIndex */
958 * Get the start time of this client.
959 * The result is the start time in seconds since 1970-01-01, as reported
960 * by the C function time(NULL).
963 Client_StartTime(CLIENT *Client)
965 assert( Client != NULL );
966 return Client->starttime;
967 } /* Client_Uptime */
971 Count( CLIENT_TYPE Type )
974 unsigned long cnt = 0;
979 if( c->type == Type ) cnt++;
980 c = (CLIENT *)c->next;
987 MyCount( CLIENT_TYPE Type )
990 unsigned long cnt = 0;
995 if(( c->introducer == This_Server ) && ( c->type == Type )) cnt++;
996 c = (CLIENT *)c->next;
1003 New_Client_Struct( void )
1005 /* Neue CLIENT-Struktur pre-initialisieren */
1009 c = (CLIENT *)malloc( sizeof( CLIENT ));
1012 Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" );
1016 memset( c, 0, sizeof ( CLIENT ));
1018 c->type = CLIENT_UNKNOWN;
1020 c->oper_by_me = false;
1030 Generate_MyToken( CLIENT *Client )
1039 if( c->mytoken == token )
1041 /* Das Token wurde bereits vergeben */
1046 else c = (CLIENT *)c->next;
1048 Client->mytoken = token;
1049 Log( LOG_DEBUG, "Assigned token %d to server \"%s\".", token, Client->id );
1050 } /* Generate_MyToken */
1054 Adjust_Counters( CLIENT *Client )
1058 assert( Client != NULL );
1060 if( Client->type != CLIENT_USER ) return;
1062 if( Client->conn_id != NONE )
1064 /* Local connection */
1065 count = Client_MyUserCount( );
1066 if( count > My_Max_Users ) My_Max_Users = count;
1068 count = Client_UserCount( );
1069 if( count > Max_Users ) Max_Users = count;
1070 } /* Adjust_Counters */
1074 * Register client in My_Whowas structure for further recall by WHOWAS.
1075 * Note: Only clients that have been connected at least 30 seconds will be
1076 * registered to prevent automated IRC bots to "destroy" a nice server
1080 Client_RegisterWhowas( CLIENT *Client )
1085 assert( Client != NULL );
1088 /* Don't register clients that were connected less than 30 seconds. */
1089 if( now - Client->starttime < 30 )
1092 slot = Last_Whowas + 1;
1093 if( slot >= MAX_WHOWAS || slot < 0 ) slot = 0;
1096 Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot );
1099 My_Whowas[slot].time = now;
1100 strlcpy( My_Whowas[slot].id, Client_ID( Client ),
1101 sizeof( My_Whowas[slot].id ));
1102 strlcpy( My_Whowas[slot].user, Client_User( Client ),
1103 sizeof( My_Whowas[slot].user ));
1104 strlcpy( My_Whowas[slot].host, Client_Hostname( Client ),
1105 sizeof( My_Whowas[slot].host ));
1106 strlcpy( My_Whowas[slot].info, Client_Info( Client ),
1107 sizeof( My_Whowas[slot].info ));
1108 strlcpy( My_Whowas[slot].server, Client_ID( Client_Introducer( Client )),
1109 sizeof( My_Whowas[slot].server ));
1112 } /* Client_RegisterWhowas */
1116 Client_TypeText(CLIENT *Client)
1118 assert(Client != NULL);
1119 switch (Client_Type(Client)) {
1123 case CLIENT_SERVICE:
1132 } /* Client_TypeText */
1136 * Destroy user or service client.
1139 Destroy_UserOrService(CLIENT *Client, char *Txt, char *FwdMsg, bool SendQuit)
1141 if(Client->conn_id != NONE) {
1142 /* Local (directly connected) client */
1144 "%s \"%s\" unregistered (connection %d): %s",
1145 Client_TypeText(Client), Client_Mask(Client),
1146 Client->conn_id, Txt);
1149 /* Inforam all the other servers */
1151 IRC_WriteStrServersPrefix(NULL,
1152 Client, "QUIT :%s", FwdMsg );
1154 IRC_WriteStrServersPrefix(NULL,
1159 LogDebug("%s \"%s\" unregistered: %s",
1160 Client_TypeText(Client), Client_Mask(Client), Txt);
1163 /* Inform all the other servers, but the ones in the
1164 * direction we got the QUIT from */
1166 IRC_WriteStrServersPrefix(Client_NextHop(Client),
1167 Client, "QUIT :%s", FwdMsg );
1169 IRC_WriteStrServersPrefix(Client_NextHop(Client),
1174 /* Unregister client from channels */
1175 Channel_Quit(Client, FwdMsg ? FwdMsg : Client->id);
1177 /* Register client in My_Whowas structure */
1178 Client_RegisterWhowas(Client);
1179 } /* Destroy_UserOrService */