From 9fa85abf24cda9681cbe3ceb1cdb2da50ca05644 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Thu, 7 May 2015 17:14:12 +0000 Subject: SkypeWeb: Leaks fix (thx wishmaster) git-svn-id: http://svn.miranda-ng.org/main/trunk@13477 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_contacts.cpp | 2 +- protocols/SkypeWeb/src/skype_history_sync.cpp | 6 +++--- protocols/SkypeWeb/src/skype_menus.cpp | 2 +- protocols/SkypeWeb/src/skype_messages.cpp | 2 +- protocols/SkypeWeb/src/skype_options.cpp | 8 +++++--- protocols/SkypeWeb/src/skype_proto.cpp | 4 +--- protocols/SkypeWeb/src/skype_trouter.cpp | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 82f5adece3..72237b51d0 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -235,7 +235,7 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) setByte(hContact, "Grant", 1); node = json_get(item, "blocked"); - bool isBlocked = json_as_bool(node); + bool isBlocked = (json_as_bool(node) != 0); if (isBlocked) { db_set_dw(hContact, "Ignore", "Mask1", 127); diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 747f3f299b..f301fdb1c9 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -34,7 +34,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) int totalCount = json_as_int(json_get(metadata, "totalCount")); ptrA syncState(mir_t2a(ptrT(json_as_string(json_get(metadata, "syncState"))))); - bool markAllAsUnread = getByte("MarkMesUnread",0); + bool markAllAsUnread = getBool("MarkMesUnread",false); if (totalCount >= 99 || json_size(conversations) >= 99) PushRequest(new GetHistoryOnUrlRequest(syncState, RegToken), &CSkypeProto::OnGetServerHistory); @@ -225,7 +225,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) if (totalCount >= 99 || json_size(conversations) >= 99) PushRequest(new SyncHistoryFirstRequest(syncState, RegToken), &CSkypeProto::OnSyncHistory); - bool autoSyncEnabled = getByte("AutoSync", 1); + bool autoSyncEnabled = getBool("AutoSync", true); for (size_t i = 0; i < json_size(conversations); i++) { @@ -236,7 +236,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) continue; char *clientMsgId = mir_t2a(json_as_string(json_get(lastMessage, "clientmessageid"))); - char *skypeEditedId = mir_t2a(json_as_string(json_get(lastMessage, "skypeeditedid"))); + //char *skypeEditedId = mir_t2a(json_as_string(json_get(lastMessage, "skypeeditedid"))); char *conversationLink = mir_t2a(json_as_string(json_get(lastMessage, "conversationLink"))); time_t composeTime(IsoToUnixTime(ptrT(json_as_string(json_get(lastMessage, "composetime"))))); diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index e2817bd55e..9a7d63dd8e 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -35,7 +35,7 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) bool isCtrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0; bool isAuthNeed = getByte(hContact, "Auth", 0) > 0; bool isGrantNeed = getByte(hContact, "Grant", 0) > 0; - bool isBlocked = getByte(hContact, "IsBlocked", 0); + bool isBlocked = getBool(hContact, "IsBlocked", false); Menu_ShowItem(ContactMenuItems[CMI_AUTH_REQUEST], isCtrlPressed || isAuthNeed); Menu_ShowItem(ContactMenuItems[CMI_AUTH_GRANT], isCtrlPressed || isGrantNeed); diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 3eb0064718..4655c3775f 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -386,7 +386,7 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) } } -int CSkypeProto::OnDbEventRead(WPARAM hContact, LPARAM hDbEvent) +int CSkypeProto::OnDbEventRead(WPARAM, LPARAM) { debugLogA(__FUNCTION__); //if (IsOnline() && !isChatRoom(hContact) && !mir_strcmp(GetContactProto(hContact), m_szModuleName)) diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index c39c3bc0ee..882b35cfe7 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -47,10 +47,12 @@ void CSkypeOptionsMain::OnInitDialog() void CSkypeOptionsMain::OnApply() { - if (mir_strcmpi(ptrA(m_proto->getStringA(SKYPE_SETTINGS_ID)), ptrA(m_skypename.GetTextA())) || mir_strcmpi(ptrA(m_proto->getStringA("Password")), ptrA(m_password.GetTextA()))) + ptrA tszNewSkypename(m_skypename.GetTextA()),tszNewPassword(m_password.GetTextA()), + tszOldSkypename(m_proto->getStringA(SKYPE_SETTINGS_ID)),tszOldPassword(m_proto->getStringA("Password")); + if (mir_strcmpi(tszNewSkypename, tszOldSkypename) || mir_strcmpi(tszNewPassword, tszOldPassword)) m_proto->delSetting("TokenExpiresIn"); - m_proto->setString(SKYPE_SETTINGS_ID, m_skypename.GetTextA()); - m_proto->setString("Password", m_password.GetTextA()); + m_proto->setString(SKYPE_SETTINGS_ID, tszNewSkypename); + m_proto->setString("Password", tszNewPassword); ptrT group(m_group.GetText()); if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group)) Clist_CreateGroup(0, group); diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index e0659f175a..407c9ea566 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -98,7 +98,6 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) case PFLAG_UNIQUEIDSETTING: return (DWORD_PTR)SKYPE_SETTINGS_ID; } - return 0; } @@ -296,8 +295,7 @@ int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConnection, 0); if (m_TrouterConnection) CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_TrouterConnection, 0); - if (m_timer) - SkypeUnsetTimer(this); + SkypeUnsetTimer(this); requestQueue->Stop(); diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 21a250a193..ea7a78f741 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -126,7 +126,7 @@ void CSkypeProto::OnHealth(const NETLIBHTTPREQUEST*) SendRequest(new GetTrouterRequest(socketIo, connId, st, se, sig, instance, ccid), &CSkypeProto::OnGetTrouter, (void *)true); } -void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *headers) +void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *) { ptrT displayname(json_as_string(json_get(body, "displayName"))); ptrT cuid(json_as_string(json_get(body, "callerId"))); -- cgit v1.2.3