pidgin: c2a52000: Grab the "Who can contact me? Only peopl...

markdoliner at pidgin.im markdoliner at pidgin.im
Tue Dec 16 19:00:56 EST 2008


-----------------------------------------------------------------
Revision: c2a520001286f0c95c761be82c041c4379ddf407
Ancestor: 9ac3d7a6ac1b7f15806fd567aa6465b838f7764a
Author: markdoliner at pidgin.im
Date: 2008-12-16T23:39:03
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c2a520001286f0c95c761be82c041c4379ddf407

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

ChangeLog: 

Grab the "Who can contact me? Only people on my buddy list?" and the
"Who can see when I'm online? Only people on my buddy list?" settings
from the server and activate your privacy setting so that the values
that you've set using the official myspace IM client will also apply
when you're logged in with Pidgin.

I really don't think this should be necessary at a protocol level.
It's just stupid.  Why wouldn't the server do this for us?

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/session.h	90f5aa2a3960e80a42bb33540bb6e23ad465288e
+++ libpurple/protocols/myspace/session.h	d23dd8e17700769dbd0ab2617783f5da4ec36f50
@@ -34,6 +34,9 @@ typedef struct _MsimSession
 	guint sesskey;                      /**< Session key from server */
 	guint userid;                       /**< This user's numeric user ID */
 	gchar *username;                    /**< This user's unique username */
+	gboolean show_only_to_list;
+	int privacy_mode;
+	int offline_message_mode;
 	gint fd;                            /**< File descriptor to/from server */
 
 	/* TODO: Remove. */
============================================================
--- libpurple/protocols/myspace/user.c	7bd8a13f50c595caf7b9f64a89090eb1a4934aa9
+++ libpurple/protocols/myspace/user.c	d727854b808f4742ad84834b9d82344858467a76
@@ -401,6 +401,39 @@ msim_store_user_info(MsimSession *sessio
 		return FALSE;
 	}
 
+	if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN &&
+		msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) {
+		/*
+		 * Some of this info will be available on the buddy list if the
+		 * has themselves as their own buddy.
+		 *
+		 * Much of the info is already available in MsimSession,
+		 * stored in msim_we_are_logged_on().
+		 */
+		gchar *tmpstr;
+
+		tmpstr = msim_msg_get_string(body, "ShowOnlyToList");
+		if (tmpstr != NULL) {
+			session->show_only_to_list = g_str_equal(tmpstr, "True");
+			g_free(tmpstr);
+		}
+
+		session->privacy_mode = msim_msg_get_integer(body, "PrivacyMode");
+		session->offline_message_mode = msim_msg_get_integer(body, "OfflineMessageMode");
+
+		msim_send(session,
+				"blocklist", MSIM_TYPE_BOOLEAN, TRUE,
+				"sesskey", MSIM_TYPE_INTEGER, session->sesskey,
+				"idlist", MSIM_TYPE_STRING,
+						g_strdup_printf("w%d|c%d",
+								session->show_only_to_list ? 1 : 0,
+								session->privacy_mode),
+				NULL);
+	} else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN &&
+			msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) {
+		/* TODO: same as above, but for MySpace info. */
+	}
+
 	username = msim_msg_get_string(body, "UserName");
 
 	if (!username) {
@@ -437,19 +470,6 @@ msim_store_user_info(MsimSession *sessio
 		msim_store_user_info_each(key_str, value_str, user);
 	}
 
-	if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN &&
-		msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) {
-		/* TODO: do something with our own IM info, if we need it for some
-		 * specific purpose. Otherwise it is available on the buddy list,
-		 * if the user has themselves as their own buddy.
-		 *
-		 * However, much of the info is already available in MsimSession,
-		 * stored in msim_we_are_logged_on(). */
-	} else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN &&
-			msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) {
-		/* TODO: same as above, but for MySpace info. */
-	}
-
 	msim_msg_free(body);
 	g_free(username);
 


More information about the Commits mailing list