summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Discord/src/http.cpp9
-rw-r--r--protocols/Discord/src/proto.h9
-rw-r--r--protocols/Discord/src/server.cpp4
3 files changed, 20 insertions, 2 deletions
diff --git a/protocols/Discord/src/http.cpp b/protocols/Discord/src/http.cpp
index e5941a71a4..90393ec6ef 100644
--- a/protocols/Discord/src/http.cpp
+++ b/protocols/Discord/src/http.cpp
@@ -98,6 +98,15 @@ AsyncHttpRequest* operator<<(AsyncHttpRequest *pReq, const INT_PARAM &param)
return pReq;
}
+AsyncHttpRequest* operator<<(AsyncHttpRequest *pReq, const INT64_PARAM &param)
+{
+ CMStringA &s = pReq->m_szParam;
+ if (!s.IsEmpty())
+ s.AppendChar('&');
+ s.AppendFormat("%s=%lld", param.szName, param.iValue);
+ return pReq;
+}
+
AsyncHttpRequest* operator<<(AsyncHttpRequest *pReq, const CHAR_PARAM &param)
{
CMStringA &s = pReq->m_szParam;
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index 66709e8f3b..d6b00fe878 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -45,6 +45,15 @@ struct INT_PARAM : public PARAM
};
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;
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 9164107309..b0d836e889 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -31,9 +31,9 @@ void CDiscordProto::RetrieveHistory(MCONTACT hContact, CDiscordHitoryOp iOp, Sno
pReq << INT_PARAM("limit", iLimit);
switch (iOp) {
case MSG_AFTER:
- pReq << CHAR_PARAM("after", CMStringA(FORMAT, "%lld", msgid)); break;
+ pReq << INT64_PARAM("after", msgid); break;
case MSG_BEFORE:
- pReq << CHAR_PARAM("before", CMStringA(FORMAT, "%lld", msgid)); break;
+ pReq << INT64_PARAM("before", msgid); break;
}
pReq->pUserInfo = pUser;
Push(pReq);