summaryrefslogtreecommitdiff
path: root/protocols/Skype
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2013-05-05 08:38:57 +0000
committerAlexander Lantsev <aunsane@gmail.com>2013-05-05 08:38:57 +0000
commit1229cee3091839af4dd181e28b55e4823079007e (patch)
tree7afa602a61bdc81de9135b5642ec11c5ee4ea229 /protocols/Skype
parent1b39cc1afb501ea3973affcf864b8485e81251ff (diff)
- reworked invitation to chat
- fixed chat contact's statuses - added "Spawn conversation" button in contact dialog - StringList now based on stl git-svn-id: http://svn.miranda-ng.org/main/trunk@4586 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype')
-rw-r--r--protocols/Skype/Skype_10.vcxproj1
-rw-r--r--protocols/Skype/Skype_10.vcxproj.filters3
-rw-r--r--protocols/Skype/res/Resource.rc1
-rw-r--r--protocols/Skype/res/conf_invite.icobin17542 -> 15086 bytes
-rw-r--r--protocols/Skype/res/conf_spawn.icobin0 -> 15086 bytes
-rw-r--r--protocols/Skype/src/resource.h5
-rw-r--r--protocols/Skype/src/skype.h3
-rw-r--r--protocols/Skype/src/skype_account.cpp5
-rw-r--r--protocols/Skype/src/skype_chat.cpp337
-rw-r--r--protocols/Skype/src/skype_contacts.cpp17
-rw-r--r--protocols/Skype/src/skype_dialogs.cpp147
-rw-r--r--protocols/Skype/src/skype_events.cpp40
-rw-r--r--protocols/Skype/src/skype_hooks.cpp3
-rw-r--r--protocols/Skype/src/skype_icons.cpp1
-rw-r--r--protocols/Skype/src/skype_instances.cpp4
-rw-r--r--protocols/Skype/src/skype_menus.cpp8
-rw-r--r--protocols/Skype/src/skype_profile.cpp14
-rw-r--r--protocols/Skype/src/skype_proto.cpp7
-rw-r--r--protocols/Skype/src/skype_proto.h31
-rw-r--r--protocols/Skype/src/skypekit/conversation.cpp12
-rw-r--r--protocols/Skype/src/skypekit/conversation.h7
-rw-r--r--protocols/Skype/src/skypekit/skypekit.cpp27
-rw-r--r--protocols/Skype/src/skypekit/skypekit.h2
-rw-r--r--protocols/Skype/src/string_list.h51
-rw-r--r--protocols/Skype/src/version.h2
25 files changed, 373 insertions, 355 deletions
diff --git a/protocols/Skype/Skype_10.vcxproj b/protocols/Skype/Skype_10.vcxproj
index 38f1d7b731..42a3ca8f67 100644
--- a/protocols/Skype/Skype_10.vcxproj
+++ b/protocols/Skype/Skype_10.vcxproj
@@ -241,6 +241,7 @@
<None Include="res\auth_revoke.ico" />
<None Include="res\call.ico" />
<None Include="res\conf_invite.ico" />
+ <None Include="res\conf_spawn.ico" />
<None Include="res\main.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/protocols/Skype/Skype_10.vcxproj.filters b/protocols/Skype/Skype_10.vcxproj.filters
index 51b1491ebf..c080b72bef 100644
--- a/protocols/Skype/Skype_10.vcxproj.filters
+++ b/protocols/Skype/Skype_10.vcxproj.filters
@@ -195,5 +195,8 @@
<None Include="res\conf_invite.ico">
<Filter>Resource Files\Icons</Filter>
</None>
+ <None Include="res\conf_spawn.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </None>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc
index 88777de95d..938470fe20 100644
--- a/protocols/Skype/res/Resource.rc
+++ b/protocols/Skype/res/Resource.rc
@@ -332,6 +332,7 @@ IDI_AUTH_REQUEST ICON "auth_request.ico"
IDI_AUTH_REVOKE ICON "auth_revoke.ico"
IDI_CALL ICON "call.ico"
IDI_CONF_INVITE ICON "conf_invite.ico"
+IDI_CONF_SPAWN ICON "conf_spawn.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/protocols/Skype/res/conf_invite.ico b/protocols/Skype/res/conf_invite.ico
index 7dfe6dc261..fcca651113 100644
--- a/protocols/Skype/res/conf_invite.ico
+++ b/protocols/Skype/res/conf_invite.ico
Binary files differ
diff --git a/protocols/Skype/res/conf_spawn.ico b/protocols/Skype/res/conf_spawn.ico
new file mode 100644
index 0000000000..1fa6b3b39c
--- /dev/null
+++ b/protocols/Skype/res/conf_spawn.ico
Binary files differ
diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h
index a8425e9e65..df27045a46 100644
--- a/protocols/Skype/src/resource.h
+++ b/protocols/Skype/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by c:\Temp\Miranda NG\protocols\Skype\res\Resource.rc
+// Used by e:\Projects\C++\MirandaNG\protocols\Skype\res\Resource.rc
//
#define IDD_ACCMGR 9
#define IDD_OPT_MAIN 10
@@ -19,6 +19,7 @@
#define IDR_KEY 107
#define IDI_CALL 108
#define IDI_CONF_INVITE 109
+#define IDI_CONF_SPAWN 110
#define IDC_CCLIST 173
#define IDC_EDITSCR 174
#define IDC_ADDSCR 175
@@ -71,7 +72,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 110
+#define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1029
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h
index 3faceb3bf8..3573740f4d 100644
--- a/protocols/Skype/src/skype.h
+++ b/protocols/Skype/src/skype.h
@@ -33,6 +33,7 @@
#include <m_xml.h>
#include <win2k.h>
#include <m_timezones.h>
+#include <m_msg_buttonsbar.h>
#include <m_folders.h>
@@ -53,6 +54,8 @@
#define SKYPE_SEARCH_BYEMAIL 1002
#define SKYPE_SEARCH_BYNAMES 1003
+#define BBB_ID_CONF_SPAWN 1
+
#define SKYPE_DB_EVENT_TYPE_EMOTE 10001
#define SKYPE_DB_EVENT_TYPE_CALL 10010
diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp
index fa29bafbef..3de83ee8dd 100644
--- a/protocols/Skype/src/skype_account.cpp
+++ b/protocols/Skype/src/skype_account.cpp
@@ -225,7 +225,6 @@ void CSkypeProto::OnLoggedIn()
this->LoadContactList(reinterpret_cast<void *>(static_cast<int>(true)));
this->LoadAuthWaitList(this);
-
fetch(this->transferList);
this->SetServerStatus(this->m_iDesiredStatus);
@@ -243,7 +242,7 @@ void CSkypeProto::SetServerStatus(int iNewStatus)
int oldStatus = m_iStatus;
m_iStatus = iNewStatus;
- CContact::AVAILABILITY availability = this->MirandaToSkypeStatus(iNewStatus);
+ CContact::AVAILABILITY availability = CSkypeProto::MirandaToSkypeStatus(iNewStatus);
if (availability != CContact::UNKNOWN)
this->account->SetAvailability(availability);
@@ -261,7 +260,7 @@ void CSkypeProto::OnLoggedOut(CAccount::LOGOUTREASON reason)
this->m_iStatus = ID_STATUS_OFFLINE;
this->SendBroadcast(
ACKTYPE_LOGIN, ACKRESULT_FAILED,
- NULL, this->SkypeToMirandaLoginError(reason));
+ NULL, CSkypeProto::SkypeToMirandaLoginError(reason));
this->ShowNotification(CSkypeProto::LogoutReasons[reason - 1]);
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp
index f85ec85f36..60ec6a65de 100644
--- a/protocols/Skype/src/skype_chat.cpp
+++ b/protocols/Skype/src/skype_chat.cpp
@@ -75,13 +75,20 @@ HANDLE CSkypeProto::AddChatRoom(CConversation::Ref conversation)
return hContact;
}
-void CSkypeProto::ChatValidateContact(HANDLE hItem, HWND hwndList, const wchar_t *contacts)
+void CSkypeProto::ChatValidateContact(HANDLE hItem, HWND hwndList, const StringList &contacts)
{
- if ( !this->IsProtoContact(hItem) || this->IsChatRoom(hItem))
+ //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()))
+ ::SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
+ }
+ else
::SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
}
-void CSkypeProto::ChatPrepare(HANDLE hItem, HWND hwndList, const wchar_t *contacts)
+void CSkypeProto::ChatPrepare(HANDLE hItem, HWND hwndList, const StringList &contacts)
{
if (hItem == NULL)
hItem = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
@@ -102,7 +109,7 @@ void CSkypeProto::ChatPrepare(HANDLE hItem, HWND hwndList, const wchar_t *contac
}
}
-void CSkypeProto::GetInviteContacts(HANDLE hItem, HWND hwndList, StringList &chatTargets)
+void CSkypeProto::GetInvitedContacts(HANDLE hItem, HWND hwndList, StringList &chatTargets)
{
if (hItem == NULL)
hItem = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
@@ -113,7 +120,7 @@ void CSkypeProto::GetInviteContacts(HANDLE hItem, HWND hwndList, StringList &cha
{
HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hItemT)
- this->GetInviteContacts(hItemT, hwndList, chatTargets);
+ this->GetInvitedContacts(hItemT, hwndList, chatTargets);
}
else
{
@@ -125,12 +132,12 @@ void CSkypeProto::GetInviteContacts(HANDLE hItem, HWND hwndList, StringList &cha
TCHAR buf[128] = _T("");
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
- if (buf[0]) chatTargets.insertn(buf);
+ if (buf[0]) chatTargets.insert(buf);
}
else
{
- ::mir_ptr<wchar_t> sid(::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
- chatTargets.insertn(sid);
+ std::wstring sid(::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
+ chatTargets.insert(sid.c_str());
}
}
}
@@ -196,77 +203,75 @@ void CSkypeProto::CreateChatWindow(CConversation::Ref conversation, bool showWin
::mir_free(chatName);
}
-//wchar_t *CSkypeProto::StartChat(const wchar_t *cid, const SEStringList &invitedContacts)
-//{
-// wchar_t *chatID;
-// SEString data;
-// CConversation::Ref conversation;
-//
-// if (invitedContacts.size())
-// {
-// if (cid)
-// {
-// g_skype->GetConversationByIdentity(::mir_utf8encodeW(cid), conversation);
-// conversation->GetJoinBlob(data);
-// g_skype->GetConversationByBlob(data, conversation, false);
-// conversation->Join();
-//
-// chatID = ::mir_wstrdup(cid);
-// }
-// else
-// {
-// g_skype->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, 1);
-//
-// conversation->GetPropIdentity(data);
-// chatID = ::mir_utf8decodeW(data);
-// }
-//
-// conversation->AddConsumers(invitedContacts);
-//
-// conversation->GetPropDisplayname(data);
-// wchar_t *chatName;
-// if (data.length())
-// chatName = ::mir_utf8decodeT(data);
-// else
-// chatName = ::TranslateT("New conference");
-//
-// GCSESSION gcw = {0};
-// gcw.cbSize = sizeof(gcw);
-// gcw.iType = GCW_CHATROOM;
-// gcw.dwFlags = GC_TCHAR;
-// gcw.pszModule = this->m_szModuleName;
-// gcw.ptszName = chatName;
-// gcw.ptszID = chatID;
-// ::CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
-//
-// GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_ADDGROUP };
-// gcd.ptszID = chatID;
-//
-// GCEVENT gce = {0};
-// gce.cbSize = sizeof(GCEVENT);
-// gce.dwFlags = GC_TCHAR;
-// gce.pDest = &gcd;
-// for (int i = 0; i < SIZEOF(CSkypeProto::Roles); i++)
-// {
-// gce.ptszStatus =:: TranslateW(CSkypeProto::Roles[i]);
-// ::CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
-// }
-//
-// gcd.iType = GC_EVENT_CONTROL;
-// ::CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
-// ::CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
-// ::CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
-//
-// ::mir_free(chatName);
-//
-// return chatID;
-// }
-// else
-// return NULL;
-//}
+CConversation::Ref 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;
+ if (g_skype->CreateConferenceWithConsumers(conversation, needToAdd))
+ {
+ delete param;
+
+ return conversation;
+ }
+ }
+
+ delete param;
+
+ return NULL;
+}
+
+CConversation::Ref CSkypeProto::StartChat()
+{
+ StringList empty;
+ return this->StartChat(empty);
+}
+
+void CSkypeProto::InviteConactsToChat(CConversation::Ref conversation, const StringList &invitedContacts)
+{
+ SEString data;
+
+ conversation->GetPropIdentity(data);
+ wchar_t *cid = ::mir_utf8decodeW(data);
+
+ InviteChatParam *param = new InviteChatParam(cid, invitedContacts, this);
+
+ if (::DialogBoxParam(
+ g_hInstance,
+ MAKEINTRESOURCE(IDD_CHATROOM_INVITE),
+ NULL,
+ CSkypeProto::InviteToChatProc,
+ (LPARAM)param) == IDOK)
+ {
+ SEStringList needToAdd;
+ for (size_t i = 0; i < param->invitedContacts.size(); i++)
+ needToAdd.append(std::string(::mir_utf8encodeW(param->invitedContacts[i])).c_str());
+
+ conversation->AddConsumers(needToAdd);
+ }
+
+ delete param;
+
+ ::mir_free(cid);
+}
void CSkypeProto::JoinToChat(CConversation::Ref conversation, bool showWindow)
{
@@ -275,10 +280,7 @@ void CSkypeProto::JoinToChat(CConversation::Ref conversation, bool showWindow)
SEString data;
conversation->GetPropIdentity(data);
- wchar_t *chatID = ::mir_utf8decodeW(data);
-
- //conversation->GetPropDisplayname(data);
- //wchar_t *chatName = ::mir_utf8decodeW(data);
+ wchar_t *cid = ::mir_utf8decodeW(data);
this->CreateChatWindow(conversation, showWindow);
@@ -287,26 +289,25 @@ void CSkypeProto::JoinToChat(CConversation::Ref conversation, bool showWindow)
for (uint i = 0; i < participants.size(); i++)
{
participants[i]->GetPropIdentity(data);
- mir_ptr<wchar_t> sid = ::mir_utf8decodeW(data);
+ std::wstring sid = ::mir_utf8decodeW(data);
CParticipant::RANK rank;
participants[i]->GetPropRank(rank);
CContact::Ref contact;
- g_skype->GetContact((char *)mir_ptr<char>(::mir_utf8encodeW(sid)), contact);
+ g_skype->GetContact(std::string(::mir_utf8encodeW(sid.c_str())).c_str(), contact);
- CContact::AVAILABILITY status;
+ auto status = Contact::OFFLINE;
contact->GetPropAvailability(status);
this->AddChatContact(
- chatID,
- sid,
+ cid,
+ sid.c_str(),
CSkypeProto::Roles[rank],
- this->SkypeToMirandaStatus(status));
+ CSkypeProto::SkypeToMirandaStatus(status));
}
-// ::mir_free(chatName);
- ::mir_free(chatID);
+ ::mir_free(cid);
}
void CSkypeProto::AddConactsToChat(CConversation::Ref conversation, const StringList &invitedContacts)
@@ -395,9 +396,8 @@ void CSkypeProto::SendChatMessage(const wchar_t *cid, const wchar_t *sid, const
void CSkypeProto::AddChatContact(const wchar_t *cid, const wchar_t *sid, const wchar_t *group, const WORD status)
{
- this->RaiseChatEvent(cid, sid, GC_EVENT_JOIN);
- this->RaiseChatEvent(cid, sid, GC_EVENT_ADDSTATUS, 0, 0, CSkypeProto::Roles[SKYPE_CHAT_GROUP_WIRTER], L"Owner");
- this->RaiseChatEvent(cid, sid, GC_EVENT_SETCONTACTSTATUS, status);
+ this->RaiseChatEvent(cid, sid, GC_EVENT_JOIN, 0, 0, CSkypeProto::Roles[SKYPE_CHAT_GROUP_WIRTER]);
+ this->RaiseChatEvent(cid, sid, GC_EVENT_SETCONTACTSTATUS, 0, status);
}
void CSkypeProto::KickChatContact(const wchar_t *cid, const wchar_t *sid)
@@ -457,7 +457,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
if (::strcmp(gch->pDest->pszModule, this->m_szModuleName))
return 0;
- wchar_t *chatID = ::mir_wstrdup(gch->pDest->ptszID);
+ wchar_t *cid = ::mir_wstrdup(gch->pDest->ptszID);
wchar_t *sid = ::mir_wstrdup(gch->ptszUID);
switch (gch->pDest->iType)
@@ -465,7 +465,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
case GC_SESSION_TERMINATE:
{
CConversation::Ref conversation;
- if (g_skype->GetConversationByIdentity(::mir_utf8encodeW(chatID), conversation, false))
+ if (g_skype->GetConversationByIdentity(::mir_utf8encodeW(cid), conversation, false))
{
Participant::Refs participants;
conversation->GetParticipants(participants, CConversation::MYSELF);
@@ -478,7 +478,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
if (gch->ptszText && gch->ptszText[0])
{
CConversation::Ref conversation;
- if (g_skype->GetConversationByIdentity(::mir_utf8encodeW(chatID), conversation, false))
+ if (g_skype->GetConversationByIdentity(::mir_utf8encodeW(cid), conversation, false))
{
CMessage::Ref message;
::mir_ptr<char> text(::mir_utf8encodeW(gch->ptszText));
@@ -488,12 +488,14 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
break;
case GC_USER_CHANMGR:
- DialogBoxParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_CHATROOM_INVITE),
- NULL,
- CSkypeProto::InviteToChatProc,
- LPARAM(new InviteChatParam(chatID, NULL, this)));
+ {
+ CConversation::Ref conversation;
+ if (g_skype->GetConversationByIdentity(::mir_utf8encodeW(cid), conversation, false))
+ {
+ StringList invitedContacts(this->GetChatUsers(cid));
+ this->InviteConactsToChat(conversation, invitedContacts);
+ }
+ }
break;
case GC_USER_PRIVMESS:
@@ -504,16 +506,18 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
switch(gch->dwData)
{
case 10:
- ::DialogBoxParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_CHATROOM_INVITE),
- NULL,
- CSkypeProto::InviteToChatProc,
- (LPARAM)new InviteChatParam(chatID, NULL, this));
+ {
+ CConversation::Ref conversation;
+ if (g_skype->GetConversationByIdentity(::mir_utf8encodeW(cid), conversation, false))
+ {
+ StringList invitedContacts(this->GetChatUsers(cid));
+ this->InviteConactsToChat(conversation, invitedContacts);
+ }
+ }
break;
case 20:
- this->LeaveChat(chatID);
+ this->LeaveChat(cid);
break;
}
break;
@@ -530,7 +534,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
break;
case 110:
- this->LeaveChat(chatID);
+ this->LeaveChat(cid);
break;
}
break;
@@ -539,7 +543,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
break;
}
::mir_free(sid);
- ::mir_free(chatID);
+ ::mir_free(cid);
return 0;
}
@@ -630,10 +634,117 @@ void CSkypeProto::UpdateChatUserStatus(CContact::Ref contact)
sid,
GC_EVENT_SETCONTACTSTATUS,
0,
- this->SkypeToMirandaStatus(availability));
+ CSkypeProto::SkypeToMirandaStatus(availability));
//::mir_free(gci.pszID);
}
::mir_free(sid);
+}
+
+INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ InviteChatParam *param = (InviteChatParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ param = (InviteChatParam *)lParam;
+
+ HWND hwndClist = GetDlgItem(hwndDlg, IDC_CCLIST);
+ SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) & ~CLS_HIDEOFFLINE);
+
+ // WindowSetIcon(hwndDlg, "msn");
+ }
+ break;
+
+ case WM_CLOSE:
+ ::EndDialog(hwndDlg, 0);
+ break;
+
+ case WM_NCDESTROY:
+// WindowFreeIcon(hwndDlg);
+ //delete param;
+ break;
+
+ case WM_NOTIFY:
+ {
+ NMCLISTCONTROL *nmc = (NMCLISTCONTROL *)lParam;
+ if (nmc->hdr.idFrom == IDC_CCLIST)
+ {
+ switch (nmc->hdr.code)
+ {
+ case CLN_NEWCONTACT:
+ if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
+ {
+ param->ppro->ChatValidateContact(nmc->hItem, nmc->hdr.hwndFrom, param->invitedContacts);
+ }
+ break;
+
+ case CLN_LISTREBUILT:
+ if (param)
+ {
+ param->ppro->ChatPrepare(NULL, nmc->hdr.hwndFrom, param->invitedContacts);
+ }
+ break;
+ }
+ }
+ }
+ break;
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_ADDSCR:
+ if (param->ppro->IsOnline())
+ {
+ wchar_t sid[SKYPE_SID_LIMIT];
+ ::GetDlgItemText(hwndDlg, IDC_EDITSCR, sid, SIZEOF(sid));
+
+ CLCINFOITEM cii = {0};
+ cii.cbSize = sizeof(cii);
+ cii.flags = CLCIIF_CHECKBOX | CLCIIF_BELOWCONTACTS;
+ cii.pszText = ::wcslwr(sid);
+
+ HANDLE hItem = (HANDLE)::SendDlgItemMessage(
+ hwndDlg,
+ IDC_CCLIST,
+ CLM_ADDINFOITEM,
+ 0,
+ (LPARAM)&cii);
+ ::SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_SETCHECKMARK, (LPARAM)hItem, 1);
+ }
+ break;
+
+ case IDOK:
+ {
+ HWND hwndList = ::GetDlgItem(hwndDlg, IDC_CCLIST);
+
+ param->invitedContacts.clear();
+ param->ppro->GetInvitedContacts(NULL, hwndList, param->invitedContacts);
+
+ if ( !param->invitedContacts.empty())
+ {
+ //SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)bct);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ ::EndDialog(hwndDlg, IDOK);
+ }
+ else
+ param->ppro->ShowNotification(::TranslateT("You did not select any contact"));
+ }
+ break;
+
+ case IDCANCEL:
+ ::EndDialog(hwndDlg, IDCANCEL);
+ break;
+ }
+ }
+ break;
+ }
+ return FALSE;
} \ No newline at end of file
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp
index 0f805c2326..fbbb4c00bc 100644
--- a/protocols/Skype/src/skype_contacts.cpp
+++ b/protocols/Skype/src/skype_contacts.cpp
@@ -29,7 +29,7 @@ void CSkypeProto::UpdateContactStatus(HANDLE hContact, CContact::Ref contact)
{
CContact::AVAILABILITY availability;
contact->GetPropAvailability(availability);
- ::db_set_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, this->SkypeToMirandaStatus(availability));
+ ::db_set_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, CSkypeProto::SkypeToMirandaStatus(availability));
if (availability == CContact::SKYPEOUT)
{
@@ -166,8 +166,8 @@ HANDLE CSkypeProto::GetContactBySid(const wchar_t *sid)
{
if (this->IsProtoContact(hContact) && !this->IsChatRoom(hContact))
{
- mir_ptr<wchar_t> contactSid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
- if (contactSid && ::wcsicmp(sid, contactSid) == 0)
+ std::wstring contactSid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN);
+ if (contactSid.compare(sid) == 0)
return hContact;
}
@@ -296,18 +296,19 @@ void __cdecl CSkypeProto::LoadContactList(void* data)
void __cdecl CSkypeProto::LoadChatList(void*)
{
CConversation::Refs conversations;
- g_skype->GetConversationList(conversations);
+ g_skype->GetConversationList(conversations);
+
for (uint i = 0; i < conversations.size(); i++)
{
+ auto conversation = conversations[i];
+
CConversation::TYPE type;
- conversations[i]->GetPropType(type);
+ conversation->GetPropType(type);
CConversation::MY_STATUS status;
- conversations[i]->GetPropMyStatus(status);
+ conversation->GetPropMyStatus(status);
if (type == CConversation::CONFERENCE && status == CConversation::CONSUMER)
{
- auto conversation = conversations[i];
-
this->AddChatRoom(conversation);
this->JoinToChat(conversation, false);
}
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp
index 46f25de0a4..2cb8fd675e 100644
--- a/protocols/Skype/src/skype_dialogs.cpp
+++ b/protocols/Skype/src/skype_dialogs.cpp
@@ -752,153 +752,6 @@ int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
return 0;
}
-INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- InviteChatParam *param = (InviteChatParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- param = (InviteChatParam *)lParam;
-
- HWND hwndClist = GetDlgItem(hwndDlg, IDC_CCLIST);
- SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) & ~CLS_HIDEOFFLINE);
-
- // WindowSetIcon(hwndDlg, "msn");
- }
- break;
-
- case WM_CLOSE:
- ::EndDialog(hwndDlg, 0);
- break;
-
- case WM_NCDESTROY:
-// WindowFreeIcon(hwndDlg);
- delete param;
- break;
-
- case WM_NOTIFY:
- {
- NMCLISTCONTROL *nmc = (NMCLISTCONTROL *)lParam;
- if (nmc->hdr.idFrom == IDC_CCLIST)
- {
- switch (nmc->hdr.code)
- {
- case CLN_NEWCONTACT:
- if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
- {
- wchar_t *contacts = NULL;
- if (param->id)
- {
- HANDLE hContact = param->ppro->GetChatRoomByCid(param->id);
- if (hContact && param->ppro->IsContactOnline(hContact))
- {
- contacts = param->ppro->GetChatUsers(param->id);
- }
- }
- param->ppro->ChatValidateContact(nmc->hItem, nmc->hdr.hwndFrom, contacts);
- }
- break;
-
- case CLN_LISTREBUILT:
- if (param)
- {
- wchar_t *contacts = NULL;
- if (param->id)
- {
- HANDLE hContact = param->ppro->GetChatRoomByCid(param->id);
- if (hContact && param->ppro->IsContactOnline(hContact))
- {
- contacts = param->ppro->GetChatUsers(param->id);
- }
- }
- param->ppro->ChatPrepare(NULL, nmc->hdr.hwndFrom, contacts);
- }
- break;
- }
- }
- }
- break;
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_ADDSCR:
- if (param->ppro->IsOnline())
- {
- wchar_t sid[SKYPE_SID_LIMIT];
- ::GetDlgItemText(hwndDlg, IDC_EDITSCR, sid, SIZEOF(sid));
-
- CLCINFOITEM cii = {0};
- cii.cbSize = sizeof(cii);
- cii.flags = CLCIIF_CHECKBOX | CLCIIF_BELOWCONTACTS;
- cii.pszText = ::wcslwr(sid);
-
- HANDLE hItem = (HANDLE)::SendDlgItemMessage(
- hwndDlg,
- IDC_CCLIST,
- CLM_ADDINFOITEM,
- 0,
- (LPARAM)&cii);
- ::SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_SETCHECKMARK, (LPARAM)hItem, 1);
- }
- break;
-
- case IDOK:
- {
- HWND hwndList = ::GetDlgItem(hwndDlg, IDC_CCLIST);
-
- StringList invitedContacts;
- param->ppro->GetInviteContacts(NULL, hwndList, invitedContacts);
-
- wchar_t *chatID = ::mir_wstrdup(param->id);
-
- SEStringList needToAdd;
- for (uint i = 0; i < (uint)invitedContacts.getCount(); i++)
- needToAdd.append((char *)mir_ptr<char>(::mir_u2a(invitedContacts[i])));
-
- CConversation::Ref conversation;
- if (chatID)
- {
- g_skype->GetConversationByIdentity(::mir_utf8encodeW(chatID), conversation);
- conversation->AddConsumers(needToAdd);
- }
- else
- {
- g_skype->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, 1);
- conversation->AddConsumers(needToAdd);
-
- SEString data;
- conversation->GetPropIdentity(data);
- chatID = ::mir_utf8decodeW(data);
-
- //param->ppro->JoinToChat(conversation);
- }
- if (chatID)
- ::EndDialog(hwndDlg, IDOK);
- else
- param->ppro->ShowNotification(::TranslateT("You did not select any contact"));
- }
- break;
-
- case IDCANCEL:
- ::EndDialog(hwndDlg, IDCANCEL);
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
void CSkypeProto::SaveToDB(HWND hwndPage, int iPage)
{
TCHAR text[2048];
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp
index bbe7aaf9fe..c27bddb7f0 100644
--- a/protocols/Skype/src/skype_events.cpp
+++ b/protocols/Skype/src/skype_events.cpp
@@ -7,6 +7,21 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
this->InitCustomFolders();
this->InitInstanceHookList();
+ if (::ServiceExists(MS_BB_ADDBUTTON))
+ {
+ BBButton bbd = {0};
+ bbd.cbSize = sizeof(BBButton);
+ bbd.pszModuleName = MODULE;
+
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON;
+ bbd.ptszTooltip = ::TranslateT("Spawn conference");
+ bbd.hIcon = CSkypeProto::GetIconHandle("confSpawn");
+ bbd.dwButtonID = BBB_ID_CONF_SPAWN;
+ bbd.dwDefPos = 100 + bbd.dwButtonID;
+
+ ::CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
+ }
+
g_skype->SetOnMessageCallback(
(CSkype::OnMessaged)&CSkypeProto::OnMessage,
this);
@@ -75,6 +90,25 @@ int __cdecl CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam)
return 0;
}
+int __cdecl CSkypeProto::OnTabSRMMButtonPressed(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
+
+ if (cbcd->dwButtonId == BBB_ID_CONF_SPAWN)
+ {
+ if (this->IsOnline() && !this->IsChatRoom(hContact))
+ {
+ StringList targets;
+ targets.insert(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
+
+ this->StartChat(targets);
+ }
+ }
+
+ return 1;
+}
+
int CSkypeProto::OnMessagePreCreate(WPARAM, LPARAM lParam)
{
MessageWindowEvent *evt = (MessageWindowEvent *)lParam;
@@ -429,7 +463,7 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa
cid,
sid,
CSkypeProto::Roles[rank],
- status);
+ CSkypeProto::MirandaToSkypeStatus(status));
}
}
}
@@ -464,9 +498,9 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa
StringList alreadyInChat(this->GetChatUsers(cid));
StringList needToKick(::mir_utf8decodeW(data));
- for (int i = 0; i < needToKick.getCount(); i++)
+ for (size_t i = 0; i < needToKick.size(); i++)
{
- wchar_t *sid = needToKick[i];
+ const wchar_t *sid = needToKick[i];
if (::wcsicmp(sid, this->login) != 0 && !alreadyInChat.contains(sid))
this->KickChatContact(cid, sid);
}
diff --git a/protocols/Skype/src/skype_hooks.cpp b/protocols/Skype/src/skype_hooks.cpp
index 6a2e9073d7..07ad8d2dc9 100644
--- a/protocols/Skype/src/skype_hooks.cpp
+++ b/protocols/Skype/src/skype_hooks.cpp
@@ -25,6 +25,9 @@ void CSkypeProto::InitInstanceHookList()
this->instanceHookList.insert(
this->HookEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnMessagePreCreate));
+
+ this->instanceHookList.insert(
+ this->HookEvent(ME_MSG_BUTTONPRESSED, &CSkypeProto::OnTabSRMMButtonPressed));
}
void CSkypeProto::UninitInstanceHookList()
diff --git a/protocols/Skype/src/skype_icons.cpp b/protocols/Skype/src/skype_icons.cpp
index 87294370ec..e7bf1249d0 100644
--- a/protocols/Skype/src/skype_icons.cpp
+++ b/protocols/Skype/src/skype_icons.cpp
@@ -6,6 +6,7 @@ _tag_iconList CSkypeProto::IconList[] =
{ LPGENT("Call"), "call", IDI_CALL },
{ LPGENT("Invite to conference"), "confInvite", IDI_CONF_INVITE },
+ { LPGENT("Spawn conference"), "confSpawn", IDI_CONF_SPAWN },
{ LPGENT("Revoke authorization"), "authRevoke", IDI_AUTH_REVOKE },
{ LPGENT("Request authorization"), "authRequest", IDI_AUTH_REQUEST },
{ LPGENT("Grant authorization"), "authGrant", IDI_AUTH_GRANT },
diff --git a/protocols/Skype/src/skype_instances.cpp b/protocols/Skype/src/skype_instances.cpp
index 9b105ba0df..5232bd7cc8 100644
--- a/protocols/Skype/src/skype_instances.cpp
+++ b/protocols/Skype/src/skype_instances.cpp
@@ -13,8 +13,8 @@ CSkypeProto* CSkypeProto::InitSkypeProto(const char* protoName, const wchar_t* u
{
CSkypeProto::ShowNotification(
::TranslateT("SkypeKit will only permit you to login to one account at a time.\n"
- "Adding multiple instances of SkypeKit is prohibited in the licence\n"
- "agreement and standard distribution terms."),
+ L"Adding multiple instances of SkypeKit is prohibited in the licence "
+ L"agreement and standard distribution terms."),
MB_ICONWARNING);
return NULL;
}
diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp
index 565d97198f..4a117ffd37 100644
--- a/protocols/Skype/src/skype_menus.cpp
+++ b/protocols/Skype/src/skype_menus.cpp
@@ -108,12 +108,8 @@ int CSkypeProto::RevokeAuth(WPARAM wParam, LPARAM lParam)
INT_PTR CSkypeProto::InviteCommand(WPARAM, LPARAM)
{
- ::DialogBoxParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_CHATROOM_INVITE),
- NULL,
- CSkypeProto::InviteToChatProc,
- LPARAM(new InviteChatParam(NULL, NULL, this)));
+ this->StartChat();
+
return 0;
}
diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp
index 0a6fac920d..5495558b83 100644
--- a/protocols/Skype/src/skype_profile.cpp
+++ b/protocols/Skype/src/skype_profile.cpp
@@ -134,7 +134,7 @@ void CSkypeProto::UpdateProfileEmails(SEObject *obj, HANDLE hContact)
else
{
StringList emls = emails;
- for (int i = 0; i < emls.getCount(); i++)
+ for (size_t i = 0; i < emls.size(); i++)
{
std::stringstream ss;
ss << "e-mail" << i;
@@ -159,7 +159,7 @@ void CSkypeProto::UpdateProfileFullName(SEObject *obj, HANDLE hContact)
StringList names = fullname;
::db_set_ws(hContact, this->m_szModuleName, "FirstName", names[0]);
- if (names.getCount() > 1)
+ if (names.size() > 1)
::db_set_ws(hContact, this->m_szModuleName, "LastName", names[1]);
}
::mir_free(fullname);
@@ -196,7 +196,7 @@ void CSkypeProto::UpdateProfileLanguages(SEObject *obj, HANDLE hContact)
else
{
StringList langs = isocodes;
- for (int i = 0; i < langs.getCount(); i++)
+ for (size_t i = 0; i < langs.size(); i++)
{
if (CSkypeProto::languages.count(langs[i]))
{
@@ -325,14 +325,14 @@ void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact)
void __cdecl CSkypeProto::LoadOwnInfo(void *)
{
- wchar_t *nick = ::db_get_wsa(NULL, this->m_szModuleName, "Nick");
- if ( !nick || !::wcslen(nick))
+ std::wstring nick = ::db_get_wsa(NULL, this->m_szModuleName, "Nick");
+ if (nick.empty())
{
SEString data;
this->account->GetPropFullname(data);
- mir_ptr<wchar_t> nick = ::mir_utf8decodeW(data);
- ::db_set_ws(NULL, this->m_szModuleName, "Nick", nick);
+ nick = ::mir_utf8decodeW(data);
+ ::db_set_ws(NULL, this->m_szModuleName, "Nick", nick.c_str());
}
this->UpdateProfileAvatar(this->account.fetch());
this->UpdateProfile(this->account.fetch());
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp
index ba2caabe44..ccb5e43057 100644
--- a/protocols/Skype/src/skype_proto.cpp
+++ b/protocols/Skype/src/skype_proto.cpp
@@ -421,12 +421,11 @@ int __cdecl CSkypeProto::UserIsTyping(HANDLE hContact, int type)
{
if (hContact && this->IsOnline() && this->m_iStatus != ID_STATUS_INVISIBLE)
{
- mir_ptr<wchar_t> sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
+ wchar_t *sid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN);
if (::wcsicmp(sid, this->login) != 0)
{
SEStringList targets;
- mir_ptr<wchar_t> sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
- targets.append((char *)mir_ptr<char>(::mir_utf8encodeW(sid)));
+ targets.append(std::string(::mir_utf8encodeW(sid)).c_str());
CConversation::Ref conversation;
g_skype->GetConversationByParticipants(targets, conversation);
@@ -445,6 +444,7 @@ int __cdecl CSkypeProto::UserIsTyping(HANDLE hContact, int type)
}
}
}
+ ::mir_free(sid);
}
return 1;
@@ -462,6 +462,7 @@ int __cdecl CSkypeProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM
case EV_PROTO_ONMENU:
this->OnInitStatusMenu();
+ break;
case EV_PROTO_ONCONTACTDELETED:
return this->OnContactDeleted(wParam, lParam);
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h
index 7f3cfa5503..d0326c03a8 100644
--- a/protocols/Skype/src/skype_proto.h
+++ b/protocols/Skype/src/skype_proto.h
@@ -40,11 +40,11 @@ const HtmlEntity htmlEntities[]={
struct InviteChatParam
{
wchar_t *id;
- HANDLE hContact;
+ StringList invitedContacts;
CSkypeProto *ppro;
- InviteChatParam(const wchar_t *id, HANDLE hContact, CSkypeProto *ppro)
- : id(::mir_wstrdup(id)), hContact(hContact), ppro(ppro) {}
+ InviteChatParam(const wchar_t *id, const StringList &contacts, CSkypeProto *ppro)
+ : id(::mir_wstrdup(id)), invitedContacts(contacts), ppro(ppro) { /*this->invitedContacts = contacts;*/ }
~InviteChatParam()
{ ::mir_free(id); }
@@ -153,6 +153,7 @@ public:
INT_PTR __cdecl OnAccountManagerInit(WPARAM wParam, LPARAM lParam);
int __cdecl OnMessagePreCreate(WPARAM, LPARAM);
+ int __cdecl OnTabSRMMButtonPressed(WPARAM, LPARAM);
// instances
static CSkypeProto* InitSkypeProto(const char* protoName, const wchar_t* userName);
@@ -195,8 +196,9 @@ protected:
CAccount::Ref account;
CContact::Refs contactList;
CTransfer::Refs transferList;
+
CContactGroup::Ref commonList;
- CContactGroup::Ref authWaitList;
+ CContactGroup::Ref authWaitList;
// account
static wchar_t* LogoutReasons[];
@@ -215,6 +217,8 @@ protected:
void InitProxy();
void SetAccountSettings();
+ void SetServerStatus(int iStatus);
+
bool LogIn();
void LogOut();
@@ -258,25 +262,27 @@ protected:
wchar_t *CSkypeProto::GetChatUsers(const wchar_t *cid);
void CSkypeProto::UpdateChatUserStatus(CContact::Ref contact);
- void ChatValidateContact(HANDLE hItem, HWND hwndList, const wchar_t *contacts);
- void ChatPrepare(HANDLE hItem, HWND hwndList, const wchar_t *contacts);
+ void ChatValidateContact(HANDLE hItem, HWND hwndList, const StringList &contacts);
+ void ChatPrepare(HANDLE hItem, HWND hwndList, const StringList &contacts);
- void GetInviteContacts(HANDLE hItem, HWND hwndList, StringList &invitedContacts);
+ void GetInvitedContacts(HANDLE hItem, HWND hwndList, StringList &invitedContacts);
void InitChat();
- //wchar_t *StartChat(const wchar_t *cid, const SEStringList &invitedContacts);
+ CConversation::Ref StartChat();
+ CConversation::Ref StartChat(StringList &invitedContacts);
void LeaveChat(const wchar_t *cid);
void CreateChatWindow(CConversation::Ref conversation, bool showWindow = true);
void JoinToChat(CConversation::Ref conversation, bool showWindow = true);
+ void InviteConactsToChat(CConversation::Ref conversation, const StringList &invitedContacts);
void AddConactsToChat(CConversation::Ref conversation, const StringList &invitedContacts);
void RaiseChatEvent(const wchar_t *cid, const wchar_t *sid, int evt, DWORD flags = 0x0001, DWORD itemData = 0, const wchar_t *status = NULL, const wchar_t *message = NULL);
void SendChatMessage(const wchar_t *cid, const wchar_t *sid, const wchar_t *message);
void AddChatContact(const wchar_t *cid, const wchar_t *sid, const wchar_t *group, const WORD status = ID_STATUS_ONLINE);
void KickChatContact(const wchar_t *cid, const wchar_t *sid);
- void RemoveChatContact(const wchar_t *cid, const wchar_t *sid);
+ void RemoveChatContact(const wchar_t *cid, const wchar_t *sid);
INT_PTR __cdecl OnJoinChat(WPARAM wParam, LPARAM);
INT_PTR __cdecl OnLeaveChat(WPARAM wParam, LPARAM);
@@ -348,13 +354,12 @@ protected:
HANDLE m_hAvatarsFolder;
bool m_bInitDone;
- int SkypeToMirandaLoginError(CAccount::LOGOUTREASON logoutReason);
+ static int SkypeToMirandaLoginError(CAccount::LOGOUTREASON logoutReason);
static char *RemoveHtml(const char *data);
- void SetServerStatus(int iStatus);
- int SkypeToMirandaStatus(CContact::AVAILABILITY availability);
- CContact::AVAILABILITY MirandaToSkypeStatus(int status);
+ static int SkypeToMirandaStatus(CContact::AVAILABILITY availability);
+ static CContact::AVAILABILITY MirandaToSkypeStatus(int status);
static bool FileExists(wchar_t *path);
diff --git a/protocols/Skype/src/skypekit/conversation.cpp b/protocols/Skype/src/skypekit/conversation.cpp
index 2b0e26ad80..3c56e57559 100644
--- a/protocols/Skype/src/skypekit/conversation.cpp
+++ b/protocols/Skype/src/skypekit/conversation.cpp
@@ -1,13 +1,3 @@
#include "conversation.h"
-CConversation::CConversation(unsigned int oid, SERootObject* root) : Conversation(oid, root)
-{
- this->GetParticipants(this->participants, CConversation::OTHER_CONSUMERS);
- fetch(this->participants);
-}
-
-void CConversation::OnParticipantListChange()
-{
- this->GetParticipants(this->participants, CConversation::OTHER_CONSUMERS);
- fetch(this->participants);
-}
+CConversation::CConversation(unsigned int oid, SERootObject* root) : Conversation(oid, root) { } \ No newline at end of file
diff --git a/protocols/Skype/src/skypekit/conversation.h b/protocols/Skype/src/skypekit/conversation.h
index 26e7fb990b..2527ced564 100644
--- a/protocols/Skype/src/skypekit/conversation.h
+++ b/protocols/Skype/src/skypekit/conversation.h
@@ -1,7 +1,6 @@
#pragma once
#include "common.h"
-#include "participant.h"
class CConversation : public Conversation
{
@@ -10,10 +9,4 @@ public:
typedef DRefs<CConversation, Conversation> Refs;
CConversation(unsigned int oid, SERootObject* root);
-
-private:
- CSkypeProto* proto;
- CParticipant::Refs participants;
-
- void OnParticipantListChange();
}; \ No newline at end of file
diff --git a/protocols/Skype/src/skypekit/skypekit.cpp b/protocols/Skype/src/skypekit/skypekit.cpp
index 6b5b77a238..233b7b0535 100644
--- a/protocols/Skype/src/skypekit/skypekit.cpp
+++ b/protocols/Skype/src/skypekit/skypekit.cpp
@@ -46,6 +46,27 @@ CContactSearch* CSkype::newContactSearch(int oid)
return new CContactSearch(oid, this);
}
+bool CSkype::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;
+}
+
+void CSkype::SetOnMessageCallback(OnMessaged callback, CSkypeProto* proto)
+{
+ this->proto = proto;
+ this->onMessagedCallback = callback;
+}
+
void CSkype::OnMessage (
const MessageRef & message,
const bool & changesInboxTimestamp,
@@ -54,10 +75,4 @@ void CSkype::OnMessage (
{
if (this->proto)
(proto->*onMessagedCallback)(conversation, message);
-}
-
-void CSkype::SetOnMessageCallback(OnMessaged callback, CSkypeProto* proto)
-{
- this->proto = proto;
- this->onMessagedCallback = callback;
} \ No newline at end of file
diff --git a/protocols/Skype/src/skypekit/skypekit.h b/protocols/Skype/src/skypekit/skypekit.h
index faac4f3d65..3f1d7b1e58 100644
--- a/protocols/Skype/src/skypekit/skypekit.h
+++ b/protocols/Skype/src/skypekit/skypekit.h
@@ -29,6 +29,8 @@ public:
void SetOnMessageCallback(OnMessaged callback, CSkypeProto* proto);
+ bool CreateConferenceWithConsumers(ConversationRef &conference, const SEStringList &identities);
+
private:
CSkypeProto* proto;
OnMessaged onMessagedCallback;
diff --git a/protocols/Skype/src/string_list.h b/protocols/Skype/src/string_list.h
index 241080928e..df1ce7b0fa 100644
--- a/protocols/Skype/src/string_list.h
+++ b/protocols/Skype/src/string_list.h
@@ -1,13 +1,16 @@
#pragma once
-#include <m_system_cpp.h>
+#include <algorithm>
+#include <vector>
-struct StringList : public LIST<wchar_t>
+class StringList
{
- static int compare(const wchar_t* p1, const wchar_t* p2) { return ::wcsicmp(p1, p2); }
+private:
+ std::vector<std::wstring> strings;
- StringList() : LIST<wchar_t>(2, compare) {}
- StringList(const wchar_t* string, const wchar_t *delimeters = L" ") : LIST<wchar_t>(2, compare)
+public:
+ StringList() {}
+ StringList(const wchar_t* string, const wchar_t *delimeters = L" ")
{
wchar_t *data = ::mir_wstrdup(string);
if (data)
@@ -15,42 +18,44 @@ struct StringList : public LIST<wchar_t>
wchar_t *p = ::wcstok(data, delimeters);
if (p)
{
- this->insert(::mir_wstrdup(p));
+ this->strings.push_back(::mir_wstrdup(p));
while (p = wcstok(NULL, delimeters))
{
- this->insert(::mir_wstrdup(p));
+ this->strings.push_back(::mir_wstrdup(p));
}
}
::mir_free(data);
}
}
- ~StringList() { destroy(); }
+ virtual ~StringList() {}
- void destroy( void )
- {
- for (int i=0; i < count; i++)
- mir_free(items[i]);
+ __inline const wchar_t *operator[](size_t idx) const
+ {
+ return (idx >= 0 && idx < this->size()) ? this->strings[idx].c_str() : NULL;
+ }
- List_Destroy((SortedList*)this);
+ __inline void insert(const wchar_t* p)
+ {
+ this->strings.push_back(::mir_wstrdup(p));
}
- int insertn(const wchar_t* p) { return insert(::mir_wstrdup(p)); }
+ __inline bool contains(const wchar_t* p) const
+ {
+ return std::find(this->strings.begin(), this->strings.end(), p) != this->strings.end();
+ }
- int remove(int idx)
+ __inline size_t size() const
{
- mir_free(items[idx]);
- return List_Remove((SortedList*)this, idx);
+ return this->strings.size();
}
- int remove(const wchar_t* p)
+ __inline bool empty() const
{
- int idx;
- return List_GetIndex((SortedList*)this, (wchar_t*)p, &idx) == 1 ? remove(idx) : -1;
+ return this->strings.empty();
}
- bool contains(wchar_t* p) const
+ __inline void clear()
{
- int idx;
- return List_GetIndex((SortedList*)this, (wchar_t*)p, &idx) == 1;
+ this->strings.clear();
}
}; \ No newline at end of file
diff --git a/protocols/Skype/src/version.h b/protocols/Skype/src/version.h
index b68233d726..d5849e9ee3 100644
--- a/protocols/Skype/src/version.h
+++ b/protocols/Skype/src/version.h
@@ -17,4 +17,4 @@
#define __AUTHOR "Unsane, Mataes"
#define __AUTHOREMAIL "mataes2007@gmail.com"
#define __AUTHORWEB "http://miranda-ng.org/"
-#define __COPYRIGHT "© 2012 Unsane, Mataes"
+#define __COPYRIGHT "© 2012-2013 Unsane, Mataes"