# HG changeset patch # User Nathan Walp # Date 1066149876 0 # Node ID 85fcaff1505d90f7702ab5183c6eeb7a49342c67 # Parent 1930e3d00ecdd3fca84baf5bad060090f95b1a4a [gaim-migrate @ 7839] put normalizing back in the realm of sanity (what was I thinking?) and fix jabber chat case sensitivity (as well as a few other things) committer: Tailor Script diff -r 1930e3d00ecd -r 85fcaff1505d src/protocols/jabber/chat.c --- a/src/protocols/jabber/chat.c Tue Oct 14 05:07:39 2003 +0000 +++ b/src/protocols/jabber/chat.c Tue Oct 14 16:44:36 2003 +0000 @@ -68,7 +68,7 @@ room_jid = g_strdup_printf("%s@%s", room, server); - chat = g_hash_table_lookup(js->chats, room_jid); + chat = g_hash_table_lookup(js->chats, jabber_normalize(room_jid)); g_free(room_jid); return chat; @@ -160,7 +160,7 @@ JabberChat *chat; char *room, *server, *handle, *passwd; xmlnode *presence, *x; - char *room_jid, *full_jid; + char *tmp, *room_jid, *full_jid; JabberStream *js = gc->proto_data; room = g_hash_table_lookup(data, "room"); @@ -174,7 +174,9 @@ if(jabber_chat_find(js, room, server)) return; - room_jid = g_strdup_printf("%s@%s", room, server); + tmp = g_strdup_printf("%s@%s", room, server); + room_jid = g_strdup(jabber_normalize(tmp)); + g_free(tmp); chat = g_new0(JabberChat, 1); chat->js = gc->proto_data; @@ -227,7 +229,7 @@ JabberStream *js = chat->js; char *room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - g_hash_table_remove(js->chats, room_jid); + g_hash_table_remove(js->chats, jabber_normalize(room_jid)); g_free(room_jid); g_free(chat->room); diff -r 1930e3d00ecd -r 85fcaff1505d src/protocols/jabber/jutil.c --- a/src/protocols/jabber/jutil.c Tue Oct 14 05:07:39 2003 +0000 +++ b/src/protocols/jabber/jutil.c Tue Oct 14 16:44:36 2003 +0000 @@ -179,12 +179,12 @@ slash = strrchr(jid, '/'); if(slash) - return g_strndup(jid, slash - jid); + return g_utf8_strdown(jid, slash - jid); else - return g_strdup(jid); + return g_utf8_strdown(jid, -1); } -const char *jabber_normalize(const GaimAccount *account, const char *in) +const char *jabber_normalize(const char *in) { static char buf[2048]; /* maximum legal length of a jabber jid */ char *tmp; diff -r 1930e3d00ecd -r 85fcaff1505d src/protocols/jabber/jutil.h --- a/src/protocols/jabber/jutil.h Tue Oct 14 05:07:39 2003 +0000 +++ b/src/protocols/jabber/jutil.h Tue Oct 14 16:44:36 2003 +0000 @@ -40,6 +40,6 @@ time_t str_to_time(const char *timestamp); const char *jabber_get_state_string(int state); -const char *jabber_normalize(const GaimAccount *account, const char *in); +const char *jabber_normalize(const char *in); #endif /* _GAIM_JABBER_JID_H_ */ diff -r 1930e3d00ecd -r 85fcaff1505d src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Tue Oct 14 05:07:39 2003 +0000 +++ b/src/protocols/msn/msn.c Tue Oct 14 16:44:36 2003 +0000 @@ -36,7 +36,7 @@ static GaimPlugin *my_protocol = NULL; -static const char *msn_normalize(const GaimAccount *account, const char *str); +static const char *msn_normalize(const char *str); typedef struct { @@ -461,7 +461,7 @@ gaim_connection_update_progress(gc, _("Connecting"), 0, MSN_CONNECT_STEPS); /* Hmm, I don't like this. */ - username = msn_normalize(account, gaim_account_get_username(account)); + username = msn_normalize(gaim_account_get_username(account)); if (strcmp(username, gaim_account_get_username(account))) gaim_account_set_username(account, username); @@ -654,7 +654,7 @@ char outparams[MSN_BUF_LEN]; GSList *l; - who = msn_normalize(gc->account, name); + who = msn_normalize(name); if (strchr(who, ' ')) { /* This is a broken blist entry. */ @@ -1187,7 +1187,7 @@ } static const char * -msn_normalize(const GaimAccount *account, const char *str) +msn_normalize(const char *str) { static char buf[BUF_LEN]; diff -r 1930e3d00ecd -r 85fcaff1505d src/protocols/zephyr/zephyr.c --- a/src/protocols/zephyr/zephyr.c Tue Oct 14 05:07:39 2003 +0000 +++ b/src/protocols/zephyr/zephyr.c Tue Oct 14 16:44:36 2003 +0000 @@ -71,7 +71,7 @@ return;\ } -static const char *zephyr_normalize(const GaimAccount *, const char *); +static const char *zephyr_normalize(const char *); /* this is so bad, and if Zephyr weren't so fucked up to begin with I * wouldn't do this. but it is so i will. */ @@ -307,7 +307,7 @@ { GList *curr; for (curr = pending_zloc_names; curr != NULL; curr = curr->next) { - if (!g_ascii_strcasecmp(zephyr_normalize(NULL, who), (char*)curr->data)) { + if (!g_ascii_strcasecmp(zephyr_normalize(who), (char*)curr->data)) { g_free((char*)curr->data); pending_zloc_names = g_list_remove(pending_zloc_names, curr->data); return TRUE; @@ -466,7 +466,7 @@ continue; if(b->account->gc == zgc) { const char *chk; - chk = zephyr_normalize(b->account, b->name); + chk = zephyr_normalize(b->name); /* doesn't matter if this fails or not; we'll just move on to the next one */ ZRequestLocations(chk, &ald, UNACKED, ZAUTH); free(ald.user); @@ -783,9 +783,9 @@ notice.z_class = zt->class; notice.z_class_inst = zt->instance; if (!g_ascii_strcasecmp(zt->recipient, "*")) - notice.z_recipient = zephyr_normalize(NULL, ""); + notice.z_recipient = zephyr_normalize(""); else - notice.z_recipient = zephyr_normalize(NULL, zt->recipient); + notice.z_recipient = zephyr_normalize(zt->recipient); notice.z_sender = 0; notice.z_default_format = "Class $class, Instance $instance:\n" @@ -832,7 +832,7 @@ return 1; } -static const char *zephyr_normalize(const GaimAccount *account, const char *orig) +static const char *zephyr_normalize(const char *orig) { static char buf[80]; if (!g_ascii_strcasecmp(orig, "")) { @@ -851,12 +851,12 @@ { ZAsyncLocateData_t ald; - if (ZRequestLocations(zephyr_normalize(gc->account, who), &ald, UNACKED, ZAUTH) + if (ZRequestLocations(zephyr_normalize(who), &ald, UNACKED, ZAUTH) != ZERR_NONE) { return; } pending_zloc_names = g_list_append(pending_zloc_names, - g_strdup(zephyr_normalize(gc->account, who))); + g_strdup(zephyr_normalize(who))); } static GList *zephyr_buddy_menu(GaimConnection *gc, const char *who) diff -r 1930e3d00ecd -r 85fcaff1505d src/prpl.h --- a/src/prpl.h Tue Oct 14 05:07:39 2003 +0000 +++ b/src/prpl.h Tue Oct 14 16:44:36 2003 +0000 @@ -306,7 +306,7 @@ void (*convo_closed)(GaimConnection *, const char *who); - const char *(*normalize)(const GaimAccount *, const char *); + const char *(*normalize)(const char *); void (*set_buddy_icon)(GaimConnection *, const char *filename); diff -r 1930e3d00ecd -r 85fcaff1505d src/util.c --- a/src/util.c Tue Oct 14 05:07:39 2003 +0000 +++ b/src/util.c Tue Oct 14 16:44:36 2003 +0000 @@ -1262,7 +1262,7 @@ prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); if(prpl_info && prpl_info->normalize) { - return prpl_info->normalize(account, s); + return prpl_info->normalize(s); } else { static char buf[BUF_LEN]; char *tmp;