changeset 111:9db08807018f

Make local commands case-insensitive.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 24 Oct 2010 18:44:59 +0300
parents 8af4072dc31a
children c4865ac2386c
files nnchat.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Sun Oct 24 18:28:22 2010 +0300
+++ b/nnchat.c	Sun Oct 24 18:44:59 2010 +0300
@@ -566,7 +566,7 @@
     /* Check for special user commands */
     if (*buf == 0) {
         return 1;
-    } else if (!strncmp(buf, "/color ", 7)) {
+    } else if (!strncasecmp(buf, "/color ", 7)) {
         /* Change color */
         int tmpInt;
         if ((tmpInt = getColor(buf+7)) < 0) {
@@ -577,7 +577,7 @@
         printMsg("Setting color to #%06x\n", optUserColor);
         nn_send_msg(sock, optUserName2, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor);
         return 0;
-    } else if (!strncmp(buf, "/w ", 3)) {
+    } else if (!strncasecmp(buf, "/w ", 3)) {
         /* Open given username's profile via firefox in a new tab */
         char *name = buf + 3;
         pid_t pud;
@@ -589,13 +589,13 @@
         printMsg("%s\n", tmpBuf);
         system(tmpBuf);
         return 0;
-    } else if (!strncmp(buf, "/to ", 4)) {
+    } else if (!strncasecmp(buf, "/to ", 4)) {
         /* Set private messaging target */
         th_free(setTarget);
         setTarget = th_strdup(buf + 4);
         printMsg("Set prv target to '%s'\n", setTarget);
         return 0;
-    } else if (!strncmp(buf, "/who", 4)) {
+    } else if (!strncasecmp(buf, "/who", 4)) {
         /* Alias /who to /listallusers */
         snprintf(tmpBuf, sizeof(tmpBuf), "/listallusers");
         buf = tmpBuf;