Mercurial > hg
diff mcabber/src/roster.c @ 772:464be13343a9
Store most data in UTF-8 internally
Only chat buffer data is still using 1 byte for char size.
User input still doesn't handle UTF-8 locales.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 25 Mar 2006 18:10:36 +0100 |
parents | ee03b56b93ee |
children | 46304b773a44 |
line wrap: on
line diff
--- a/mcabber/src/roster.c Sat Mar 25 18:00:40 2006 +0100 +++ b/mcabber/src/roster.c Sat Mar 25 18:10:36 2006 +0100 @@ -23,6 +23,7 @@ #include <string.h> #include "roster.h" +#include "utils.h" char *strrole[] = { /* Should match enum in roster.h */ @@ -1123,15 +1124,29 @@ roster *roster_usr; if (!buddylist || !current_buddy) return NULL; for (;;) { + gchar *jid_locale, *name_locale; + char *found = NULL; + buddy = g_list_next(buddy); if (!buddy) buddy = buddylist; roster_usr = (roster*)buddy->data; - if (roster_usr->jid && strcasestr(roster_usr->jid, string)) - return buddy; - if (roster_usr->name && strcasestr(roster_usr->name, string)) - return buddy; + + jid_locale = from_utf8(roster_usr->jid); + if (jid_locale) { + found = strcasestr(jid_locale, string); + g_free(jid_locale); + if (found) + return buddy; + } + name_locale = from_utf8(roster_usr->name); + if (name_locale) { + found = strcasestr(name_locale, string); + g_free(name_locale); + if (found) + return buddy; + } if (buddy == current_buddy) return NULL; // Back to the beginning, and no match found @@ -1181,12 +1196,12 @@ if (btype == ROSTER_TYPE_GROUP) { const char *bname = buddy_getname(BUDDATA(buddy)); if ((bname) && (*bname)) - list = g_slist_append(list, g_strdup(bname)); + list = g_slist_append(list, from_utf8(bname)); } } else { // ROSTER_TYPE_USER (jid) (or agent, or chatroom...) const char *bjid = buddy_getjid(BUDDATA(buddy)); if (bjid) - list = g_slist_append(list, g_strdup(bjid)); + list = g_slist_append(list, from_utf8(bjid)); } }