From: Nathan W. <fac...@us...> - 2003-03-16 00:02:17
|
Update of /cvsroot/gaim/gaim/src/protocols/msn In directory sc8-pr-cvs1:/tmp/cvs-serv19860/src/protocols/msn Modified Files: ft.c msn.c switchboard.c Log Message: 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. Index: ft.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/ft.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ft.c 8 Mar 2003 08:27:02 -0000 1.4 +++ ft.c 16 Mar 2003 00:01:43 -0000 1.5 @@ -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; Index: msn.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/msn.c,v retrieving revision 1.150 retrieving revision 1.151 diff -u -d -r1.150 -r1.151 --- msn.c 13 Mar 2003 17:52:20 -0000 1.150 +++ msn.c 16 Mar 2003 00:01:43 -0000 1.151 @@ -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; } Index: switchboard.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/switchboard.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- switchboard.c 10 Mar 2003 05:30:29 -0000 1.4 +++ switchboard.c 16 Mar 2003 00:01:43 -0000 1.5 @@ -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; } |