From de0c391964f20214bedcffa954c162360675d3b1 Mon Sep 17 00:00:00 2001 From: watcherhd Date: Thu, 15 Mar 2012 16:43:42 +0000 Subject: FacebookRM: version bump # For running plugin is required Miranda 0.9.43 or newer # Plugin is compiled with VS2005 (Fb x86) and a VS2010 (Fb x64) + Added 2 types of newsfeeds: Photos and Links * Reworked options ! Fixed setting to notify different type of newsfeeds ! Fixed and improved parsing newsfeeds ! Fixed getting groupchat messages which contains % ! Fixed not working login ! Improved deleting of contacts + Support for Miranda's EV_PROTO_ONCONTACTDELETED events + Added missing GUID for x64 version and updated user-agent ! Some other minor fixes or improvements ! Fixed item 'Visit Profile' when protocol menus are moved to Main menu * Updated language pack file (for translators) - Disabled option for closing message windows on website (temporary doesnt work) git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@279 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- FacebookRM/utils.cpp | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) (limited to 'FacebookRM/utils.cpp') diff --git a/FacebookRM/utils.cpp b/FacebookRM/utils.cpp index 71062c3..02a7662 100644 --- a/FacebookRM/utils.cpp +++ b/FacebookRM/utils.cpp @@ -151,8 +151,7 @@ std::string utils::text::edit_html( std::string data ) } } - start = 0; - end = 0; + start = end = 0; data = new_string; new_string = ""; @@ -168,6 +167,23 @@ std::string utils::text::edit_html( std::string data ) } } + // Remove "Translate" link + start = end = 0; + data = new_string; + new_string = ""; + while ( end != std::string::npos ) + { + end = data.find( "translate_story_link\\\">", start ); + if ( end != std::string::npos ) + { + new_string += data.substr( start, end - start ); + start = data.find( "<\\/div", end ); + } else { + new_string += data.substr( start, data.length() - start ); + } + } + + // Append newline after attachement title start = new_string.find( "class=\\\"uiAttachmentTitle", 0 ); if ( start != std::string::npos ) { @@ -183,7 +199,8 @@ std::string utils::text::edit_html( std::string data ) new_string.insert(start, "\n"); } - start = new_string.find( "uiAttachmentDesc\\\"", 0 ); + // Append newline between attachement link and description + start = new_string.find( "uiAttachmentDesc", 0 ); if ( start != std::string::npos ) { start = new_string.find( ">", start ); @@ -197,6 +214,8 @@ std::string utils::text::edit_html( std::string data ) utils::text::replace_all( &new_string, "
", "\n" ); utils::text::replace_all( &new_string, "\n\n\n", "\n\n" ); + //utils::text::replace_all( &new_string, "\\t", "" ); + //utils::text::replace_all( &new_string, "\\n", "" ); return new_string; } @@ -260,24 +279,25 @@ std::string utils::text::slashu_to_utf8( std::string data ) std::string utils::text::trim( std::string data ) { - std::string spaces = " \t\r\n"; // TODO: include "nbsp" + std::string spaces = " \t\r\n"; // TODO: include "nbsp"? std::string::size_type begin = data.find_first_not_of( spaces ); std::string::size_type end = data.find_last_not_of( spaces ) + 1; return (begin != std::string::npos) ? data.substr( begin, end - begin ) : ""; } -void utils::text::explode(std::string str, std::string separator, std::vector* results){ +void utils::text::explode(std::string str, std::string separator, std::vector* results) +{ std::string::size_type pos; pos = str.find_first_of(separator); - while(pos != std::string::npos){ - if(pos > 0){ + while (pos != std::string::npos) { + if (pos > 0) { results->push_back(str.substr(0,pos)); } str = str.substr(pos+1); pos = str.find_first_of(separator); } - if(str.length() > 0){ + if (str.length() > 0) { results->push_back(str); } } @@ -384,18 +404,3 @@ int ext_to_format(const std::string &ext) return PA_FORMAT_UNKNOWN; } - - -// OBSOLETE - -void MB( const char* m ) -{ - MessageBoxA( NULL, m, NULL, MB_OK ); -} - -void MBI( int a ) -{ - char b[32]; - itoa( a, b, 10 ); - MB( b ); -} -- cgit v1.2.3