Module: ngircd.git Branch: master Commit: 9f74c0ff075dc67e068b8c2da0c069b6c622e436 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=9f74c...
Author: Federico G. Schwindt fgsch@lodoss.net Date: Thu Sep 5 10:40:39 2013 +0100
Minor cosmetic change
Add a define to indicate any client. While I'm here use hex values instead of decimal, it's somewhat clearer that they could be OR'ed together.
---
src/ngircd/client.h | 23 ++++++++++++----------- src/ngircd/parse.c | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/ngircd/client.h b/src/ngircd/client.h index c104a75..e5c48b7 100644 --- a/src/ngircd/client.h +++ b/src/ngircd/client.h @@ -17,19 +17,20 @@ * Client management (header) */
-#define CLIENT_UNKNOWN 1 /* connection of unknown type */ -#define CLIENT_GOTPASS 2 /* client did send PASS */ -#define CLIENT_GOTNICK 4 /* client did send NICK */ -#define CLIENT_GOTUSER 8 /* client did send USER */ -#define CLIENT_USER 16 /* client is an IRC user */ -#define CLIENT_SERVER 32 /* client is a server */ -#define CLIENT_SERVICE 64 /* client is a service */ -#define CLIENT_UNKNOWNSERVER 128 /* unregistered server connection */ -#define CLIENT_GOTPASS_2813 256 /* client did send PASS, RFC 2813 style */ +#define CLIENT_UNKNOWN 0x0001 /* connection of unknown type */ +#define CLIENT_GOTPASS 0x0002 /* client did send PASS */ +#define CLIENT_GOTNICK 0x0004 /* client did send NICK */ +#define CLIENT_GOTUSER 0x0008 /* client did send USER */ +#define CLIENT_USER 0x0010 /* client is an IRC user */ +#define CLIENT_SERVER 0x0020 /* client is a server */ +#define CLIENT_SERVICE 0x0040 /* client is a service */ +#define CLIENT_UNKNOWNSERVER 0x0080 /* unregistered server connection */ +#define CLIENT_GOTPASS_2813 0x0100 /* client did send PASS, RFC 2813 style */ #ifndef STRICT_RFC -# define CLIENT_WAITAUTHPING 512 /* waiting for AUTH PONG from client */ +# define CLIENT_WAITAUTHPING 0x0200 /* waiting for AUTH PONG from client */ #endif -#define CLIENT_WAITCAPEND 1024 /* waiting for "CAP END" command */ +#define CLIENT_WAITCAPEND 0x0400 /* waiting for "CAP END" command */ +#define CLIENT_ANY 0xFFFF
#define CLIENT_TYPE int
diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index e5eaa6e..68aa945 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -62,11 +62,11 @@ static COMMAND My_Commands[] = { { "ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "AWAY", IRC_AWAY, CLIENT_USER, 0, 0, 0 }, - { "CAP", IRC_CAP, 0xFFFF, 0, 0, 0 }, + { "CAP", IRC_CAP, CLIENT_ANY, 0, 0, 0 }, { "CONNECT", IRC_CONNECT, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0 }, { "DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 0, 0, 0 }, - { "ERROR", IRC_ERROR, 0xFFFF, 0, 0, 0 }, + { "ERROR", IRC_ERROR, CLIENT_ANY, 0, 0, 0 }, { "GLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "HELP", IRC_HELP, CLIENT_USER, 0, 0, 0 }, { "INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, @@ -83,20 +83,20 @@ static COMMAND My_Commands[] = { "MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, - { "NICK", IRC_NICK, 0xFFFF, 0, 0, 0 }, + { "NICK", IRC_NICK, CLIENT_ANY, 0, 0, 0 }, { "NJOIN", IRC_NJOIN, CLIENT_SERVER, 0, 0, 0 }, - { "NOTICE", IRC_NOTICE, 0xFFFF, 0, 0, 0 }, + { "NOTICE", IRC_NOTICE, CLIENT_ANY, 0, 0, 0 }, { "OPER", IRC_OPER, CLIENT_USER, 0, 0, 0 }, { "PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, - { "PASS", IRC_PASS, 0xFFFF, 0, 0, 0 }, + { "PASS", IRC_PASS, CLIENT_ANY, 0, 0, 0 }, { "PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, - { "PONG", IRC_PONG, 0xFFFF, 0, 0, 0 }, + { "PONG", IRC_PONG, CLIENT_ANY, 0, 0, 0 }, { "PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, - { "QUIT", IRC_QUIT, 0xFFFF, 0, 0, 0 }, + { "QUIT", IRC_QUIT, CLIENT_ANY, 0, 0, 0 }, { "REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0 }, { "RESTART", IRC_RESTART, CLIENT_USER, 0, 0, 0 }, - { "SERVER", IRC_SERVER, 0xFFFF, 0, 0, 0 }, - { "SERVICE", IRC_SERVICE, 0xFFFF, 0, 0, 0 }, + { "SERVER", IRC_SERVER, CLIENT_ANY, 0, 0, 0 }, + { "SERVICE", IRC_SERVICE, CLIENT_ANY, 0, 0, 0 }, { "SERVLIST", IRC_SERVLIST, CLIENT_USER, 0, 0, 0 }, { "SQUERY", IRC_SQUERY, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "SQUIT", IRC_SQUIT, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, @@ -106,7 +106,7 @@ static COMMAND My_Commands[] = { "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, - { "USER", IRC_USER, 0xFFFF, 0, 0, 0 }, + { "USER", IRC_USER, CLIENT_ANY, 0, 0, 0 }, { "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 }, { "USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },