pidgin: 8b9e8f9e: Add invite message support to Oscar.

qulogic at pidgin.im qulogic at pidgin.im
Sun Mar 20 20:32:49 EDT 2011


----------------------------------------------------------------------
Revision: 8b9e8f9ef88d2c352fb11c6c14692022694f4bbb
Parent:   dff7d7a31ada22d83148fd4c0103ab2837f860a5
Author:   qulogic at pidgin.im
Date:     03/20/11 18:03:48
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8b9e8f9ef88d2c352fb11c6c14692022694f4bbb

Changelog: 

Add invite message support to Oscar.

Changes against parent dff7d7a31ada22d83148fd4c0103ab2837f860a5

  patched  libpurple/protocols/oscar/authorization.c
  patched  libpurple/protocols/oscar/family_feedbag.c
  patched  libpurple/protocols/oscar/libaim.c
  patched  libpurple/protocols/oscar/libicq.c
  patched  libpurple/protocols/oscar/oscar.c
  patched  libpurple/protocols/oscar/oscar.h
  patched  libpurple/protocols/oscar/oscarcommon.h

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	a2c1f4372e8d824a0c8b530a437aab438526f3a6
+++ libpurple/protocols/oscar/oscar.c	fc577a8df13369348e0d2ea675ed061453219ac7
@@ -3685,7 +3685,8 @@ void
 }
 
 void
-oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {
+oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *msg)
+{
 	OscarData *od;
 	PurpleAccount *account;
 	const char *bname, *gname;
@@ -3725,7 +3726,7 @@ oscar_add_buddy(PurpleConnection *gc, Pu
 		                                  aim_ssi_itemlist_findparentname(od->ssi.local, bname),
 		                                  bname)) {
 			/* Not authorized -- Re-request authorization */
-			oscar_auth_sendrequest(gc, bname);
+			oscar_auth_sendrequest(gc, bname, msg);
 		}
 	}
 
