From aa312e59cd0065e20ffdf78cd49811ba0520c0bd Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Wed, 3 Jul 2013 19:45:53 +0000 Subject: Skype: - fixed files(contacts) sending in conference (issue #397) - fixes in contacts blocking - some small fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@5223 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/res/Resource.rc | 8 +++---- protocols/Skype/src/skype_blocked.cpp | 15 +++++++++--- protocols/Skype/src/skype_chat.cpp | 17 +++++++++----- protocols/Skype/src/skype_menus.cpp | 30 ++++++++++++++---------- protocols/Skype/src/skype_proto.cpp | 40 ++++++++++++++++++++++++-------- protocols/Skype/src/skype_transfers.cpp | 24 ++++++++++++------- protocols/Skype/src/skypekit/contact.cpp | 2 +- 7 files changed, 91 insertions(+), 45 deletions(-) (limited to 'protocols/Skype') diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc index 97f84d3a8b..25df418097 100644 --- a/protocols/Skype/res/Resource.rc +++ b/protocols/Skype/res/Resource.rc @@ -203,7 +203,7 @@ BEGIN PUSHBUTTON "Register new account",IDC_REGISTER,66,39,120,14,WS_DISABLED END -IDD_OPT_MAIN DIALOGEX 0, 0, 305, 238 +IDD_OPT_MAIN DIALOGEX 0, 0, 305, 230 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -231,7 +231,7 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "",IDC_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,291,194 - COMBOBOX IDC_CONTACTS,7,206,231,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_CONTACTS,7,206,231,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Block",IDC_BLOCK,248,206,50,13,WS_DISABLED END @@ -242,7 +242,7 @@ CAPTION "Block this person" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "%s",IDC_HEADERBAR,"MHeaderbarCtrl",0x0,0,0,295,25 - LTEXT "Are you sure you want to block %s?\nThey won't be able to contact you\nand won't appear in your Contact List.",IDC_MESSAGE,6,32,282,27 + LTEXT "",IDC_MESSAGE,6,32,282,27 CONTROL "Remove from your Contact List",IDC_REMOVE_FROM_CL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,67,282,10 GROUPBOX "Abuse",IDC_STATIC,6,84,282,40 @@ -365,7 +365,7 @@ BEGIN VERTGUIDE, 291 VERTGUIDE, 298 TOPMARGIN, 7 - BOTTOMMARGIN, 231 + BOTTOMMARGIN, 223 END IDD_OPT_BLOCKED, DIALOG diff --git a/protocols/Skype/src/skype_blocked.cpp b/protocols/Skype/src/skype_blocked.cpp index bf4212e9ef..e9d4461b59 100644 --- a/protocols/Skype/src/skype_blocked.cpp +++ b/protocols/Skype/src/skype_blocked.cpp @@ -65,7 +65,14 @@ INT_PTR CALLBACK CSkypeProto::SkypeBlockProc(HWND hwndDlg, UINT msg, WPARAM wPar { param = (BlockParam *)lParam; ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - ::TranslateDialogDefault(hwndDlg); + ::TranslateDialogDefault(hwndDlg); + + wchar_t *nick = (wchar_t *)::CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)param->hContact, GCDNF_TCHAR); + + TCHAR oldTitle[256], newTitle[256]; + ::GetDlgItemText(hwndDlg, IDC_HEADERBAR, oldTitle, SIZEOF(oldTitle)); + ::mir_sntprintf(newTitle, SIZEOF(newTitle), ::TranslateTS(oldTitle), nick); + ::SetDlgItemText(hwndDlg, IDC_HEADERBAR, newTitle); ::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)::Skin_GetIcon("Skype_block", ICON_BIG)); ::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)::Skin_GetIcon("Skype_block")); @@ -74,8 +81,8 @@ INT_PTR CALLBACK CSkypeProto::SkypeBlockProc(HWND hwndDlg, UINT msg, WPARAM wPar ::mir_sntprintf( text, SIZEOF(text), - L"Are you sure you want to block %s (%s)?\nThey won't be able to contact you\nand won't appear in your Contact List.", - ptrW(::db_get_wsa(param->hContact, param->ppro->m_szModuleName, "Nick")), + TranslateT("Are you sure you want to block \"%s\" (%s)? They won't be able to contact you and won't appear in your Contact List."), + nick, ptrW(::db_get_wsa(param->hContact, param->ppro->m_szModuleName, SKYPE_SETTINGS_SID))); ::SetDlgItemText(hwndDlg, IDC_MESSAGE, text), @@ -292,6 +299,8 @@ INT_PTR CALLBACK CSkypeProto::SkypeBlockedOptionsProc(HWND hwndDlg, UINT msg, WP break; contact->SetBlocked(true, param.abuse); + if (::db_get_b(hContact, ppro->m_szModuleName, "IsSkypeOut", 0) > 0) + ::db_set_w(hContact, ppro->m_szModuleName, "Status", ID_STATUS_ONTHEPHONE); if (param.remove) { diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index 8339ad386e..a16fdf0d73 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -1675,15 +1675,20 @@ void CSkypeProto::OnChatEvent(const ConversationRef &conversation, const Message { room->OnEvent(conversation, message); } - else if(messageType != Message::RETIRED && messageType != Message::RETIRED_OTHERS) + else { - SEString data; + Conversation::MY_STATUS status; + conversation->GetPropMyStatus(status); + if (status != Conversation::RETIRED_FORCEFULLY || status != Conversation::RETIRED_FORCEFULLY) + { + SEString data; - conversation->GetPropDisplayname(data); - ptrW name = ::mir_utf8decodeW(data); + conversation->GetPropDisplayname(data); + ptrW name = ::mir_utf8decodeW(data); - ChatRoom *room = new ChatRoom(cid, name, this); - room->Start(conversation, true); + ChatRoom *room = new ChatRoom(cid, name, this); + room->Start(conversation, true); + } } } diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp index 0a348a9013..d1ca420913 100644 --- a/protocols/Skype/src/skype_menus.cpp +++ b/protocols/Skype/src/skype_menus.cpp @@ -50,6 +50,12 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) clmi.icolibItem = CSkypeProto::GetSkinIconHandle("contact"); clmi.ptszName = LPGENT("Unblock this person..."); } + else + { + clmi.flags |= CMIM_NAME | CMIM_ICON | CMIF_TCHAR; + clmi.icolibItem = CSkypeProto::GetSkinIconHandle("block"); + clmi.ptszName = LPGENT("Block this person..."); + } ::CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)CSkypeProto::contactMenuItems[CMI_BLOCK], (LPARAM)&clmi); } } @@ -167,49 +173,49 @@ void CSkypeProto::InitMenus() mi.flags &= ~CMIF_ROOTPOPUP; mi.pszService = MODULE"/SyncHistoryDay"; - mi.ptszName = LPGENT("...by last day"); + mi.ptszName = LPGENT("for last day"); mi.flags |= CMIF_CHILDPOPUP; - mi.position = -200001000 + CMI_HISTORY + 1; + mi.position = -200001000 + CMI_HISTORY + 100; mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY]; ::Menu_AddContactMenuItem(&mi); ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastDayHistoryCommand>); mi.pszService = MODULE"/SyncHistoryWeek"; - mi.ptszName = LPGENT("...by last week"); + mi.ptszName = LPGENT("for last week"); mi.flags |= CMIF_CHILDPOPUP; - mi.position = -200001000 + CMI_HISTORY + 2; + mi.position = -200001000 + CMI_HISTORY + 1001; mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY]; ::Menu_AddContactMenuItem(&mi); ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastWeekHistoryCommand>); mi.pszService = MODULE"/SyncHistoryMonth"; - mi.ptszName = LPGENT("...by last month"); + mi.ptszName = LPGENT("for last month"); mi.flags |= CMIF_CHILDPOPUP; - mi.position = -200001000 + CMI_HISTORY + 3; + mi.position = -200001000 + CMI_HISTORY + 102; mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY]; ::Menu_AddContactMenuItem(&mi); ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastMonthHistoryCommand>); mi.pszService = MODULE"/SyncHistory3Month"; - mi.ptszName = LPGENT("...by last 3 month"); + mi.ptszName = LPGENT("for last 3 month"); mi.flags |= CMIF_CHILDPOPUP; - mi.position = -200001000 + CMI_HISTORY + 4; + mi.position = -200001000 + CMI_HISTORY + 103; mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY]; ::Menu_AddContactMenuItem(&mi); ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLast3MonthHistoryCommand>); mi.pszService = MODULE"/SyncHistoryYear"; - mi.ptszName = LPGENT("...by last year"); + mi.ptszName = LPGENT("for last year"); mi.flags |= CMIF_CHILDPOPUP; - mi.position = -200001000 + CMI_HISTORY + 5; + mi.position = -200001000 + CMI_HISTORY + 104; mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY]; ::Menu_AddContactMenuItem(&mi); ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastYearHistoryCommand>); mi.pszService = MODULE"/SyncHistoryAllTime"; - mi.ptszName = LPGENT("...by all time"); + mi.ptszName = LPGENT("for all time"); mi.flags |= CMIF_CHILDPOPUP; - mi.position = -200001000 + CMI_HISTORY + 6; + mi.position = -200001000 + CMI_HISTORY + 105; mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY]; ::Menu_AddContactMenuItem(&mi); ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncAllTimeHistoryCommand>); diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 9a52404047..e8eadfd162 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -346,11 +346,21 @@ int __cdecl CSkypeProto::SendContacts(HANDLE hContact, int flags, int nContacts, if (this->IsOnline() && hContact && hContactsList) { this->Log(L"Outcoming contacts"); - SEStringList targets; - targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))); - CConversation::Ref conversation; - this->GetConversationByParticipants(targets, conversation); + ConversationRef conversation; + if ( !this->IsChatRoom(hContact)) + { + SEStringList targets; + targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))); + + this->GetConversationByParticipants(targets, conversation); + } + else + { + this->GetConversationByIdentity((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)), conversation); + } + if ( !conversation) + return 0; ContactRefs contacts; for (int i = 0; i < nContacts; i++) @@ -387,19 +397,29 @@ HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription if (this->IsOnline() && hContact && ppszFiles) { this->Log(L"Outcoming file transfer"); - SEStringList targets; - targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))); - CConversation::Ref conversation; - this->GetConversationByParticipants(targets, conversation); + ConversationRef conversation; + if ( !this->IsChatRoom(hContact)) + { + SEStringList targets; + targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))); + + this->GetConversationByParticipants(targets, conversation); + } + else + { + this->GetConversationByIdentity((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)), conversation); + } + if ( !conversation) + return 0; SEFilenameList fileList; for (int i = 0; ppszFiles[i]; i++) fileList.append((char *)ptrA(::mir_utf8encodeW(ppszFiles[i]))); auto error = TRANSFER_OPEN_SUCCESS; - SEFilename errFile; MessageRef msgRef; - //(char *)mir_ptr(::mir_utf8encodeW(szDescription)) + SEFilename errFile; + MessageRef msgRef; if ( !conversation->PostFiles(fileList, " ", error, errFile, msgRef) || error) return 0; diff --git a/protocols/Skype/src/skype_transfers.cpp b/protocols/Skype/src/skype_transfers.cpp index e891be18c3..b3edeeba1a 100644 --- a/protocols/Skype/src/skype_transfers.cpp +++ b/protocols/Skype/src/skype_transfers.cpp @@ -26,7 +26,10 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) Transfer::FAILUREREASON reason; - uint oid = transfer->getOID(); + MessageRef msgRef; + this->GetMessageByGuid(guid, msgRef); + + uint oid = msgRef->getOID(); SEString data; transfer->GetPropPartnerHandle(data); @@ -40,24 +43,24 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) break;*/ /*case CTransfer::WAITING_FOR_ACCEPT: break;*/ - case CTransfer::CONNECTING: + case Transfer::CONNECTING: this->SendBroadcast(hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)oid, 0); break; - case CTransfer::TRANSFERRING: - case CTransfer::TRANSFERRING_OVER_RELAY: + case Transfer::TRANSFERRING: + case Transfer::TRANSFERRING_OVER_RELAY: this->SendBroadcast(hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, (HANDLE)oid, 0); break; - case CTransfer::FAILED: + case Transfer::FAILED: transfer->GetPropFailurereason(reason); this->SendBroadcast(hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)oid, (LPARAM)CSkypeProto::TransferFailureReasons[reason]); this->transferList.remove_val(transfer); break; - case CTransfer::COMPLETED: + case Transfer::COMPLETED: this->SendBroadcast(hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)oid, 0); this->transferList.remove_val(transfer); break; - case CTransfer::CANCELLED: - case CTransfer::CANCELLED_BY_REMOTE: + case Transfer::CANCELLED: + case Transfer::CANCELLED_BY_REMOTE: transfer->GetPropFailurereason(reason); this->SendBroadcast(hContact, ACKTYPE_FILE, ACKRESULT_DENIED, (HANDLE)oid, (LPARAM)CSkypeProto::TransferFailureReasons[reason]); this->transferList.remove_val(transfer); @@ -73,7 +76,10 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) SEBinary guid; transfer->GetPropChatmsgGuid(guid); - uint oid = transfer->getOID(); + MessageRef msgRef; + this->GetMessageByGuid(guid, msgRef); + + uint oid = msgRef->getOID(); PROTOFILETRANSFERSTATUS pfts = {0}; pfts.cbSize = sizeof(pfts); diff --git a/protocols/Skype/src/skypekit/contact.cpp b/protocols/Skype/src/skypekit/contact.cpp index 622023a040..cd6afab9ef 100644 --- a/protocols/Skype/src/skypekit/contact.cpp +++ b/protocols/Skype/src/skypekit/contact.cpp @@ -12,7 +12,7 @@ SEString CContact::GetSid() SEString result; CContact::AVAILABILITY availability; this->GetPropAvailability(availability); - if (availability == CContact::SKYPEOUT) + if (availability == Contact::SKYPEOUT || availability == Contact::BLOCKED_SKYPEOUT) this->GetPropPstnnumber(result); else this->GetPropSkypename(result); -- cgit v1.2.3