diff options
27 files changed, 490 insertions, 252 deletions
diff --git a/protocols/Skype/Skype_10.vcxproj b/protocols/Skype/Skype_10.vcxproj index 2da87aff44..bd4665820e 100644 --- a/protocols/Skype/Skype_10.vcxproj +++ b/protocols/Skype/Skype_10.vcxproj @@ -240,7 +240,6 @@ </ClCompile>
<ClCompile Include="src\skype_account.cpp" />
<ClCompile Include="src\skype_avatars.cpp" />
- <ClCompile Include="src\skype_bookmarks.cpp" />
<ClCompile Include="src\skype_chat.cpp" />
<ClCompile Include="src\skype_contacts.cpp" />
<ClCompile Include="src\skype_database.cpp" />
@@ -248,6 +247,7 @@ <ClCompile Include="src\skype_events.cpp" />
<ClCompile Include="src\skype_hooks.cpp" />
<ClCompile Include="src\skype_icons.cpp" />
+ <ClCompile Include="src\skype_ignore_list.cpp" />
<ClCompile Include="src\skype_instances.cpp" />
<ClCompile Include="src\skype_menus.cpp" />
<ClCompile Include="src\skype_messages.cpp" />
diff --git a/protocols/Skype/Skype_10.vcxproj.filters b/protocols/Skype/Skype_10.vcxproj.filters index f5f122bc0e..4c25c9578a 100644 --- a/protocols/Skype/Skype_10.vcxproj.filters +++ b/protocols/Skype/Skype_10.vcxproj.filters @@ -120,7 +120,7 @@ <ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\skype_bookmarks.cpp">
+ <ClCompile Include="src\skype_ignore_list.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/protocols/Skype/Skype_11.vcxproj b/protocols/Skype/Skype_11.vcxproj index 637a824f43..f16815bcba 100644 --- a/protocols/Skype/Skype_11.vcxproj +++ b/protocols/Skype/Skype_11.vcxproj @@ -238,7 +238,6 @@ </ClCompile>
<ClCompile Include="src\skype_account.cpp" />
<ClCompile Include="src\skype_avatars.cpp" />
- <ClCompile Include="src\skype_bookmarks.cpp" />
<ClCompile Include="src\skype_chat.cpp" />
<ClCompile Include="src\skype_contacts.cpp" />
<ClCompile Include="src\skype_database.cpp" />
@@ -246,6 +245,7 @@ <ClCompile Include="src\skype_events.cpp" />
<ClCompile Include="src\skype_hooks.cpp" />
<ClCompile Include="src\skype_icons.cpp" />
+ <ClCompile Include="src\skype_ignore_list.cpp" />
<ClCompile Include="src\skype_instances.cpp" />
<ClCompile Include="src\skype_menus.cpp" />
<ClCompile Include="src\skype_messages.cpp" />
diff --git a/protocols/Skype/Skype_11.vcxproj.filters b/protocols/Skype/Skype_11.vcxproj.filters index f5f122bc0e..4c25c9578a 100644 --- a/protocols/Skype/Skype_11.vcxproj.filters +++ b/protocols/Skype/Skype_11.vcxproj.filters @@ -120,7 +120,7 @@ <ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\skype_bookmarks.cpp">
+ <ClCompile Include="src\skype_ignore_list.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/protocols/Skype/docs/todo_list.txt b/protocols/Skype/docs/todo_list.txt index d14e0d4651..581db42afa 100644 --- a/protocols/Skype/docs/todo_list.txt +++ b/protocols/Skype/docs/todo_list.txt @@ -1,7 +1,4 @@ Features:
-- add correct own info
-- multiuser chat
- voice
- video
-- editing last message as in skype
- run skype runtime from resources directly
\ No newline at end of file diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc index 09b0289af6..c2fabb0b19 100644 --- a/protocols/Skype/res/Resource.rc +++ b/protocols/Skype/res/Resource.rc @@ -7,7 +7,7 @@ //
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "afxres.h"
+#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -225,13 +225,13 @@ BEGIN LTEXT "Default group:",IDC_STATIC,15,121,63,8
END
-IDD_BOOKMARKS DIALOGEX 0, 0, 296, 262
+IDD_IGNORE_LIST DIALOGEX 0, 0, 296, 262
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Skype bookmarks"
+CAPTION "Ignore list"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "Server side bookmarks\nControl conference bookmarks on server.",IDC_HEADERBAR,
+ CONTROL "Server side ignore list\nControl ignore list on server.",IDC_HEADERBAR,
"MHeaderbarCtrl",0x0,0,0,296,25
CONTROL "List1",IDC_BM_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,6,38,282,216
END
@@ -352,7 +352,7 @@ BEGIN BOTTOMMARGIN, 231
END
- IDD_BOOKMARKS, DIALOG
+ IDD_IGNORE_LIST, DIALOG
BEGIN
VERTGUIDE, 6
VERTGUIDE, 288
@@ -379,15 +379,15 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDI_ICON ICON "main.ico"
+IDI_SKYPE ICON "skype.ico"
IDI_CALL ICON "call.ico"
-IDI_CONF_INVITE ICON "conf_invite.ico"
-IDI_CONF_SPAWN ICON "conf_spawn.ico"
+IDI_ADD_CONTACTS ICON "add_contacts.ico"
IDI_SEND_CONTACTS ICON "send_contacts.ico"
IDI_DELETE ICON "delete.ico"
-IDI_BOOKMARK ICON "bookmark.ico"
IDI_IGNORE ICON "ignore.ico"
IDI_BLOCK ICON "block.ico"
+IDI_CONFERENCE ICON "conference.ico"
+IDI_CONTACT ICON "contact.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/protocols/Skype/res/add_contacts.ico b/protocols/Skype/res/add_contacts.ico Binary files differnew file mode 100644 index 0000000000..d2b5d6a477 --- /dev/null +++ b/protocols/Skype/res/add_contacts.ico diff --git a/protocols/Skype/res/block.ico b/protocols/Skype/res/block.ico Binary files differindex 26c0a6d040..e92c4d4bce 100644 --- a/protocols/Skype/res/block.ico +++ b/protocols/Skype/res/block.ico diff --git a/protocols/Skype/res/call.ico b/protocols/Skype/res/call.ico Binary files differindex 8a202ed455..41e984fc6b 100644 --- a/protocols/Skype/res/call.ico +++ b/protocols/Skype/res/call.ico diff --git a/protocols/Skype/res/conference.ico b/protocols/Skype/res/conference.ico Binary files differnew file mode 100644 index 0000000000..7d535835c0 --- /dev/null +++ b/protocols/Skype/res/conference.ico diff --git a/protocols/Skype/res/contact.ico b/protocols/Skype/res/contact.ico Binary files differnew file mode 100644 index 0000000000..241bb8a83b --- /dev/null +++ b/protocols/Skype/res/contact.ico diff --git a/protocols/Skype/res/delete.ico b/protocols/Skype/res/delete.ico Binary files differindex ac630347c2..81a38441b1 100644 --- a/protocols/Skype/res/delete.ico +++ b/protocols/Skype/res/delete.ico diff --git a/protocols/Skype/res/ignore.ico b/protocols/Skype/res/ignore.ico Binary files differindex d8801af182..d21e262467 100644 --- a/protocols/Skype/res/ignore.ico +++ b/protocols/Skype/res/ignore.ico diff --git a/protocols/Skype/res/skype.ico b/protocols/Skype/res/skype.ico Binary files differnew file mode 100644 index 0000000000..140b9704af --- /dev/null +++ b/protocols/Skype/res/skype.ico diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h index f65b27c7e5..da62894a98 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 E:\Projects\C++\MirandaNG\protocols\Skype\res\Resource.rc
+// Used by D:\Projects\CPlusPlus\MirandaNG\protocols\Skype\res\Resource.rc
//
#define IDD_ACCMGR 9
#define IDD_OPT_MAIN 10
@@ -10,21 +10,21 @@ #define IDD_OWNINFO_CONTACT 14
#define IDD_PASSWORD_CHANGE 15
#define IDD_CHATROOM_INVITE 40
-#define IDI_ICON 101
+#define IDI_SKYPE 101
#define IDR_RUNTIME 102
#define IDD_PASSWORD_REQUEST 106
#define IDR_KEY 107
#define IDI_CALL 108
#define IDI_CONF_INVITE 109
-#define IDI_CONF_SPAWN 110
+#define IDI_ADD_CONTACTS 109
#define IDI_SEND_CONTACTS 111
#define IDD_CHATROOM_CREATE 111
#define IDD_CHATROOM_CONFIG 112
#define IDI_DELETE 112
-#define IDI_BOOKMARK 113
#define IDI_IGNORE 114
-#define IDI_ICON1 115
#define IDI_BLOCK 115
+#define IDI_CONFERENCE 116
+#define IDI_CONTACT 117
#define IDC_CCLIST 173
#define IDC_EDITSCR 174
#define IDC_ADDSCR 175
@@ -92,13 +92,14 @@ #define IDC_CHECK2 1054
#define IDC_HEADERBAR 1320
#define IDD_BOOKMARKS 3001
+#define IDD_IGNORE_LIST 3001
#define IDC_BM_LIST 3002
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 116
+#define _APS_NEXT_RESOURCE_VALUE 118
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1054
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h index 098a5efeb8..696551b041 100644 --- a/protocols/Skype/src/skype.h +++ b/protocols/Skype/src/skype.h @@ -15,6 +15,7 @@ #include <newpluginapi.h>
#include <m_system_cpp.h>
+#include <m_assocmgr.h>
#include <m_avatars.h>
#include <m_clist.h>
#include <m_clistint.h>
@@ -61,7 +62,6 @@ #define BBB_ID_CONF_INVITE 2001
#define BBB_ID_CONF_SPAWN 2002
-#define BBB_ID_CONF_BOOKMARK 2003
#define SKYPE_DB_EVENT_TYPE_EMOTE 10001
#define SKYPE_DB_EVENT_TYPE_CONTACTS 10002
@@ -72,14 +72,13 @@ enum CMI_AUTH_REQUEST,
CMI_AUTH_GRANT,
CMI_AUTH_REVOKE,
- CMI_CHAT_BOOKMARK,
CMI_IGNORE,
CMI_BLOCK,
CMI_MAX // this item shall be the last one
};
-#define SMI_CHAT_INVITE 1
-#define SMI_CHAT_BOOKMARKS 2
+#define SMI_CHAT_CREATE 1
+#define SMI_IGNORE_LIST 2
#include "string_list.h"
diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp index ca4f38b4ac..47ad1b71d2 100644 --- a/protocols/Skype/src/skype_account.cpp +++ b/protocols/Skype/src/skype_account.cpp @@ -4,38 +4,38 @@ wchar_t *CSkypeProto::LogoutReasons[] = {
LPGENW("") /* --- */,
LPGENW("LOGOUT_CALLED") /* LOGOUT_CALLED */,
- LPGENW("HTTPS_PROXY_AUTH_FAILED") /* HTTPS_PROXY_AUTH_FAILED */,
- LPGENW("SOCKS_PROXY_AUTH_FAILED") /* SOCKS_PROXY_AUTH_FAILED */,
- LPGENW("P2P_CONNECT_FAILED") /* P2P_CONNECT_FAILED */,
+ LPGENW("HTTPS proxy authentication failed") /* HTTPS_PROXY_AUTH_FAILED */,
+ LPGENW("SOCKS proxy authentication failed") /* SOCKS_PROXY_AUTH_FAILED */,
+ LPGENW("P2P connection failed") /* P2P_CONNECT_FAILED */,
LPGENW("SERVER_CONNECT_FAILED") /* SERVER_CONNECT_FAILED */,
- LPGENW("SERVER_OVERLOADED") /* SERVER_OVERLOADED */,
- LPGENW("DB_IN_USE") /* DB_IN_USE */,
+ LPGENW("Server is overloaded") /* SERVER_OVERLOADED */,
+ LPGENW("SkypeKit database already in use") /* DB_IN_USE */,
LPGENW("Invalid skypename") /* INVALID_SKYPENAME */,
LPGENW("Invalid email") /* INVALID_EMAIL */,
LPGENW("Unacceptable password") /* UNACCEPTABLE_PASSWORD */,
- LPGENW("SKYPENAME_TAKEN") /* SKYPENAME_TAKEN */,
+ LPGENW("Skype name is taken") /* SKYPENAME_TAKEN */,
LPGENW("REJECTED_AS_UNDERAGE") /* REJECTED_AS_UNDERAGE */,
LPGENW("NO_SUCH_IDENTITY") /* NO_SUCH_IDENTITY */,
LPGENW("Incorrect password") /* INCORRECT_PASSWORD */,
LPGENW("Too many login attempts") /* TOO_MANY_LOGIN_ATTEMPTS */,
- LPGENW("PASSWORD_HAS_CHANGED") /* PASSWORD_HAS_CHANGED */,
+ LPGENW("Password has changed") /* PASSWORD_HAS_CHANGED */,
LPGENW("PERIODIC_UIC_UPDATE_FAILED") /* PERIODIC_UIC_UPDATE_FAILED */,
LPGENW("DB_DISK_FULL") /* DB_DISK_FULL */,
LPGENW("DB_IO_ERROR") /* DB_IO_ERROR */,
- LPGENW("DB_CORRUPT") /* DB_CORRUPT */,
+ LPGENW("SkypeKit database is corrupt") /* DB_CORRUPT */,
LPGENW("DB_FAILURE") /* DB_FAILURE */,
- LPGENW("INVALID_APP_ID") /* INVALID_APP_ID */,
+ LPGENW("Invalid application ID") /* INVALID_APP_ID */,
LPGENW("APP_ID_FAILURE") /* APP_ID_FAILURE */,
- LPGENW("UNSUPPORTED_VERSION") /* UNSUPPORTED_VERSION */,
- LPGENW("ATO (Account TakeOver) detected, account blocked") /* ATO_BLOCKED */,
+ LPGENW("Version is unsupported") /* UNSUPPORTED_VERSION */,
+ LPGENW("Account blocked") /* ATO_BLOCKED */,
LPGENW("Logout from another instance") /* REMOTE_LOGOUT */,
- LPGENW("") /* ACCESS_TOKEN_RENEWAL_FAILED */
+ LPGENW("ACCESS_TOKEN_RENEWAL_FAILED") /* ACCESS_TOKEN_RENEWAL_FAILED */
};
wchar_t *CSkypeProto::PasswordChangeReasons[] =
{
- LPGENW("Password change succeeded") /* PWD_OK */,
- LPGENW("") /* PWD_CHANGING */,
+ LPGENW("Password successfully changed") /* PWD_OK */,
+ LPGENW("Password changing") /* PWD_CHANGING */,
LPGENW("Old password was incorrect") /* PWD_INVALID_OLD_PASSWORD */,
LPGENW("Failed to verify password. No connection to server") /* PWD_SERVER_CONNECT_FAILED */,
LPGENW("Password was set but server didn't like it much") /* PWD_OK_BUT_CHANGE_SUGGESTED */,
@@ -56,7 +56,10 @@ bool CSkypeProto::PrepareLogin() {
this->m_iStatus = ID_STATUS_OFFLINE;
this->SendBroadcast(ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
- this->ShowNotification(::TranslateT("You have not entered a Skype name.\nConfigure this in Options->Network->Skype and try again."));
+
+ wchar_t message[512];
+ ::mir_sntprintf(message, SIZEOF(message), ::TranslateT("You have not entered a Skype name.\nConfigure this in Options->Network->%s and try again."), this->m_tszUserName);
+ this->ShowNotification(message);
return false;
}
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index b5180c1c6f..14d22d1955 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -187,7 +187,7 @@ void ChatRoom::CreateChatSession(bool showWindow) this->ppro->Log(L"Created new chat session %s", this->cid);
}
-void ChatRoom::Create(const StringList &invitedMembers, CSkypeProto *ppro, ChatRoomParam *param)
+void ChatRoom::Create(const StringList &invitedMembers, CSkypeProto *ppro, const ChatRoomParam *param)
{
SEString data;
ChatRoom *room = NULL;
@@ -849,28 +849,6 @@ void ChatRoom::OnChange(const ConversationRef &conversation, int prop) }
break;
- case Conversation::P_IS_BOOKMARKED:
- {
- if (conversation->GetBoolProp(Conversation::P_IS_BOOKMARKED))
- ::db_set_b(hContact, this->ppro->m_szModuleName, "IsBookmarked", 1);
- else
- ::db_unset(hContact, this->ppro->m_szModuleName, "IsBookmarked");
-
- if (this->hContact)
- {
- BBButton bbd = { sizeof(bbd) };
- bbd.pszModuleName = MODULE;
- bbd.bbbFlags = 0;
- if (::strcmp(::GetContactProto(this->hContact), this->ppro->m_szModuleName) != 0)
- bbd.bbbFlags = BBSF_HIDDEN | BBSF_DISABLED;
- else if (this->ppro->IsChatRoomBookmarked(this->hContact))
- bbd.bbbFlags = BBSF_DISABLED;
- bbd.dwButtonID = BBB_ID_CONF_BOOKMARK;
- ::CallService(MS_BB_SETBUTTONSTATE, (WPARAM)this->hContact, (LPARAM)&bbd);
- }
- }
- break;
-
case Conversation::P_LOCAL_LIVESTATUS:
{
Conversation::LOCAL_LIVESTATUS liveStatus;
@@ -1145,11 +1123,6 @@ bool CSkypeProto::IsChatRoom(HANDLE hContact) return ::db_get_b(hContact, this->m_szModuleName, "ChatRoom", 0) == 1;
}
-bool CSkypeProto::IsChatRoomBookmarked(HANDLE hContact)
-{
- return ::db_get_b(hContact, this->m_szModuleName, "IsBookmarked", 0) == 1;
-}
-
HANDLE CSkypeProto::GetChatRoomByCid(const wchar_t *cid)
{
HANDLE hContact = NULL;
@@ -1181,10 +1154,12 @@ void CSkypeProto::StartChat(StringList &invitedContacts) delete param;
}
-void CSkypeProto::StartChat()
+INT_PTR CSkypeProto::CreateChatRoomCommand(WPARAM, LPARAM)
{
StringList empty;
- return this->StartChat(empty);
+ this->StartChat(empty);
+
+ return 0;
}
void CSkypeProto::InviteToChatRoom(HANDLE hContact)
@@ -1217,17 +1192,6 @@ void CSkypeProto::InviteToChatRoom(HANDLE hContact) ::mir_free(gci.pszID);
}
-void CSkypeProto::BookmarkChatRoom(HANDLE hContact)
-{
- ptrW cid = ::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID");
- ChatRoom *room = (ChatRoom *)this->FindChatRoom(cid);
- if (room != NULL && room->conversation)
- {
- bool state = room->conversation->GetBoolProp(Conversation::P_IS_BOOKMARKED);
- room->conversation->SetBookmark(!state);
- }
-}
-
void CSkypeProto::CloseAllChatSessions()
{
GC_INFO gci = {0};
@@ -1607,6 +1571,29 @@ void CSkypeProto:: UpdateChatUserNick(CContact::Ref contact) }
}
+void CSkypeProto::CreateChat(const ChatRoomParam *param)
+{
+ ChatRoom::Create(param->invitedContacts, this, param);
+}
+
+void CSkypeProto::JoinToChat(const wchar_t *joinBlob)
+{
+ SEString data;
+ ConversationRef conversation;
+ if (this->GetConversationByBlob(data, conversation))
+ {
+ conversation->GetPropIdentity(data);
+ ptrW cid(::mir_utf8decodeW(data));
+
+ conversation->GetPropDisplayname(data);
+ ptrW name(::mir_utf8decodeW(data));
+
+ CSkypeProto::ReplaceSpecialChars(cid);
+ ChatRoom *room = new ChatRoom(cid, name, this);
+ room->Start(conversation, true);
+ }
+}
+
INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM)
{
HANDLE hContact = (HANDLE)wParam;
@@ -1617,20 +1604,13 @@ INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM) ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
ptrA cidA(::mir_utf8encodeW(cid));
- SEString data;
ConversationRef conversation;
if (this->GetConversationByIdentity((char *)cidA, conversation))
{
+ SEString data;
conversation->GetJoinBlob(data);
- if (this->GetConversationByBlob(data, conversation))
- {
- conversation->GetPropDisplayname(data);
- ptrW name(::mir_utf8decodeW(data));
-
- CSkypeProto::ReplaceSpecialChars(cid);
- ChatRoom *room = new ChatRoom(cid, name, this);
- room->Start(conversation, true);
- }
+ ptrW joinBlob(::mir_utf8decodeW(data));
+ this->JoinToChat(joinBlob);
}
}
else
diff --git a/protocols/Skype/src/skype_chat.h b/protocols/Skype/src/skype_chat.h index b40d4c7f52..29e27e8885 100644 --- a/protocols/Skype/src/skype_chat.h +++ b/protocols/Skype/src/skype_chat.h @@ -159,7 +159,7 @@ public: HANDLE GetContactHandle() const;
- static void Create(const StringList &invitedMembers, CSkypeProto *ppro, ChatRoomParam *param);
+ static void Create(const StringList &invitedMembers, CSkypeProto *ppro, const ChatRoomParam *param);
void Start(const ConversationRef &conversation, bool showWindow = false);
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 87a9346fd7..f63cbed0c5 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -7,6 +7,12 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) this->InitCustomFolders();
this->InitInstanceHookList();
+ /*if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
+ {
+ ::CreateServiceFunction(MODULE"/ParseSkypeURI", &CSkypeProto::ParseSkypeUri);
+ ::AssocMgr_AddNewUrlTypeT("skype:", TranslateT("Skype URI"), g_hInstance, IDI_SKYPE, MODULE"/ParseSkypeURI", 0);
+ }*/
+
if (::ServiceExists(MS_BB_ADDBUTTON))
{
BBButton bbd = { sizeof(bbd) };
@@ -14,25 +20,18 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
bbd.ptszTooltip = ::TranslateT("Invite contacts to conference");
- bbd.hIcon = CSkypeProto::GetIconHandle("confInvite");
+ bbd.hIcon = CSkypeProto::GetIconHandle("addContacts");
bbd.dwButtonID = BBB_ID_CONF_INVITE;
bbd.dwDefPos = 100 + bbd.dwButtonID;
::CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON;
bbd.ptszTooltip = ::TranslateT("Spawn conference");
- bbd.hIcon = CSkypeProto::GetIconHandle("confSpawn");
+ bbd.hIcon = CSkypeProto::GetIconHandle("conference");
bbd.dwButtonID = BBB_ID_CONF_SPAWN;
bbd.dwDefPos = 100 + bbd.dwButtonID;
::CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
- bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.ptszTooltip = ::TranslateT("Bookmark");
- bbd.hIcon = CSkypeProto::GetIconHandle("bookmark");
- bbd.dwButtonID = BBB_ID_CONF_BOOKMARK;
- bbd.dwDefPos = 100 + bbd.dwButtonID;
- ::CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
-
this->HookEvent(ME_MSG_WINDOWEVENT, &CSkypeProto::OnSrmmWindowOpen);
}
@@ -51,9 +50,6 @@ int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) bbd.dwButtonID = BBB_ID_CONF_SPAWN;
::CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd);
-
- bbd.dwButtonID = BBB_ID_CONF_BOOKMARK;
- ::CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd);
}
this->SetStatus(ID_STATUS_OFFLINE);
@@ -166,14 +162,6 @@ int __cdecl CSkypeProto::OnSrmmWindowOpen(WPARAM, LPARAM lParam) bbd.dwButtonID = BBB_ID_CONF_SPAWN;
::CallService(MS_BB_SETBUTTONSTATE, (WPARAM)ev->hContact, (LPARAM)&bbd);
-
- bbd.bbbFlags = 0;
- if (::strcmp(::GetContactProto(ev->hContact), this->m_szModuleName) != 0)
- bbd.bbbFlags = BBSF_HIDDEN | BBSF_DISABLED;
- else if (this->IsChatRoomBookmarked(ev->hContact))
- bbd.bbbFlags = BBSF_DISABLED;
- bbd.dwButtonID = BBB_ID_CONF_BOOKMARK;
- ::CallService(MS_BB_SETBUTTONSTATE, (WPARAM)ev->hContact, (LPARAM)&bbd);
}
return 0;
}
@@ -199,10 +187,6 @@ int __cdecl CSkypeProto::OnTabSRMMButtonPressed(WPARAM wParam, LPARAM lParam) this->StartChat(targets);
}
break;
-
- case BBB_ID_CONF_BOOKMARK:
- this->SetBookmarkCommand(wParam, 0);
- break;
}
return 1;
diff --git a/protocols/Skype/src/skype_icons.cpp b/protocols/Skype/src/skype_icons.cpp index ceb520dc69..03a66d61ce 100644 --- a/protocols/Skype/src/skype_icons.cpp +++ b/protocols/Skype/src/skype_icons.cpp @@ -2,13 +2,13 @@ _tag_iconList CSkypeProto::IconList[] =
{
- { LPGENT("Protocol icon"), "main", IDI_ICON },
+ { LPGENT("Protocol icon"), "main", IDI_SKYPE },
{ LPGENT("Call"), "call", IDI_CALL },
- { LPGENT("Invite to conference"), "confInvite", IDI_CONF_INVITE },
- { LPGENT("Spawn conference"), "confSpawn", IDI_CONF_SPAWN },
+ { LPGENT("Invite to conference"), "addContacts", IDI_ADD_CONTACTS },
+ { LPGENT("Conference"), "conference", IDI_CONFERENCE },
{ LPGENT("Send contact"), "sendContacts", IDI_SEND_CONTACTS },
- { LPGENT("Bookmark"), "bookmark", IDI_BOOKMARK },
+ { LPGENT("Contact"), "contact", IDI_CONTACT },
{ LPGENT("Delete"), "delete", IDI_DELETE },
{ LPGENT("Ignore"), "ignore", IDI_IGNORE },
{ LPGENT("Block"), "block", IDI_BLOCK },
diff --git a/protocols/Skype/src/skype_ignore_list.cpp b/protocols/Skype/src/skype_ignore_list.cpp new file mode 100644 index 0000000000..008fd85045 --- /dev/null +++ b/protocols/Skype/src/skype_ignore_list.cpp @@ -0,0 +1,283 @@ +#include "skype.h"
+#include "skype_chat.h"
+
+int CSkypeProto::IgnoreCommand(WPARAM wParam, LPARAM)
+{
+ CContact::Ref contact;
+ HANDLE hContact = (HANDLE)wParam;
+ SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
+ if (this->GetContact(sid, contact))
+ {
+ //bool state = ::CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_ALL);
+ bool state = ::db_get_b(hContact, this->m_szModuleName, "Ignore", 0) > 0;
+ if (contact->SetBlocked(!state))
+ {
+ //::CallService(!state ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, wParam, IGNOREEVENT_ALL);
+ ::db_set_b(hContact, this->m_szModuleName, "Ignore", (int)!state);
+ }
+ }
+
+ return 0;
+}
+
+int CSkypeProto::BlockCommand(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact)
+ {
+ this->IgnoreCommand(wParam, lParam);
+
+ ::db_set_b(hContact, "CList", "Hidden", 1);
+ }
+
+ return 0;
+}
+
+INT_PTR CSkypeProto::OpenIgnoreListCommand(WPARAM, LPARAM)
+{
+ ::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_IGNORE_LIST), NULL, CSkypeProto::IgnoreListWndProc, (LPARAM)this);
+
+ return 0;
+}
+
+static WNDPROC oldWndProc = NULL;
+
+static LRESULT CALLBACK IgnoreListSubProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ if (msg == WM_LBUTTONDOWN)
+ {
+ LVHITTESTINFO hi;
+ hi.pt.x = LOWORD(lParam); hi.pt.y = HIWORD(lParam);
+ ListView_SubItemHitTest(hwnd, &hi);
+ if (hi.iSubItem == 1)
+ {
+ LVITEM lvi = {0};
+ lvi.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_GROUPID;
+ lvi.stateMask = -1;
+ lvi.iItem = hi.iItem;
+ if (ListView_GetItem(hwnd, &lvi))
+ {
+ if (lvi.iGroupId == 1)
+ {
+ CContact *contact = (CContact *)lvi.lParam;
+
+ if (contact->SetBlocked(false))
+ ListView_DeleteItem(hwnd, lvi.iItem);
+ }
+ /*else if (lvi.iGroupId == 2)
+ {
+ CConversation *convo = (CConversation *)lvi.lParam;
+
+ if (convo->SetBlocked(false))
+ ListView_DeleteItem(hwnd, lvi.iItem);
+ }*/
+ }
+ }
+ }
+
+ return ::CallWindowProc(oldWndProc, hwnd, msg, wParam, lParam);
+}
+
+int ImageList_AddIconFromIconLib(HIMAGELIST hIml, const char *name)
+{
+ HICON icon = ::Skin_GetIconByHandle(::Skin_GetIconHandle(name));
+ int res = ImageList_AddIcon(hIml, icon);
+ ::Skin_ReleaseIcon(icon);
+ return res;
+}
+
+INT_PTR CALLBACK CSkypeProto::IgnoreListWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ if (lParam)
+ {
+ ppro = (CSkypeProto *)lParam;
+ ::TranslateDialogDefault(hwndDlg);
+
+ ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+
+ ::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)::Skin_GetIcon("Skype_block", ICON_BIG));
+ ::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)::Skin_GetIcon("Skype_block"));
+
+ HWND hwndList = ::GetDlgItem(hwndDlg, IDC_BM_LIST);
+ { // IDC_BM_LIST setup
+ oldWndProc = (WNDPROC)::SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)IgnoreListSubProc);
+
+ HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 4, 0);
+ ImageList_AddIconFromIconLib(hIml, "Skype_contact");
+ ImageList_AddIconFromIconLib(hIml, "Skype_delete");
+ ListView_SetImageList(hwndList, hIml, LVSIL_SMALL);
+
+ ///
+ LVCOLUMN lvc = {0};
+ lvc.mask = LVCF_WIDTH | LVCF_TEXT;
+
+ //lvc.fmt = LVCFMT_JUSTIFYMASK;
+ lvc.pszText = TranslateT("Name");
+ lvc.cx = 220; // width of column in pixels
+ ListView_InsertColumn(hwndList, 0, &lvc);
+
+ //lvc.fmt = LVCFMT_RIGHT;
+ lvc.pszText = L"";
+ lvc.cx = 32 - GetSystemMetrics(SM_CXVSCROLL); // width of column in pixels
+ ListView_InsertColumn(hwndList, 1, &lvc);
+
+ ///
+ LVGROUP lvg;
+ lvg.cbSize = sizeof(LVGROUP);
+ lvg.mask = LVGF_HEADER | LVGF_GROUPID;
+
+ lvg.pszHeader = ::TranslateT("Contacts");
+ lvg.iGroupId = 1;
+ ListView_InsertGroup(hwndList, 0, &lvg);
+
+ lvg.pszHeader = ::TranslateT("Conferences");
+ lvg.iGroupId = 2;
+ ListView_InsertGroup(hwndList, 0, &lvg);
+
+ ListView_EnableGroupView(hwndList, TRUE);
+
+ ::SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
+
+ if ( !ppro->IsOnline())
+ ::EnableWindow(hwndList, FALSE);
+ }
+
+ SEString data;
+ ContactGroupRef blockedList;
+ ppro->GetHardwiredContactGroup(ContactGroup::CONTACTS_BLOCKED_BY_ME, blockedList);
+
+ ContactRefs contacts;
+ blockedList->GetContacts(contacts);
+ for (size_t i = 0; i < contacts.size(); i++)
+ {
+ auto contact = contacts[i];
+
+ contact->GetPropDisplayname(data);
+ ptrW name = ::mir_utf8decodeW(data);
+
+ LVITEM lvi = {0};
+ lvi.mask = LVIF_GROUPID | LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
+ lvi.iItem = (int)i;
+ lvi.iGroupId = 1;
+ lvi.iImage = 0;
+ lvi.lParam = (LPARAM)contact.fetch();
+ lvi.pszText = name;
+ int iRow = ListView_InsertItem(hwndList, &lvi);
+
+ if (iRow != -1)
+ {
+ lvi.iItem = iRow;
+ lvi.mask = LVIF_IMAGE;
+ lvi.iSubItem = 1;
+ lvi.iImage = 1;
+ ListView_SetItem(hwndList, &lvi);
+ }
+ }
+
+ ConversationRefs conversations;
+ blockedList->GetConversations(conversations);
+ for (size_t i = 0; i < conversations.size(); i++)
+ {
+ auto conversation = conversations[i];
+
+ uint type = conversation->GetUintProp(Conversation::P_TYPE);
+ if (type != Conversation::CONFERENCE)
+ continue;
+
+ conversation->GetPropDisplayname(data);
+ ptrW name = ::mir_utf8decodeW(data);
+
+ LVITEM lvi = {0};
+ lvi.mask = LVIF_GROUPID | LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
+ lvi.iItem = (int)i;
+ lvi.iGroupId = 2;
+ lvi.iImage = 0;
+ lvi.lParam = (LPARAM)conversation.fetch();
+ lvi.pszText = name;
+ int iRow = ListView_InsertItem(hwndList, &lvi);
+
+ if (iRow != -1)
+ {
+ lvi.iItem = iRow;
+ lvi.mask = LVIF_IMAGE;
+ lvi.iSubItem = 1;
+ lvi.iImage = 1;
+ ListView_SetItem(hwndList, &lvi);
+ }
+ }
+
+ ::Utils_RestoreWindowPosition(hwndDlg, 0, MODULE, "BookmarksWindow");
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch(LOWORD(wParam))
+ {
+ case IDC_BM_LIST:
+ if (((LPNMHDR)lParam)->code == NM_DBLCLK)
+ {
+ HWND hwndList = ::GetDlgItem(hwndDlg, IDC_BM_LIST);
+ int iItem = ListView_GetNextItem(hwndList, -1, LVNI_ALL | LVNI_SELECTED);
+ if (iItem < 0) break;
+ LVITEM lvi = {0};
+ lvi.mask = LVIF_PARAM | LVIF_GROUPID;
+ lvi.stateMask = -1;
+ lvi.iItem = iItem;
+ if (ListView_GetItem(hwndList, &lvi))
+ {
+ SEString data;
+ if (lvi.iGroupId == 1)
+ {
+ CContact *contact = (CContact *)lvi.lParam;
+
+ contact->GetIdentity(data);
+ ptrW sid(::mir_utf8decodeW(data));
+ ::CallService(MS_MSG_SENDMESSAGE, (WPARAM)ppro->GetContactBySid(sid), 0);
+ }
+ else if (lvi.iGroupId == 2)
+ {
+ CConversation *conversation = (CConversation *)lvi.lParam;
+
+ conversation->GetPropIdentity(data);
+ ptrW cid(::mir_utf8decodeW(data));
+ CSkypeProto::ReplaceSpecialChars(cid);
+
+ ChatRoom *room = ppro->FindChatRoom(cid);
+ if (room != NULL)
+ ::CallProtoService(ppro->m_szModuleName, PS_JOINCHAT, (WPARAM)room->GetContactHandle(), 0);
+ else
+ {
+ conversation->GetPropDisplayname(data);
+ ptrW name = ::mir_utf8decodeW(data);
+
+ ChatRoom *room = new ChatRoom(cid, name, ppro);
+ room->Start(conversation->ref(), true);
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case WM_COMMAND:
+ if (HIWORD( wParam ) == BN_CLICKED)
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDCANCEL:
+ ::Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "BookmarksWindow");
+ ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
+ ::DestroyWindow(hwndDlg);
+ return TRUE;
+ }
+ }
+ break;
+ }
+ return FALSE;
+}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_instances.cpp b/protocols/Skype/src/skype_instances.cpp index c0a6ed0bd6..8a4c2b6f99 100644 --- a/protocols/Skype/src/skype_instances.cpp +++ b/protocols/Skype/src/skype_instances.cpp @@ -72,3 +72,17 @@ void CSkypeProto::UninitInstances() {
instanceList.destroy();
}
+
+CSkypeProto* CSkypeProto::GetContactInstance(HANDLE hContact)
+{
+ char *proto = (char *)::CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+
+ if (proto == NULL)
+ return NULL;
+
+ for (int i = 0; i < CSkypeProto::instanceList.getCount(); i++)
+ if ( !::strcmp(proto, CSkypeProto::instanceList[i]->m_szModuleName))
+ return CSkypeProto::instanceList[i];
+
+ return NULL;
+}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp index 5f9b5a4e73..527e90ac76 100644 --- a/protocols/Skype/src/skype_menus.cpp +++ b/protocols/Skype/src/skype_menus.cpp @@ -14,10 +14,10 @@ INT_PTR CSkypeProto::MenuChooseService(WPARAM wParam, LPARAM lParam) int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
{
HANDLE hContact = (HANDLE)wParam;
- if (hContact == NULL)
+ if ( !hContact)
return 0;
- if ( !this->IsOnline() || lstrcmpA( GetContactProto(hContact), m_szModuleName))
+ if ( !this->IsOnline() || ::lstrcmpA(::GetContactProto(hContact), m_szModuleName))
return 0;
if ( !this->IsChatRoom(hContact))
@@ -36,44 +36,20 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS;
+ //::CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_ALL);
if (::db_get_b(hContact, this->m_szModuleName, "Ignore", 0) == 1)
clmi.flags |= CMIF_CHECKED;
::CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)CSkypeProto::contactMenuItems[CMI_IGNORE], (LPARAM)&clmi);
}
- else
- {
- // bookmark
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
-
- if (this->IsChatRoomBookmarked(hContact))
- clmi.flags |= CMIF_CHECKED;
-
- ::CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)CSkypeProto::contactMenuItems[CMI_CHAT_BOOKMARK], (LPARAM)&clmi);
- }
return 0;
}
-CSkypeProto* CSkypeProto::GetInstanceByHContact(HANDLE hContact)
-{
- char *proto = (char *)::CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
-
- if (proto == NULL)
- return NULL;
-
- for (int i = 0; i < CSkypeProto::instanceList.getCount(); i++)
- if ( !::strcmp(proto, CSkypeProto::instanceList[i]->m_szModuleName))
- return CSkypeProto::instanceList[i];
-
- return NULL;
-}
-
template<int (__cdecl CSkypeProto::*Service)(WPARAM, LPARAM)>
INT_PTR GlobalService(WPARAM wParam, LPARAM lParam)
{
- CSkypeProto *ppro = CSkypeProto::GetInstanceByHContact((HANDLE)wParam);
+ CSkypeProto *ppro = CSkypeProto::GetContactInstance((HANDLE)wParam);
return ppro ? (ppro->*Service)(wParam, lParam) : 0;
}
@@ -86,7 +62,7 @@ int CSkypeProto::GrantAuth(WPARAM wParam, LPARAM lParam) {
CContact::Ref contact;
HANDLE hContact = (HANDLE)wParam;
- SEString sid(::mir_u2a(mir_ptr<wchar_t>(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))));
+ SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
if (this->GetContact(sid, contact))
{
if (contact->SetBuddyStatus(true))
@@ -114,65 +90,12 @@ int CSkypeProto::RevokeAuth(WPARAM wParam, LPARAM lParam) return 0;
}
-int CSkypeProto::IgnoreCommand(WPARAM wParam, LPARAM)
-{
- CContact::Ref contact;
- HANDLE hContact = (HANDLE)wParam;
- SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
- if (this->GetContact(sid, contact))
- {
- bool state = ::db_get_b(hContact, this->m_szModuleName, "Ignore", 0) > 0;
- if (contact->SetBlocked(!state))
- {
- ::CallService(!state ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, wParam, IGNOREEVENT_ALL);
- ::db_set_b(hContact, this->m_szModuleName, "Ignore", (int)!state);
- }
- }
-
- return 0;
-}
-
-int CSkypeProto::BlockCommand(WPARAM wParam, LPARAM)
-{
- CContact::Ref contact;
- HANDLE hContact = (HANDLE)wParam;
- SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
- if (this->GetContact(sid, contact))
- {
- if (contact->SetBuddyStatus(false))
- ::db_set_b(hContact, this->m_szModuleName, "Grant", 1);
- this->contactList.remove_val(contact);
-
- bool state = ::db_get_b(hContact, this->m_szModuleName, "Ignore", 0) > 0;
- if (contact->SetBlocked(!state))
- ::db_set_b(hContact, this->m_szModuleName, "Ignore", (int)!state);
-
- ::db_set_b(hContact, "CList", "Hidden", 1);
- }
-
- return 0;
-}
-
-INT_PTR CSkypeProto::InviteCommand(WPARAM, LPARAM)
-{
- this->StartChat();
-
- return 0;
-}
-
-INT_PTR CSkypeProto::ShowBookmarksCommand(WPARAM, LPARAM)
-{
- ::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_BOOKMARKS), NULL, CSkypeProto::SkypeBookmarksProc, (LPARAM)this);
-
- return 0;
-}
-
int CSkypeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- for (size_t i = 0; i < SIZEOF(CSkypeProto::contactMenuItems); i++)
- Menu_ShowItem(CSkypeProto::contactMenuItems[i], false);
+ for (int i = 0; i < SIZEOF(CSkypeProto::contactMenuItems); i++)
+ ::Menu_ShowItem(CSkypeProto::contactMenuItems[i], false);
- CSkypeProto* ppro = CSkypeProto::GetInstanceByHContact((HANDLE)wParam);
+ CSkypeProto* ppro = CSkypeProto::GetContactInstance((HANDLE)wParam);
return (ppro) ? ppro->OnPrebuildContactMenu(wParam, lParam) : 0;
}
@@ -215,14 +138,6 @@ void CSkypeProto::InitMenus() CSkypeProto::contactMenuItems[CMI_AUTH_REVOKE] = ::Menu_AddContactMenuItem(&mi);
::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::RevokeAuth>);
- // "Bookmark"
- mi.pszService = MODULE"/SetBookmark";
- mi.ptszName = LPGENT("Set bookmark");
- mi.position = -200001000 + CMI_CHAT_BOOKMARK;
- mi.icolibItem = NULL;//CSkypeProto::GetIconHandle("bookmark");
- CSkypeProto::contactMenuItems[CMI_CHAT_BOOKMARK] = ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SetBookmarkCommand>);
-
// "Ignore"
mi.pszService = MODULE"/Ignore";
mi.ptszName = LPGENT("Ignore");
@@ -275,18 +190,18 @@ void CSkypeProto::OnInitStatusMenu() mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR;
// Invite Command
- ::strcpy(tDest, "/InviteCommand");
- this->CreateServiceObj(tDest, &CSkypeProto::InviteCommand);
+ ::strcpy(tDest, "/CreateChatRoom");
+ this->CreateServiceObj(tDest, &CSkypeProto::CreateChatRoomCommand);
mi.ptszName = LPGENT("Create conference");
- mi.position = 200000 + SMI_CHAT_INVITE;
- mi.icolibItem = CSkypeProto::GetIconHandle("confInvite");
+ mi.position = 200000 + SMI_CHAT_CREATE;
+ mi.icolibItem = CSkypeProto::GetIconHandle("conference");
::Menu_AddProtoMenuItem(&mi);
// Invite Command
- ::strcpy(tDest, "/BookmarksCommand");
- this->CreateServiceObj(tDest, &CSkypeProto::ShowBookmarksCommand);
- mi.ptszName = LPGENT("Bookmarks");
- mi.position = 200000 + SMI_CHAT_BOOKMARKS;
- mi.icolibItem = CSkypeProto::GetIconHandle("bookmark");
+ ::strcpy(tDest, "/IgnoreList");
+ this->CreateServiceObj(tDest, &CSkypeProto::OpenIgnoreListCommand);
+ mi.ptszName = LPGENT("Ignore list");
+ mi.position = 200000 + SMI_IGNORE_LIST;
+ mi.icolibItem = CSkypeProto::GetIconHandle("ignore");
::Menu_AddProtoMenuItem(&mi);
}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index b82cc174aa..b98ffc640d 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<char>(::mir_u2a( mir_ptr<wchar_t>(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)))));
+ SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
if (this->GetContact(sid, contact))
{
contact->SetBuddyStatus(Contact::AUTHORIZED_BY_ME);
@@ -232,7 +232,7 @@ DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HANDLE hContact) case PFLAGNUM_5:
return PF2_ONTHEPHONE;
case PFLAG_UNIQUEIDTEXT:
- return (DWORD_PTR)::Translate("Skype Name");
+ return (DWORD_PTR)::Translate("Skype name");
case PFLAG_MAXCONTACTSPERPACKET:
return 1024;
case PFLAG_UNIQUEIDSETTING:
@@ -333,19 +333,18 @@ int __cdecl CSkypeProto::SendContacts(HANDLE hContact, int flags, int nContacts, {
this->Log(L"Outcoming contacts");
SEStringList targets;
- mir_ptr<wchar_t> sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- targets.append((char *)mir_ptr<char>(::mir_utf8encodeW(sid)));
+ targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
CConversation::Ref conversation;
this->GetConversationByParticipants(targets, conversation);
- CContact::Refs contacts;
+ ContactRefs contacts;
for (int i = 0; i < nContacts; i++)
{
CContact::Ref contact;
- mir_ptr<wchar_t> csid(::db_get_wsa(hContactsList[i], this->m_szModuleName, SKYPE_SETTINGS_SID));
- this->GetContact((char *)mir_ptr<char>(::mir_utf8encodeW(csid)), contact);
+ ptrW csid(::db_get_wsa(hContactsList[i], this->m_szModuleName, SKYPE_SETTINGS_SID));
+ this->GetContact((char *)ptrA(::mir_utf8encodeW(csid)), contact);
contacts.append(contact);
}
@@ -375,15 +374,14 @@ HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription {
this->Log(L"Outcoming file transfer");
SEStringList targets;
- mir_ptr<wchar_t> sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- targets.append((char *)mir_ptr<char>(::mir_utf8encodeW(sid)));
+ targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
CConversation::Ref conversation;
this->GetConversationByParticipants(targets, conversation);
SEFilenameList fileList;
for (int i = 0; ppszFiles[i]; i++)
- fileList.append((char *)mir_ptr<char>(::mir_utf8encodeW(ppszFiles[i])));
+ fileList.append((char *)ptrA(::mir_utf8encodeW(ppszFiles[i])));
auto error = TRANSFER_OPEN_SUCCESS;
SEFilename errFile; MessageRef msgRef;
@@ -412,9 +410,7 @@ int __cdecl CSkypeProto::SendMsg(HANDLE hContact, int flags, const char *msg) {
this->Log(L"Outcoming message");
SEStringList targets;
- mir_ptr<wchar_t> sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- SEString identity = ::mir_u2a(sid);
- targets.append(identity);
+ targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
CConversation::Ref conversation;
this->GetConversationByParticipants(targets, conversation);
@@ -507,11 +503,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_SID));
+ ptrW sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
if (::wcsicmp(sid, this->login) != 0)
{
SEStringList targets;
- targets.append(std::string(::mir_utf8encodeW(sid)).c_str());
+ targets.append((char *)ptrA(::mir_utf8encodeW(sid)));
CConversation::Ref conversation;
this->GetConversationByParticipants(targets, conversation);
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 3abce98378..7ffc125101 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -156,7 +156,7 @@ public: static CSkypeProto* InitSkypeProto(const char* protoName, const wchar_t* userName);
static int UninitSkypeProto(CSkypeProto* ppro);
- static CSkypeProto* GetInstanceByHContact(HANDLE hContact);
+ static CSkypeProto* GetContactInstance(HANDLE hContact);
static void UninitInstances();
// icons
@@ -275,7 +275,6 @@ protected: // chat
bool IsChatRoom(HANDLE hContact);
- bool IsChatRoomBookmarked(HANDLE hContact);
HANDLE GetChatRoomByCid(const wchar_t *cid);
HANDLE AddChatRoom(CConversation::Ref conversation);
@@ -289,16 +288,18 @@ protected: void InitChat();
- void StartChat();
void StartChat(StringList &invitedContacts);
void InviteToChatRoom(HANDLE hContact);
- void BookmarkChatRoom(HANDLE hContact);
void CloseAllChatSessions();
ChatRoom *FindChatRoom(const wchar_t *cid);
void DeleteChatRoom(HANDLE hContact);
+
+ void CreateChat(const ChatRoomParam *param);
+ void JoinToChat(const wchar_t *joinBlob);
+ INT_PTR __cdecl CreateChatRoomCommand(WPARAM, LPARAM);
INT_PTR __cdecl OnJoinChat(WPARAM wParam, LPARAM);
INT_PTR __cdecl OnLeaveChat(WPARAM wParam, LPARAM);
@@ -390,6 +391,8 @@ protected: static void ReplaceSpecialChars(wchar_t *text, wchar_t replaceWith = L'_');
+ static INT_PTR __cdecl ParseSkypeUri(WPARAM wParam, LPARAM lParam);
+
// languages
static std::map<std::wstring, std::wstring> languages;
@@ -440,16 +443,15 @@ protected: static INT_PTR MenuChooseService(WPARAM wParam, LPARAM lParam);
+ static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
+ int OnPrebuildContactMenu(WPARAM wParam, LPARAM);
+
+ // ignore list
int __cdecl IgnoreCommand(WPARAM, LPARAM);
int __cdecl BlockCommand(WPARAM, LPARAM);
+ INT_PTR __cdecl OpenIgnoreListCommand(WPARAM, LPARAM);
- INT_PTR __cdecl InviteCommand(WPARAM, LPARAM);
-
- int __cdecl SetBookmarkCommand(WPARAM, LPARAM);
- INT_PTR __cdecl ShowBookmarksCommand(WPARAM, LPARAM);
-
- static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
- int OnPrebuildContactMenu(WPARAM wParam, LPARAM);
+ static INT_PTR CALLBACK IgnoreListWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
// database
bool IsMessageInDB(HANDLE hContact, DWORD timestamp, SEBinary &guid, int flag = 0);
@@ -474,9 +476,7 @@ protected: static INT_PTR CALLBACK SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK ContactSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
- static INT_PTR CALLBACK SkypeBookmarksProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
// skype runtime
char *LoadKeyPair();
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp index 2c354210cb..eb5eb1e4f1 100644 --- a/protocols/Skype/src/skype_utils.cpp +++ b/protocols/Skype/src/skype_utils.cpp @@ -539,4 +539,70 @@ void CSkypeProto::ReplaceSpecialChars(wchar_t *text, wchar_t replaceWith) for (size_t i = 0; i < ::wcslen(text); i++)
if (::wcschr(special, text[i]) != NULL)
text[i] = replaceWith;
+}
+
+INT_PTR CSkypeProto::ParseSkypeUri(WPARAM wParam, LPARAM lParam)
+{
+ return 1;
+ if (CSkypeProto::instanceList.getCount() == 0 || !CSkypeProto::instanceList[0]->IsOnline())
+ return 1;
+
+ CSkypeProto::ShowNotification((wchar_t *)lParam);
+
+ CSkypeProto *ppro = CSkypeProto::instanceList[0];
+
+ wchar_t *args = ::mir_wstrdup((wchar_t *)lParam);
+ if (args == NULL)
+ return 1;
+ // set focus on clist
+
+ wchar_t * q = ::wcschr(args, L'?');
+ if (q == NULL)
+ return 1;
+
+ wchar_t *c = q + 1; q = 0;
+ StringList participants = StringList(args, L";");
+ StringList commands = StringList(q + 1, L"&");
+
+ ptrW command, arg, commandAndParam;
+
+ if (::lstrcmpiW( commands[0], L"chat") != 0)
+ {
+ wchar_t message[1024];
+ ::mir_sntprintf(message, SIZEOF(message), ::TranslateT("Command\"%s\" is unsupported"), args);
+ CSkypeProto::ShowNotification(message);
+ return 1;
+ }
+
+ ChatRoomParam *param = new ChatRoomParam(NULL, participants, ppro);
+
+ for (size_t i = 1; i < commands.size(); i++)
+ {
+ commandAndParam = command = ::mir_wstrdup(commands[i]);
+ wchar_t * p = ::wcschr(commandAndParam, L'=');
+ if (p != NULL)
+ {
+ arg = p + 1;
+ p = 0;
+ }
+
+ if ( !::lstrcmpiW(commands[0], L"blob"))
+ {
+ ppro->JoinToChat(arg);
+ break;
+ }
+
+ if ( !::lstrcmpiW( commands[0], L"topic"))
+ {
+ ::wcscpy(param->topic, arg);
+ ppro->CreateChat(param);
+ break;
+
+ }
+ //param
+ }
+
+ delete param;
+
+ return 0;
}
\ No newline at end of file |