summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_chat.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-05-06 15:42:54 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-05-06 15:42:54 +0000
commit27d17244cb0af6f8b04e2b6725d504c336dabb07 (patch)
tree397c9ff1289c02c4a886e06919f8c67fd6d92e5d /protocols/Skype/src/skype_chat.cpp
parent14eec47b6101e1f96437f7bb1057ee04a3cc4f63 (diff)
memory leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@4592 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_chat.cpp')
-rw-r--r--protocols/Skype/src/skype_chat.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp
index 60ec6a65de..00926950b5 100644
--- a/protocols/Skype/src/skype_chat.cpp
+++ b/protocols/Skype/src/skype_chat.cpp
@@ -32,7 +32,7 @@ HANDLE CSkypeProto::GetChatRoomByCid(const wchar_t *cid)
{
if (this->IsProtoContact(hContact) && this->IsChatRoom(hContact))
{
- ::mir_ptr<wchar_t> chatID(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
+ mir_ptr<wchar_t> chatID(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
if (::wcscmp(cid, chatID) == 0)
return hContact;
}
@@ -80,8 +80,8 @@ void CSkypeProto::ChatValidateContact(HANDLE hItem, HWND hwndList, const StringL
//HANDLE hContact = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
if (this->IsProtoContact(hItem) && !this->IsChatRoom(hItem))
{
- std::wstring sid = ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_LOGIN);
- if (sid.empty() || contacts.contains(sid.c_str()))
+ mir_ptr<wchar_t> sid( ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
+ if (sid == NULL || contacts.contains(sid))
::SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
}
else
@@ -136,8 +136,8 @@ void CSkypeProto::GetInvitedContacts(HANDLE hItem, HWND hwndList, StringList &ch
}
else
{
- std::wstring sid(::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
- chatTargets.insert(sid.c_str());
+ mir_ptr<wchar_t> login( ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
+ chatTargets.insert(login);
}
}
}
@@ -415,7 +415,7 @@ INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM)
HANDLE hContact = (HANDLE)wParam;
if (hContact)
{
- wchar_t *cid = ::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID");
+ mir_ptr<wchar_t> cid( ::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
SEString data;
CConversation::Ref conversation;
@@ -427,8 +427,6 @@ INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM)
conversation->Join();
this->JoinToChat(conversation);
-
- ::mir_free(cid);
}
return 0;
@@ -438,13 +436,7 @@ INT_PTR __cdecl CSkypeProto::OnLeaveChat(WPARAM wParam, LPARAM)
{
HANDLE hContact = (HANDLE)wParam;
if (hContact)
- {
- wchar_t *cid = ::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID");
-
- this->LeaveChat(cid);
-
- ::mir_free(cid);
- }
+ this->LeaveChat( mir_ptr<wchar_t>( ::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID")));
return 0;
}
@@ -481,7 +473,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
if (g_skype->GetConversationByIdentity(::mir_utf8encodeW(cid), conversation, false))
{
CMessage::Ref message;
- ::mir_ptr<char> text(::mir_utf8encodeW(gch->ptszText));
+ mir_ptr<char> text(::mir_utf8encodeW(gch->ptszText));
conversation->PostText((char *)text, message);
}
}