diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-22 17:28:49 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-22 17:28:49 +0300 |
commit | 70437dd0ee5856d76a1000aad4633be7e10f8362 (patch) | |
tree | 94aedd2a8bf4ea0f643a2577ac1d007925b39346 /protocols/FacebookRM | |
parent | 0a3685cbd7415509472e54c496ff10d7c1889131 (diff) |
Facebook: minor code cleaning
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/src/http_request.cpp | 45 | ||||
-rw-r--r-- | protocols/FacebookRM/src/http_request.h | 44 |
2 files changed, 48 insertions, 41 deletions
diff --git a/protocols/FacebookRM/src/http_request.cpp b/protocols/FacebookRM/src/http_request.cpp index 3e9f8ff53c..8c2a42c19c 100644 --- a/protocols/FacebookRM/src/http_request.cpp +++ b/protocols/FacebookRM/src/http_request.cpp @@ -17,6 +17,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" +HttpRequest::HttpRequest(int type, LPCSTR url) +{ + m_szUrl = url; + flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_DUMPASTEXT; + requestType = type; + timeout = 600 * 1000; + + NotifyErrors = true; + Persistent = DEFAULT; +} + +HttpRequest::HttpRequest(int type, CMStringDataFormat, LPCSTR urlFormat, ...) +{ + m_szUrl.AppendFormatV(urlFormat, (va_start(formatArgs, urlFormat), formatArgs)); + flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_DUMPASTEXT; + requestType = type; + va_end(formatArgs); + timeout = 20 * 1000; + + NotifyErrors = true; + Persistent = DEFAULT; +} + +NETLIBHTTPREQUEST* HttpRequest::Send(HNETLIBUSER nlu) +{ + if (m_szUrl.Find("://") == -1) + m_szUrl.Insert(0, ((flags & NLHRF_SSL) ? "https://" : "http://")); + if (!m_szParam.IsEmpty()) { + m_szUrl.AppendChar('?'); + m_szUrl += m_szParam; + } + szUrl = m_szUrl.GetBuffer(); + + if (!pData) { + pData = Body.ToString(); + dataLength = (int)mir_strlen(pData); + } + + Netlib_Logf(nlu, "Send request to %s", szUrl); + + return Netlib_HttpTransaction(nlu, this); +} + +///////////////////////////////////////////////////////////////////////////////////////// + HttpRequest::HttpRequestBody& HttpRequest::HttpRequestBody::operator<<(const char *str) { AppendSeparator(); diff --git a/protocols/FacebookRM/src/http_request.h b/protocols/FacebookRM/src/http_request.h index 8a6c1f146a..0c79573120 100644 --- a/protocols/FacebookRM/src/http_request.h +++ b/protocols/FacebookRM/src/http_request.h @@ -57,48 +57,10 @@ public: bool NotifyErrors; PersistentType Persistent; - HttpRequest(int type, LPCSTR url) - { - m_szUrl = url; - flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_DUMPASTEXT; - requestType = type; - timeout = 600 * 1000; - - NotifyErrors = true; - Persistent = DEFAULT; - } - - HttpRequest(int type, CMStringDataFormat, LPCSTR urlFormat, ...) - { - m_szUrl.AppendFormatV(urlFormat, (va_start(formatArgs, urlFormat), formatArgs)); - flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_DUMPASTEXT; - requestType = type; - va_end(formatArgs); - timeout = 20 * 1000; - - NotifyErrors = true; - Persistent = DEFAULT; - } - - virtual NETLIBHTTPREQUEST* Send(HNETLIBUSER nlu) - { - if (m_szUrl.Find("://") == -1) - m_szUrl.Insert(0, ((flags & NLHRF_SSL) ? "https://" : "http://")); - if (!m_szParam.IsEmpty()) { - m_szUrl.AppendChar('?'); - m_szUrl += m_szParam; - } - szUrl = m_szUrl.GetBuffer(); - - if (!pData) { - pData = Body.ToString(); - dataLength = (int)mir_strlen(pData); - } - - Netlib_Logf(nlu, "Send request to %s", szUrl); + HttpRequest(int type, LPCSTR url); + HttpRequest(int type, CMStringDataFormat, LPCSTR urlFormat, ...); - return Netlib_HttpTransaction(nlu, this); - } + NETLIBHTTPREQUEST* Send(HNETLIBUSER nlu); }; #endif //_HTTP_REQUEST_H_
\ No newline at end of file |