[libmsn/f14: 4/4] * Wed Nov 09 2011 John5342 <john5342 at, fedoraproject.org> 4.1-4 - Back port a patch to fix redirec

john5342 john5342 at fedoraproject.org
Wed Nov 9 01:29:42 UTC 2011


commit 9a54f7049519c0bcee1fb56578f5033b3fd4ee4d
Author: John5342 <john5342+commit at gmail.com>
Date:   Wed Nov 9 01:24:00 2011 +0000

    * Wed Nov 09 2011 John5342 <john5342 at, fedoraproject.org> 4.1-4
    - Back port a patch to fix redirects

 libmsn-4.1-redirects.patch |  572 ++++++++++++++++++++++++++++++++++++++++++++
 libmsn.spec                |   14 +-
 2 files changed, 584 insertions(+), 2 deletions(-)
---
diff --git a/libmsn-4.1-redirects.patch b/libmsn-4.1-redirects.patch
new file mode 100644
index 0000000..74382eb
--- /dev/null
+++ b/libmsn-4.1-redirects.patch
@@ -0,0 +1,572 @@
+Index: msn/soap.h
+===================================================================
+--- msn/soap.h	(revision 120)
++++ msn/soap.h	(revision 121)
+@@ -35,6 +35,8 @@
+ #include <vector>
+ #include <map>
+ 
++#include "xmlParser.h"
++
+ #include "libmsn_export.h"
+ 
+ namespace MSN
+@@ -205,6 +207,8 @@
+ 
+         void changeDisplayName(std::string newDisplayName);
+         void parseChangeDisplayNameResponse(std::string);
++    
++        Soap* manageSoapRedirect(XMLNode response1, soapAction action);
+ 
+         virtual void dispatchCommand(std::vector<std::string> &) {};
+         virtual void connect(const std::string &, unsigned int) {};
+Index: msn/soap.cpp
+===================================================================
+--- msn/soap.cpp	(revision 120)
++++ msn/soap.cpp	(revision 121)
+@@ -314,25 +314,17 @@
+ 
+     void Soap::parseGetTicketsResponse(std::string response)
+     {
+-          XMLNode domTree = XMLNode::parseString( response.c_str() );
+-        if(http_response_code == "301" )
++        XMLNode response1 = XMLNode::parseString( response.c_str() );
++        if(http_response_code == "301")
+         {
+-            const char *preferredHostName = domTree.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[AUTH] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->getTickets(this->passport, this->password, this->policy);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, AUTH);
++            soapConnection->getTickets(this->passport, this->password, this->policy);
+             return;
+         }
+ 
+           // get the header information from the DOM
+-          XMLNode tokens = domTree.getChildNode("S:Envelope").getChildNode("S:Body").getChildNode("wst:RequestSecurityTokenResponseCollection");
+-          const char *reason = domTree.getChildNode("S:Envelope").getChildNode("S:Fault").getChildNode("faultcode").getText();
++          XMLNode tokens = response1.getChildNode("S:Envelope").getChildNode("S:Body").getChildNode("wst:RequestSecurityTokenResponseCollection");
++          const char *reason = response1.getChildNode("S:Envelope").getChildNode("S:Fault").getChildNode("faultcode").getText();
+           if(reason)
+           {
+             std::string reason1(reason);
+@@ -345,7 +337,7 @@
+             }
+             if(reason1 == "psf:Redirect")
+             {
+-                const char *newurl = domTree.getChildNode("S:Envelope").getChildNode("S:Fault").getChildNode("psf:redirectUrl").getText();
++                const char *newurl = response1.getChildNode("S:Envelope").getChildNode("S:Fault").getChildNode("psf:redirectUrl").getText();
+                 Soap *soapConnection = new Soap(notificationServer);
+ 
+                 std::string newurl1(newurl);
+@@ -480,22 +472,14 @@
+     void Soap::parseEnableContactOnAddressBookResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[ENABLE_CONTACT_ON_ADDRESSBOOK] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->enableContactOnAddressBook(this->contactId, this->tempPassport, this->myDisplayName);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, ENABLE_CONTACT_ON_ADDRESSBOOK);
++            soapConnection->enableContactOnAddressBook(this->contactId, this->tempPassport, this->myDisplayName);
+             return;
+         }
+ 
+-
+         XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version");
+         const char *ver = version.getText();
+         if(ver)
+@@ -576,22 +560,14 @@
+     void Soap::parseDelContactFromAddressBookResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[DEL_CONTACT_FROM_ADDRESSBOOK] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->delContactFromAddressBook(this->contactId, this->tempPassport);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, DEL_CONTACT_FROM_ADDRESSBOOK);
++            soapConnection->delContactFromAddressBook(this->contactId, this->tempPassport);
+             return;
+         }
+ 
+-
+         XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version");
+         const char *ver = version.getText();
+         if(ver)
+@@ -683,22 +659,14 @@
+     void Soap::parseDisableContactFromAddressBookResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[DISABLE_CONTACT_ON_ADDRESSBOOK] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->disableContactFromAddressBook(this->contactId, this->tempPassport);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, DISABLE_CONTACT_ON_ADDRESSBOOK);
++            soapConnection->disableContactFromAddressBook(this->contactId, this->tempPassport);
+             return;
+         }
+ 
+-
+         XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version");
+         const char *ver = version.getText();
+         if(ver)
+@@ -797,18 +765,11 @@
+     void Soap::parseAddContactToAddressBookResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[ADD_CONTACT_TO_ADDRESSBOOK] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->addContactToAddressBook(this->tempPassport, this->tempDisplayName);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, ADD_CONTACT_TO_ADDRESSBOOK);
++            soapConnection->addContactToAddressBook(this->tempPassport, this->tempDisplayName);
+             return;
+         }
+ 
+@@ -902,22 +863,14 @@
+     void Soap::parseAddContactToGroupResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[ADD_CONTACT_TO_GROUP] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->addContactToGroup(this->groupId, this->contactId);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, ADD_CONTACT_TO_GROUP);
++            soapConnection->addContactToGroup(this->groupId, this->contactId);
+             return;
+         }
+ 
+-
+         XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version");
+         const char *ver = version.getText();
+         if(ver)
+@@ -1017,22 +970,14 @@
+     void Soap::parseAddGroupResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[ADD_GROUP] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->addGroup(this->groupName);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, ADD_GROUP);
++            soapConnection->addGroup(this->groupName);
+             return;
+         }
+ 
+-
+         XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version");
+         const char *ver = version.getText();
+         if(ver)
+@@ -1116,22 +1061,14 @@
+     void Soap::parseDelGroupResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[DEL_GROUP] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->delGroup(this->groupId);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, DEL_GROUP);
++            soapConnection->delGroup(this->groupId);
+             return;
+         }
+ 
+-
+         XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version");
+         const char *ver = version.getText();
+         if(ver)
+@@ -1220,22 +1157,14 @@
+     void Soap::parseRenameGroupResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[RENAME_GROUP] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->renameGroup(this->groupId, this->groupName);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, RENAME_GROUP);
++            soapConnection->renameGroup(this->groupId, this->groupName);
+             return;
+         }
+ 
+-
+         XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version");
+         const char *ver = version.getText();
+         if(ver)
+@@ -1323,22 +1252,14 @@
+     void Soap::parseDelContactFromGroupResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[DEL_CONTACT_FROM_GROUP] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->delContactFromGroup(this->groupId, this->contactId);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, DEL_CONTACT_FROM_GROUP);
++            soapConnection->delContactFromGroup(this->groupId, this->contactId);
+             return;
+         }
+ 
+-
+         XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version");
+         const char *ver = version.getText();
+         if(ver)
+@@ -1454,18 +1375,11 @@
+     void Soap::parseAddContactToListResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
+-        if(http_response_code == "301" )
+-        {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+ 
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[ADD_CONTACT_TO_LIST] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->addContactToList(this->tempPassport, this->tempList);
+-            }
++        if(http_response_code == "301")
++        {
++            Soap *soapConnection = manageSoapRedirect(response1, ADD_CONTACT_TO_LIST);
++            soapConnection->addContactToList(this->tempPassport, this->tempList);
+             return;
+         }
+ 
+@@ -1585,22 +1499,14 @@
+     void Soap::parseRemoveContactFromListResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
+-        if(http_response_code == "301" )
+-        {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+ 
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[DEL_CONTACT_FROM_LIST] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->removeContactFromList(this->tempPassport, this->tempList);
+-            }
++        if(http_response_code == "301")
++        {
++            Soap *soapConnection = manageSoapRedirect(response1, DEL_CONTACT_FROM_LIST);
++            soapConnection->removeContactFromList(this->tempPassport, this->tempList);
+             return;
+         }
+ 
+-
+         XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version");
+         const char *ver = version.getText();
+         if(ver)
+@@ -1709,20 +1615,11 @@
+         XMLNode response1 = XMLNode::parseString(response.c_str());
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[GET_LISTS] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->getLists(this->listInfo);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, GET_LISTS);
++            soapConnection->getLists(this->listInfo);
+             return;
+         }
+ 
+-
+         XMLNode Services = response1.getChildNode("soap:Envelope").getChildNode("soap:Body").getChildNode("FindMembershipResponse").getChildNode("FindMembershipResult").getChildNode("Services");
+ 
+         int nServices = Services.nChildNode("Service");
+@@ -1869,16 +1766,8 @@
+         XMLNode response1 = XMLNode::parseString(response.c_str());
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[GET_ADDRESS_BOOK] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->getAddressBook(this->listInfo);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, GET_ADDRESS_BOOK);
++            soapConnection->getAddressBook(this->listInfo);
+             return;
+         }
+ 
+@@ -2075,20 +1964,11 @@
+         XMLNode response1 = XMLNode::parseString(response.c_str());
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[RETRIEVE_OIM] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->getOIM(this->oim_id, this->markAsRead);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, RETRIEVE_OIM);
++            soapConnection->getOIM(this->oim_id, this->markAsRead);
+             return;
+         }
+ 
+-
+         const char* msg = response1.getChildNode("soap:Envelope").getChildNode("soap:Body").getChildNode("GetMessageResponse").getChildNode("GetMessageResult").getText();
+         if(msg)
+         {
+@@ -2160,18 +2040,11 @@
+     void Soap::parseDeleteOIMResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
++
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[DELETE_OIM] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->deleteOIM(this->oim_id);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, DELETE_OIM);
++            soapConnection->deleteOIM(this->oim_id);
+             return;
+         }
+ 
+@@ -2225,23 +2098,15 @@
+     void Soap::parseGetMailDataResponse(std::string response)
+     {
+         XMLNode response1 = XMLNode::parseString(response.c_str());
+-        if(http_response_code == "301" )
+-        {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+ 
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[RETRIEVE_OIM_MAIL_DATA] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->getMailData();
+-            }
++        if(http_response_code == "301")
++        {
++            Soap *soapConnection = manageSoapRedirect(response1, RETRIEVE_OIM_MAIL_DATA);
++            soapConnection->getMailData();
+             return;
+         }
+ 
+-
+-            // oh my god! xml text as a field of a xml node! I cant believe it!
++        // oh my god! xml text as a field of a xml node! I cant believe it!
+         std::string maildata = response1.getChildNode("soap:Envelope").getChildNode("soap:Body").getChildNode("GetMetadataResponse").getChildNode("MD").createXMLString(false);
+         if(maildata.empty())
+             return; // TODO - raise an error
+@@ -2349,18 +2214,11 @@
+         OIM oim = this->oim;
+         // probably we need to generate a new lockkey
+         XMLNode response1 = XMLNode::parseString(response.c_str());
+-        if(http_response_code == "301" )
+-        {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+ 
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[GENERATE_LOCKKEY] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->generateLockkey(this->oim);
+-            }
++        if(http_response_code == "301")
++        {
++            Soap *soapConnection = manageSoapRedirect(response1, GENERATE_LOCKKEY);
++            soapConnection->generateLockkey(this->oim);
+             return;
+         }
+ 
+@@ -2478,18 +2336,11 @@
+     {
+         OIM oim = this->oim;
+         XMLNode response1 = XMLNode::parseString(response.c_str());
+-        if(http_response_code == "301" )
+-        {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+ 
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[SEND_OIM] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->sendOIM(this->oim, this->lockkey);
+-            }
++        if(http_response_code == "301")
++        {
++            Soap *soapConnection = manageSoapRedirect(response1, SEND_OIM);
++            soapConnection->sendOIM(this->oim, this->lockkey);
+             return;
+         }
+ 
+@@ -2576,16 +2427,8 @@
+         XMLNode response1 = XMLNode::parseString(response.c_str());
+         if(http_response_code == "301" )
+         {
+-            const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
+-            if(preferredHostName)
+-            {
+-                Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
+-
+-                std::string newdomain(preferredHostName);
+-                soapConnection->actionDomains[CHANGE_DISPLAYNAME] = newdomain;
+-                soapConnection->setMBI(mbi);
+-                soapConnection->changeDisplayName(this->tempDisplayName);
+-            }
++            Soap *soapConnection = manageSoapRedirect(response1, CHANGE_DISPLAYNAME);
++            soapConnection->changeDisplayName(this->tempDisplayName);
+             return;
+         }
+ 
+@@ -2613,7 +2456,7 @@
+                 return;
+ 
+             http_header_response = this->readBuffer.substr(0,this->readBuffer.find("\r\n\r\n") + 4);
+-                Message::Headers headers = Message::Headers(http_header_response);
++            Message::Headers headers = Message::Headers(http_header_response);
+             this->response_length = decimalFromString(headers["Content-Length"]);
+ 
+             this->http_response_code = splitString(http_header_response.substr(0,http_header_response.find("\r\n"))," ")[1];
+@@ -2698,6 +2541,34 @@
+         delete this;
+     }
+ 
++    Soap* Soap::manageSoapRedirect(XMLNode response1, soapAction action)
++    {
++        Soap *soapConnection = new Soap(notificationServer, sitesToAuthList);
++        Message::Headers headers = Message::Headers(http_header_response);
++        std::string newdomain;
++        std::string location = headers["Location"];
++
++        const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText();
++        if(preferredHostName)
++        {
++            std::string newdomain(preferredHostName);
++            soapConnection->actionDomains[action] = newdomain;
++        }
++
++        if (location.size())
++        {
++            std::string newurl1(location);
++            std::vector<std::string> a = splitString(newurl1, "/");
++            std::string newdomain = splitString(a[1], "/")[0];
++            soapConnection->actionDomains[action] = newdomain;
++            std::vector<std::string> postpath = splitString(newurl1, newdomain);
++            soapConnection->actionPOSTURLs[action] = postpath[1];
++        }
++        soapConnection->setMBI(mbi);
++
++        return soapConnection;
++    }
++
+     void Soap::disconnect()
+     {
+     }
diff --git a/libmsn.spec b/libmsn.spec
index 294a585..dd94341 100644
--- a/libmsn.spec
+++ b/libmsn.spec
@@ -2,7 +2,7 @@
 Name:		libmsn
 Summary:	Library for connecting to the MSN Messenger service
 Version:	4.1
-Release:	3%{?dist}
+Release:	4%{?dist}
 
 Group:		System Environment/Libraries
 License:	GPLv2
@@ -11,9 +11,15 @@ Source0:	http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 ## upstreamable patches
-# upstream me! :) -- rex
+# Patch is already in upstream but not in an official tarball
 Patch50:	libmsn-4.0-beta7-openssl.patch
 
+# Patch is commit 121 from upstream. Fixes an issue where redirects are not dealt with correctly
+# svn co https://libmsn.svn.sourceforge.net/svnroot/libmsn libmsn
+# cd libmsn
+# svn diff -r 120:121 > libmsn-4.1-redirects.patch
+Patch51:	libmsn-4.1-redirects.patch
+
 BuildRequires:	cmake
 BuildRequires:	openssl-devel
 BuildRequires:	pkgconfig
@@ -36,6 +42,7 @@ developing applications that use %{name}.
 %prep
 %setup -q -n %{name}-%{version}
 %patch50 -p1 -b .openssl
+%patch51 -b .redirects
 
 %build
 
@@ -75,6 +82,9 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Wed Nov 09 2011 John5342 <john5342 at, fedoraproject.org> 4.1-4
+- Back port a patch to fix redirects
+
 * Fri Aug 12 2011 Rex Dieter <rdieter at fedoraproject.org> 4.1-3
 - -devel: use %%{?_isa}
 - -devel: drop hard-coded pkgconfig dep, should be automatic now


More information about the scm-commits mailing list