From 30ab6ceb71842f003f649b3d62b89af010cf40d1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 20 Jun 2012 17:00:14 +0000 Subject: - direct call of MS_SKIN_ADDNEWSOUND replaced with Skin_AddSound() call; - obsolete structure SKINSOUNDDESC removed - dynamically translated hot keys; - checked correct LPGEN'ing of the sounds creation; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@500 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/JSON_CAJUN/elements.inl | 14 ++--- protocols/FacebookRM/chat.cpp | 12 ++--- protocols/FacebookRM/communication.cpp | 68 ++++++++++++------------ protocols/FacebookRM/connection.cpp | 22 ++++---- protocols/FacebookRM/contacts.cpp | 18 +++---- protocols/FacebookRM/definitions.h | 2 +- protocols/FacebookRM/dialogs.cpp | 18 +++---- protocols/FacebookRM/events.cpp | 22 ++++---- protocols/FacebookRM/json.cpp | 78 ++++++++++++++-------------- protocols/FacebookRM/list.hpp | 2 +- protocols/FacebookRM/main.cpp | 6 +-- protocols/FacebookRM/messages.cpp | 20 +++---- protocols/FacebookRM/process.cpp | 48 ++++++++--------- protocols/FacebookRM/proto.cpp | 26 +++++----- protocols/FacebookRM/theme.cpp | 2 +- protocols/FacebookRM/utils.cpp | 20 +++---- 16 files changed, 189 insertions(+), 189 deletions(-) (limited to 'protocols/FacebookRM') diff --git a/protocols/FacebookRM/JSON_CAJUN/elements.inl b/protocols/FacebookRM/JSON_CAJUN/elements.inl index deb838cb3f..7febabc3a2 100644 --- a/protocols/FacebookRM/JSON_CAJUN/elements.inl +++ b/protocols/FacebookRM/JSON_CAJUN/elements.inl @@ -108,14 +108,14 @@ public: -inline UnknownElement::UnknownElement() : m_pImp( new Imp_T( Null() ) ) {} +inline UnknownElement::UnknownElement() : m_pImp( new Imp_T( Null()) ) {} inline UnknownElement::UnknownElement(const UnknownElement& unknown) : m_pImp( unknown.m_pImp->Clone()) {} -inline UnknownElement::UnknownElement(const Object& object) : m_pImp( new Imp_T(object) ) {} -inline UnknownElement::UnknownElement(const Array& array) : m_pImp( new Imp_T(array) ) {} -inline UnknownElement::UnknownElement(const Number& number) : m_pImp( new Imp_T(number) ) {} -inline UnknownElement::UnknownElement(const Boolean& boolean) : m_pImp( new Imp_T(boolean) ) {} -inline UnknownElement::UnknownElement(const String& string) : m_pImp( new Imp_T(string) ) {} -inline UnknownElement::UnknownElement(const Null& null) : m_pImp( new Imp_T(null) ) {} +inline UnknownElement::UnknownElement(const Object& object) : m_pImp( new Imp_T(object)) {} +inline UnknownElement::UnknownElement(const Array& array) : m_pImp( new Imp_T(array)) {} +inline UnknownElement::UnknownElement(const Number& number) : m_pImp( new Imp_T(number)) {} +inline UnknownElement::UnknownElement(const Boolean& boolean) : m_pImp( new Imp_T(boolean)) {} +inline UnknownElement::UnknownElement(const String& string) : m_pImp( new Imp_T(string)) {} +inline UnknownElement::UnknownElement(const Null& null) : m_pImp( new Imp_T(null)) {} inline UnknownElement::~UnknownElement() { delete m_pImp; } diff --git a/protocols/FacebookRM/chat.cpp b/protocols/FacebookRM/chat.cpp index 2b66e730a1..db50207076 100644 --- a/protocols/FacebookRM/chat.cpp +++ b/protocols/FacebookRM/chat.cpp @@ -48,7 +48,7 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char * // Close chat window, if set - ForkThread( &FacebookProto::MessagingWorker, this, new send_messaging(chat_id, FACEBOOK_SEND_MESSAGE ) ); + ForkThread( &FacebookProto::MessagingWorker, this, new send_messaging(chat_id, FACEBOOK_SEND_MESSAGE )); } int FacebookProto::OnChatOutgoing(WPARAM wParam,LPARAM lParam) @@ -75,7 +75,7 @@ int FacebookProto::OnChatOutgoing(WPARAM wParam,LPARAM lParam) if (isOnline()) { LOG("**Chat - Outgoing message: %s", text); - ForkThread(&FacebookProto::SendChatMsgWorker, this, new send_chat(chat_id, msg) ); + ForkThread(&FacebookProto::SendChatMsgWorker, this, new send_chat(chat_id, msg)); } break; @@ -198,9 +198,9 @@ void FacebookProto::AddChat(const char *id, const char *name) // Create a user statuses gcd.iType = GC_EVENT_ADDGROUP; gce.ptszStatus = _T("Admin"); - CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce) ); + CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce)); gce.ptszStatus = _T("Normal"); - CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce) ); + CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce)); // Finish initialization gcd.iType = GC_EVENT_CONTROL; @@ -258,10 +258,10 @@ int FacebookProto::OnJoinChat(WPARAM,LPARAM suppress) gcd.iType = GC_EVENT_ADDGROUP; gce.ptszStatus = _T("Admin"); - CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce) ); + CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce)); gce.ptszStatus = _T("Normal"); - CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce) ); + CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce)); SetTopic("Omegle is a great way of meeting new friends!"); diff --git a/protocols/FacebookRM/communication.cpp b/protocols/FacebookRM/communication.cpp index 90296b18e0..7cbaed3f8d 100644 --- a/protocols/FacebookRM/communication.cpp +++ b/protocols/FacebookRM/communication.cpp @@ -144,7 +144,7 @@ bool facebook_client::validate_response( http::response* resp ) try { pos += 8; - int error_num = atoi( resp->data.substr( pos, resp->data.find( ",", pos ) - pos ).c_str() ); + int error_num = atoi( resp->data.substr( pos, resp->data.find( ",", pos ) - pos ).c_str()); if ( error_num != 0 ) { std::string error = ""; @@ -154,7 +154,7 @@ bool facebook_client::validate_response( http::response* resp ) error = resp->data.substr( pos, resp->data.find( "\"", pos ) - pos ); error = utils::text::trim( utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( error ) ) ); + utils::text::slashu_to_utf8( error )) ); } @@ -215,7 +215,7 @@ DWORD facebook_client::choose_security_level( int request_type ) if (this->https_) { if ( request_type != FACEBOOK_REQUEST_MESSAGES_RECEIVE - || DBGetContactSettingByte( NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL ) ) + || DBGetContactSettingByte( NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL )) return NLHRF_SSL; } @@ -451,7 +451,7 @@ std::string facebook_client::choose_action( int request_type, std::string* data, action = "/pull?clientid=&channel=p_%s&seq=%s&cb=&state=active"; //utils::text::replace_first( &action, "%s", dtsg_ ); } else { - utils::text::replace_first( &action, "%s", utils::time::unix_timestamp() ); + utils::text::replace_first( &action, "%s", utils::time::unix_timestamp()); } utils::text::replace_first( &action, "%s", self_.user_id ); @@ -485,8 +485,8 @@ std::string facebook_client::choose_action( int request_type, std::string* data, std::string facebook_client::choose_request_url( int request_type, std::string* data, std::string* get_data ) { std::string url = choose_proto( request_type ); - url.append( choose_server( request_type, data, get_data ) ); - url.append( choose_action( request_type, data, get_data ) ); + url.append( choose_server( request_type, data, get_data )); + url.append( choose_action( request_type, data, get_data )); return url; } @@ -497,7 +497,7 @@ NETLIBHTTPHEADER* facebook_client::get_request_headers( int request_type, int* h else *headers_count = 4; - NETLIBHTTPHEADER* headers = ( NETLIBHTTPHEADER* )utils::mem::allocate( sizeof( NETLIBHTTPHEADER )*( *headers_count ) ); + NETLIBHTTPHEADER* headers = ( NETLIBHTTPHEADER* )utils::mem::allocate( sizeof( NETLIBHTTPHEADER )*( *headers_count )); if (request_type == REQUEST_POST) { @@ -531,7 +531,7 @@ char* facebook_client::load_cookies( ) std::string cookieString = "isfbe=false;"; - if ( !cookies.empty( ) ) + if ( !cookies.empty( )) for ( std::map< std::string, std::string >::iterator iter = cookies.begin(); iter != cookies.end(); ++iter ) { cookieString.append( iter->first ); @@ -554,7 +554,7 @@ void facebook_client::store_headers( http::response* resp, NETLIBHTTPHEADER* hea if ( header_name == "Set-Cookie" ) { - std::string cookie_name = header_value.substr( 0, header_value.find( "=" ) ); + std::string cookie_name = header_value.substr( 0, header_value.find( "=" )); std::string cookie_value = header_value.substr( header_value.find( "=" ) + 1, header_value.find( ";" ) - header_value.find( "=" ) - 1 ); if ( cookie_value == "deleted" ) { @@ -567,7 +567,7 @@ void facebook_client::store_headers( http::response* resp, NETLIBHTTPHEADER* hea } else { // TODO RM: (un)comment - //parent->Log("----- Got header '%s': %s", header_name.c_str(), header_value.c_str() ); + //parent->Log("----- Got header '%s': %s", header_name.c_str(), header_value.c_str()); resp->headers[header_name] = header_value; } } @@ -577,7 +577,7 @@ void facebook_client::clear_cookies( ) { ScopedLock s( cookies_lock_ ); - if ( !cookies.empty( ) ) + if ( !cookies.empty( )) cookies.clear( ); } @@ -602,12 +602,12 @@ bool facebook_client::login(const std::string &username,const std::string &passw // Process result data validate_response(&resp); - if ( resp.code == HTTP_CODE_FOUND && resp.headers.find("Location") != resp.headers.end() ) + if ( resp.code == HTTP_CODE_FOUND && resp.headers.find("Location") != resp.headers.end()) { // Check whether some Facebook things are required if ( resp.headers["Location"].find("help.php") != std::string::npos ) { - client_notify( TranslateT("Login error: Some Facebook things are required.") ); + client_notify( TranslateT("Login error: Some Facebook things are required.")); parent->Log(" ! ! Login error: Some Facebook things are required."); // return handle_error( "login", FORCE_DISCONNECT ); } @@ -646,7 +646,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw } } - if ( resp.code == HTTP_CODE_FOUND && resp.headers.find("Location") != resp.headers.end() ) + if ( resp.code == HTTP_CODE_FOUND && resp.headers.find("Location") != resp.headers.end()) { // Check whether HTTPS connection is required and we don't have enabled it if (!this->https_) @@ -662,15 +662,15 @@ bool facebook_client::login(const std::string &username,const std::string &passw } // Check for Device ID - if ( cookies["datr"].length() ) - DBWriteContactSettingString( NULL, parent->m_szModuleName, FACEBOOK_KEY_DEVICE_ID, cookies["datr"].c_str() ); + if ( cookies["datr"].length()) + DBWriteContactSettingString( NULL, parent->m_szModuleName, FACEBOOK_KEY_DEVICE_ID, cookies["datr"].c_str()); switch ( resp.code ) { case HTTP_CODE_FAKE_DISCONNECTED: { // When is error only because timeout, try login once more - if ( handle_error( "login" ) ) + if ( handle_error( "login" )) return login(username, password); else return false; @@ -681,7 +681,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw // Check whether captcha code is required if ( resp.data.find("id=\"captcha\"") != std::string::npos ) { - client_notify( TranslateT("Login error: Captcha code is required. Bad login credentials?") ); + client_notify( TranslateT("Login error: Captcha code is required. Bad login credentials?")); parent->Log(" ! ! Login error: Captcha code is required."); return handle_error( "login", FORCE_DISCONNECT ); } @@ -691,9 +691,9 @@ bool facebook_client::login(const std::string &username,const std::string &passw utils::text::special_expressions_decode( utils::text::remove_html( utils::text::edit_html( - utils::text::source_get_value( &resp.data, 2, "id=\"standard_error\">", "" ) ) ) ) ); + utils::text::source_get_value( &resp.data, 2, "id=\"standard_error\">", "" )) )) ); - if ( !error_str.length() ) + if ( !error_str.length()) error_str = Translate("Unknown login error"); parent->Log(" ! ! Login error: %s", error_str.c_str()); @@ -708,7 +708,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw return handle_error( "login", FORCE_DISCONNECT ); case HTTP_CODE_FOUND: // Found and redirected to Home, Logged in, everything is OK - if ( cookies.find("c_user") != cookies.end() ) + if ( cookies.find("c_user") != cookies.end()) { this->self_.user_id = cookies.find("c_user")->second; DBWriteContactSettingString(NULL,parent->m_szModuleName,FACEBOOK_KEY_ID,this->self_.user_id.c_str()); @@ -724,7 +724,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw bool facebook_client::logout( ) { - if ( DBGetContactSettingByte(NULL, parent->m_szModuleName, FACEBOOK_KEY_DISABLE_LOGOUT, 0) ) + if ( DBGetContactSettingByte(NULL, parent->m_szModuleName, FACEBOOK_KEY_DISABLE_LOGOUT, 0)) return true; handle_entry( "logout" ); @@ -769,13 +769,13 @@ bool facebook_client::home( ) if ( resp.data.find( "id=\"navAccountName\"" ) != std::string::npos ) { // Backup for old fb version // Get real_name - this->self_.real_name = utils::text::remove_html( utils::text::special_expressions_decode( utils::text::source_get_value( &resp.data, 2, " id=\"navAccountName\">", "self_.real_name = utils::text::remove_html( utils::text::special_expressions_decode( utils::text::source_get_value( &resp.data, 2, " id=\"navAccountName\">", "m_szModuleName,FACEBOOK_KEY_NAME,this->self_.real_name.c_str()); DBWriteContactSettingUTF8String(NULL,parent->m_szModuleName,FACEBOOK_KEY_NICK,this->self_.real_name.c_str()); parent->Log(" Got self real name: %s", this->self_.real_name.c_str()); } else if ( resp.data.find("id=\"pageNav\"") != std::string::npos ) { // Get real_name - this->self_.real_name = utils::text::remove_html( utils::text::special_expressions_decode( utils::text::source_get_value( &resp.data, 3, " class=\"headerTinymanName\"", ">", "self_.real_name = utils::text::remove_html( utils::text::special_expressions_decode( utils::text::source_get_value( &resp.data, 3, " class=\"headerTinymanName\"", ">", "m_szModuleName,FACEBOOK_KEY_NAME,this->self_.real_name.c_str()); DBWriteContactSettingUTF8String(NULL,parent->m_szModuleName,FACEBOOK_KEY_NICK,this->self_.real_name.c_str()); parent->Log(" Got self real name: %s", this->self_.real_name.c_str()); @@ -789,7 +789,7 @@ bool facebook_client::home( ) if (avatar.empty()) avatar = utils::text::source_get_value( &resp.data, 3, "class=\"fbxWelcomeBoxImg", "src=\"", "\"" ); - this->self_.image_url = utils::text::trim( utils::text::special_expressions_decode( avatar ) ); + this->self_.image_url = utils::text::trim( utils::text::special_expressions_decode( avatar )); parent->Log(" Got self avatar: %s", this->self_.image_url.c_str()); parent->CheckAvatarChange(NULL, this->self_.image_url); @@ -810,18 +810,18 @@ bool facebook_client::home( ) if (!DBGetContactSettingByte(NULL,parent->m_szModuleName,FACEBOOK_KEY_PARSE_MESSAGES, DEFAULT_PARSE_MESSAGES)) { str_count = utils::text::source_get_value( &resp.data, 2, "", "" ); - if ( str_count.length() && str_count != std::string( "0" ) ) + if ( str_count.length() && str_count != std::string( "0" )) { std::string message = Translate("Got new messages: ") + str_count; TCHAR* tmessage = mir_a2t(message.c_str()); - parent->NotifyEvent( parent->m_tszUserName, tmessage, NULL, FACEBOOK_EVENT_OTHER, TEXT(FACEBOOK_URL_MESSAGES) ); + parent->NotifyEvent( parent->m_tszUserName, tmessage, NULL, FACEBOOK_EVENT_OTHER, TEXT(FACEBOOK_URL_MESSAGES)); mir_free( tmessage ); } } str_count = utils::text::source_get_value( &resp.data, 2, "", "" ); - if ( str_count.length() && str_count != std::string( "0" ) ) + if ( str_count.length() && str_count != std::string( "0" )) { // Parse notifications directly to popups ForkThread( &FacebookProto::ProcessNotifications, this->parent, NULL ); @@ -839,7 +839,7 @@ bool facebook_client::home( ) if (!id.empty()) { std::string name = utils::text::source_get_value( &item, 3, "class=\"linkWrap", ">", "" ); - name = utils::text::special_expressions_decode(utils::text::slashu_to_utf8( name ) ); + name = utils::text::special_expressions_decode(utils::text::slashu_to_utf8( name )); parent->Log(" Got new group chat: %s (id: %s)", name.c_str(), id.c_str()); if (!name.empty()) parent->AddChat(id.c_str(), name.c_str()); @@ -1112,9 +1112,9 @@ bool facebook_client::send_message( std::string message_recipient, std::string m data += "&recipients[0]="; data += message_recipient; data += "&lsd=&fb_dtsg="; - data += ( dtsg_.length( ) ) ? dtsg_ : "0"; + data += ( dtsg_.length( )) ? dtsg_ : "0"; data += "&post_form_id="; - data += ( post_form_id_.length( ) ) ? post_form_id_ : "0"; + data += ( post_form_id_.length( )) ? post_form_id_ : "0"; resp = flap( FACEBOOK_REQUEST_ASYNC, &data ); } @@ -1215,7 +1215,7 @@ bool facebook_client::set_status(const std::string &status_text) data += "&fb_dtsg=" + (this->dtsg_.length() ? this->dtsg_ : "0"); data += "&target_id=" + this->self_.user_id; - if ( status_text.length( ) ) + if ( status_text.length( )) { data += "&action=PROFILE_UPDATE&app_id=&hey_kid_im_a_composer=true&display_context=profile&_log_display_context=profile&ajax_log=1"; data += "&status=" + utils::url::encode( status_text ); @@ -1250,12 +1250,12 @@ bool facebook_client::save_url(const std::string &url,const std::tstring &filena req.nlc = nlc; resp = reinterpret_cast(CallService( MS_NETLIB_HTTPTRANSACTION, - reinterpret_cast(this->parent->m_hNetlibUser), reinterpret_cast(&req) )); + reinterpret_cast(this->parent->m_hNetlibUser), reinterpret_cast(&req))); if ( resp ) { nlc = resp->nlc; - parent->Log( "@@@@@ Saving avatar URL %s to path %s", url.c_str(), filename.c_str() ); + parent->Log( "@@@@@ Saving avatar URL %s to path %s", url.c_str(), filename.c_str()); // Create folder if necessary std::tstring dir = filename.substr(0,filename.rfind('\\')); diff --git a/protocols/FacebookRM/connection.cpp b/protocols/FacebookRM/connection.cpp index 5d955d917f..4ae173d60d 100644 --- a/protocols/FacebookRM/connection.cpp +++ b/protocols/FacebookRM/connection.cpp @@ -43,7 +43,7 @@ void FacebookProto::ChangeStatus(void*) SetEvent(update_loop_lock_); Netlib_Shutdown(facy.hMsgCon); - if ( getByte(FACEBOOK_KEY_DISCONNECT_CHAT, DEFAULT_DISCONNECT_CHAT) ) + if ( getByte(FACEBOOK_KEY_DISCONNECT_CHAT, DEFAULT_DISCONNECT_CHAT)) facy.chat_state( false ); facy.logout( ); @@ -82,7 +82,7 @@ void FacebookProto::ChangeStatus(void*) ResetEvent(update_loop_lock_); - if ( NegotiateConnection( ) ) + if ( NegotiateConnection( )) { facy.last_feeds_update_ = ::time( NULL ); @@ -97,7 +97,7 @@ void FacebookProto::ChangeStatus(void*) if (getByte(FACEBOOK_KEY_PARSE_MESSAGES, DEFAULT_PARSE_MESSAGES)) ForkThread( &FacebookProto::ProcessUnreadMessages, this ); - setDword( "LogonTS", (DWORD)time(NULL) ); + setDword( "LogonTS", (DWORD)time(NULL)); ForkThread( &FacebookProto::UpdateLoop, this ); ForkThread( &FacebookProto::MessageLoop, this ); @@ -146,7 +146,7 @@ bool FacebookProto::NegotiateConnection( ) DBVARIANT dbv = {0}; error = true; - if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_LOGIN,&dbv) ) + if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_LOGIN,&dbv)) { user = dbv.pszVal; DBFreeVariant(&dbv); @@ -159,7 +159,7 @@ bool FacebookProto::NegotiateConnection( ) } error = true; - if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_PASS,&dbv) ) + if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_PASS,&dbv)) { CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1, reinterpret_cast(dbv.pszVal)); @@ -174,7 +174,7 @@ bool FacebookProto::NegotiateConnection( ) } // Load machine name - if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_DEVICE_ID,&dbv) ) + if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_DEVICE_ID,&dbv)) { facy.cookies["datr"] = dbv.pszVal; DBFreeVariant(&dbv); @@ -195,11 +195,11 @@ void FacebookProto::UpdateLoop(void *) { if ( i != -1 ) { if ( !facy.invisible_ ) - if ( !facy.buddy_list( ) ) + if ( !facy.buddy_list( )) break; } - if ( i == 2 && getByte( FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE ) ) - if ( !facy.feeds( ) ) + if ( i == 2 && getByte( FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE )) + if ( !facy.feeds( )) break; if ( i == 49 ) @@ -220,9 +220,9 @@ void FacebookProto::MessageLoop(void *) time_t tim = ::time(NULL); LOG( ">>>>> Entering Facebook::MessageLoop[%d]", tim ); - while ( facy.channel( ) ) + while ( facy.channel( )) { - if ( isOffline() ) + if ( isOffline()) break; LOG( "***** FacebookProto::MessageLoop[%d] refreshing...", tim ); } diff --git a/protocols/FacebookRM/contacts.cpp b/protocols/FacebookRM/contacts.cpp index 32cc1ce269..ab953e809d 100644 --- a/protocols/FacebookRM/contacts.cpp +++ b/protocols/FacebookRM/contacts.cpp @@ -25,7 +25,7 @@ along with this program. If not, see . bool FacebookProto::IsMyContact(HANDLE hContact, bool include_chat) { const char *proto = reinterpret_cast( CallService(MS_PROTO_GETCONTACTBASEPROTO, - reinterpret_cast(hContact),0) ); + reinterpret_cast(hContact),0)); if( proto && strcmp(m_szModuleName,proto) == 0 ) { @@ -42,13 +42,13 @@ HANDLE FacebookProto::ChatIDToHContact(std::string chat_id) { for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); hContact; - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0) ) + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)) { if(!IsMyContact(hContact, true)) continue; DBVARIANT dbv; - if( !DBGetContactSettingString(hContact,m_szModuleName,"ChatRoomID",&dbv) ) + if( !DBGetContactSettingString(hContact,m_szModuleName,"ChatRoomID",&dbv)) { if( strcmp(chat_id.c_str(),dbv.pszVal) == 0 ) { @@ -67,13 +67,13 @@ HANDLE FacebookProto::ContactIDToHContact(std::string user_id) { for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); hContact; - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0) ) + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)) { if(!IsMyContact(hContact)) continue; DBVARIANT dbv; - if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) { if( strcmp(user_id.c_str(),dbv.pszVal) == 0 ) { @@ -115,7 +115,7 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_ DBDeleteContactSetting(hContact, "CList", "MyHandle"); DBVARIANT dbv; - if( !DBGetContactSettingTString(NULL,m_szModuleName,FACEBOOK_KEY_DEF_GROUP,&dbv) ) + if( !DBGetContactSettingTString(NULL,m_szModuleName,FACEBOOK_KEY_DEF_GROUP,&dbv)) { DBWriteContactSettingTString(hContact,"CList","Group",dbv.ptszVal); DBFreeVariant(&dbv); @@ -200,7 +200,7 @@ void FacebookProto::DeleteContactFromServer(void *data) NotifyEvent(m_tszUserName, TranslateT("Contact was removed from your server list."), NULL, FACEBOOK_EVENT_OTHER, NULL); } else { - facy.client_notify( TranslateT("Error occured when removing contact from server.") ); + facy.client_notify( TranslateT("Error occured when removing contact from server.")); } if (resp.code != HTTP_CODE_OK) @@ -244,7 +244,7 @@ void FacebookProto::AddContactToServer(void *data) NotifyEvent(m_tszUserName, TranslateT("Request for friendship was sent."), NULL, FACEBOOK_EVENT_OTHER, NULL); } else { - facy.client_notify( TranslateT("Error occured when requesting friendship.") ); + facy.client_notify( TranslateT("Error occured when requesting friendship.")); } if (resp.code != HTTP_CODE_OK) @@ -314,7 +314,7 @@ void FacebookProto::CancelFriendsRequest(void *data) DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE); NotifyEvent(m_tszUserName, TranslateT("Request for friendship was canceled."), NULL, FACEBOOK_EVENT_OTHER, NULL); } else { - facy.client_notify( TranslateT("Error occured when canceling friendship request.") ); + facy.client_notify( TranslateT("Error occured when canceling friendship request.")); } if (resp.code != HTTP_CODE_OK) diff --git a/protocols/FacebookRM/definitions.h b/protocols/FacebookRM/definitions.h index 5a862438d8..94efdb128b 100644 --- a/protocols/FacebookRM/definitions.h +++ b/protocols/FacebookRM/definitions.h @@ -29,7 +29,7 @@ along with this program. If not, see . #define CODE_BLOCK_END } #define FLAG_CONTAINS(x,y) ( ( x & y ) == y ) -#define REMOVE_FLAG(x,y) ( x = ( x & ~y ) ) +#define REMOVE_FLAG(x,y) ( x = ( x & ~y )) #define LOG Log diff --git a/protocols/FacebookRM/dialogs.cpp b/protocols/FacebookRM/dialogs.cpp index 02ce022d5b..9eb1b3b2d5 100644 --- a/protocols/FacebookRM/dialogs.cpp +++ b/protocols/FacebookRM/dialogs.cpp @@ -50,13 +50,13 @@ INT_PTR CALLBACK FBAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam); DBVARIANT dbv; - if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv) ) + if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv)) { SetDlgItemTextA(hwnd,IDC_UN,dbv.pszVal); DBFreeVariant(&dbv); } - if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv) ) + if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv)) { CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1, reinterpret_cast(dbv.pszVal)); @@ -74,11 +74,11 @@ INT_PTR CALLBACK FBAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l if ( LOWORD( wparam ) == IDC_NEWACCOUNTLINK ) { CallService(MS_UTILS_OPENURL,1,reinterpret_cast - ( FACEBOOK_URL_HOMEPAGE ) ); + ( FACEBOOK_URL_HOMEPAGE )); return TRUE; } - if ( HIWORD( wparam ) == EN_CHANGE && reinterpret_cast(lparam) == GetFocus() ) + if ( HIWORD( wparam ) == EN_CHANGE && reinterpret_cast(lparam) == GetFocus()) { switch(LOWORD(wparam)) { @@ -195,13 +195,13 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam); DBVARIANT dbv; - if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv) ) + if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv)) { SetDlgItemTextA(hwnd,IDC_UN,dbv.pszVal); DBFreeVariant(&dbv); } - if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv) ) + if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv)) { CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,reinterpret_cast(dbv.pszVal)); SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal); @@ -216,7 +216,7 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, FACEBOOK_GROUP_NAME_LIMIT, 0); - if ( !DBGetContactSettingTString(0,proto->ModuleName(),FACEBOOK_KEY_DEF_GROUP,&dbv) ) + if ( !DBGetContactSettingTString(0,proto->ModuleName(),FACEBOOK_KEY_DEF_GROUP,&dbv)) { SetDlgItemText(hwnd,IDC_GROUP,dbv.ptszVal); DBFreeVariant(&dbv); @@ -232,7 +232,7 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l if ( LOWORD( wparam ) == IDC_NEWACCOUNTLINK ) { CallService(MS_UTILS_OPENURL,1,reinterpret_cast - ( FACEBOOK_URL_HOMEPAGE ) ); + ( FACEBOOK_URL_HOMEPAGE )); return TRUE; } @@ -412,7 +412,7 @@ INT_PTR CALLBACK FBEventsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp } return TRUE; case WM_COMMAND: { - switch ( LOWORD( wparam ) ) + switch ( LOWORD( wparam )) { case IDC_PREVIEW: { diff --git a/protocols/FacebookRM/events.cpp b/protocols/FacebookRM/events.cpp index 2f93a58335..5d01df88df 100644 --- a/protocols/FacebookRM/events.cpp +++ b/protocols/FacebookRM/events.cpp @@ -24,7 +24,7 @@ along with this program. If not, see . int FacebookProto::Log(const char *fmt,...) { - if ( !getByte( FACEBOOK_KEY_LOGGING_ENABLE, 0 ) ) + if ( !getByte( FACEBOOK_KEY_LOGGING_ENABLE, 0 )) return EXIT_SUCCESS; va_list va; @@ -52,7 +52,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa if ( url.substr(0,4) != "http" ) url = FACEBOOK_URL_HOMEPAGE + url; // make absolute url - CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) url.c_str() ); + CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) url.c_str()); } // After a click, destroy popup @@ -85,9 +85,9 @@ void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD switch ( flags ) { case FACEBOOK_EVENT_CLIENT: - if ( !getByte( FACEBOOK_KEY_EVENT_CLIENT_ENABLE, DEFAULT_EVENT_CLIENT_ENABLE ) ) + if ( !getByte( FACEBOOK_KEY_EVENT_CLIENT_ENABLE, DEFAULT_EVENT_CLIENT_ENABLE )) goto exit; - if ( !getByte( FACEBOOK_KEY_EVENT_CLIENT_DEFAULT, 0 ) ) + if ( !getByte( FACEBOOK_KEY_EVENT_CLIENT_DEFAULT, 0 )) { colorBack = getDword( FACEBOOK_KEY_EVENT_CLIENT_COLBACK, DEFAULT_EVENT_COLBACK ); colorText = getDword( FACEBOOK_KEY_EVENT_CLIENT_COLTEXT, DEFAULT_EVENT_COLTEXT ); @@ -97,9 +97,9 @@ void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD break; case FACEBOOK_EVENT_NEWSFEED: - if ( !getByte( FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE ) ) + if ( !getByte( FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE )) goto exit; - if ( !getByte( FACEBOOK_KEY_EVENT_FEEDS_DEFAULT, 0 ) ) + if ( !getByte( FACEBOOK_KEY_EVENT_FEEDS_DEFAULT, 0 )) { colorBack = getDword( FACEBOOK_KEY_EVENT_FEEDS_COLBACK, DEFAULT_EVENT_COLBACK ); colorText = getDword( FACEBOOK_KEY_EVENT_FEEDS_COLTEXT, DEFAULT_EVENT_COLTEXT ); @@ -110,9 +110,9 @@ void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD break; case FACEBOOK_EVENT_NOTIFICATION: - if ( !getByte( FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE ) ) + if ( !getByte( FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE )) goto exit; - if ( !getByte( FACEBOOK_KEY_EVENT_NOTIFICATIONS_DEFAULT, 0 ) ) + if ( !getByte( FACEBOOK_KEY_EVENT_NOTIFICATIONS_DEFAULT, 0 )) { colorBack = getDword( FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK, DEFAULT_EVENT_COLBACK ); colorText = getDword( FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT, DEFAULT_EVENT_COLTEXT ); @@ -123,9 +123,9 @@ void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD break; case FACEBOOK_EVENT_OTHER: - if ( !getByte( FACEBOOK_KEY_EVENT_OTHER_ENABLE, DEFAULT_EVENT_OTHER_ENABLE ) ) + if ( !getByte( FACEBOOK_KEY_EVENT_OTHER_ENABLE, DEFAULT_EVENT_OTHER_ENABLE )) goto exit; - if ( !getByte( FACEBOOK_KEY_EVENT_OTHER_DEFAULT, 0 ) ) + if ( !getByte( FACEBOOK_KEY_EVENT_OTHER_DEFAULT, 0 )) { colorBack = getDword( FACEBOOK_KEY_EVENT_OTHER_COLBACK, DEFAULT_EVENT_COLBACK ); colorText = getDword( FACEBOOK_KEY_EVENT_OTHER_COLTEXT, DEFAULT_EVENT_COLTEXT ); @@ -136,7 +136,7 @@ void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD break; } - if ( !getByte(FACEBOOK_KEY_SYSTRAY_NOTIFY,DEFAULT_SYSTRAY_NOTIFY) ) + if ( !getByte(FACEBOOK_KEY_SYSTRAY_NOTIFY,DEFAULT_SYSTRAY_NOTIFY)) { if (ServiceExists(MS_POPUP_ADDPOPUP)) { diff --git a/protocols/FacebookRM/json.cpp b/protocols/FacebookRM/json.cpp index bb92cb4434..b9bf8915a8 100644 --- a/protocols/FacebookRM/json.cpp +++ b/protocols/FacebookRM/json.cpp @@ -40,14 +40,14 @@ int facebook_json_parser::parse_buddy_list( void* data, List::List< facebook_use const Object& objRoot = objDocument; /* const Array& wasAvailableIDs = objRoot["payload"]["buddy_list"]["wasAvailableIDs"]; - for ( Array::const_iterator itWasAvailable( wasAvailableIDs.Begin() ); + for ( Array::const_iterator itWasAvailable( wasAvailableIDs.Begin()); itWasAvailable != wasAvailableIDs.End(); ++itWasAvailable) { const Number& member = *itWasAvailable; char was_id[32]; lltoa( member.Value(), was_id, 10 ); - current = buddy_list->find( std::string( was_id ) ); + current = buddy_list->find( std::string( was_id )); if ( current != NULL ) current->status_id = ID_STATUS_OFFLINE; }*/ // Facebook removed support for "wasAvailableIDs" @@ -61,7 +61,7 @@ int facebook_json_parser::parse_buddy_list( void* data, List::List< facebook_use if (DBGetContactSettingByte(NULL,proto->m_szModuleName,FACEBOOK_KEY_LOAD_MOBILE, DEFAULT_LOAD_MOBILE)) { const Array& mobileFriends = objRoot["payload"]["buddy_list"]["mobile_friends"]; - for ( Array::const_iterator buddy( mobileFriends.Begin() ); buddy != mobileFriends.End(); ++buddy) { + for ( Array::const_iterator buddy( mobileFriends.Begin()); buddy != mobileFriends.End(); ++buddy) { const Number& member = *buddy; char was_id[32]; lltoa( member.Value(), was_id, 10 ); @@ -71,7 +71,7 @@ int facebook_json_parser::parse_buddy_list( void* data, List::List< facebook_use current = buddy_list->find( id ); if ( current == NULL) { - buddy_list->insert( std::make_pair( id, new facebook_user( ) ) ); + buddy_list->insert( std::make_pair( id, new facebook_user( )) ); current = buddy_list->find( id ); current->user_id = id; } @@ -94,7 +94,7 @@ int facebook_json_parser::parse_buddy_list( void* data, List::List< facebook_use if ( current == NULL) { if (idle) continue; // Just little optimalization - buddy_list->insert( std::make_pair( member.name, new facebook_user( ) ) ); + buddy_list->insert( std::make_pair( member.name, new facebook_user( )) ); current = buddy_list->find( member.name ); current->user_id = current->real_name = member.name; } @@ -118,23 +118,23 @@ int facebook_json_parser::parse_buddy_list( void* data, List::List< facebook_use const String& imageUrl = objMember["thumbSrc"]; current->real_name = utils::text::slashu_to_utf8( - utils::text::special_expressions_decode( realName.Value( ) ) ); + utils::text::special_expressions_decode( realName.Value( )) ); current->image_url = utils::text::slashu_to_utf8( - utils::text::special_expressions_decode( imageUrl.Value( ) ) ); + utils::text::special_expressions_decode( imageUrl.Value( )) ); } } catch (Reader::ParseException& e) { - proto->Log( "!!!!! Caught json::ParseException: %s", e.what() ); + proto->Log( "!!!!! Caught json::ParseException: %s", e.what()); proto->Log( " Line/offset: %d/%d", e.m_locTokenBegin.m_nLine + 1, e.m_locTokenBegin.m_nLineOffset + 1 ); } catch (const Exception& e) { - proto->Log( "!!!!! Caught json::Exception: %s", e.what() ); + proto->Log( "!!!!! Caught json::Exception: %s", e.what()); } catch (const std::exception& e) { - proto->Log( "!!!!! Caught std::exception: %s", e.what() ); + proto->Log( "!!!!! Caught std::exception: %s", e.what()); } return EXIT_SUCCESS; @@ -154,7 +154,7 @@ int facebook_json_parser::parse_friends( void* data, std::map< std::string, face const Object& objRoot = objDocument; const Object& payload = objRoot["payload"]; - for ( Object::const_iterator payload_item( payload.Begin() ); payload_item != payload.End(); ++payload_item) + for ( Object::const_iterator payload_item( payload.Begin()); payload_item != payload.End(); ++payload_item) { const Object::Member& member = *payload_item; @@ -169,9 +169,9 @@ int facebook_json_parser::parse_friends( void* data, std::map< std::string, face fbu->user_id = member.name; fbu->real_name = utils::text::slashu_to_utf8( - utils::text::special_expressions_decode( realName.Value() ) ); + utils::text::special_expressions_decode( realName.Value()) ); fbu->image_url = utils::text::slashu_to_utf8( - utils::text::special_expressions_decode( imageUrl.Value() ) ); + utils::text::special_expressions_decode( imageUrl.Value()) ); if (gender.Value() == 1) { fbu->gender = 70; // female @@ -179,21 +179,21 @@ int facebook_json_parser::parse_friends( void* data, std::map< std::string, face fbu->gender = 77; // male } - friends->insert( std::make_pair( member.name, fbu ) ); + friends->insert( std::make_pair( member.name, fbu )); } } catch (Reader::ParseException& e) { - proto->Log( "!!!!! Caught json::ParseException: %s", e.what() ); + proto->Log( "!!!!! Caught json::ParseException: %s", e.what()); proto->Log( " Line/offset: %d/%d", e.m_locTokenBegin.m_nLine + 1, e.m_locTokenBegin.m_nLineOffset + 1 ); } catch (const Exception& e) { - proto->Log( "!!!!! Caught json::Exception: %s", e.what() ); + proto->Log( "!!!!! Caught json::Exception: %s", e.what()); } catch (const std::exception& e) { - proto->Log( "!!!!! Caught std::exception: %s", e.what() ); + proto->Log( "!!!!! Caught std::exception: %s", e.what()); } return EXIT_SUCCESS; @@ -214,7 +214,7 @@ int facebook_json_parser::parse_notifications( void *data, std::vector< facebook const Object& objRoot = objDocument; const Object& payload = objRoot["payload"]["notifications"]; - for ( Object::const_iterator payload_item( payload.Begin() ); payload_item != payload.End(); ++payload_item) + for ( Object::const_iterator payload_item( payload.Begin()); payload_item != payload.End(); ++payload_item) { const Object::Member& member = *payload_item; @@ -227,11 +227,11 @@ int facebook_json_parser::parse_notifications( void *data, std::vector< facebook continue; std::string text = utils::text::slashu_to_utf8( - utils::text::special_expressions_decode( content.Value() ) ); + utils::text::special_expressions_decode( content.Value()) ); facebook_notification* notification = new facebook_notification( ); - notification->text = utils::text::remove_html( utils::text::source_get_value(&text, 1, "text = utils::text::remove_html( utils::text::source_get_value(&text, 1, "link = utils::text::source_get_value(&text, 3, "push_back( notification ); @@ -240,16 +240,16 @@ int facebook_json_parser::parse_notifications( void *data, std::vector< facebook } catch (Reader::ParseException& e) { - proto->Log( "!!!!! Caught json::ParseException: %s", e.what() ); + proto->Log( "!!!!! Caught json::ParseException: %s", e.what()); proto->Log( " Line/offset: %d/%d", e.m_locTokenBegin.m_nLine + 1, e.m_locTokenBegin.m_nLineOffset + 1 ); } catch (const Exception& e) { - proto->Log( "!!!!! Caught json::Exception: %s", e.what() ); + proto->Log( "!!!!! Caught json::Exception: %s", e.what()); } catch (const std::exception& e) { - proto->Log( "!!!!! Caught std::exception: %s", e.what() ); + proto->Log( "!!!!! Caught std::exception: %s", e.what()); } return EXIT_SUCCESS; @@ -301,8 +301,8 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess last_msg = text.Value(); facebook_message* message = new facebook_message( ); message->message_text = utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( text.Value( ) ) ); - message->time = utils::time::fix_timestamp( time_sent.Value() ); + utils::text::slashu_to_utf8( text.Value( )) ); + message->time = utils::time::fix_timestamp( time_sent.Value()); message->user_id = was_id; messages->push_back( message ); @@ -344,19 +344,19 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess facebook_message* message = new facebook_message( ); message->message_text = utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( text.Value( ) ) ); + utils::text::slashu_to_utf8( text.Value( )) ); message->sender_name = utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( sender_name.Value( ) ) ); + utils::text::slashu_to_utf8( sender_name.Value( )) ); - message->time = utils::time::fix_timestamp( time_sent.Value() ); + message->time = utils::time::fix_timestamp( time_sent.Value()); message->user_id = was_id; // TODO: Check if we have contact with this ID in friendlist and then do something different? if (row.find("uiSplitPic",0) != std::string::npos) { // This is multiuser message std::string authors = utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( row ) ); + utils::text::slashu_to_utf8( row )); authors = utils::text::source_get_value(&authors, 2, "", "<"); const String& to_id = messageContent["tid"]; @@ -410,17 +410,17 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess const String& text = messageContent["text"]; std::string msg = utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( text.Value( ) ) ); + utils::text::slashu_to_utf8( text.Value( )) ); std::string name = utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( from_name.Value( ) ) ); + utils::text::slashu_to_utf8( from_name.Value( )) ); // Add contact into chat, if isn't there already if (!proto->IsChatContact(group_id, was_id)) proto->AddChatContact(group_id, was_id, name.c_str()); const Number& time_sent = messageContent["time"]; - DWORD timestamp = utils::time::fix_timestamp( time_sent.Value() ); + DWORD timestamp = utils::time::fix_timestamp( time_sent.Value()); // Add message into chat proto->UpdateChat(group_id, was_id, name.c_str(), msg.c_str(), timestamp); @@ -447,15 +447,15 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess std::string popup_text = utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( from_name.Value( ) ) ); + utils::text::slashu_to_utf8( from_name.Value( )) ); popup_text += ": "; popup_text += utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( text.Value( ) ) ); + utils::text::slashu_to_utf8( text.Value( )) ); std::string title = Translate("Multichat"); title += ": "; title += utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( to_name.Value( ) ) ); + utils::text::slashu_to_utf8( to_name.Value( )) ); std::string url = "/?action=read&sk=inbox&page&query&tid="; url += to_id.Value(); @@ -487,9 +487,9 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess facebook_notification* notification = new facebook_notification( ); notification->text = utils::text::remove_html( utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( text.Value( ) ) ) ); + utils::text::slashu_to_utf8( text.Value( )) )); - notification->link = utils::text::special_expressions_decode( link.Value( ) ); + notification->link = utils::text::special_expressions_decode( link.Value( )); notifications->push_back( notification ); } @@ -526,12 +526,12 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess } catch (Reader::ParseException& e) { - proto->Log( "!!!!! Caught json::ParseException: %s", e.what() ); + proto->Log( "!!!!! Caught json::ParseException: %s", e.what()); proto->Log( " Line/offset: %d/%d", e.m_locTokenBegin.m_nLine + 1, e.m_locTokenBegin.m_nLineOffset + 1 ); } catch (const Exception& e) { - proto->Log ( "!!!!! Caught json::Exception: %s", e.what() ); + proto->Log ( "!!!!! Caught json::Exception: %s", e.what()); } return EXIT_SUCCESS; diff --git a/protocols/FacebookRM/list.hpp b/protocols/FacebookRM/list.hpp index 597a2b413e..7a26aec1ec 100644 --- a/protocols/FacebookRM/list.hpp +++ b/protocols/FacebookRM/list.hpp @@ -86,7 +86,7 @@ namespace List void insert( Item< T >* item ) { - if ( this->empty( ) ) + if ( this->empty( )) { this->first = this->last = item; this->count = 1; diff --git a/protocols/FacebookRM/main.cpp b/protocols/FacebookRM/main.cpp index b6f4c3af1b..8725af285e 100644 --- a/protocols/FacebookRM/main.cpp +++ b/protocols/FacebookRM/main.cpp @@ -98,7 +98,7 @@ static int protoUninit(PROTO_INTERFACE* proto) int OnModulesLoaded(WPARAM,LPARAM) { - if ( ServiceExists( MS_UPDATE_REGISTER ) ) + if ( ServiceExists( MS_UPDATE_REGISTER )) { Update upd = {sizeof(upd)}; char curr_version[30]; @@ -114,7 +114,7 @@ int OnModulesLoaded(WPARAM,LPARAM) #else upd.szBetaUpdateURL = "http://robyer.info/stahni/facebookRM.zip"; #endif - upd.pbVersion = reinterpret_cast(CreateVersionStringPluginEx(&pluginInfo,curr_version) ); + upd.pbVersion = reinterpret_cast(CreateVersionStringPluginEx(&pluginInfo,curr_version)); upd.cpbVersion = (int)strlen(reinterpret_cast(upd.pbVersion)); CallService(MS_UPDATE_REGISTER,0,(LPARAM)&upd); } @@ -134,7 +134,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) mir_getLP(&pluginInfo); pcli = reinterpret_cast( CallService( - MS_CLIST_RETRIEVE_INTERFACE,0,reinterpret_cast(g_hInstance)) ); + MS_CLIST_RETRIEVE_INTERFACE,0,reinterpret_cast(g_hInstance))); PROTOCOLDESCRIPTOR pd = { 0 }; pd.cbSize = sizeof(pd); diff --git a/protocols/FacebookRM/messages.cpp b/protocols/FacebookRM/messages.cpp index def7a6b64b..1f6d80a6d5 100644 --- a/protocols/FacebookRM/messages.cpp +++ b/protocols/FacebookRM/messages.cpp @@ -26,9 +26,9 @@ int FacebookProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) { DBVARIANT dbv; - if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) { - ForkThread( &FacebookProto::MessagingWorker, this, new send_messaging(dbv.pszVal, FACEBOOK_RECV_MESSAGE ) ); + ForkThread( &FacebookProto::MessagingWorker, this, new send_messaging(dbv.pszVal, FACEBOOK_RECV_MESSAGE )); DBFreeVariant(&dbv); } @@ -49,11 +49,11 @@ void FacebookProto::SendMsgWorker(void *p) DBVARIANT dbv; - if ( !isOnline( ) ) + if ( !isOnline( )) { ProtoBroadcastAck(m_szModuleName, data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, data->msgid, (LPARAM)Translate("You cannot send messages when you are offline.")); } - else if ( !DBGetContactSettingString(data->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + else if ( !DBGetContactSettingString(data->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) { int retries = 5; std::string error_text = ""; @@ -64,7 +64,7 @@ void FacebookProto::SendMsgWorker(void *p) } if (result) { ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_SUCCESS, data->msgid,0); - MessagingWorker( new send_messaging(dbv.pszVal, FACEBOOK_SEND_MESSAGE ) ); + MessagingWorker( new send_messaging(dbv.pszVal, FACEBOOK_SEND_MESSAGE )); } else { char *err = mir_utf8decodeA(error_text.c_str()); ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED, data->msgid,(LPARAM)err); @@ -118,7 +118,7 @@ int FacebookProto::SendMsg(HANDLE hContact, int flags, const char *msg) msg = mir_utf8encode(msg); facy.msgid_ = (facy.msgid_ % 1024)+1; - ForkThread( &FacebookProto::SendMsgWorker, this,new send_direct(hContact,msg,(HANDLE)facy.msgid_) ); + ForkThread( &FacebookProto::SendMsgWorker, this,new send_direct(hContact,msg,(HANDLE)facy.msgid_)); return facy.msgid_; } @@ -146,14 +146,14 @@ void FacebookProto::SendTypingWorker(void *p) facy.is_typing_ = (typing->status == PROTOTYPE_SELFTYPING_ON); SleepEx( 2000, true ); - if ( !facy.is_typing_ == (typing->status == PROTOTYPE_SELFTYPING_ON) ) + if ( !facy.is_typing_ == (typing->status == PROTOTYPE_SELFTYPING_ON)) { delete typing; return; } DBVARIANT dbv; - if ( !DBGetContactSettingString(typing->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if ( !DBGetContactSettingString(typing->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) { std::string data = "typ="; data += ( typing->status == PROTOTYPE_SELFTYPING_ON ) ? "1" : "0"; // PROTOTYPE_SELFTYPING_OFF @@ -162,7 +162,7 @@ void FacebookProto::SendTypingWorker(void *p) data += "&source=mercury-chat"; data += "&fb_dtsg=" + facy.dtsg_; data += "&post_form_id="; - data += ( facy.post_form_id_.length( ) ) ? facy.post_form_id_ : "0"; + data += ( facy.post_form_id_.length( )) ? facy.post_form_id_ : "0"; data += "&post_form_id_source=AsyncRequest&lsd=&phstamp=0&__user="; data += facy.self_.user_id; @@ -184,7 +184,7 @@ void FacebookProto::MessagingWorker(void *p) if (data->type == FACEBOOK_RECV_MESSAGE) facy.chat_mark_read( data->user_id ); -// if ( DBGetContactSettingByte(NULL, m_szModuleName, FACEBOOK_KEY_CLOSE_WINDOWS_ENABLE, DEFAULT_CLOSE_WINDOWS_ENABLE ) ) +// if ( DBGetContactSettingByte(NULL, m_szModuleName, FACEBOOK_KEY_CLOSE_WINDOWS_ENABLE, DEFAULT_CLOSE_WINDOWS_ENABLE )) // facy.close_chat( data->user_id ); delete data; diff --git a/protocols/FacebookRM/process.cpp b/protocols/FacebookRM/process.cpp index 09bdd2ac79..f8ffa7e1ce 100644 --- a/protocols/FacebookRM/process.cpp +++ b/protocols/FacebookRM/process.cpp @@ -31,7 +31,7 @@ void FacebookProto::ProcessBuddyList( void* data ) std::string* resp = (std::string*)data; - if ( isOffline() ) + if ( isOffline()) goto exit; LOG("***** Starting processing buddy list"); @@ -81,7 +81,7 @@ void FacebookProto::ProcessBuddyList( void* data ) } // Wasn't contact removed from "server-list" someday? - if ( DBGetContactSettingDword(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED, 0) ) { + if ( DBGetContactSettingDword(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) { DBDeleteContactSetting(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED); std::string url = FACEBOOK_URL_PROFILE + fbu->user_id; @@ -131,14 +131,14 @@ void FacebookProto::ProcessFriendList( void* data ) // Check and update old contacts for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); hContact; - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0) ) + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)) { if (!IsMyContact(hContact)) continue; DBVARIANT dbv; facebook_user *fbu; - if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { + if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) { std::string id = dbv.pszVal; DBFreeVariant(&dbv); @@ -158,9 +158,9 @@ void FacebookProto::ProcessFriendList( void* data ) DBWriteContactSettingByte(hContact, m_szModuleName, "Gender", fbu->gender); // Update real name - if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv) ) + if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) { - update_required = strcmp( dbv.pszVal, fbu->real_name.c_str() ) != 0; + update_required = strcmp( dbv.pszVal, fbu->real_name.c_str()) != 0; DBFreeVariant(&dbv); } if ( update_required ) @@ -175,7 +175,7 @@ void FacebookProto::ProcessFriendList( void* data ) } // Wasn't contact removed from "server-list" someday? - if ( DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0) ) { + if ( DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) { DBDeleteContactSetting(hContact, m_szModuleName, FACEBOOK_KEY_DELETED); std::string url = FACEBOOK_URL_PROFILE + fbu->user_id; @@ -204,7 +204,7 @@ void FacebookProto::ProcessFriendList( void* data ) DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE); std::string contactname = id; - if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv) ) { + if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) { contactname = dbv.pszVal; DBFreeVariant(&dbv); } @@ -253,7 +253,7 @@ void FacebookProto::ProcessUnreadMessages( void* ) std::string get_data = "sk=inbox&query=is%3Aunread"; std::string data = "post_form_id="; - data += ( facy.post_form_id_.length( ) ) ? facy.post_form_id_ : "0"; + data += ( facy.post_form_id_.length( )) ? facy.post_form_id_ : "0"; data += "&fb_dtsg=" + facy.dtsg_; data += "&post_form_id_source=AsyncRequest&lsd=&phstamp="; data += utils::time::mili_timestamp(); @@ -277,7 +277,7 @@ void FacebookProto::ProcessUnreadMessages( void* ) std::string::size_type pos = 0; - while ( ( pos = threadlist.find( "
  • ", pos ); std::string thread_content = threadlist.substr( pos, pos2 - pos ); @@ -313,7 +313,7 @@ void FacebookProto::ProcessUnreadMessages( void* ) // TODO: maybe create new "receiveMsg" function and use it for offline and channel messages? pos2 = 0; - while ( ( pos2 = messageslist.find( "class=\\\"MessagingMessage ", pos2 ) ) != std::string::npos ) { + while ( ( pos2 = messageslist.find( "class=\\\"MessagingMessage ", pos2 )) != std::string::npos ) { pos2 += 8; std::string strclass = messageslist.substr(pos2, messageslist.find("\\\"", pos2) - pos2); @@ -325,10 +325,10 @@ void FacebookProto::ProcessUnreadMessages( void* ) std::string messagesgroup = messageslist.substr( pos2, pos3 - pos2 ); DWORD timestamp = utils::conversion::to_timestamp( - utils::text::source_get_value( &messagesgroup, 2, "data-utime=\\\"", "\\\"" ) ); + utils::text::source_get_value( &messagesgroup, 2, "data-utime=\\\"", "\\\"" )); pos3 = 0; - while ( ( pos3 = messagesgroup.find( "class=\\\"content noh", pos3 ) ) != std::string::npos ) + while ( ( pos3 = messagesgroup.find( "class=\\\"content noh", pos3 )) != std::string::npos ) { std::string message_attachments = ""; @@ -337,17 +337,17 @@ void FacebookProto::ProcessUnreadMessages( void* ) std::string attachments = messagesgroup.substr( pos4, messagesgroup.find("<\\/ul", pos4) - pos4 ); pos4 = 0; - while ( ( pos4 = attachments.find("", pos4) - pos4 ); std::string link = utils::text::source_get_value( &attachment, 4, "", "<\\/a>" ); std::string name = utils::text::trim( utils::text::special_expressions_decode( - utils::text::remove_html( attachment ) ) ); + utils::text::remove_html( attachment )) ); if (link.find("/ajax/messaging/attachments/photo/dialog.php?uri=") != std::string::npos) { link = link.substr(49); @@ -366,7 +366,7 @@ void FacebookProto::ProcessUnreadMessages( void* ) message_text = utils::text::source_get_value( &message_text, 2, "\\\">", "<\\/div" ); message_text = utils::text::trim( utils::text::special_expressions_decode( - utils::text::remove_html( message_text ) ) ); + utils::text::remove_html( message_text )) ); if (!message_attachments.empty()) { if (!message_text.empty()) @@ -404,7 +404,7 @@ void FacebookProto::ProcessMessages( void* data ) std::string* resp = (std::string*)data; - if ( isOffline() ) + if ( isOffline()) goto exit; LOG("***** Starting processing messages"); @@ -476,7 +476,7 @@ exit: void FacebookProto::ProcessNotifications( void* ) { - if ( isOffline() ) + if ( isOffline()) return; if (!getByte( FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE )) @@ -643,7 +643,7 @@ void FacebookProto::ProcessFeeds( void* data ) *resp = utils::text::slashu_to_utf8(*resp); *resp = utils::text::source_get_value(resp, 2, "\"html\":\"", ">\""); - while ( ( pos = resp->find( "
    find( "
    find( "
    title = utils::text::trim( utils::text::special_expressions_decode( - utils::text::remove_html( post_header ) ) ); + utils::text::remove_html( post_header )) ); nf->user_id = utils::text::source_get_value( &post_header, 2, "user.php?id=", "\\\"" ); nf->link = utils::text::special_expressions_decode( - utils::text::source_get_value( &post_link, 2, "href=\\\"", "\\\">" ) ); + utils::text::source_get_value( &post_link, 2, "href=\\\"", "\\\">" )); nf->text = utils::text::trim( utils::text::special_expressions_decode( utils::text::remove_html( - utils::text::edit_html( post_message ) ) ) ); + utils::text::edit_html( post_message )) )); - if ( !nf->title.length() || !nf->text.length() ) + if ( !nf->title.length() || !nf->text.length()) { delete nf; continue; diff --git a/protocols/FacebookRM/proto.cpp b/protocols/FacebookRM/proto.cpp index e51a39f1dd..cc5f446662 100644 --- a/protocols/FacebookRM/proto.cpp +++ b/protocols/FacebookRM/proto.cpp @@ -69,9 +69,9 @@ FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username) facy.set_handle(m_hNetlibUser); - SkinAddNewSoundExT( "Notification", m_tszUserName, LPGENT( "Notification" ) ); - SkinAddNewSoundExT( "NewsFeed", m_tszUserName, LPGENT( "News Feed" ) ); - SkinAddNewSoundExT( "OtherEvent", m_tszUserName, LPGENT( "Other Event" ) ); + SkinAddNewSoundExT( "Notification", m_tszUserName, LPGENT( "Notification" )); + SkinAddNewSoundExT( "NewsFeed", m_tszUserName, LPGENT( "News Feed" )); + SkinAddNewSoundExT( "OtherEvent", m_tszUserName, LPGENT( "Other Event" )); TCHAR *profile = Utils_ReplaceVarsT( _T("%miranda_avatarcache%")); def_avatar_folder_ = std::tstring(profile) + _T("\\") + m_tszUserName; @@ -115,7 +115,7 @@ DWORD_PTR FacebookProto::GetCaps( int type, HANDLE hContact ) { DWORD_PTR flags = PF1_IM | PF1_CHAT | PF1_SERVERCLIST | PF1_AUTHREQ | /*PF1_ADDED |*/ PF1_BASICSEARCH | PF1_USERIDISEMAIL | PF1_SEARCHBYEMAIL | PF1_SEARCHBYNAME | PF1_ADDSEARCHRES; // | PF1_VISLIST | PF1_INVISLIST; - if ( getByte( FACEBOOK_KEY_SET_MIRANDA_STATUS, 0 ) ) + if ( getByte( FACEBOOK_KEY_SET_MIRANDA_STATUS, 0 )) return flags |= PF1_MODEMSG; else return flags |= PF1_MODEMSGRECV; @@ -123,7 +123,7 @@ DWORD_PTR FacebookProto::GetCaps( int type, HANDLE hContact ) case PFLAGNUM_2: return PF2_ONLINE | PF2_INVISIBLE | PF2_ONTHEPHONE | PF2_IDLE; // | PF2_SHORTAWAY; case PFLAGNUM_3: - if ( getByte( FACEBOOK_KEY_SET_MIRANDA_STATUS, 0 ) ) + if ( getByte( FACEBOOK_KEY_SET_MIRANDA_STATUS, 0 )) return PF2_ONLINE; // | PF2_SHORTAWAY; else return 0; @@ -222,7 +222,7 @@ int FacebookProto::SetAwayMsg( int status, const PROTOCHAR *msg ) void FacebookProto::SetAwayMsgWorker(void *) { - if ( !last_status_msg_.empty() ) + if ( !last_status_msg_.empty()) facy.set_status( last_status_msg_ ); } @@ -446,7 +446,7 @@ int FacebookProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) int FacebookProto::OnMind(WPARAM,LPARAM) { HWND hDlg = CreateDialogParam( g_hInstance, MAKEINTRESOURCE( IDD_MIND ), - ( HWND )0, FBMindProc, reinterpret_cast( this ) ); + ( HWND )0, FBMindProc, reinterpret_cast( this )); ShowWindow( hDlg, SW_SHOW ); return FALSE; } @@ -456,7 +456,7 @@ int FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) HANDLE hContact = reinterpret_cast(wParam); DBVARIANT dbv; - if ( wParam != 0 && !DBGetContactSettingString(hContact,m_szModuleName,"Homepage",&dbv) ) + if ( wParam != 0 && !DBGetContactSettingString(hContact,m_szModuleName,"Homepage",&dbv)) { CallService(MS_UTILS_OPENURL,1,reinterpret_cast(dbv.pszVal)); DBFreeVariant(&dbv); @@ -494,22 +494,22 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) DBVARIANT dbv; TCHAR tstr[256]; - if ( !DBGetContactSettingTString(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv) ) { + if ( !DBGetContactSettingTString(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) { mir_sntprintf(tstr,SIZEOF(tstr),TranslateT("Do you want to cancel your friendship with '%s'?"), dbv.ptszVal); DBFreeVariant(&dbv); - } else if ( !DBGetContactSettingTString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { + } else if ( !DBGetContactSettingTString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) { mir_sntprintf(tstr,SIZEOF(tstr),TranslateT("Do you want to cancel your friendship with '%s'?"), dbv.ptszVal); DBFreeVariant(&dbv); } if (MessageBox( 0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) == IDYES) { - if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) { std::string* id = new std::string(dbv.pszVal); if (deleting) { - facebook_user* fbu = facy.buddies.find( (*id) ); + facebook_user* fbu = facy.buddies.find( (*id)); if (fbu != NULL) { fbu->handle = NULL; } @@ -532,7 +532,7 @@ int FacebookProto::RequestFriendship(WPARAM wParam,LPARAM lParam) HANDLE hContact = reinterpret_cast(wParam); DBVARIANT dbv; - if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) { std::string* id = new std::string(dbv.pszVal); ForkThread( &FacebookProto::AddContactToServer, this, ( void* )id ); diff --git a/protocols/FacebookRM/theme.cpp b/protocols/FacebookRM/theme.cpp index 02c28a4b8e..c3d2fca65b 100644 --- a/protocols/FacebookRM/theme.cpp +++ b/protocols/FacebookRM/theme.cpp @@ -117,7 +117,7 @@ HANDLE g_hContactMenuSvc[CMITEMS_COUNT]; static FacebookProto * GetInstanceByHContact(HANDLE hContact) { char *proto = reinterpret_cast( CallService(MS_PROTO_GETCONTACTBASEPROTO, - reinterpret_cast(hContact),0) ); + reinterpret_cast(hContact),0)); if(!proto) return 0; diff --git a/protocols/FacebookRM/utils.cpp b/protocols/FacebookRM/utils.cpp index e34238a372..8e33b26e01 100644 --- a/protocols/FacebookRM/utils.cpp +++ b/protocols/FacebookRM/utils.cpp @@ -25,7 +25,7 @@ along with this program. If not, see . std::string utils::url::encode(const std::string &s) { char *encoded = reinterpret_cast(CallService( MS_NETLIB_URLENCODE, - 0,reinterpret_cast(s.c_str()) )); + 0,reinterpret_cast(s.c_str()))); std::string ret = encoded; HeapFree(GetProcessHeap(),0,encoded); @@ -114,7 +114,7 @@ void utils::text::replace_all( std::string* data, std::string from, std::string { std::string::size_type position = 0; - while ( ( position = data->find( from, position ) ) != std::string::npos ) + while ( ( position = data->find( from, position )) != std::string::npos ) { data->replace( position, from.size(), to ); position++; @@ -126,7 +126,7 @@ unsigned int utils::text::count_all( std::string* data, std::string term ) unsigned int count = 0; std::string::size_type position = 0; - while ( ( position = data->find( term, position ) ) != std::string::npos ) + while ( ( position = data->find( term, position )) != std::string::npos ) { count++; position++; @@ -282,14 +282,14 @@ std::string utils::text::slashu_to_utf8( std::string data ) if ( udn >= 128 && udn <= 2047 ) { // U+0080 .. U+07FF - new_string += ( char )( 192 + ( udn / 64 ) ); - new_string += ( char )( 128 + ( udn % 64 ) ); + new_string += ( char )( 192 + ( udn / 64 )); + new_string += ( char )( 128 + ( udn % 64 )); } else if ( udn >= 2048 && udn <= 65535 ) { // U+0800 .. U+FFFF - new_string += ( char )( 224 + ( udn / 4096 ) ); - new_string += ( char )( 128 + ( ( udn / 64 ) % 64 ) ); - new_string += ( char )( 128 + ( udn % 64 ) ); + new_string += ( char )( 224 + ( udn / 4096 )); + new_string += ( char )( 128 + ( ( udn / 64 ) % 64 )); + new_string += ( char )( 128 + ( udn % 64 )); } else if ( udn <= 127 ) { // U+0000 .. U+007F (should not appear) @@ -380,7 +380,7 @@ std::string utils::text::source_get_value2( std::string* data, const char *term, int utils::number::random( ) { - srand( ::time( NULL ) ); + srand( ::time( NULL )); return rand( ); } @@ -389,7 +389,7 @@ int utils::debug::log(std::string file_name, std::string text) char szFile[MAX_PATH]; GetModuleFileNameA(g_hInstance, szFile, SIZEOF(szFile)); std::string path = szFile; - path = path.substr( 0, path.rfind( "\\" ) ); + path = path.substr( 0, path.rfind( "\\" )); path = path.substr( 0, path.rfind( "\\" ) + 1 ); path = path + file_name.c_str() + ".txt"; -- cgit v1.2.3