summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-08-25 19:29:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-08-25 19:29:14 +0300
commited946baa5e32135fd3c9a3c263a98340ead4da47 (patch)
tree3f918ca689480269ddc9927a5ecbd8b76e6bcb26 /protocols
parentd94f9da99db86de15df91acbdd820584186417a0 (diff)
useless condition removed
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/avatars.cpp2
-rw-r--r--protocols/Discord/src/proto.cpp2
-rw-r--r--protocols/Discord/src/proto.h2
-rw-r--r--protocols/Discord/src/server.cpp27
4 files changed, 14 insertions, 19 deletions
diff --git a/protocols/Discord/src/avatars.cpp b/protocols/Discord/src/avatars.cpp
index d938b95727..87905e17e1 100644
--- a/protocols/Discord/src/avatars.cpp
+++ b/protocols/Discord/src/avatars.cpp
@@ -66,7 +66,7 @@ void CDiscordProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *
{
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_UNKNOWN;
- ai.hContact = (MCONTACT)pReq->pUserInfo;
+ ai.hContact = (UINT_PTR)pReq->pUserInfo;
if (reply->resultCode != 200) {
LBL_Error:
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index ace96630cb..b384f34be8 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -235,7 +235,7 @@ HANDLE CDiscordProto::SearchBasic(const wchar_t *wszId)
CMStringA szUrl = "/users/";
szUrl.AppendFormat(ptrA(mir_utf8encodeW(wszId)));
- AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, szUrl, &CDiscordProto::OnReceiveUserInfo);
+ AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, szUrl, &CDiscordProto::OnReceiveMyInfo);
pReq->pUserInfo = (void*)-1;
Push(pReq);
return (HANDLE)1; // Success
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index f0af47b0ad..f3f2a2a9bb 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -373,7 +373,7 @@ public:
void OnReceiveToken(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void RetrieveMyInfo();
- void OnReceiveUserInfo(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
+ void OnReceiveMyInfo(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void RetrieveHistory(MCONTACT hContact, CDiscordHistoryOp iOp = MSG_NOFILTER, SnowFlake msgid = 0, int iLimit = 50);
void OnReceiveHistory(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 2924b971d0..60d713d4f2 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -143,10 +143,10 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest
void CDiscordProto::RetrieveMyInfo()
{
- Push(new AsyncHttpRequest(this, REQUEST_GET, "/users/@me", &CDiscordProto::OnReceiveUserInfo));
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/users/@me", &CDiscordProto::OnReceiveMyInfo));
}
-void CDiscordProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*)
+void CDiscordProto::OnReceiveMyInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*)
{
if (pReply->resultCode != 200) {
ConnectionFailed(LOGINERR_WRONGPASSWORD);
@@ -167,22 +167,17 @@ void CDiscordProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpReques
setWString(0, DB_KEY_NICK, root["username"].as_mstring());
setWString(0, DB_KEY_EMAIL, root["email"].as_mstring());
- if (0 == 0) {
- m_ownId = id;
- for (int i=0; i < pReply->headersCount; i++)
- if (!strcmp(pReply->headers[i].szName, "Set-Cookie")) {
- char *p = strchr(pReply->headers[i].szValue, ';');
- if (p) *p = 0;
- m_szAccessCookie = mir_strdup(pReply->headers[i].szValue);
- }
-
- OnLoggedIn();
- }
- else {
- CDiscordUser *pUser = FindUser(id);
- ProcessType(pUser, root);
+ m_ownId = id;
+ for (int i = 0; i < pReply->headersCount; i++) {
+ if (!strcmp(pReply->headers[i].szName, "Set-Cookie")) {
+ char *p = strchr(pReply->headers[i].szValue, ';');
+ if (p) *p = 0;
+ m_szAccessCookie = mir_strdup(pReply->headers[i].szValue);
+ }
}
+ OnLoggedIn();
+
CheckAvatarChange(0, root["avatar"].as_mstring());
}