From 0043f79996b6bf582194fd45d42d86ca2816292f Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 14 Jun 2013 18:26:29 +0000 Subject: Skype: - fixed chat creating/removing - fixed chat inviting - fixed #367 git-svn-id: http://svn.miranda-ng.org/main/trunk@4945 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype.h | 2 +- protocols/Skype/src/skype_account.cpp | 2 +- protocols/Skype/src/skype_avatars.cpp | 4 +- protocols/Skype/src/skype_chat.cpp | 418 +++++++++++++++++---------------- protocols/Skype/src/skype_chat.h | 12 +- protocols/Skype/src/skype_contacts.cpp | 6 +- protocols/Skype/src/skype_dialogs.cpp | 6 +- protocols/Skype/src/skype_events.cpp | 33 +-- protocols/Skype/src/skype_menus.cpp | 16 +- protocols/Skype/src/skype_proto.cpp | 14 +- protocols/Skype/src/skype_proto.h | 13 +- protocols/Skype/src/skype_skype.cpp | 15 -- protocols/Skype/src/skype_utils.cpp | 11 + protocols/Skype/src/string_list.h | 2 +- 14 files changed, 274 insertions(+), 280 deletions(-) diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h index fa3261dc38..883be3ecd8 100644 --- a/protocols/Skype/src/skype.h +++ b/protocols/Skype/src/skype.h @@ -47,7 +47,7 @@ #define SKYPE_GROUP_NAME_LIMIT 100 #define SKYPE_SETTINGS_STATUS "Status" -#define SKYPE_SETTINGS_LOGIN "sid" +#define SKYPE_SETTINGS_SID "sid" #define SKYPE_SETTINGS_PASSWORD "Password" #define SKYPE_SETTINGS_DEF_GROUP "DefaultGroup" diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp index ff44128bd2..728bcc2750 100644 --- a/protocols/Skype/src/skype_account.cpp +++ b/protocols/Skype/src/skype_account.cpp @@ -51,7 +51,7 @@ bool CSkypeProto::IsOnline() bool CSkypeProto::PrepareLogin() { - this->login = ::db_get_wsa(NULL, this->m_szModuleName, SKYPE_SETTINGS_LOGIN); + this->login = ::db_get_wsa(NULL, this->m_szModuleName, SKYPE_SETTINGS_SID); if ( !this->login || !::wcslen(this->login)) { this->m_iStatus = ID_STATUS_OFFLINE; diff --git a/protocols/Skype/src/skype_avatars.cpp b/protocols/Skype/src/skype_avatars.cpp index 27bf4a5dd0..b44cb2cb66 100644 --- a/protocols/Skype/src/skype_avatars.cpp +++ b/protocols/Skype/src/skype_avatars.cpp @@ -70,7 +70,7 @@ wchar_t * CSkypeProto::GetContactAvatarFilePath(HANDLE hContact) if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path); - mir_ptr sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + mir_ptr sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); if (hContact != NULL) ::mir_sntprintf(path, MAX_PATH, _T("%s\\%s.jpg"), path, sid); else if (sid != NULL) @@ -93,7 +93,7 @@ INT_PTR __cdecl CSkypeProto::GetAvatarInfo(WPARAM, LPARAM lParam) return GAIR_NOAVATAR; } - mir_ptr sid = ::db_get_wsa(pai->hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN); + mir_ptr sid = ::db_get_wsa(pai->hContact, this->m_szModuleName, SKYPE_SETTINGS_SID); if (sid) { mir_ptr path( this->GetContactAvatarFilePath(pai->hContact)); diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index 3c0e2cae3c..83f93dff2e 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -28,7 +28,7 @@ static struct gc_item crListItems[] = { LPGENT("&User"), ICM_ROLE_WRITER, MENU_POPUPITEM }, { LPGENT("&Listener"), ICM_ROLE_SPECTATOR, MENU_POPUPITEM }, { NULL, 0, MENU_SEPARATOR }, - { LPGENT("&Add"), ICM_ADD, MENU_ITEM }, + { LPGENT("&Add"), ICM_ADD, MENU_ITEM }, { LPGENT("&Kick"), ICM_KICK, MENU_ITEM }, { LPGENT("Outlaw (&ban)"), ICM_BAN, MENU_ITEM }, { NULL, 0, MENU_SEPARATOR }, @@ -36,12 +36,30 @@ static struct gc_item crListItems[] = { LPGENT("Copy room &uri"), ICM_COPY_URI, MENU_ITEM } }; +static void CheckChatMenuItem(CHAT_LIST_MENU checkedId) +{ + for (int i = 0; i < SIZEOF(crListItems); i++) + { + if (crListItems[i].dwID == checkedId) + { + if (crListItems[i].uType == MENU_ITEM) + crListItems[i].uType = MENU_CHECK; + else if (crListItems[i].uType == MENU_POPUPITEM) + crListItems[i].uType = MENU_POPUPCHECK; + break; + } + } +} + static void DisableChatMenuItem(CHAT_LIST_MENU disabledId) { for (int i = 0; i < SIZEOF(crListItems); i++) { if (crListItems[i].dwID == disabledId) + { crListItems[i].bDisabled = TRUE; + break; + } } } @@ -54,7 +72,13 @@ static void DisableChatMenuItems(CHAT_LIST_MENU disabledIds[]) static void ResetChatMenuItem() { for (int i = 0; i < SIZEOF(crListItems); i++) + { crListItems[i].bDisabled = FALSE; + if (crListItems[i].uType == MENU_CHECK) + crListItems[i].uType = MENU_ITEM; + else if (crListItems[i].uType == MENU_POPUPCHECK) + crListItems[i].uType = MENU_POPUPITEM; + } } void CSkypeProto::InitChat() @@ -118,12 +142,10 @@ ChatRoom::~ChatRoom() ::mir_free(this->name); if (this->me != NULL) delete this->me; - for (int i = 0; i < this->members.getCount(); i++) - delete this->members[i]; this->members.destroy(); } -void ChatRoom::Start(bool showWindow) +void ChatRoom::CreateChatSession(bool showWindow) { SEString data; @@ -152,9 +174,6 @@ void ChatRoom::Start(bool showWindow) gce.ptszStatus = ::TranslateW(ChatRoom::Roles[i]); ::CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); } - - /*gce.ptszStatus = ::TranslateT("Other"); - ::CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);*/ // init [and show window] gcd.iType = GC_EVENT_CONTROL; @@ -163,12 +182,59 @@ void ChatRoom::Start(bool showWindow) ::CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce); } -void ChatRoom::Start(const ParticipantRefs &participants, bool showWindow) +void ChatRoom::Create(const StringList &invitedMembers, CSkypeProto *ppro, bool showWindow) +{ + SEString data; + ChatRoom *room = NULL; + + ConversationRef conversation; + if (ppro->CreateConference(conversation)) + { + conversation->SetOption(CConversation::P_OPT_JOINING_ENABLED, true); + conversation->SetOption(CConversation::P_OPT_ENTRY_LEVEL_RANK, CParticipant::WRITER); + conversation->SetOption(CConversation::P_OPT_DISCLOSE_HISTORY, true); + + SEStringList consumers; + for (size_t i = 0; i < invitedMembers.size(); i++) + { + data = ::mir_utf8encodeW(invitedMembers[i]); + consumers.append(data); + } + conversation->AddConsumers(consumers); + } +} + +void ChatRoom::Start(const ConversationRef &conversation, bool showWindow) { SEString data; - this->Start(showWindow); + this->CreateChatSession(showWindow); + + this->conversation = conversation; + this->conversation.fetch(); + + GC_INFO gci = {0}; + gci.Flags = BYID | HCONTACT; + gci.pszModule = ppro->m_szModuleName; + gci.pszID = this->cid; + + if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) + { + ptrW joinBlob = ::db_get_wsa(gci.hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID); + if ( joinBlob == NULL) + { + this->conversation->GetPropIdentity(data); + ptrW 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); + } + } + ParticipantRefs participants; + this->conversation->GetParticipants(participants, Conversation::CONSUMERS_AND_APPLICANTS); for (uint i = 0; i < participants.size(); i++) { auto participant = participants[i]; @@ -203,6 +269,8 @@ void ChatRoom::Start(const ParticipantRefs &participants, bool showWindow) void ChatRoom::LeaveChat() { + this->conversation->RetireFrom(); + GCDEST gcd = { ppro->m_szModuleName, { NULL }, GC_EVENT_CONTROL }; gcd.ptszID = this->cid; @@ -612,9 +680,11 @@ void ChatRoom::OnEvent(const ConversationRef &conversation, const MessageRef &me } break; - //case Message::SET_RANK: - // { - // SEString data; + case Message::SET_RANK: + { + SEString data; + } + break; // message->GetPropBodyXml(data); // ptrA text = ::mir_strdup(data); // int i = 0; @@ -719,7 +789,7 @@ void CSkypeProto::ChatValidateContact(HANDLE hItem, HWND hwndList, const StringL { if (this->IsProtoContact(hItem) && !this->IsChatRoom(hItem)) { - ptrW sid( ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + ptrW sid( ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_SID)); if (sid == NULL || contacts.contains(sid)) ::SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); } @@ -775,7 +845,7 @@ void CSkypeProto::GetInvitedContacts(HANDLE hItem, HWND hwndList, StringList &ch } else { - mir_ptr login( ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + ptrW login( ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_SID)); chatTargets.insert(login); } } @@ -788,7 +858,8 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP { InviteChatParam *param = (InviteChatParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch (msg) { + switch (msg) + { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -797,6 +868,13 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP { HWND hwndClist = GetDlgItem(hwndDlg, IDC_CCLIST); SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) & ~CLS_HIDEOFFLINE); + + if ( !param->ppro->IsOnline()) + { + ::EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); + ::EnableWindow(GetDlgItem(hwndDlg, IDC_ADDSCR), FALSE); + ::EnableWindow(GetDlgItem(hwndDlg, IDC_CCLIST), FALSE); + } } break; @@ -893,7 +971,7 @@ HANDLE CSkypeProto::GetChatRoomByCid(const wchar_t *cid) { if (this->IsChatRoom(hContact)) { - ptrW chatSid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + ptrW chatSid( ::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID")); if (::lstrcmpi(chatSid, cid) == 0) break; } @@ -904,68 +982,12 @@ HANDLE CSkypeProto::GetChatRoomByCid(const wchar_t *cid) return hContact; } -HANDLE CSkypeProto::AddChatRoom(CConversation::Ref conversation) -{ - SEString data; - - conversation->GetPropIdentity(data); - ptrW cid = ::mir_utf8decodeW(data); - - HANDLE hContact = this->GetChatRoomByCid(cid); - if ( !hContact) - { - hContact = (HANDLE)::CallService(MS_DB_CONTACT_ADD, 0, 0); - ::CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)this->m_szModuleName); - - conversation->GetPropDisplayname(data); - ptrW name = ::mir_utf8decodeW(data); - - conversation->GetJoinBlob(data); - ptrW joinBlob = ::mir_utf8decodeW(data); - - ::db_set_b(hContact, this->m_szModuleName, "ChatRoom", 1); - ::db_set_ws(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN, cid); - ::db_set_ws(hContact, this->m_szModuleName, "ChatRoomID", cid); - ::db_set_ws(hContact, this->m_szModuleName, "JoinBlob", joinBlob); - ::db_set_ws(hContact, this->m_szModuleName, "Nick", name); - ::db_set_w(hContact, this->m_szModuleName, "Status", ID_STATUS_OFFLINE); - ::db_set_w(hContact, this->m_szModuleName, "ApparentMode", ID_STATUS_OFFLINE); - - ptrW defaultGroup = ::db_get_wsa(NULL, "Chat", "AddToGroup"); - if (defaultGroup != NULL) - { - ::db_set_ws(hContact, "CList", "Group", defaultGroup); - } - } - - return hContact; -} - void CSkypeProto::StartChat(StringList &invitedContacts) { InviteChatParam *param = new InviteChatParam(NULL, invitedContacts, this); - SEStringList needToAdd; - for (size_t i = 0; i < param->invitedContacts.size(); i++) - needToAdd.append(std::string(::mir_utf8encodeW(param->invitedContacts[i])).c_str()); - - if (::DialogBoxParam( - g_hInstance, - MAKEINTRESOURCE(IDD_CHATROOM_INVITE), - NULL, - CSkypeProto::InviteToChatProc, - (LPARAM)param) == IDOK) - { - for (size_t i = 0; i < param->invitedContacts.size(); i++) - { - std::string sid(::mir_utf8encodeW(param->invitedContacts[i])); - if ( !needToAdd.contains(sid.c_str())) - needToAdd.append(sid.c_str()); - } - - CConversation::Ref conversation; - this->CreateConferenceWithConsumers(conversation, needToAdd); - } + if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, CSkypeProto::InviteToChatProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0) + ChatRoom::Create(param->invitedContacts, this, true); delete param; } @@ -976,7 +998,37 @@ void CSkypeProto::StartChat() return this->StartChat(empty); } -void CSkypeProto::LeaveChat(const wchar_t *cid) +void CSkypeProto::InviteToChatRoom(HANDLE hContact) +{ + GC_INFO gci = {0}; + gci.Flags = BYID | USERS | DATA; + gci.pszModule = this->m_szModuleName; + gci.pszID = ::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"); + if ( !::CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci)) + { + ChatRoom *room = (ChatRoom *)gci.dwItemData; + if (room != NULL && gci.pszUsers != NULL) + { + StringList invitedContacts(_A2T(gci.pszUsers)); + InviteChatParam *param = new InviteChatParam(NULL, invitedContacts, this); + + if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, CSkypeProto::InviteToChatProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0) + { + SEStringList needToAdd; + for (size_t i = 0; i < param->invitedContacts.size(); i++) + { + if (!invitedContacts.contains(param->invitedContacts[i])) + needToAdd.append((char *)_T2A(param->invitedContacts[i])); + } + room->conversation->AddConsumers(needToAdd); + } + delete param; + } + } + ::mir_free(gci.pszID); +} + +ChatRoom *CSkypeProto::FindChatRoom(const wchar_t *cid) { GC_INFO gci = {0}; gci.Flags = BYID | DATA; @@ -984,9 +1036,32 @@ void CSkypeProto::LeaveChat(const wchar_t *cid) gci.pszID = ::mir_wstrdup(cid); if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) + return (ChatRoom *)gci.dwItemData; + + return NULL; +} + +void CSkypeProto::DeleteChatRoom(HANDLE hContact) +{ + ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID")); + ChatRoom *room = this->FindChatRoom(cid); + if (room != NULL && room->conversation) { - ChatRoom *room = (ChatRoom *)gci.dwItemData; room->LeaveChat(); + room->conversation->Delete(); + } + else + { + cid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID); + if (cid != NULL) + { + ConversationRef conversation; + if (this->GetConversationByIdentity((char *)_T2A(cid), conversation) && conversation) + { + conversation->RetireFrom(); + conversation->Delete(); + } + } } } @@ -995,18 +1070,10 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) GCHOOK *gch = (GCHOOK *)lParam; if (!gch) return 1; - if (::strcmp(gch->pDest->pszModule, this->m_szModuleName)) + if (::strcmp(gch->pDest->pszModule, this->m_szModuleName) != 0) return 0; - GC_INFO gci = {0}; - gci.Flags = BYID | DATA; - gci.pszModule = gch->pDest->pszModule; - gci.pszID = gch->pDest->ptszID; - - ::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci); - - ChatRoom *room = (ChatRoom *)gci.dwItemData; - + ChatRoom *room = this->FindChatRoom(gch->pDest->ptszID); if (room == NULL) return 0; @@ -1067,10 +1134,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) break; } if (member->participant && member->participant->SetRankTo(rank)) - { - //member->SetRank(rank); room->UpdateMemberRole(member, rank, *room->me); - } } } break; @@ -1132,7 +1196,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) HANDLE hContact = this->GetContactBySid(gch->ptszUID); if (!hContact) { - ptrW sid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN); + ptrW sid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID); if (sid != NULL) CSkypeProto::CopyToClipboard(sid); } @@ -1164,57 +1228,67 @@ int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam) { GCMENUITEMS *gcmi = (GCMENUITEMS*) lParam; - GC_INFO gci = {0}; - gci.Flags = BYID | DATA; - gci.pszModule = gcmi->pszModule; - gci.pszID = gcmi->pszID; - - ::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci); - - ChatRoom *room = (ChatRoom *)gci.dwItemData; + if (::stricmp(gcmi->pszModule, this->m_szModuleName) != 0) + return 0; - if (room == NULL || ::stricmp(gcmi->pszModule, this->m_szModuleName)) + ChatRoom *room = this->FindChatRoom(gcmi->pszID); + if (room == NULL) return 0; ResetChatMenuItem(); - /*if (gcmi->Type == MENU_ON_LOG) + if (room->me->GetRank() > Participant::ADMIN || room->me->GetRank() == 0) { - gcmi->nItems = SIZEOF(crListItems); - gcmi->Item = crListItems; + DisableChatMenuItem(ICM_ROLE); + DisableChatMenuItem(ICM_ADD); + DisableChatMenuItem(ICM_KICK); + DisableChatMenuItem(ICM_BAN); } - else if (gcmi->Type == MENU_ON_NICKLIST) - { - gcmi->nItems = SIZEOF(crListItems); - gcmi->Item = crListItems; - }*/ + //todo: add other case if (room->me->GetRank() >= Participant::APPLICANT) { DisableChatMenuItem(ICM_CONF_INVITE); - } + } - if (gcmi->pszUID == NULL || this->GetContactBySid(gcmi->pszUID) != NULL) + ChatMember *member = room->FindChatMember(gcmi->pszUID); + if (member != NULL) { - DisableChatMenuItem(ICM_AUTH_REQUEST); - DisableChatMenuItem(ICM_COPY_SID); - } + if (member->GetRank() == Participant::CREATOR) + { + DisableChatMenuItem(ICM_ROLE); + DisableChatMenuItem(ICM_ADD); + DisableChatMenuItem(ICM_KICK); + DisableChatMenuItem(ICM_BAN); + } + + if (member->GetRank() <= Participant::SPECTATOR) + { + CHAT_LIST_MENU type = (CHAT_LIST_MENU)(ICM_ROLE + member->GetRank() - 1); + CheckChatMenuItem(type); + DisableChatMenuItem(type); - if (room->me->GetRank() > Participant::ADMIN || room->me->GetRank() == 0) + DisableChatMenuItem(ICM_ADD); + } + + if (member->GetRank() > Participant::SPECTATOR) + DisableChatMenuItem(ICM_ROLE); + + HANDLE hContact = this->GetContactBySid(gcmi->pszUID); + if (hContact == NULL) + DisableChatMenuItem(ICM_DETAILS); + else if(::db_get_b(hContact, this->m_szModuleName, "Auth", 0) == 0) + DisableChatMenuItem(ICM_AUTH_REQUEST); + } + else { - //CHAT_LIST_MENU adminItems[] = { ICM_ROLE, ICM_ROLE_ADMIN, ICM_ROLE_SPEAKER, ICM_ROLE_WRITER, ICM_ROLE_SPECTATOR }; - //DisableChatMenuItems(adminItems); - + DisableChatMenuItem(ICM_DETAILS); + DisableChatMenuItem(ICM_AUTH_REQUEST); DisableChatMenuItem(ICM_ROLE); DisableChatMenuItem(ICM_ADD); DisableChatMenuItem(ICM_KICK); DisableChatMenuItem(ICM_BAN); - } - - ChatMember *member = room->FindChatMember(gcmi->pszUID); - if (member != NULL && member->GetRank() > Participant::SPECTATOR) - { - DisableChatMenuItem(ICM_ROLE); + DisableChatMenuItem(ICM_COPY_SID); } gcmi->nItems = SIZEOF(crListItems); @@ -1223,20 +1297,6 @@ int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam) return 0; } -wchar_t *CSkypeProto::GetChatUsers(const wchar_t *cid) -{ - GC_INFO gci = {0}; - gci.Flags = USERS; - gci.pszModule = this->m_szModuleName; - gci.pszID = ::mir_wstrdup(cid); - ::CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci); - - ::mir_free(gci.pszID); - - // todo: fix me - return ::mir_a2u(gci.pszUsers); -} - void CSkypeProto::UpdateChatUserStatus(CContact::Ref contact) { CContact::AVAILABILITY availability; @@ -1275,6 +1335,8 @@ void CSkypeProto:: UpdateChatUserNick(CContact::Ref contact) contact->GetPropFullname(data); ptrW nick(::mir_utf8decodeW(data)); + if (data.length() == 0) + nick = sid; GC_INFO gci = {0}; gci.Flags = BYINDEX | DATA; @@ -1301,33 +1363,24 @@ INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM) HANDLE hContact = (HANDLE)wParam; if (hContact) { - ptrW joinBlob(::db_get_wsa(hContact, this->m_szModuleName, "JoinBlob")); - ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + ptrW joinBlob(::db_get_wsa(hContact, this->m_szModuleName, "JoinBlob")); SEString data; ConversationRef conversation; this->GetConversationByBlob(::mir_utf8encodeW(joinBlob), conversation); - //this->GetConversationByIdentity(::mir_utf8encodeW(cid), conversation); if (conversation) { - //conversation->Join(); - conversation->GetPropDisplayname(data); ptrW name(::mir_utf8decodeW(data)); - /*conversation->GetPropIdentity(data); - ptrW cid(::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, SKYPE_SETTINGS_SID)); ChatRoom *room = new ChatRoom(cid, name, this); - room->conversation = conversation; - room->conversation.fetch(); - //room->conversation->SetOnConvoChangedCallback(this->OnConversationChanged); - - Participant::Refs participants; - conversation->GetParticipants(participants, Conversation::CONSUMERS_AND_APPLICANTS); - - room->Start(participants, true); + room->Start(conversation, true); } } @@ -1339,19 +1392,11 @@ INT_PTR __cdecl CSkypeProto::OnLeaveChat(WPARAM wParam, LPARAM) HANDLE hContact = (HANDLE)wParam; if (hContact) { - ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID")); - GC_INFO gci = {0}; - gci.Flags = BYID | DATA; - gci.pszModule = this->m_szModuleName; - gci.pszID = cid; - - if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) - { - ChatRoom *room = (ChatRoom *)gci.dwItemData; - room->conversation->RetireFrom(); + ChatRoom *room = this->FindChatRoom(cid); + if (room != NULL) room->LeaveChat(); - } } return 0; @@ -1382,21 +1427,13 @@ void __cdecl CSkypeProto::LoadChatList(void*) { conversation->GetPropIdentity(data); ptrW cid = ::mir_utf8decodeW(data); + CSkypeProto::ReplaceSpecialChars(cid); conversation->GetPropDisplayname(data); ptrW name = ::mir_utf8decodeW(data); ChatRoom *room = new ChatRoom(cid, name, this); - room->conversation = conversation; - room->conversation.fetch(); - //room->conversation->SetOnConvoChangedCallback(&CSkypeProto::OnConversationChanged); - - this->AddChatRoom(conversation); - - Participant::Refs participants; - conversation->GetParticipants(participants, Conversation::CONSUMERS_AND_APPLICANTS); - - room->Start(participants); + room->Start(conversation); } } } @@ -1412,36 +1449,22 @@ void CSkypeProto::OnChatEvent(const ConversationRef &conversation, const Message SEString data; conversation->GetPropIdentity(data); ptrW cid = ::mir_utf8decodeW(data); + CSkypeProto::ReplaceSpecialChars(cid); - GC_INFO gci = {0}; - gci.Flags = BYID | DATA; - gci.pszModule = this->m_szModuleName; - gci.pszID = cid; - - if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) + ChatRoom *room = this->FindChatRoom(cid); + if (room != NULL) { - ChatRoom *room = (ChatRoom *)gci.dwItemData; room->OnEvent(conversation, message); } - else if(messageType != Message::RETIRED || messageType != Message::RETIRED_OTHERS) + else if(messageType != Message::RETIRED && messageType != Message::RETIRED_OTHERS) { SEString data; - conversation->GetPropIdentity(data); - ptrW cid = ::mir_utf8decodeW(data); - conversation->GetPropDisplayname(data); ptrW name = ::mir_utf8decodeW(data); ChatRoom *room = new ChatRoom(cid, name, this); - room->conversation = conversation; - room->conversation.fetch(); - this->AddChatRoom(conversation); - - Participant::Refs participants; - conversation->GetParticipants(participants, Conversation::CONSUMERS_AND_APPLICANTS); - - room->Start(participants, true); + room->Start(conversation, true); } } @@ -1457,24 +1480,15 @@ void CSkypeProto::OnConversationListChange( conversation->GetPropIdentity(data); ptrW cid = ::mir_utf8decodeW(data); + CSkypeProto::ReplaceSpecialChars(cid); if ( !this->GetChatRoomByCid(cid)) { - conversation->GetPropIdentity(data); - ptrW cid = ::mir_utf8decodeW(data); - conversation->GetPropDisplayname(data); ptrW name = ::mir_utf8decodeW(data); ChatRoom *room = new ChatRoom(cid, name, this); - room->conversation = conversation; - room->conversation.fetch(); - this->AddChatRoom(conversation); - - Participant::Refs participants; - conversation->GetParticipants(participants, Conversation::CONSUMERS_AND_APPLICANTS); - - room->Start(participants, true); + room->Start(conversation, true); } } } \ No newline at end of file diff --git a/protocols/Skype/src/skype_chat.h b/protocols/Skype/src/skype_chat.h index c2d0fa80b9..7b1dcd0bf2 100644 --- a/protocols/Skype/src/skype_chat.h +++ b/protocols/Skype/src/skype_chat.h @@ -137,10 +137,10 @@ private: ChatRoom(const wchar_t *cid); - HANDLE AddChatRoom(); - inline static int CompareMembers(const ChatMember *p1, const ChatMember *p2) { return ChatMember::Compare(p1, p2); } + void CreateChatSession(bool showWindow = false); + bool IsMe(const ChatMember &item) const; bool IsSys(const ChatMember &item) const; void SendEvent(const ChatMember &item, int eventType, DWORD timestamp = time(NULL), DWORD flags = GCEF_ADDTOLOG, DWORD itemData = 0, const wchar_t *status = NULL, const wchar_t *message = NULL); @@ -157,8 +157,9 @@ public: ChatRoom(const wchar_t *cid, const wchar_t *name, CSkypeProto *ppro); ~ChatRoom(); - void Start(bool showWindow = false); - void Start(const ParticipantRefs &participants, bool showWindow = false); + static void Create(const StringList &invitedMembers, CSkypeProto *ppro, bool showWindow = false); + + void Start(const ConversationRef &conversation, bool showWindow = false); void LeaveChat(); @@ -185,6 +186,5 @@ public: void OnParticipantChanged(const ParticipantRef &participant, int prop); - static int __cdecl OnGCEventHook(WPARAM, LPARAM lParam); - static int __cdecl OnGCMenuHook(WPARAM, LPARAM lParam); + static ChatRoom *FindChatRoom(const wchar_t *cid); }; \ No newline at end of file diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 6b60eae031..9b5f1e0cd2 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -177,9 +177,9 @@ HANDLE CSkypeProto::GetContactBySid(const wchar_t *sid) for (hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName)) { - if ( !this->IsChatRoom(hContact)) + //if ( !this->IsChatRoom(hContact)) { - ptrW contactSid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + ptrW contactSid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); if (::lstrcmpi(contactSid, sid) == 0) break; } @@ -246,7 +246,7 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact) ::db_unset(hContact, "CList", "NotOnList"); } - ::db_set_ws(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN, sid); + ::db_set_ws(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID, sid); ::db_set_ws(hContact, this->m_szModuleName, "Nick", nick); DBVARIANT dbv; diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 883a0227e0..3f225f7dc2 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -13,7 +13,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR proto = (CSkypeProto *)lParam; ::SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); { - mir_ptr sid( ::db_get_wsa(NULL, proto->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + mir_ptr sid( ::db_get_wsa(NULL, proto->m_szModuleName, SKYPE_SETTINGS_SID)); SetDlgItemText(hwnd, IDC_SL, sid); } { @@ -150,7 +150,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR { wchar_t sid[128]; GetDlgItemText(hwnd, IDC_SL, sid, SIZEOF(sid)); - ::db_set_ws(NULL, proto->m_szModuleName, SKYPE_SETTINGS_LOGIN, sid); + ::db_set_ws(NULL, proto->m_szModuleName, SKYPE_SETTINGS_SID, sid); ::mir_free(proto->login); proto->login = ::mir_wstrdup(sid); @@ -354,7 +354,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam if (!szProto) break; - ::SetDlgItemText(hwndDlg, IDC_SID, mir_ptr(::db_get_wsa(hContact, ppro->m_szModuleName, SKYPE_SETTINGS_LOGIN))); + ::SetDlgItemText(hwndDlg, IDC_SID, mir_ptr(::db_get_wsa(hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID))); DBVARIANT dbv; if ( !::db_get_ts(hContact, ppro->m_szModuleName, "XStatusMsg", &dbv)) { diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 8d48c579c7..9432284352 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -59,18 +59,7 @@ int CSkypeProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) if (hContact && this->IsOnline()) { if (this->IsChatRoom(hContact)) - { - ptrW chatID(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); - this->LeaveChat(chatID); - - ConversationRef conversation; - this->GetConversationByIdentity(::mir_utf8encodeW(chatID), conversation); - if (conversation) - { - conversation->RetireFrom(); - conversation->Delete(); - } - } + this->DeleteChatRoom(hContact); else this->RevokeAuth(wParam, lParam); } @@ -180,18 +169,14 @@ int __cdecl CSkypeProto::OnTabSRMMButtonPressed(WPARAM wParam, LPARAM lParam) { case BBB_ID_CONF_INVITE: if (this->IsOnline() && this->IsChatRoom(hContact)) - { - StringList targets = this->GetChatUsers(ptrW(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN))); - - this->StartChat(targets); - } + this->InviteToChatRoom(hContact); break; case BBB_ID_CONF_SPAWN: if (this->IsOnline() && !this->IsChatRoom(hContact)) { StringList targets; - targets.insert(ptrW(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN))); + targets.insert(ptrW(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))); this->StartChat(targets); } @@ -201,7 +186,7 @@ int __cdecl CSkypeProto::OnTabSRMMButtonPressed(WPARAM wParam, LPARAM lParam) return 1; } -void CSkypeProto::OnMessage ( +void CSkypeProto::OnMessage( const MessageRef & message, const bool & changesInboxTimestamp, const MessageRef & supersedesHistoryMessage, @@ -254,11 +239,11 @@ void CSkypeProto::OnMessage ( void CSkypeProto::OnConversationChanged(const ConversationRef &conversation, int prop) { - if (prop == Conversation::P_LOCAL_LIVESTATUS) - { - Conversation::LOCAL_LIVESTATUS liveStatus; - conversation->GetPropLocalLivestatus(liveStatus); - if (liveStatus == Conversation::RINGING_FOR_ME) + if (prop == Conversation::P_LOCAL_LIVESTATUS) + { + Conversation::LOCAL_LIVESTATUS liveStatus; + conversation->GetPropLocalLivestatus(liveStatus); + if (liveStatus == Conversation::RINGING_FOR_ME) { SEString data; diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp index af4fbc783c..e47754fbb3 100644 --- a/protocols/Skype/src/skype_menus.cpp +++ b/protocols/Skype/src/skype_menus.cpp @@ -12,12 +12,12 @@ INT_PTR CSkypeProto::MenuChooseService(WPARAM wParam, LPARAM lParam) return 0; } -void CSkypeProto::EnableMenuItem(HANDLE hMenuItem, BOOL bEnable) +void CSkypeProto::ShowMenuItem(HANDLE hMenuItem, BOOL show) { CLISTMENUITEM clmi = {0}; clmi.cbSize = sizeof(CLISTMENUITEM); clmi.flags = CMIM_FLAGS; - if (!bEnable) + if (!show) clmi.flags |= CMIF_HIDDEN; ::CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi); @@ -37,9 +37,9 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) bool authNeed = ::db_get_b(hContact, this->m_szModuleName, "Auth", 0) > 0; bool grantNeed = ::db_get_b(hContact, this->m_szModuleName, "Grant", 0) > 0; - CSkypeProto::EnableMenuItem(CSkypeProto::contactMenuItems[CMI_AUTH_REQUEST], ctrlPressed || authNeed); - CSkypeProto::EnableMenuItem(CSkypeProto::contactMenuItems[CMI_AUTH_GRANT], ctrlPressed || grantNeed); - CSkypeProto::EnableMenuItem(CSkypeProto::contactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || (!grantNeed && !authNeed)); + CSkypeProto::ShowMenuItem(CSkypeProto::contactMenuItems[CMI_AUTH_REQUEST], ctrlPressed || authNeed); + CSkypeProto::ShowMenuItem(CSkypeProto::contactMenuItems[CMI_AUTH_GRANT], ctrlPressed || grantNeed); + CSkypeProto::ShowMenuItem(CSkypeProto::contactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || (!grantNeed && !authNeed)); } return 0; @@ -75,7 +75,7 @@ int CSkypeProto::GrantAuth(WPARAM wParam, LPARAM lParam) { CContact::Ref contact; HANDLE hContact = (HANDLE)wParam; - SEString sid(::mir_u2a(mir_ptr(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)))); + SEString sid(::mir_u2a(mir_ptr(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)))); if (this->GetContact(sid, contact)) { if (contact->SetBuddyStatus(true)) @@ -92,7 +92,7 @@ int CSkypeProto::RevokeAuth(WPARAM wParam, LPARAM lParam) { CContact::Ref contact; HANDLE hContact = (HANDLE)wParam; - SEString sid(::mir_u2a(mir_ptr(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)))); + SEString sid(::mir_u2a(mir_ptr(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)))); if (this->GetContact(sid, contact)) { if (contact->SetBuddyStatus(false)) @@ -115,7 +115,7 @@ INT_PTR CSkypeProto::InviteCommand(WPARAM, LPARAM) int CSkypeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { for (size_t i = 0; i < SIZEOF(CSkypeProto::contactMenuItems); i++) - CSkypeProto::EnableMenuItem(CSkypeProto::contactMenuItems[i], false); + CSkypeProto::ShowMenuItem(CSkypeProto::contactMenuItems[i], false); CSkypeProto* ppro = CSkypeProto::GetInstanceByHContact((HANDLE)wParam); return (ppro) ? ppro->OnPrebuildContactMenu(wParam, lParam) : 0; diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index a717c8948e..3347708837 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -130,7 +130,7 @@ int __cdecl CSkypeProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage) if (this->IsOnline() && hContact) { CContact::Ref contact; - SEString sid( mir_ptr(::mir_u2a( mir_ptr(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN))))); + SEString sid( mir_ptr(::mir_u2a( mir_ptr(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))))); if (this->GetContact(sid, contact)) { contact->SetBuddyStatus(Contact::AUTHORIZED_BY_ME); @@ -236,7 +236,7 @@ DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HANDLE hContact) case PFLAG_MAXCONTACTSPERPACKET: return 1024; case PFLAG_UNIQUEIDSETTING: - return (DWORD_PTR)SKYPE_SETTINGS_LOGIN; + return (DWORD_PTR)SKYPE_SETTINGS_SID; default: return 0; } @@ -333,7 +333,7 @@ int __cdecl CSkypeProto::SendContacts(HANDLE hContact, int flags, int nContacts, { this->Log(L"Outcoming contacts"); SEStringList targets; - mir_ptr sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + mir_ptr sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); targets.append((char *)mir_ptr(::mir_utf8encodeW(sid))); CConversation::Ref conversation; @@ -344,7 +344,7 @@ int __cdecl CSkypeProto::SendContacts(HANDLE hContact, int flags, int nContacts, { CContact::Ref contact; - mir_ptr csid(::db_get_wsa(hContactsList[i], this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + mir_ptr csid(::db_get_wsa(hContactsList[i], this->m_szModuleName, SKYPE_SETTINGS_SID)); this->GetContact((char *)mir_ptr(::mir_utf8encodeW(csid)), contact); contacts.append(contact); } @@ -375,7 +375,7 @@ HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription { this->Log(L"Outcoming file transfer"); SEStringList targets; - mir_ptr sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + mir_ptr sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); targets.append((char *)mir_ptr(::mir_utf8encodeW(sid))); CConversation::Ref conversation; @@ -413,7 +413,7 @@ int __cdecl CSkypeProto::SendMsg(HANDLE hContact, int flags, const char *msg) { this->Log(L"Outcoming message"); SEStringList targets; - mir_ptr sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + mir_ptr sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); SEString identity = ::mir_u2a(sid); targets.append(identity); @@ -496,7 +496,7 @@ int __cdecl CSkypeProto::UserIsTyping(HANDLE hContact, int type) { if (hContact && this->IsOnline() && this->m_iStatus != ID_STATUS_INVISIBLE) { - mir_ptr sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + mir_ptr sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); if (::wcsicmp(sid, this->login) != 0) { SEStringList targets; diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index c87cb73307..4c79e4355f 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -177,8 +177,6 @@ private: CMessage *newMessage(int oid); CTransfer *newTransfer(int oid); - bool CreateConferenceWithConsumers(ConversationRef &conference, const SEStringList &identities); - void OnMessage( const MessageRef & message, const bool & changesInboxTimestamp, @@ -265,13 +263,10 @@ protected: void OnTransferChanged(CTransfer::Ref transfer, int prop); // chat - static wchar_t* Roles[]; - bool IsChatRoom(HANDLE hContact); HANDLE GetChatRoomByCid(const wchar_t *cid); HANDLE AddChatRoom(CConversation::Ref conversation); - wchar_t *GetChatUsers(const wchar_t *cid); void UpdateChatUserStatus(CContact::Ref contact); void UpdateChatUserNick(CContact::Ref contact); @@ -284,8 +279,10 @@ protected: void StartChat(); void StartChat(StringList &invitedContacts); + void InviteToChatRoom(HANDLE hContact); - void LeaveChat(const wchar_t *cid); + ChatRoom *FindChatRoom(const wchar_t *cid); + void DeleteChatRoom(HANDLE hContact); INT_PTR __cdecl OnJoinChat(WPARAM wParam, LPARAM); INT_PTR __cdecl OnLeaveChat(WPARAM wParam, LPARAM); @@ -377,6 +374,8 @@ protected: static void CopyToClipboard(const wchar_t *text); + static void ReplaceSpecialChars(wchar_t *text, wchar_t replaceWith = L'_'); + // languages static std::map languages; @@ -428,7 +427,7 @@ protected: virtual int __cdecl GrantAuth(WPARAM, LPARAM); virtual int __cdecl RevokeAuth(WPARAM, LPARAM); - static void EnableMenuItem(HANDLE hMenuItem, BOOL bEnable); + static void ShowMenuItem(HANDLE hMenuItem, BOOL show); static INT_PTR MenuChooseService(WPARAM wParam, LPARAM lParam); diff --git a/protocols/Skype/src/skype_skype.cpp b/protocols/Skype/src/skype_skype.cpp index 3e9eeac7fe..214f4fb242 100644 --- a/protocols/Skype/src/skype_skype.cpp +++ b/protocols/Skype/src/skype_skype.cpp @@ -38,19 +38,4 @@ CTransfer* CSkypeProto::newTransfer(int oid) CContactSearch* CSkypeProto::newContactSearch(int oid) { return new CContactSearch(oid, this); -} - -bool CSkypeProto::CreateConferenceWithConsumers(ConversationRef &conference, const SEStringList &identities) -{ - if (this->CreateConference(conference)) - { - conference->SetOption(CConversation::P_OPT_JOINING_ENABLED, true); - conference->SetOption(CConversation::P_OPT_ENTRY_LEVEL_RANK, CParticipant::WRITER); - conference->SetOption(CConversation::P_OPT_DISCLOSE_HISTORY, 1); - conference->AddConsumers(identities); - - return true; - } - - return false; } \ No newline at end of file diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp index 10203a3577..9af8c5b5cf 100644 --- a/protocols/Skype/src/skype_utils.cpp +++ b/protocols/Skype/src/skype_utils.cpp @@ -551,4 +551,15 @@ void CSkypeProto::CopyToClipboard(const wchar_t *text) ::GlobalUnlock(hMem); ::SetClipboardData(CF_UNICODETEXT, hMem); ::CloseClipboard(); +} + +void CSkypeProto::ReplaceSpecialChars(wchar_t *text, wchar_t replaceWith) +{ + if (text == NULL) + return; + + wchar_t *special = L"\\/:*?\"<>|"; + for (size_t i = 0; i < ::wcslen(text); i++) + if (::wcschr(special, text[i]) != NULL) + text[i] = replaceWith; } \ No newline at end of file diff --git a/protocols/Skype/src/string_list.h b/protocols/Skype/src/string_list.h index 60921746b5..7cf3b0aee7 100644 --- a/protocols/Skype/src/string_list.h +++ b/protocols/Skype/src/string_list.h @@ -27,7 +27,7 @@ public: ::mir_free(data); } } - virtual ~StringList() {} + virtual ~StringList() { } __inline const wchar_t *operator[](size_t idx) const { -- cgit v1.2.3