# HG changeset patch # User Nathan Walp # Date 1047772909 0 # Node ID 677d3cb193a1ee954cffb8715e6f31f6ae594a56 # Parent 9212d1c5b7dced181d036250f43b4e4ca97fb03f [gaim-migrate @ 5113] this removes all the remaining deprecated glib, gdk, gdk-pixbuf, and gtk function calls. Hopefully I didn't break anything. Most of this is due to the deprecation of g_strcasecmp and g_strncasecmp. Two functions I never thought would be deprecated, but apparently they're no good at comparing utf8 text. g_ascii_str{,n}casecmp is OK when you're sure that it's ASCII. Otherwise, we're supposed to use g_utf8_collate(), except that it is case sensitive. Since glib doesn't currently have a case-insensitive one, I wrote one. If you need to compare utf8 text, you can use gaim_utf8_strcasecmp(). I have to go do dishes now. committer: Tailor Script diff -r 9212d1c5b7dc -r 677d3cb193a1 configure.ac --- a/configure.ac Sat Mar 15 22:22:39 2003 +0000 +++ b/configure.ac Sun Mar 16 00:01:49 2003 +0000 @@ -147,7 +147,7 @@ *** always available at http://www.gtk.org/.])) AC_PATH_PROG(gaimpath, gaim) -CFLAGS="$CFLAGS $GTK_CFLAGS -DGTK_DISABLE_DEPRECATED" +CFLAGS="$CFLAGS $GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" AC_PATH_X diff -r 9212d1c5b7dc -r 677d3cb193a1 configure.in --- a/configure.in Sat Mar 15 22:22:39 2003 +0000 +++ b/configure.in Sun Mar 16 00:01:49 2003 +0000 @@ -138,7 +138,7 @@ *** always available at http://www.gtk.org/.])) AC_PATH_PROG(gaimpath, gaim) -CFLAGS="$CFLAGS $GTK_CFLAGS -DGTK_DISABLE_DEPRECATED" +CFLAGS="$CFLAGS $GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" AC_PATH_X diff -r 9212d1c5b7dc -r 677d3cb193a1 plugins/notify.c --- a/plugins/notify.c Sat Mar 15 22:22:39 2003 +0000 +++ b/plugins/notify.c Sun Mar 16 00:01:49 2003 +0000 @@ -296,7 +296,7 @@ g_snprintf(buf, sizeof(buf), "[%d] %s", number, win->title); } else if (!c) { g_snprintf(buf, sizeof(buf), "[1] %s", win->title); - } else if (!g_strncasecmp(buf, "[", 1)) { + } else if (buf[0]== '[' ) { g_snprintf(buf, sizeof(buf), "[%d] %s", c+1, &win->title[3+length]); } gtk_window_set_title(win, buf); @@ -308,7 +308,7 @@ int length; strncpy(buf, win->title, sizeof(buf)); - if (!g_strncasecmp(buf, "[", 1)) { + if (buf[0] == '[') { Number = counter(buf, &length); g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]); gtk_window_set_title(win, buf); @@ -322,7 +322,7 @@ GtkWindow *win = GTK_WINDOW(widget); strncpy(buf, win->title, sizeof(buf)); - if (g_strncasecmp(buf, "\"", 1)) { + if (buf[0] != '\"') { g_snprintf(buf, sizeof(buf), "\"%s\"", win->title); gtk_window_set_title(win, buf); } @@ -333,7 +333,7 @@ GtkWindow *win = GTK_WINDOW(widget); strncpy(buf, win->title, sizeof(buf)); - if (!g_strncasecmp(buf, "\"", 1)) { + if (buf[0] == '\"') { g_snprintf(buf, strlen(buf) - 1, "%s", &win->title[1]); gtk_window_set_title(win, buf); return TRUE; diff -r 9212d1c5b7dc -r 677d3cb193a1 src/away.c --- a/src/away.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/away.c Sun Mar 16 00:01:49 2003 +0000 @@ -72,7 +72,7 @@ while (templist) { struct queued_message *qm = templist->data; if (templist->data) { - if (!g_strcasecmp(qm->name, name)) { + if (!gaim_utf8_strcasecmp(qm->name, name)) { struct gaim_account *account = NULL; if (g_slist_index(gaim_accounts, qm->account) >= 0) diff -r 9212d1c5b7dc -r 677d3cb193a1 src/conversation.c --- a/src/conversation.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/conversation.c Sun Mar 16 00:01:49 2003 +0000 @@ -88,11 +88,9 @@ char *msg, *who, *p; int n; - msg = g_strdup(message); - g_strdown(msg); - - who = g_strdup(gc->username); - g_strdown(who); + msg = g_utf8_strdown(message, -1); + + who = g_utf8_strdown(gc->username, -1); n = strlen(who); if ((p = strstr(msg, who)) != NULL) { @@ -106,14 +104,13 @@ g_free(who); - if (!g_strcasecmp(gc->username, gc->displayname)) { + if (!gaim_utf8_strcasecmp(gc->username, gc->displayname)) { g_free(msg); return FALSE; } - who = g_strdup(gc->displayname); - g_strdown(who); + who = g_utf8_strdown(gc->displayname, -1); n = strlen(who); if (n > 0 && (p = strstr(msg, who)) != NULL) { @@ -1342,7 +1339,7 @@ for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) { c = (struct gaim_conversation *)cnv->data; - if (!g_strcasecmp(cuser, normalize(gaim_conversation_get_name(c)))) + if (!gaim_utf8_strcasecmp(cuser, normalize(gaim_conversation_get_name(c)))) break; c = NULL; @@ -1368,7 +1365,7 @@ for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) { c = (struct gaim_conversation *)cnv->data; - if (!g_strcasecmp(cuser, normalize(gaim_conversation_get_name(c))) && + if (!gaim_utf8_strcasecmp(cuser, normalize(gaim_conversation_get_name(c))) && account == gaim_conversation_get_account(c)) { break; @@ -1780,15 +1777,15 @@ const char *ign = (const char *)ignored->data; - if (!g_strcasecmp(user, ign) || - ((*ign == '+' || *ign == '%') && !g_strcasecmp(user, ign + 1))) + if (!gaim_utf8_strcasecmp(user, ign) || + ((*ign == '+' || *ign == '%') && !gaim_utf8_strcasecmp(user, ign + 1))) return ign; if (*ign == '@') { ign++; - if ((*ign == '+' && !g_strcasecmp(user, ign + 1)) || - (*ign != '+' && !g_strcasecmp(user, ign))) + if ((*ign == '+' && !gaim_utf8_strcasecmp(user, ign + 1)) || + (*ign != '+' && !gaim_utf8_strcasecmp(user, ign))) return ign; } } @@ -1874,8 +1871,8 @@ str = g_strdup(normalize(who)); - if (!g_strcasecmp(str, normalize(gc->username)) || - !g_strcasecmp(str, normalize(gc->displayname))) { + if (!gaim_utf8_strcasecmp(str, normalize(gc->username)) || + !gaim_utf8_strcasecmp(str, normalize(gc->displayname))) { flags |= WFLAG_SEND; } @@ -1968,7 +1965,7 @@ names != NULL; names = names->next) { - if (!g_strcasecmp((char *)names->data, old_user)) { + if (!gaim_utf8_strcasecmp((char *)names->data, old_user)) { gaim_chat_set_users(chat, g_list_remove(gaim_chat_get_users(chat), names->data)); break; @@ -2015,7 +2012,7 @@ names != NULL; names = names->next) { - if (!g_strcasecmp((char *)names->data, user)) { + if (!gaim_utf8_strcasecmp((char *)names->data, user)) { gaim_chat_set_users(chat, g_list_remove(gaim_chat_get_users(chat), names->data)); break; diff -r 9212d1c5b7dc -r 677d3cb193a1 src/core.c --- a/src/core.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/core.c Sun Mar 16 00:01:49 2003 +0000 @@ -96,9 +96,11 @@ gint UI_write(struct UI *ui, guchar *data, gint len) { + GError *error; gint sent; /* we'll let the write silently fail because the read will pick it up as dead */ - g_io_channel_write(ui->channel, data, len, &sent); + g_io_channel_write_chars(ui->channel, data, len, &sent, &error); + g_free(error); return sent; } @@ -149,6 +151,7 @@ static void meta_handler(struct UI *ui, guchar subtype, guchar *data) { struct gaim_cui_packet *p; + GError *error = NULL; switch (subtype) { case CUI_META_LIST: break; @@ -156,7 +159,7 @@ while (uis) { ui = uis->data; uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); g_source_remove(ui->inpa); g_free(ui); } @@ -164,7 +167,7 @@ break; case CUI_META_DETACH: uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); g_source_remove(ui->inpa); g_free(ui); break; @@ -177,6 +180,9 @@ debug_printf("unhandled meta subtype %d\n", subtype); break; } + + if(error) + g_free(error); } static void plugin_handler(struct UI *ui, guchar subtype, guchar *data) @@ -292,9 +298,13 @@ gint total = 0; gint cur; + GError *error; + while (total < len) { - if (g_io_channel_read(source, buf + total, len - total, &cur) != G_IO_ERROR_NONE) + if (g_io_channel_read_chars(source, buf + total, len - total, &cur, &error) != G_IO_STATUS_NORMAL) { + g_free(error); return -1; + } if (cur == 0) return total; total += cur; @@ -332,13 +342,17 @@ guchar subtype; guint32 len; + GError *error; + guchar *in; /* no byte order worries! this'll change if we go to TCP */ if (gaim_recv(source, &type, sizeof(type)) != sizeof(type)) { debug_printf("UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); + if(error) + g_free(error); g_source_remove(ui->inpa); g_free(ui); return FALSE; @@ -347,7 +361,9 @@ if (gaim_recv(source, &subtype, sizeof(subtype)) != sizeof(subtype)) { debug_printf("UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); + if(error) + g_free(error); g_source_remove(ui->inpa); g_free(ui); return FALSE; @@ -356,7 +372,9 @@ if (gaim_recv(source, (guchar *)&len, sizeof(len)) != sizeof(len)) { debug_printf("UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); + if(error) + g_free(error); g_source_remove(ui->inpa); g_free(ui); return FALSE; @@ -367,7 +385,9 @@ if (gaim_recv(source, in, len) != len) { debug_printf("UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); + if(error) + g_free(error); g_source_remove(ui->inpa); g_free(ui); return FALSE; diff -r 9212d1c5b7dc -r 677d3cb193a1 src/dialogs.c --- a/src/dialogs.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/dialogs.c Sun Mar 16 00:01:49 2003 +0000 @@ -163,7 +163,7 @@ continue; if (!who) continue; - if (!g_strcasecmp(normalize(who), d->who)) + if (!gaim_utf8_strcasecmp(normalize(who), d->who)) return d; } return NULL; @@ -271,11 +271,11 @@ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(gtkconv->toolbar.font), FALSE); gtkconv->dialogs.font = NULL; - } else if (!g_strcasecmp(object_data, "smiley dialog")) { + } else if (!g_ascii_strcasecmp(object_data, "smiley dialog")) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.smiley), FALSE); gtkconv->dialogs.smiley = NULL; - } else if (!g_strcasecmp(object_data, "log dialog")) { + } else if (!g_ascii_strcasecmp(object_data, "log dialog")) { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->toolbar.log), FALSE); gtkconv->dialogs.log = NULL; @@ -566,7 +566,7 @@ if (resp == GTK_RESPONSE_OK) { who = g_strdup(normalize(gtk_entry_get_text(GTK_ENTRY(info->entry)))); - if (!g_strcasecmp(who, "")) { + if (!g_ascii_strcasecmp(who, "")) { g_free(who); return; } @@ -1844,7 +1844,7 @@ new1 = gtk_entry_get_text(GTK_ENTRY(b->new1)); new2 = gtk_entry_get_text(GTK_ENTRY(b->new2)); - if (g_strcasecmp(new1, new2)) { + if (g_utf8_collate(new1, new2)) { do_error_dialog(_("New Passwords Do Not Match"), NULL, GAIM_ERROR); return; } @@ -3902,7 +3902,7 @@ if (new_name && (strlen(new_name) != 0) && strcmp(new_name, g->name)) { char *prevname; - if ((orig = gaim_find_group(new_name)) != NULL && g_strcasecmp(new_name, g->name)) { + if ((orig = gaim_find_group(new_name)) != NULL && gaim_utf8_strcasecmp(new_name, g->name)) { gaim_blist_rename_group(orig, g->name); accts = gaim_group_get_accounts(g); while(accts) { @@ -4225,8 +4225,8 @@ /* this causes clipping on lots of buttons with long text */ /* gtk_widget_set_size_request(button, 75, 30);*/ gtk_widget_show(button); - gdk_pixmap_unref(pm); - gdk_bitmap_unref(mask); + g_object_unref(G_OBJECT(pm)); + g_object_unref(G_OBJECT(mask)); return button; } @@ -4261,8 +4261,8 @@ gtk_widget_show(pixmap); - gdk_pixmap_unref(pm); - gdk_bitmap_unref(mask); + g_object_unref(G_OBJECT(pm)); + g_object_unref(G_OBJECT(mask)); } if (dispstyle == 2 || dispstyle == 1) { diff -r 9212d1c5b7dc -r 677d3cb193a1 src/dnd-hints.c --- a/src/dnd-hints.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/dnd-hints.c Sun Mar 16 00:01:49 2003 +0000 @@ -61,9 +61,9 @@ g_return_val_if_fail(pixbuf, NULL); gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, &bitmap, 128); - gdk_pixbuf_unref(pixbuf); + g_object_unref(G_OBJECT(pixbuf)); - gtk_widget_push_colormap(gdk_rgb_get_cmap()); + gtk_widget_push_colormap(gdk_rgb_get_colormap()); win = gtk_window_new(GTK_WINDOW_POPUP); pix = gtk_image_new_from_pixmap(pixmap, bitmap); gtk_widget_realize(win); @@ -71,8 +71,8 @@ gtk_widget_shape_combine_mask(win, bitmap, 0, 0); gtk_widget_pop_colormap(); - gdk_pixmap_unref(pixmap); - gdk_bitmap_unref(bitmap); + g_object_unref(G_OBJECT(pixmap)); + g_object_unref(G_OBJECT(bitmap)); gtk_widget_show_all(pix); @@ -95,7 +95,7 @@ else { gdk_window_get_origin(w->window, &ox, &oy); - gdk_window_get_size(w->window, &width, &height); + gdk_drawable_get_size(w->window, &width, &height); } if (x1) *x1 = ox; diff -r 9212d1c5b7dc -r 677d3cb193a1 src/gaim.h --- a/src/gaim.h Sat Mar 15 22:22:39 2003 +0000 +++ b/src/gaim.h Sun Mar 16 00:01:49 2003 +0000 @@ -454,6 +454,7 @@ * if everything fails it returns NULL. */ char *gaim_try_conv_to_utf8(const char *str); char *gaim_getip_from_fd(int fd); +gint gaim_utf8_strcasecmp(const gchar *a, const gchar *b); /* Functions in log.h */ extern FILE *open_log_file (const char *, int); diff -r 9212d1c5b7dc -r 677d3cb193a1 src/gtkconv.c --- a/src/gtkconv.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/gtkconv.c Sun Mar 16 00:01:49 2003 +0000 @@ -799,7 +799,7 @@ buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); message = gtk_entry_get_text(GTK_ENTRY(info->message)); - if (!g_strcasecmp(buddy, "")) { + if (!g_ascii_strcasecmp(buddy, "")) { g_free(info); return; @@ -2085,7 +2085,7 @@ /* Make our menu item */ menuitem = gtk_radio_menu_item_new_with_label(group, gc->username); - group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menuitem)); + group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); /* Do some evil, see some evil, speak some evil. */ box = gtk_hbox_new(FALSE, 0); @@ -2167,7 +2167,7 @@ /* Make our menu item */ menuitem = gtk_radio_menu_item_new_with_label(group, account->username); - group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menuitem)); + group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); /* Do some evil, see some evil, speak some evil. */ box = gtk_hbox_new(FALSE, 0); @@ -2326,15 +2326,15 @@ char *nick = nicks->data; /* this checks to see if the current nick could be a completion */ - if (g_strncasecmp(nick, entered, strlen(entered))) { + if (g_ascii_strncasecmp(nick, entered, strlen(entered))) { if (*nick != '+' && *nick != '@' && *nick != '%') continue; - if (g_strncasecmp(nick + 1, entered, strlen(entered))) { + if (g_ascii_strncasecmp(nick + 1, entered, strlen(entered))) { if (nick[0] != '@' || nick[1] != '+') continue; - if (g_strncasecmp(nick + 2, entered, strlen(entered))) + if (g_ascii_strncasecmp(nick + 2, entered, strlen(entered))) continue; else nick += 2; @@ -2392,7 +2392,7 @@ partial = g_strdup(nick); } else if (most_matched) { - while (g_strncasecmp(nick, partial, most_matched)) + while (g_ascii_strncasecmp(nick, partial, most_matched)) most_matched--; partial[most_matched] = 0; @@ -2482,7 +2482,7 @@ } } - if (*c != '\0' && !g_strncasecmp(c, "/me ", 4)) { + if (*c != '\0' && !g_ascii_strncasecmp(c, "/me ", 4)) { memmove(c, c + 4, len - 3); return TRUE; @@ -3757,7 +3757,7 @@ gtk_widget_destroy(gtkconv->u.im->save_icon); if (gtkconv->u.im->anim != NULL) - gdk_pixbuf_animation_unref(gtkconv->u.im->anim); + g_object_unref(G_OBJECT(gtkconv->u.im->anim)); g_free(gtkconv->u.im); } @@ -4142,7 +4142,7 @@ char *u = (char *)names->data; - if (!g_strcasecmp(u, old_name)) { + if (!gaim_utf8_strcasecmp(u, old_name)) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) @@ -4153,7 +4153,7 @@ gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); - if (!g_strcasecmp(old_name, val)) { + if (!gaim_utf8_strcasecmp(old_name, val)) { gtk_list_store_remove(GTK_LIST_STORE(model), &iter); break; } @@ -4200,7 +4200,7 @@ char *u = (char *)names->data; - if (!g_strcasecmp(u, user)) { + if (!gaim_utf8_strcasecmp(u, user)) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) @@ -4211,7 +4211,7 @@ gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); - if (!g_strcasecmp(user, val)) + if (!gaim_utf8_strcasecmp(user, val)) gtk_list_store_remove(GTK_LIST_STORE(model), &iter); f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); @@ -4471,7 +4471,7 @@ gtkconv->u.im->icon->parent->parent); if (gtkconv->u.im->anim != NULL) - gdk_pixbuf_animation_unref(gtkconv->u.im->anim); + g_object_unref(G_OBJECT(gtkconv->u.im->anim)); if (gtkconv->u.im->icon_timer != 0) g_source_remove(gtkconv->u.im->icon_timer); @@ -4515,13 +4515,13 @@ GDK_INTERP_NEAREST); gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); - gdk_pixbuf_unref(scale); + g_object_unref(G_OBJECT(scale)); gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); - gdk_pixmap_unref(pm); + g_object_unref(G_OBJECT(pm)); gtk_widget_queue_draw(gtkconv->u.im->icon); if (bm) - gdk_bitmap_unref(bm); + g_object_unref(G_OBJECT(bm)); delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; @@ -4658,6 +4658,9 @@ if (gaim_conversation_get_gc(conv) == NULL) return; + if(gtkconv->u.im->anim) + g_object_unref(G_OBJECT(gtkconv->u.im->anim)); + if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), gaim_conversation_get_name(conv))) != NULL) { char *file = gaim_buddy_get_setting(buddy, "buddy_icon"); @@ -4699,6 +4702,9 @@ if (!gtkconv->u.im->anim) return; + if(gtkconv->u.im->iter) + g_object_unref(G_OBJECT(gtkconv->u.im->iter)); + if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { gtkconv->u.im->iter = NULL; delay = 0; @@ -4724,7 +4730,7 @@ conv); gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); - gdk_pixbuf_unref(scale); + g_object_unref(G_OBJECT(scale)); frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(frame), @@ -4747,10 +4753,10 @@ if(im_options & OPT_IM_NO_ANIMATION) stop_anim(NULL, conv); - gdk_pixmap_unref(pm); + g_object_unref(G_OBJECT(pm)); if (bm) - gdk_bitmap_unref(bm); + g_object_unref(G_OBJECT(bm)); } void diff -r 9212d1c5b7dc -r 677d3cb193a1 src/gtkimhtml.c --- a/src/gtkimhtml.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/gtkimhtml.c Sun Mar 16 00:01:49 2003 +0000 @@ -532,14 +532,14 @@ return t->image->icon; } -#define VALID_TAG(x) if (!g_strncasecmp (string, x ">", strlen (x ">"))) { \ +#define VALID_TAG(x) if (!g_ascii_strncasecmp (string, x ">", strlen (x ">"))) { \ *tag = g_strndup (string, strlen (x)); \ *len = strlen (x) + 1; \ return TRUE; \ } \ (*type)++ -#define VALID_OPT_TAG(x) if (!g_strncasecmp (string, x " ", strlen (x " "))) { \ +#define VALID_OPT_TAG(x) if (!g_ascii_strncasecmp (string, x " ", strlen (x " "))) { \ const gchar *c = string + strlen (x " "); \ gchar e = '"'; \ gboolean quote = FALSE; \ @@ -573,25 +573,25 @@ g_return_val_if_fail (replace != NULL, FALSE); g_return_val_if_fail (length != NULL, FALSE); - if (!g_strncasecmp (string, "&", 5)) { + if (!g_ascii_strncasecmp (string, "&", 5)) { *replace = '&'; *length = 5; - } else if (!g_strncasecmp (string, "<", 4)) { + } else if (!g_ascii_strncasecmp (string, "<", 4)) { *replace = '<'; *length = 4; - } else if (!g_strncasecmp (string, ">", 4)) { + } else if (!g_ascii_strncasecmp (string, ">", 4)) { *replace = '>'; *length = 4; - } else if (!g_strncasecmp (string, " ", 6)) { + } else if (!g_ascii_strncasecmp (string, " ", 6)) { *replace = ' '; *length = 6; - } else if (!g_strncasecmp (string, "©", 6)) { + } else if (!g_ascii_strncasecmp (string, "©", 6)) { *replace = '©'; /* was: '©' */ *length = 6; - } else if (!g_strncasecmp (string, """, 6)) { + } else if (!g_ascii_strncasecmp (string, """, 6)) { *replace = '\"'; *length = 6; - } else if (!g_strncasecmp (string, "®", 5)) { + } else if (!g_ascii_strncasecmp (string, "®", 5)) { *replace = '®'; /* was: '®' */ *length = 5; } else if (*(string + 1) == '#') { @@ -674,7 +674,7 @@ VALID_OPT_TAG ("P"); VALID_OPT_TAG ("H3"); - if (!g_strncasecmp(string, "!--", strlen ("!--"))) { + if (!g_ascii_strncasecmp(string, "!--", strlen ("!--"))) { gchar *e = strstr (string + strlen("!--"), "-->"); if (e) { *len = e - string + strlen ("-->"); @@ -693,7 +693,7 @@ gchar *t = tag; gchar *e, *a; - while (g_strncasecmp (t, opt, strlen (opt))) { + while (g_ascii_strncasecmp (t, opt, strlen (opt))) { gboolean quote = FALSE; if (*t == '\0') break; while (*t && !((*t == ' ') && !quote)) { @@ -704,7 +704,7 @@ while (*t && (*t == ' ')) t++; } - if (!g_strncasecmp (t, opt, strlen (opt))) { + if (!g_ascii_strncasecmp (t, opt, strlen (opt))) { t += strlen (opt); } else { return NULL; diff -r 9212d1c5b7dc -r 677d3cb193a1 src/gtkutils.c --- a/src/gtkutils.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/gtkutils.c Sun Mar 16 00:01:49 2003 +0000 @@ -165,8 +165,8 @@ b1 = gtk_text_buffer_get_text(buffer, &start1, &start2, FALSE); b2 = gtk_text_buffer_get_text(buffer, &end1, &end2, FALSE); - if (!g_strncasecmp(b1, s1, strlen(s1)) && - !g_strncasecmp(b2, s2, strlen(s2))) { + if (!g_ascii_strncasecmp(b1, s1, strlen(s1)) && + !g_ascii_strncasecmp(b2, s2, strlen(s2))) { if (really) { GtkTextMark *m_end1, *m_end2; diff -r 9212d1c5b7dc -r 677d3cb193a1 src/list.c --- a/src/list.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/list.c Sun Mar 16 00:01:49 2003 +0000 @@ -377,7 +377,7 @@ while (group) { buddy = group->child; while (buddy) { - if (!g_strcasecmp(normalize(((struct buddy*)buddy)->name), norm_name) && account == ((struct buddy*)buddy)->account) { + if (!gaim_utf8_strcasecmp(normalize(((struct buddy*)buddy)->name), norm_name) && account == ((struct buddy*)buddy)->account) { g_free(norm_name); return (struct buddy*)buddy; } @@ -684,14 +684,17 @@ { gchar **split; gchar *good; + gchar *ret; split = g_strsplit(name, G_DIR_SEPARATOR_S, -1); good = g_strjoinv(NULL, split); g_strfreev(split); - g_strup(good); + ret = g_utf8_strup(good, -1); - return good; + g_free(good); + + return ret; } static gboolean gaim_blist_read(const char *filename); @@ -1232,7 +1235,7 @@ GSList *d = account->permit; char *n = g_strdup(normalize(who)); while(d) { - if(!g_strcasecmp(n, normalize(d->data))) + if(!gaim_utf8_strcasecmp(n, normalize(d->data))) break; d = d->next; } @@ -1249,7 +1252,7 @@ GSList *d = account->permit; char *n = g_strdup(normalize(who)); while(d) { - if(!g_strcasecmp(n, normalize(d->data))) + if(!gaim_utf8_strcasecmp(n, normalize(d->data))) break; d = d->next; } @@ -1266,7 +1269,7 @@ GSList *d = account->deny; char *n = g_strdup(normalize(who)); while(d) { - if(!g_strcasecmp(n, normalize(d->data))) + if(!gaim_utf8_strcasecmp(n, normalize(d->data))) break; d = d->next; } @@ -1283,7 +1286,7 @@ GSList *d = account->deny; char *n = g_strdup(normalize(who)); while(d) { - if(!g_strcasecmp(n, normalize(d->data))) + if(!gaim_utf8_strcasecmp(n, normalize(d->data))) break; d = d->next; } diff -r 9212d1c5b7dc -r 677d3cb193a1 src/log.c --- a/src/log.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/log.c Sun Mar 16 00:01:49 2003 +0000 @@ -46,7 +46,7 @@ while (lc) { l = (struct log_conversation *)lc->data; - if (!g_strcasecmp(pname, normalize(l->name))) { + if (!gaim_utf8_strcasecmp(pname, normalize(l->name))) { g_free(pname); return l; } diff -r 9212d1c5b7dc -r 677d3cb193a1 src/main.c --- a/src/main.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/main.c Sun Mar 16 00:01:49 2003 +0000 @@ -316,7 +316,7 @@ icon = gaim_pixbuf(NULL, "gaim.png"); if (icon) { gtk_window_set_icon(GTK_WINDOW(mainwindow), icon); - gdk_pixbuf_unref(icon); + g_object_unref(G_OBJECT(icon)); } vbox = gtk_vbox_new(FALSE, 0); @@ -470,36 +470,53 @@ guint32 len; guchar *data; guint32 x; + GError *error; debug_printf("Core says: "); - g_io_channel_read(source, &type, sizeof(type), &x); + g_io_channel_read_chars(source, &type, sizeof(type), &x, &error); + if(error) + g_free(error); if (x == 0) { debug_printf("CORE IS GONE!\n"); - g_io_channel_close(source); + g_io_channel_shutdown(source, TRUE, &error); + if(error) + g_free(error); return FALSE; } debug_printf("%d ", type); - g_io_channel_read(source, &subtype, sizeof(subtype), &x); + g_io_channel_read_chars(source, &subtype, sizeof(subtype), &x, &error); + if(error) + g_free(error); if (x == 0) { debug_printf("CORE IS GONE!\n"); - g_io_channel_close(source); + g_io_channel_shutdown(source, TRUE, &error); + if(error) + g_free(error); return FALSE; } debug_printf("%d ", subtype); - g_io_channel_read(source, (guchar *)&len, sizeof(len), &x); + g_io_channel_read_chars(source, (guchar *)&len, sizeof(len), &x, &error); + if(error) + g_free(error); if (x == 0) { debug_printf("CORE IS GONE!\n"); - g_io_channel_close(source); + g_io_channel_shutdown(source, TRUE, &error); + if(error) + g_free(error); return FALSE; } debug_printf("(%d bytes)\n", len); data = g_malloc(len); - g_io_channel_read(source, data, len, &x); + g_io_channel_read_chars(source, data, len, &x, &error); + if(error) + g_free(error); if (x != len) { debug_printf("CORE IS GONE! (read %d/%d bytes)\n", x, len); g_free(data); - g_io_channel_close(source); + g_io_channel_shutdown(source, TRUE, &error); + if(error) + g_free(error); return FALSE; } diff -r 9212d1c5b7dc -r 677d3cb193a1 src/pounce.c --- a/src/pounce.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/pounce.c Sun Mar 16 00:01:49 2003 +0000 @@ -64,7 +64,7 @@ if (account->gc != gc) continue; - if (!g_strcasecmp(who, normalize (b->name))) { /* find someone to pounce */ + if (!gaim_utf8_strcasecmp(who, normalize (b->name))) { /* find someone to pounce */ if (b->options & OPT_POUNCE_POPUP) { c = gaim_find_conversation(name); diff -r 9212d1c5b7dc -r 677d3cb193a1 src/prefs.c --- a/src/prefs.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/prefs.c Sun Mar 16 00:01:49 2003 +0000 @@ -274,7 +274,7 @@ /* We'll check this just to make sure. This also lets us do something different on * other platforms, if need be */ - if (!g_strcasecmp(tail, ".gz") || !g_strcasecmp(tail, ".tgz")) + if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) command = g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", path, destdir); else { g_free(destdir); @@ -312,11 +312,11 @@ /* Well, it looks like the drag event was cool. * Let's do something with it */ - if (!g_strncasecmp(name, "file://", 7)) { + if (!g_ascii_strncasecmp(name, "file://", 7)) { /* It looks like we're dealing with a local file. Let's * just untar it in the right place */ theme_install_theme(name + 7, NULL); - } else if (!g_strncasecmp(name, "http://", 7)) { + } else if (!g_ascii_strncasecmp(name, "http://", 7)) { /* Oo, a web drag and drop. This is where things * will start to get interesting */ gchar *tail; @@ -1405,7 +1405,7 @@ if (last_sound_dir) g_free(last_sound_dir); - last_sound_dir = g_dirname(file); + last_sound_dir = g_path_get_dirname(file); } static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun) diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/gg/gg.c --- a/src/protocols/gg/gg.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/gg/gg.c Sun Mar 16 00:01:49 2003 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 5105 2003-03-15 03:23:30Z faceprint $ + * $Id: gg.c 5113 2003-03-16 00:01:49Z faceprint $ * * Copyright (C) 2001 Arkadiusz Mi¶kiewicz * @@ -116,10 +116,7 @@ static gint args_compare(gconstpointer a, gconstpointer b) { - gchar *arg_a = (gchar *)a; - gchar *arg_b = (gchar *)b; - - return g_strcasecmp(arg_a, arg_b); + return g_ascii_strcasecmp((const gchar *)a,(const gchar *)b); } static gboolean allowed_uin(struct gaim_connection *gc, char *uin) @@ -194,27 +191,27 @@ gc->away = NULL; } - if (!g_strcasecmp(state, AGG_STATUS_AVAIL)) + if (!gaim_utf8_strcasecmp(state, AGG_STATUS_AVAIL)) status = GG_STATUS_AVAIL; - else if (!g_strcasecmp(state, AGG_STATUS_AVAIL_FRIENDS)) { + else if (!gaim_utf8_strcasecmp(state, AGG_STATUS_AVAIL_FRIENDS)) { status = GG_STATUS_AVAIL | GG_STATUS_FRIENDS_MASK; gc->away = g_strdup(""); - } else if (!g_strcasecmp(state, AGG_STATUS_BUSY)) { + } else if (!gaim_utf8_strcasecmp(state, AGG_STATUS_BUSY)) { status = GG_STATUS_BUSY; gc->away = g_strdup(""); - } else if (!g_strcasecmp(state, AGG_STATUS_BUSY_FRIENDS)) { + } else if (!gaim_utf8_strcasecmp(state, AGG_STATUS_BUSY_FRIENDS)) { status = GG_STATUS_BUSY | GG_STATUS_FRIENDS_MASK; gc->away = g_strdup(""); - } else if (!g_strcasecmp(state, AGG_STATUS_INVISIBLE)) { + } else if (!gaim_utf8_strcasecmp(state, AGG_STATUS_INVISIBLE)) { status = GG_STATUS_INVISIBLE; gc->away = g_strdup(""); - } else if (!g_strcasecmp(state, AGG_STATUS_INVISIBLE_FRIENDS)) { + } else if (!gaim_utf8_strcasecmp(state, AGG_STATUS_INVISIBLE_FRIENDS)) { status = GG_STATUS_INVISIBLE | GG_STATUS_FRIENDS_MASK; gc->away = g_strdup(""); - } else if (!g_strcasecmp(state, AGG_STATUS_NOT_AVAIL)) { + } else if (!gaim_utf8_strcasecmp(state, AGG_STATUS_NOT_AVAIL)) { status = GG_STATUS_NOT_AVAIL; gc->away = g_strdup(""); - } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) { + } else if (!gaim_utf8_strcasecmp(state, GAIM_AWAY_CUSTOM)) { if (msg) { status = GG_STATUS_BUSY; gc->away = g_strdup(""); diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/irc/irc.c --- a/src/protocols/irc/irc.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/irc/irc.c Sun Mar 16 00:01:49 2003 +0000 @@ -206,7 +206,7 @@ while (bcs) { struct gaim_conversation *b = bcs->data; - if (!g_strcasecmp(b->name, name)) + if (!gaim_utf8_strcasecmp(b->name, name)) return b; bcs = bcs->next; } @@ -309,42 +309,42 @@ GString *str = g_string_new(""); char *cur = msg, *end = msg; gboolean bold = FALSE, underline = FALSE, italics = FALSE; - + while ((end = strchr(cur, '<'))) { *end = 0; str = g_string_append(str, cur); cur = ++end; - if (!g_strncasecmp(cur, "B>", 2)) { + if (!g_ascii_strncasecmp(cur, "B>", 2)) { if (!bold) { bold = TRUE; str = g_string_append_c(str, '\2'); } cur = cur + 2; - } else if (!g_strncasecmp(cur, "I>", 2)) { /* use bold for italics too */ + } else if (!g_ascii_strncasecmp(cur, "I>", 2)) { /* use bold for italics too */ if (!italics) { italics = TRUE; str = g_string_append_c(str, '\2'); } cur = cur + 2; - } else if (!g_strncasecmp(cur, "U>", 2)) { + } else if (!g_ascii_strncasecmp(cur, "U>", 2)) { if (!underline) { underline = TRUE; str = g_string_append_c(str, '\37'); } cur = cur + 2; - } else if (!g_strncasecmp(cur, "/B>", 3)) { + } else if (!g_ascii_strncasecmp(cur, "/B>", 3)) { if (bold) { bold = FALSE; str = g_string_append_c(str, '\2'); } cur = cur + 3; - } else if (!g_strncasecmp(cur, "/I>", 3)) { + } else if (!g_ascii_strncasecmp(cur, "/I>", 3)) { if (italics) { italics = FALSE; str = g_string_append_c(str, '\2'); } cur = cur + 3; - } else if (!g_strncasecmp(cur, "/U>", 3)) { + } else if (!g_ascii_strncasecmp(cur, "/U>", 3)) { if (underline) { underline = FALSE; str = g_string_append_c(str, '\37'); @@ -353,7 +353,7 @@ } else { str = g_string_append_c(str, '<'); } - + } str = g_string_append(str, cur); return str; @@ -569,15 +569,18 @@ handle_list(struct gaim_connection *gc, char *list) { struct irc_data *id = gc->proto_data; + char *tmp; GaimBlistNode *gnode, *bnode; + tmp = g_utf8_strdown(list, -1); + id->str = g_string_append_c(id->str, ' '); - id->str = g_string_append(id->str, list); + id->str = g_string_append(id->str, tmp); id->bc--; + g_free(tmp); if (id->bc) return; - g_strdown(id->str->str); for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) @@ -587,9 +590,8 @@ if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) continue; if(b->account->gc == gc) { - char *tmp = g_strdup(b->name); + char *tmp = g_utf8_strdown(b->name, -1); char *x, *l; - g_strdown(tmp); x = strstr(id->str->str, tmp); l = x + strlen(b->name); if (x && (*l != ' ' && *l != 0)) @@ -999,7 +1001,7 @@ char *text = word_eol[3]; int n = atoi(word[2]); - if (!g_strncasecmp(gc->displayname, text, strlen(gc->displayname))) + if (!g_ascii_strncasecmp(gc->displayname, text, strlen(gc->displayname))) text += strlen(gc->displayname) + 1; if (*text == ':') text++; @@ -1136,7 +1138,7 @@ who++; if (*who == '+') who++; - if (!g_strcasecmp(who, nick)) { + if (!gaim_utf8_strcasecmp(who, nick)) { char *tmp = g_strdup(r->data); gaim_chat_remove_user(chat, tmp, reason); g_free(tmp); @@ -1308,26 +1310,26 @@ char buf[IRC_BUF_LEN]; char out[IRC_BUF_LEN]; - if (!g_strncasecmp(msg, "VERSION", 7)) { + if (!g_ascii_strncasecmp(msg, "VERSION", 7)) { g_snprintf(buf, sizeof(buf), "\001VERSION Gaim " VERSION ": The Penguin Pimpin' " "Multi-protocol Messaging Client: " WEBSITE "\001"); irc_send_notice (gc, nick, buf); g_snprintf(out, sizeof(out), ">> CTCP VERSION requested from %s", nick); do_error_dialog(out, _("IRC CTCP info"), GAIM_INFO); } - if (!g_strncasecmp(msg, "CLIENTINFO", 10)) { + if (!g_ascii_strncasecmp(msg, "CLIENTINFO", 10)) { g_snprintf(buf, sizeof(buf), "\001CLIENTINFO USERINFO CLIENTINFO VERSION\001"); irc_send_notice (gc, nick, buf); g_snprintf(out, sizeof(out), ">> CTCP CLIENTINFO requested from %s", nick); do_error_dialog(out, _("IRC CTCP info"), GAIM_INFO); } - if (!g_strncasecmp(msg, "USERINFO", 8)) { + if (!g_ascii_strncasecmp(msg, "USERINFO", 8)) { g_snprintf(buf, sizeof(buf), "\001USERINFO Alias: %s\001", gc->account->alias); irc_send_notice (gc, nick, buf); g_snprintf(out, sizeof(out), ">> CTCP USERINFO requested from %s", nick); do_error_dialog(out, _("IRC CTCP info"), GAIM_INFO); } - if (!g_strncasecmp(msg, "ACTION", 6)) { + if (!g_ascii_strncasecmp(msg, "ACTION", 6)) { char *po = strchr(msg + 6, 1); char *tmp; if (po) *po = 0; @@ -1335,13 +1337,13 @@ handle_privmsg(gc, to, nick, tmp); g_free(tmp); } - if (!g_strncasecmp(msg, "PING", 4)) { - g_snprintf(buf, sizeof(buf), "\001%s\001", msg); + if (!g_ascii_strncasecmp(msg, "PING", 4)) { + g_snprintf(buf, sizeof(buf), "\001%s\001", msg); irc_send_notice (gc, nick, buf); g_snprintf(out, sizeof(out), ">> CTCP PING requested from %s", nick); - do_error_dialog(out, _("IRC CTCP info"), GAIM_INFO); + do_error_dialog(out, _("IRC CTCP info"), GAIM_INFO); } - if (!g_strncasecmp(msg, "DCC CHAT", 8)) { + if (!g_ascii_strncasecmp(msg, "DCC CHAT", 8)) { char **chat_args = g_strsplit(msg, " ", 5); char ask[1024]; struct dcc_chat *dccchat = g_new0(struct dcc_chat, 1); @@ -1354,7 +1356,7 @@ } - if (!g_strncasecmp(msg, "DCC SEND", 8)) { + if (!g_ascii_strncasecmp(msg, "DCC SEND", 8)) { struct gaim_xfer *xfer; char **send_args; char *ip, *filename; @@ -1512,7 +1514,7 @@ to = word[3]; msg = *word_eol[4] == ':' ? word_eol[4] + 1 : word_eol[4]; if (msg[0] == 1 && msg[strlen (msg) - 1] == 1) { /* ctcp */ - if (!g_strncasecmp(msg + 1, "DCC ", 4)) + if (!g_ascii_strncasecmp(msg + 1, "DCC ", 4)) process_data_init(pdibuf, buf, word, word_eol, TRUE); handle_ctcp(gc, to, nick, msg + 1, word, word_eol); } else { @@ -1539,25 +1541,25 @@ { char buf[IRC_BUF_LEN]; - if (!g_strcasecmp(word[4], ":\001CLIENTINFO")) { + if (!g_ascii_strcasecmp(word[4], ":\001CLIENTINFO")) { char *p = g_strrstr(word_eol[5], "\001"); *p = 0; g_snprintf(buf, sizeof(buf), "CTCP Answer: %s", word_eol[5]); do_error_dialog(buf, _("CTCP ClientInfo"), GAIM_INFO); - } else if (!g_strcasecmp(word[4], ":\001USERINFO")) { + } else if (!g_ascii_strcasecmp(word[4], ":\001USERINFO")) { char *p = g_strrstr(word_eol[5], "\001"); *p = 0; g_snprintf(buf, sizeof(buf), "CTCP Answer: %s", word_eol[5]); do_error_dialog(buf, _("CTCP UserInfo"), GAIM_INFO); - } else if (!g_strcasecmp(word[4], ":\001VERSION")) { + } else if (!g_ascii_strcasecmp(word[4], ":\001VERSION")) { char *p = g_strrstr(word_eol[5], "\001"); *p = 0; g_snprintf(buf, sizeof(buf), "CTCP Answer: %s", word_eol[5]); do_error_dialog(buf, _("CTCP Version"), GAIM_INFO); - } else if (!g_strcasecmp(word[4], ":\001PING")) { + } else if (!g_ascii_strcasecmp(word[4], ":\001PING")) { char *p = g_strrstr(word_eol[5], "\001"); struct timeval ping_time; struct timeval now; @@ -1601,7 +1603,7 @@ struct gaim_conversation *c; char *hostmask, *p; - if (!g_strcasecmp(gc->displayname, nick)) { + if (!gaim_utf8_strcasecmp(gc->displayname, nick)) { serv_got_joined_chat(gc, id++, chan); } else { c = irc_find_chat(gc, chan); @@ -1672,7 +1674,7 @@ who++; if (*who == '+') who++; - if (!g_strcasecmp(who, nick)) { + if (!gaim_utf8_strcasecmp(who, nick)) { char *tmp = g_strdup(r->data); gaim_chat_remove_user(chat, tmp, reason); g_free(tmp); @@ -2050,7 +2052,7 @@ process_data_init(pdibuf, what + 1, word, word_eol, TRUE); g_string_free(str, FALSE); - if (!g_strcasecmp(pdibuf, "ME")) { + if (!g_ascii_strcasecmp(pdibuf, "ME")) { if (dccchat) { intl = irc_send_convert(gc, word_eol[2], sizeof(buf), &len); g_snprintf(buf, sizeof(buf), "\001ACTION %s\001\r\n", intl); @@ -2063,11 +2065,11 @@ irc_send_privmsg (gc, who, buf, FALSE); g_free(what); return 1; - } else if (!g_strcasecmp(pdibuf, "INVITE")) { + } else if (!g_ascii_strcasecmp(pdibuf, "INVITE")) { char buf[IRC_BUF_LEN]; g_snprintf(buf, sizeof(buf), "INVITE %s\r\n", word_eol[2]); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "TOPIC")) { + } else if (!g_ascii_strcasecmp(pdibuf, "TOPIC")) { if (!*word_eol[2]) { struct gaim_conversation *c; struct gaim_chat *chat; @@ -2089,39 +2091,39 @@ g_free(intl); irc_write(id->fd, buf, strlen(buf)); } - } else if (!g_strcasecmp(pdibuf, "NICK")) { + } else if (!g_ascii_strcasecmp(pdibuf, "NICK")) { if (!*word_eol[2]) { g_free(what); return -EINVAL; } g_snprintf(buf, sizeof(buf), "NICK %s\r\n", word_eol[2]); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "OP")) { + } else if (!g_ascii_strcasecmp(pdibuf, "OP")) { set_mode(gc, who, '+', 'o', word); - } else if (!g_strcasecmp(pdibuf, "DEOP")) { + } else if (!g_ascii_strcasecmp(pdibuf, "DEOP")) { set_mode(gc, who, '-', 'o', word); - } else if (!g_strcasecmp(pdibuf, "VOICE")) { + } else if (!g_ascii_strcasecmp(pdibuf, "VOICE")) { set_mode(gc, who, '+', 'v', word); - } else if (!g_strcasecmp(pdibuf, "DEVOICE")) { + } else if (!g_ascii_strcasecmp(pdibuf, "DEVOICE")) { set_mode(gc, who, '-', 'v', word); - } else if (!g_strcasecmp(pdibuf, "MODE")) { + } else if (!g_ascii_strcasecmp(pdibuf, "MODE")) { char *chan = who; set_chan_mode(gc, chan, word_eol[2]); - } else if (!g_strcasecmp(pdibuf, "QUOTE")) { + } else if (!g_ascii_strcasecmp(pdibuf, "QUOTE")) { if (!*word_eol[2]) { g_free(what); return -EINVAL; } g_snprintf(buf, sizeof(buf), "%s\r\n", word_eol[2]); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "SAY")) { + } else if (!g_ascii_strcasecmp(pdibuf, "SAY")) { if (!*word_eol[2]) { g_free(what); return -EINVAL; } irc_send_privmsg (gc, who, word_eol[2], TRUE); return 1; - } else if (!g_strcasecmp(pdibuf, "MSG")) { + } else if (!g_ascii_strcasecmp(pdibuf, "MSG")) { if (!*word[2]) { g_free(what); return -EINVAL; @@ -2131,7 +2133,7 @@ return -EINVAL; } irc_send_privmsg (gc, word[2], word_eol[3], TRUE); - } else if (!g_strcasecmp(pdibuf, "KICK")) { + } else if (!g_ascii_strcasecmp(pdibuf, "KICK")) { if (!*word[2]) { g_free(what); return -EINVAL; @@ -2143,7 +2145,7 @@ } else g_snprintf(buf, sizeof(buf), "KICK %s %s\r\n", who, word[2]); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "JOIN") || !g_strcasecmp(pdibuf, "J")) { + } else if (!g_ascii_strcasecmp(pdibuf, "JOIN") || !g_ascii_strcasecmp(pdibuf, "J")) { if (!*word[2]) { g_free(what); return -EINVAL; @@ -2153,7 +2155,7 @@ else g_snprintf(buf, sizeof(buf), "JOIN %s\r\n", word[2]); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "PART")) { + } else if (!g_ascii_strcasecmp(pdibuf, "PART")) { char *chan = *word[2] ? word[2] : who; char *reason = word_eol[3]; struct gaim_conversation *c; @@ -2175,49 +2177,49 @@ g_snprintf(buf, sizeof(buf), _("You have left %s"), chan); do_error_dialog(buf, _("IRC Part"), GAIM_INFO); } - } else if (!g_strcasecmp(pdibuf, "WHOIS")) { + } else if (!g_ascii_strcasecmp(pdibuf, "WHOIS")) { g_snprintf(buf, sizeof(buf), "WHOIS %s\r\n", word_eol[2]); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "WHOWAS")) { + } else if (!g_ascii_strcasecmp(pdibuf, "WHOWAS")) { g_snprintf(buf, sizeof(buf), "WHOWAS %s\r\n", word_eol[2]); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "LIST")) { + } else if (!g_ascii_strcasecmp(pdibuf, "LIST")) { g_snprintf(buf, sizeof(buf), "LIST\r\n"); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "QUIT")) { + } else if (!g_ascii_strcasecmp(pdibuf, "QUIT")) { char *reason = word_eol[2]; id->str = g_string_insert(id->str, 0, reason); do_quit(); - } else if (!g_strcasecmp(pdibuf, "VERSION")) { + } else if (!g_ascii_strcasecmp(pdibuf, "VERSION")) { g_snprintf(buf, sizeof(buf), "VERSION\r\n"); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "W")) { + } else if (!g_ascii_strcasecmp(pdibuf, "W")) { g_snprintf(buf, sizeof(buf), "WHO *\r\n"); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "REHASH")) { + } else if (!g_ascii_strcasecmp(pdibuf, "REHASH")) { g_snprintf(buf, sizeof(buf), "REHASH\r\n"); - irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "RESTART")) { + irc_write(id->fd, buf, strlen(buf)); + } else if (!g_ascii_strcasecmp(pdibuf, "RESTART")) { g_snprintf(buf, sizeof(buf), "RESTART\r\n"); irc_write(id->fd, buf, strlen(buf)); - } else if (!g_strcasecmp(pdibuf, "CTCP")) { - if (!g_strcasecmp(word[2], "CLIENTINFO")) { + } else if (!g_ascii_strcasecmp(pdibuf, "CTCP")) { + if (!g_ascii_strcasecmp(word[2], "CLIENTINFO")) { if (word[3]) irc_ctcp_clientinfo(gc, word[3]); - } else if (!g_strcasecmp(word[2], "USERINFO")) { + } else if (!g_ascii_strcasecmp(word[2], "USERINFO")) { if (word[3]) irc_ctcp_userinfo(gc, word[3]); - } else if (!g_strcasecmp(word[2], "VERSION")) { + } else if (!g_ascii_strcasecmp(word[2], "VERSION")) { if (word[3]) irc_ctcp_version(gc, word[3]); - - } else if (!g_strcasecmp(word[2], "PING")) { + + } else if (!g_ascii_strcasecmp(word[2], "PING")) { if (word[3]) irc_ctcp_ping(gc, word[3]); } - } else if (!g_strcasecmp(pdibuf, "DCC")) { + } else if (!g_ascii_strcasecmp(pdibuf, "DCC")) { struct gaim_conversation *c = NULL; - if (!g_strcasecmp(word[2], "CHAT")) { + if (!g_ascii_strcasecmp(word[2], "CHAT")) { if (word[3]) irc_start_chat(gc, word[3]); @@ -2232,7 +2234,7 @@ -1, WFLAG_SYSTEM, time(NULL)); } } - } else if (!g_strcasecmp(pdibuf, "HELP")) { + } else if (!g_ascii_strcasecmp(pdibuf, "HELP")) { struct gaim_conversation *c = NULL; if (is_channel(gc, who)) { c = irc_find_chat(gc, who); @@ -2243,12 +2245,12 @@ g_free(what); return -EINVAL; } - if (!g_strcasecmp(word[2], "OPER")) { + if (!g_ascii_strcasecmp(word[2], "OPER")) { gaim_conversation_write(c, NULL, _("Operator commands:
" "REHASH RESTART
"), -1, WFLAG_NOLOG, time(NULL)); - } else if (!g_strcasecmp(word[2], "CTCP")) { + } else if (!g_ascii_strcasecmp(word[2], "CTCP")) { gaim_conversation_write(c, NULL, _("CTCP commands:
" "CLIENTINFO
" @@ -2256,7 +2258,7 @@ "VERSION
" "PING

