From aa6b2f434c204d6da1906f381c418bd8f0bca163 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 24 Oct 2015 18:54:18 +0000 Subject: Steam: - remove custom db event adding - add charset utf-8 to some of requests git-svn-id: http://svn.miranda-ng.org/main/trunk@15607 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/src/api/authorization.h | 2 +- protocols/Steam/src/api/friend_list.h | 6 +++--- protocols/Steam/src/api/login.h | 4 ++-- protocols/Steam/src/api/message.h | 2 +- protocols/Steam/src/api/pending.h | 6 +++--- protocols/Steam/src/api/poll.h | 2 +- protocols/Steam/src/api/rsa_key.h | 2 +- protocols/Steam/src/api/session.h | 2 +- protocols/Steam/src/steam_contacts.cpp | 6 +++++- protocols/Steam/src/steam_polling.cpp | 9 +++++---- protocols/Steam/src/steam_proto.cpp | 5 ----- protocols/Steam/src/steam_proto.h | 4 ---- protocols/Steam/src/steam_utils.cpp | 13 ------------- 13 files changed, 23 insertions(+), 40 deletions(-) (limited to 'protocols/Steam') diff --git a/protocols/Steam/src/api/authorization.h b/protocols/Steam/src/api/authorization.h index af0cdd4bf6..20e9f3ced9 100644 --- a/protocols/Steam/src/api/authorization.h +++ b/protocols/Steam/src/api/authorization.h @@ -9,7 +9,7 @@ public: { flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; - AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); AddHeader("Referer", STEAM_WEB_URL "/mobilelogin/dologin?oauth_client_id=3638BFB1&oauth_scope=read_profile%20write_profile%20read_client%20write_client"); AddHeader("Cookie", "mobileClientVersion=1291812;forceMobile=1;mobileClient=ios"); diff --git a/protocols/Steam/src/api/friend_list.h b/protocols/Steam/src/api/friend_list.h index c16a7d84bf..06dd886364 100644 --- a/protocols/Steam/src/api/friend_list.h +++ b/protocols/Steam/src/api/friend_list.h @@ -33,7 +33,7 @@ public: SetData(data, strlen(data)); AddHeader("Cookie", cookie); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; @@ -57,7 +57,7 @@ public: SetData(data, strlen(data)); AddHeader("Cookie", cookie); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; @@ -81,7 +81,7 @@ public: SetData(data, strlen(data)); AddHeader("Cookie", cookie); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; diff --git a/protocols/Steam/src/api/login.h b/protocols/Steam/src/api/login.h index 331822d260..ced52b065c 100644 --- a/protocols/Steam/src/api/login.h +++ b/protocols/Steam/src/api/login.h @@ -11,7 +11,7 @@ public: mir_snprintf(data, "access_token=%s&ui_mode=web", token); SetData(data, strlen(data)); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; @@ -25,7 +25,7 @@ public: mir_snprintf(data, "access_token=%s&umqid=%s", token, umqId); SetData(data, strlen(data)); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; diff --git a/protocols/Steam/src/api/message.h b/protocols/Steam/src/api/message.h index cb3a1f0590..4c3ec6c80f 100644 --- a/protocols/Steam/src/api/message.h +++ b/protocols/Steam/src/api/message.h @@ -15,7 +15,7 @@ public: ptrA(mir_urlEncode(text))); SetData(data, data.GetLength()); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; diff --git a/protocols/Steam/src/api/pending.h b/protocols/Steam/src/api/pending.h index b07e14f087..d878d34caa 100644 --- a/protocols/Steam/src/api/pending.h +++ b/protocols/Steam/src/api/pending.h @@ -18,7 +18,7 @@ public: SetData(data, strlen(data)); AddHeader("Cookie", cookie); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; @@ -39,7 +39,7 @@ public: SetData(data, strlen(data)); AddHeader("Cookie", cookie); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; @@ -60,7 +60,7 @@ public: SetData(data, strlen(data)); AddHeader("Cookie", cookie); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; diff --git a/protocols/Steam/src/api/poll.h b/protocols/Steam/src/api/poll.h index fec71c98e4..a196f35f1c 100644 --- a/protocols/Steam/src/api/poll.h +++ b/protocols/Steam/src/api/poll.h @@ -21,7 +21,7 @@ public: SetData(data, data.GetLength()); AddHeader("Connection", "keep-alive"); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; diff --git a/protocols/Steam/src/api/rsa_key.h b/protocols/Steam/src/api/rsa_key.h index 5efdec2839..c9c826b18b 100644 --- a/protocols/Steam/src/api/rsa_key.h +++ b/protocols/Steam/src/api/rsa_key.h @@ -9,7 +9,7 @@ public: { flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; - AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); CMStringA data; data.AppendFormat("username=%s&donotcache=%lld", ptrA(mir_urlEncode(username)), time(NULL)); diff --git a/protocols/Steam/src/api/session.h b/protocols/Steam/src/api/session.h index 5499d33c74..caf965803e 100644 --- a/protocols/Steam/src/api/session.h +++ b/protocols/Steam/src/api/session.h @@ -17,7 +17,7 @@ public: cookie); SetData(data, strlen(data)); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); } }; diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 4d1a2bc498..8b3171298d 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -651,7 +651,11 @@ void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg) pCurBlob += mir_strlen(steamId) + 1; mir_strcpy((char*)pCurBlob, reason); - AddDBEvent(hContact, EVENTTYPE_AUTHREQUEST, time(NULL), DBEF_UTF, cbBlob, pBlob); + PROTORECVEVENT recv = { 0 }; + recv.timestamp = time(NULL); + recv.szMessage = (char*)pBlob; + recv.lParam = cbBlob; + Proto_AuthRecv(m_szModuleName, &recv); } json_delete(nodes); diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 975c008e77..d353ffaccb 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -32,16 +32,17 @@ void CSteamProto::ParsePollData(JSONNode *data) ptrT text(json_as_string(node)); T2Utf szMessage(text); + PROTORECVEVENT recv = { 0 }; + recv.timestamp = timestamp; + recv.szMessage = szMessage; if (_tcsstr(type, _T("my_")) == NULL) { - PROTORECVEVENT recv = { 0 }; - recv.timestamp = timestamp; - recv.szMessage = szMessage; ProtoChainRecvMsg(hContact, &recv); } else { - AddDBEvent(hContact, EVENTTYPE_MESSAGE, timestamp, DBEF_UTF | DBEF_SENT, (int)mir_strlen(szMessage) + 1, (PBYTE)(char*)szMessage); + recv.flags = PREF_SENT; + Proto_RecvMessage(hContact, &recv); } } else if (!lstrcmpi(type, _T("typing"))) diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index da4f58083e..d4364da17f 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -237,11 +237,6 @@ HANDLE CSteamProto::SearchBasic(const TCHAR* id) return (HANDLE)STEAM_SEARCH_BYID; } -int CSteamProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre) -{ - return (INT_PTR)AddDBEvent(hContact, EVENTTYPE_MESSAGE, pre->timestamp, DBEF_UTF, (DWORD)mir_strlen(pre->szMessage), (BYTE*)pre->szMessage); -} - int CSteamProto::SendMsg(MCONTACT hContact, int, const char *message) { if (!IsOnline()) diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 2b9ae01492..5f7f081f92 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -53,8 +53,6 @@ public: virtual HANDLE __cdecl SearchBasic(const TCHAR *id); - virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg); virtual int __cdecl SetStatus(int iNewStatus); @@ -208,8 +206,6 @@ protected: static int RsaEncrypt(const char *pszModulus, const char *data, BYTE *encrypted, DWORD &encryptedSize); - MEVENT AddDBEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob); - static void CSteamProto::ShowNotification(const TCHAR *message, int flags = 0, MCONTACT hContact = NULL); static void CSteamProto::ShowNotification(const TCHAR *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL); diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index fa43e141b2..33ac3f8bde 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -159,19 +159,6 @@ exit: return 0; } -MEVENT CSteamProto::AddDBEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) -{ - DBEVENTINFO dbei = { sizeof(dbei) }; - dbei.szModule = m_szModuleName; - dbei.timestamp = timestamp; - dbei.eventType = type; - dbei.cbBlob = cbBlob; - dbei.pBlob = pBlob; - dbei.flags = flags; - - return db_event_add(hContact, &dbei); -} - void CSteamProto::ShowNotification(const TCHAR *caption, const wchar_t *message, int flags, MCONTACT hContact) { if (Miranda_Terminated()) -- cgit v1.2.3