comparison nnchat.c @ 123:0a07138e75bc

Rename function getColor() to getHexColorDef().
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 29 Oct 2010 10:58:39 +0300
parents e564dd9df07c
children d03ebefb92a6
comparison
equal deleted inserted replaced
122:e564dd9df07c 123:0a07138e75bc
68 }; 68 };
69 69
70 const int optListN = (sizeof(optList) / sizeof(optList[0])); 70 const int optListN = (sizeof(optList) / sizeof(optList[0]));
71 71
72 72
73 int getColor(char *str) 73 int getHexColorDef(char *str)
74 { 74 {
75 char *p = str; 75 char *p = str;
76 int len, val = 0; 76 int len, val = 0;
77 77
78 for (len = 0; *p && len < 6; p++, len++) { 78 for (len = 0; *p && len < 6; p++, len++) {
116 case 3: 116 case 3:
117 optServer = optArg; 117 optServer = optArg;
118 break; 118 break;
119 119
120 case 4: 120 case 4:
121 if ((optUserColor = getColor(optArg)) < 0) { 121 if ((optUserColor = getHexColorDef(optArg)) < 0) {
122 THERR("Invalid color argument '%s', should be a RGB hex triplet '000000'.\n", 122 THERR("Invalid color argument '%s', should be a RGB hex triplet '000000'.\n",
123 optArg); 123 optArg);
124 return FALSE; 124 return FALSE;
125 } 125 }
126 THMSG(1, "Using color #%06x\n", optUserColor); 126 THMSG(1, "Using color #%06x\n", optUserColor);
559 if (*buf == 0) { 559 if (*buf == 0) {
560 return 1; 560 return 1;
561 } else if (!strncasecmp(buf, "/color ", 7)) { 561 } else if (!strncasecmp(buf, "/color ", 7)) {
562 /* Change color */ 562 /* Change color */
563 int tmpInt; 563 int tmpInt;
564 if ((tmpInt = getColor(buf+7)) < 0) { 564 if ((tmpInt = getHexColorDef(buf+7)) < 0) {
565 printMsg("Invalid color value '%s'\n", buf+7); 565 printMsg("Invalid color value '%s'\n", buf+7);
566 return 1; 566 return 1;
567 } 567 }
568 optUserColor = tmpInt; 568 optUserColor = tmpInt;
569 printMsg("Setting color to #%06x\n", optUserColor); 569 printMsg("Setting color to #%06x\n", optUserColor);