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