1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/* Replace "dll.h" with the name of your header */
#include "common.h"
#include "version.h"
#include "resource.h"
#include "options.h"
#include "proto.h"
#include "menu.h"
#include "icons.h"
#include "api.h"
#include "priorities.h"
#include "m_metacontacts.h"
#include "settings.h"
#include "import.h"
///////////////////////////////////////////////
// Common Plugin Stuff
///////////////////////////////////////////////
HINSTANCE hInst;
PLUGINLINK *pluginLink;
MM_INTERFACE mmi;
UTF8_INTERFACE utfi;
HANDLE metaMainThread;
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
__DESC,
__AUTHOR,
__AUTHOREMAIL,
__COPYRIGHT,
__AUTHORWEB,
UNICODE_AWARE,
0,
{ 0x5F9B2B98, 0x3412, 0x4671, { 0x89, 0xAD, 0x5B, 0xA9, 0x53, 0x74, 0xC6, 0xA8 } }
};
extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) {
hInst=hinstDLL;
return TRUE;
}
extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) {
return &pluginInfo;
}
// TODO: add any interfaces you implement to this list
static const MUUID interfaces[] = {MIID_PROTOCOL, MIID_METACONTACTS, MIID_LAST};
extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
{
return interfaces;
}
int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
InitIcons();
InitMenu();
if(DBGetContactSettingByte(0, MODULE, "FirstRun", 1) == 1) {
ImportOldMetas();
DBWriteContactSettingByte(0, MODULE, "FirstRun", 0);
}
return 0;
}
HANDLE hModulesLoaded;
extern "C" __declspec (dllexport) int Load(PLUGINLINK *link) {
pluginLink=link;
DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &metaMainThread, THREAD_SET_CONTEXT, FALSE, 0 );
mir_getMMI(&mmi);
mir_getUTFI(&utfi);
InitOptions();
InitPriorities();
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULE "/Status"));
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULE "/IdleTS"));
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULE "/Handle"));
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULE "/WindowOpen"));
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULE "/IsSubcontact"));
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULE "/ForceSend"));
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULE "/TempDefault"));
InitProto();
InitAPI();
InitSettings(link);
// hook modules loaded
hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
return 0;
}
extern "C" __declspec (dllexport) int Unload(void) {
DeinitSettings();
UnhookEvent(hModulesLoaded);
DeinitMenu();
DeinitIcons();
DeinitAPI();
DeinitProto();
DeinitPriorities();
DeinitOptions();
return 0;
}
|