express: Ignore case of commands when comparing
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
27d84340d3
commit
3694a56087
|
@ -6,7 +6,7 @@ _handle_help_cmd(char *token, char *buff)
|
|||
{
|
||||
if (!token) goto help_help;
|
||||
|
||||
if (!strcmp(token,"ADMIN"))
|
||||
if (!strcasecmp(token,"ADMIN"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: ADMIN [<target>]\n"
|
||||
"Instructs the server to return information about "
|
||||
"the administrators of the server specified by "
|
||||
|
@ -14,33 +14,33 @@ _handle_help_cmd(char *token, char *buff)
|
|||
"user. If <target> is omitted, the server should "
|
||||
"return information about the administrators of "
|
||||
"the current server.\r\n");
|
||||
else if (!strcmp(token, "AWAY"))
|
||||
else if (!strcasecmp(token, "AWAY"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: AWAY [<message>]\n"
|
||||
"Provides the server with a message to automatically "
|
||||
"send in reply to a PRIVMSG directed at the user, but "
|
||||
"not to a channel they are on.[2] If <message> is "
|
||||
"omitted, the away status is removed.\r\n");
|
||||
else if (!strcmp(token, "CNOTICE"))
|
||||
else if (!strcasecmp(token, "CNOTICE"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: CNOTICE <nickname> <channel> :<message>\n"
|
||||
"Sends a channel NOTICE message to <nickname> on <channel> that "
|
||||
"bypasses flood protection limits. The target nickname must be "
|
||||
"in the same channel as the client issuing the command, and the "
|
||||
"client must be a channel operator.\r\n");
|
||||
else if (!strcmp(token, "CPRIVMSG"))
|
||||
else if (!strcasecmp(token, "CPRIVMSG"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: CPRIVMSG <nickname> <channel> :<message>\n"
|
||||
"Sends a private message to <nickname> on <channel> that bypasses "
|
||||
"flood protection limits. The target nickname must be in the same "
|
||||
"channel as the client issuing the command, and the client must be "
|
||||
"a channel operator.\r\n");
|
||||
else if (!strcmp(token, "CONNECT"))
|
||||
else if (!strcasecmp(token, "CONNECT"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: CONNECT <target server> [<port> [<remote server>]]\n"
|
||||
"Instructs the server <remote server> (or the current server, if "
|
||||
"<remote server> is omitted) to connect to <target server> on port "
|
||||
"<port>. This command should only be available to IRC Operators.\r\n");
|
||||
else if (!strcmp(token, "DIE"))
|
||||
else if (!strcasecmp(token, "DIE"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: DIE\n"
|
||||
"This command may only be issued by IRC server operators.\r\n");
|
||||
else if (!strcmp(token, "ENCAP"))
|
||||
else if (!strcasecmp(token, "ENCAP"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: :<source> ENCAP <destination> <subcommand> <parameters>\n"
|
||||
"This command is for use by servers to encapsulate commands so that they will "
|
||||
"propagate across hub servers not yet updated to support them, and indicates the "
|
||||
|
@ -48,12 +48,12 @@ _handle_help_cmd(char *token, char *buff)
|
|||
"where it will be unencapsulated and parsed. This facilitates implementation of "
|
||||
"new features without a need to restart all servers before they are usable across "
|
||||
"the network.\r\n");
|
||||
else if (!strcmp(token, "ERROR"))
|
||||
else if (!strcasecmp(token, "ERROR"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: ERROR <error message>\n"
|
||||
"This command is for use by servers to report errors "
|
||||
"to other servers. It is also used before terminating "
|
||||
"client connections.\r\n");
|
||||
else if (!strcmp(token, "INFO"))
|
||||
else if (!strcasecmp(token, "INFO"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: INFO [<target>]\n"
|
||||
"Returns information about the <target> server, or "
|
||||
"the current server if <target> is omitted. Information "
|
||||
|
@ -61,14 +61,14 @@ _handle_help_cmd(char *token, char *buff)
|
|||
"compiled, the patch level, when it was started, and "
|
||||
"any other information which may be considered to be "
|
||||
"relevant.\r\n");
|
||||
else if (!strcmp(token, "INVITE"))
|
||||
else if (!strcasecmp(token, "INVITE"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: INVITE <nickname> <channel>\n"
|
||||
"Invites <nickname> to the channel <channel>. <channel> "
|
||||
"does not have to exist, but if it does, only members of "
|
||||
"the channel are allowed to invite other clients. If the "
|
||||
"channel mode i is set, only channel operators may invite "
|
||||
"other clients.\r\n");
|
||||
else if (!strcmp(token, "ISON"))
|
||||
else if (!strcasecmp(token, "ISON"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: ISON <nicknames>\n"
|
||||
"Queries the server to see if the clients in the "
|
||||
"space-separated list <nicknames> are currently on the "
|
||||
|
@ -76,35 +76,35 @@ _handle_help_cmd(char *token, char *buff)
|
|||
"on the network in a space-separated list. If none of "
|
||||
"the clients are on the network the server returns an "
|
||||
"empty list.\r\n");
|
||||
else if (!strcmp(token, "JOIN"))
|
||||
else if (!strcasecmp(token, "JOIN"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: JOIN <channels> [<keys>]\n"
|
||||
"Makes the client join the channels in the comma-separated "
|
||||
"list <channels>, specifying the passwords, if needed, in "
|
||||
"the comma-separated list <keys>. If the channel(s) do not "
|
||||
"exist then they will be created.\r\n");
|
||||
else if (!strcmp(token, "KICK"))
|
||||
else if (!strcasecmp(token, "KICK"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: KICK <channel> <client> [<message>]\n"
|
||||
"Forcibly removes <client> from <channel>. This command may "
|
||||
"only be issued by channel operators.\r\n");
|
||||
else if (!strcmp(token, "KILL"))
|
||||
else if (!strcasecmp(token, "KILL"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: KILL <client> <comment>\n"
|
||||
"Forcibly removes <client> from the network. This command "
|
||||
"may only be issued by IRC operators.\r\n");
|
||||
else if (!strcmp(token, "KNOCK"))
|
||||
else if (!strcasecmp(token, "KNOCK"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: KNOCK <channel> [<message>]\n"
|
||||
"Sends a NOTICE to an invitation-only <channel> with an "
|
||||
"optional <message>, requesting an invite.\r\n");
|
||||
else if (!strcmp(token, "LINKS"))
|
||||
else if (!strcasecmp(token, "LINKS"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: LINKS [<remote server> [<server mask>]]\n"
|
||||
"Lists all server links matching <server mask>, if given, on "
|
||||
"<remote server>, or the current server if omitted.\r\n");
|
||||
else if (!strcmp(token, "LIST"))
|
||||
else if (!strcasecmp(token, "LIST"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: LIST [<channels> [<server>]]\n"
|
||||
"Lists all channels on the server. If the comma-separated "
|
||||
"list <channels> is given, it will return the channel topics. "
|
||||
"If <server> is given, the command will be forwarded to "
|
||||
"<server> for evaluation.\r\n");
|
||||
else if (!strcmp(token, "LUSERS"))
|
||||
else if (!strcasecmp(token, "LUSERS"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: LUSERS [<mask> [<server>]]\n"
|
||||
"Returns statistics about the size of the network. If called "
|
||||
"with no arguments, the statistics will reflect the entire "
|
||||
|
@ -112,14 +112,14 @@ _handle_help_cmd(char *token, char *buff)
|
|||
"reflecting the masked subset of the network. If <target> is "
|
||||
"given, the command will be forwarded to <server> for "
|
||||
"evaluation.\r\n");
|
||||
else if (!strcmp(token, "MODE"))
|
||||
else if (!strcasecmp(token, "MODE"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: MODE <nickname> <flags> (user)\n MODE <channel> <flags> [<args>]\n"
|
||||
"The MODE command is dual-purpose. It can be used to set both user and channel modes.\r\n");
|
||||
else if (!strcmp(token, "MOTD"))
|
||||
else if (!strcasecmp(token, "MOTD"))
|
||||
snprintf(buff, PATH_MAX, "Syntax: MOTD [<server>]\n"
|
||||
"Returns the message of the day on <server> or the current "
|
||||
"server if it is omitted.\r\n");
|
||||
else if (!strcmp(token, "NAMES"))
|
||||
else if (!strcasecmp(token, "NAMES"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: NAMES [<channels> [<server>]]\n"
|
||||
"Returns a list of who is on the comma-separated list of "
|
||||
"<channels>, by channel name. If <channels> is omitted, "
|
||||
|
@ -127,58 +127,58 @@ _handle_help_cmd(char *token, char *buff)
|
|||
"who are not on a channel being shown as part of channel \"*\". "
|
||||
"If <server> is specified, the command is sent to <server> "
|
||||
"for evaluation\r\n");
|
||||
else if (!strcmp(token, "NAMESX"))
|
||||
else if (!strcasecmp(token, "NAMESX"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: PROTOCTL NAMESX\n"
|
||||
"Instructs the server to send names in an RPL_NAMES reply "
|
||||
"prefixed with all their respective channel statuses instead "
|
||||
"of just the highest one (similar to IRCv3's multi-prefix).\r\n");
|
||||
else if (!strcmp(token, "NICK"))
|
||||
else if (!strcasecmp(token, "NICK"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: NICK <nickname> [<hopcount>]\n"
|
||||
"Allows a client to change their IRC nickname. Hopcount "
|
||||
"is for use between servers to specify how far away a "
|
||||
"nickname is from its home server.\r\n");
|
||||
else if (!strcmp(token, "NOTICE"))
|
||||
else if (!strcasecmp(token, "NOTICE"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: NOTICE <msgtarget> <message>\n"
|
||||
"This command works similarly to PRIVMSG, except automatic "
|
||||
"replies must never be sent in reply to NOTICE messages.\r\n");
|
||||
else if (!strcmp(token, "OPER"))
|
||||
else if (!strcasecmp(token, "OPER"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: OPER <username> <password>\n"
|
||||
"Authenticates a user as an IRC operator on that server/network.\r\n");
|
||||
else if (!strcmp(token, "PART"))
|
||||
else if (!strcasecmp(token, "PART"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: PART <channels> [<message>]\n"
|
||||
"Causes a user to leave the channels in the comma-separated "
|
||||
"list <channels>.\r\n");
|
||||
else if (!strcmp(token, "PASS"))
|
||||
else if (!strcasecmp(token, "PASS"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: PASS <password>\n"
|
||||
"Sets a connection password. This command must be sent "
|
||||
"before the NICK/USER registration combination.\r\n");
|
||||
else if (!strcmp(token, "PING"))
|
||||
else if (!strcasecmp(token, "PING"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: PING <server1> [<server2>]\n"
|
||||
"Tests the presence of a connection. A PING message results "
|
||||
"in a PONG reply. If <server2> is specified, the message "
|
||||
"gets passed on to it.\r\n");
|
||||
else if (!strcmp(token, "PONG"))
|
||||
else if (!strcasecmp(token, "PONG"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: PONG <server1> [<server2>]"
|
||||
"This command is a reply to the PING command and works "
|
||||
"in much the same way.\r\n");
|
||||
else if (!strcmp(token, "PRIVMSG"))
|
||||
else if (!strcasecmp(token, "PRIVMSG"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: PRIVMSG <msgtarget> <message>\n"
|
||||
"Sends <message> to <msgtarget>, which is usually a user "
|
||||
"or channel.\r\n");
|
||||
else if (!strcmp(token, "QUIT"))
|
||||
else if (!strcasecmp(token, "QUIT"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: QUIT [<message>]\n"
|
||||
"Disconnects the user from the server.\r\n");
|
||||
else if (!strcmp(token, "REHASH"))
|
||||
else if (!strcasecmp(token, "REHASH"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: REHASH\n"
|
||||
"Causes the server to re-read and re-process its configuration "
|
||||
"file(s). This command can only be sent by IRC Operators.\r\n");
|
||||
else if (!strcmp(token, "RESTART"))
|
||||
else if (!strcasecmp(token, "RESTART"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: RESTART\n"
|
||||
"Restarts a server. It may only be sent by IRC Operators.\r\n");
|
||||
else if (!strcmp(token, "RULES"))
|
||||
else if (!strcasecmp(token, "RULES"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: RULES\n"
|
||||
"Requests the server rules.\r\n");
|
||||
else if (!strcmp(token, "SERVER"))
|
||||
else if (!strcasecmp(token, "SERVER"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: SERVER <servername> <hopcount> <info>\n"
|
||||
"The server message is used to tell a server that the other "
|
||||
"end of a new connection is a server.[36] This message is also "
|
||||
|
@ -186,24 +186,24 @@ _handle_help_cmd(char *token, char *buff)
|
|||
"how many hops (server connections) away <servername> is. "
|
||||
"<info> contains addition human-readable information about "
|
||||
"the server.\r\n");
|
||||
else if (!strcmp(token, "SERVICE"))
|
||||
else if (!strcasecmp(token, "SERVICE"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: SERVICE <nickname> <reserved> <distribution> <type> <reserved> <info>\n"
|
||||
"Registers a new service on the network.\r\n");
|
||||
else if (!strcmp(token, "SERVLIST"))
|
||||
else if (!strcasecmp(token, "SERVLIST"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: SERVLIST [<mask> [<type>]]\n"
|
||||
"Lists the services currently on the network.\r\n");
|
||||
else if (!strcmp(token, "SQUERY"))
|
||||
else if (!strcasecmp(token, "SQUERY"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: SQUERY <servicename> <text>\n"
|
||||
"Identical to PRIVMSG except the recipient must be a "
|
||||
"service.\r\n");
|
||||
else if (!strcmp(token, "SQUIT"))
|
||||
else if (!strcasecmp(token, "SQUIT"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: SQUIT <server> <comment>\n"
|
||||
"Causes <server> to quit the network.\r\n");
|
||||
else if (!strcmp(token, "SETNAME"))
|
||||
else if (!strcasecmp(token, "SETNAME"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: SETNAME <new real name>\n"
|
||||
"Allows a client to change the \"real name\" specified "
|
||||
"when registering a connection.\r\n");
|
||||
else if (!strcmp(token, "SILENCE"))
|
||||
else if (!strcasecmp(token, "SILENCE"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: SILENCE [+/-<hostmask>]\n"
|
||||
"Adds or removes a host mask to a server-side ignore list "
|
||||
"that prevents matching users from sending the client messages. "
|
||||
|
@ -211,59 +211,59 @@ _handle_help_cmd(char *token, char *buff)
|
|||
"each item prefixed with a \"+\" or \"-\" to designate whether "
|
||||
"it is being added or removed. Sending the command with no "
|
||||
"parameters returns the entries in the client's ignore list.\r\n");
|
||||
else if (!strcmp(token, "STATS"))
|
||||
else if (!strcasecmp(token, "STATS"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: STATS <query> [<server>]\n"
|
||||
"Returns statistics about the current server, or <server> "
|
||||
"if it's specified.\r\n");
|
||||
else if (!strcmp(token, "SUMMON"))
|
||||
else if (!strcasecmp(token, "SUMMON"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: SUMMON <user> [<server> [<channel>]]\n"
|
||||
"Gives users who are on the same host as <server> a message "
|
||||
"asking them to join IRC.\r\n");
|
||||
else if (!strcmp(token, "TIME"))
|
||||
else if (!strcasecmp(token, "TIME"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: TIME [<server>]\n"
|
||||
"Returns the local time on the current server, or <server> "
|
||||
"if specified.\r\n");
|
||||
else if (!strcmp(token, "TOPIC"))
|
||||
else if (!strcasecmp(token, "TOPIC"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: TOPIC <channel> [<topic>]\n"
|
||||
"Allows the client to query or set the channel topic on "
|
||||
"<channel>. If <topic> is given, it sets the channel topic "
|
||||
"to <topic>. If channel mode +t is set, only a channel "
|
||||
"operator may set the topic.\r\n");
|
||||
else if (!strcmp(token, "TRACE"))
|
||||
else if (!strcasecmp(token, "TRACE"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: TRACE [<target>]\n"
|
||||
"Trace a path across the IRC network to a specific server "
|
||||
"or client, in a similar method to traceroute.\r\n");
|
||||
else if (!strcmp(token, "UHNAMES"))
|
||||
else if (!strcasecmp(token, "UHNAMES"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: PROTOCTL UHNAMES\n"
|
||||
"Instructs the server to send names in an RPL_NAMES reply "
|
||||
"in the long format.\r\n");
|
||||
else if (!strcmp(token, "USER"))
|
||||
else if (!strcasecmp(token, "USER"))
|
||||
snprintf(buff, PATH_MAX,"Syntax: USER <username> <hostname> <servername> <realname>\n"
|
||||
"This command is used at the beginning of a connection to specify the "
|
||||
"username, hostname, real name and initial user modes of the connecting "
|
||||
"client. <realname> may contain spaces, and thus must be prefixed with a "
|
||||
"colon.\r\n");
|
||||
else if (!strcmp(token, "USERHOST"))
|
||||
else if (!strcasecmp(token, "USERHOST"))
|
||||
snprintf(buff, PATH_MAX,"Syntatx: USERHOST <nickname> [<nickname> <nickname> ...]\n"
|
||||
"Returns a list of information about the nicknames specified.\r\n");
|
||||
else if (!strcmp(token, "USERIP"))
|
||||
else if (!strcasecmp(token, "USERIP"))
|
||||
snprintf(buff, PATH_MAX,"Syntatx: USERIP <nickname>\n"
|
||||
"Requests the direct IP address of the user with the "
|
||||
"specified nickname.\r\n");
|
||||
else if (!strcmp(token, "USERS"))
|
||||
else if (!strcasecmp(token, "USERS"))
|
||||
snprintf(buff, PATH_MAX,"Syntatx: USERS [<server>]\n"
|
||||
"Returns a list of users and information about those users "
|
||||
"in a format similar to the UNIX commands who, rusers and "
|
||||
"finger.\r\n");
|
||||
else if (!strcmp(token, "VERSION"))
|
||||
else if (!strcasecmp(token, "VERSION"))
|
||||
snprintf(buff, PATH_MAX,"Syntatx: VERSION [<server>]\n"
|
||||
"Returns the version of <server>, or the current server "
|
||||
"if omitted.\r\n");
|
||||
else if (!strcmp(token, "WALLOPS"))
|
||||
else if (!strcasecmp(token, "WALLOPS"))
|
||||
snprintf(buff, PATH_MAX,"Syntatx: WALLOPS <message>\n"
|
||||
"Sends <message> to all operators connected to the server, "
|
||||
"or all users with user mode 'w' set.\r\n");
|
||||
else if (!strcmp(token, "WATCH"))
|
||||
else if (!strcasecmp(token, "WATCH"))
|
||||
snprintf(buff, PATH_MAX,"Syntatx: WATCH [+/-<nicknames>]\n"
|
||||
"Adds or removes a user to a client's server-side friends "
|
||||
"list. More than one nickname may be specified in a "
|
||||
|
@ -271,17 +271,17 @@ _handle_help_cmd(char *token, char *buff)
|
|||
"\"-\" to designate whether it is being added or removed. "
|
||||
"Sending the command with no parameters returns the "
|
||||
"entries in the client's friends list.\r\n");
|
||||
else if (!strcmp(token, "WHO"))
|
||||
else if (!strcasecmp(token, "WHO"))
|
||||
snprintf(buff, PATH_MAX,"Syntatx: WHO [<name> [\"o\"]]\n"
|
||||
"Returns a list of users who match <name>. If the flag "
|
||||
"\"o\" is given, the server will only return information "
|
||||
"about IRC Operators.\r\n");
|
||||
else if (!strcmp(token, "WHOIS"))
|
||||
else if (!strcasecmp(token, "WHOIS"))
|
||||
snprintf(buff, PATH_MAX,"Syntatx: WHOIS [<server>] <nicknames>\n"
|
||||
"Returns information about the comma-separated list of "
|
||||
"nicknames masks <nicknames>. If <server> is given, the "
|
||||
"command is forwarded to it for processing.\r\n");
|
||||
else if (!strcmp(token, "WHOWAS"))
|
||||
else if (!strcasecmp(token, "WHOWAS"))
|
||||
snprintf(buff, PATH_MAX,"Syntatx: WHOWAS <nickname> [<count> [<server>]]\n"
|
||||
"Used to return information about a nickname that is no longer "
|
||||
"in use (due to client disconnection, or nickname changes). If "
|
||||
|
@ -309,7 +309,7 @@ _cmd_txt_handle(Express_Network *channel_net, const char *channel_name, char *st
|
|||
|
||||
eina_str_toupper(&cmd);
|
||||
tokens = eina_str_split(cmd, " ", 0);
|
||||
if (!strcmp(tokens[0], "/HELP"))
|
||||
if (!strcasecmp(tokens[0], "/HELP"))
|
||||
{
|
||||
_handle_help_cmd(tokens[1], buff);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue