changeset 19747:1b48fbbd0e61

[gaim-migrate @ 16655] add a group add/del contact add/del/block/unblock SOAP Operation Framework Need to finish the content soon comitted by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Sun, 06 Aug 2006 17:41:51 +0000
parents d55d8050f54d
children b22d13f55232
files src/protocols/msn/contact.c src/protocols/msn/contact.h src/protocols/msn/history.c
diffstat 3 files changed, 67 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/contact.c	Sun Aug 06 16:20:39 2006 +0000
+++ b/src/protocols/msn/contact.c	Sun Aug 06 17:41:51 2006 +0000
@@ -410,7 +410,7 @@
 {
 	gaim_debug_info("MaYuan","msn_get_address_book()...\n");
 	/*build SOAP and POST it*/
-	contact->soapconn->login_path = g_strdup(MSN_GET_ADDRESS_POST_URL);
+	contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL);
 	contact->soapconn->soap_action = g_strdup(MSN_GET_ADDRESS_SOAP_ACTION);
 	msn_soap_post(contact->soapconn,MSN_GET_ADDRESS_TEMPLATE,msn_address_written_cb);
 }
@@ -420,6 +420,12 @@
 msn_add_contact(MsnContact *contact)
 {
 	gaim_debug_info("MaYuan","msn add a contact...\n");
+
+	/*build SOAP and POST it*/
+	contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL);
+	contact->soapconn->soap_action = g_strdup(MSN_CONTACT_ADD_SOAP_ACTION);
+	msn_soap_post(contact->soapconn,MSN_GET_ADDRESS_TEMPLATE,msn_address_written_cb);
+
 }
 
 /*delete a Contact*/
@@ -427,6 +433,10 @@
 msn_delete_contact(MsnContact *contact)
 {	
 	gaim_debug_info("MaYuan","msn delete a contact...\n");
+	/*build SOAP and POST it*/
+	contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL);
+	contact->soapconn->soap_action = g_strdup(MSN_GET_GLEAMS_SOAP_ACTION);
+	msn_soap_post(contact->soapconn,MSN_GLEAMS_TEMPLATE,msn_address_written_cb);
 }
 
 /*block a Contact*/
@@ -434,6 +444,10 @@
 msn_block_contact(MsnContact *contact)
 {	
 	gaim_debug_info("MaYuan","msn block a contact...\n");
+	/*build SOAP and POST it*/
+	contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL);
+	contact->soapconn->soap_action = g_strdup(MSN_GET_GLEAMS_SOAP_ACTION);
+	msn_soap_post(contact->soapconn,MSN_GLEAMS_TEMPLATE,msn_address_written_cb);
 }
 
 /*unblock a contact*/
@@ -441,6 +455,10 @@
 msn_unblock_contact(MsnContact *contact)
 {	
 	gaim_debug_info("MaYuan","msn unblock a contact...\n");
+	/*build SOAP and POST it*/
+	contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL);
+	contact->soapconn->soap_action = g_strdup(MSN_GET_GLEAMS_SOAP_ACTION);
+	msn_soap_post(contact->soapconn,MSN_GLEAMS_TEMPLATE,msn_address_written_cb);
 }
 
 /*get the gleams info*/
@@ -449,11 +467,33 @@
 {
 	gaim_debug_info("MaYuan","msn get gleams info...\n");
 	/*build SOAP and POST it*/
-	contact->soapconn->login_path = g_strdup(MSN_GET_ADDRESS_POST_URL);
-	contact->soapconn->soap_action = g_strdup(MSN_GET_ADDRESS_SOAP_ACTION);
+	contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL);
+	contact->soapconn->soap_action = g_strdup(MSN_GET_GLEAMS_SOAP_ACTION);
 	msn_soap_post(contact->soapconn,MSN_GLEAMS_TEMPLATE,msn_address_written_cb);
 }
 
