diff -r f83643b0a067 -r c3347685b9ef src/protocols/msn/utils.c --- a/src/protocols/msn/utils.c Sat Aug 02 15:27:00 2003 +0000 +++ b/src/protocols/msn/utils.c Sun Aug 03 02:16:15 2003 +0000 @@ -80,33 +80,38 @@ return buf; } -char * -msn_parse_format(const char *mime) +void +msn_parse_format(const char *mime, char **pre_ret, char **post_ret) { char *cur; - GString *ret = g_string_new(NULL); + GString *pre = g_string_new(NULL); + GString *post = g_string_new(NULL); unsigned int colors[3]; + if (pre_ret != NULL) *pre_ret = NULL; + if (post_ret != NULL) *post_ret = NULL; + cur = strstr(mime, "FN="); if (cur && (*(cur = cur + 3) != ';')) { - ret = g_string_append(ret, ""); + pre = g_string_append(pre, "\">"); + post = g_string_prepend(post, ""); } - + cur = strstr(mime, "EF="); if (cur && (*(cur = cur + 3) != ';')) { while (*cur && *cur != ';') { - ret = g_string_append_c(ret, '<'); - ret = g_string_append_c(ret, *cur); - ret = g_string_append_c(ret, '>'); + pre = g_string_append_c(pre, '<'); + pre = g_string_append_c(pre, *cur); + pre = g_string_append_c(pre, '>'); cur++; } } @@ -136,12 +141,20 @@ "", colors[2], colors[1], colors[0]); - ret = g_string_append(ret, tag); + pre = g_string_append(pre, tag); + post = g_string_prepend(post, ""); } } - cur = msn_url_decode(ret->str); - g_string_free(ret, TRUE); + cur = msn_url_decode(pre->str); + g_string_free(pre, TRUE); + + if (pre_ret != NULL) + *pre_ret = cur; - return cur; + cur = msn_url_decode(post->str); + g_string_free(post, TRUE); + + if (post_ret != NULL) + *post_ret = cur; }