Changeset b7bc432 in code
- Timestamp:
- Mar 4, 2014, 11:17:15 PM (11 years ago)
- Branches:
- master
- Children:
- efa8586
- Parents:
- 626f420
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cmd.c
r626f420 rb7bc432 87 87 } 88 88 89 icb_vis(whom, arg, ICB_MAXNICKLEN );89 icb_vis(whom, arg, ICB_MAXNICKLEN, VIS_SP); 90 90 91 91 LIST_FOREACH(s, &ig->sess, entry) { … … 129 129 } 130 130 131 icb_vis(whom, arg, ICB_MAXNICKLEN );131 icb_vis(whom, arg, ICB_MAXNICKLEN, VIS_SP); 132 132 133 133 /* who would be a target then? */ … … 160 160 } 161 161 162 icb_vis(group, arg, ICB_MAXGRPLEN );162 icb_vis(group, arg, ICB_MAXGRPLEN, VIS_SP); 163 163 164 164 LIST_FOREACH(ig, &groups, entry) { … … 237 237 if (strlen(arg) > ICB_MAXNICKLEN) 238 238 arg[ICB_MAXNICKLEN - 1] = '\0'; 239 icb_vis(nick, arg, ICB_MAXNICKLEN );239 icb_vis(nick, arg, ICB_MAXNICKLEN, VIS_SP); 240 240 LIST_FOREACH(s, &ig->sess, entry) { 241 241 if (strcmp(s->nick, nick) == 0) { … … 312 312 return; 313 313 } 314 icb_vis(whom, arg, ICB_MAXNICKLEN );314 icb_vis(whom, arg, ICB_MAXNICKLEN, VIS_SP); 315 315 LIST_FOREACH(s, &ig->sess, entry) { 316 316 if (strcmp(s->nick, whom) == 0) … … 344 344 return; 345 345 } 346 icb_vis(topic, arg, ICB_MAXTOPICLEN );346 icb_vis(topic, arg, ICB_MAXTOPICLEN, 0); 347 347 strlcpy(ig->topic, topic, sizeof ig->topic); 348 348 icb_status_group(ig, NULL, STATUS_TOPIC, … … 360 360 return icb_who(is, NULL); 361 361 362 icb_vis(group, arg, ICB_MAXGRPLEN );362 icb_vis(group, arg, ICB_MAXGRPLEN, VIS_SP); 363 363 LIST_FOREACH(ig, &groups, entry) { 364 364 if (strcmp(ig->name, group) == 0) -
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 { -
icb.h
r626f420 rb7bc432 139 139 int, const char *, ...); 140 140 void icb_who(struct icb_session *, struct icb_group *); 141 int icb_vis(char *, const char *, size_t );141 int icb_vis(char *, const char *, size_t, int); 142 142 143 143 /* callbacks from icbd.c */
Note:
See TracChangeset
for help on using the changeset viewer.