diff --git a/sflphone-common/src/sip/im/InstantMessaging.cpp b/sflphone-common/src/sip/im/InstantMessaging.cpp index c88c1667577a184e365031343c6fd117666782d7..34de71fe5b289824b5b8d1f37441d0ea6a7f937c 100644 --- a/sflphone-common/src/sip/im/InstantMessaging.cpp +++ b/sflphone-common/src/sip/im/InstantMessaging.cpp @@ -325,7 +325,7 @@ std::string InstantMessaging::findTextUriList (std::string& text) throw InstantMessageException ("Could not find Content-Disposition tag while parsing sip message for recipient-list"); // xml content start after content disposition tag (plus \n\n) - begin = pos+cdispo.size() +2; + begin = pos+cdispo.size(); // find final boundary if ( (end = text.find (boundary, begin)) == std::string::npos) @@ -348,13 +348,13 @@ std::string InstantMessaging::findTextMessage (std::string& text) throw InstantMessageException ("Could not find Content-Type tag while parsing sip message for text"); // plain text content start after content type tag (plus \n\n) - begin = pos+ctype.size() +2; + begin = pos+ctype.size(); // retrive end of the text content if ( (end = text.find (boundary, begin)) == std::string::npos) throw InstantMessageException ("Could not find end of text \"boundary\" while parsing sip message for text"); - return text.substr (begin, end-begin-1); + return text.substr (begin, end-begin); } diff --git a/sflphone-common/src/sip/im/InstantMessaging.h b/sflphone-common/src/sip/im/InstantMessaging.h index 8924c9d436a876d0e55177f7ca2ef9019c71f18c..576b3d781be1403c28380b2c2a16b9b662f97429 100644 --- a/sflphone-common/src/sip/im/InstantMessaging.h +++ b/sflphone-common/src/sip/im/InstantMessaging.h @@ -40,7 +40,7 @@ class InstantMessageException : public std::exception virtual ~InstantMessageException() throw() {} virtual const char *what() const throw() { - std::string expt ("YamlParserException occured: "); + std::string expt ("InstantMessageException occured: "); expt.append (errstr); return expt.c_str(); diff --git a/sflphone-common/test/instantmessagingtest.cpp b/sflphone-common/test/instantmessagingtest.cpp index 4909e2eb14d68423da5e78e1eeed5bb0b18ecc00..f36a92136e1e781f9af3538b7b2c89376578b1cd 100644 --- a/sflphone-common/test/instantmessagingtest.cpp +++ b/sflphone-common/test/instantmessagingtest.cpp @@ -266,11 +266,11 @@ void InstantMessagingTest::testXmlUriListParsing () void InstantMessagingTest::testGetTextArea () { - std::string formatedText = "--boundary\n Content-Type: text/plain\n\n"; + std::string formatedText = "--boundary Content-Type: text/plain"; formatedText.append ("Here is the text area"); - formatedText.append ("\n--boundary\nContent-Type: application/resource-lists+xml\n"); - formatedText.append ("Content-Disposition: recipient-list\n\n"); + formatedText.append ("--boundary Content-Type: application/resource-lists+xml"); + formatedText.append ("Content-Disposition: recipient-list"); formatedText.append ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); formatedText.append ("<resource-lists xmlns=\"urn:ietf:params:xml:ns:resource-lists\" xmlns:cp=\"urn:ietf:params:xml:ns:copycontrol\">"); formatedText.append ("<list>"); @@ -282,19 +282,19 @@ void InstantMessagingTest::testGetTextArea () std::string message = _im->findTextMessage(formatedText); - CPPUNIT_ASSERT(message == "Here is the text area"); + std::cout << "message " << message << std::endl; - std::cout << "message: " << message << std::endl; + CPPUNIT_ASSERT(message == "Here is the text area"); } void InstantMessagingTest::testGetUriListArea () { - std::string formatedText = "--boundary\n Content-Type: text/plain\n\n"; + std::string formatedText = "--boundary Content-Type: text/plain"; formatedText.append ("Here is the text area"); - formatedText.append ("\n--boundary\nContent-Type: application/resource-lists+xml\n"); - formatedText.append ("Content-Disposition: recipient-list\n\n"); + formatedText.append ("--boundary Content-Type: application/resource-lists+xml"); + formatedText.append ("Content-Disposition: recipient-list"); formatedText.append ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); formatedText.append ("<resource-lists xmlns=\"urn:ietf:params:xml:ns:resource-lists\" xmlns:cp=\"urn:ietf:params:xml:ns:copycontrol\">"); formatedText.append ("<list>"); @@ -334,11 +334,11 @@ void InstantMessagingTest::testIllFormatedMessage () bool exceptionCaught = false; // SHOULD BE: Content-Type: text/plain - std::string formatedText = "--boundary\n Content-Ty\n\n"; + std::string formatedText = "--boundary Content-Ty"; formatedText.append ("Here is the text area"); - formatedText.append ("\n--boundary\nContent-Type: application/resource-lists+xml\n"); - formatedText.append ("Content-Disposition: recipient-list\n\n"); + formatedText.append ("--boundary Content-Type: application/resource-lists+xml"); + formatedText.append ("Content-Disposition: recipient-list"); formatedText.append ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); formatedText.append ("<resource-lists xmlns=\"urn:ietf:params:xml:ns:resource-lists\" xmlns:cp=\"urn:ietf:params:xml:ns:copycontrol\">"); formatedText.append ("<list>");