From 47ab9a9c9411f14bb95da9bfb97a943e1c531c48 Mon Sep 17 00:00:00 2001 From: dequis Date: Fri, 27 Nov 2015 20:42:00 -0300 Subject: misc.c: Add a str_reject_chars function, use it in otr_filter_colors --- otr.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'otr.c') diff --git a/otr.c b/otr.c index 201aa816..4888691a 100644 --- a/otr.c +++ b/otr.c @@ -750,14 +750,9 @@ void op_create_instag(void *opdata, const char *account, const char *protocol) } } -static char *otr_filter_colors(char *msg) { - int i; - for (i = 0; msg[i]; i++) { - if (msg[i] == '\x02' || msg[i] == '\x03') { - msg[i] = '?'; - } - } - return msg; +static char *otr_filter_colors(char *msg) +{ + return str_reject_chars(msg, "\x02\x03", '?'); } /* returns newly allocated string */ -- cgit v1.2.3