From 016a848803aaaff835a51a495327148781163342 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Tue, 25 Sep 2012 19:18:37 +0000 Subject: - init commit git-svn-id: http://svn.miranda-ng.org/main/trunk@1657 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/Skype.vcxproj | 100 ++++++++++++++++++++++++++++++++++ protocols/Skype/Skype.vcxproj.filters | 39 +++++++++++++ protocols/Skype/Skype.vcxproj.user | 3 + protocols/Skype/skype.cpp | 75 +++++++++++++++++++++++++ protocols/Skype/skype.h | 41 ++++++++++++++ protocols/Skype/skype_proto.cpp | 46 ++++++++++++++++ protocols/Skype/skype_proto.h | 64 ++++++++++++++++++++++ protocols/Skype/version.h | 3 + 8 files changed, 371 insertions(+) create mode 100644 protocols/Skype/Skype.vcxproj create mode 100644 protocols/Skype/Skype.vcxproj.filters create mode 100644 protocols/Skype/Skype.vcxproj.user create mode 100644 protocols/Skype/skype.cpp create mode 100644 protocols/Skype/skype.h create mode 100644 protocols/Skype/skype_proto.cpp create mode 100644 protocols/Skype/skype_proto.h create mode 100644 protocols/Skype/version.h (limited to 'protocols') diff --git a/protocols/Skype/Skype.vcxproj b/protocols/Skype/Skype.vcxproj new file mode 100644 index 0000000000..2ccc01b90d --- /dev/null +++ b/protocols/Skype/Skype.vcxproj @@ -0,0 +1,100 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {F5282DBC-756B-4071-B186-3E82C0E8E1F7} + Win32Proj + Skype + + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + + + + + + + + + + + + + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;SKYPE_EXPORTS;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + skype.h + 4996;%(DisableSpecificWarnings) + + + Windows + true + $(SolutionDir)\lib + true + $(IntDir)$(TargetName).lib + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;SKYPE_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/protocols/Skype/Skype.vcxproj.filters b/protocols/Skype/Skype.vcxproj.filters new file mode 100644 index 0000000000..911b429cea --- /dev/null +++ b/protocols/Skype/Skype.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ 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 @@ + + + \ No newline at end of file diff --git a/protocols/Skype/skype.cpp b/protocols/Skype/skype.cpp new file mode 100644 index 0000000000..098ea96697 --- /dev/null +++ b/protocols/Skype/skype.cpp @@ -0,0 +1,75 @@ +#include "skype.h" +#include "version.h" +#include "skype_proto.h" + +int hLangpack; +HINSTANCE g_hInstance; + +PLUGININFOEX pluginInfo = +{ + sizeof(PLUGININFOEX), + "Skype Plugin", + __VERSION_DWORD, + "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 } } +}; + +static int compare_protos(const CSkypeProto *p1, const CSkypeProto *p2) +{ + return _tcscmp(p1->m_tszUserName, p2->m_tszUserName); +} + +OBJLIST g_Instances(1, compare_protos); + +DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) +{ + g_hInstance = hInstance; + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST}; + +static CSkypeProto* SkypeProtoInit(const char* pszProtoName, const TCHAR* tszUserName) +{ + //CSkypeProto *ppro = new CSkypeProto(pszProtoName, tszUserName); + //g_Instances.insert(ppro); + //return ppro; + return 0; +} + +static int SkypeProtoUninit(CSkypeProto* ppro) +{ + g_Instances.remove(ppro); + delete ppro; + return 0; +} + +extern "C" int __declspec(dllexport) Load(void) +{ + //mir_getLP(&pluginInfo); + + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; + pd.szName = "Skype"; + pd.type = PROTOTYPE_PROTOCOL; + pd.fnInit = (pfnInitProto)SkypeProtoInit; + pd.fnUninit = (pfnUninitProto)SkypeProtoUninit; + CallService(MS_PROTO_REGISTERMODULE, 0, reinterpret_cast(&pd)); + + return 0; +} + +extern "C" int __declspec(dllexport) Unload(void) +{ + return 0; +} \ No newline at end of file diff --git a/protocols/Skype/skype.h b/protocols/Skype/skype.h new file mode 100644 index 0000000000..1899c873f5 --- /dev/null +++ b/protocols/Skype/skype.h @@ -0,0 +1,41 @@ +#pragma once + +#define MIRANDA_VER 0x0A00 + +#include + +#pragma warning(push) +# pragma warning(disable:4312) +#include +#include +#include +#include +#include +#include +#include +#include +//#include "m_cluiframes.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#pragma warning(pop) + +extern HINSTANCE g_hInstance; \ No newline at end of file diff --git a/protocols/Skype/skype_proto.cpp b/protocols/Skype/skype_proto.cpp new file mode 100644 index 0000000000..eede6c744e --- /dev/null +++ b/protocols/Skype/skype_proto.cpp @@ -0,0 +1,46 @@ +#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); + _strlwr(m_szProtoName); + m_szProtoName[0] = toupper(m_szProtoName[0]); + + TCHAR name[128]; + mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), 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->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); +} \ No newline at end of file diff --git a/protocols/Skype/skype_proto.h b/protocols/Skype/skype_proto.h new file mode 100644 index 0000000000..a4613fcb3b --- /dev/null +++ b/protocols/Skype/skype_proto.h @@ -0,0 +1,64 @@ +#pragma once + +#include "skype.h" +#include + +struct CSkypeProto : public PROTO_INTERFACE, public MZeroedObject +{ +public: + CSkypeProto(const char*, const TCHAR*); + ~CSkypeProto(); + + // PROTO_INTERFACE + /*virtual HANDLE __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); + virtual HANDLE __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ); + + virtual int __cdecl Authorize( HANDLE hDbEvent ); + virtual int __cdecl AuthDeny( HANDLE hDbEvent, const TCHAR* szReason ); + virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl AuthRequest( HANDLE hContact, const TCHAR* szMessage ); + + virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ); + + virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const TCHAR* szPath ); + virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ); + virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason ); + virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename ); + + virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ); + virtual HICON __cdecl GetIcon( int iconIndex ); + virtual int __cdecl GetInfo( HANDLE hContact, int infoType ); + + virtual HANDLE __cdecl SearchBasic( const TCHAR* id ); + virtual HANDLE __cdecl SearchByEmail( const TCHAR* email ); + virtual HANDLE __cdecl SearchByName( const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName ); + virtual HWND __cdecl SearchAdvanced( HWND owner ); + virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ); + + virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvFile( HANDLE hContact, PROTORECVFILET* ); + virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ); + + virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ); + virtual HANDLE __cdecl SendFile( HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles ); + virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ); + virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ); + + virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ); + virtual int __cdecl SetStatus( int iNewStatus ); + + virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ); + virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ); + virtual int __cdecl SendAwayMsg( HANDLE hContact, HANDLE hProcess, const char* msg ); + virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR* msg ); + + virtual int __cdecl UserIsTyping( HANDLE hContact, int type ); + + virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam );*/ + +protected: + HANDLE m_hNetlibUser; + + void Log( const char* fmt, ... ); +}; \ No newline at end of file diff --git a/protocols/Skype/version.h b/protocols/Skype/version.h new file mode 100644 index 0000000000..d66bebe741 --- /dev/null +++ b/protocols/Skype/version.h @@ -0,0 +1,3 @@ +#pragma once + +#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0, 1, 0, 0) \ No newline at end of file -- cgit v1.2.3