gobjectification: 1124e451: compile myspace

sadrul at pidgin.im sadrul at pidgin.im
Thu Mar 13 04:36:40 EDT 2008


-----------------------------------------------------------------
Revision: 1124e4519468c2955f33b5df2a74cbc11975b117
Ancestor: 12679db96f79378aa39c45190f693c6acefe8b2f
Author: sadrul at pidgin.im
Date: 2008-03-13T07:15:48
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/1124e4519468c2955f33b5df2a74cbc11975b117

Modified files:
        libpurple/protocols/myspace/myspace.c
        libpurple/protocols/myspace/session.c
        libpurple/protocols/myspace/user.c
        libpurple/protocols/myspace/zap.c

ChangeLog: 

compile myspace

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/myspace.c	2c3c9a0249091233aab5333c75226e613186f252
+++ libpurple/protocols/myspace/myspace.c	f3c1a8aaee8f9b90c34b6deb940a346fa68c3d3b
@@ -209,7 +209,7 @@ msim_send_raw(MsimSession *session, cons
 	
 	purple_debug_info("msim", "msim_send_raw: writing <%s>\n", msg);
 
-	return msim_send_really_raw(purple_account_get_connection(session), msg, strlen(msg)) ==
+	return msim_send_really_raw(session->gc, msg, strlen(msg)) ==
 		strlen(msg);
 }
 
@@ -235,7 +235,7 @@ msim_send_really_raw(PurpleConnection *g
 	g_return_val_if_fail(buf != NULL, -1);
 	g_return_val_if_fail(total_bytes >= 0, -1);
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), -1);
 	
@@ -278,8 +278,8 @@ msim_login(PurpleAccount *acct)
 	purple_debug_info("msim", "logging in %s\n", purple_account_get_username(acct));
 
 	gc = purple_account_get_connection(acct);
