summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-09-26 19:14:12 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-09-26 19:14:12 +0000
commit9f54d2d2fe173c2a426dc790e70f14a585829431 (patch)
treee374ddc425d4ed4e7eb2b7f04ad62a294e527166
parentceae8e098fb5f4e3ae1acef7d8d26822ec8e3633 (diff)
- added SKYPEACCOUNT dialog
- added normal skype class starting - merge fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@1668 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Skype/Skype.apsbin0 -> 34240 bytes
-rw-r--r--protocols/Skype/Skype.rcbin0 -> 4360 bytes
-rw-r--r--protocols/Skype/Skype.vcxproj16
-rw-r--r--protocols/Skype/Skype.vcxproj.filters56
-rw-r--r--protocols/Skype/Skype.vcxproj.user3
-rw-r--r--protocols/Skype/src/resource.hbin451 -> 1262 bytes
-rw-r--r--protocols/Skype/src/skype.cpp65
-rw-r--r--protocols/Skype/src/skype.h61
-rw-r--r--protocols/Skype/src/skype_proto.cpp331
-rw-r--r--protocols/Skype/src/skype_proto.h19
10 files changed, 308 insertions, 243 deletions
diff --git a/protocols/Skype/Skype.aps b/protocols/Skype/Skype.aps
new file mode 100644
index 0000000000..f7b328f63e
--- /dev/null
+++ b/protocols/Skype/Skype.aps
Binary files differ
diff --git a/protocols/Skype/Skype.rc b/protocols/Skype/Skype.rc
new file mode 100644
index 0000000000..e7d12a3a55
--- /dev/null
+++ b/protocols/Skype/Skype.rc
Binary files differ
diff --git a/protocols/Skype/Skype.vcxproj b/protocols/Skype/Skype.vcxproj
index 0bb03e1bd9..2740909280 100644
--- a/protocols/Skype/Skype.vcxproj
+++ b/protocols/Skype/Skype.vcxproj
@@ -45,24 +45,25 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
- <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SKYPE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\api;..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\ipc;..\..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\types;..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\platform\threading;..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\platform\threading\win;..\..\SkypeKit\SDK\ipc\cpp;..\..\SkypeKit\SDK\ipc\cpp\VideoBuffers;..\..\SkypeKit\SDK\ipc\cpp\platform\se;..\..\SkypeKit\SDK\ipc\cpp\ssl\cyassl\include;..\..\SkypeKit\SDK\ipc\cpp\ssl\cyassl\include\openssl;..\..\SkypeKit\SDK\ipc\cpp\ssl\cyassl\ctaocrypt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;..\..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\api;..\..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\ipc;..\..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\types;..\..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\platform\threading;..\..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\src\platform\threading\win;..\..\..\SkypeKit\SDK\ipc\cpp;..\..\..\SkypeKit\SDK\ipc\cpp\VideoBuffers;..\..\..\SkypeKit\SDK\ipc\cpp\platform\se;..\..\..\SkypeKit\SDK\ipc\cpp\ssl\cyassl\include;..\..\..\SkypeKit\SDK\ipc\cpp\ssl\cyassl\include\openssl;..\..\..\SkypeKit\SDK\ipc\cpp\ssl\cyassl\ctaocrypt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<StringPooling>false</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib;$(SolutionDir)..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\build</AdditionalLibraryDirectories>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
- <AdditionalDependencies>$(SolutionDir)..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\build\skypekit-cyassl_lib.lib;$(SolutionDir)..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\build\skypekit-cppwrapper_2_lib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Ws2_32.lib;Advapi32.lib;skypekit-cyassl_lib.lib;skypekit-cppwrapper_2_lib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>
+ </IgnoreAllDefaultLibraries>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -113,6 +114,9 @@
<ResourceCompile Include="res\Version.rc" />
<ResourceCompile Include="res\Resource.rc" />
</ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="Skype.rc" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/protocols/Skype/Skype.vcxproj.filters b/protocols/Skype/Skype.vcxproj.filters
index cbb891cc18..607da3c71b 100644
--- a/protocols/Skype/Skype.vcxproj.filters
+++ b/protocols/Skype/Skype.vcxproj.filters
@@ -1,20 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
+ <ClCompile Include="src\skype.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\skype_proto.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="src\resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
<ClInclude Include="src\skype.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -22,26 +19,29 @@
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\skype_proto.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\resource.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\skype_proto.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skype.cpp">
<Filter>Source Files</Filter>
- </ClCompile>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
- <ResourceCompile Include="res\Version.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
<ResourceCompile Include="res\Resource.rc">
- <Filter>Resource Files</Filter>
+ <Filter>Resource Filess</Filter>
+ </ResourceCompile>
+ <ResourceCompile Include="Skype.rc">
+ <Filter>Resource Filess</Filter>
</ResourceCompile>
+ <ResourceCompile Include="res\Version.rc">
+ <Filter>Resource Filess</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{13e9b105-554f-4080-b7de-8adf0f43b9f6}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Resource Filess">
+ <UniqueIdentifier>{901463af-0f59-4125-b874-1662b095d403}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{b14a0070-da9c-49e8-8a47-d93df5eed672}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/Skype/Skype.vcxproj.user b/protocols/Skype/Skype.vcxproj.user
new file mode 100644
index 0000000000..695b5c78b9
--- /dev/null
+++ b/protocols/Skype/Skype.vcxproj.user
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+</Project> \ No newline at end of file
diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h
index 6f23e4f274..2c0229ac79 100644
--- a/protocols/Skype/src/resource.h
+++ b/protocols/Skype/src/resource.h
Binary files differ
diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp
index 82df6a8da4..f8431166b2 100644
--- a/protocols/Skype/src/skype.cpp
+++ b/protocols/Skype/src/skype.cpp
@@ -1,18 +1,22 @@
#include "skype.h"
+#include "version.h"
+#include "skype_proto.h"
int hLangpack;
HINSTANCE g_hInstance;
+Skype* g_skype;
+
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __AUTHOREMAIL,
- __COPYRIGHT,
- __AUTHORWEB,
+ "Skype Plugin",
+ PLUGIN_MAKE_VERSION(0,1,0,0),
+ "Provides basic support for Skype protocol.",
+ "unsane",
+ "",
+ "© 2012 unsane",
+ "http://miranda-ng.org/",
UNICODE_AWARE,
// {9C448C61-FC3F-42F9-B9F0-4A30E1CF8671}
{ 0x9c448c61, 0xfc3f, 0x42f9, { 0xb9, 0xf0, 0x4a, 0x30, 0xe1, 0xcf, 0x86, 0x71 } }
@@ -43,6 +47,7 @@ static CSkypeProto* SkypeProtoInit(const char* pszProtoName, const TCHAR* tszUse
CSkypeProto *ppro = new CSkypeProto(pszProtoName, tszUserName);
g_Instances.insert(ppro);
return ppro;
+ return 0;
}
static int SkypeProtoUninit(CSkypeProto* ppro)
@@ -52,22 +57,60 @@ static int SkypeProtoUninit(CSkypeProto* ppro)
return 0;
}
+char* keyBuf = 0;
+
+int LoadKeyPair()
+{
+ FILE* f = 0;
+ size_t fsize = 0;
+ int keyLen = 0;
+
+ f = fopen(g_keyFileName, "r");
+
+ if (f != 0)
+ {
+ fseek(f, 0, SEEK_END);
+ fsize = ftell(f);
+ rewind(f);
+ keyLen = fsize + 1;
+ keyBuf = new char[keyLen];
+ size_t read = fread(keyBuf, 1, fsize, f);
+ if (read != fsize)
+ {
+ printf("Error reading %s\n", g_keyFileName);
+ return 0;
+ };
+ keyBuf[fsize] = 0; //cert should be null terminated
+ fclose(f);
+ return keyLen;
+ };
+
+ printf("Error opening app token file: %s\n", g_keyFileName);
+
+ return 0;
+};
+
extern "C" int __declspec(dllexport) Load(void)
{
- mir_getLP(&pluginInfo);
+ g_skype = new Skype();
+ LoadKeyPair();
+ g_skype->init(keyBuf, "127.0.0.1", 8963, "streamlog.txt");
+ g_skype->start();
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "Skype";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)SkypeProtoInit;
pd.fnUninit = (pfnUninitProto)SkypeProtoUninit;
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
+ CallService(MS_PROTO_REGISTERMODULE, 0, reinterpret_cast<LPARAM>(&pd));
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
+ g_skype->stop();
+ delete g_skype;
+
return 0;
} \ No newline at end of file
diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h
index df4c355ef6..8bbc0bd854 100644
--- a/protocols/Skype/src/skype.h
+++ b/protocols/Skype/src/skype.h
@@ -1,46 +1,52 @@
+#pragma once
+
#define MIRANDA_VER 0x0A00
#include <windows.h>
+#include <win2k.h>
+//#pragma warning(push)
+//# pragma warning(disable:4312)
#include <newpluginapi.h>
-#include <m_avatars.h>
-#include <m_button.h>
-#include <m_chat.h>
-#include <m_clc.h>
+//#include <m_avatars.h>
+//#include <m_button.h>
+//#include <m_chat.h>
+//#include <m_clc.h>
#include <m_clist.h>
#include <m_clistint.h>
#include <m_clui.h>
-//#include "m_cluiframes.h"
+////#include "m_cluiframes.h"
#include <m_database.h>
-#include <m_history.h>
-#include <m_idle.h>
-#include <m_langpack.h>
-#include <m_message.h>
+//#include <m_history.h>
+//#include <m_idle.h>
+//#include <m_langpack.h>
+//#include <m_message.h>
#include <m_netlib.h>
-#include <m_options.h>
-#include <m_popup.h>
+//#include <m_options.h>
+//#include <m_popup.h>
#include <m_protocols.h>
#include <m_protomod.h>
#include <m_protosvc.h>
#include <m_protoint.h>
-#include <m_skin.h>
-#include <statusmodes.h>
-#include <m_system.h>
-#include <m_userinfo.h>
-#include <m_addcontact.h>
-#include <m_icolib.h>
+//#include <m_skin.h>
+//#include <statusmodes.h>
+//#include <m_system.h>
+//#include <m_userinfo.h>
+//#include <m_addcontact.h>
+//#include <m_icolib.h>
#include <m_utils.h>
#include <m_system_cpp.h>
-#include <m_hotkeys.h>
-#include <win2k.h>
+//#include <m_hotkeys.h>
+//#pragma warning(pop)
-#include "version.h"
-#include "skype_proto.h"
#include "resource.h"
+
+extern HINSTANCE g_hInstance;
+
// skype
-#define SSL_LIB_CYASSL
-#define NO_FILESYSTEM
+//#define SSL_LIB_CYASSL
+//#define NO_FILESYSTEM
// Enable desktop video
//#define SKYPEKIT_SURFACE_RENDERING
@@ -49,4 +55,11 @@
//#define VIDEO_TRANSPORT_SYSV
//#define VIDEO_TRANSPORT_POSIX
-extern HINSTANCE g_hInstance; \ No newline at end of file
+#undef OCSP_REQUEST
+#undef OCSP_RESPONSE
+
+#include <skype-embedded_2.h>
+
+static const char* g_keyFileName = "..\\..\\..\\SkypeKit\\keypair.crt";
+
+extern Skype* g_skype; \ No newline at end of file
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp
index 250283bc11..1f78e2dd57 100644
--- a/protocols/Skype/src/skype_proto.cpp
+++ b/protocols/Skype/src/skype_proto.cpp
@@ -1,229 +1,218 @@
-#include "skype.h"
+#include "skype_proto.h"
CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName)
{
- m_iVersion = 2;
- m_iStatus = ID_STATUS_OFFLINE;
- m_tszUserName = mir_tstrdup(userName);
- m_szModuleName = mir_strdup(protoName);
- m_szProtoName = mir_strdup(protoName);
+ this->isOffline = true;
+ this->m_iVersion = 2;
+ this->m_iStatus = ID_STATUS_OFFLINE;
+ this->m_tszUserName = mir_tstrdup(userName);
+ this->m_szModuleName = mir_strdup(protoName);
+ this->m_szProtoName = mir_strdup(protoName);
_strlwr(m_szProtoName);
- m_szProtoName[0] = toupper(m_szProtoName[0]);
+ this->m_szProtoName[0] = toupper(m_szProtoName[0]);
TCHAR name[128];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), this->m_tszUserName);
NETLIBUSER nlu = {0};
nlu.cbSize = sizeof( nlu );
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
nlu.ptszDescriptiveName = name;
nlu.szSettingsModule = m_szModuleName;
- m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ this->hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
this->Log("Setting protocol/module name to '%s/%s'", m_szProtoName, m_szModuleName);
-}
-
-CSkypeProto::~CSkypeProto()
-{
- Netlib_CloseHandle(m_hNetlibUser);
- m_hNetlibUser = NULL;
-
- mir_free(m_szProtoName);
- mir_free(m_szModuleName);
- mir_free(m_tszUserName);
-}
-
-void CSkypeProto::Log( const char* fmt, ... )
-{
- va_list va;
- char msg[1024];
-
- va_start(va, fmt);
- mir_vsnprintf(msg, sizeof(msg), fmt, va);
- va_end(va);
- CallService(MS_NETLIB_LOG, ( WPARAM )m_hNetlibUser, (LPARAM)msg);
-}
-
-void CSkypeProto::CreateProtoService(const char *szService, ServiceFunc serviceProc)
-{
- char str[ MAXMODULELABELLENGTH ];
- strcpy( str, m_szModuleName );
- strcat( str, szService );
- ::CreateServiceFunctionObj( str, ( MIRANDASERVICEOBJ )*( void** )&serviceProc, this );
+ this->CreateProtoService(PS_CREATEACCMGRUI, &CSkypeProto::SvcCreateAccMgrUI);
}
-HANDLE CSkypeProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
-{
- return NULL/*hContact*/;
-}
-
-HANDLE CSkypeProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
-{
- return NULL;
-}
-
-int CSkypeProto::Authorize(HANDLE hDbEvent)
-{
- return NULL;
-}
-
-int CSkypeProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason)
-{
- return NULL;
-}
-
-int CSkypeProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre)
-{
- return NULL;
-}
-
-int CSkypeProto::AuthRequest(HANDLE hContact, const TCHAR *lptszMessage)
-{
- return NULL;
-}
-
-HANDLE CSkypeProto::ChangeInfo(int type, void *info_data)
-{
- return NULL;
-}
-
-HANDLE CSkypeProto::FileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR *szPath)
-{
- return NULL;
-}
-
-int CSkypeProto::FileCancel(HANDLE hContact, HANDLE hTransfer)
+CSkypeProto::~CSkypeProto()
{
- return NULL;
-}
+ Netlib_CloseHandle(this->hNetlibUser);
+ this->hNetlibUser = NULL;
-int CSkypeProto::FileDeny(HANDLE hContact, HANDLE hTransfer, const TCHAR*)
-{
- return NULL;
+ mir_free(this->m_szProtoName);
+ mir_free(this->m_szModuleName);
+ mir_free(this->m_tszUserName);
}
-int CSkypeProto::FileResume(HANDLE, int*, const TCHAR**)
+INT_PTR CALLBACK SkypeAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
- return 1;
-}
+ CSkypeProto *proto;
-DWORD_PTR CSkypeProto::GetCaps(int type, HANDLE hContact)
-{
- return NULL;
-}
+ switch ( message )
+ {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwnd);
-HICON CSkypeProto::GetIcon(int iconIndex)
-{
- return NULL;
-}
+ proto = reinterpret_cast<CSkypeProto*>(lparam);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
+
+ DBVARIANT dbv;
+ if ( !DBGetContactSettingString(0, proto->ModuleName(), "SkypeName", &dbv))
+ {
+ SetDlgItemText(hwnd, IDC_SN, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
+
+ if ( !DBGetContactSettingString(0, proto->ModuleName(), "Password", &dbv))
+ {
+ CallService(
+ MS_DB_CRYPT_DECODESTRING,
+ wcslen(dbv.ptszVal) + 1,
+ reinterpret_cast<LPARAM>(dbv.ptszVal));
+ SetDlgItemText(hwnd, IDC_PW, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
+
+ if ( !proto->IsOffline())
+ {
+ SendMessage(GetDlgItem(hwnd, IDC_SN), EM_SETREADONLY, 1, 0);
+ SendMessage(GetDlgItem(hwnd, IDC_PW), EM_SETREADONLY, 1, 0);
+ }
+
+ return TRUE;
+
+ case WM_COMMAND:
+ if (HIWORD(wparam) == EN_CHANGE && reinterpret_cast<HWND>(lparam) == GetFocus())
+ {
+ switch(LOWORD(wparam))
+ {
+ case IDC_SN:
+ case IDC_PW:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
+ {
+ proto = reinterpret_cast<CSkypeProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
+ TCHAR str[128];
-int CSkypeProto::GetInfo(HANDLE hContact, int infoType)
-{
- return NULL;
-}
+ GetDlgItemText(hwnd, IDC_SN, str, sizeof(str));
+ DBWriteContactSettingTString(0, proto->ModuleName(), "SkypeName", str);
-HANDLE CSkypeProto::SearchBasic(const TCHAR *id)
-{
- return NULL;
-}
+ GetDlgItemText(hwnd, IDC_PW, str, sizeof(str));
+ CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), reinterpret_cast<LPARAM>(str));
+ DBWriteContactSettingTString(0, proto->ModuleName(), "Password", str);
-HANDLE CSkypeProto::SearchByEmail(const TCHAR *email)
-{
- return NULL;
-}
+ return TRUE;
+ }
+ break;
-HANDLE CSkypeProto::SearchByName(const TCHAR *pszNick, const TCHAR *pszFirstName, const TCHAR *pszLastName)
-{
- return NULL;
-}
+ }
-HWND CSkypeProto::SearchAdvanced(HWND hWndDlg)
-{
- return NULL;
+ return FALSE;
}
-HWND CSkypeProto::CreateExtendedSearchUI(HWND owner)
+INT_PTR __cdecl CSkypeProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
{
- return NULL;
+ return (int)CreateDialogParam(
+ g_hInstance,
+ MAKEINTRESOURCE(IDD_SKYPEACCOUNT),
+ (HWND)lParam,
+ ::SkypeAccountProc, (LPARAM)this);
}
-int CSkypeProto::RecvContacts(HANDLE hContact, PROTORECVEVENT* pre)
-{
- return NULL;
-}
+HANDLE __cdecl CSkypeProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) { return 0; }
+HANDLE __cdecl CSkypeProto::AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ) { return 0; }
+int __cdecl CSkypeProto::Authorize( HANDLE hDbEvent ) { return 0; }
+int __cdecl CSkypeProto::AuthDeny( HANDLE hDbEvent, const TCHAR* szReason ) { return 0; }
+int __cdecl CSkypeProto::AuthRecv( HANDLE hContact, PROTORECVEVENT* ) { return 0; }
+int __cdecl CSkypeProto::AuthRequest( HANDLE hContact, const TCHAR* szMessage ) { return 0; }
-int CSkypeProto::RecvFile(HANDLE hContact, PROTORECVFILET *pre)
-{
- return NULL;
-}
+HANDLE __cdecl CSkypeProto::ChangeInfo( int iInfoType, void* pInfoData ) { return 0; }
-int CSkypeProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre)
-{
- return NULL;
-}
+HANDLE __cdecl CSkypeProto::FileAllow( HANDLE hContact, HANDLE hTransfer, const TCHAR* szPath ) { return 0; }
+int __cdecl CSkypeProto::FileCancel( HANDLE hContact, HANDLE hTransfer ) { return 0; }
+int __cdecl CSkypeProto::FileDeny( HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason ) { return 0; }
+int __cdecl CSkypeProto::FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename ) { return 0; }
+
+DWORD_PTR __cdecl CSkypeProto:: GetCaps( int type, HANDLE hContact ) { return 0; }
+HICON __cdecl CSkypeProto::GetIcon( int iconIndex ) { return 0; }
+int __cdecl CSkypeProto::GetInfo( HANDLE hContact, int infoType ) { return 0; }
+
+HANDLE __cdecl CSkypeProto::SearchBasic( const TCHAR* id ) { return 0; }
+HANDLE __cdecl CSkypeProto::SearchByEmail( const TCHAR* email ) { return 0; }
+HANDLE __cdecl CSkypeProto::SearchByName( const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName ) { return 0; }
+HWND __cdecl CSkypeProto::SearchAdvanced( HWND owner ) { return 0; }
+HWND __cdecl CSkypeProto::CreateExtendedSearchUI( HWND owner ) { return 0; }
+
+int __cdecl CSkypeProto::RecvContacts( HANDLE hContact, PROTORECVEVENT* ) { return 0; }
+int __cdecl CSkypeProto::RecvFile( HANDLE hContact, PROTORECVFILET* ) { return 0; }
+int __cdecl CSkypeProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* ) { return 0; }
+int __cdecl CSkypeProto::RecvUrl( HANDLE hContact, PROTORECVEVENT* ) { return 0; }
+
+int __cdecl CSkypeProto::SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ) { return 0; }
+HANDLE __cdecl CSkypeProto::SendFile( HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles ) { return 0; }
+int __cdecl CSkypeProto::SendMsg( HANDLE hContact, int flags, const char* msg ) { return 0; }
+int __cdecl CSkypeProto::SendUrl( HANDLE hContact, int flags, const char* url ) { return 0; }
+
+int __cdecl CSkypeProto::SetApparentMode( HANDLE hContact, int mode ) { return 0; }
+int CSkypeProto::SetStatus(int new_status)
+{
+ switch(new_status)
+ {
+ case ID_STATUS_OFFLINE:
+ if ( !this->isOffline)
+ {
+ this->isOffline = true;
+ account->Logout(false);
+ };
+ break;
-int CSkypeProto::RecvUrl(HANDLE, PROTORECVEVENT*)
-{
- return 1;
-}
+ case ID_STATUS_ONLINE:
+ if (g_skype->GetAccount("", this->account))
+ {
+ this->isOffline = false;
+ account->LoginWithPassword("", false, false);
-int CSkypeProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList)
-{
- return NULL;
-}
+ // Loop until LoggedIn or login failure
+ //while ( (!account->loggedIn) && (!account->loggedOut) ) { Delay(1); };
+ }
+ break;
+ }
-HANDLE CSkypeProto::SendFile(HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
-{
- return NULL;
+ return 0;
}
-int CSkypeProto::SendMsg(HANDLE hContact, int flags, const char *lpszMessage)
-{
- return NULL;
-}
+HANDLE __cdecl CSkypeProto::GetAwayMsg( HANDLE hContact ) { return 0; }
+int __cdecl CSkypeProto::RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ) { return 0; }
+int __cdecl CSkypeProto::SendAwayMsg( HANDLE hContact, HANDLE hProcess, const char* msg ) { return 0; }
+int __cdecl CSkypeProto::SetAwayMsg( int m_iStatus, const TCHAR* msg ) { return 0; }
-int CSkypeProto::SendUrl(HANDLE, int, const char*)
-{
- return 1;
-}
+int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type ) { return 0; }
-int CSkypeProto::SetApparentMode(HANDLE hContact, int mode)
-{
- return NULL;
-}
+int __cdecl CSkypeProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ) { return 0; }
-int CSkypeProto::SetStatus(int iNewStatus)
+void CSkypeProto::Log(const char* fmt, ...)
{
- return NULL;
-}
+ va_list va;
+ char msg[1024];
-HANDLE CSkypeProto::GetAwayMsg(HANDLE hContact)
-{
- return NULL;
-}
+ va_start(va, fmt);
+ mir_vsnprintf(msg, sizeof(msg), fmt, va);
+ va_end(va);
-int CSkypeProto::RecvAwayMsg(HANDLE, int, PROTORECVEVENT*)
-{
- return 1;
+ CallService(MS_NETLIB_LOG, ( WPARAM )this->hNetlibUser, (LPARAM)msg);
}
-int CSkypeProto::SendAwayMsg(HANDLE, HANDLE, const char* )
+void CSkypeProto::CreateProtoService(const char* szService, SkypeServiceFunc serviceProc)
{
- return 1;
-}
+ char temp[MAX_PATH*2];
-int CSkypeProto::SetAwayMsg(int m_iStatus, const TCHAR* msg)
-{
- return NULL;
+ mir_snprintf(temp, sizeof(temp), "%s%s", this->m_szModuleName, szService);
+ CreateServiceFunctionObj(temp, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this);
}
-int CSkypeProto::UserIsTyping(HANDLE hContact, int type)
+char* CSkypeProto::ModuleName()
{
- return NULL;
+ return this->m_szProtoName;
}
-int CSkypeProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
+bool CSkypeProto::IsOffline()
{
- return NULL;
+ return this->isOffline;
} \ No newline at end of file
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h
index 405d2fa907..6967c918a9 100644
--- a/protocols/Skype/src/skype_proto.h
+++ b/protocols/Skype/src/skype_proto.h
@@ -1,5 +1,10 @@
+#pragma once
+
+#include "skype.h"
+
struct CSkypeProto;
-typedef INT_PTR (__cdecl CSkypeProto::*ServiceFunc)(WPARAM, LPARAM);
+
+typedef INT_PTR (__cdecl CSkypeProto::*SkypeServiceFunc)(WPARAM, LPARAM);
struct CSkypeProto : public PROTO_INTERFACE, public MZeroedObject
{
@@ -55,8 +60,16 @@ public:
virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam );
- HANDLE m_hNetlibUser;
+ char* ModuleName();
+ bool IsOffline();
+protected:
+ bool isOffline;
+ Account::Ref account;
+
+ HANDLE hNetlibUser;
void Log( const char* fmt, ... );
- void CreateProtoService(const char* szService, ServiceFunc serviceProc);
+
+ INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam);
+ void CreateProtoService(const char* szService, SkypeServiceFunc serviceProc);
}; \ No newline at end of file