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, const char *ID,
68 const char *User, const char *Hostname, const char *Info,
69 int Hops, int Token, const char *Modes,
72 static void Destroy_UserOrService PARAMS((CLIENT *Client,const char *Txt, const 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, const 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, const char *Hostname, CLIENT *TopServer,
158 int Hops, int Token, const 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, const char *Nick, int Hops, const char *User,
171 const char *Hostname, int Token, const char *Modes, const 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, const char *ID, const char *User, const char *Hostname, const char *Info, int Hops,
186 int Token, const 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, const char *LogMsg, const char *FwdMsg, bool SendQuit )
229 /* Client entfernen. */
235 assert( Client != NULL );
237 if( LogMsg ) txt = LogMsg;
239 if( ! txt ) txt = "Reason unknown.";
241 /* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */
242 if( Client->type == CLIENT_SERVER ) {
243 strlcpy(msg, This_Server->id, sizeof (msg));
244 strlcat(msg, " ", sizeof (msg));
245 strlcat(msg, Client->id, sizeof (msg));
252 if(( Client->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c != Client ))
254 /* der Client, der geloescht wird ist ein Server. Der Client, den wir gerade
255 * pruefen, ist ein Child von diesem und muss daher auch entfernt werden */
256 Client_Destroy( c, NULL, msg, false );
263 /* Wir haben den Client gefunden: entfernen */
264 if( last ) last->next = c->next;
265 else My_Clients = (CLIENT *)c->next;
267 if(c->type == CLIENT_USER || c->type == CLIENT_SERVICE)
268 Destroy_UserOrService(c, txt, FwdMsg, SendQuit);
269 else if( c->type == CLIENT_SERVER )
271 if( c != This_Server )
273 if( c->conn_id != NONE ) Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
274 else Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered: %s", c->id, txt );
277 /* andere Server informieren */
278 if( ! NGIRCd_SignalQuit )
280 if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg );
281 else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :", c->id );
286 if( c->conn_id != NONE )
288 if( c->id[0] ) Log( LOG_NOTICE, "Client \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
289 else Log( LOG_NOTICE, "Client unregistered (connection %d): %s", c->conn_id, txt );
291 Log(LOG_WARNING, "Unregistered unknown client \"%s\": %s",
292 c->id[0] ? c->id : "(No Nick)", txt );
300 c = (CLIENT *)c->next;
302 } /* Client_Destroy */
306 Client_SetHostname( CLIENT *Client, const char *Hostname )
308 /* Hostname eines Clients setzen */
310 assert( Client != NULL );
311 assert( Hostname != NULL );
313 strlcpy( Client->host, Hostname, sizeof( Client->host ));
314 } /* Client_SetHostname */
318 Client_SetID( CLIENT *Client, const char *ID )
320 /* Hostname eines Clients setzen, Hash-Wert berechnen */
322 assert( Client != NULL );
323 assert( ID != NULL );
325 strlcpy( Client->id, ID, sizeof( Client->id ));
328 Client->hash = Hash( Client->id );
333 Client_SetUser( CLIENT *Client, const char *User, bool Idented )
335 /* Username eines Clients setzen */
337 assert( Client != NULL );
338 assert( User != NULL );
340 if( Idented ) strlcpy( Client->user, User, sizeof( Client->user ));
343 Client->user[0] = '~';
344 strlcpy( Client->user + 1, User, sizeof( Client->user ) - 1 );
346 } /* Client_SetUser */
350 Client_SetInfo( CLIENT *Client, const char *Info )
352 /* Hostname eines Clients setzen */
354 assert( Client != NULL );
355 assert( Info != NULL );
357 strlcpy( Client->info, Info, sizeof( Client->info ));
358 } /* Client_SetInfo */
362 Client_SetModes( CLIENT *Client, const char *Modes )
364 /* Modes eines Clients setzen */
366 assert( Client != NULL );
367 assert( Modes != NULL );
369 strlcpy( Client->modes, Modes, sizeof( Client->modes ));
370 } /* Client_SetModes */
374 Client_SetFlags( CLIENT *Client, const char *Flags )
376 /* Flags eines Clients setzen */
378 assert( Client != NULL );
379 assert( Flags != NULL );
381 strlcpy( Client->flags, Flags, sizeof( Client->flags ));
382 } /* Client_SetFlags */
386 Client_SetPassword( CLIENT *Client, const char *Pwd )
388 /* Von einem Client geliefertes Passwort */
390 assert( Client != NULL );
391 assert( Pwd != NULL );
393 strlcpy( Client->pwd, Pwd, sizeof( Client->pwd ));
394 } /* Client_SetPassword */
398 Client_SetAway( CLIENT *Client, const char *Txt )
400 /* Set AWAY reason of client */
402 assert( Client != NULL );
403 assert( Txt != NULL );
405 strlcpy( Client->away, Txt, sizeof( Client->away ));
406 LogDebug("%s \"%s\" is away: %s", Client_TypeText(Client),
407 Client_Mask(Client), Txt);
408 } /* Client_SetAway */
412 Client_SetType( CLIENT *Client, int Type )
414 assert( Client != NULL );
416 if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
417 Adjust_Counters( Client );
418 } /* Client_SetType */
422 Client_SetHops( CLIENT *Client, int Hops )
424 assert( Client != NULL );
426 } /* Client_SetHops */
430 Client_SetToken( CLIENT *Client, int Token )
432 assert( Client != NULL );
433 Client->token = Token;
434 } /* Client_SetToken */
438 Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer )
440 assert( Client != NULL );
441 assert( Introducer != NULL );
442 Client->introducer = Introducer;
443 } /* Client_SetIntroducer */
447 Client_SetOperByMe( CLIENT *Client, bool OperByMe )
449 assert( Client != NULL );
450 Client->oper_by_me = OperByMe;
451 } /* Client_SetOperByMe */
455 Client_ModeAdd( CLIENT *Client, char Mode )
458 * If Client already alread had Mode, return false.
459 * If the Mode was newly set, return true.
464 assert( Client != NULL );
466 x[0] = Mode; x[1] = '\0';
467 if( ! strchr( Client->modes, x[0] ))
469 /* Client hat den Mode noch nicht -> setzen */
470 strlcat( Client->modes, x, sizeof( Client->modes ));
474 } /* Client_ModeAdd */
478 Client_ModeDel( CLIENT *Client, char Mode )
481 * If Mode was removed, return true.
482 * If Client did not have Mode, return false.
487 assert( Client != NULL );
489 x[0] = Mode; x[1] = '\0';
491 p = strchr( Client->modes, x[0] );
492 if( ! p ) return false;
494 /* Client has Mode -> delete */
501 } /* Client_ModeDel */
505 Client_Search( const char *Nick )
507 /* return Client-Structure that has the corresponding Nick.
508 * If none is found, return NULL.
511 char search_id[CLIENT_ID_LEN], *ptr;
515 assert( Nick != NULL );
517 /* copy Nick and truncate hostmask if necessary */
518 strlcpy( search_id, Nick, sizeof( search_id ));
519 ptr = strchr( search_id, '!' );
520 if( ptr ) *ptr = '\0';
522 search_hash = Hash( search_id );
527 if( c->hash == search_hash )
529 /* lt. Hash-Wert: Treffer! */
530 if( strcasecmp( c->id, search_id ) == 0 ) return c;
532 c = (CLIENT *)c->next;
535 } /* Client_Search */
539 Client_GetFromToken( CLIENT *Client, int Token )
541 /* Client-Struktur, die den entsprechenden Introducer (=Client)
542 * und das gegebene Token hat, liefern. Wird keine gefunden,
543 * so wird NULL geliefert. */
547 assert( Client != NULL );
553 if(( c->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c->token == Token )) return c;
554 c = (CLIENT *)c->next;
557 } /* Client_GetFromToken */
561 Client_Type( CLIENT *Client )
563 assert( Client != NULL );
569 Client_Conn( CLIENT *Client )
571 assert( Client != NULL );
572 return Client->conn_id;
577 Client_ID( CLIENT *Client )
579 assert( Client != NULL );
582 if(Client->type == CLIENT_USER)
583 assert(strlen(Client->id) < Conf_MaxNickLength);
586 if( Client->id[0] ) return Client->id;
592 Client_Info( CLIENT *Client )
594 assert( Client != NULL );
600 Client_User( CLIENT *Client )
602 assert( Client != NULL );
603 return Client->user[0] ? Client->user : "~";
608 Client_Hostname( CLIENT *Client )
610 assert( Client != NULL );
612 } /* Client_Hostname */
616 Client_Password( CLIENT *Client )
618 assert( Client != NULL );
620 } /* Client_Password */
624 Client_Modes( CLIENT *Client )
626 assert( Client != NULL );
627 return Client->modes;
632 Client_Flags( CLIENT *Client )
634 assert( Client != NULL );
635 return Client->flags;
640 Client_OperByMe( CLIENT *Client )
642 assert( Client != NULL );
643 return Client->oper_by_me;
644 } /* Client_OperByMe */
648 Client_Hops( CLIENT *Client )
650 assert( Client != NULL );
656 Client_Token( CLIENT *Client )
658 assert( Client != NULL );
659 return Client->token;
664 Client_MyToken( CLIENT *Client )
666 assert( Client != NULL );
667 return Client->mytoken;
668 } /* Client_MyToken */
672 Client_NextHop( CLIENT *Client )
676 assert( Client != NULL );
679 while( c->introducer && ( c->introducer != c ) && ( c->introducer != This_Server ))
683 } /* Client_NextHop */
687 Client_Mask( CLIENT *Client )
689 /* Client-"ID" liefern, wie sie z.B. fuer
690 * Prefixe benoetigt wird. */
692 assert( Client != NULL );
694 if( Client->type == CLIENT_SERVER ) return Client->id;
696 snprintf( GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host );
702 Client_Introducer( CLIENT *Client )
704 assert( Client != NULL );
705 return Client->introducer;
706 } /* Client_Introducer */
710 Client_TopServer( CLIENT *Client )
712 assert( Client != NULL );
713 return Client->topserver;
714 } /* Client_TopServer */
718 Client_HasMode( CLIENT *Client, char Mode )
720 assert( Client != NULL );
721 return strchr( Client->modes, Mode ) != NULL;
722 } /* Client_HasMode */
726 Client_Away( CLIENT *Client )
728 /* AWAY-Text liefern */
730 assert( Client != NULL );
736 Client_CheckNick( CLIENT *Client, char *Nick )
738 assert( Client != NULL );
739 assert( Nick != NULL );
741 if( ! Client_IsValidNick( Nick ))
743 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), Nick );
747 /* Nick bereits vergeben? */
748 if( Client_Search( Nick ))
750 /* den Nick gibt es bereits */
751 IRC_WriteStrClient( Client, ERR_NICKNAMEINUSE_MSG, Client_ID( Client ), Nick );
756 } /* Client_CheckNick */
760 Client_CheckID( CLIENT *Client, char *ID )
762 /* Nick ueberpruefen */
764 char str[COMMAND_LEN];
767 assert( Client != NULL );
768 assert( Client->conn_id > NONE );
769 assert( ID != NULL );
772 if( strlen( ID ) > CLIENT_ID_LEN )
774 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), ID );
778 /* ID bereits vergeben? */
782 if( strcasecmp( c->id, ID ) == 0 )
784 /* die Server-ID gibt es bereits */
785 snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID );
786 if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
787 else Log( LOG_ERR, "%s (via network)!", str );
788 Conn_Close( Client->conn_id, str, str, true);
791 c = (CLIENT *)c->next;
795 } /* Client_CheckID */
801 /* Ersten Client liefern. */
808 Client_Next( CLIENT *c )
810 /* Naechsten Client liefern. Existiert keiner,
811 * so wird NULL geliefert. */
814 return (CLIENT *)c->next;
819 Client_UserCount( void )
821 return Count( CLIENT_USER );
822 } /* Client_UserCount */
826 Client_ServiceCount( void )
828 return Count( CLIENT_SERVICE );;
829 } /* Client_ServiceCount */
833 Client_ServerCount( void )
835 return Count( CLIENT_SERVER );
836 } /* Client_ServerCount */
840 Client_MyUserCount( void )
842 return MyCount( CLIENT_USER );
843 } /* Client_MyUserCount */
847 Client_MyServiceCount( void )
849 return MyCount( CLIENT_SERVICE );
850 } /* Client_MyServiceCount */
854 Client_MyServerCount( void )
857 unsigned long cnt = 0;
862 if(( c->type == CLIENT_SERVER ) && ( c->hops == 1 )) cnt++;
863 c = (CLIENT *)c->next;
866 } /* Client_MyServerCount */
870 Client_OperCount( void )
873 unsigned long cnt = 0;
878 if( c && ( c->type == CLIENT_USER ) && ( strchr( c->modes, 'o' ))) cnt++;
879 c = (CLIENT *)c->next;
882 } /* Client_OperCount */
886 Client_UnknownCount( void )
889 unsigned long cnt = 0;
894 if( c && ( c->type != CLIENT_USER ) && ( c->type != CLIENT_SERVICE ) && ( c->type != CLIENT_SERVER )) cnt++;
895 c = (CLIENT *)c->next;
899 } /* Client_UnknownCount */
903 Client_MaxUserCount( void )
906 } /* Client_MaxUserCount */
910 Client_MyMaxUserCount( void )
913 } /* Client_MyMaxUserCount */
917 Client_IsValidNick( const char *Nick )
920 static const char goodchars[] = ";0123456789-";
922 assert( Nick != NULL );
924 if( Nick[0] == '#' ) return false;
925 if( strchr( goodchars, Nick[0] )) return false;
926 if( strlen( Nick ) >= Conf_MaxNickLength) return false;
931 if (( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false;
932 if ( *ptr > '}' ) return false;
937 } /* Client_IsValidNick */
941 * Return pointer to "My_Whowas" structure.
944 Client_GetWhowas( void )
947 } /* Client_GetWhowas */
950 * Return the index of the last used WHOWAS entry.
953 Client_GetLastWhowasIndex( void )
956 } /* Client_GetLastWhowasIndex */
960 * Get the start time of this client.
961 * The result is the start time in seconds since 1970-01-01, as reported
962 * by the C function time(NULL).
965 Client_StartTime(CLIENT *Client)
967 assert( Client != NULL );
968 return Client->starttime;
969 } /* Client_Uptime */
973 Count( CLIENT_TYPE Type )
976 unsigned long cnt = 0;
981 if( c->type == Type ) cnt++;
982 c = (CLIENT *)c->next;
989 MyCount( CLIENT_TYPE Type )
992 unsigned long cnt = 0;
997 if(( c->introducer == This_Server ) && ( c->type == Type )) cnt++;
998 c = (CLIENT *)c->next;
1005 New_Client_Struct( void )
1007 /* Neue CLIENT-Struktur pre-initialisieren */
1011 c = (CLIENT *)malloc( sizeof( CLIENT ));
1014 Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" );
1018 memset( c, 0, sizeof ( CLIENT ));
1020 c->type = CLIENT_UNKNOWN;
1022 c->oper_by_me = false;
1032 Generate_MyToken( CLIENT *Client )
1041 if( c->mytoken == token )
1043 /* Das Token wurde bereits vergeben */
1048 else c = (CLIENT *)c->next;
1050 Client->mytoken = token;
1051 LogDebug("Assigned token %d to server \"%s\".", token, Client->id);
1052 } /* Generate_MyToken */
1056 Adjust_Counters( CLIENT *Client )
1060 assert( Client != NULL );
1062 if( Client->type != CLIENT_USER ) return;
1064 if( Client->conn_id != NONE )
1066 /* Local connection */
1067 count = Client_MyUserCount( );
1068 if( count > My_Max_Users ) My_Max_Users = count;
1070 count = Client_UserCount( );
1071 if( count > Max_Users ) Max_Users = count;
1072 } /* Adjust_Counters */
1076 * Register client in My_Whowas structure for further recall by WHOWAS.
1077 * Note: Only clients that have been connected at least 30 seconds will be
1078 * registered to prevent automated IRC bots to "destroy" a nice server
1082 Client_RegisterWhowas( CLIENT *Client )
1087 assert( Client != NULL );
1090 /* Don't register clients that were connected less than 30 seconds. */
1091 if( now - Client->starttime < 30 )
1094 slot = Last_Whowas + 1;
1095 if( slot >= MAX_WHOWAS || slot < 0 ) slot = 0;
1098 Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot );
1101 My_Whowas[slot].time = now;
1102 strlcpy( My_Whowas[slot].id, Client_ID( Client ),
1103 sizeof( My_Whowas[slot].id ));
1104 strlcpy( My_Whowas[slot].user, Client_User( Client ),
1105 sizeof( My_Whowas[slot].user ));
1106 strlcpy( My_Whowas[slot].host, Client_Hostname( Client ),
1107 sizeof( My_Whowas[slot].host ));
1108 strlcpy( My_Whowas[slot].info, Client_Info( Client ),
1109 sizeof( My_Whowas[slot].info ));
1110 strlcpy( My_Whowas[slot].server, Client_ID( Client_Introducer( Client )),
1111 sizeof( My_Whowas[slot].server ));
1114 } /* Client_RegisterWhowas */
1118 Client_TypeText(CLIENT *Client)
1120 assert(Client != NULL);
1121 switch (Client_Type(Client)) {
1125 case CLIENT_SERVICE:
1134 } /* Client_TypeText */
1138 * Destroy user or service client.
1141 Destroy_UserOrService(CLIENT *Client, const char *Txt, const char *FwdMsg, bool SendQuit)
1143 if(Client->conn_id != NONE) {
1144 /* Local (directly connected) client */
1146 "%s \"%s\" unregistered (connection %d): %s",
1147 Client_TypeText(Client), Client_Mask(Client),
1148 Client->conn_id, Txt);
1151 /* Inforam all the other servers */
1153 IRC_WriteStrServersPrefix(NULL,
1154 Client, "QUIT :%s", FwdMsg );
1156 IRC_WriteStrServersPrefix(NULL,
1161 LogDebug("%s \"%s\" unregistered: %s",
1162 Client_TypeText(Client), Client_Mask(Client), Txt);
1165 /* Inform all the other servers, but the ones in the
1166 * direction we got the QUIT from */
1168 IRC_WriteStrServersPrefix(Client_NextHop(Client),
1169 Client, "QUIT :%s", FwdMsg );
1171 IRC_WriteStrServersPrefix(Client_NextHop(Client),
1176 /* Unregister client from channels */
1177 Channel_Quit(Client, FwdMsg ? FwdMsg : Client->id);
1179 /* Register client in My_Whowas structure */
1180 Client_RegisterWhowas(Client);
1181 } /* Destroy_UserOrService */