From 7f920402def20a9d2a3d95defc53877b2cbe2990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Wed, 2 Oct 2013 10:38:56 +0000 Subject: Facebook: get rid of validate_response forever git-svn-id: http://svn.miranda-ng.org/main/trunk@6305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/http.h | 82 ++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 38 deletions(-) (limited to 'protocols/FacebookRM/src/http.h') diff --git a/protocols/FacebookRM/src/http.h b/protocols/FacebookRM/src/http.h index 69dc4dc9c7..507658bff9 100644 --- a/protocols/FacebookRM/src/http.h +++ b/protocols/FacebookRM/src/http.h @@ -25,37 +25,37 @@ along with this program. If not, see . #define HTTP_PROTO_REGULAR "http://" #define HTTP_PROTO_SECURE "https://" -#define HTTP_CODE_CONTINUE 100 +#define HTTP_CODE_CONTINUE 100 #define HTTP_CODE_SWITCHING_PROTOCOLS 101 -#define HTTP_CODE_PROCESSING 102 -#define HTTP_CODE_OK 200 -#define HTTP_CODE_CREATED 201 -#define HTTP_CODE_ACCEPTED 202 +#define HTTP_CODE_PROCESSING 102 +#define HTTP_CODE_OK 200 +#define HTTP_CODE_CREATED 201 +#define HTTP_CODE_ACCEPTED 202 #define HTTP_CODE_NON_AUTHORITATIVE_INFORMATION 203 -#define HTTP_CODE_NO_CONTENT 204 -#define HTTP_CODE_RESET_CONTENT 205 -#define HTTP_CODE_PARTIAL_CONTENT 206 -#define HTTP_CODE_MULTI_STATUS 207 -#define HTTP_CODE_MULTIPLE_CHOICES 300 -#define HTTP_CODE_MOVED_PERMANENTLY 301 -#define HTTP_CODE_FOUND 302 -#define HTTP_CODE_SEE_OTHER 303 -#define HTTP_CODE_NOT_MODIFIED 304 -#define HTTP_CODE_USE_PROXY 305 -#define HTTP_CODE_SWITCH_PROXY 306 +#define HTTP_CODE_NO_CONTENT 204 +#define HTTP_CODE_RESET_CONTENT 205 +#define HTTP_CODE_PARTIAL_CONTENT 206 +#define HTTP_CODE_MULTI_STATUS 207 +#define HTTP_CODE_MULTIPLE_CHOICES 300 +#define HTTP_CODE_MOVED_PERMANENTLY 301 +#define HTTP_CODE_FOUND 302 +#define HTTP_CODE_SEE_OTHER 303 +#define HTTP_CODE_NOT_MODIFIED 304 +#define HTTP_CODE_USE_PROXY 305 +#define HTTP_CODE_SWITCH_PROXY 306 #define HTTP_CODE_TEMPORARY_REDIRECT 307 -#define HTTP_CODE_BAD_REQUEST 400 -#define HTTP_CODE_UNAUTHORIZED 401 -#define HTTP_CODE_PAYMENT_REQUIRED 402 -#define HTTP_CODE_FORBIDDEN 403 -#define HTTP_CODE_NOT_FOUND 404 +#define HTTP_CODE_BAD_REQUEST 400 +#define HTTP_CODE_UNAUTHORIZED 401 +#define HTTP_CODE_PAYMENT_REQUIRED 402 +#define HTTP_CODE_FORBIDDEN 403 +#define HTTP_CODE_NOT_FOUND 404 #define HTTP_CODE_METHOD_NOT_ALLOWED 405 -#define HTTP_CODE_NOT_ACCEPTABLE 406 +#define HTTP_CODE_NOT_ACCEPTABLE 406 #define HTTP_CODE_PROXY_AUTHENTICATION_REQUIRED 407 -#define HTTP_CODE_REQUEST_TIMEOUT 408 -#define HTTP_CODE_CONFLICT 409 -#define HTTP_CODE_GONE 410 -#define HTTP_CODE_LENGTH_REQUIRED 411 +#define HTTP_CODE_REQUEST_TIMEOUT 408 +#define HTTP_CODE_CONFLICT 409 +#define HTTP_CODE_GONE 410 +#define HTTP_CODE_LENGTH_REQUIRED 411 #define HTTP_CODE_PRECONDITION_REQUIRED 412 #define HTTP_CODE_REQUEST_ENTITY_TOO_LARGE 413 #define HTTP_CODE_REQUEST_URI_TOO_LONG 414 @@ -63,24 +63,24 @@ along with this program. If not, see . #define HTTP_CODE_REQUESTED_RANGE_NOT_SATISFIABLE 416 #define HTTP_CODE_EXPECTATION_FAILED 417 #define HTTP_CODE_UNPROCESSABLE_ENTITY 422 -#define HTTP_CODE_LOCKED 423 -#define HTTP_CODE_FAILED_DEPENDENCY 424 +#define HTTP_CODE_LOCKED 423 +#define HTTP_CODE_FAILED_DEPENDENCY 424 #define HTTP_CODE_UNORDERED_COLLECTION 425 -#define HTTP_CODE_UPGRADE_REQUIRED 426 -#define HTTP_CODE_RETRY_WITH 449 +#define HTTP_CODE_UPGRADE_REQUIRED 426 +#define HTTP_CODE_RETRY_WITH 449 #define HTTP_CODE_INTERNAL_SERVER_ERROR 500 -#define HTTP_CODE_NOT_IMPLEMENTED 501 -#define HTTP_CODE_BAD_GATEWAY 502 +#define HTTP_CODE_NOT_IMPLEMENTED 501 +#define HTTP_CODE_BAD_GATEWAY 502 #define HTTP_CODE_SERVICE_UNAVAILABLE 503 -#define HTTP_CODE_GATEWAY_TIMEOUT 504 +#define HTTP_CODE_GATEWAY_TIMEOUT 504 #define HTTP_CODE_HTTP_VERSION_NOT_SUPPORTED 505 #define HTTP_CODE_VARIANT_ALSO_NEGOTIATES 506 #define HTTP_CODE_INSUFFICIENT_STORAGE 507 #define HTTP_CODE_BANDWIDTH_LIMIT_EXCEEDED 509 -#define HTTP_CODE_NOT_EXTENDED 510 +#define HTTP_CODE_NOT_EXTENDED 510 -#define HTTP_CODE_FAKE_DISCONNECTED 0 -#define HTTP_CODE_FAKE_ERROR 1 +#define HTTP_CODE_FAKE_DISCONNECTED 0 +#define HTTP_CODE_FAKE_ERROR 1 namespace http { @@ -94,10 +94,16 @@ namespace http { response() : code(0), error_number(0) {} int code; + std::map< std::string, std::string > headers; + std::string data; + + // Facebook's error data unsigned int error_number; std::string error_text; std::string error_title; - std::map< std::string, std::string > headers; - std::string data; + + bool isValid() { + return (code == HTTP_CODE_OK && error_number == 0); + } }; } -- cgit v1.2.3