Mercurial > hg > nnchat
comparison nnchat.c @ 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 |
comparison
equal
deleted
inserted
replaced
110:8af4072dc31a | 111:9db08807018f |
---|---|
564 buf[bufLen--] = 0; | 564 buf[bufLen--] = 0; |
565 | 565 |
566 /* Check for special user commands */ | 566 /* Check for special user commands */ |
567 if (*buf == 0) { | 567 if (*buf == 0) { |
568 return 1; | 568 return 1; |
569 } else if (!strncmp(buf, "/color ", 7)) { | 569 } else if (!strncasecmp(buf, "/color ", 7)) { |
570 /* Change color */ | 570 /* Change color */ |
571 int tmpInt; | 571 int tmpInt; |
572 if ((tmpInt = getColor(buf+7)) < 0) { | 572 if ((tmpInt = getColor(buf+7)) < 0) { |
573 printMsg("Invalid color value '%s'\n", buf+7); | 573 printMsg("Invalid color value '%s'\n", buf+7); |
574 return 1; | 574 return 1; |
575 } | 575 } |
576 optUserColor = tmpInt; | 576 optUserColor = tmpInt; |
577 printMsg("Setting color to #%06x\n", optUserColor); | 577 printMsg("Setting color to #%06x\n", optUserColor); |
578 nn_send_msg(sock, optUserName2, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor); | 578 nn_send_msg(sock, optUserName2, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor); |
579 return 0; | 579 return 0; |
580 } else if (!strncmp(buf, "/w ", 3)) { | 580 } else if (!strncasecmp(buf, "/w ", 3)) { |
581 /* Open given username's profile via firefox in a new tab */ | 581 /* Open given username's profile via firefox in a new tab */ |
582 char *name = buf + 3; | 582 char *name = buf + 3; |
583 pid_t pud; | 583 pid_t pud; |
584 tmpStr = nn_encode_str1(name); | 584 tmpStr = nn_encode_str1(name); |
585 snprintf(tmpBuf, sizeof(tmpBuf), "firefox -remote \"openurl(http://www.newbienudes.com/profile/%s/,new-tab)\"", tmpStr); | 585 snprintf(tmpBuf, sizeof(tmpBuf), "firefox -remote \"openurl(http://www.newbienudes.com/profile/%s/,new-tab)\"", tmpStr); |
587 | 587 |
588 printMsg("Opening profile for: %s\n", name); | 588 printMsg("Opening profile for: %s\n", name); |
589 printMsg("%s\n", tmpBuf); | 589 printMsg("%s\n", tmpBuf); |
590 system(tmpBuf); | 590 system(tmpBuf); |
591 return 0; | 591 return 0; |
592 } else if (!strncmp(buf, "/to ", 4)) { | 592 } else if (!strncasecmp(buf, "/to ", 4)) { |
593 /* Set private messaging target */ | 593 /* Set private messaging target */ |
594 th_free(setTarget); | 594 th_free(setTarget); |
595 setTarget = th_strdup(buf + 4); | 595 setTarget = th_strdup(buf + 4); |
596 printMsg("Set prv target to '%s'\n", setTarget); | 596 printMsg("Set prv target to '%s'\n", setTarget); |
597 return 0; | 597 return 0; |
598 } else if (!strncmp(buf, "/who", 4)) { | 598 } else if (!strncasecmp(buf, "/who", 4)) { |
599 /* Alias /who to /listallusers */ | 599 /* Alias /who to /listallusers */ |
600 snprintf(tmpBuf, sizeof(tmpBuf), "/listallusers"); | 600 snprintf(tmpBuf, sizeof(tmpBuf), "/listallusers"); |
601 buf = tmpBuf; | 601 buf = tmpBuf; |
602 } else if (setPrvMode) { | 602 } else if (setPrvMode) { |
603 /* Private chat mode, send as PRV */ | 603 /* Private chat mode, send as PRV */ |