+void msn_add_group(MsnContact *contact)
+{
+	gaim_debug_info("MaYuan","msn add group...\n");
+
+	/*build SOAP and POST it*/
+	contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL);
+	contact->soapconn->soap_action = g_strdup(MSN_GROUP_ADD_SOAP_ACTION);
+	msn_soap_post(contact->soapconn,MSN_GROUP_ADD_TEMPLATE,msn_address_written_cb);
+
+}
+
+void msn_del_group(MsnContact *contact)
+{
+	gaim_debug_info("MaYuan","msn del group...\n");
+
+	/*build SOAP and POST it*/
+	contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL);
+	contact->soapconn->soap_action = g_strdup(MSN_GROUP_DEL_SOAP_ACTION);
+	msn_soap_post(contact->soapconn,MSN_GROUP_DEL_TEMPLATE,msn_address_written_cb);
+
+}
+
 void
 msn_contact_connect(MsnContact *contact)
 {
--- a/src/protocols/msn/contact.h	Sun Aug 06 16:20:39 2006 +0000
+++ b/src/protocols/msn/contact.h	Sun Aug 06 17:41:51 2006 +0000
@@ -57,9 +57,12 @@
 	"</soap:Body>"\
 "</soap:Envelope>"
 
+/************************************************
+ * Address Book SOAP
+ * *********************************************/
+#define MSN_ADDRESS_BOOK_POST_URL	"/abservice/abservice.asmx"
 /*get addressbook soap request template*/
 #define MSN_GET_ADDRESS_SOAP_ACTION	"http://www.msn.com/webservices/AddressBook/ABFindAll"
-#define MSN_GET_ADDRESS_POST_URL	"/abservice/abservice.asmx"
 #define MSN_GET_ADDRESS_TEMPLATE	"<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
 "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\
 	"<soap:Header>"\
@@ -81,6 +84,7 @@
 "</soap:Envelope>"
 
 /*Gleams SOAP request template*/
+#define MSN_GET_GLEAMS_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll"
 #define MSN_GLEAMS_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
 "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\
 	"<soap:Header>"\
@@ -103,6 +107,9 @@
 	"</soap:Body>"\
 "</soap:Envelope>"
 
+/*******************************************************
+ * Contact Add/del SOAP Action
+ *******************************************************/
 /*add conatct soap request*/
 #define MSN_CONTACT_ADD_SOAP_ACTION	"http://www.msn.com/webservices/AddressBook/ABContactAdd"
 #define MSN_CONTACT_XML	"<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\"><contactInfo><contactType>LivePending</contactType><passportName>%s</passportName><isMessengerUser>true</isMessengerUser></contactInfo></Contact>"
@@ -116,7 +123,11 @@
 
 #define MSN_MEMBER_TEMPLATE		"<Member xsi:type=\"PassportMember\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><Type>Passport</Type><State>Accepted</State><PassportName>%s</PassportName></Member>"
 
+/*******************************************************
+ * Contact Block/Unblock SOAP Action
+ *******************************************************/
 /*block means add contact to block list*/
+#define MSN_SHARE_POST_URL		"/abservice/SharingService.asmx"
 #define MSN_CONTACT_BLOCK_SOAP_ACTION	"http://www.msn.com/webservices/AddressBook/AddMember"
 #define MSN_BLOCK_CONTACT_TEMPLATE	"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"><soap:Header><ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ApplicationId>09607671-1C32-421F-A6A6-CBFAA51AB5F4</ApplicationId><IsMigration>false</IsMigration><PartnerScenario>BlockUnblock</PartnerScenario></ABApplicationHeader><ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ManagedGroupRequest>false</ManagedGroupRequest></ABAuthHeader></soap:Header><soap:Body><AddMember xmlns=\"http://www.msn.com/webservices/AddressBook\"><serviceHandle><Id>0</Id><Type>Messenger</Type><ForeignId></ForeignId></serviceHandle><memberships><Membership><MemberRole>Block</MemberRole><Members>%s</Members></Membership></memberships></AddMember></soap:Body></soap:Envelope>"
 
@@ -124,6 +135,17 @@
 #define MSN_CONTACT_UNBLOCK_SOAP_ACTION	"http://www.msn.com/webservices/AddressBook/DeleteMember"
 #define MSN_UNBLOCK_CONTACT_TEMPLATE	"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"><soap:Header><ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ApplicationId>09607671-1C32-421F-A6A6-CBFAA51AB5F4</ApplicationId><IsMigration>false</IsMigration><PartnerScenario>BlockUnblock</PartnerScenario></ABApplicationHeader><ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ManagedGroupRequest>false</ManagedGroupRequest></ABAuthHeader></soap:Header><soap:Body><DeleteMember xmlns=\"http://www.msn.com/webservices/AddressBook\"><serviceHandle><Id>0</Id><Type>Messenger</Type><ForeignId></ForeignId></serviceHandle><memberships><Membership><MemberRole>Block</MemberRole><Members>%s</Members></Membership></memberships></DeleteMember></soap:Body></soap:Envelope>"
 
+/*******************************************************
+ * Group SOAP Action
+ *******************************************************/
+/*add a group*/
+#define MSN_GROUP_ADD_SOAP_ACTION	"http://www.msn.com/webservices/AddressBook/ABGroupAdd"
+#define MSN_GROUP_ADD_TEMPLATE	"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"><soap:Header><ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ApplicationId>09607671-1C32-421F-A6A6-CBFAA51AB5F4</ApplicationId><IsMigration>false</IsMigration><PartnerScenario>GroupSave</PartnerScenario></ABApplicationHeader><ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ManagedGroupRequest>false</ManagedGroupRequest></ABAuthHeader></soap:Header><soap:Body><ABGroupAdd xmlns=\"http://www.msn.com/webservices/AddressBook\"><abId>00000000-0000-0000-0000-000000000000</abId><groupAddOptions><fRenameOnMsgrConflict>false</fRenameOnMsgrConflict></groupAddOptions><groupInfo><GroupInfo><name>%s</name><groupType>C8529CE2-6EAD-434d-881F-341E17DB3FF8</groupType><fMessenger>false</fMessenger><annotations><Annotation><Name>MSN.IM.Display</Name><Value>1</Value></Annotation></annotations></GroupInfo></groupInfo></ABGroupAdd></soap:Body></soap:Envelope>"
+
+/*delete a group*/
+#define MSN_GROUP_DEL_SOAP_ACTION	"http://www.msn.com/webservices/AddressBook/ABGroupDelete"
+#define MSN_GROUP_DEL_TEMPLATE	"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"><soap:Header><ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ApplicationId>09607671-1C32-421F-A6A6-CBFAA51AB5F4</ApplicationId><IsMigration>false</IsMigration><PartnerScenario>Timer</PartnerScenario></ABApplicationHeader><ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ManagedGroupRequest>false</ManagedGroupRequest></ABAuthHeader></soap:Header><soap:Body><ABGroupDelete xmlns=\"http://www.msn.com/webservices/AddressBook\"><abId>00000000-0000-0000-0000-000000000000</abId><groupFilter><groupIds><guid>%s</guid></groupIds></groupFilter></ABGroupDelete></soap:Body></soap:Envelope>"
+
 typedef struct _MsnContact MsnContact;
 
 struct _MsnContact
--- a/src/protocols/msn/history.c	Sun Aug 06 16:20:39 2006 +0000
+++ b/src/protocols/msn/history.c	Sun Aug 06 17:41:51 2006 +0000
@@ -84,3 +84,4 @@
 		msn_transaction_destroy(trans);
 	}
 }
+