diff options
Diffstat (limited to 'protocols/Discord/src')
-rw-r--r-- | protocols/Discord/src/avatars.cpp | 2 | ||||
-rw-r--r-- | protocols/Discord/src/gateway.cpp | 2 | ||||
-rw-r--r-- | protocols/Discord/src/main.cpp | 1 | ||||
-rw-r--r-- | protocols/Discord/src/proto.h | 53 | ||||
-rw-r--r-- | protocols/Discord/src/utils.cpp | 34 | ||||
-rw-r--r-- | protocols/Discord/src/version.h | 1 |
6 files changed, 2 insertions, 91 deletions
diff --git a/protocols/Discord/src/avatars.cpp b/protocols/Discord/src/avatars.cpp index d2b629e442..73c5b49da4 100644 --- a/protocols/Discord/src/avatars.cpp +++ b/protocols/Discord/src/avatars.cpp @@ -191,7 +191,7 @@ INT_PTR CDiscordProto::SetMyAvatar(WPARAM, LPARAM lParam) ptrA szFileContents((char*)mir_alloc(iFileLength)); fread(szFileContents, 1, iFileLength, in); fclose(in); - szPayload.Append(ptrA(mir_base64_encode((BYTE*)szFileContents.get(), iFileLength))); + szPayload.Append(ptrA(mir_base64_encode(szFileContents.get(), iFileLength))); JSONNode root; root << CHAR_PARAM("avatar", szPayload); Push(new AsyncHttpRequest(this, REQUEST_PATCH, "/users/@me", nullptr, &root)); diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp index 0f59b9382e..228e6bad25 100644 --- a/protocols/Discord/src/gateway.cpp +++ b/protocols/Discord/src/gateway.cpp @@ -220,7 +220,7 @@ void CDiscordProto::GatewayThreadWorker() debugLogA("Got packet: buffer = %d, opcode = %d, headerSize = %d, final = %d, masked = %d", bufSize, hdr.opCode, hdr.headerSize, hdr.bIsFinal, hdr.bIsMasked); // we have some additional data, not only opcode - if (bufSize > hdr.headerSize) { + if ((size_t)bufSize > hdr.headerSize) { size_t currPacketSize = bufSize - hdr.headerSize; netbuf.append(buf, bufSize); while (currPacketSize < hdr.payloadSize) { diff --git a/protocols/Discord/src/main.cpp b/protocols/Discord/src/main.cpp index 808354befb..24c2b8e7b5 100644 --- a/protocols/Discord/src/main.cpp +++ b/protocols/Discord/src/main.cpp @@ -34,7 +34,6 @@ PLUGININFOEX pluginInfo = { PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), __DESCRIPTION, __AUTHOR, - __AUTHOREMAIL, __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index 56c04ef157..5970ce26d3 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -26,64 +26,11 @@ struct AsyncHttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject void *pUserInfo; }; -struct PARAM -{ - LPCSTR szName; - __forceinline PARAM(LPCSTR _name) : szName(_name) - {} -}; - -struct BOOL_PARAM : public PARAM -{ - bool bValue; - __forceinline BOOL_PARAM(LPCSTR _name, bool _value) : - PARAM(_name), bValue(_value) - {} -}; -AsyncHttpRequest* operator<<(AsyncHttpRequest*, const BOOL_PARAM&); - -struct INT_PARAM : public PARAM -{ - int iValue; - __forceinline INT_PARAM(LPCSTR _name, int _value) : - PARAM(_name), iValue(_value) - {} -}; AsyncHttpRequest* operator<<(AsyncHttpRequest*, const INT_PARAM&); - -struct INT64_PARAM : public PARAM -{ - SnowFlake iValue; - __forceinline INT64_PARAM(LPCSTR _name, SnowFlake _value) : - PARAM(_name), iValue(_value) - {} -}; AsyncHttpRequest* operator<<(AsyncHttpRequest*, const INT64_PARAM&); - -struct CHAR_PARAM : public PARAM -{ - LPCSTR szValue; - __forceinline CHAR_PARAM(LPCSTR _name, LPCSTR _value) : - PARAM(_name), szValue(_value) - {} -}; AsyncHttpRequest* operator<<(AsyncHttpRequest*, const CHAR_PARAM&); - -struct WCHAR_PARAM : public PARAM -{ - LPCWSTR wszValue; - __forceinline WCHAR_PARAM(LPCSTR _name, LPCWSTR _value) : - PARAM(_name), wszValue(_value) - {} -}; AsyncHttpRequest* operator<<(AsyncHttpRequest*, const WCHAR_PARAM&); -JSONNode& operator<<(JSONNode &json, const INT_PARAM ¶m); -JSONNode& operator<<(JSONNode &json, const INT64_PARAM ¶m); -JSONNode& operator<<(JSONNode &json, const BOOL_PARAM ¶m); -JSONNode& operator<<(JSONNode &json, const CHAR_PARAM ¶m); -JSONNode& operator<<(JSONNode &json, const WCHAR_PARAM ¶m); - ///////////////////////////////////////////////////////////////////////////////////////// struct CDiscordRole : public MZeroedObject diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp index 2c0b254930..0b37e53167 100644 --- a/protocols/Discord/src/utils.cpp +++ b/protocols/Discord/src/utils.cpp @@ -42,40 +42,6 @@ int StrToStatus(const CMStringW &str) ///////////////////////////////////////////////////////////////////////////////////////// -JSONNode& operator<<(JSONNode &json, const INT_PARAM ¶m) -{ - json.push_back(JSONNode(param.szName, param.iValue)); - return json; -} - -JSONNode& operator<<(JSONNode &json, const INT64_PARAM ¶m) -{ - char tmp[100]; - _i64toa_s(param.iValue, tmp, _countof(tmp), 10); - json.push_back(JSONNode(param.szName, tmp)); - return json; -} - -JSONNode& operator<<(JSONNode &json, const BOOL_PARAM ¶m) -{ - json.push_back(JSONNode(param.szName, param.bValue)); - return json; -} - -JSONNode& operator<<(JSONNode &json, const CHAR_PARAM ¶m) -{ - json.push_back(JSONNode(param.szName, param.szValue)); - return json; -} - -JSONNode& operator<<(JSONNode &json, const WCHAR_PARAM ¶m) -{ - json.push_back(JSONNode(param.szName, ptrA(mir_utf8encodeW(param.wszValue)).get())); - return json; -} - -///////////////////////////////////////////////////////////////////////////////////////// - time_t StringToDate(const CMStringW &str) { struct tm T = { 0 }; diff --git a/protocols/Discord/src/version.h b/protocols/Discord/src/version.h index 2389a715d1..9114967209 100644 --- a/protocols/Discord/src/version.h +++ b/protocols/Discord/src/version.h @@ -9,6 +9,5 @@ #define __FILENAME "Discord.dll" #define __DESCRIPTION "Discord support for Miranda NG." #define __AUTHOR "George Hazan" -#define __AUTHOREMAIL "ghazan@miranda.im" #define __AUTHORWEB "https://miranda-ng.org/p/Discord/" #define __COPYRIGHT "© 2016-17 Miranda NG team" |