summaryrefslogtreecommitdiff
path: root/plugins/AvatarHistory/src/AvatarHistory.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
commitc4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch)
tree17a8627550b202d62df8e1df76d2585d3d0cdeaa /plugins/AvatarHistory/src/AvatarHistory.cpp
parent5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (diff)
new easy standard way of registering icons: Icon_Register
git-svn-id: http://svn.miranda-ng.org/main/trunk@2601 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AvatarHistory/src/AvatarHistory.cpp')
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.cpp33
1 files changed, 10 insertions, 23 deletions
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp
index 68fed732d0..fe493bddd5 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.cpp
+++ b/plugins/AvatarHistory/src/AvatarHistory.cpp
@@ -27,9 +27,6 @@ HINSTANCE hInst;
DWORD mirVer;
-HANDLE hHooks[6] = {0};
-HANDLE hServices[3] = {0};
-
HANDLE hFolder = NULL;
char *metacontacts_proto = NULL;
@@ -172,14 +169,14 @@ extern "C" __declspec(dllexport) int Load(void)
LoadOptions();
- hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
- hHooks[1] = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
- hHooks[3] = HookEvent(ME_OPT_INITIALISE, OptInit);
- hHooks[4] = HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged);
- hHooks[5] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
+ HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
- hServices[0] = CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
- hServices[1] = CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);
+ CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
+ CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);
if(CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0)
_tcscpy(profilePath, _T(".")); // Failed, use current dir
@@ -206,10 +203,9 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
if (ServiceExists(MS_MC_GETPROTOCOLNAME))
metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
- if (DBGetContactSettingByte(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY))
+ if (DBGetContactSettingByte(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY))
{
- char *templates[] = { "Avatar change\nchanged his/her avatar",
- "Avatar removal\nremoved his/her avatar" };
+ char *templates[] = { "Avatar change\nchanged his/her avatar", "Avatar removal\nremoved his/her avatar" };
HICON hIcon = createDefaultOverlayedIcon(FALSE);
HistoryEvents_RegisterWithTemplates(MODULE_NAME, "avatarchange", "Avatar change", EVENTTYPE_AVATAR_CHANGE, hIcon,
HISTORYEVENTS_FORMAT_CHAR | HISTORYEVENTS_FORMAT_WCHAR | HISTORYEVENTS_FORMAT_RICH_TEXT,
@@ -218,23 +214,14 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
DestroyIcon(hIcon);
}
- hHooks[2] = HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged);
+ HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged);
return 0;
}
static int PreShutdown(WPARAM wParam, LPARAM lParam)
{
- int i;
-
- for (i = 0; i < MAX_REGS(hHooks); i++)
- UnhookEvent(hHooks[i]);
-
- for (i = 0; i < MAX_REGS(hServices); i++)
- DestroyServiceFunction(hServices[i]);
-
WindowList_Broadcast(hAvatarWindowsList,WM_CLOSE,0,0);
-
return 0;
}