1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-12-13 02:10:27 +00:00

Add Client_HasFlag() to check if a client has certain flag

This commit is contained in:
Federico G. Schwindt 2013-08-04 03:20:13 +01:00
parent a95d3e05e7
commit e03d8eb728
6 changed files with 16 additions and 7 deletions

View File

@ -950,6 +950,14 @@ Client_HasMode( CLIENT *Client, char Mode )
} /* Client_HasMode */
GLOBAL bool
Client_HasFlag( CLIENT *Client, char Flag )
{
assert( Client != NULL );
return strchr( Client->flags, Flag ) != NULL;
} /* Client_HasFlag */
GLOBAL char *
Client_Away( CLIENT *Client )
{

View File

@ -126,6 +126,7 @@ GLOBAL char *Client_Away PARAMS(( CLIENT *Client ));
GLOBAL time_t Client_StartTime PARAMS(( CLIENT *Client ));
GLOBAL bool Client_HasMode PARAMS(( CLIENT *Client, char Mode ));
GLOBAL bool Client_HasFlag PARAMS(( CLIENT *Client, char Flag ));
GLOBAL void Client_SetHostname PARAMS(( CLIENT *Client, const char *Hostname ));
GLOBAL void Client_SetID PARAMS(( CLIENT *Client, const char *Nick ));

View File

@ -70,7 +70,7 @@ IRC_METADATA(CLIENT *Client, REQUEST *Req)
Req->argv[1], Req->argv[2]);
/* Mark client: it has receiveda a METADATA command */
if (!strchr(Client_Flags(target), 'M')) {
if (!Client_HasFlag(target, 'M')) {
snprintf(new_flags, sizeof new_flags, "%sM",
Client_Flags(target));
Client_SetFlags(target, new_flags);

View File

@ -152,7 +152,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
Client_SetType(Client, CLIENT_UNKNOWNSERVER);
#ifdef ZLIB
if (strchr(Client_Flags(Client), 'Z')
if (Client_HasFlag(Client, 'Z')
&& !Zip_InitConn(Client_Conn(Client))) {
Conn_Close(Client_Conn(Client),
"Can't initialize compression (zlib)!",
@ -162,7 +162,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
#endif
#ifdef IRCPLUS
if (strchr(Client_Flags(Client), 'H')) {
if (Client_HasFlag(Client, 'H')) {
LogDebug("Peer supports IRC+ extended server handshake ...");
if (!IRC_Send_ISUPPORT(Client))
return DISCONNECTED;

View File

@ -311,7 +311,7 @@ IRC_WriteStrServersPrefixFlag_CB(CLIENT *ExceptOf, CLIENT *Prefix, char Flag,
if (Client_Type(c) == CLIENT_SERVER && Client_Conn(c) > NONE &&
c != Client_ThisServer() && c != ExceptOf) {
/* Found a target server, do the flags match? */
if (Flag == '\0' || strchr(Client_Flags(c), Flag))
if (Flag == '\0' || Client_HasFlag(c, Flag))
callback(c, Prefix, cb_data);
}
c = Client_Next(c);

View File

@ -52,7 +52,7 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan)
/* Check features of remote server */
njoin = Conn_Options(Client_Conn(Client)) & CONN_RFC1459 ? false : true;
xop = strchr(Client_Flags(Client), 'X') ? true : false;
xop = Client_HasFlag(Client, 'X') ? true : false;
/* Get all the members of this channel */
cl2chan = Channel_FirstMember(Chan);
@ -321,7 +321,7 @@ IRC_Num_ENDOFMOTD(CLIENT * Client, UNUSED REQUEST * Req)
}
#ifdef IRCPLUS
/* Send CHANINFO if the peer supports it */
if (strchr(Client_Flags(Client), 'C')) {
if (Client_HasFlag(Client, 'C')) {
if (!Send_CHANINFO(Client, chan))
return DISCONNECTED;
}
@ -335,7 +335,7 @@ IRC_Num_ENDOFMOTD(CLIENT * Client, UNUSED REQUEST * Req)
}
#ifdef IRCPLUS
if (strchr(Client_Flags(Client), 'L')) {
if (Client_HasFlag(Client, 'L')) {
LogDebug("Synchronizing INVITE- and BAN-lists ...");
if (!Synchronize_Lists(Client))
return DISCONNECTED;