"), -1, WFLAG_NOLOG, time(NULL)); - } else if (!g_strcasecmp(word[2], "DCC")) { + } else if (!g_ascii_strcasecmp(word[2], "DCC")) { gaim_conversation_write(c, NULL, _("DCC commands:
" "CHAT
"), diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/jabber/jabber.c --- a/src/protocols/jabber/jabber.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/jabber/jabber.c Sun Mar 16 00:01:49 2003 +0000 @@ -2970,7 +2970,7 @@ xmlnode_put_attrib(x, "type", "groupchat"); if (message && strlen(message) > strlen("/topic ") && - !g_strncasecmp(message, "/topic ", strlen("/topic "))) { + !g_ascii_strncasecmp(message, "/topic ", strlen("/topic "))) { char buf[8192]; y = xmlnode_insert_tag(x, "subject"); xmlnode_insert_cdata(y, message + strlen("/topic "), -1); @@ -3025,9 +3025,7 @@ if(s == NULL) { return(NULL); } else { - u = t = g_strdup(s); - - g_strdown(t); + u = t = g_utf8_strdown(s, -1); while (*t && (x < BUF_LEN - 1)) { if (*t != ' ') @@ -3787,7 +3785,7 @@ * Send only if there's actually any *information* to send */ if((vc_node = xmlstr2xmlnode(info)) != NULL && xmlnode_get_name(vc_node) != NULL && - g_strncasecmp(xmlnode_get_name(vc_node), "vcard", 5) == 0) { + g_ascii_strncasecmp(xmlnode_get_name(vc_node), "vcard", 5) == 0) { xmlnode_insert_tag_node(x, vc_node); debug_printf("jabber: vCard packet: %s\n", xmlnode2str(x)); gjab_send(gjc, x); diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/msn/ft.c --- a/src/protocols/msn/ft.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/msn/ft.c Sun Mar 16 00:01:49 2003 +0000 @@ -259,7 +259,7 @@ xfer_data = (struct msn_xfer_data *)xfer->data; account = gaim_xfer_get_account(xfer); - if (!g_strncasecmp(buf, "VER MSNFTP", 10)) { + if (!g_ascii_strncasecmp(buf, "VER MSNFTP", 10)) { /* Send the USR string */ g_snprintf(sendbuf, sizeof(sendbuf), "USR %s %lu\r\n", account->gc->username, @@ -271,7 +271,7 @@ return 0; } } - else if (!g_strncasecmp(buf, "FIL", 3)) { + else if (!g_ascii_strncasecmp(buf, "FIL", 3)) { gaim_input_remove(xfer_data->inpa); xfer_data->inpa = 0; diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/msn/msn.c Sun Mar 16 00:01:49 2003 +0000 @@ -328,7 +328,7 @@ struct msn_data *md = gc->proto_data; char sendbuf[MSN_BUF_LEN]; - if (!g_strncasecmp(buf, "ADD", 3)) { + if (!g_ascii_strncasecmp(buf, "ADD", 3)) { char *list, *user, *friend, *tmp = buf; struct msn_add_permit *ap; GSList *perm = gc->account->permit; @@ -345,11 +345,11 @@ GET_NEXT(tmp); friend = url_decode(tmp); - if (g_strcasecmp(list, "RL")) + if (g_ascii_strcasecmp(list, "RL")) return 1; while (perm) { - if (!g_strcasecmp(perm->data, user)) + if (!gaim_utf8_strcasecmp(perm->data, user)) return 1; perm = perm->next; } @@ -363,7 +363,7 @@ ap->user, ap->friend, ap->gc->username); // do_ask_dialog(msg, NULL, ap, _("Authorize"), msn_accept_add, _("Deny"), msn_cancel_add, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); - } else if (!g_strncasecmp(buf, "BLP", 3)) { + } else if (!g_ascii_strncasecmp(buf, "BLP", 3)) { char *type, *tmp = buf; GET_NEXT(tmp); @@ -371,7 +371,7 @@ GET_NEXT(tmp); type = tmp; - if (!g_strcasecmp(type, "AL")) { + if (!g_ascii_strcasecmp(type, "AL")) { /* If the current setting is AL, messages * from users who are not in BL will be delivered * @@ -385,9 +385,9 @@ * In other words, permit some */ gc->account->permdeny = PERMIT_SOME; } - } else if (!g_strncasecmp(buf, "BPR", 3)) { - } else if (!g_strncasecmp(buf, "CHG", 3)) { - } else if (!g_strncasecmp(buf, "CHL", 3)) { + } else if (!g_ascii_strncasecmp(buf, "BPR", 3)) { + } else if (!g_ascii_strncasecmp(buf, "CHG", 3)) { + } else if (!g_ascii_strncasecmp(buf, "CHL", 3)) { char *hash = buf; char buf2[MSN_BUF_LEN]; md5_state_t st; @@ -414,14 +414,14 @@ } debug_printf("\n"); - } else if (!g_strncasecmp(buf, "FLN", 3)) { + } else if (!g_ascii_strncasecmp(buf, "FLN", 3)) { char *usr = buf; GET_NEXT(usr); serv_got_update(gc, usr, 0, 0, 0, 0, 0); - } else if (!g_strncasecmp(buf, "GTC", 3)) { - } else if (!g_strncasecmp(buf, "INF", 3)) { - } else if (!g_strncasecmp(buf, "ILN", 3)) { + } else if (!g_ascii_strncasecmp(buf, "GTC", 3)) { + } else if (!g_ascii_strncasecmp(buf, "INF", 3)) { + } else if (!g_ascii_strncasecmp(buf, "ILN", 3)) { char *state, *user, *friend, *tmp = buf; int status = 0; @@ -438,22 +438,22 @@ serv_got_alias(gc, user, friend); - if (!g_strcasecmp(state, "BSY")) { + if (!g_ascii_strcasecmp(state, "BSY")) { status |= UC_UNAVAILABLE | (MSN_BUSY << 1); - } else if (!g_strcasecmp(state, "IDL")) { + } else if (!g_ascii_strcasecmp(state, "IDL")) { status |= UC_UNAVAILABLE | (MSN_IDLE << 1); - } else if (!g_strcasecmp(state, "BRB")) { + } else if (!g_ascii_strcasecmp(state, "BRB")) { status |= UC_UNAVAILABLE | (MSN_BRB << 1); - } else if (!g_strcasecmp(state, "AWY")) { + } else if (!g_ascii_strcasecmp(state, "AWY")) { status |= UC_UNAVAILABLE | (MSN_AWAY << 1); - } else if (!g_strcasecmp(state, "PHN")) { + } else if (!g_ascii_strcasecmp(state, "PHN")) { status |= UC_UNAVAILABLE | (MSN_PHONE << 1); - } else if (!g_strcasecmp(state, "LUN")) { + } else if (!g_ascii_strcasecmp(state, "LUN")) { status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); } serv_got_update(gc, user, 1, 0, 0, 0, status); - } else if (!g_strncasecmp(buf, "LST", 3)) { + } else if (!g_ascii_strncasecmp(buf, "LST", 3)) { char *which, *who, *friend, *tmp = buf; struct msn_add_permit *ap; /* for any as yet undealt with buddies who've added you to their buddy list when you were off-line. How dare they! */ GSList *perm = gc->account->permit; /* current permit list */ @@ -477,29 +477,29 @@ GET_NEXT(tmp); friend = url_decode(tmp); - if (!g_strcasecmp(which, "FL") && pos) { + if (!g_ascii_strcasecmp(which, "FL") && pos) { struct msn_buddy *b = g_new0(struct msn_buddy, 1); b->user = g_strdup(who); b->friend = g_strdup(friend); md->fl = g_slist_append(md->fl, b); - } else if (!g_strcasecmp(which, "AL") && pos) { + } else if (!g_ascii_strcasecmp(which, "AL") && pos) { if (g_slist_find_custom(gc->account->deny, who, (GCompareFunc)strcmp)) { debug_printf("moving from deny to permit: %s", who); gaim_privacy_deny_remove(gc->account, who); } gaim_privacy_permit_add(gc->account, who); - } else if (!g_strcasecmp(which, "BL") && pos) { + } else if (!g_ascii_strcasecmp(which, "BL") && pos) { gaim_privacy_deny_add(gc->account, who); - } else if (!g_strcasecmp(which, "RL")) { + } else if (!g_ascii_strcasecmp(which, "RL")) { if (pos) { while(perm) { - if(!g_strcasecmp(perm->data, who)) + if(!g_ascii_strcasecmp(perm->data, who)) new = 0; perm = perm->next; } while(denyl) { - if(!g_strcasecmp(denyl->data, who)) + if(!g_ascii_strcasecmp(denyl->data, who)) new = 0; denyl = denyl->next; } @@ -552,7 +552,7 @@ g_free(mb); } } - } else if (!g_strncasecmp(buf, "MSG", 3)) { + } else if (!g_ascii_strncasecmp(buf, "MSG", 3)) { char *user, *tmp = buf; int length; @@ -567,7 +567,7 @@ md->msg = TRUE; md->msguser = g_strdup(user); md->msglen = length; - } else if (!g_strncasecmp(buf, "NLN", 3)) { + } else if (!g_ascii_strncasecmp(buf, "NLN", 3)) { char *state, *user, *friend, *tmp = buf; int status = 0; @@ -582,35 +582,35 @@ serv_got_alias(gc, user, friend); - if (!g_strcasecmp(state, "BSY")) { + if (!g_ascii_strcasecmp(state, "BSY")) { status |= UC_UNAVAILABLE | (MSN_BUSY << 1); - } else if (!g_strcasecmp(state, "IDL")) { + } else if (!g_ascii_strcasecmp(state, "IDL")) { status |= UC_UNAVAILABLE | (MSN_IDLE << 1); - } else if (!g_strcasecmp(state, "BRB")) { + } else if (!g_ascii_strcasecmp(state, "BRB")) { status |= UC_UNAVAILABLE | (MSN_BRB << 1); - } else if (!g_strcasecmp(state, "AWY")) { + } else if (!g_ascii_strcasecmp(state, "AWY")) { status |= UC_UNAVAILABLE | (MSN_AWAY << 1); - } else if (!g_strcasecmp(state, "PHN")) { + } else if (!g_ascii_strcasecmp(state, "PHN")) { status |= UC_UNAVAILABLE | (MSN_PHONE << 1); - } else if (!g_strcasecmp(state, "LUN")) { + } else if (!g_ascii_strcasecmp(state, "LUN")) { status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); } serv_got_update(gc, user, 1, 0, 0, 0, status); - } else if (!g_strncasecmp(buf, "OUT", 3)) { + } else if (!g_ascii_strncasecmp(buf, "OUT", 3)) { char *tmp = buf; GET_NEXT(tmp); - if (!g_strncasecmp(tmp, "OTH", 3)) { + if (!g_ascii_strncasecmp(tmp, "OTH", 3)) { hide_login_progress(gc, _("You have been disconnected. You have " "signed on from another location.")); signoff(gc); return 0; } - } else if (!g_strncasecmp(buf, "PRP", 3)) { - } else if (!g_strncasecmp(buf, "QNG", 3)) { - } else if (!g_strncasecmp(buf, "QRY", 3)) { - } else if (!g_strncasecmp(buf, "REA", 3)) { + } else if (!g_ascii_strncasecmp(buf, "PRP", 3)) { + } else if (!g_ascii_strncasecmp(buf, "QNG", 3)) { + } else if (!g_ascii_strncasecmp(buf, "QRY", 3)) { + } else if (!g_ascii_strncasecmp(buf, "REA", 3)) { char *friend, *tmp = buf; GET_NEXT(tmp); @@ -621,8 +621,8 @@ friend = url_decode(tmp); g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); - } else if (!g_strncasecmp(buf, "REM", 3)) { - } else if (!g_strncasecmp(buf, "RNG", 3)) { + } else if (!g_ascii_strncasecmp(buf, "REM", 3)) { + } else if (!g_ascii_strncasecmp(buf, "RNG", 3)) { struct msn_switchboard *ms; char *sessid, *ssaddr, *auth, *user; int port, i = 0; @@ -660,7 +660,7 @@ ms->sessid = g_strdup(sessid); ms->auth = g_strdup(auth); ms->gc = gc; - } else if (!g_strncasecmp(buf, "URL", 3)) { + } else if (!g_ascii_strncasecmp(buf, "URL", 3)) { char *tmp = buf; FILE *fd; md5_state_t st; @@ -742,9 +742,9 @@ } } } - } else if (!g_strncasecmp(buf, "SYN", 3)) { - } else if (!g_strncasecmp(buf, "USR", 3)) { - } else if (!g_strncasecmp(buf, "XFR", 3)) { + } else if (!g_ascii_strncasecmp(buf, "SYN", 3)) { + } else if (!g_ascii_strncasecmp(buf, "USR", 3)) { + } else if (!g_ascii_strncasecmp(buf, "XFR", 3)) { char *host = strstr(buf, "SB"); int port; int i = 0; @@ -813,7 +813,7 @@ content = strstr(msg, "Content-Type: "); - if ((content) && (!g_strncasecmp(content, "Content-Type: text/x-msmsgsprofile", + if ((content) && (!g_ascii_strncasecmp(content, "Content-Type: text/x-msmsgsprofile", strlen("Content-Type: text/x-msmsgsprofile")))) { char *kv,*sid,*mspauth; @@ -850,7 +850,7 @@ - if (!g_strcasecmp(md->msguser, "hotmail")) { + if (!g_ascii_strcasecmp(md->msguser, "hotmail")) { handle_hotmail(gc, msg); return; } @@ -979,7 +979,7 @@ struct msn_data *md = gc->proto_data; char sendbuf[MSN_BUF_LEN]; - if (!g_strncasecmp(buf, "VER", 3)) { + if (!g_ascii_strncasecmp(buf, "VER", 3)) { /* we got VER, check to see that MSNP5 is in the list, then send INF */ if (!strstr(buf, "MSNP5")) { hide_login_progress(gc, _("Protocol not supported")); @@ -993,7 +993,7 @@ signoff(gc); return 0; } - } else if (!g_strncasecmp(buf, "INF", 3)) { + } else if (!g_ascii_strncasecmp(buf, "INF", 3)) { /* check to make sure we can use md5 */ if (!strstr(buf, "MD5")) { hide_login_progress(gc, _("Unable to login using MD5")); @@ -1009,7 +1009,7 @@ } set_login_progress(gc, 3, _("Requesting to send password")); - } else if (!g_strncasecmp(buf, "USR", 3)) { + } else if (!g_ascii_strncasecmp(buf, "USR", 3)) { char *resp, *friend, *tmp = buf; GET_NEXT(tmp); @@ -1021,7 +1021,7 @@ GET_NEXT(tmp); /* so here, we're either getting the challenge or the OK */ - if (!g_strcasecmp(resp, "OK")) { + if (!g_ascii_strcasecmp(resp, "OK")) { g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); g_snprintf(sendbuf, sizeof(sendbuf), "SYN %u 0\r\n", ++md->trId); @@ -1034,7 +1034,7 @@ gaim_input_remove(md->inpa); md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_callback, gc); return 0; - } else if (!g_strcasecmp(resp, "MD5")) { + } else if (!g_ascii_strcasecmp(resp, "MD5")) { char buf2[MSN_BUF_LEN]; md5_state_t st; md5_byte_t di[16]; @@ -1061,7 +1061,7 @@ set_login_progress(gc, 4, _("Password sent")); } - } else if (!g_strncasecmp(buf, "XFR", 3)) { + } else if (!g_ascii_strncasecmp(buf, "XFR", 3)) { char *host = strstr(buf, "NS"); int port; int i = 0; @@ -1687,7 +1687,7 @@ while (l) { struct msn_buddy *b = l->data; - if (!g_strcasecmp(who, b->user)) + if (!gaim_utf8_strcasecmp(who, b->user)) break; l = l->next; } diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/msn/switchboard.c --- a/src/protocols/msn/switchboard.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/msn/switchboard.c Sun Mar 16 00:01:49 2003 +0000 @@ -78,11 +78,11 @@ char sendbuf[MSN_BUF_LEN]; static int id = 0; - if (!g_strncasecmp(buf, "ACK", 3)) { - } else if (!g_strncasecmp(buf, "ANS", 3)) { + if (!g_ascii_strncasecmp(buf, "ACK", 3)) { + } else if (!g_ascii_strncasecmp(buf, "ANS", 3)) { if (ms->chat) gaim_chat_add_user(GAIM_CHAT(ms->chat), gc->username, NULL); - } else if (!g_strncasecmp(buf, "BYE", 3)) { + } else if (!g_ascii_strncasecmp(buf, "BYE", 3)) { char *user, *tmp = buf; GET_NEXT(tmp); user = tmp; @@ -110,8 +110,8 @@ msn_kill_switch(ms); return 0; } - } else if (!g_strncasecmp(buf, "CAL", 3)) { - } else if (!g_strncasecmp(buf, "IRO", 3)) { + } else if (!g_ascii_strncasecmp(buf, "CAL", 3)) { + } else if (!g_ascii_strncasecmp(buf, "IRO", 3)) { char *tot, *user, *tmp = buf; GET_NEXT(tmp); @@ -129,7 +129,7 @@ gaim_chat_add_user(GAIM_CHAT(ms->chat), user, NULL); } - } else if (!g_strncasecmp(buf, "JOI", 3)) { + } else if (!g_ascii_strncasecmp(buf, "JOI", 3)) { char *user, *tmp = buf; GET_NEXT(tmp); user = tmp; @@ -162,7 +162,7 @@ debug_printf("\n"); } - } else if (!g_strncasecmp(buf, "MSG", 3)) { + } else if (!g_ascii_strncasecmp(buf, "MSG", 3)) { char *user, *tmp = buf; int length; @@ -177,15 +177,15 @@ ms->msg = TRUE; ms->msguser = g_strdup(user); ms->msglen = length; - } else if (!g_strncasecmp(buf, "NAK", 3)) { + } else if (!g_ascii_strncasecmp(buf, "NAK", 3)) { do_error_dialog(_("An MSN message may not have been received."), NULL, GAIM_ERROR); - } else if (!g_strncasecmp(buf, "NLN", 3)) { - } else if (!g_strncasecmp(buf, "OUT", 3)) { + } else if (!g_ascii_strncasecmp(buf, "NLN", 3)) { + } else if (!g_ascii_strncasecmp(buf, "OUT", 3)) { if (ms->chat) serv_got_chat_left(gc, gaim_chat_get_id(GAIM_CHAT(ms->chat))); msn_kill_switch(ms); return 0; - } else if (!g_strncasecmp(buf, "USR", 3)) { + } else if (!g_ascii_strncasecmp(buf, "USR", 3)) { /* good, we got USR, now we need to find out who we want to talk to */ struct msn_switchboard *ms = msn_find_writable_switch(gc); @@ -221,7 +221,7 @@ agent = strstr(msg, "User-Agent: "); if (agent) { - if (!g_strncasecmp(agent, "User-Agent: Gaim", + if (!g_ascii_strncasecmp(agent, "User-Agent: Gaim", strlen("User-Agent: Gaim"))) flags |= IM_FLAG_GAIMUSER; } @@ -236,7 +236,7 @@ content = strstr(msg, "Content-Type: "); if (!content) return; - if (!g_strncasecmp(content, "Content-Type: text/x-msmsgscontrol\r\n", + if (!g_ascii_strncasecmp(content, "Content-Type: text/x-msmsgscontrol\r\n", strlen( "Content-Type: text/x-msmsgscontrol\r\n"))) { if (strstr(content,"TypingUser: ") && !ms->chat) { serv_got_typing(ms->gc, ms->msguser, @@ -244,7 +244,7 @@ return; } - } else if (!g_strncasecmp(content, "Content-Type: text/x-msmsgsinvite;", + } else if (!g_ascii_strncasecmp(content, "Content-Type: text/x-msmsgsinvite;", strlen("Content-Type: text/x-msmsgsinvite;"))) { /* @@ -257,7 +257,7 @@ */ msn_process_ft_msg(ms, content); - } else if (!g_strncasecmp(content, "Content-Type: text/plain", + } else if (!g_ascii_strncasecmp(content, "Content-Type: text/plain", strlen("Content-Type: text/plain"))) { char *skiphead = strstr(msg, "\r\n\r\n"); @@ -442,7 +442,7 @@ for (m = md->switches; m != NULL; m = m->next) { struct msn_switchboard *ms = (struct msn_switchboard *)m->data; - if (ms->total <= 1 && !g_strcasecmp(ms->user, username)) + if (ms->total <= 1 && !gaim_utf8_strcasecmp(ms->user, username)) return ms; } diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/napster/napster.c --- a/src/protocols/napster/napster.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/napster/napster.c Sun Mar 16 00:01:49 2003 +0000 @@ -109,7 +109,7 @@ channel = (struct nap_channel *)channels->data; if (channel) { - if (!g_strcasecmp(name, channel->name)) { + if (!gaim_utf8_strcasecmp(name, channel->name)) { return channel; } } diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/toc/toc.c --- a/src/protocols/toc/toc.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/toc/toc.c Sun Mar 16 00:01:49 2003 +0000 @@ -623,10 +623,10 @@ if (tdt->state == STATE_SIGNON_REQUEST) { debug_printf("* TOC sends client SIGN_ON reply\n"); - if (g_strncasecmp(buf + sizeof(struct sflap_hdr), "SIGN_ON", strlen("SIGN_ON"))) { + if (g_ascii_strncasecmp(buf + sizeof(struct sflap_hdr), "SIGN_ON", strlen("SIGN_ON"))) { debug_printf("Didn't get SIGN_ON! buf was: %s\n", buf + sizeof(struct sflap_hdr)); - if (!g_strncasecmp(buf + sizeof(struct sflap_hdr), "ERROR", 5)) { + if (!g_ascii_strncasecmp(buf + sizeof(struct sflap_hdr), "ERROR", 5)) { strtok(buf + sizeof(struct sflap_hdr), ":"); hide_login_progress(gc, show_error_message()); } else @@ -665,7 +665,7 @@ c = strtok(buf + sizeof(struct sflap_hdr), ":"); /* Ditch the first part */ - if (!g_strcasecmp(c, "SIGN_ON")) { + if (!g_ascii_strcasecmp(c, "SIGN_ON")) { /* we should only get here after a PAUSE */ if (tdt->state != STATE_PAUSE) debug_printf("got SIGN_ON but not PAUSE!\n"); @@ -684,15 +684,15 @@ do_error_dialog(_("TOC has come back from its pause. You may now send" " messages again."), NULL, GAIM_INFO); } - } else if (!strcasecmp(c, "CONFIG")) { + } else if (!g_ascii_strcasecmp(c, "CONFIG")) { c = strtok(NULL, ":"); parse_toc_buddy_list(gc->account, c); - } else if (!strcasecmp(c, "NICK")) { + } else if (!g_ascii_strcasecmp(c, "NICK")) { /* ignore NICK so that things get imported/exported properly c = strtok(NULL, ":"); g_snprintf(gc->username, sizeof(gc->username), "%s", c); */ - } else if (!strcasecmp(c, "IM_IN")) { + } else if (!g_ascii_strcasecmp(c, "IM_IN")) { char *away, *message; int a = 0; @@ -707,7 +707,7 @@ a = (away && (*away == 'T')) ? IM_FLAG_AWAY : 0; serv_got_im(gc, c, message, a, time(NULL), -1); - } else if (!strcasecmp(c, "UPDATE_BUDDY")) { + } else if (!g_ascii_strcasecmp(c, "UPDATE_BUDDY")) { char *l, *uc, *tmp; int logged, evil, idle, type = 0; time_t signon, time_idle; @@ -754,9 +754,9 @@ g_free(tmp); serv_got_update(gc, c, logged, evil, signon, time_idle, type); - } else if (!strcasecmp(c, "ERROR")) { + } else if (!g_ascii_strcasecmp(c, "ERROR")) { do_error_dialog(show_error_message(), NULL, GAIM_ERROR); - } else if (!strcasecmp(c, "EVILED")) { + } else if (!g_ascii_strcasecmp(c, "EVILED")) { int lev; char *name; @@ -764,7 +764,7 @@ name = strtok(NULL, ":"); serv_got_eviled(gc, name, lev); - } else if (!strcasecmp(c, "CHAT_JOIN")) { + } else if (!g_ascii_strcasecmp(c, "CHAT_JOIN")) { char *name; int id; @@ -772,7 +772,7 @@ name = strtok(NULL, ":"); serv_got_joined_chat(gc, id, name); - } else if (!strcasecmp(c, "CHAT_IN")) { + } else if (!g_ascii_strcasecmp(c, "CHAT_IN")) { int id, w; char *m, *who, *whisper; @@ -787,7 +787,7 @@ w = (whisper && (*whisper == 'T')) ? 1 : 0; serv_got_chat_in(gc, id, who, w, m, time((time_t)NULL)); - } else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) { + } else if (!g_ascii_strcasecmp(c, "CHAT_UPDATE_BUDDY")) { int id; char *in, *buddy; GSList *bcs = gc->buddy_chats; @@ -816,7 +816,7 @@ else while ((buddy = strtok(NULL, ":")) != NULL) gaim_chat_remove_user(chat, buddy, NULL); - } else if (!strcasecmp(c, "CHAT_INVITE")) { + } else if (!g_ascii_strcasecmp(c, "CHAT_INVITE")) { char *name, *who, *message; int *id = g_new0(int, 1); @@ -826,7 +826,7 @@ message = strtok(NULL, ":"); serv_got_chat_invite(gc, name, who, message, g_list_append(NULL, id)); - } else if (!strcasecmp(c, "CHAT_LEFT")) { + } else if (!g_ascii_strcasecmp(c, "CHAT_LEFT")) { GSList *bcs = gc->buddy_chats; struct gaim_conversation *b = NULL; int id; @@ -852,7 +852,7 @@ do_error_dialog(error_buf, NULL, GAIM_ERROR); } else serv_got_chat_left(gc, id); - } else if (!strcasecmp(c, "GOTO_URL")) { + } else if (!g_ascii_strcasecmp(c, "GOTO_URL")) { char *name, *url, tmp[256]; name = strtok(NULL, ":"); @@ -863,17 +863,17 @@ atoi(gc->account->proto_opt[USEROPT_AUTHPORT]) : TOC_PORT, url); grab_url(tmp, FALSE, toc_got_info, NULL); - } else if (!strcasecmp(c, "DIR_STATUS")) { - } else if (!strcasecmp(c, "ADMIN_NICK_STATUS")) { - } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) { + } else if (!g_ascii_strcasecmp(c, "DIR_STATUS")) { + } else if (!g_ascii_strcasecmp(c, "ADMIN_NICK_STATUS")) { + } else if (!g_ascii_strcasecmp(c, "ADMIN_PASSWD_STATUS")) { do_error_dialog(_("Password Change Successful"), NULL, GAIM_INFO); - } else if (!strcasecmp(c, "PAUSE")) { + } else if (!g_ascii_strcasecmp(c, "PAUSE")) { tdt->state = STATE_PAUSE; do_error_dialog(_("TOC has sent a PAUSE command."), _("When this happens, TOC ignores" " any messages sent to it, and may kick you off if you send a" " message. Gaim will prevent anything from going through. This" " is only temporary, please be patient."), GAIM_WARNING); - } else if (!strcasecmp(c, "RVOUS_PROPOSE")) { + } else if (!g_ascii_strcasecmp(c, "RVOUS_PROPOSE")) { char *user, *uuid, *cookie; int seq; char *rip, *pip, *vip, *trillian = NULL; @@ -1718,7 +1718,7 @@ if (old_ft->files == 1) ft->filename = g_strdup(dirname); else - ft->filename = g_dirname(dirname); + ft->filename = g_path_get_dirname(dirname); ft->cookie = g_strdup(old_ft->cookie); ft->user = g_strdup(old_ft->user); ft->ip = g_strdup(old_ft->ip); @@ -1766,6 +1766,7 @@ if (ft->hdr.hdrtype == htons(0x1108)) { struct tm *fortime; struct stat st; + char *basename; toc_read(source, ft, 8); toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); @@ -1773,11 +1774,13 @@ stat(ft->filename, &st); fortime = localtime(&st.st_mtime); + basename = g_path_get_basename(ft->filename); g_snprintf(buf, sizeof(buf), "%2d/%2d/%4d %2d:%2d %8ld %s\r\n", fortime->tm_mon + 1, fortime->tm_mday, fortime->tm_year + 1900, fortime->tm_hour + 1, fortime->tm_min + 1, (long)st.st_size, - g_basename(ft->filename)); + basename); toc_write(source, buf, ntohl(ft->hdr.size)); + g_free(basename); return; } @@ -1849,6 +1852,7 @@ struct file_transfer *ft = data; struct file_header *hdr; char *buf; + char *basename; if (src == -1) { do_error_dialog(_("Could not connect for transfer!"), NULL, GAIM_ERROR); @@ -1872,7 +1876,9 @@ hdr->totparts = htons(1); hdr->partsleft = htons(1); hdr->totsize = htonl((long)ft->st.st_size); /* combined size of all files */ /* size = strlen("mm/dd/yyyy hh:mm sizesize 'name'\r\n") */ - hdr->size = htonl(28 + strlen(g_basename(ft->filename))); /* size of listing.txt */ + basename = g_path_get_basename(ft->filename); + hdr->size = htonl(28 + strlen(basename)); /* size of listing.txt */ + g_free(basename); hdr->modtime = htonl(ft->st.st_mtime); hdr->checksum = htonl(0x89f70000); /* uh... */ g_snprintf(hdr->idstring, 32, "OFT_Windows ICBMFT V1.1 32"); diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/yahoo/yahoo.c Sun Mar 16 00:01:49 2003 +0000 @@ -515,12 +515,12 @@ if (!msg) return; - if (!g_strncasecmp(msg, "TYPING", strlen("TYPING"))) { + if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING"))) { if (*stat == '1') serv_got_typing(gc, from, 0, TYPING); else serv_got_typing_stopped(gc, from); - } else if (!g_strncasecmp(msg, "GAME", strlen("GAME"))) { + } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { struct buddy *bud = gaim_find_buddy(gc->account, from); void *free1=NULL, *free2=NULL; if (!bud) @@ -967,7 +967,7 @@ yd->games = g_hash_table_new(g_str_hash, g_str_equal); - if (!g_strncasecmp(account->proto_opt[USEROPT_PAGERHOST], "cs.yahoo.com", strlen("cs.yahoo.com"))) { + if (!g_ascii_strncasecmp(account->proto_opt[USEROPT_PAGERHOST], "cs.yahoo.com", strlen("cs.yahoo.com"))) { /* Figured out the new auth method -- cs.yahoo.com likes to disconnect on buddy remove and add now */ debug_printf("Setting new Yahoo! server.\n"); g_snprintf(account->proto_opt[USEROPT_PAGERHOST], strlen("scs.yahoo.com") + 1, "scs.yahoo.com"); diff -r 9212d1c5b7dc -r 677d3cb193a1 src/protocols/zephyr/zephyr.c --- a/src/protocols/zephyr/zephyr.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/protocols/zephyr/zephyr.c Sun Mar 16 00:01:49 2003 +0000 @@ -126,16 +126,16 @@ * wildcards in each field of zt1. */ static gboolean triple_subset(zephyr_triple *zt1, zephyr_triple *zt2) { - if (g_strcasecmp(zt2->class, zt1->class) && - g_strcasecmp(zt2->class, "*")) { + if (g_ascii_strcasecmp(zt2->class, zt1->class) && + g_ascii_strcasecmp(zt2->class, "*")) { return FALSE; } - if (g_strcasecmp(zt2->instance, zt1->instance) && - g_strcasecmp(zt2->instance, "*")) { + if (g_ascii_strcasecmp(zt2->instance, zt1->instance) && + g_ascii_strcasecmp(zt2->instance, "*")) { return FALSE; } - if (g_strcasecmp(zt2->recipient, zt1->recipient) && - g_strcasecmp(zt2->recipient, "*")) { + if (g_ascii_strcasecmp(zt2->recipient, zt1->recipient) && + g_ascii_strcasecmp(zt2->recipient, "*")) { return FALSE; } return TRUE; @@ -200,8 +200,8 @@ if (end) { g_snprintf(buf, end, "%s", message+cnt+1); } - if (!g_strcasecmp(buf, "italic") || - !g_strcasecmp(buf, "i")) { + if (!g_ascii_strcasecmp(buf, "italic") || + !g_ascii_strcasecmp(buf, "i")) { new_f = g_new(zframe, 1); new_f->enclosing = frames; new_f->text = g_string_new(""); @@ -209,8 +209,8 @@ new_f->has_closer = TRUE; frames = new_f; cnt += end+1; /* cnt points to char after opener */ - } else if (!g_strcasecmp(buf, "bold") - || !g_strcasecmp(buf, "b")) { + } else if (!g_ascii_strcasecmp(buf, "bold") + || !g_ascii_strcasecmp(buf, "b")) { new_f = g_new(zframe, 1); new_f->enclosing = frames; new_f->text = g_string_new(""); @@ -218,7 +218,7 @@ new_f->has_closer = TRUE; frames = new_f; cnt += end+1; - } else if (!g_strcasecmp(buf, "color")) { + } else if (!g_ascii_strcasecmp(buf, "color")) { cnt += end+1; new_f = g_new(zframe, 1); new_f->enclosing = frames; @@ -231,7 +231,7 @@ new_f->closing = ""; new_f->has_closer = FALSE; frames = new_f; - } else if (!g_strcasecmp(buf, "")) { + } else if (!g_ascii_strcasecmp(buf, "")) { new_f = g_new(zframe, 1); new_f->enclosing = frames; new_f->text = g_string_new(""); @@ -299,7 +299,7 @@ { GList *curr; for (curr = pending_zloc_names; curr != NULL; curr = curr->next) { - if (!g_strcasecmp(who, (char*)curr->data)) { + if (!g_ascii_strcasecmp(who, (char*)curr->data)) { g_free((char*)curr->data); pending_zloc_names = g_list_remove(pending_zloc_names, curr->data); return TRUE; @@ -310,10 +310,10 @@ static void handle_message(ZNotice_t notice, struct sockaddr_in from) { - if (!g_strcasecmp(notice.z_class, LOGIN_CLASS)) { + if (!g_ascii_strcasecmp(notice.z_class, LOGIN_CLASS)) { /* well, we'll be updating in 20 seconds anyway, might as well ignore this. */ - } else if (!g_strcasecmp(notice.z_class, LOCATE_CLASS)) { - if (!g_strcasecmp(notice.z_opcode, LOCATE_LOCATE)) { + } else if (!g_ascii_strcasecmp(notice.z_class, LOCATE_CLASS)) { + if (!g_ascii_strcasecmp(notice.z_opcode, LOCATE_LOCATE)) { int nlocs; char *user; struct buddy *b; @@ -333,15 +333,15 @@ ZLocations_t locs; int one = 1; GString *str = g_string_new(""); - g_string_sprintfa(str, "User: %s
" + g_string_append_printf(str, "User: %s
" "Alias: %s
", b->name, b->alias); if (!nlocs) { - g_string_sprintfa(str, "
Hidden or not logged-in"); + g_string_append_printf(str, "
Hidden or not logged-in"); } for (; nlocs > 0; nlocs--) { ZGetLocations(&locs, &one); - g_string_sprintfa(str, "
At %s since %s", locs.host, + g_string_append_printf(str, "
At %s since %s", locs.host, locs.time); } g_show_info_text(NULL, NULL, 2, str->str, NULL); @@ -365,9 +365,9 @@ g_strchomp(buf); buf2 = zephyr_to_html(buf); g_free(buf); - if (!g_strcasecmp(notice.z_class, "MESSAGE") && - !g_strcasecmp(notice.z_class_inst, "PERSONAL")) { - if (!g_strcasecmp(notice.z_message, "Automated reply:")) + if (!g_ascii_strcasecmp(notice.z_class, "MESSAGE") && + !g_ascii_strcasecmp(notice.z_class_inst, "PERSONAL")) { + if (!g_ascii_strcasecmp(notice.z_message, "Automated reply:")) away = TRUE; else away = FALSE; @@ -389,7 +389,7 @@ sendertmp = g_strdup_printf("%s",notice.z_sender); if ((realmptr = strchr(sendertmp,'@')) != NULL) { realmptr++; - if (!g_strcasecmp(realmptr,ZGetRealm())) { + if (!g_ascii_strcasecmp(realmptr,ZGetRealm())) { realmptr--; sprintf(realmptr,"%c",'\0'); send_inst = g_strdup_printf("%s %s",sendertmp, @@ -474,15 +474,15 @@ if (!exposure) return EXPOSE_REALMVIS; - if (!g_strcasecmp(exposure, EXPOSE_NONE)) + if (!g_ascii_strcasecmp(exposure, EXPOSE_NONE)) return EXPOSE_NONE; - if (!g_strcasecmp(exposure, EXPOSE_OPSTAFF)) + if (!g_ascii_strcasecmp(exposure, EXPOSE_OPSTAFF)) return EXPOSE_OPSTAFF; - if (!g_strcasecmp(exposure, EXPOSE_REALMANN)) + if (!g_ascii_strcasecmp(exposure, EXPOSE_REALMANN)) return EXPOSE_REALMANN; - if (!g_strcasecmp(exposure, EXPOSE_NETVIS)) + if (!g_ascii_strcasecmp(exposure, EXPOSE_NETVIS)) return EXPOSE_NETVIS; - if (!g_strcasecmp(exposure, EXPOSE_NETANN)) + if (!g_ascii_strcasecmp(exposure, EXPOSE_NETANN)) return EXPOSE_NETANN; return EXPOSE_REALMVIS; } @@ -521,13 +521,13 @@ sub.zsub_classinst = triple[1]; if(triple[2] == NULL) { recip = g_malloc0(1); - } else if (!g_strcasecmp(triple[2], "%me%")) { + } else if (!g_ascii_strcasecmp(triple[2], "%me%")) { recip = g_strdup_printf("%s",ZGetSender()); - } else if (!g_strcasecmp(triple[2], "*")) { + } else if (!g_ascii_strcasecmp(triple[2], "*")) { /* wildcard * form of class,instance,* */ recip = g_malloc0(1); - } else if (!g_strcasecmp(triple[2], tmp)) { + } else if (!g_ascii_strcasecmp(triple[2], tmp)) { /* form of class,instance,aatharuv@ATHENA.MIT.EDU */ recip = g_strdup(triple[2]); } else if ((atptr = strchr(triple[2], '@')) != NULL) { @@ -537,7 +537,7 @@ * @REALM-NAME */ char *realmat = g_strdup_printf("@%s", ZGetRealm()); - if (!g_strcasecmp(atptr, realmat)) + if (!g_ascii_strcasecmp(atptr, realmat)) recip = g_malloc0(1); else recip = g_strdup(atptr); @@ -645,9 +645,9 @@ zt = s->data; triple = g_strsplit(zt->name,",",3); if (triple[2] != NULL) { - if (!g_strcasecmp(triple[2], "")) { + if (!g_ascii_strcasecmp(triple[2], "")) { fprintf(fd, "%s,%s,*\n", triple[0], triple[1]); - } else if (!g_strcasecmp(triple[2], ZGetSender())) { + } else if (!g_ascii_strcasecmp(triple[2], ZGetSender())) { fprintf(fd, "%s,%s,%%me%%\n",triple[0],triple[1]); } else { fprintf(fd, "%s\n", zt->name); @@ -689,7 +689,7 @@ /* We should only strip the realm name if the principal is in the user's realm */ - if (!g_strcasecmp(ptr2,ZGetRealm())) { + if (!g_ascii_strcasecmp(ptr2,ZGetRealm())) { *ptr = '\0'; } } @@ -764,7 +764,7 @@ notice.z_opcode = ""; notice.z_class = zt->class; notice.z_class_inst = zt->instance; - if (!g_strcasecmp(zt->recipient, "*")) + if (!g_ascii_strcasecmp(zt->recipient, "*")) notice.z_recipient = zephyr_normalize(""); else notice.z_recipient = zephyr_normalize(zt->recipient); @@ -858,10 +858,10 @@ gc->away = NULL; } - if (!g_strcasecmp(state, "Hidden")) { + if (!g_ascii_strcasecmp(state, "Hidden")) { ZSetLocation(EXPOSE_OPSTAFF); gc->away = g_strdup(""); - } else if (!g_strcasecmp(state, "Online")) + } else if (!g_ascii_strcasecmp(state, "Online")) ZSetLocation(get_exposure_level()); else /* state is GAIM_AWAY_CUSTOM */ if (msg) gc->away = g_strdup(msg); @@ -911,7 +911,7 @@ classname = data->data; instname = data->next->data; recip = data->next->next->data; - if (!g_strcasecmp(recip, "%me%")) + if (!g_ascii_strcasecmp(recip, "%me%")) recip = ZGetSender(); zt1 = new_triple(classname, instname, recip); diff -r 9212d1c5b7dc -r 677d3cb193a1 src/prpl.c --- a/src/prpl.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/prpl.c Sun Mar 16 00:01:49 2003 +0000 @@ -550,7 +550,7 @@ const struct icon_data *x = a; const struct icon_data *y = b; - return ((x->gc != y->gc) || g_strcasecmp(x->who, y->who)); + return ((x->gc != y->gc) || gaim_utf8_strcasecmp(x->who, y->who)); } void set_icon_data(struct gaim_connection *gc, const char *who, void *data, int len) diff -r 9212d1c5b7dc -r 677d3cb193a1 src/server.c --- a/src/server.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/server.c Sun Mar 16 00:01:49 2003 +0000 @@ -855,7 +855,7 @@ if (signon && (gc->prpl->options & OPT_PROTO_CORRECT_TIME)) { char *tmp = g_strdup(normalize(name)); - if (!g_strcasecmp(tmp, normalize(gc->username))) { + if (!gaim_utf8_strcasecmp(tmp, normalize(gc->username))) { gc->evil = evil; gc->correction_time = (signon - gc->login_time); /*update_idle_times();*/ diff -r 9212d1c5b7dc -r 677d3cb193a1 src/themes.c --- a/src/themes.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/themes.c Sun Mar 16 00:01:49 2003 +0000 @@ -136,16 +136,16 @@ else theme->list = child; list = child; - } else if (!g_strncasecmp(i, "Name=", strlen("Name="))) { + } else if (!g_ascii_strncasecmp(i, "Name=", strlen("Name="))) { theme->name = g_strdup(i+ strlen("Name=")); theme->name[strlen(theme->name)-1] = 0; - } else if (!g_strncasecmp(i, "Description=", strlen("Description="))) { + } else if (!g_ascii_strncasecmp(i, "Description=", strlen("Description="))) { theme->desc = g_strdup(i + strlen("Description=")); theme->desc[strlen(theme->desc)-1] = 0; - } else if (!g_strncasecmp(i, "Icon=", strlen("Icon="))) { + } else if (!g_ascii_strncasecmp(i, "Icon=", strlen("Icon="))) { theme->icon = g_build_filename(dirname, i + strlen("Icon="), NULL); theme->icon[strlen(theme->icon)-1] = 0; - } else if (!g_strncasecmp(i, "Author=", strlen("Author="))) { + } else if (!g_ascii_strncasecmp(i, "Author=", strlen("Author="))) { theme->author = g_strdup(i + strlen("Author=")); theme->author[strlen(theme->author)-1] = 0; } else if (load && list) { diff -r 9212d1c5b7dc -r 677d3cb193a1 src/util.c --- a/src/util.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/util.c Sun Mar 16 00:01:49 2003 +0000 @@ -149,9 +149,9 @@ cpy[strlen(text)] = 0; c = cpy; while (*c) { - if (!g_strncasecmp(c, "", 3)) { + if (!g_ascii_strncasecmp(c, "/A>", 3)) { break; } text[cnt++] = *c; @@ -159,7 +159,7 @@ if (!(*c)) break; } - } else if ((*c=='h') && (!g_strncasecmp(c, "http://", 7) || (!g_strncasecmp(c, "https://", 8)))) { + } else if ((*c=='h') && (!g_ascii_strncasecmp(c, "http://", 7) || (!g_ascii_strncasecmp(c, "https://", 8)))) { t = c; while (1) { if (badchar(*t)) { @@ -183,7 +183,7 @@ t++; } - } else if (!g_strncasecmp(c, "www.", 4)) { + } else if (!g_ascii_strncasecmp(c, "www.", 4)) { if (c[4] != '.') { t = c; while (1) { @@ -212,7 +212,7 @@ t++; } } - } else if (!g_strncasecmp(c, "ftp://", 6)) { + } else if (!g_ascii_strncasecmp(c, "ftp://", 6)) { t = c; while (1) { if (badchar(*t)) { @@ -230,7 +230,7 @@ t++; } - } else if (!g_strncasecmp(c, "ftp.", 4)) { + } else if (!g_ascii_strncasecmp(c, "ftp.", 4)) { if (c[4] != '.') { t = c; while (1) { @@ -253,7 +253,7 @@ t++; } } - } else if (!g_strncasecmp(c, "mailto:", 7)) { + } else if (!g_ascii_strncasecmp(c, "mailto:", 7)) { t = c; while (1) { if (badchar(*t)) { @@ -470,6 +470,7 @@ char *normalize(const char *s) { static char buf[BUF_LEN]; + char *tmp; int i, j; g_return_val_if_fail((s != NULL), NULL); @@ -481,7 +482,10 @@ buf[i] = buf[j]; } buf[i] = '\0'; - g_strdown(buf); + + tmp = g_utf8_strdown(buf, -1); + g_snprintf(buf, sizeof(buf), tmp); + g_free(tmp); return buf; } @@ -980,7 +984,7 @@ return _("Not connected to AIM"); /* aim:goim?screenname=screenname&message=message */ - if (!g_strncasecmp(uri, "aim:goim?", strlen("aim:goim?"))) { + if (!g_ascii_strncasecmp(uri, "aim:goim?", strlen("aim:goim?"))) { char *who, *what; struct gaim_conversation *c; uri = uri + strlen("aim:goim?"); @@ -1002,7 +1006,7 @@ if (what) { what = what + strlen("message="); str = g_string_new(NULL); - while (*what && (*what != '&' || !g_strncasecmp(what, "&", 5))) { + while (*what && (*what != '&' || !g_ascii_strncasecmp(what, "&", 5))) { g_string_append_c(str, *what == '+' ? ' ' : *what); what++; } @@ -1019,7 +1023,7 @@ gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, what, -1); g_free(what); } - } else if (!g_strncasecmp(uri, "aim:addbuddy?", strlen("aim:addbuddy?"))) { + } else if (!g_ascii_strncasecmp(uri, "aim:addbuddy?", strlen("aim:addbuddy?"))) { char *who, *group; uri = uri + strlen("aim:addbuddy?"); /* spaces are encoded as +'s */ @@ -1040,7 +1044,7 @@ if (group) { group = group + strlen("group="); str = g_string_new(NULL); - while (*group && (*group != '&' || !g_strncasecmp(group, "&", 5))) { + while (*group && (*group != '&' || !g_ascii_strncasecmp(group, "&", 5))) { g_string_append_c(str, *group == '+' ? ' ' : *group); group++; } @@ -1052,7 +1056,7 @@ g_free(who); if (group) g_free(group); - } else if (!g_strncasecmp(uri, "aim:gochat?", strlen("aim:gochat?"))) { + } else if (!g_ascii_strncasecmp(uri, "aim:gochat?", strlen("aim:gochat?"))) { char *room; GList *chat=NULL; int exch = 5; @@ -1244,8 +1248,8 @@ pm = gdk_pixmap_create_from_xpm_d(menu->parent->window, &mask, NULL, xpm); pixmap = gtk_image_new_from_pixmap(pm, mask); gtk_widget_show(pixmap); - gdk_pixmap_unref(pm); - gdk_bitmap_unref(mask); + g_object_unref(G_OBJECT(pm)); + g_object_unref(G_OBJECT(mask)); gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, FALSE, 2); /* Create our label and pack it */ @@ -1328,3 +1332,12 @@ return g_strdup(inet_ntoa(((struct sockaddr_in *)&addr)->sin_addr)); } + +gint gaim_utf8_strcasecmp(const gchar *a, const gchar *b) { + gchar *a_norm = g_utf8_casefold(a, -1); + gchar *b_norm = g_utf8_casefold(b, -1); + gint ret = g_utf8_collate(a_norm, b_norm); + g_free(a_norm); + g_free(b_norm); + return ret; +}