2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors.
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.
26 #include "conn-func.h"
36 #include "irc-write.h"
39 #include "irc-login.h"
41 static void Kill_Nick PARAMS(( char *Nick, char *Reason ));
44 * Handler for the IRC "PASS" command.
46 * See RFC 2813 section 4.1.1, and RFC 2812 section 3.1.1.
48 * @param Client The client from which this command has been received.
49 * @param Req Request structure with prefix and all parameters.
50 * @returns CONNECTED or DISCONNECTED.
53 IRC_PASS( CLIENT *Client, REQUEST *Req )
55 char *type, *orig_flags;
56 int protohigh, protolow;
58 assert( Client != NULL );
59 assert( Req != NULL );
61 /* Return an error if this is not a local client */
62 if (Client_Conn(Client) <= NONE)
63 return IRC_WriteStrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
64 Client_ID(Client), Req->command);
66 if (Client_Type(Client) == CLIENT_UNKNOWN && Req->argc == 1) {
67 /* Not yet registered "unknown" connection, PASS with one
68 * argument: either a regular client, service, or server
69 * using the old RFC 1459 section 4.1.1 syntax. */
70 LogDebug("Connection %d: got PASS command (RFC 1459) ...",
72 } else if ((Client_Type(Client) == CLIENT_UNKNOWN ||
73 Client_Type(Client) == CLIENT_UNKNOWNSERVER) &&
74 (Req->argc == 3 || Req->argc == 4)) {
75 /* Not yet registered "unknown" connection or outgoing server
76 * link, PASS with three or four argument: server using the
77 * RFC 2813 section 4.1.1 syntax. */
78 LogDebug("Connection %d: got PASS command (RFC 2813, new server link) ...",
80 } else if (Client_Type(Client) == CLIENT_UNKNOWN ||
81 Client_Type(Client) == CLIENT_UNKNOWNSERVER) {
82 /* Unregistered connection, but wrong number of arguments: */
83 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
84 Client_ID(Client), Req->command);
86 /* Registered connection, PASS command is not allowed! */
87 return IRC_WriteStrClient(Client, ERR_ALREADYREGISTRED_MSG,
91 Conn_SetPassword(Client_Conn(Client), Req->argv[0]);
93 /* Protocol version */
94 if (Req->argc >= 2 && strlen(Req->argv[1]) >= 4) {
100 Req->argv[1][4] = '\0';
101 protolow = atoi(&Req->argv[1][2]);
102 Req->argv[1][2] = '\0';
103 protohigh = atoi(Req->argv[1]);
105 Req->argv[1][2] = c2;
106 Req->argv[1][4] = c4;
108 Client_SetType(Client, CLIENT_GOTPASS_2813);
110 protohigh = protolow = 0;
111 Client_SetType(Client, CLIENT_GOTPASS);
114 /* Protocol type, see doc/Protocol.txt */
115 if (Req->argc >= 2 && strlen(Req->argv[1]) > 4)
116 type = &Req->argv[1][4];
120 /* Protocol flags/options */
122 orig_flags = Req->argv[3];
126 /* Implementation, version and IRC+ flags */
127 if (Req->argc >= 3) {
128 char *impl, *ptr, *serverver, *flags;
131 ptr = strchr(impl, '|');
135 if (type && strcmp(type, PROTOIRCPLUS) == 0) {
136 /* The peer seems to be a server which supports the
137 * IRC+ protocol (see doc/Protocol.txt). */
138 serverver = ptr ? ptr + 1 : "?";
139 flags = strchr(ptr ? serverver : impl, ':');
146 "Peer on conenction %d announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").",
147 Client_Conn(Client), impl, serverver,
148 protohigh, protolow, flags);
150 /* The peer seems to be a server supporting the
151 * "original" IRC protocol (RFC 2813). */
152 if (strchr(orig_flags, 'Z'))
157 "Peer on connection %d announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").",
158 Client_Conn(Client), impl,
159 protohigh, protolow, flags);
161 Client_SetFlags(Client, flags);
169 * Handler for the IRC "NICK" command.
171 * See RFC 2812, 3.1.2 "Nick message", and RFC 2813, 4.1.3 "Nick".
173 * This function implements the IRC command "NICK" which is used to register
174 * with the server, to change already registered nicknames and to introduce
175 * new users which are connected to other servers.
177 * @param Client The client from which this command has been received.
178 * @param Req Request structure with prefix and all parameters.
179 * @returns CONNECTED or DISCONNECTED.
182 IRC_NICK( CLIENT *Client, REQUEST *Req )
184 CLIENT *intr_c, *target, *c;
185 char *nick, *user, *hostname, *modes, *info;
188 assert( Client != NULL );
189 assert( Req != NULL );
191 /* Some IRC clients, for example BitchX, send the NICK and USER
192 * commands in the wrong order ... */
193 if(Client_Type(Client) == CLIENT_UNKNOWN
194 || Client_Type(Client) == CLIENT_GOTPASS
195 || Client_Type(Client) == CLIENT_GOTNICK
197 || Client_Type(Client) == CLIENT_GOTUSER
199 || Client_Type(Client) == CLIENT_USER
200 || Client_Type(Client) == CLIENT_SERVICE
201 || (Client_Type(Client) == CLIENT_SERVER && Req->argc == 1))
203 /* User registration or change of nickname */
205 /* Wrong number of arguments? */
207 return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG,
211 /* Search "target" client */
212 if( Client_Type( Client ) == CLIENT_SERVER )
214 target = Client_Search( Req->prefix );
216 return IRC_WriteStrClient( Client,
223 /* Is this a restricted client? */
224 if( Client_HasMode( Client, 'r' ))
225 return IRC_WriteStrClient( Client,
227 Client_ID( Client ));
233 /* If the clients tries to change to its own nickname we won't
234 * do anything. This is how the original ircd behaves and some
235 * clients (for example Snak) expect it to be like this.
236 * But I doubt that this is "really the right thing" ... */
237 if( strcmp( Client_ID( target ), Req->argv[0] ) == 0 )
241 /* Check that the new nickname is available. Special case:
242 * the client only changes from/to upper to lower case. */
243 if( strcasecmp( Client_ID( target ), Req->argv[0] ) != 0 )
245 if( ! Client_CheckNick( target, Req->argv[0] ))
249 if (Client_Type(target) != CLIENT_USER &&
250 Client_Type(target) != CLIENT_SERVICE &&
251 Client_Type(target) != CLIENT_SERVER) {
253 LogDebug("Connection %d: got valid NICK command ...",
254 Client_Conn( Client ));
256 /* Register new nickname of this client */
257 Client_SetID( target, Req->argv[0] );
261 Conn_SetAuthPing(Client_Conn(Client), rand());
262 IRC_WriteStrClient(Client, "PING :%ld",
263 Conn_GetAuthPing(Client_Conn(Client)));
264 LogDebug("Connection %d: sent AUTH PING %ld ...",
266 Conn_GetAuthPing(Client_Conn(Client)));
270 /* If we received a valid USER command already then
271 * register the new client! */
272 if( Client_Type( Client ) == CLIENT_GOTUSER )
273 return Login_User( Client );
275 Client_SetType( Client, CLIENT_GOTNICK );
277 /* Nickname change */
278 if (Client_Conn(target) > NONE) {
281 "%s \"%s\" changed nick (connection %d): \"%s\" -> \"%s\".",
282 Client_TypeText(target), Client_Mask(target),
283 Client_Conn(target), Client_ID(target),
285 Conn_UpdateIdle(Client_Conn(target));
288 LogDebug("%s \"%s\" changed nick: \"%s\" -> \"%s\".",
289 Client_TypeText(target),
290 Client_Mask(target), Client_ID(target),
294 /* Inform all users and servers (which have to know)
295 * of this nickname change */
296 if( Client_Type( Client ) == CLIENT_USER )
297 IRC_WriteStrClientPrefix( Client, Client,
300 IRC_WriteStrServersPrefix( Client, target,
301 "NICK :%s", Req->argv[0] );
302 IRC_WriteStrRelatedPrefix( target, target, false,
303 "NICK :%s", Req->argv[0] );
305 /* Register old nickname for WHOWAS queries */
306 Client_RegisterWhowas( target );
308 /* Save new nickname */
309 Client_SetID( target, Req->argv[0] );
311 IRC_SetPenalty( target, 2 );
315 } else if(Client_Type(Client) == CLIENT_SERVER ||
316 Client_Type(Client) == CLIENT_SERVICE) {
317 /* Server or service introduces new client */
319 /* Bad number of parameters? */
320 if (Req->argc != 2 && Req->argc != 7)
321 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
322 Client_ID(Client), Req->command);
324 if (Req->argc >= 7) {
325 /* RFC 2813 compatible syntax */
327 hops = atoi(Req->argv[1]);
329 hostname = Req->argv[3];
330 token = atoi(Req->argv[4]);
331 modes = Req->argv[5] + 1;
334 /* RFC 1459 compatible syntax */
338 hostname = Client_ID(Client);
339 token = atoi(Req->argv[1]);
344 c = Client_Search(nick);
347 * the new nick is already present on this server:
348 * the new and the old one have to be disconnected now.
350 Log( LOG_ERR, "Server %s introduces already registered nick \"%s\"!", Client_ID( Client ), Req->argv[0] );
351 Kill_Nick( Req->argv[0], "Nick collision" );
355 /* Find the Server this client is connected to */
356 intr_c = Client_GetFromToken(Client, token);
359 Log( LOG_ERR, "Server %s introduces nick \"%s\" on unknown server!?", Client_ID( Client ), Req->argv[0] );
360 Kill_Nick( Req->argv[0], "Unknown server" );
364 c = Client_NewRemoteUser(intr_c, nick, hops, user, hostname,
365 token, modes, info, true);
368 /* out of memory, need to disconnect client to keep network state consistent */
369 Log( LOG_ALERT, "Can't create client structure! (on connection %d)", Client_Conn( Client ));
370 Kill_Nick( Req->argv[0], "Server error" );
374 /* RFC 2813: client is now fully registered, inform all the
375 * other servers about the new user.
376 * RFC 1459: announce the new client only after receiving the
377 * USER command, first we need more information! */
379 LogDebug("Client \"%s\" is being registered (RFC 1459) ...",
381 Client_SetType(c, CLIENT_GOTNICK);
383 Client_Introduce(Client, c, CLIENT_USER);
387 else return IRC_WriteStrClient( Client, ERR_ALREADYREGISTRED_MSG, Client_ID( Client ));
392 * Handler for the IRC "USER" command.
394 * See RFC 2812, 3.1.3 "User message".
396 * @param Client The client from which this command has been received.
397 * @param Req Request structure with prefix and all parameters.
398 * @returns CONNECTED or DISCONNECTED.
401 IRC_USER(CLIENT * Client, REQUEST * Req)
406 assert(Client != NULL);
409 if (Client_Type(Client) == CLIENT_GOTNICK ||
411 Client_Type(Client) == CLIENT_UNKNOWN ||
413 Client_Type(Client) == CLIENT_GOTPASS)
417 return IRC_WriteStrClient(Client,
418 ERR_NEEDMOREPARAMS_MSG,
422 /* User name: only alphanumeric characters and limited
423 punctuation is allowed.*/
426 if (!isalnum(*ptr) &&
427 *ptr != '+' && *ptr != '-' &&
428 *ptr != '.' && *ptr != '_') {
429 Conn_Close(Client_Conn(Client), NULL,
430 "Invalid user name", true);
437 ptr = Client_User(Client);
438 if (!ptr || !*ptr || *ptr == '~')
439 Client_SetUser(Client, Req->argv[0], false);
441 Client_SetUser(Client, Req->argv[0], false);
443 Client_SetOrigUser(Client, Req->argv[0]);
445 /* "Real name" or user info text: Don't set it to the empty
446 * string, the original ircd can't deal with such "real names"
447 * (e. g. "USER user * * :") ... */
449 Client_SetInfo(Client, Req->argv[3]);
451 Client_SetInfo(Client, "-");
453 LogDebug("Connection %d: got valid USER command ...",
454 Client_Conn(Client));
455 if (Client_Type(Client) == CLIENT_GOTNICK)
456 return Login_User(Client);
458 Client_SetType(Client, CLIENT_GOTUSER);
461 } else if (Client_Type(Client) == CLIENT_SERVER ||
462 Client_Type(Client) == CLIENT_SERVICE) {
463 /* Server/service updating an user */
465 return IRC_WriteStrClient(Client,
466 ERR_NEEDMOREPARAMS_MSG,
469 c = Client_Search(Req->prefix);
471 return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
475 Client_SetUser(c, Req->argv[0], true);
476 Client_SetOrigUser(c, Req->argv[0]);
477 Client_SetHostname(c, Req->argv[1]);
478 Client_SetInfo(c, Req->argv[3]);
480 LogDebug("Connection %d: got valid USER command for \"%s\".",
481 Client_Conn(Client), Client_Mask(c));
483 /* RFC 1459 style user registration?
484 * Introduce client to network: */
485 if (Client_Type(c) == CLIENT_GOTNICK)
486 Client_Introduce(Client, c, CLIENT_USER);
489 } else if (Client_Type(Client) == CLIENT_USER) {
490 /* Already registered connection */
491 return IRC_WriteStrClient(Client, ERR_ALREADYREGISTRED_MSG,
494 /* Unexpected/invalid connection state? */
495 return IRC_WriteStrClient(Client, ERR_NOTREGISTERED_MSG,
502 * Handler for the IRC "SERVICE" command.
504 * This function implements IRC Services registration using the SERVICE command
505 * defined in RFC 2812 3.1.6 and RFC 2813 4.1.4.
507 * At the moment ngIRCd doesn't support directly linked services, so this
508 * function returns ERR_ERRONEUSNICKNAME when the SERVICE command has not been
509 * received from a peer server.
511 * @param Client The client from which this command has been received.
512 * @param Req Request structure with prefix and all parameters.
513 * @returns CONNECTED or DISCONNECTED..
516 IRC_SERVICE(CLIENT *Client, REQUEST *Req)
519 char *nick, *user, *host, *info, *modes, *ptr;
522 assert(Client != NULL);
525 if (Client_Type(Client) != CLIENT_GOTPASS &&
526 Client_Type(Client) != CLIENT_SERVER)
527 return IRC_WriteStrClient(Client, ERR_ALREADYREGISTRED_MSG,
531 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
532 Client_ID(Client), Req->command);
534 if (Client_Type(Client) != CLIENT_SERVER)
535 return IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
536 Client_ID(Client), Req->argv[0]);
538 /* Bad number of parameters? */
540 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
541 Client_ID(Client), Req->command);
544 user = NULL; host = NULL;
545 token = atoi(Req->argv[1]);
546 hops = atoi(Req->argv[4]);
549 /* Validate service name ("nickname") */
550 c = Client_Search(nick);
552 /* Nickname collission: disconnect (KILL) both clients! */
553 Log(LOG_ERR, "Server %s introduces already registered service \"%s\"!",
554 Client_ID(Client), nick);
555 Kill_Nick(nick, "Nick collision");
559 /* Get the server to which the service is connected */
560 intr_c = Client_GetFromToken(Client, token);
562 Log(LOG_ERR, "Server %s introduces service \"%s\" on unknown server!?",
563 Client_ID(Client), nick);
564 Kill_Nick(nick, "Unknown server");
568 /* Get user and host name */
569 ptr = strchr(nick, '@');
575 host = Client_Hostname(intr_c);
576 ptr = strchr(nick, '!');
584 /* According to RFC 2812/2813 parameter 4 <type> "is currently reserved
585 * for future usage"; but we use it to transfer the modes and check
586 * that the first character is a '+' sign and ignore it otherwise. */
587 modes = (Req->argv[3][0] == '+') ? ++Req->argv[3] : "";
589 c = Client_NewRemoteUser(intr_c, nick, hops, user, host,
590 token, modes, info, true);
592 /* Couldn't create client structure, so KILL the service to
593 * keep network status consistent ... */
594 Log(LOG_ALERT, "Can't create client structure! (on connection %d)",
595 Client_Conn(Client));
596 Kill_Nick(nick, "Server error");
600 Client_Introduce(Client, c, CLIENT_SERVICE);
606 * Handler for the IRC "WEBIRC" command.
608 * See doc/Protocol.txt, section II.4:
609 * "Update webchat/proxy client information".
611 * @param Client The client from which this command has been received.
612 * @param Req Request structure with prefix and all parameters.
613 * @returns CONNECTED or DISCONNECTED.
616 IRC_WEBIRC(CLIENT *Client, REQUEST *Req)
618 /* Exactly 4 parameters are requited */
620 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
621 Client_ID(Client), Req->command);
623 if (!Conf_WebircPwd[0] || strcmp(Req->argv[0], Conf_WebircPwd) != 0)
624 return IRC_WriteStrClient(Client, ERR_PASSWDMISMATCH_MSG,
627 LogDebug("Connection %d: got valid WEBIRC command: user=%s, host=%s, ip=%s",
628 Client_Conn(Client), Req->argv[1], Req->argv[2], Req->argv[3]);
630 Client_SetUser(Client, Req->argv[1], true);
631 Client_SetOrigUser(Client, Req->argv[1]);
632 Client_SetHostname(Client, Req->argv[2]);
638 * Handler for the IRC "QUIT" command.
640 * See RFC 2812, 3.1.7 "Quit", and RFC 2813, 4.1.5 "Quit".
642 * @param Client The client from which this command has been received.
643 * @param Req Request structure with prefix and all parameters.
644 * @returns CONNECTED or DISCONNECTED.
647 IRC_QUIT( CLIENT *Client, REQUEST *Req )
650 char quitmsg[LINE_LEN];
652 assert(Client != NULL);
655 /* Wrong number of arguments? */
657 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
658 Client_ID(Client), Req->command);
661 strlcpy(quitmsg, Req->argv[0], sizeof quitmsg);
663 if (Client_Type(Client) == CLIENT_SERVER) {
665 target = Client_Search(Req->prefix);
668 "Got QUIT from %s for unknown client!?",
673 if (target != Client) {
674 Client_Destroy(target, "Got QUIT command.",
675 Req->argc == 1 ? quitmsg : NULL, true);
678 Conn_Close(Client_Conn(Client), "Got QUIT command.",
679 Req->argc == 1 ? quitmsg : NULL, true);
683 if (Req->argc == 1 && quitmsg[0] != '\"') {
684 /* " " to avoid confusion */
685 strlcpy(quitmsg, "\"", sizeof quitmsg);
686 strlcat(quitmsg, Req->argv[0], sizeof quitmsg-1);
687 strlcat(quitmsg, "\"", sizeof quitmsg );
690 /* User, Service, or not yet registered */
691 Conn_Close(Client_Conn(Client), "Got QUIT command.",
692 Req->argc == 1 ? quitmsg : NULL, true);
702 * Handler for HTTP command, e.g. GET and POST
704 * We handle these commands here to avoid the quite long timeout when
705 * some user tries to access this IRC daemon using an web browser ...
707 * @param Client The client from which this command has been received.
708 * @param Req Request structure with prefix and all parameters.
709 * @returns CONNECTED or DISCONNECTED.
712 IRC_QUIT_HTTP( CLIENT *Client, REQUEST *Req )
715 Req->argv[0] = "Oops, HTTP request received? This is IRC!";
716 return IRC_QUIT(Client, Req);
717 } /* IRC_QUIT_HTTP */
723 * Handler for the IRC "PING" command.
725 * See RFC 2812, 3.7.2 "Ping message".
727 * @param Client The client from which this command has been received.
728 * @param Req Request structure with prefix and all parameters.
729 * @returns CONNECTED or DISCONNECTED.
732 IRC_PING(CLIENT *Client, REQUEST *Req)
734 CLIENT *target, *from;
736 assert(Client != NULL);
740 return IRC_WriteStrClient(Client, ERR_NOORIGIN_MSG,
743 /* Don't ignore additional arguments when in "strict" mode */
745 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
746 Client_ID(Client), Req->command);
750 /* A target has been specified ... */
751 target = Client_Search(Req->argv[1]);
753 if (!target || Client_Type(target) != CLIENT_SERVER)
754 return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
755 Client_ID(Client), Req->argv[1]);
757 if (target != Client_ThisServer()) {
758 /* Ok, we have to forward the PING */
759 if (Client_Type(Client) == CLIENT_SERVER)
760 from = Client_Search(Req->prefix);
764 return IRC_WriteStrClient(Client,
765 ERR_NOSUCHSERVER_MSG,
766 Client_ID(Client), Req->prefix);
768 return IRC_WriteStrClientPrefix(target, from,
769 "PING %s :%s", Req->argv[0],
774 if (Client_Type(Client) == CLIENT_SERVER) {
776 from = Client_Search(Req->prefix);
780 from = Client_ThisServer();
782 return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
783 Client_ID(Client), Req->prefix);
785 Log(LOG_DEBUG, "Connection %d: got PING, sending PONG ...",
786 Client_Conn(Client));
789 return IRC_WriteStrClient(Client, "PONG %s :%s",
790 Client_ID(from), Client_ID(Client));
792 /* Some clients depend on the argument being returned in the PONG
793 * reply (not mentioned in any RFC, though) */
794 return IRC_WriteStrClient(Client, "PONG %s :%s",
795 Client_ID(from), Req->argv[0]);
801 * Handler for the IRC "PONG" command.
803 * See RFC 2812, 3.7.3 "Pong message".
805 * @param Client The client from which this command has been received.
806 * @param Req Request structure with prefix and all parameters.
807 * @returns CONNECTED or DISCONNECTED.
810 IRC_PONG(CLIENT *Client, REQUEST *Req)
812 CLIENT *target, *from;
819 assert(Client != NULL);
822 /* Wrong number of arguments? */
824 if (Client_Type(Client) == CLIENT_USER)
825 return IRC_WriteStrClient(Client, ERR_NOORIGIN_MSG,
831 if (Client_Type(Client) == CLIENT_USER)
832 return IRC_WriteStrClient(Client,
833 ERR_NEEDMOREPARAMS_MSG,
841 if (Req->argc == 2 && Client_Type(Client) == CLIENT_SERVER) {
842 target = Client_Search(Req->argv[0]);
844 return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
845 Client_ID(Client), Req->argv[0]);
847 from = Client_Search(Req->prefix);
849 if (target != Client_ThisServer() && target != from) {
850 /* Ok, we have to forward the message. */
852 return IRC_WriteStrClient(Client,
853 ERR_NOSUCHSERVER_MSG,
854 Client_ID(Client), Req->prefix);
856 if (Client_Type(Client_NextHop(target)) != CLIENT_SERVER)
860 return IRC_WriteStrClientPrefix(target, from,
861 "PONG %s :%s", s, Req->argv[1]);
865 /* The connection timestamp has already been updated when the data has
866 * been read from so socket, so we don't need to update it here. */
868 conn = Client_Conn(Client);
871 /* Check authentication PING-PONG ... */
872 auth_ping = Conn_GetAuthPing(conn);
874 LogDebug("AUTH PONG: waiting for token \"%ld\", got \"%s\" ...",
875 auth_ping, Req->argv[0]);
876 if (auth_ping == atoi(Req->argv[0])) {
877 Conn_SetAuthPing(conn, 0);
878 if (Client_Type(Client) == CLIENT_WAITAUTHPING)
881 if (!IRC_WriteStrClient(Client,
882 "To connect, type /QUOTE PONG %ld",
888 if (Client_Type(Client) == CLIENT_SERVER && Conn_LastPing(conn) == 0) {
890 "Synchronization with \"%s\" done (connection %d): %ld seconds [%ld users, %ld channels]",
891 Client_ID(Client), conn, time(NULL) - Conn_GetSignon(conn),
892 Client_UserCount(), Channel_CountVisible(NULL));
893 Conn_UpdatePing(conn);
895 LogDebug("Connection %d: received PONG. Lag: %ld seconds.",
896 conn, time(NULL) - Conn_LastPing(conn));
903 * Kill all users with a specific nickname in the network.
905 * @param Nick Nickname.
906 * @param Reason Reason for the KILL.
909 Kill_Nick(char *Nick, char *Reason)
913 assert (Nick != NULL);
914 assert (Reason != NULL);
921 Log(LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s",
924 IRC_KILL(Client_ThisServer(), &r);