cpw.rekkanoryo.icqxstatus: 0a622e14: Made it compile again.

malu at pidgin.im malu at pidgin.im
Sun Feb 7 16:16:05 EST 2010


-----------------------------------------------------------------
Revision: 0a622e149aa0d0a9ce389c921370e59672649862
Ancestor: 4da8a734fcdde89058156f06d62cc2c0ac9ee875
Author: malu at pidgin.im
Date: 2010-02-07T21:11:56
Branch: im.pidgin.cpw.rekkanoryo.icqxstatus
URL: http://d.pidgin.im/viewmtn/revision/info/0a622e149aa0d0a9ce389c921370e59672649862

Modified files:
        libpurple/protocols/gg/gg.c
        libpurple/protocols/jabber/libxmpp.c
        libpurple/protocols/oscar/family_buddy.c
        libpurple/protocols/oscar/family_icbm.c
        libpurple/protocols/oscar/family_locate.c
        libpurple/protocols/oscar/libicq.c
        libpurple/protocols/oscar/oscar.c
        libpurple/protocols/oscar/oscar.h libpurple/request.h
        pidgin/gtkblist.c

ChangeLog: 

Made it compile again.
Changed aim_info.flag to guint64, to avoid loss of precition, I hope this
won't break it...
Re-introduced a couple of UI callbacks lost in earlier merges

-------------- next part --------------
============================================================
--- libpurple/protocols/gg/gg.c	c82da15b84a5ac4ae87b78730b343504530515b2
+++ libpurple/protocols/gg/gg.c	ff57e3337726509ecbe7edb0fd1fe4cbd0b78b7c
@@ -2465,7 +2465,8 @@ static PurplePluginProtocolInfo prpl_inf
 	sizeof(PurplePluginProtocolInfo),       /* struct_size */
 	NULL,                           /* get_account_text_table */
 	NULL,                           /* initiate_media */
-	NULL                            /* can_do_media */
+	NULL,                            /* can_do_media */
+	NULL 				/* get_moods */
 };
 
 static PurplePluginInfo info = {
============================================================
--- libpurple/protocols/jabber/libxmpp.c	6d1839e61483597c793d12d0efce7ad1c7fe7ae1
+++ libpurple/protocols/jabber/libxmpp.c	3ad955d9fda8d453caac327f3e52d7a8f6dd9e31
@@ -126,6 +126,7 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL, /* get_account_text_table */
 	jabber_initiate_media,          /* initiate_media */
 	jabber_get_media_caps,                  /* get_media_caps */
+	NULL  							/* get_moods */
 };
 
 static gboolean load_plugin(PurplePlugin *plugin)
============================================================
--- libpurple/protocols/oscar/family_buddy.c	81a5bc35428a8500ccdbafb43f3cf15ca6f947e8
+++ libpurple/protocols/oscar/family_buddy.c	c88ada98b296b946a2f9153a857ca8cbf8df7516
@@ -224,13 +224,13 @@ buddychange(OscarData *od, FlapConnectio
 	if (snac->subtype == SNAC_SUBTYPE_BUDDY_ONCOMING &&
 	    userinfo.capabilities & OSCAR_CAPABILITY_XTRAZ) {
 		PurpleAccount *account = purple_connection_get_account(od->gc);
-		PurpleBuddy *buddy = purple_find_buddy(account, userinfo.sn);
+		PurpleBuddy *buddy = purple_find_buddy(account, userinfo.bn);
 
 		if (buddy) {
 			PurplePresence *presence = purple_buddy_get_presence(buddy);
 
 			if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOOD))
-				icq_im_xstatus_request(od, userinfo.sn);
+				icq_im_xstatus_request(od, userinfo.bn);
 		}
 	}
 	aim_info_free(&userinfo);
