diff options
-rw-r--r-- | protocols/Skype/src/skype.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_events.cpp | 19 | ||||
-rw-r--r-- | protocols/Skype/src/skype_hooks.cpp | 21 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.cpp | 6 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.h | 12 | ||||
-rw-r--r-- | protocols/Skype/src/skype_services.cpp | 21 |
6 files changed, 21 insertions, 60 deletions
diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp index 2ff69e5311..24a461da6b 100644 --- a/protocols/Skype/src/skype.cpp +++ b/protocols/Skype/src/skype.cpp @@ -304,8 +304,6 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- CSkypeProto::UninitServiceList();
- CSkypeProto::UninitHookList();
CSkypeProto::UninitIcons();
CSkypeProto::UninitMenus();
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 53a938a30b..fa75b0d5fe 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -17,8 +17,9 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) bbd.hIcon = CSkypeProto::GetIconHandle("confSpawn");
bbd.dwButtonID = BBB_ID_CONF_SPAWN;
bbd.dwDefPos = 100 + bbd.dwButtonID;
-
::CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
+
+ HookEvent(ME_MSG_WINDOWEVENT, &CSkypeProto::OnSrmmWindowOpen);
}
g_skype->SetOnMessageCallback(
@@ -40,9 +41,7 @@ int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) this->SetStatus(ID_STATUS_OFFLINE);
- this->UninitInstanceHookList();
this->UninitNetLib();
-
return 0;
}
@@ -68,6 +67,20 @@ int CSkypeProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) return 0;
}
+int __cdecl CSkypeProto::OnSrmmWindowOpen(WPARAM, LPARAM lParam)
+{
+ MessageWindowEventData *ev = (MessageWindowEventData*)lParam;
+ if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact)
+ {
+ BBButton bbd = { sizeof(bbd) };
+ bbd.pszModuleName = MODULE;
+ bbd.dwButtonID = BBB_ID_CONF_SPAWN;
+ bbd.bbbFlags = (!strcmp( GetContactProto(ev->hContact), this->m_szModuleName)) ? 0 : BBSF_HIDDEN | BBSF_DISABLED;
+ ::CallService(MS_BB_SETBUTTONSTATE, (WPARAM)ev->hContact, (LPARAM)&bbd);
+ }
+ return 0;
+}
+
INT_PTR __cdecl CSkypeProto::OnAccountManagerInit(WPARAM wParam, LPARAM lParam)
{
return (int)::CreateDialogParam(
diff --git a/protocols/Skype/src/skype_hooks.cpp b/protocols/Skype/src/skype_hooks.cpp index 42155750c9..60592fa39f 100644 --- a/protocols/Skype/src/skype_hooks.cpp +++ b/protocols/Skype/src/skype_hooks.cpp @@ -1,24 +1,13 @@ #include "skype_proto.h"
-LIST<void> CSkypeProto::hookList(1);
-
void CSkypeProto::InitHookList()
{
- CSkypeProto::hookList.insert(
- ::HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSkypeProto::PrebuildContactMenu));
-}
-
-void CSkypeProto::UninitHookList()
-{
- for (int i = 0; i < CSkypeProto::hookList.getCount(); i++)
- ::UnhookEvent(CSkypeProto::hookList[i]);
+ ::HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSkypeProto::PrebuildContactMenu);
}
HANDLE CSkypeProto::HookEvent(const char* szEvent, SkypeEventFunc handler)
{
- HANDLE hook = ::HookEventObj(szEvent, (MIRANDAHOOKOBJ)*( void**)&handler, this);
- this->instanceHookList.insert(hook);
- return hook;
+ return ::HookEventObj(szEvent, (MIRANDAHOOKOBJ)*( void**)&handler, this);
}
void CSkypeProto::InitInstanceHookList()
@@ -30,9 +19,3 @@ void CSkypeProto::InitInstanceHookList() this->HookEvent(ME_MSG_BUTTONPRESSED, &CSkypeProto::OnTabSRMMButtonPressed);
}
-
-void CSkypeProto::UninitInstanceHookList()
-{
- for (int i = 0; i < this->instanceHookList.getCount(); i++)
- ::UnhookEvent(this->instanceHookList[i]);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index d320f51b84..2a92a7ea5e 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -1,8 +1,6 @@ #include "skype_proto.h"
-CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) :
- instanceHookList(1),
- instanceServiceList(1)
+CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName)
{
::ProtoConstructor(this, protoName, userName);
@@ -35,8 +33,6 @@ CSkypeProto::~CSkypeProto() this->password = NULL;
}
- this->UninitInstanceServiceList();
-
::ProtoDestructor(this);
}
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 3e008be7f6..1326eda358 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -149,6 +149,7 @@ public: int __cdecl OnPreShutdown(WPARAM, LPARAM);
int __cdecl OnContactDeleted(WPARAM, LPARAM);
int __cdecl OnOptionsInit(WPARAM, LPARAM);
+ int __cdecl OnSrmmWindowOpen(WPARAM, LPARAM);
int __cdecl OnUserInfoInit(WPARAM, LPARAM);
INT_PTR __cdecl OnAccountManagerInit(WPARAM wParam, LPARAM lParam);
@@ -171,11 +172,9 @@ public: // services
static void InitServiceList();
- static void UninitServiceList();
// hooks
static void InitHookList();
- static void UninitHookList();
INT_PTR __cdecl InviteCommand(WPARAM, LPARAM);
@@ -389,21 +388,12 @@ protected: void Log(const wchar_t *fmt, ...);
// services
- static LIST<void> serviceList;
-
- LIST<void> instanceServiceList;
void InitInstanceServiceList();
- void UninitInstanceServiceList();
// hooks
- static LIST<void> hookList;
-
- LIST<void> instanceHookList;
-
HANDLE HookEvent(const char*, SkypeEventFunc);
void InitInstanceHookList();
- void UninitInstanceHookList();
// icons
static _tag_iconList IconList[];
diff --git a/protocols/Skype/src/skype_services.cpp b/protocols/Skype/src/skype_services.cpp index 4900b51b99..051051a466 100644 --- a/protocols/Skype/src/skype_services.cpp +++ b/protocols/Skype/src/skype_services.cpp @@ -1,19 +1,8 @@ #include "skype_proto.h"
-LIST<void> CSkypeProto::serviceList(1);
-
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]);
- }
+ ::CreateServiceFunction("Skype/MenuChoose", CSkypeProto::MenuChooseService);
}
void CSkypeProto::InitInstanceServiceList()
@@ -29,11 +18,3 @@ void CSkypeProto::InitInstanceServiceList() this->CreateServiceObj(PS_GETMYAVATART, &CSkypeProto::GetMyAvatar);
this->CreateServiceObj(PS_SETMYAVATART, &CSkypeProto::SetMyAvatar);
}
-
-void CSkypeProto::UninitInstanceServiceList()
-{
- for (int i = 0; i < this->instanceServiceList.getCount(); i++)
- {
- ::DestroyServiceFunction(this->instanceServiceList[i]);
- }
-}
\ No newline at end of file |