im.pidgin.pidgin: 5781d39f495daa6c1aaac51861fb1cd79d6869f0
jeff2 at soc.pidgin.im
jeff2 at soc.pidgin.im
Sat Feb 16 16:35:49 EST 2008
-----------------------------------------------------------------
Revision: 5781d39f495daa6c1aaac51861fb1cd79d6869f0
Ancestor: 264d4bc3abd6ada52ea199d083180cdedf78d38b
Author: jeff2 at soc.pidgin.im
Date: 2008-02-16T21:07:09
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5781d39f495daa6c1aaac51861fb1cd79d6869f0
Modified files:
libpurple/protocols/myspace/persist.h
libpurple/protocols/myspace/user.c
ChangeLog:
In msimprpl, define a new set of symbolic constants for the command to
set a username. Closes #4856.
-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/persist.h b457505291911d795ab58b73b4930915380afa0e
+++ libpurple/protocols/myspace/persist.h c1bb5a816d5914dc5cce181414368b638dbb4bb7
@@ -73,7 +73,8 @@ MSIM_PERSIST_DSN_LID(MC_CONTACT_INFO,
/** Messages to Change/send information */
MSIM_PERSIST_DSN_LID(MC_USER_PREFERENCES, 1, 10)
MSIM_PERSIST_DSN_LID(MC_CONTACT_INFO, 0, 9)
-MSIM_PERSIST_DSN_LID(MC_IMPORT_ALL_FRIENDS, 14, 21)
+MSIM_PERSIST_DSN_LID(MC_SET_USERNAME, 9, 14)
+MSIM_PERSIST_DSN_LID(MC_IMPORT_ALL_FRIENDS, 14, 21)
MSIM_PERSIST_DSN_LID(MC_INVITE, 16, 25)
/** Messages to Delete information */
============================================================
--- libpurple/protocols/myspace/user.c e979e6141e16cebdd74993a41620cc3ebffcf038
+++ libpurple/protocols/myspace/user.c c3d59eb6811a7e6f0f426a8d626fa02a80cb0749
@@ -651,9 +651,6 @@ static void msim_username_is_available_c
NULL,
session->gc,
G_CALLBACK(msim_set_username_confirmed_cb),
- /* TODO: Should we really abort the whole process if the user changes their
- * mind about setting a username? Maybe should instead ask for another username,
- * but there should still be a way to get out of the loop. */
G_CALLBACK(msim_do_not_set_username_cb));
} else {
/* Looks like its in use or we have an invalid response */
@@ -738,10 +735,10 @@ msim_set_username(MsimSession *session,
g_return_if_fail(msim_send(session,
"persist", MSIM_TYPE_INTEGER, 1,
"sesskey", MSIM_TYPE_INTEGER, session->sesskey,
- "cmd", MSIM_TYPE_INTEGER, 1,
- "dsn", MSIM_TYPE_INTEGER, 5,
+ "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET,
+ "dsn", MSIM_TYPE_INTEGER, MG_MYSPACE_INFO_BY_STRING_DSN,
"uid", MSIM_TYPE_INTEGER, session->userid,
- "lid", MSIM_TYPE_INTEGER, 7,
+ "lid", MSIM_TYPE_INTEGER, MG_MYSPACE_INFO_BY_STRING_LID,
"rid", MSIM_TYPE_INTEGER, rid,
"body", MSIM_TYPE_DICTIONARY, body,
NULL));
@@ -768,10 +765,12 @@ static void msim_username_is_set_cb(Msim
uid = msim_msg_get_integer(userinfo, "uid");
lid = msim_msg_get_integer(userinfo, "lid");
body = msim_msg_get_dictionary(userinfo, "body");
- errmsg = g_strdup("An error occured while trying to set the username.\nPlease try again, or visit http://editprofile.myspace.com/index.cfm?fuseaction=profile.username to set your username.");
+ errmsg = g_strdup("An error occured while trying to set the username.\n"
+ "Please try again, or visit http://editprofile.myspace.com/index.cfm?"
+ "fuseaction=profile.username to set your username.");
if (!body) {
- purple_debug_info("msim","No body for in msim_username_is_set\n");
+ purple_debug_info("msim_username_is_set_cb", "No body");
/* Error: No body! */
purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
}
@@ -780,24 +779,37 @@ static void msim_username_is_set_cb(Msim
msim_msg_free(body);
- purple_debug_info("msim","username_is_set cmd = %d, dsn = %d, lid = %d, code = %d, username = %s\n",cmd,dsn,lid,code,username);
- if (cmd == 258 && dsn == 9 && lid == 14) {
- purple_debug_info("msim","Proper cmd,dsn,lid for username_is_set!\n");
- purple_debug_info("msim","Username Set with return code %d\n",code);
+ purple_debug_info("msim_username_is_set_cb",
+ "cmd = %d, dsn = %d, lid = %d, code = %d, username = %s\n",
+ cmd, dsn, lid, code, username);
+
+ if (cmd == (MSIM_CMD_BIT_REPLY | MSIM_CMD_PUT)
+ && dsn == MC_SET_USERNAME_DSN
+ && lid == MC_SET_USERNAME_LID) {
+ purple_debug_info("msim_username_is_set_cb", "Proper cmd,dsn,lid for username_is_set!\n");
+ purple_debug_info("msim_username_is_set_cb", "Username Set with return code %d\n",code);
if (code == 0) {
/* Good! */
msim_we_are_logged_on(session);
} else {
- purple_debug_info("msim","code is %d",code);
+ purple_debug_info("msim_username_is_set", "code is %d",code);
+ /* TODO: what to do here? */
}
- } else if (cmd == 257 && dsn == 5 && lid == 7) {
+ } else if (cmd == (MSIM_CMD_BIT_REPLY | MSIM_CMD_GET)
+ && dsn == MG_MYSPACE_INFO_BY_STRING_DSN
+ && lid == MG_MYSPACE_INFO_BY_STRING_LID) {
/* Not quite done... ONE MORE STEP :) */
rid = msim_new_reply_callback(session, msim_username_is_set_cb, data);
body = msim_msg_new("UserName", MSIM_TYPE_STRING, g_strdup(username),NULL);
- if (!msim_send(session, "persist", MSIM_TYPE_INTEGER, 1, "sesskey", MSIM_TYPE_INTEGER, session->sesskey,
- "cmd", MSIM_TYPE_INTEGER, 2, "dsn", MSIM_TYPE_INTEGER, 9, "uid", MSIM_TYPE_INTEGER, session->userid,
- "lid", MSIM_TYPE_INTEGER, 14, "rid", MSIM_TYPE_INTEGER, rid, "body", MSIM_TYPE_DICTIONARY, body,
- NULL)) {
+ if (!msim_send(session, "persist", MSIM_TYPE_INTEGER, 1,
+ "sesskey", MSIM_TYPE_INTEGER, session->sesskey,
+ "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_PUT,
+ "dsn", MSIM_TYPE_INTEGER, MC_SET_USERNAME_DSN,
+ "uid", MSIM_TYPE_INTEGER, session->userid,
+ "lid", MSIM_TYPE_INTEGER, MC_SET_USERNAME_LID,
+ "rid", MSIM_TYPE_INTEGER, rid,
+ "body", MSIM_TYPE_DICTIONARY, body,
+ NULL)) {
/* Error! */
/* Can't set... Disconnect */
purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
More information about the Commits
mailing list