From 2439856505a634e770112b73dfce0b8733558e9c Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 7 Oct 2012 17:52:14 +0000 Subject: - some minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@1807 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype.cpp | 8 +++++--- protocols/Skype/src/skype_menus.cpp | 31 ++++++++++++++++--------------- protocols/Skype/src/skype_proto.cpp | 12 ++++++------ protocols/Skype/src/skype_proto.h | 5 +++-- protocols/Skype/src/skype_services.cpp | 9 ++++++++- 5 files changed, 38 insertions(+), 27 deletions(-) (limited to 'protocols') diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp index d156be206f..d6eb5dd95a 100644 --- a/protocols/Skype/src/skype.cpp +++ b/protocols/Skype/src/skype.cpp @@ -139,14 +139,16 @@ extern "C" int __declspec(dllexport) Load(void) // (LPARAM)&CSkypeProto::countryList); CSkypeProto::InitIcons(); - /*CSkypeProto::InitMenus(); -*/ + CSkypeProto::InitServiceList(); + CSkypeProto::InitMenus(); + return 0; } extern "C" int __declspec(dllexport) Unload(void) { - //CSkypeProto::UninitMenus(); + CSkypeProto::UninitMenus(); + CSkypeProto::UninitServiceList(); CSkypeProto::UninitIcons(); g_skype->stop(); diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp index e0982e8cf3..e2a7c222d2 100644 --- a/protocols/Skype/src/skype_menus.cpp +++ b/protocols/Skype/src/skype_menus.cpp @@ -1,7 +1,16 @@ #include "skype_proto.h" +HANDLE CSkypeProto::hChooserMenu; HANDLE CSkypeProto::hPrebuildMenuHook; +INT_PTR CSkypeProto::MenuChooseService(WPARAM wParam, LPARAM lParam) +{ + if (lParam) + *(void**)lParam = (void*)wParam; + + return 0; +} + int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) { HANDLE hContact = (HANDLE)wParam; @@ -46,23 +55,15 @@ int CSkypeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) void CSkypeProto::InitMenus() { - CSkypeProto::hPrebuildMenuHook = ::HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CSkypeProto::PrebuildContactMenu); - - //List_InsertPtr( &arServices, CreateServiceFunction( "Jabber/MenuChoose", JabberMenuChooseService )); + CSkypeProto::hPrebuildMenuHook = ::HookEvent( + ME_CLIST_PREBUILDCONTACTMENU, + CSkypeProto::PrebuildContactMenu); - /*TMenuParam mnu = {0}; + TMenuParam mnu = {0}; mnu.cbSize = sizeof(mnu); - mnu.name = "JabberAccountChooser"; - mnu.ExecService = "Jabber/MenuChoose"; - hChooserMenu = (HANDLE)CallService( MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu ); - - TMO_MenuItem tmi = { 0 }; - tmi.cbSize = sizeof( tmi ); - tmi.flags = CMIF_ICONFROMICOLIB; - tmi.pszName = "Cancel"; - tmi.position = 9999999; - tmi.hIcolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); - CallService( MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, ( LPARAM )&tmi );*/ + mnu.name = "SkypeAccountChooser"; + mnu.ExecService = "Skype/MenuChoose"; + hChooserMenu = (HANDLE)::CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu); } void CSkypeProto::UninitMenus() diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index b7a13163e1..bafa79ed05 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -24,8 +24,8 @@ CSkypeProto::~CSkypeProto() CloseHandle(this->signin_lock); - mir_free(this->login); - mir_free(this->password); + /*mir_free(this->login); + mir_free(this->password);*/ mir_free(this->m_szProtoName); mir_free(this->m_szModuleName); @@ -224,8 +224,8 @@ int CSkypeProto::SetStatus(int new_status) this->m_iStatus = ID_STATUS_CONNECTING; this->password = this->GetDecodeSettingString(SKYPE_SETTINGS_PASSWORD); - //this->ForkThread(&CSkypeProto::SignIn, this); - this->SignIn(this); + this->ForkThread(&CSkypeProto::SignIn, this); + //this->SignIn(this); } } @@ -271,8 +271,8 @@ void __cdecl CSkypeProto::SignIn(void*) this->account->BlockWhileLoggingIn(); this->SetStatus(this->m_iDesiredStatus); - //this->ForkThread(&CSkypeProto::LoadContactList, this); - this->LoadContactList(this); + this->ForkThread(&CSkypeProto::LoadContactList, this); + //this->LoadContactList(this); ReleaseMutex(this->signin_lock); } diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 3338a5e1ec..74bc4703c6 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -179,14 +179,15 @@ protected: void Log(const char* fmt, ...); // services - static LIST serviceList; + static LIST serviceList; // icons static _tag_iconList iconList[]; // menu + static HANDLE hChooserMenu; static HANDLE hPrebuildMenuHook; - + static INT_PTR MenuChooseService(WPARAM wParam, LPARAM lParam); int OnPrebuildContactMenu(WPARAM wParam, LPARAM); // database diff --git a/protocols/Skype/src/skype_services.cpp b/protocols/Skype/src/skype_services.cpp index 04e9b43c3e..9c5a4d034b 100644 --- a/protocols/Skype/src/skype_services.cpp +++ b/protocols/Skype/src/skype_services.cpp @@ -1,11 +1,18 @@ #include "skype_proto.h" -LIST CSkypeProto::serviceList(0); +LIST CSkypeProto::serviceList(0); void CSkypeProto::InitServiceList() { + CSkypeProto::serviceList.insert( + ::CreateServiceFunction("Skype/MenuChoose", CSkypeProto::MenuChooseService)); } void CSkypeProto::UninitServiceList() { + for (int i = 0; i < CSkypeProto::serviceList.getCount(); i++) + { + ::DestroyServiceFunction(CSkypeProto::serviceList[i]); + } + CSkypeProto::serviceList.destroy(); } -- cgit v1.2.3