Commit 2510538d authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3963] Parse data in SIP message to retreive actual Text Message

parent aaa76da5
......@@ -300,10 +300,11 @@ std::string InstantMessaging::appendUriList (std::string text, UriList& list)
return formatedText;
}
std::string InstantMessaging::findTextUriList (std::string text)
std::string InstantMessaging::findTextUriList (std::string& text)
{
std::string ctype = "Content-Type: application/resource-lists+xml";
std::string cdispo = "Content-Disposition: recipient-list";
std::string boundary = ("--boundary--");
size_t pos = 0;
pos = text.find (ctype);
......@@ -311,12 +312,12 @@ std::string InstantMessaging::findTextUriList (std::string text)
size_t begin = pos+cdispo.size();
size_t end = text.find ("--boundary--", begin);
size_t end = text.find (boundary, begin);
return text.substr (begin, end-begin);
}
std::string InstantMessaging::findTextMessage (std::string text)
std::string InstantMessaging::findTextMessage (std::string& text)
{
std::string ctype = "Content-Type: text/plain";
std::string boundary = "--boundary";
......
......@@ -155,9 +155,23 @@ class InstantMessaging
*/
std::string appendUriList (std::string text, UriList& list);
std::string findTextUriList (std::string text);
std::string findTextMessage (std::string text);
/**
* Retreive the xml formated uri list in formated text data according to RFC 5365
*
* @param text The formated text message as retreived in the SIP message
*
* @return A string containing the XML content
*/
std::string findTextUriList (std::string& text);
/**
* Retrive the plain text message in formated text data according to RFC 5365
*
* @param text The formated text message as retreived in the SIP message
*
* @return A string containing the actual message
*/
std::string findTextMessage (std::string& text);
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment