diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-06-08 12:03:44 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-06-08 12:03:44 +0000 |
commit | 9c4ba307862a3408c67a55bd0c003b6f0f2bdc7d (patch) | |
tree | 3bb2fa32d6c6529b6b5f597d80a1e03a46ff3a8d | |
parent | 57c27326f7ba7b6ae6a29665dcc6554a98971f3d (diff) |
SkypeWeb: Memleaks fix (detected by coverity).
git-svn-id: http://svn.miranda-ng.org/main/trunk@14066 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/SkypeWeb/src/requests/login.h | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 12 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/stdafx.h | 3 |
4 files changed, 15 insertions, 4 deletions
diff --git a/protocols/SkypeWeb/src/requests/login.h b/protocols/SkypeWeb/src/requests/login.h index ac513d2c66..1ffb2b3ba9 100644 --- a/protocols/SkypeWeb/src/requests/login.h +++ b/protocols/SkypeWeb/src/requests/login.h @@ -33,7 +33,7 @@ public: mir_md5_hash((BYTE*)str.GetString(), str.GetLength(), digest);
- char *hash = mir_base64_encode(digest, sizeof(digest));
+ ptrA hash(mir_base64_encode(digest, sizeof(digest)));
Body
<< CHAR_VALUE("scopes", "client")
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 063360f894..97d0eedce3 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -57,6 +57,7 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) if (response->resultCode != 200)
{
+ int error = 0;
if (!json["status"].isnull())
{
const JSONNode &status = json["status"];
@@ -64,25 +65,34 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) {
switch(status["code"].as_int())
{
+ case 40002:
+ {
+ ShowNotification(_T("Skype"), TranslateT("Authentication failed. Invalid username."), NULL, 1);
+ error = LOGINERR_BADUSERID;
+ break;
+ }
case 40120:
{
ShowNotification(_T("Skype"), TranslateT("Authentication failed. Bad username or password."), NULL, 1);
+ error = LOGINERR_WRONGPASSWORD;
break;
}
case 40121:
{
ShowNotification(_T("Skype"), TranslateT("Too many failed authentication attempts with given username or IP."), NULL, 1);
+ error = LOGIN_ERROR_TOOMANY_REQUESTS;
break;
}
default:
{
ShowNotification(_T("Skype"), !status["text"].isnull() ? status["text"].as_mstring().GetBuffer() : TranslateT("Authentication failed. Unknown error."), NULL, 1);
+ error = LOGIN_ERROR_UNKNOWN;
}
}
}
}
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, error);
SetStatus(ID_STATUS_OFFLINE);
return;
}
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 228d8bdc26..eea09a0389 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -188,7 +188,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) msg.AppendFormat("%s\n%s %s:\n%s", mir_utf8decodeA(dbMsgText), Translate("Edited at"), T2Utf(time), mir_utf8decodeA(message));
db_event_delete(hContact, dbevent);
- AddMessageToDb(hContact, dbEventTimestamp, DBEF_UTF, skypeEditedId.c_str(), mir_utf8encode(msg.GetBuffer()));
+ AddMessageToDb(hContact, dbEventTimestamp, DBEF_UTF, skypeEditedId.c_str(), ptrA(mir_utf8encode(msg.GetBuffer())));
}
else OnReceiveMessage(clientMsgId.c_str(), conversationLink.c_str(), timestamp, message, emoteOffset);
}
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 44f9f00b39..a4250c6e65 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -97,7 +97,8 @@ extern LIST<CSkypeProto> Accounts; enum SKYPE_LOGIN_ERROR
{
- LOGIN_ERROR_UNKNOWN = 1001
+ LOGIN_ERROR_UNKNOWN = 1001,
+ LOGIN_ERROR_TOOMANY_REQUESTS
};
enum SKYPE_DB_EVENT_TYPE
|