- Timestamp:
- Mar 4, 2014, 11:17:15 PM (11 years ago)
- Branches:
- master
- Children:
- efa8586
- Parents:
- 626f420
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
icb.c
r626f420 rb7bc432 25 25 #include <ctype.h> 26 26 #include <event.h> 27 #include <vis.h> 27 28 28 29 #include "icb.h" … … 150 151 151 152 if (!nick || strlen(nick) == 0 || 152 icb_vis(is->nick, nick, ICB_MAXNICKLEN )) {153 icb_vis(is->nick, nick, ICB_MAXNICKLEN, VIS_SP)) { 153 154 icb_error(is, "Invalid nick"); 154 155 icb_drop(is, NULL); … … 158 159 strlcpy(group, defgrp, ICB_MAXGRPLEN); 159 160 else 160 icb_vis(group, grp, ICB_MAXNICKLEN );161 icb_vis(group, grp, ICB_MAXNICKLEN, VIS_SP); 161 162 LIST_FOREACH(ig, &groups, entry) { 162 163 if (strcmp(ig->name, group) == 0) … … 186 187 187 188 if (client && strlen(client) > 0) 188 icb_vis(is->client, client, sizeof is->client );189 icb_vis(is->client, client, sizeof is->client, VIS_SP); 189 190 strlcpy(is->nick, nick, sizeof is->nick); 190 191 is->group = ig; … … 251 252 char whom[ICB_MAXNICKLEN]; 252 253 253 icb_vis(whom, to, ICB_MAXNICKLEN );254 icb_vis(whom, to, ICB_MAXNICKLEN, VIS_SP); 254 255 255 256 LIST_FOREACH(s, &ig->sess, entry) { … … 273 274 char command[32]; /* XXX */ 274 275 275 icb_vis(command, cmd, sizeof command );276 icb_vis(command, cmd, sizeof command, VIS_SP); 276 277 277 278 if ((handler = icb_cmd_lookup(command)) == NULL) { … … 614 615 */ 615 616 int 616 icb_vis(char *dst, const char *src, size_t dstsize )617 icb_vis(char *dst, const char *src, size_t dstsize, int flags) 617 618 { 618 619 int si = 0, di = 0, td; … … 621 622 if (src[si] == '%') 622 623 dst[di++] = '%', dst[di] = '%'; 623 else if (isgraph(src[si])) 624 else if (src[si] == ' ' && flags & VIS_SP) 625 dst[di] = '_'; 626 else if (isgraph(src[si]) || src[si] == ' ') 624 627 dst[di] = src[si]; 625 628 else {
Note:
See TracChangeset
for help on using the changeset viewer.