@@ -4175,7 +4176,7 @@ static int purple_ssi_parseack(OscarData
 
 			case 0x000e: { /* buddy requires authorization */
 				if ((retval->action == SNAC_SUBTYPE_FEEDBAG_ADD) && (retval->name))
-					oscar_auth_sendrequest(gc, retval->name);
+					oscar_auth_sendrequest(gc, retval->name, NULL);
 			} break;
 
 			default: { /* La la la */
============================================================
--- libpurple/protocols/oscar/family_feedbag.c	ae1f1a5c598f4bc3377ff17e61d18b94eb7a52cb
+++ libpurple/protocols/oscar/family_feedbag.c	79463d5f485b87238c7d5cb3028fe1371c4333af
@@ -1682,7 +1682,7 @@ static int receiveauthgrant(OscarData *o
  * granted, denied, or dropped.
  *
  */
-int aim_ssi_sendauthrequest(OscarData *od, char *bn, const char *msg)
+int aim_ssi_sendauthrequest(OscarData *od, const char *bn, const char *msg)
 {
 	FlapConnection *conn;
 	ByteStream bs;
@@ -1759,7 +1759,7 @@ static int receiveauthrequest(OscarData 
  * if reply=0x01 then grant
  *
  */
-int aim_ssi_sendauthreply(OscarData *od, char *bn, guint8 reply, const char *msg)
+int aim_ssi_sendauthreply(OscarData *od, const char *bn, guint8 reply, const char *msg)
 {
 	FlapConnection *conn;
 	ByteStream bs;
============================================================
--- libpurple/protocols/oscar/oscar.h	d6e887f2bc0553a3f5073447e4b27ec3adf887b4
+++ libpurple/protocols/oscar/oscar.h	db70f8c340e9f6c2c5dac5f91b7efe7914d4762f
@@ -912,8 +912,8 @@ struct aim_ssi_tmp
 /* 0x0007 */ int aim_ssi_enable(OscarData *od);
 /* 0x0011 */ int aim_ssi_modbegin(OscarData *od);
 /* 0x0012 */ int aim_ssi_modend(OscarData *od);
-/* 0x0018 */ int aim_ssi_sendauthrequest(OscarData *od, char *bn, const char *msg);
-/* 0x001a */ int aim_ssi_sendauthreply(OscarData *od, char *bn, guint8 reply, const char *msg);
+/* 0x0018 */ int aim_ssi_sendauthrequest(OscarData *od, const char *bn, const char *msg);
+/* 0x001a */ int aim_ssi_sendauthreply(OscarData *od, const char *bn, guint8 reply, const char *msg);
 
 /* Client functions for retrieving SSI data */
 struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid);
@@ -1311,7 +1311,7 @@ void oscar_user_info_display_aim(OscarDa
 void oscar_user_info_display_aim(OscarData *od, aim_userinfo_t *userinfo);
 
 /* authorization.c - OSCAR authorization requests */
-void oscar_auth_sendrequest(PurpleConnection *gc, const char *name);
+void oscar_auth_sendrequest(PurpleConnection *gc, const char *name, const char *msg);
 void oscar_auth_sendrequest_menu(PurpleBlistNode *node, gpointer ignored);
 void oscar_auth_recvrequest(PurpleConnection *gc, gchar *name, gchar *nick, gchar *reason);
 
============================================================
--- libpurple/protocols/oscar/libaim.c	15ed7f8ec80697be10bcf367576ca43c93a3622e
+++ libpurple/protocols/oscar/libaim.c	a64b5eca261a904a5ecc60290abcaec53a3432f3
@@ -29,7 +29,7 @@ static PurplePluginProtocolInfo prpl_inf
 
 static PurplePluginProtocolInfo prpl_info =
 {
-	OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE,
+	OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE,
 	NULL,					/* user_splits */
 	NULL,					/* protocol_options */
 	{"gif,jpeg,bmp,ico", 0, 0, 100, 100, 7168, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
@@ -50,7 +50,7 @@ static PurplePluginProtocolInfo prpl_inf
 	oscar_set_status,		/* set_status */
 	oscar_set_idle,			/* set_idle */
 	oscar_change_passwd,	/* change_passwd */
-	oscar_add_buddy,		/* add_buddy */
+	NULL,					/* add_buddy */
 	NULL,					/* add_buddies */
 	oscar_remove_buddy,		/* remove_buddy */
 	NULL,					/* remove_buddies */
@@ -101,7 +101,7 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,					/* get_moods */
 	NULL,					/* set_public_alias */
 	NULL,					/* get_public_alias */
-	NULL,					/* add_buddy_with_invite */
+	oscar_add_buddy,		/* add_buddy_with_invite */
 	NULL					/* add_buddies_with_invite */
 };
 
============================================================
--- libpurple/protocols/oscar/libicq.c	950b5cd3a60d3a73a6fb5a71f6d59998ade0a3bc
+++ libpurple/protocols/oscar/libicq.c	1cee78d9aad16734383b5c0b7511c58bd67026b5
@@ -38,7 +38,7 @@ static PurplePluginProtocolInfo prpl_inf
 
 static PurplePluginProtocolInfo prpl_info =
 {
-	OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE,
+	OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE,
 	NULL,					/* user_splits */
 	NULL,					/* protocol_options */
 	{"gif,jpeg,bmp,ico", 0, 0, 100, 100, 7168, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
@@ -59,7 +59,7 @@ static PurplePluginProtocolInfo prpl_inf
 	oscar_set_status,		/* set_status */
 	oscar_set_idle,			/* set_idle */
 	oscar_change_passwd,	/* change_passwd */
-	oscar_add_buddy,		/* add_buddy */
+	NULL,					/* add_buddy */
 	NULL,					/* add_buddies */
 	oscar_remove_buddy,		/* remove_buddy */
 	NULL,					/* remove_buddies */
@@ -111,7 +111,7 @@ static PurplePluginProtocolInfo prpl_inf
 	oscar_get_purple_moods, /* get_moods */
 	NULL,					/* set_public_alias */
 	NULL,					/* get_public_alias */
-	NULL,					/* add_buddy_with_invite */
+	oscar_add_buddy,		/* add_buddy_with_invite */
 	NULL					/* add_buddies_with_invite */
 };
 
============================================================
--- libpurple/protocols/oscar/oscarcommon.h	0423983406abfc42493e28d62e09ecf9b5168856
+++ libpurple/protocols/oscar/oscarcommon.h	eea4f893126c956696ec488da7ee2a31c1352d8c
@@ -79,7 +79,7 @@ void oscar_change_passwd(PurpleConnectio
 void oscar_set_status(PurpleAccount *account, PurpleStatus *status);
 void oscar_set_idle(PurpleConnection *gc, int time);
 void oscar_change_passwd(PurpleConnection *gc, const char *old, const char *new);
-void oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
+void oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *msg);
 void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
 void oscar_add_permit(PurpleConnection *gc, const char *who);
 void oscar_add_deny(PurpleConnection *gc, const char *who);
============================================================
--- libpurple/protocols/oscar/authorization.c	9b453d50f9c436df99b5979bf65538127ad7a61f
+++ libpurple/protocols/oscar/authorization.c	539320df357faa036601e5b1e31c2ddf63d7ef24
@@ -25,20 +25,19 @@
 #include "oscar.h"
 #include "request.h"
 
-static void
-oscar_auth_request(struct name_data *data, char *msg)
+/* When you ask other people for authorization */
+void
+oscar_auth_sendrequest(PurpleConnection *gc, const char *bname, const char *msg)
 {
-	PurpleConnection *gc;
 	OscarData *od;
 	PurpleAccount *account;
 	PurpleBuddy *buddy;
 	PurpleGroup *group;
-	const char *bname, *gname;
+	const char *gname;
 
-	gc = data->gc;
 	od = purple_connection_get_protocol_data(gc);
 	account = purple_connection_get_account(gc);
-	buddy = purple_find_buddy(account, data->name);
+	buddy = purple_find_buddy(account, bname);
 	if (buddy != NULL)
 		group = purple_buddy_get_group(buddy);
 	else
@@ -46,11 +45,10 @@ oscar_auth_request(struct name_data *dat
 
 	if (group != NULL)
 	{
-		bname = purple_buddy_get_name(buddy);
 		gname = purple_group_get_name(group);
 		purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n",
 				   bname, gname);
-		aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list."));
+		aim_ssi_sendauthrequest(od, bname, msg ? msg : _("Please authorize me so I can add you to my buddy list."));
 		if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY))
 		{
 			aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE);
@@ -66,8 +64,6 @@ oscar_auth_request(struct name_data *dat
 			}
 		}
 	}
-
-	oscar_free_name_data(data);
 }
 
 static void
@@ -105,25 +101,7 @@ oscar_auth_dontgrant_msgprompt(gpointer 
 					   data);
 }
 
-/* When you ask other people for authorization */
 void
-oscar_auth_sendrequest(PurpleConnection *gc, const char *name)
-{
-	struct name_data *data;
-
-	data = g_new0(struct name_data, 1);
-	data->gc = gc;
-	data->name = g_strdup(name);
-
-	purple_request_input(data->gc, NULL, _("Authorization Request Message:"),
-					   NULL, _("Please authorize me!"), TRUE, FALSE, NULL,
-					   _("_OK"), G_CALLBACK(oscar_auth_request),
-					   _("_Cancel"), G_CALLBACK(oscar_free_name_data),
-					   purple_connection_get_account(gc), name, NULL,
-					   data);
-}
-
-void
 oscar_auth_sendrequest_menu(PurpleBlistNode *node, gpointer ignored)
 {
 	PurpleBuddy *buddy;
@@ -133,7 +111,7 @@ oscar_auth_sendrequest_menu(PurpleBlistN
 
 	buddy = (PurpleBuddy *) node;
 	gc = purple_account_get_connection(purple_buddy_get_account(buddy));
-	oscar_auth_sendrequest(gc, purple_buddy_get_name(buddy));
+	oscar_auth_sendrequest(gc, purple_buddy_get_name(buddy), NULL);
 }
 
 /* When other people ask you for authorization */
@@ -150,4 +128,4 @@ oscar_auth_recvrequest(PurpleConnection 
 	purple_account_request_authorization(account, data->name, NULL, data->nick,
 		reason, purple_find_buddy(account, data->name) != NULL,
 		oscar_auth_grant, oscar_auth_dontgrant_msgprompt, data);
-}
\ No newline at end of file
+}


More information about the Commits mailing list