-	gc->proto_data = msim_session_new(acct);
-	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_NO_URLDESC;
+	purple_object_set_protocol_data(PURPLE_OBJECT(gc),msim_session_new(acct));
+	purple_connection_turn_on_flags(gc, PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_NO_URLDESC);
 
 	/* 1. connect to server */
 	purple_connection_update_progress(gc, _("Connecting"),
@@ -332,19 +332,19 @@ msim_login_challenge(MsimSession *sessio
 
 	g_return_val_if_fail(account != NULL, FALSE);
 
-	purple_connection_update_progress(purple_account_get_connection(session), _("Reading challenge"), 1, 4);
+	purple_connection_update_progress(session->gc, _("Reading challenge"), 1, 4);
 
 	purple_debug_info("msim", "nc is %d bytes, decoded\n", nc_len);
 
 	if (nc_len != MSIM_AUTH_CHALLENGE_LENGTH) {
 		purple_debug_info("msim", "bad nc length: %x != 0x%x\n", nc_len, MSIM_AUTH_CHALLENGE_LENGTH);
-		purple_connection_error_reason (purple_account_get_connection(session),
+		purple_connection_error_reason (session->gc,
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Unexpected challenge length from server"));
 		return FALSE;
 	}
 
-	purple_connection_update_progress(purple_account_get_connection(session), _("Logging in"), 2, 4);
+	purple_connection_update_progress(session->gc, _("Logging in"), 2, 4);
 
 	response_len = 0;
 	response = msim_compute_login_response(nc, purple_account_get_username(account), purple_account_get_password(account), &response_len);
@@ -524,7 +524,7 @@ msim_send_im(PurpleConnection *gc, const
 
 	/* 'flags' has many options, not used here. */
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), -1);
 
@@ -687,7 +687,7 @@ msim_incoming_im(MsimSession *session, M
 		time_received = time(NULL);
 	}
 
-	serv_got_im(purple_account_get_connection(session), username, msg_purple_markup, PURPLE_MESSAGE_RECV, time_received);
+	serv_got_im(session->gc, username, msg_purple_markup, PURPLE_MESSAGE_RECV, time_received);
 
 	g_free(username);
 	g_free(msg_purple_markup);
@@ -758,10 +758,10 @@ msim_incoming_action(MsimSession *sessio
 			msg_text, username);
 
 	if (g_str_equal(msg_text, "%typing%")) {
-		serv_got_typing(purple_account_get_connection(session), username, 0, PURPLE_TYPING);
+		serv_got_typing(session->gc, username, 0, PURPLE_TYPING);
 		rc = TRUE;
 	} else if (g_str_equal(msg_text, "%stoptyping%")) {
-		serv_got_typing_stopped(purple_account_get_connection(session), username);
+		serv_got_typing_stopped(session->gc, username);
 		rc = TRUE;
 	} else if (strstr(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_")) {
 		rc = msim_incoming_zap(session, msg);
@@ -813,8 +813,8 @@ msim_incoming_media(MsimSession *session
 	/* Media messages are sent when the user opens a window to someone.
 	 * Tell libpurple they started typing and stopped typing, to inform the Psychic
 	 * Mode plugin so it too can open a window to the user. */
-	serv_got_typing(purple_account_get_connection(session), username, 0, PURPLE_TYPING);
-	serv_got_typing_stopped(purple_account_get_connection(session), username);
+	serv_got_typing(session->gc, username, 0, PURPLE_TYPING);
+	serv_got_typing_stopped(session->gc, username);
 
 	g_free(username);
 
@@ -893,7 +893,7 @@ msim_send_typing(PurpleConnection *gc, c
 	g_return_val_if_fail(gc != NULL, 0);
 	g_return_val_if_fail(name != NULL, 0);
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), 0);
 
@@ -954,7 +954,7 @@ msim_get_info_cb(MsimSession *session, M
 
 		buddy = purple_buddy_new(session->account, username, NULL);
 		user->buddy = buddy;
-		buddy->proto_data = (gpointer)user;
+		purple_object_set_protocol_data(PURPLE_OBJECT(buddy),(gpointer)user);
 	}
 
 	/* Update user structure with new information */
@@ -965,7 +965,7 @@ msim_get_info_cb(MsimSession *session, M
 	/* Append data from MsimUser to PurpleNotifyUserInfo for display, full */
 	msim_append_user_info(session, user_info, user, TRUE);
 
-	purple_notify_userinfo(purple_account_get_connection(session), username, user_info, NULL, NULL);
+	purple_notify_userinfo(session->gc, username, user_info, NULL, NULL);
 	purple_debug_info("msim", "msim_get_info_cb: username=%s\n", username);
 
 	purple_notify_user_info_destroy(user_info);
@@ -977,7 +977,7 @@ msim_get_info_cb(MsimSession *session, M
 		g_free(user->location);
 		g_free(user->headline);
 		g_free(user->display_name);
-		g_free(purple_account_get_username(user));
+		g_free(user->username);
 		g_free(user->image_url);
 		g_free(user);
 	}
@@ -999,7 +999,7 @@ msim_get_info(PurpleConnection *gc, cons
 	g_return_if_fail(gc != NULL);
 	g_return_if_fail(username != NULL);
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	g_return_if_fail(MSIM_SESSION_VALID(session));
 
@@ -1040,7 +1040,7 @@ msim_set_status(PurpleAccount *account, 
 	gchar *stripped;
 	gchar *unrecognized_msg;
 
-	session = (MsimSession *)purple_account_get_connection(account)->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(account)));
 
 	g_return_if_fail(MSIM_SESSION_VALID(session));
 
@@ -1104,7 +1104,7 @@ msim_set_idle(PurpleConnection *gc, int 
 
 	g_return_if_fail(gc != NULL);
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	g_return_if_fail(MSIM_SESSION_VALID(session));
 
@@ -1313,10 +1313,10 @@ msim_check_alive(gpointer data)
 
 		purple_debug_info("msim", "msim_check_alive: %s > interval of %d, presumed dead\n",
 				errmsg, MSIM_KEEPALIVE_INTERVAL);
-		purple_connection_error_reason(purple_account_get_connection(session),
+		purple_connection_error_reason(session->gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR, errmsg);
 
-		purple_notify_error(purple_account_get_connection(session), NULL, errmsg, NULL);
+		purple_notify_error(session->gc, NULL, errmsg, NULL);
 
 		g_free(errmsg);
 
@@ -1387,7 +1387,7 @@ msim_check_inbox_cb(MsimSession *session
 
 				subjects[n] = message_types[i].text;
 				froms[n] = _("MySpace");
-				tos[n] = purple_account_get_username(session);
+				tos[n] = session->username;
 				/* TODO: append token, web challenge, so automatically logs in.
 				 * Would also need to free strings because they won't be static
 				 */
@@ -1409,7 +1409,7 @@ msim_check_inbox_cb(MsimSession *session
 				"msim_check_inbox_cb: notifying of %d\n", n);
 
 		/* TODO: free strings with callback _if_ change to dynamic (w/ token) */
-		purple_notify_emails(purple_account_get_connection(session),         /* handle */
+		purple_notify_emails(session->gc,         /* handle */
 				n,                        /* count */
 				TRUE,                     /* detailed */
 				subjects, froms, tos, urls, 
@@ -1543,7 +1543,7 @@ msim_is_username_set(MsimSession *sessio
 {
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE);
 	g_return_val_if_fail(msg != NULL, FALSE);
-	g_return_val_if_fail(purple_account_get_connection(session) != NULL, FALSE);
+	g_return_val_if_fail(session->gc != NULL, FALSE);
 
 	session->sesskey = msim_msg_get_integer(msg, "sesskey");
 	purple_debug_info("msim", "SESSKEY=<%d>\n", session->sesskey);
@@ -1566,12 +1566,12 @@ msim_is_username_set(MsimSession *sessio
 	/* We now know are our own username, only after we're logged in..
 	 * which is weird, but happens because you login with your email
 	 * address and not username. Will be freed in msim_session_destroy(). */
-	purple_account_get_username(session) = msim_msg_get_string(msg, "uniquenick");
+	session->username = msim_msg_get_string(msg, "uniquenick");
 
 	/* If user lacks a username, help them get one. */
 	if (msim_msg_get_integer(msg, "uniquenick") == session->userid) {
 		purple_debug_info("msim_is_username_set", "no username is set\n");
-		purple_request_yes_no(purple_account_get_connection(session),
+		purple_request_yes_no(session->gc,
 			_("MySpaceIM - No Username Set"),
 			_("You appear to have no MySpace username."),
 			_("Would you like to set one now? (Note: THIS CANNOT BE CHANGED!)"),
@@ -1579,7 +1579,7 @@ msim_is_username_set(MsimSession *sessio
 			session->account,
 			NULL,
 			NULL,
-			purple_account_get_connection(session), 
+			session->gc, 
 			G_CALLBACK(msim_set_username_cb), 
 			G_CALLBACK(msim_do_not_set_username_cb));
 		purple_debug_info("msim_is_username_set","'username not set' alert prompted\n");
@@ -1598,11 +1598,11 @@ gboolean msim_we_are_logged_on(MsimSessi
 	/* The session is now set up, ready to be connected. This emits the
 	 * signedOn signal, so clients can now do anything with msimprpl, and
 	 * we're ready for it (session key, userid, username all setup). */
-	purple_connection_update_progress(purple_account_get_connection(session), _("Connected"), 3, 4);
-	purple_connection_set_state(purple_account_get_connection(session), PURPLE_CONNECTION_STATE_CONNECTED);
+	purple_connection_update_progress(session->gc, _("Connected"), 3, 4);
+	purple_connection_set_state(session->gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 	/* Set display name to username (otherwise will show email address) */
-	purple_connection_set_display_name(purple_account_get_connection(session), purple_account_get_username(session));
+	purple_connection_set_display_name(session->gc, session->username);
 
 	body = msim_msg_new(
 			"UserID", MSIM_TYPE_INTEGER, session->userid,
@@ -1876,7 +1876,7 @@ msim_error(MsimSession *session, MsimMes
 					purple_account_set_password(session->account, NULL);
 				break;
 		}
-		purple_connection_error_reason (purple_account_get_connection(session), reason, full_errmsg);
+		purple_connection_error_reason (session->gc, reason, full_errmsg);
 	} else {
 		purple_notify_error(session->account, _("MySpaceIM Error"), full_errmsg, NULL);
 	}
@@ -2044,7 +2044,7 @@ msim_add_buddy(PurpleConnection *gc, Pur
 	MsimMessage *msg_persist;
 	MsimMessage *body;
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", 
 			buddy->name, (group && group->name) ? group->name : "(no group)");
 
@@ -2307,7 +2307,7 @@ msim_remove_buddy(PurpleConnection *gc, 
 	MsimMessage *blocklist_msg;
 	GList *blocklist_updates;
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	delbuddy_msg = msim_msg_new(
 				"delbuddy", MSIM_TYPE_BOOLEAN, TRUE,
@@ -2464,7 +2464,7 @@ msim_input_cb(gpointer gc_uncasted, gint
 
 	gc = (PurpleConnection *)(gc_uncasted);
 	account = purple_connection_get_account(gc);
-	session = gc->proto_data;
+	session = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* libpurple/eventloop.h only defines these two */
 	if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) {
@@ -2635,7 +2635,7 @@ msim_connect_cb(gpointer data, gint sour
 	g_return_if_fail(data != NULL);
 
 	gc = (PurpleConnection *)data;
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	if (source < 0) {
 		purple_connection_error_reason (gc,
@@ -2648,7 +2648,7 @@ msim_connect_cb(gpointer data, gint sour
 
 	session->fd = source; 
 
-	gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, msim_input_cb, gc);
+	g_object_set(G_OBJECT(gc),"inpa",purple_input_add(source, PURPLE_INPUT_READ, msim_input_cb, gc),NULL);
 }
 
 			 
@@ -2666,18 +2666,18 @@ msim_close(PurpleConnection *gc)
 		return;
 	}
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	if (session == NULL)
 		return;
 
-	gc->proto_data = NULL;
+	purple_object_set_protocol_data(PURPLE_OBJECT(gc),NULL);
 
 	if (!MSIM_SESSION_VALID(session)) {
 		return;
 	}
 
-	if (purple_account_get_connection(session)->inpa) {
-		purple_input_remove(purple_account_get_connection(session)->inpa);
+	if (purple_object_get_int(PURPLE_OBJECT(session->gc),"inpa")) {
+		purple_input_remove(purple_object_get_int(PURPLE_OBJECT(session->gc),"inpa"));
 	}
 
 	msim_session_destroy(session);
@@ -2703,7 +2703,7 @@ msim_status_text(PurpleBuddy *buddy)
 
 	user = msim_get_user_from_buddy(buddy);
 
-	session = (MsimSession *)purple_account_get_connection(buddy->account)->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(buddy->account)));
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), NULL);
 
 	display_name = headline = NULL;
@@ -2752,7 +2752,7 @@ msim_tooltip_text(PurpleBuddy *buddy, Pu
 	if (PURPLE_BUDDY_IS_ONLINE(buddy)) {
 		MsimSession *session;
 
-		session = (MsimSession *)purple_account_get_connection(buddy->account)->proto_data;
+		session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(buddy->account)));
 
 		g_return_if_fail(MSIM_SESSION_VALID(session));
 
@@ -2994,7 +2994,7 @@ static void msim_import_friends(PurplePl
 	gchar *group_name;
 
 	gc = (PurpleConnection *)action->context;
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	group_name = "MySpace Friends";
 
@@ -3339,7 +3339,7 @@ msim_uri_handler(const gchar *proto, con
 		return FALSE;
 	}
 
-	session = (MsimSession *)purple_account_get_connection(account)->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(account)));
 	g_return_val_if_fail(session != NULL, FALSE);
 
 	/* Lookup userid to username. TODO: push this down, to IM sending/contact 
@@ -3361,7 +3361,7 @@ msim_uri_handler(const gchar *proto, con
 	return FALSE;
 }
 
-/* TODO: move purple_account_get_username(uid) resolving to IM sending and buddy adding functions,
+/* TODO: move uid->username resolving to IM sending and buddy adding functions,
  * so that user can manually add or IM by userid and username automatically
  * looked up if possible? */
  
============================================================
--- libpurple/protocols/myspace/session.c	7e4d775c52512f0d5d08d33ccad9337116e0748d
+++ libpurple/protocols/myspace/session.c	b04c86f6f2cce01380766179288ea45db239ff24
@@ -40,10 +40,10 @@ msim_session_new(PurpleAccount *acct)
 
 	session->magic = MSIM_SESSION_STRUCT_MAGIC;
 	session->account = acct;
-	purple_account_get_connection(session) = purple_account_get_connection(acct);
+	session->gc = purple_account_get_connection(acct);
 	session->sesskey = 0;
 	session->userid = 0;
-	purple_account_get_username(session) = NULL;
+	session->username = NULL;
 	session->fd = -1;
 
 	/* TODO: Remove. */
@@ -82,7 +82,7 @@ msim_session_destroy(MsimSession *sessio
 	session->magic = -1;
 
 	g_free(session->rxbuf);
-	g_free(purple_account_get_username(session));
+	g_free(session->username);
 
 	/* TODO: Remove. */
 	g_hash_table_destroy(session->user_lookup_cb);
============================================================
--- libpurple/protocols/myspace/user.c	c53bedda9387d810a9a16df4b6e096cec46a053b
+++ libpurple/protocols/myspace/user.c	d41923f284e5060c41ff57c795ec92d384653e5a
@@ -57,16 +57,16 @@ msim_get_user_from_buddy(PurpleBuddy *bu
 		return NULL;
 	}
 
-	if (!buddy->proto_data) {
+	if (!purple_object_get_protocol_data(PURPLE_OBJECT(buddy))) {
 		/* No MsimUser for this buddy; make one. */
 
 		/* TODO: where is this freed? */
 		user = g_new0(MsimUser, 1);
 		user->buddy = buddy;
-		buddy->proto_data = (gpointer)user;
+		purple_object_set_protocol_data(PURPLE_OBJECT(buddy),(gpointer)user);
 	} 
 
-	user = (MsimUser *)(buddy->proto_data);
+	user = (MsimUser *)(purple_object_get_protocol_data(PURPLE_OBJECT(buddy)));
 
 	return user;
 }
@@ -101,8 +101,8 @@ msim_append_user_info(MsimSession *sessi
 
 	/* Useful to identify the account the tooltip refers to. 
 	 *  Other prpls show this. */
-	if (purple_account_get_username(user)) {
-		purple_notify_user_info_add_pair(user_info, _("User"), purple_account_get_username(user));
+	if (user->username) {
+		purple_notify_user_info_add_pair(user_info, _("User"), user->username);
 	}
 
 	uid = purple_blist_node_get_int(&user->buddy->node, "UserID");
@@ -595,7 +595,7 @@ static void msim_check_username_availabi
 
 	g_return_if_fail(gc != NULL);
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	g_return_if_fail(MSIM_SESSION_VALID(session));
 
@@ -634,7 +634,7 @@ static void msim_username_is_available_c
 
 	if (!body) {
 		purple_debug_info("msim_username_is_available_cb", "No body for %s?!\n", username);
-		purple_connection_error_reason(purple_account_get_connection(session), PURPLE_CONNECTION_ERROR_OTHER_ERROR, 
+		purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, 
 				"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.");
@@ -654,7 +654,7 @@ static void msim_username_is_available_c
 		purple_debug_info("msim_username_is_available_cb", "Username available. Prompting to Confirm.\n");
 		msim_username_to_set = g_strdup(username);
 		g_free(username);
-		purple_request_yes_no(purple_account_get_connection(session),
+		purple_request_yes_no(session->gc,
 			_("MySpaceIM - Username Available"),
 			_("This username is available. Would you like to set it?"),
 			_("ONCE SET, THIS CANNOT BE CHANGED!"),
@@ -662,13 +662,13 @@ static void msim_username_is_available_c
 			session->account,
 			NULL,
 			NULL,
-			purple_account_get_connection(session), 
+			session->gc, 
 			G_CALLBACK(msim_set_username_confirmed_cb), 
 			G_CALLBACK(msim_do_not_set_username_cb));
 	} else {
 		/* Looks like its in use or we have an invalid response */
 		purple_debug_info("msim_username_is_available_cb", "Username unavaiable. Prompting for new entry.\n");
-		purple_request_input(purple_account_get_connection(session), _("MySpaceIM - Please Set a Username"),
+		purple_request_input(session->gc, _("MySpaceIM - Please Set a Username"),
 			_("This username is unavailable."),
 				_("Please try another username:"),
 				"", FALSE, FALSE, NULL,
@@ -677,7 +677,7 @@ static void msim_username_is_available_c
 				session->account,
 				NULL,
 				NULL,
-				purple_account_get_connection(session));
+				session->gc);
 	}
 }
 
@@ -689,7 +689,7 @@ static void msim_set_username_confirmed_
 
 	g_return_if_fail(gc != NULL);
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	g_return_if_fail(MSIM_SESSION_VALID(session));
 
@@ -785,7 +785,7 @@ static void msim_username_is_set_cb(Msim
 	if (!body) {
 		purple_debug_info("msim_username_is_set_cb", "No body");
 		/* Error: No body! */
-		purple_connection_error_reason(purple_account_get_connection(session), PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
+		purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
 	}
 	username = msim_msg_get_string(body, "UserName");
 	code = msim_msg_get_integer(body,"Code");
@@ -803,7 +803,7 @@ static void msim_username_is_set_cb(Msim
 		purple_debug_info("msim_username_is_set_cb", "Username Set with return code %d\n",code);
 		if (code == 0) {
 			/* Good! */
-			purple_account_get_username(session) = username;
+			session->username = username;
 			msim_we_are_logged_on(session);
 		} else {
 			purple_debug_info("msim_username_is_set", "code is %d",code);
@@ -826,13 +826,13 @@ static void msim_username_is_set_cb(Msim
 					NULL)) {
 			/* Error! */
 			/* Can't set... Disconnect */
-			purple_connection_error_reason(purple_account_get_connection(session), PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
+			purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
 		}
 			
 	} else {
 		/* Error! */
 		purple_debug_info("msim","username_is_set Error: Invalid cmd/dsn/lid combination");
-		purple_connection_error_reason(purple_account_get_connection(session), PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
+		purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
 	}
 	g_free(errmsg);
 }
============================================================
--- libpurple/protocols/myspace/zap.c	d03ee171710d2880ad50e9a429b95ba3f2bf8c55
+++ libpurple/protocols/myspace/zap.c	f92e933ec1c95db10ab3d573249e90969137e2f5
@@ -109,7 +109,7 @@ msim_send_attention(PurpleConnection *gc
 	PurpleAttentionType *attn;
 	PurpleBuddy *buddy;
 
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* Look for this attention type, by the code index given. */
 	types = msim_attention_types(purple_connection_get_account(gc));
@@ -179,11 +179,11 @@ msim_send_zap_from_menu(PurpleBlistNode 
 	/* Find the session */
 	account = buddy->account;
 	gc = purple_account_get_connection(account);
-	session = (MsimSession *)gc->proto_data;
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	zap = GPOINTER_TO_INT(zap_num_ptr);
 
-	serv_send_attention(purple_account_get_connection(session), buddy->name, zap);
+	serv_send_attention(session->gc, buddy->name, zap);
 }
 
 /** Return menu, if any, for a buddy list node. */
@@ -241,7 +241,7 @@ msim_incoming_zap(MsimSession *session, 
 
 	zap = CLAMP(zap, 0, 9);
 
-	serv_got_attention(purple_account_get_connection(session), username, zap);
+	serv_got_attention(session->gc, username, zap);
 
 	g_free(msg_text);
 	g_free(username);


More information about the Commits mailing list