diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Skype/Skype.vcxproj | 22 | ||||
-rw-r--r-- | protocols/Skype/Skype.vcxproj.filters | 15 | ||||
-rw-r--r-- | protocols/Skype/src/skype.cpp | 6 | ||||
-rw-r--r-- | protocols/Skype/src/skype.h | 4 | ||||
-rw-r--r-- | protocols/Skype/src/skype_dialogs.cpp | 9 | ||||
-rw-r--r-- | protocols/Skype/src/skype_events.cpp | 1 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.cpp | 43 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.h | 9 | ||||
-rw-r--r-- | protocols/Skype/src/skype_settings.cpp | 33 | ||||
-rw-r--r-- | protocols/Skype/src/skype_subclassing.cpp | 45 | ||||
-rw-r--r-- | protocols/Skype/src/skype_subclassing.h | 27 | ||||
-rw-r--r-- | protocols/Skype/src/skype_utils.cpp | 21 | ||||
-rw-r--r-- | protocols/Skype/src/version.h | 1 |
13 files changed, 188 insertions, 48 deletions
diff --git a/protocols/Skype/Skype.vcxproj b/protocols/Skype/Skype.vcxproj index 5fd7ff3d49..4c852865c9 100644 --- a/protocols/Skype/Skype.vcxproj +++ b/protocols/Skype/Skype.vcxproj @@ -45,12 +45,14 @@ </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
+ <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>
<StringPooling>false</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
@@ -62,8 +64,6 @@ <AdditionalDependencies>Ws2_32.lib;Advapi32.lib;skypekit-cyassl_lib.lib;skypekit-cppwrapper_2_lib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreAllDefaultLibraries>
</IgnoreAllDefaultLibraries>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <AdditionalOptions>/PDBALTPATH:%_PDB% %(AdditionalOptions)</AdditionalOptions>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -73,11 +73,13 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_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>
+ <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
@@ -87,9 +89,7 @@ <OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
- <AdditionalDependencies>Ws2_32.lib;Advapi32.lib;skypekit-cyassl_lib.lib;skypekit-cppwrapper_2_lib.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>$(SolutionDir)\lib;$(SolutionDir)..\..\SkypeKit\SDK\interfaces\skype\cpp_embedded\build</AdditionalLibraryDirectories>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <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>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -97,15 +97,23 @@ </ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClInclude Include="skype_subclassing.h" />
<ClInclude Include="src\skype.h" />
<ClInclude Include="src\skype_proto.h" />
<ClInclude Include="src\version.h" />
<ClInclude Include="src\resource.h" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\skype.cpp" />
+ <ClCompile Include="src\skype.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
<ClCompile Include="src\skype_dialogs.cpp" />
+ <ClCompile Include="src\skype_events.cpp" />
<ClCompile Include="src\skype_proto.cpp" />
+ <ClCompile Include="src\skype_settings.cpp" />
+ <ClCompile Include="src\skype_subclassing.cpp" />
+ <ClCompile Include="src\skype_utils.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\Version.rc" />
diff --git a/protocols/Skype/Skype.vcxproj.filters b/protocols/Skype/Skype.vcxproj.filters index c23255e856..e38dad19a3 100644 --- a/protocols/Skype/Skype.vcxproj.filters +++ b/protocols/Skype/Skype.vcxproj.filters @@ -10,6 +10,18 @@ <ClCompile Include="src\skype_dialogs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\skype_subclassing.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\skype_events.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\skype_settings.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\skype_utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\resource.h">
@@ -24,6 +36,9 @@ <ClInclude Include="src\skype_proto.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="skype_subclassing.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\Resource.rc">
diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp index 01df986a0e..b45462ede8 100644 --- a/protocols/Skype/src/skype.cpp +++ b/protocols/Skype/src/skype.cpp @@ -4,13 +4,13 @@ int hLangpack;
HINSTANCE g_hInstance;
-Skype* g_skype;
+CSkype* g_skype;
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __VERSION_DWORD,
__DESCRIPTION,
__AUTHOR,
__AUTHOREMAIL,
@@ -91,7 +91,7 @@ int LoadKeyPair() extern "C" int __declspec(dllexport) Load(void)
{
- g_skype = new Skype();
+ g_skype = new CSkype();
LoadKeyPair();
g_skype->init(keyBuf, "127.0.0.1", 8963, "streamlog.txt");
g_skype->start();
diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h index 076c26da80..8fd0390354 100644 --- a/protocols/Skype/src/skype.h +++ b/protocols/Skype/src/skype.h @@ -59,8 +59,8 @@ extern HINSTANCE g_hInstance; #undef OCSP_REQUEST
#undef OCSP_RESPONSE
-#include <skype-embedded_2.h>
+#include "skype_subclassing.h"
static const char* g_keyFileName = "..\\..\\..\\SkypeKit\\keypair.crt";
-extern Skype* g_skype;
\ No newline at end of file +extern CSkype* g_skype;
\ No newline at end of file diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 806843cd86..fea322746c 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -69,4 +69,13 @@ INT_PTR CALLBACK CSkypeProto::SkypeAccountProc(HWND hwnd, UINT message, WPARAM w }
return FALSE;
+}
+
+INT_PTR __cdecl CSkypeProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
+{
+ return (int)CreateDialogParam(
+ g_hInstance,
+ MAKEINTRESOURCE(IDD_SKYPEACCOUNT),
+ (HWND)lParam,
+ &CSkypeProto::SkypeAccountProc, (LPARAM)this);
}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp new file mode 100644 index 0000000000..159b64a666 --- /dev/null +++ b/protocols/Skype/src/skype_events.cpp @@ -0,0 +1 @@ +#include "skype_proto.h"
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index d4f19e4aa8..d9986db95c 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -36,15 +36,6 @@ CSkypeProto::~CSkypeProto() mir_free(this->m_tszUserName);
}
-INT_PTR __cdecl CSkypeProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
-{
- return (int)CreateDialogParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_SKYPEACCOUNT),
- (HWND)lParam,
- &CSkypeProto::SkypeAccountProc, (LPARAM)this);
-}
-
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; }
@@ -88,18 +79,19 @@ int CSkypeProto::SetStatus(int new_status) if ( !this->isOffline)
{
this->isOffline = true;
- account->Logout(false);
+ this->account->Logout(false);
};
break;
case ID_STATUS_ONLINE:
- if (g_skype->GetAccount("", this->account))
+
+ char* sn = mir_t2a(this->GetSettingString(NULL, "SkypeName"));
+ if (g_skype->GetAccount(sn, this->account))
{
this->isOffline = false;
- account->LoginWithPassword("", false, false);
-
- // Loop until LoggedIn or login failure
- //while ( (!account->loggedIn) && (!account->loggedOut) ) { Delay(1); };
+ char* pw = mir_t2a(this->GetDecodeSettingString(NULL, "Password"));
+ this->account->LoginWithPassword(pw, false, false);
+ this->account->BlockWhileLoggingIn();
}
break;
}
@@ -116,29 +108,10 @@ int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type ) { return 0 int __cdecl CSkypeProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ) { return 0; }
-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 )this->hNetlibUser, (LPARAM)msg);
-}
-
-void CSkypeProto::CreateProtoService(const char* szService, SkypeServiceFunc serviceProc)
-{
- char temp[MAX_PATH*2];
-
- mir_snprintf(temp, sizeof(temp), "%s%s", this->m_szModuleName, szService);
- CreateServiceFunctionObj(temp, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this);
-}
char* CSkypeProto::ModuleName()
{
- return this->m_szProtoName;
+ return this->m_szModuleName;
}
bool CSkypeProto::IsOffline()
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 414f104d3c..c31b1f1afd 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -1,6 +1,7 @@ #pragma once
#include "skype.h"
+#include "skype_subclassing.h"
struct CSkypeProto;
@@ -65,7 +66,7 @@ public: protected:
bool isOffline;
- Account::Ref account;
+ CAccount::Ref account;
HANDLE hNetlibUser;
void Log( const char* fmt, ... );
@@ -73,5 +74,11 @@ protected: INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam);
void CreateProtoService(const char* szService, SkypeServiceFunc serviceProc);
+ TCHAR* GetSettingString(const char *szSetting, TCHAR* defVal = NULL);
+ TCHAR* GetSettingString(HANDLE hContact, const char *szSetting, TCHAR* defVal = NULL);
+
+ TCHAR* GetDecodeSettingString(const char *szSetting, TCHAR* defVal = NULL);
+ TCHAR* GetDecodeSettingString(HANDLE hContact, const char *szSetting, TCHAR* defVal = NULL);
+
static INT_PTR CALLBACK SkypeAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
};
\ No newline at end of file diff --git a/protocols/Skype/src/skype_settings.cpp b/protocols/Skype/src/skype_settings.cpp new file mode 100644 index 0000000000..8a2d0c0bfa --- /dev/null +++ b/protocols/Skype/src/skype_settings.cpp @@ -0,0 +1,33 @@ +#include "skype_proto.h"
+
+TCHAR* CSkypeProto::GetSettingString(const char *szSetting, TCHAR* defVal)
+{
+ return this->GetSettingString(NULL, szSetting, defVal);
+}
+
+TCHAR* CSkypeProto::GetSettingString(HANDLE hContact, const char *szSetting, TCHAR* defVal)
+{
+ TCHAR* result = DBGetStringW(hContact, this->m_szModuleName, szSetting);
+ return result != NULL ? result : defVal;
+}
+
+TCHAR* CSkypeProto::GetDecodeSettingString(const char *szSetting, TCHAR* defVal)
+{
+ return this->GetSettingString(NULL, szSetting, defVal);
+}
+
+TCHAR* CSkypeProto::GetDecodeSettingString(HANDLE hContact, const char *szSetting, TCHAR* defVal)
+{
+ DBVARIANT dbv;
+ TCHAR* result = NULL;
+ if ( !DBGetContactSettingString(0, this->m_szModuleName, szSetting, &dbv))
+ {
+ CallService(
+ MS_DB_CRYPT_DECODESTRING,
+ wcslen(dbv.ptszVal) + 1,
+ reinterpret_cast<LPARAM>(dbv.ptszVal));
+ result = mir_wstrdup(dbv.pwszVal);
+ DBFreeVariant(&dbv);
+ }
+ return result;
+}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_subclassing.cpp b/protocols/Skype/src/skype_subclassing.cpp new file mode 100644 index 0000000000..04b4a82b74 --- /dev/null +++ b/protocols/Skype/src/skype_subclassing.cpp @@ -0,0 +1,45 @@ +#include "skype_subclassing.h" + +Account* CSkype::newAccount(int oid) +{ + return new CAccount(oid, this); +} + +CAccount::CAccount(unsigned int oid, SERootObject* root) : Account(oid, root) +{ + this->isLoggedOut = true; +} + +void CAccount::OnChange(int prop) +{ + if (prop == Account::P_STATUS) + { + Account::STATUS loginStatus; + this->GetPropStatus(loginStatus); + if (loginStatus == Account::LOGGED_IN) + this->isLoggedOut = false; + + if (loginStatus == Account::LOGGED_OUT) + { + this->isLoggedOut = true; + Account::LOGOUTREASON whyLogout; + this->GetPropLogoutreason(whyLogout); + /*if (whyLogout != Account::LOGOUT_CALLED) + { + printf("%s\n", (const char*)tostring(whyLogout)); + }*/ + }
+ } +}; + +void CAccount::BlockWhileLoggingIn() +{ + while (this->isLoggedOut) + Sleep(1); +} + +void CAccount::BlockWhileLoggingOut() +{ + while ( !this->isLoggedOut) + Sleep(1); +};
\ No newline at end of file diff --git a/protocols/Skype/src/skype_subclassing.h b/protocols/Skype/src/skype_subclassing.h new file mode 100644 index 0000000000..466b84809e --- /dev/null +++ b/protocols/Skype/src/skype_subclassing.h @@ -0,0 +1,27 @@ +#pragma once
+
+#include <skype-embedded_2.h>
+
+class CAccount;
+
+class CSkype : public Skype
+{
+public:
+ Account* newAccount(int oid);
+};
+
+class CAccount : public Account
+{
+public: + typedef DRef<CAccount, Account> Ref; + typedef DRefs<CAccount, Account> Refs; + + bool isLoggedOut; + + CAccount(unsigned int oid, SERootObject* root); + void OnChange(int prop); + + void BlockWhileLoggingIn(); + void BlockWhileLoggingOut(); +}; + diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp new file mode 100644 index 0000000000..be141b3e75 --- /dev/null +++ b/protocols/Skype/src/skype_utils.cpp @@ -0,0 +1,21 @@ +#include "skype_proto.h" +
+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 )this->hNetlibUser, (LPARAM)msg);
+}
+
+void CSkypeProto::CreateProtoService(const char* szService, SkypeServiceFunc serviceProc)
+{
+ char temp[MAX_PATH*2];
+
+ mir_snprintf(temp, sizeof(temp), "%s%s", this->m_szModuleName, szService);
+ CreateServiceFunctionObj(temp, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this);
+}
\ No newline at end of file diff --git a/protocols/Skype/src/version.h b/protocols/Skype/src/version.h index 281233e9ec..9acc0b7ca3 100644 --- a/protocols/Skype/src/version.h +++ b/protocols/Skype/src/version.h @@ -2,6 +2,7 @@ #define __MINOR_VERSION 0
#define __RELEASE_NUM 0
#define __BUILD_NUM 1
+#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0, 1, 0, 0)
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
|