From dee5ce2a65db4c11371a565cbfac0fe082949776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 9 Sep 2012 07:29:38 +0000 Subject: Partial fix for setting machine name at login. Miranda IM -> Miranda NG git-svn-id: http://svn.miranda-ng.org/main/trunk@1550 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/client.h | 2 +- protocols/FacebookRM/communication.cpp | 16 ++++++++-------- protocols/FacebookRM/main.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'protocols') diff --git a/protocols/FacebookRM/client.h b/protocols/FacebookRM/client.h index 2e854c2c98..d11cf0ab55 100644 --- a/protocols/FacebookRM/client.h +++ b/protocols/FacebookRM/client.h @@ -164,7 +164,7 @@ public: // HTTP communication - http::response flap( const int request_type, std::string* request_data = NULL, std::string* request_get_data = NULL ); + http::response flap( const int request_type, std::string* request_data = NULL, std::string* request_get_data = NULL, int method = 0 ); bool save_url(const std::string &url,const std::tstring &filename, HANDLE &nlc); DWORD choose_security_level( int ); diff --git a/protocols/FacebookRM/communication.cpp b/protocols/FacebookRM/communication.cpp index 7cbaed3f8d..5f61fee42d 100644 --- a/protocols/FacebookRM/communication.cpp +++ b/protocols/FacebookRM/communication.cpp @@ -27,10 +27,10 @@ void facebook_client::client_notify( TCHAR* message ) parent->NotifyEvent( parent->m_tszUserName, message, NULL, FACEBOOK_EVENT_CLIENT ); } -http::response facebook_client::flap( const int request_type, std::string* request_data, std::string* request_get_data ) +http::response facebook_client::flap( const int request_type, std::string* request_data, std::string* request_get_data, int method ) { NETLIBHTTPREQUEST nlhr = {sizeof( NETLIBHTTPREQUEST )}; - nlhr.requestType = choose_method( request_type ); + nlhr.requestType = !method ? choose_method( request_type ) : method; std::string url = choose_request_url( request_type, request_data, request_get_data ); nlhr.szUrl = (char*)url.c_str( ); nlhr.flags = NLHRF_HTTP11 | NLHRF_NODUMP | choose_security_level( request_type ); @@ -615,31 +615,31 @@ bool facebook_client::login(const std::string &username,const std::string &passw // Check whether setting Machine name is required if ( resp.headers["Location"].find("/checkpoint/") != std::string::npos ) { - resp = flap( FACEBOOK_REQUEST_SETUP_MACHINE ); + resp = flap( FACEBOOK_REQUEST_SETUP_MACHINE, NULL, NULL, REQUEST_GET ); std::string inner_data; if (resp.data.find("name=\"submit[Continue]\"") != std::string::npos) { // Multi step with approving last unrecognized device // 1) Continue inner_data = "submit[Continue]=Continue"; - inner_data += "&lsd=" + utils::text::source_get_value(&resp.data, 3, "name=\"lsd\"", "value=\"", "\"" ); inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"" ); + inner_data += "&fb_dtsg=" + utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"" ); resp = flap( FACEBOOK_REQUEST_SETUP_MACHINE, &inner_data ); // 2) Approve last unknown login // inner_data = "submit[I%20don't%20recognize]=I%20don't%20recognize"; // Don't recognize - this will force to change account password inner_data = "submit[This%20is%20Okay]=This%20is%20Okay"; // Recognize - inner_data += "&lsd=" + utils::text::source_get_value(&resp.data, 3, "name=\"lsd\"", "value=\"", "\"" ); inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"" ); + inner_data += "&fb_dtsg=" + utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"" ); resp = flap( FACEBOOK_REQUEST_SETUP_MACHINE, &inner_data ); } // Save actual machine name - // inner_data = "machine_name=Miranda%20IM&submit[Don't%20Save]=Don't%20Save"; // Don't save - inner_data = "machine_name=Miranda%20IM&submit[Save%20Device]=Save%20Device"; // Save - inner_data += "&post_form_id=" + utils::text::source_get_value(&resp.data, 3, "name=\"post_form_id\"", "value=\"", "\"" ); + // inner_data = "machine_name=Miranda%20NG&submit[Don't%20Save]=Don't%20Save"; // Don't save + inner_data = "machine_name=Miranda%20NG&submit[Save%20Device]=Save%20Device"; // Save inner_data += "&lsd=" + utils::text::source_get_value(&resp.data, 3, "name=\"lsd\"", "value=\"", "\"" ); inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"" ); + inner_data += "&fb_dtsg=" + utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"" ); resp = flap( FACEBOOK_REQUEST_SETUP_MACHINE, &inner_data ); validate_response(&resp); diff --git a/protocols/FacebookRM/main.cpp b/protocols/FacebookRM/main.cpp index 9e58374232..5928b85499 100644 --- a/protocols/FacebookRM/main.cpp +++ b/protocols/FacebookRM/main.cpp @@ -113,7 +113,7 @@ extern "C" int __declspec(dllexport) Load(void) { std::stringstream agent; // DWORD mir_ver = ( DWORD )CallService( MS_SYSTEM_GETVERSION, NULL, NULL ); - agent << "MirandaIM/"; + agent << "MirandaNG/"; agent << (( g_mirandaVersion >> 24) & 0xFF); agent << "."; agent << (( g_mirandaVersion >> 16) & 0xFF); -- cgit v1.2.3