]> arthur.barton.de Git - ngircd.git/blob - src/ngircd/irc-login.c
Version 0.7.7
[ngircd.git] / src / ngircd / irc-login.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
4  *
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.
10  *
11  * Login and logout
12  */
13
14
15 #include "portab.h"
16
17 static char UNUSED id[] = "$Id: irc-login.c,v 1.34.2.3 2004/02/04 20:04:54 alex Exp $";
18
19 #include "imp.h"
20 #include <assert.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24
25 #include "ngircd.h"
26 #include "resolve.h"
27 #include "conn-func.h"
28 #include "conf.h"
29 #include "client.h"
30 #include "channel.h"
31 #include "log.h"
32 #include "messages.h"
33 #include "parse.h"
34 #include "irc.h"
35 #include "irc-info.h"
36 #include "irc-write.h"
37 #include "cvs-version.h"
38
39 #include "exp.h"
40 #include "irc-login.h"
41
42
43 LOCAL BOOLEAN Hello_User PARAMS(( CLIENT *Client ));
44 LOCAL VOID Kill_Nick PARAMS(( CHAR *Nick, CHAR *Reason ));
45
46
47 GLOBAL BOOLEAN
48 IRC_PASS( CLIENT *Client, REQUEST *Req )
49 {
50         assert( Client != NULL );
51         assert( Req != NULL );
52
53         /* Fehler liefern, wenn kein lokaler Client */
54         if( Client_Conn( Client ) <= NONE ) return IRC_WriteStrClient( Client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( Client ), Req->command );
55         
56         if(( Client_Type( Client ) == CLIENT_UNKNOWN ) && ( Req->argc == 1))
57         {
58                 /* noch nicht registrierte unbekannte Verbindung */
59                 Log( LOG_DEBUG, "Connection %d: got PASS command ...", Client_Conn( Client ));
60
61                 /* Passwort speichern */
62                 Client_SetPassword( Client, Req->argv[0] );
63
64                 Client_SetType( Client, CLIENT_GOTPASS );
65                 return CONNECTED;
66         }
67         else if((( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER )) && (( Req->argc == 3 ) || ( Req->argc == 4 )))
68         {
69                 CHAR c2, c4, *type, *impl, *serverver, *flags, *ptr, *ircflags;
70                 INT protohigh, protolow;
71
72                 /* noch nicht registrierte Server-Verbindung */
73                 Log( LOG_DEBUG, "Connection %d: got PASS command (new server link) ...", Client_Conn( Client ));
74
75                 /* Passwort speichern */
76                 Client_SetPassword( Client, Req->argv[0] );
77
78                 /* Protokollversion ermitteln */
79                 if( strlen( Req->argv[1] ) >= 4 )
80                 {
81                         c2 = Req->argv[1][2];
82                         c4 = Req->argv[1][4];
83
84                         Req->argv[1][4] = '\0';
85                         protolow = atoi( &Req->argv[1][2] );
86                         Req->argv[1][2] = '\0';
87                         protohigh = atoi( Req->argv[1] );
88                         
89                         Req->argv[1][2] = c2;
90                         Req->argv[1][4] = c4;
91                 }                       
92                 else protohigh = protolow = 0;
93
94                 /* Protokoll-Typ */
95                 if( strlen( Req->argv[1] ) > 4 ) type = &Req->argv[1][4];
96                 else type = NULL;
97
98                 /* IRC-Flags (nach RFC 2813) */
99                 if( Req->argc >= 4 ) ircflags = Req->argv[3];
100                 else ircflags = "";
101
102                 /* Implementation, Version und ngIRCd-Flags */
103                 impl = Req->argv[2];
104                 ptr = strchr( impl, '|' );
105                 if( ptr ) *ptr = '\0';
106
107                 if( type && ( strcmp( type, PROTOIRCPLUS ) == 0 ))
108                 {
109                         /* auf der anderen Seite laeuft ein Server, der
110                          * ebenfalls das IRC+-Protokoll versteht */
111                         serverver = ptr + 1;
112                         flags = strchr( serverver, ':' );
113                         if( flags )
114                         {
115                                 *flags = '\0';
116                                 flags++;
117                         }
118                         else flags = "";
119                         Log( LOG_INFO, "Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", impl, serverver, protohigh, protolow, flags );
120                 }
121                 else
122                 {
123                         /* auf der anderen Seite laeuft ein Server, der
124                          * nur das Originalprotokoll unterstuetzt */
125                         serverver = "";
126                         if( strchr( ircflags, 'Z' )) flags = "Z";
127                         else flags = "";
128                         Log( LOG_INFO, "Peer announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").", impl, protohigh, protolow, flags );
129                 }
130
131                 Client_SetType( Client, CLIENT_GOTPASSSERVER );
132                 Client_SetFlags( Client, flags );
133
134                 return CONNECTED;
135         }
136         else if(( Client_Type( Client ) == CLIENT_UNKNOWN  ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER ))
137         {
138                 /* Falsche Anzahl Parameter? */
139                 return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
140         }
141         else return IRC_WriteStrClient( Client, ERR_ALREADYREGISTRED_MSG, Client_ID( Client ));
142 } /* IRC_PASS */
143
144
145 GLOBAL BOOLEAN
146 IRC_NICK( CLIENT *Client, REQUEST *Req )
147 {
148         CLIENT *intr_c, *target, *c;
149         CHAR *modes;
150
151         assert( Client != NULL );
152         assert( Req != NULL );
153
154         /* Zumindest BitchX sendet NICK-USER in der falschen Reihenfolge. */
155 #ifndef STRICT_RFC
156         if( Client_Type( Client ) == CLIENT_UNKNOWN || Client_Type( Client ) == CLIENT_GOTPASS || Client_Type( Client ) == CLIENT_GOTNICK || Client_Type( Client ) == CLIENT_GOTUSER || Client_Type( Client ) == CLIENT_USER || ( Client_Type( Client ) == CLIENT_SERVER && Req->argc == 1 ))
157 #else
158         if( Client_Type( Client ) == CLIENT_UNKNOWN || Client_Type( Client ) == CLIENT_GOTPASS || Client_Type( Client ) == CLIENT_GOTNICK || Client_Type( Client ) == CLIENT_USER || ( Client_Type( Client ) == CLIENT_SERVER && Req->argc == 1 ))
159 #endif
160         {
161                 /* User-Registrierung bzw. Nick-Aenderung */
162
163                 /* Falsche Anzahl Parameter? */
164                 if( Req->argc != 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
165
166                 /* "Ziel-Client" ermitteln */
167                 if( Client_Type( Client ) == CLIENT_SERVER )
168                 {
169                         target = Client_Search( Req->prefix );
170                         if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
171                 }
172                 else
173                 {
174                         /* Ist der Client "restricted"? */
175                         if( Client_HasMode( Client, 'r' )) return IRC_WriteStrClient( Client, ERR_RESTRICTED_MSG, Client_ID( Client ));
176                         target = Client;
177                 }
178
179 #ifndef STRICT_RFC
180                 /* Wenn der Client zu seinem eigenen Nick wechseln will, so machen
181                  * wir nichts. So macht es das Original und mind. Snak hat probleme,
182                  * wenn wir es nicht so machen. Ob es so okay ist? Hm ... */
183                 if( strcmp( Client_ID( target ), Req->argv[0] ) == 0 ) return CONNECTED;
184 #endif
185
186                 /* pruefen, ob Nick bereits vergeben. Speziallfall: der Client
187                  * will nur die Gross- und Kleinschreibung aendern. Das darf
188                  * er natuerlich machen :-) */
189                 if( strcasecmp( Client_ID( target ), Req->argv[0] ) != 0 )
190                 {
191                         if( ! Client_CheckNick( target, Req->argv[0] )) return CONNECTED;
192                 }
193
194                 if(( Client_Type( target ) != CLIENT_USER ) && ( Client_Type( target ) != CLIENT_SERVER ))
195                 {
196                         /* Neuer Client */
197                         Log( LOG_DEBUG, "Connection %d: got valid NICK command ...", Client_Conn( Client ));
198
199                         /* Client-Nick registrieren */
200                         Client_SetID( target, Req->argv[0] );
201
202                         /* schon ein USER da? Dann registrieren! */
203                         if( Client_Type( Client ) == CLIENT_GOTUSER ) return Hello_User( Client );
204                         else Client_SetType( Client, CLIENT_GOTNICK );
205                 }
206                 else
207                 {
208                         /* Nick-Aenderung */
209                         if( Client_Conn( target ) > NONE )
210                         {
211                                 /* lokaler Client */
212                                 Log( LOG_INFO, "User \"%s\" changed nick (connection %d): \"%s\" -> \"%s\".", Client_Mask( target ), Client_Conn( target ), Client_ID( target ), Req->argv[0] );
213                         }
214                         else
215                         {
216                                 /* Remote-Client */
217                                 Log( LOG_DEBUG, "User \"%s\" changed nick: \"%s\" -> \"%s\".", Client_Mask( target ), Client_ID( target ), Req->argv[0] );
218                         }
219
220                         /* alle betroffenen User und Server ueber Nick-Aenderung informieren */
221                         if( Client_Type( Client ) == CLIENT_USER ) IRC_WriteStrClientPrefix( Client, Client, "NICK :%s", Req->argv[0] );
222                         IRC_WriteStrServersPrefix( Client, target, "NICK :%s", Req->argv[0] );
223                         IRC_WriteStrRelatedPrefix( target, target, FALSE, "NICK :%s", Req->argv[0] );
224                         
225                         /* neuen Client-Nick speichern */
226                         Client_SetID( target, Req->argv[0] );
227                         IRC_SetPenalty( target, 2 );
228                 }
229
230                 return CONNECTED;
231         }
232         else if( Client_Type( Client ) == CLIENT_SERVER )
233         {
234                 /* Server fuehrt neuen Client ein */
235
236                 /* Falsche Anzahl Parameter? */
237                 if( Req->argc != 7 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
238
239                 /* Nick ueberpruefen */
240                 c = Client_Search( Req->argv[0] );
241                 if( c )
242                 {
243                         /* Der neue Nick ist auf diesem Server bereits registriert:
244                          * sowohl der neue, als auch der alte Client muessen nun
245                          * disconnectiert werden. */
246                         Log( LOG_ERR, "Server %s introduces already registered nick \"%s\"!", Client_ID( Client ), Req->argv[0] );
247                         Kill_Nick( Req->argv[0], "Nick collision" );
248                         return CONNECTED;
249                 }
250
251                 /* Server, zu dem der Client connectiert ist, suchen */
252                 intr_c = Client_GetFromToken( Client, atoi( Req->argv[4] ));
253                 if( ! intr_c )
254                 {
255                         Log( LOG_ERR, "Server %s introduces nick \"%s\" on unknown server!?", Client_ID( Client ), Req->argv[0] );
256                         Kill_Nick( Req->argv[0], "Unknown server" );
257                         return CONNECTED;
258                 }
259
260                 /* Neue Client-Struktur anlegen */
261                 c = Client_NewRemoteUser( intr_c, Req->argv[0], atoi( Req->argv[1] ), Req->argv[2], Req->argv[3], atoi( Req->argv[4] ), Req->argv[5] + 1, Req->argv[6], TRUE );
262                 if( ! c )
263                 {
264                         /* Eine neue Client-Struktur konnte nicht angelegt werden.
265                          * Der Client muss disconnectiert werden, damit der Netz-
266                          * status konsistent bleibt. */
267                         Log( LOG_ALERT, "Can't create client structure! (on connection %d)", Client_Conn( Client ));
268                         Kill_Nick( Req->argv[0], "Server error" );
269                         return CONNECTED;
270                 }
271
272                 modes = Client_Modes( c );
273                 if( *modes ) Log( LOG_DEBUG, "User \"%s\" (+%s) registered (via %s, on %s, %d hop%s).", Client_Mask( c ), modes, Client_ID( Client ), Client_ID( intr_c ), Client_Hops( c ), Client_Hops( c ) > 1 ? "s": "" );
274                 else Log( LOG_DEBUG, "User \"%s\" registered (via %s, on %s, %d hop%s).", Client_Mask( c ), Client_ID( Client ), Client_ID( intr_c ), Client_Hops( c ), Client_Hops( c ) > 1 ? "s": "" );
275
276                 /* Andere Server, ausser dem Introducer, informieren */
277                 IRC_WriteStrServersPrefix( Client, Client, "NICK %s %d %s %s %d %s :%s", Req->argv[0], atoi( Req->argv[1] ) + 1, Req->argv[2], Req->argv[3], Client_MyToken( intr_c ), Req->argv[5], Req->argv[6] );
278
279                 return CONNECTED;
280         }
281         else return IRC_WriteStrClient( Client, ERR_ALREADYREGISTRED_MSG, Client_ID( Client ));
282 } /* IRC_NICK */
283
284
285 GLOBAL BOOLEAN
286 IRC_USER( CLIENT *Client, REQUEST *Req )
287 {
288         assert( Client != NULL );
289         assert( Req != NULL );
290
291 #ifndef STRICT_RFC
292         if( Client_Type( Client ) == CLIENT_GOTNICK || Client_Type( Client ) == CLIENT_GOTPASS || Client_Type( Client ) == CLIENT_UNKNOWN )
293 #else
294         if( Client_Type( Client ) == CLIENT_GOTNICK || Client_Type( Client ) == CLIENT_GOTPASS )
295 #endif
296         {
297                 /* Wrong number of parameters? */
298                 if( Req->argc != 4 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
299
300                 /* User name */
301                 Client_SetUser( Client, Req->argv[0], FALSE );
302
303                 /* "Real name" or user info text: Don't set it to the empty
304                  * string, the original ircd can't deal with such "real names"
305                  * (e. g. "USER user * * :") ... */
306                 if( *Req->argv[3] ) Client_SetInfo( Client, Req->argv[3] );
307                 else Client_SetInfo( Client, "-" );
308
309                 Log( LOG_DEBUG, "Connection %d: got valid USER command ...", Client_Conn( Client ));
310                 if( Client_Type( Client ) == CLIENT_GOTNICK ) return Hello_User( Client );
311                 else Client_SetType( Client, CLIENT_GOTUSER );
312                 return CONNECTED;
313         }
314         else if( Client_Type( Client ) == CLIENT_USER || Client_Type( Client ) == CLIENT_SERVER || Client_Type( Client ) == CLIENT_SERVICE )
315         {
316                 return IRC_WriteStrClient( Client, ERR_ALREADYREGISTRED_MSG, Client_ID( Client ));
317         }
318         else return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
319 } /* IRC_USER */
320
321
322 GLOBAL BOOLEAN
323 IRC_QUIT( CLIENT *Client, REQUEST *Req )
324 {
325         CLIENT *target;
326         
327         assert( Client != NULL );
328         assert( Req != NULL );
329
330         if ( Client_Type( Client ) == CLIENT_SERVER )
331         {
332                 /* Server */
333
334                 /* Falsche Anzahl Parameter? */
335                 if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
336
337                 target = Client_Search( Req->prefix );
338                 if( ! target )
339                 {
340                         /* Den Client kennen wir nicht (mehr), also nichts zu tun. */
341                         Log( LOG_WARNING, "Got QUIT from %s for unknown client!?", Client_ID( Client ));
342                         return CONNECTED;
343                 }
344
345                 if( Req->argc == 0 ) Client_Destroy( target, "Got QUIT command.", NULL, TRUE );
346                 else Client_Destroy( target, "Got QUIT command.", Req->argv[0], TRUE );
347
348                 return CONNECTED;
349         }
350         else
351         {
352                 /* User, Service, oder noch nicht registriert */
353                 
354                 /* Falsche Anzahl Parameter? */
355                 if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
356
357                 if( Req->argc == 0 ) Conn_Close( Client_Conn( Client ), "Got QUIT command.", NULL, TRUE );
358                 else Conn_Close( Client_Conn( Client ), "Got QUIT command.", Req->argv[0], TRUE );
359                 
360                 return DISCONNECTED;
361         }
362 } /* IRC_QUIT */
363
364
365 GLOBAL BOOLEAN
366 IRC_PING( CLIENT *Client, REQUEST *Req )
367 {
368         CLIENT *target, *from;
369
370         assert( Client != NULL );
371         assert( Req != NULL );
372
373         /* Falsche Anzahl Parameter? */
374         if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
375 #ifdef STRICT_RFC
376         if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
377 #endif
378
379         if( Req->argc > 1 )
380         {
381                 /* es wurde ein Ziel-Client angegeben */
382                 target = Client_Search( Req->argv[1] );
383                 if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
384                 if( target != Client_ThisServer( ))
385                 {
386                         /* ok, forwarden */
387                         if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
388                         else from = Client;
389                         if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
390                         return IRC_WriteStrClientPrefix( target, from, "PING %s :%s", Client_ID( from ), Req->argv[1] );
391                 }
392         }
393
394         Log( LOG_DEBUG, "Connection %d: got PING, sending PONG ...", Client_Conn( Client ));
395         return IRC_WriteStrClient( Client, "PONG %s :%s", Client_ID( Client_ThisServer( )), Client_ID( Client ));
396 } /* IRC_PING */
397
398
399 GLOBAL BOOLEAN
400 IRC_PONG( CLIENT *Client, REQUEST *Req )
401 {
402         CLIENT *target, *from;
403
404         assert( Client != NULL );
405         assert( Req != NULL );
406
407         /* Falsche Anzahl Parameter? */
408         if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
409         if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
410
411         /* forwarden? */
412         if( Req->argc == 2 )
413         {
414                 target = Client_Search( Req->argv[1] );
415                 if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
416                 if( target != Client_ThisServer( ))
417                 {
418                         /* ok, forwarden */
419                         if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
420                         else from = Client;
421                         if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
422                         return IRC_WriteStrClientPrefix( target, from, "PONG %s :%s", Client_ID( from ), Req->argv[1] );
423                 }
424         }
425
426         /* Der Connection-Timestamp wurde schon beim Lesen aus dem Socket
427          * aktualisiert, daher muss das hier nicht mehr gemacht werden. */
428
429         if( Client_Conn( Client ) > NONE ) Log( LOG_DEBUG, "Connection %d: received PONG. Lag: %ld seconds.", Client_Conn( Client ), time( NULL ) - Conn_LastPing( Client_Conn( Client )));
430         else Log( LOG_DEBUG, "Connection %d: received PONG.", Client_Conn( Client ));
431
432         return CONNECTED;
433 } /* IRC_PONG */
434
435
436 LOCAL BOOLEAN
437 Hello_User( CLIENT *Client )
438 {
439 #ifdef CVSDATE
440         CHAR ver[12], vertxt[30];
441 #endif
442
443         assert( Client != NULL );
444
445         /* Check password ... */
446         if( strcmp( Client_Password( Client ), Conf_ServerPwd ) != 0 )
447         {
448                 /* Bad password! */
449                 Log( LOG_ERR, "User \"%s\" rejected (connection %d): Bad password!", Client_Mask( Client ), Client_Conn( Client ));
450                 Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE );
451                 return DISCONNECTED;
452         }
453
454         Log( LOG_NOTICE, "User \"%s\" registered (connection %d).", Client_Mask( Client ), Client_Conn( Client ));
455
456         /* Inform other servers */
457         IRC_WriteStrServers( NULL, "NICK %s 1 %s %s 1 +%s :%s", Client_ID( Client ), Client_User( Client ), Client_Hostname( Client ), Client_Modes( Client ), Client_Info( Client ));
458
459         /* Welcome :-) */
460         if( ! IRC_WriteStrClient( Client, RPL_WELCOME_MSG, Client_ID( Client ), Client_Mask( Client ))) return FALSE;
461
462         /* Version and system type */
463 #ifdef CVSDATE
464         strlcpy( ver, CVSDATE, sizeof( ver ));
465         strncpy( ver + 4, ver + 5, 2 );
466         strncpy( ver + 6, ver + 8, 3 );
467         snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver );
468         if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE;
469 #else
470         if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE;
471 #endif
472
473         if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE;
474 #ifdef CVSDATE
475         if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, USERMODES, CHANMODES )) return FALSE;  
476 #else
477         if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return FALSE;
478 #endif
479
480         /* Features */
481         if( ! IRC_WriteStrClient( Client, RPL_ISUPPORT_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1, CHANNEL_TOPIC_LEN - 1, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;
482
483         Client_SetType( Client, CLIENT_USER );
484
485         if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED;
486         if( ! IRC_Show_MOTD( Client )) return DISCONNECTED;
487
488         /* Suspend the client for a second ... */
489         IRC_SetPenalty( Client, 1 );
490
491         return CONNECTED;
492 } /* Hello_User */
493
494
495 LOCAL VOID
496 Kill_Nick( CHAR *Nick, CHAR *Reason )
497 {
498         REQUEST r;
499
500         assert( Nick != NULL );
501         assert( Reason != NULL );
502
503         r.prefix = Client_ThisServer( );
504         r.argv[0] = Nick;
505         r.argv[1] = Reason;
506         r.argc = 2;
507
508         Log( LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s", Nick, Reason );
509         IRC_KILL( Client_ThisServer( ), &r );
510 } /* Kill_Nick */
511
512
513 /* -eof- */