summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_chat.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2013-05-11 14:49:09 +0000
committerAlexander Lantsev <aunsane@gmail.com>2013-05-11 14:49:09 +0000
commit59328dff21b246ffee24cfd45dfe36b65c76e916 (patch)
treede615a28bb2d43f126ca6a0928364dfc2704c424 /protocols/Skype/src/skype_chat.cpp
parente0fe91da0455894d26e6d804f9028e0c3efb6d59 (diff)
- fix own nick in chat log
- add thread sync on contact searching in db git-svn-id: http://svn.miranda-ng.org/main/trunk@4632 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_chat.cpp')
-rw-r--r--protocols/Skype/src/skype_chat.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp
index c17ac72106..d5f0c9d787 100644
--- a/protocols/Skype/src/skype_chat.cpp
+++ b/protocols/Skype/src/skype_chat.cpp
@@ -192,17 +192,23 @@ bool CSkypeProto::IsChatRoom(HANDLE hContact)
HANDLE CSkypeProto::GetChatRoomByCid(const wchar_t *cid)
{
- for (HANDLE hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName))
+ HANDLE hContact = NULL;
+
+ ::EnterCriticalSection(&this->contact_search_lock);
+
+ for (hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName))
{
if (this->IsChatRoom(hContact))
{
mir_ptr<wchar_t> chatID(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
if (::lstrcmp(cid, chatID) == 0)
- return hContact;
+ break;
}
}
- return 0;
+ ::LeaveCriticalSection(&this->contact_search_lock);
+
+ return hContact;
}
HANDLE CSkypeProto::AddChatRoom(CConversation::Ref conversation)
@@ -449,9 +455,12 @@ void CSkypeProto::LeaveChat(const wchar_t *cid)
void CSkypeProto::RaiseChatEvent(const wchar_t *cid, const wchar_t *sid, int evt, DWORD flags, DWORD itemData, const wchar_t *status, const wchar_t *message)
{
HANDLE hContact = this->GetContactBySid(sid);
- mir_ptr<wchar_t> nick( hContact ?
+ mir_ptr<wchar_t> nick(::db_get_wsa(hContact, this->m_szModuleName, "Nick"));
+ if (!nick)
+ nick = ::mir_wstrdup(sid);
+ /*mir_ptr<wchar_t> nick( hContact ?
::mir_a2u((char *)::CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), 0)) :
- ::mir_wstrdup(sid));
+ ::mir_wstrdup(sid));*/
GCDEST gcd = { this->m_szModuleName, { NULL }, evt };
gcd.ptszID = ::mir_wstrdup(cid);