X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fclient.c;h=cf0720b9942e81631a84fc0900fb259903b8ac99;hp=09bd6fdeaee8400ae3e5c75ee539fb230a607a09;hb=904c8a4375cb9deed64007b06c6a7ba42313d93d;hpb=15dfdaac823c5927b096b2980753a6198a6a7741 diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 09bd6fde..cf0720b9 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) + * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -217,7 +217,7 @@ Init_New_Client(CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, if (Type == CLIENT_SERVER) Generate_MyToken(client); - if (strchr(client->modes, 'a')) + if (Client_HasMode(client, 'a')) strlcpy(client->away, DEFAULT_AWAY_MSG, sizeof(client->away)); client->next = (POINTER *)My_Clients; @@ -524,7 +524,7 @@ Client_ModeAdd( CLIENT *Client, char Mode ) assert( Client != NULL ); x[0] = Mode; x[1] = '\0'; - if (!strchr( Client->modes, x[0])) { + if (!Client_HasMode(Client, x[0])) { strlcat( Client->modes, x, sizeof( Client->modes )); return true; } @@ -991,11 +991,11 @@ Client_CheckNick(CLIENT *Client, char *Nick) if (!Client_IsValidNick(Nick)) { if (strlen(Nick ) >= Conf_MaxNickLength) - IRC_WriteStrClient(Client, ERR_NICKNAMETOOLONG_MSG, + IRC_WriteErrClient(Client, ERR_NICKNAMETOOLONG_MSG, Client_ID(Client), Nick, Conf_MaxNickLength - 1); else - IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG, + IRC_WriteErrClient(Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID(Client), Nick); return false; } @@ -1004,7 +1004,7 @@ Client_CheckNick(CLIENT *Client, char *Nick) && Client_Type(Client) != CLIENT_SERVICE) { /* Make sure that this isn't a restricted/forbidden nickname */ if (Conf_NickIsBlocked(Nick)) { - IRC_WriteStrClient(Client, ERR_FORBIDDENNICKNAME_MSG, + IRC_WriteErrClient(Client, ERR_FORBIDDENNICKNAME_MSG, Client_ID(Client), Nick); return false; } @@ -1012,7 +1012,7 @@ Client_CheckNick(CLIENT *Client, char *Nick) /* Nickname already registered? */ if (Client_Search(Nick)) { - IRC_WriteStrClient(Client, ERR_NICKNAMEINUSE_MSG, + IRC_WriteErrClient(Client, ERR_NICKNAMEINUSE_MSG, Client_ID(Client), Nick); return false; } @@ -1033,7 +1033,8 @@ Client_CheckID( CLIENT *Client, char *ID ) /* ID too long? */ if (strlen(ID) > CLIENT_ID_LEN) { - IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID(Client), ID); + IRC_WriteErrClient(Client, ERR_ERRONEUSNICKNAME_MSG, + Client_ID(Client), ID); return false; } @@ -1131,7 +1132,8 @@ Client_OperCount( void ) c = My_Clients; while( c ) { - if( c && ( c->type == CLIENT_USER ) && ( strchr( c->modes, 'o' ))) cnt++; + if (c && c->type == CLIENT_USER && Client_HasMode(c, 'o' )) + cnt++; c = (CLIENT *)c->next; } return cnt; @@ -1580,7 +1582,7 @@ Client_Announce(CLIENT * Client, CLIENT * Prefix, CLIENT * User) } else { /* RFC 2813 mode: one combined NICK or SERVICE command */ if (Client_Type(User) == CLIENT_SERVICE - && strchr(Client_Flags(Client), 'S')) { + && Client_HasFlag(Client, 'S')) { if (!IRC_WriteStrClientPrefix(Client, Prefix, "SERVICE %s %d * +%s %d :%s", Client_Mask(User), @@ -1599,7 +1601,7 @@ Client_Announce(CLIENT * Client, CLIENT * Prefix, CLIENT * User) } } - if (strchr(Client_Flags(Client), 'M')) { + if (Client_HasFlag(Client, 'M')) { /* Synchronize metadata */ if (Client_HostnameCloaked(User)) { if (!IRC_WriteStrClientPrefix(Client, Prefix,