From 2e1a5d69fbe1e329bde49c2ae6e9be82017fbd00 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Wed, 19 Jun 2013 21:11:41 +0000 Subject: Skype: added password request for chat rooms git-svn-id: http://svn.miranda-ng.org/main/trunk@5050 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/Skype_10.vcxproj | 1 + protocols/Skype/Skype_10.vcxproj.filters | 3 ++ protocols/Skype/res/Resource.rc | 2 +- protocols/Skype/src/skype_chat.cpp | 91 +++++++++++++++++--------------- protocols/Skype/src/skype_dialogs.cpp | 2 +- 5 files changed, 54 insertions(+), 45 deletions(-) (limited to 'protocols') diff --git a/protocols/Skype/Skype_10.vcxproj b/protocols/Skype/Skype_10.vcxproj index 4f627dbc2f..546b9bcd18 100644 --- a/protocols/Skype/Skype_10.vcxproj +++ b/protocols/Skype/Skype_10.vcxproj @@ -240,6 +240,7 @@ + diff --git a/protocols/Skype/Skype_10.vcxproj.filters b/protocols/Skype/Skype_10.vcxproj.filters index 02dc39d2ad..92ac63714a 100644 --- a/protocols/Skype/Skype_10.vcxproj.filters +++ b/protocols/Skype/Skype_10.vcxproj.filters @@ -120,6 +120,9 @@ Source Files + + Source Files\skypekit + diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc index c80ea60be2..0a9c53fd22 100644 --- a/protocols/Skype/res/Resource.rc +++ b/protocols/Skype/res/Resource.rc @@ -95,7 +95,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | CAPTION "Enter password" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT "Enter a password for skype name %d:",IDC_INSTRUCTION,7,7,142,8 + LTEXT "Enter a password",IDC_INSTRUCTION,7,7,142,8 EDITTEXT IDC_PASSWORD,17,16,122,14,ES_PASSWORD | ES_AUTOHSCROLL CONTROL "Remember this session password",IDC_SAVEPASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,32,120,10 DEFPUSHBUTTON "OK",IDOK,46,50,50,14 diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index eb84e2aff3..b5180c1c6f 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -237,16 +237,12 @@ void ChatRoom::Start(const ConversationRef &conversation, bool showWindow) if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) { this->hContact = gci.hContact; - ptrW joinBlob = ::db_get_wsa(gci.hContact, ppro->m_szModuleName, "JoinBlob"); - if ( joinBlob == NULL) + ptrW cid = ::db_get_wsa(gci.hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID); + if (cid == NULL) { this->conversation->GetPropIdentity(data); - ptrW cid = ::mir_utf8decodeW(data); + cid = ::mir_utf8decodeW(data); ::db_set_ws(gci.hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID, cid); - - this->conversation->GetJoinBlob(data); - joinBlob = ::mir_utf8decodeW(data); - ::db_set_ws(gci.hContact, ppro->m_szModuleName, "JoinBlob", joinBlob); } } @@ -387,7 +383,18 @@ void ChatRoom::AddMember(const ChatMember &item, const ChatMember &author, DWORD //newMember->participant->SetOnChangedCallback(&ChatRoom::OnParticipantChanged, this); this->members.insert(newMember); - this->SendEvent(item, GC_EVENT_JOIN, timestamp, GCEF_ADDTOLOG, 0, ::TranslateW(ChatRoom::Roles[item.GetRank()])); + if (newMember->GetRank() == CParticipant::APPLICANT) + this->SendEvent( + *this->sys, + GC_EVENT_INFORMATION, + time(NULL), + GCEF_ADDTOLOG, + 0, + NULL, + ::TranslateT("waits to join")); + else + this->SendEvent(item, GC_EVENT_JOIN, timestamp, GCEF_ADDTOLOG, 0, ::TranslateW(ChatRoom::Roles[item.GetRank()])); + this->SendEvent(item, GC_EVENT_SETCONTACTSTATUS, timestamp, 0, item.GetStatus()); } } @@ -814,31 +821,30 @@ void ChatRoom::OnChange(const ConversationRef &conversation, int prop) conversation->GetPropMyStatus(status); if (status == Conversation::INVALID_ACCESS_TOKEN) { - //todo: password request; - CSkypeProto::ShowNotification(::TranslateT("The password is incorrect"), 0, this->hContact); - GCDEST gcd = { ppro->m_szModuleName, { NULL }, GC_EVENT_CONTROL }; - gcd.ptszID = this->cid; - - GCEVENT gce = {0}; - gce.cbSize = sizeof(GCEVENT); - gce.dwFlags = GC_TCHAR; - gce.pDest = &gcd; - ::CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce); - ::CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce); + PasswordRequestBoxParam param(this->name, false); + if (this->ppro->RequestPassword(param)) + { + if ( !this->conversation->EnterPassword(param.password)) + this->SendEvent( + *this->sys, + GC_EVENT_INFORMATION, + time(NULL), + GCEF_ADDTOLOG, + 0, + NULL, + ::TranslateT("The password is incorrect")); + } } else if (status == Conversation::APPLICATION_DENIED) { - // - CSkypeProto::ShowNotification(::TranslateT("Your application to join the conference was denied"), 0, this->hContact); - GCDEST gcd = { ppro->m_szModuleName, { NULL }, GC_EVENT_CONTROL }; - gcd.ptszID = this->cid; - - GCEVENT gce = {0}; - gce.cbSize = sizeof(GCEVENT); - gce.dwFlags = GC_TCHAR; - gce.pDest = &gcd; - ::CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce); - ::CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce); + this->SendEvent( + *this->sys, + GC_EVENT_INFORMATION, + time(NULL), + GCEF_ADDTOLOG, + 0, + NULL, + ::TranslateT("Your application to join the conference was denied")); } } break; @@ -1608,24 +1614,23 @@ INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM) { if (::db_get_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) { - ptrW joinBlob(::db_get_wsa(hContact, this->m_szModuleName, "JoinBlob")); + ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); + ptrA cidA(::mir_utf8encodeW(cid)); SEString data; ConversationRef conversation; - - this->GetConversationByBlob(::mir_utf8encodeW(joinBlob), conversation); - if (conversation) + if (this->GetConversationByIdentity((char *)cidA, conversation)) { - conversation->GetPropDisplayname(data); - ptrW name(::mir_utf8decodeW(data)); - conversation->GetJoinBlob(data); - joinBlob = ::mir_utf8decodeW(data); - ::db_set_ws(hContact, this->m_szModuleName, "JoinBlob", joinBlob); - - ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID")); - ChatRoom *room = new ChatRoom(cid, name, this); - room->Start(conversation, true); + if (this->GetConversationByBlob(data, conversation)) + { + conversation->GetPropDisplayname(data); + ptrW name(::mir_utf8decodeW(data)); + + CSkypeProto::ReplaceSpecialChars(cid); + ChatRoom *room = new ChatRoom(cid, name, this); + room->Start(conversation, true); + } } } else diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index d26868284b..2a0b48b4f4 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -206,7 +206,7 @@ INT_PTR CALLBACK CSkypeProto::SkypePasswordRequestProc(HWND hwndDlg, UINT msg, W ::mir_sntprintf( title, MAX_PATH, - ::TranslateT("Enter a password for Skype Name %s:"), + ::TranslateT("Enter a password for %s:"), param->login); ::SetDlgItemText(hwndDlg, IDC_INSTRUCTION, title); -- cgit v1.2.3