From 7b20bdca3b22c66a58b2ecf2735cb32417496681 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 27 Sep 2012 16:31:32 +0000 Subject: - fixed previous commit issues git-svn-id: http://svn.miranda-ng.org/main/trunk@1684 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/Skype.vcxproj | 3 +++ protocols/Skype/Skype.vcxproj.filters | 7 ++++--- protocols/Skype/res/Resource.rc | 7 ++++--- protocols/Skype/src/resource.h | Bin 1256 -> 676 bytes protocols/Skype/src/skype.h | 4 ++-- protocols/Skype/src/skype_dialogs.cpp | 32 ++++++++++++++++---------------- protocols/Skype/src/skype_events.cpp | 8 ++++---- protocols/Skype/src/skype_proto.cpp | 15 ++++++++++----- protocols/Skype/src/skype_proto.h | 22 ++++++++++++++++++++-- protocols/Skype/src/skype_utils.cpp | 9 +++++++-- 10 files changed, 70 insertions(+), 37 deletions(-) diff --git a/protocols/Skype/Skype.vcxproj b/protocols/Skype/Skype.vcxproj index e10d205a1d..cc64210e5d 100644 --- a/protocols/Skype/Skype.vcxproj +++ b/protocols/Skype/Skype.vcxproj @@ -116,6 +116,9 @@ + + + diff --git a/protocols/Skype/Skype.vcxproj.filters b/protocols/Skype/Skype.vcxproj.filters index d4371a8cad..4c5f0221b3 100644 --- a/protocols/Skype/Skype.vcxproj.filters +++ b/protocols/Skype/Skype.vcxproj.filters @@ -36,9 +36,7 @@ Header Files - - Header Files - + @@ -59,4 +57,7 @@ {b14a0070-da9c-49e8-8a47-d93df5eed672} + + + \ No newline at end of file diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc index 1ecf45e8c9..147c08d1a7 100644 --- a/protocols/Skype/res/Resource.rc +++ b/protocols/Skype/res/Resource.rc @@ -13,7 +13,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Русский (Россия) resources +// Russian (Russia) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT @@ -34,7 +34,8 @@ IDI_ICON ICON "Main.ico" // IDD_SKYPEACCOUNT DIALOGEX 0, 0, 199, 92 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Skype name:",IDC_STATIC,7,7,53,12 @@ -113,7 +114,7 @@ BEGIN END #endif // APSTUDIO_INVOKED -#endif // Русский (Россия) resources +#endif // Russian (Russia) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h index 55bc8b8b3f..dd62507289 100644 Binary files a/protocols/Skype/src/resource.h and b/protocols/Skype/src/resource.h differ diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h index e71506b49b..49f0f59234 100644 --- a/protocols/Skype/src/skype.h +++ b/protocols/Skype/src/skype.h @@ -18,10 +18,10 @@ #include //#include //#include -//#include +#include //#include #include -//#include +#include //#include #include #include diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index e22e50d7aa..4410d91364 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -71,27 +71,17 @@ 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); -} - -INT_PTR CALLBACK SkypeOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) +INT_PTR CALLBACK CSkypeProto::SkypeOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { CSkypeProto *proto; switch (message) { - case WM_INITDIALOG: { TranslateDialogDefault(hwnd); - proto = reinterpret_cast(lparam); + proto = reinterpret_cast(lparam); SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam); DBVARIANT dbv; @@ -119,7 +109,8 @@ INT_PTR CALLBACK SkypeOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM } return TRUE; - case WM_COMMAND: { + case WM_COMMAND: + { if (HIWORD(wparam) == EN_CHANGE && reinterpret_cast(lparam) == GetFocus()) { switch(LOWORD(wparam)) @@ -146,14 +137,23 @@ INT_PTR CALLBACK SkypeOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM return TRUE; } - break; - + } + break; } return FALSE; } -int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) +int __cdecl CSkypeProto::OnAccountManagerInit(WPARAM wParam, LPARAM lParam) +{ + return (int)CreateDialogParam( + g_hInstance, + MAKEINTRESOURCE(IDD_SKYPEACCOUNT), + (HWND)lParam, + &CSkypeProto::SkypeAccountProc, (LPARAM)this); +} + +int __cdecl CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) { OPTIONSDIALOGPAGE odp = {0}; odp.cbSize = sizeof(odp); diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 65d33fa4c4..d899e593b8 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -1,18 +1,18 @@ #include "skype_proto.h" -void IconsLoad(); +//void IconsLoad(); int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) { - IconsLoad(); - HookEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit); + //IconsLoad(); + this->HookEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit); return 0; } int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) { - SetStatus(ID_STATUS_OFFLINE); + this->SetStatus(ID_STATUS_OFFLINE); return 0; } diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 297a372cbb..ba3635274c 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -23,7 +23,7 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) this->Log("Setting protocol/module name to '%s/%s'", m_szProtoName, m_szModuleName); - this->CreateProtoService(PS_CREATEACCMGRUI, &CSkypeProto::SvcCreateAccMgrUI); + this->CreateService(PS_CREATEACCMGRUI, &CSkypeProto::OnAccountManagerInit); } CSkypeProto::~CSkypeProto() @@ -107,12 +107,17 @@ int __cdecl CSkypeProto::SetAwayMsg( int m_iStatus, const TCHAR* msg ) { retu int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type ) { return 0; } -int __cdecl CSkypeProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ) +int __cdecl CSkypeProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) { - switch ( eventType ) { - case EV_PROTO_ONLOAD: return OnModulesLoaded( 0, 0 ); - case EV_PROTO_ONEXIT: return OnPreShutdown( 0, 0 ); + switch (eventType) + { + case EV_PROTO_ONLOAD: + return this->OnModulesLoaded(0, 0); + + case EV_PROTO_ONEXIT: + return this->OnPreShutdown(0, 0); } + return 1; } diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 7d25d5dd49..43a430c153 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -5,7 +5,11 @@ struct CSkypeProto; +typedef void (__cdecl CSkypeProto::*SkypeThreadFunc) (void*); typedef INT_PTR (__cdecl CSkypeProto::*SkypeServiceFunc)(WPARAM, LPARAM); +typedef int (__cdecl CSkypeProto::*SkypeEventFunc)(WPARAM, LPARAM); +typedef INT_PTR (__cdecl CSkypeProto::*SkypeServiceFuncParam)(WPARAM, LPARAM, LPARAM); + struct CSkypeProto : public PROTO_INTERFACE, public MZeroedObject { @@ -64,6 +68,7 @@ public: int __cdecl OnModulesLoaded(WPARAM, LPARAM); int __cdecl OnPreShutdown(WPARAM, LPARAM); int __cdecl OnOptionsInit(WPARAM, LPARAM); + int __cdecl OnAccountManagerInit(WPARAM wParam, LPARAM lParam); char* ModuleName(); bool IsOffline(); @@ -75,8 +80,19 @@ protected: HANDLE hNetlibUser; void Log( const char* fmt, ... ); - INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam); - void CreateProtoService(const char* szService, SkypeServiceFunc serviceProc); + + + + void CreateService(const char* szService, SkypeServiceFunc serviceProc); + //void CreateServiceParam(const char* szService, SkypeServiceFunc serviceProc, LPARAM lParam); + + //HANDLE CreateHookableEvent(const char* szService); + void HookEvent(const char*, SkypeEventFunc); + //int SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam); + + //void ForkThread(SkypeThreadFunc, void*); + //HANDLE ForkThreadEx(SkypeThreadFunc, void*, UINT* threadID = NULL); + TCHAR* GetSettingString(const char *szSetting, TCHAR* defVal = NULL); TCHAR* GetSettingString(HANDLE hContact, const char *szSetting, TCHAR* defVal = NULL); @@ -84,5 +100,7 @@ protected: 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); + static INT_PTR CALLBACK SkypeOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); }; \ No newline at end of file diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp index be141b3e75..1f218dfc08 100644 --- a/protocols/Skype/src/skype_utils.cpp +++ b/protocols/Skype/src/skype_utils.cpp @@ -9,10 +9,15 @@ void CSkypeProto::Log(const char* fmt, ...) mir_vsnprintf(msg, sizeof(msg), fmt, va); va_end(va); - CallService(MS_NETLIB_LOG, ( WPARAM )this->hNetlibUser, (LPARAM)msg); + CallService(MS_NETLIB_LOG, (WPARAM)this->hNetlibUser, (LPARAM)msg); } -void CSkypeProto::CreateProtoService(const char* szService, SkypeServiceFunc serviceProc) +void CSkypeProto::HookEvent(const char* szEvent, SkypeEventFunc handler) +{ + HookEventObj(szEvent, (MIRANDAHOOKOBJ)*( void**)&handler, this); +} + +void CSkypeProto::CreateService(const char* szService, SkypeServiceFunc serviceProc) { char temp[MAX_PATH*2]; -- cgit v1.2.3