============================================================
--- libpurple/protocols/oscar/family_icbm.c	a6f4a409e25a5989363a7c697f2cb8acf8fe35f8
+++ libpurple/protocols/oscar/family_icbm.c	63cf3ce56103c92c60734f538fcc8fd768ec13c1
@@ -2675,10 +2675,10 @@ static int clientautoresp(OscarData *od,
 					}
  					purple_debug_misc("oscar", "X-Status reply: %s\n", (const char*)xml);
  					account = purple_connection_get_account(od->gc);
- 					buddy = purple_find_buddy(account, sn);
+ 					buddy = purple_find_buddy(account, bn);
  					presence = purple_buddy_get_presence(buddy);
  					status = purple_presence_get_active_status(presence);
- 					purple_prpl_got_user_status(account, sn,
+ 					purple_prpl_got_user_status(account, bn,
   					    purple_status_get_id(status), "message", xml, NULL);
 		   		} else {
 			 		purple_debug_misc("oscar", "X-Status: Can't get XML reply string\n");
============================================================
--- libpurple/protocols/oscar/family_locate.c	348be7635bb41005a6c8b21002afccca15dbdac2
+++ libpurple/protocols/oscar/family_locate.c	f11785242ac64392ff13f81c7e20a6bbcca42daa
@@ -45,7 +45,7 @@ static const struct {
  * But, eh.
  */
 static const struct {
-	guint32 flag;
+	guint64 flag;
 	guint8 data[16];
 } aim_caps[] = {
 
@@ -928,11 +928,11 @@ aim_info_extract(OscarData *od, ByteStre
 
 			mood = aim_receive_custom_icon(od, bs, length);
 			if (mood)
-				purple_prpl_got_user_status(account, outinfo->sn, "mood",
+				purple_prpl_got_user_status(account, outinfo->bn, "mood",
 						PURPLE_MOOD_NAME, mood,
 						NULL);
 			else
-				purple_prpl_got_user_status_deactive(account, outinfo->sn, "mood");
+				purple_prpl_got_user_status_deactive(account, outinfo->bn, "mood");
 
 		} else if (type == 0x000e) {
 			/*
@@ -1093,11 +1093,11 @@ aim_info_extract(OscarData *od, ByteStre
 						g_free(icqmood);
 
 						if (mood)
-							purple_prpl_got_user_status(account, outinfo->sn, "mood",
+							purple_prpl_got_user_status(account, outinfo->bn, "mood",
 									PURPLE_MOOD_NAME, mood,
 									NULL);
 						else
-							purple_prpl_got_user_status_deactive(account, outinfo->sn, "mood");
+							purple_prpl_got_user_status_deactive(account, outinfo->bn, "mood");
 					} break;
 				}
 
@@ -1507,11 +1507,11 @@ userinfo(OscarData *od, FlapConnection *
 
 		mood = aim_receive_custom_icon(od, &cbs, tlv->length);
 		if (mood)
-			purple_prpl_got_user_status(account, userinfo->sn, "mood",
+			purple_prpl_got_user_status(account, userinfo->bn, "mood",
 					PURPLE_MOOD_NAME, mood,
 					NULL);
 		else
-			purple_prpl_got_user_status_deactive(account, userinfo->sn, "mood");
+			purple_prpl_got_user_status_deactive(account, userinfo->bn, "mood");
 	}
 	aim_tlvlist_free(tlvlist);
 
============================================================
--- libpurple/protocols/oscar/libicq.c	57e67846a67422e81d4ac6d9c61783d041f5430e
+++ libpurple/protocols/oscar/libicq.c	67eca9fcfecbf6204cc3e04bb5ad7fd69578da31
@@ -108,7 +108,7 @@ static PurplePluginProtocolInfo prpl_inf
 	sizeof(PurplePluginProtocolInfo),       /* struct_size */
 	icq_get_account_text_table, /* get_account_text_table */
 	NULL,					/* initiate_media */
-	NULL					/* can_do_media */
+	NULL,					/* can_do_media */
 	oscar_get_purple_moods, /* get_moods */
 };
 
============================================================
--- libpurple/protocols/oscar/oscar.c	a840e72932cc86666df5a4a32eee544e59ba69c8
+++ libpurple/protocols/oscar/oscar.c	914148e71ed2164626cee69852b9c5a9e1ffc183
@@ -232,7 +232,6 @@ static void oscar_set_extendedstatus(Pur
 void oscar_set_info(PurpleConnection *gc, const char *info);
 static void oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, PurpleStatus *status);
 static void oscar_set_extendedstatus(PurpleConnection *gc);
-static void oscar_format_username(PurpleConnection *gc, const char *nick);
 static gboolean purple_ssi_rerequestdata(gpointer data);
 
 static void oscar_free_name_data(struct name_data *data) {
@@ -680,7 +679,7 @@ static gchar *oscar_caps_to_string(Oscar
 {
 	GString *str;
 	const gchar *tmp;
-	guint bit = 1;
+	guint64 bit = 1;
 
 	str = g_string_new("");
 
@@ -801,7 +800,7 @@ static char *oscar_icqstatus(int state) 
 	else if (state & AIM_ICQ_STATE_DEPRESSION)
 		return g_strdup(_("Depression"));
 	else if (state & AIM_ICQ_STATE_ATHOME)
-		return g_strdup_(_("At home"));
+		return g_strdup(_("At home"));
 	else if (state & AIM_ICQ_STATE_ATWORK)
 		return g_strdup(_("At work"));
 	else if (state & AIM_ICQ_STATE_LUNCH)
@@ -2730,18 +2729,18 @@ incomingim_chan2(OscarData *od, FlapConn
 		purple_debug_info("oscar", "Sending X-Status Reply\n");
 
 		if(args->info.rtfmsg.msgtype == 26)
-			icq_relay_xstatus(od, userinfo->sn, args->cookie);
+			icq_relay_xstatus(od, userinfo->bn, args->cookie);
 		
 		if(args->info.rtfmsg.msgtype == 1)
 		{
 			if(rtfmsg)
 			{
-				serv_got_im(gc, userinfo->sn, rtfmsg, flags,
+				serv_got_im(gc, userinfo->bn, rtfmsg, flags,
 				            time(NULL));
 			}
 			else
 			{
-				serv_got_im(gc, userinfo->sn,
+				serv_got_im(gc, userinfo->bn,
 				            args->info.rtfmsg.rtfmsg, flags,
 				            time(NULL));
 			}
@@ -5164,10 +5163,12 @@ oscar_set_status(PurpleAccount *account,
 	if (!purple_account_is_connected(account))
 		return;
 
+	pc = purple_account_get_connection(account);
+	od = purple_connection_get_protocol_data(pc);
+
 	/* There's no need to do the stuff below for mood updates. */
 	if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_MOOD) {
-		PurpleConnection *gc = purple_account_get_connection(account);
-		aim_locate_setcaps((OscarData *)gc->proto_data, purple_caps);
+		aim_locate_setcaps(od, purple_caps);
 		return;
 	}
 
@@ -6723,6 +6724,21 @@ static void oscar_get_icqxstatusmsg (Pur
 	icq_im_xstatus_request(gc->proto_data, purple_buddy_get_name(buddy));
 }
 
+static void
+oscar_get_aim_info_cb(PurpleBlistNode *node, gpointer ignore)
+{
+	PurpleBuddy *buddy;
+	PurpleConnection *gc;
+
+	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
+
+	buddy = (PurpleBuddy *)node;
+	gc = purple_account_get_connection(purple_buddy_get_account(buddy));
+
+	aim_locate_getinfoshort(purple_connection_get_protocol_data(gc),
+			purple_buddy_get_name(buddy), 0x00000003);
+}
+
 static GList *
 oscar_buddy_menu(PurpleBuddy *buddy) {
 
============================================================
--- libpurple/protocols/oscar/oscar.h	b71eb2c1b44e8edc2927a995fbd7c179515fa099
+++ libpurple/protocols/oscar/oscar.h	3d464afe8a58f6a47e8159afb553d3ea36d6f93c
@@ -379,10 +379,8 @@ typedef enum
 	OSCAR_CAPABILITY_XTRAZ                = 0x40000000,
 	OSCAR_CAPABILITY_GENERICUNKNOWN       = 0x80000000,
 #warning Fix OSCAR_CAPABILITY_LAST situation
-#if 0
 	// TODO: We're out of bits.  Rework things that depend on this or remove some capability. (Or, ensure this is a 64-bit type.)
-	OSCAR_CAPABILITY_LAST                 = 0x100000000
-#endif
+	OSCAR_CAPABILITY_LAST                 = 0x100000000	
 } OscarCapability;
 
 /*
@@ -1158,7 +1156,6 @@ int aim_putuserinfo(ByteStream *bs, aim_
 void aim_info_free(aim_userinfo_t *);
 int aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *);
 int aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info);
-#endif
 PurpleMood* icq_get_purple_moods(PurpleAccount *account);
 const char* icq_get_custom_icon_description(const char *mood);
 guint8* icq_get_custom_icon_data(const char *mood);
@@ -1491,7 +1488,7 @@ int aim_tlvlist_add_str(GSList **list, c
 int aim_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value);
 int aim_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value);
 int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value);
-int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps);
+int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps, const char *mood);
 int aim_tlvlist_add_userinfo(GSList **list, guint16 type, aim_userinfo_t *userinfo);
 int aim_tlvlist_add_chatroom(GSList **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance);
 int aim_tlvlist_add_frozentlvlist(GSList **list, guint16 type, GSList **tl);
============================================================
--- libpurple/request.h	4a258c6ef50039487cd76622a7940b78cdeea96b
+++ libpurple/request.h	02c50fabb2c640e13a3848b7a7c0e90d0886d628
@@ -948,7 +948,6 @@ void *purple_request_field_list_get_data
 void *purple_request_field_list_get_data(const PurpleRequestField *field,
 									   const char *text);
 
-#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_REQUEST_C_)
 /**
  * Adds an item to a list field.
  *
@@ -960,7 +959,6 @@ void purple_request_field_list_add(Purpl
  */
 void purple_request_field_list_add(PurpleRequestField *field,
 								 const char *item, void *data);
-#endif
 
 /**
  * Adds an item to a list field.
============================================================
--- pidgin/gtkblist.c	f0132f2bf5cd9e64c328cc55285aae636302934c
+++ pidgin/gtkblist.c	cfc3cd2416abd3034ebe72aa8d5bb310893d83cf
@@ -3830,7 +3830,7 @@ pidgin_blist_get_emblem(PurpleBlistNode 
 	PurplePluginProtocolInfo *prpl_info;
 	const char *name = NULL;
 	char *filename, *path;
-	PurplePresence *presence = NULL;
+	PurplePresence *p = NULL;
 	PurpleStatus *tune;
 
 	if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
@@ -3841,8 +3841,8 @@ pidgin_blist_get_emblem(PurpleBlistNode 
 	} else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
 		buddy = (PurpleBuddy*)node;
 		gtkbuddynode = node->ui_data;
-		presence = purple_buddy_get_presence(buddy);
-		if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE)) {
+		p = purple_buddy_get_presence(buddy);
+		if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) {
 			/* This emblem comes from the small emoticon set now,
 			 * to reduce duplication. */
 			path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes",
@@ -3868,10 +3868,10 @@ pidgin_blist_get_emblem(PurpleBlistNode 
 
 	/* If we came through the contact code flow above, we didn't need
 	 * to get the presence until now. */
-	if (presence == NULL)
-		presence = purple_buddy_get_presence(buddy);
+	if (p == NULL)
+		p = purple_buddy_get_presence(buddy);
 
-	if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE)) {
+	if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) {
 		/* This emblem comes from the small emoticon set now, to reduce duplication. */
 		path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", "small", "mobile.png", NULL);
 		return _pidgin_blist_get_cached_emblem(path);
@@ -3908,10 +3908,10 @@ pidgin_blist_get_emblem(PurpleBlistNode 
 	if (name == NULL) {
 		PurpleStatus *status;
 
-		if (!purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOOD))
+		if (!purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOOD))
 			return NULL;
 
-		status = purple_presence_get_status(presence, "mood");
+		status = purple_presence_get_status(p, "mood");
 		name = purple_status_get_attr_string(status, PURPLE_MOOD_NAME);
 		
 		if (!(name && *name))
@@ -7949,6 +7949,88 @@ disable_account_cb(GtkCheckMenuItem *wid
 	purple_account_set_enabled(account, PIDGIN_UI, FALSE);
 }
 
+static void
+edit_mood_cb(PurpleConnection *gc, PurpleRequestFields *fields)
+{
+	PurpleRequestField *f;
+	GList *l;
+
+	f = purple_request_fields_get_field(fields, "mood");
+	l = purple_request_field_list_get_selected(f);
+
+	if (l) {
+		const char *mood = purple_request_field_list_get_data(f, l->data);
+		PurpleAccount *account = purple_connection_get_account(gc);
+
+		if (mood != NULL) {
+			purple_account_set_status(account, "mood", TRUE,
+			                          PURPLE_MOOD_NAME, mood,
+			                          NULL);
+		} else {
+			purple_account_set_status(account, "mood", FALSE, NULL);
+		}
+	}
+}
+
+static void
+set_mood_cb(GtkWidget *widget, PurpleAccount *account)
+{
+	PurplePresence *presence = purple_account_get_presence(account);
+	PurpleStatus *status = purple_presence_get_status(presence, "mood");
+	const char *current_mood;
+	PurpleRequestFields *fields;
+	PurpleRequestFieldGroup *g;
+	PurpleRequestField *f;
+	char* na_fn;
+	PurpleConnection *gc = purple_account_get_connection(account);
+	PurplePluginProtocolInfo *prpl_info;
+	PurpleMood *mood;
+
+	g_return_if_fail(gc->prpl != NULL);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+
+	current_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME);
+
+	fields = purple_request_fields_new();
+	g = purple_request_field_group_new(NULL);
+	f = purple_request_field_list_new("mood", _("Please select your mood from the list"));
+
+	na_fn = g_build_filename("pixmaps", "pidgin", "emblems", "16", "not-authorized.png", NULL);
+
+	purple_request_field_list_add_icon(f, _("None"), na_fn, NULL);
+	if (current_mood == NULL)
+		purple_request_field_list_add_selected(f, _("None"));
+
+	g_free(na_fn);
+
+	/* TODO: rlaager wants this sorted. */
+	for (mood = prpl_info->get_moods(account);
+	     mood->mood != NULL ; mood++) {
+		char *path;
+
+		if (mood->mood == NULL || mood->description == NULL)
+			continue;
+
+		path = get_mood_icon_path(mood->mood);
+		purple_request_field_list_add_icon(f, _(mood->description),
+				path, (gpointer)mood->mood);
+		g_free(path);
+
+		if (current_mood && !strcmp(current_mood, mood->mood))
+			purple_request_field_list_add_selected(f, _(mood->description));
+	}
+	purple_request_field_group_add_field(g, f);
+
+	purple_request_fields_add_group(fields, g);
+
+	purple_request_fields(gc, _("Edit User Mood"), _("Edit User Mood"),
+                              NULL, fields,
+                              _("OK"), G_CALLBACK(edit_mood_cb),
+                              _("Cancel"), NULL,
+                              purple_connection_get_account(gc),
+                              NULL, NULL, gc);
+}
+
 void
 pidgin_blist_update_accounts_menu(void)
 {
@@ -8028,7 +8110,7 @@ pidgin_blist_update_accounts_menu(void)
 		PurpleAccount *account = NULL;
 		GdkPixbuf *pixbuf = NULL;
 		PurplePlugin *plugin = NULL;
-		PurplePluginProtocolInfo *prpl_info
+		PurplePluginProtocolInfo *prpl_info;
 
 		account = accounts->data;
 


More information about the Commits mailing list