From 94c575dc25f045c7083f3aa1cfdbdfac7e08bd00 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 26 Sep 2012 06:27:36 +0000 Subject: default folders structure git-svn-id: http://svn.miranda-ng.org/main/trunk@1659 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype.cpp | 73 +++++++++++++++++++++++++++++++++++++ protocols/Skype/src/skype.h | 51 ++++++++++++++++++++++++++ protocols/Skype/src/skype_proto.cpp | 46 +++++++++++++++++++++++ protocols/Skype/src/skype_proto.h | 64 ++++++++++++++++++++++++++++++++ protocols/Skype/src/version.h | 20 ++++++++++ 5 files changed, 254 insertions(+) create mode 100644 protocols/Skype/src/skype.cpp create mode 100644 protocols/Skype/src/skype.h create mode 100644 protocols/Skype/src/skype_proto.cpp create mode 100644 protocols/Skype/src/skype_proto.h create mode 100644 protocols/Skype/src/version.h (limited to 'protocols/Skype/src') diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp new file mode 100644 index 0000000000..47e9ea0c5e --- /dev/null +++ b/protocols/Skype/src/skype.cpp @@ -0,0 +1,73 @@ +#include "skype.h" + +int hLangpack; +HINSTANCE g_hInstance; + +PLUGININFOEX pluginInfo = +{ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + 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/src/skype.h b/protocols/Skype/src/skype.h new file mode 100644 index 0000000000..908b8bda21 --- /dev/null +++ b/protocols/Skype/src/skype.h @@ -0,0 +1,51 @@ +#define MIRANDA_VER 0x0A00 + +#include + +#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 + +#include "version.h" +#include "skype_proto.h" + +// skype + +#define SSL_LIB_CYASSL +#define NO_FILESYSTEM + +// Enable desktop video +//#define SKYPEKIT_SURFACE_RENDERING + +// Additional flags for desktop video for non-Windows targets +//#define VIDEO_TRANSPORT_SYSV +//#define VIDEO_TRANSPORT_POSIX + +extern HINSTANCE g_hInstance; \ No newline at end of file diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp new file mode 100644 index 0000000000..b01329ca4e --- /dev/null +++ b/protocols/Skype/src/skype_proto.cpp @@ -0,0 +1,46 @@ +#include "skype.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/src/skype_proto.h b/protocols/Skype/src/skype_proto.h new file mode 100644 index 0000000000..a4613fcb3b --- /dev/null +++ b/protocols/Skype/src/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/src/version.h b/protocols/Skype/src/version.h new file mode 100644 index 0000000000..281233e9ec --- /dev/null +++ b/protocols/Skype/src/version.h @@ -0,0 +1,20 @@ +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 0 +#define __RELEASE_NUM 0 +#define __BUILD_NUM 1 + +#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM +#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM + +#define __STRINGIFY_IMPL(x) #x +#define __STRINGIFY(x) __STRINGIFY_IMPL(x) +#define __VERSION_STRING __STRINGIFY(__FILEVERSION_DOTS) + +#define __PLUGIN_NAME "Skype Plugin" +#define __INTERNAL_NAME "Skype" +#define __FILENAME "Skype.dll" +#define __DESCRIPTION "Provides basic support for Skype protocol." +#define __AUTHOR "Unsane, Mataes" +#define __AUTHOREMAIL "mataes2007@gmail.com" +#define __AUTHORWEB "http://miranda-ng.org/" +#define __COPYRIGHT "© 2012 Unsane, Mataes" -- cgit v1.2.3