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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/* Replace "dll.h" with the name of your header */
#include "common.h"
#include "private.h"
#include "resource.h"
#include "icons.h"
#include "options.h"
#include "services.h"
#include "iax_interface.h"
#include "menu.h"
///////////////////////////////////////////////
// Common Plugin Stuff
///////////////////////////////////////////////
HINSTANCE hInst;
PLUGINLINK *pluginLink;
// plugin stuff
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
MODULE,
PLUGIN_MAKE_VERSION(VER_MAJOR, VER_MINOR, VER_RELEASE, VER_BUILD),
DESC_STRING,
"Scott Ellis",
"mail@scottellis.com.au",
"© 2005 Scott Ellis",
"http://www.scottellis.com.au/",
0, //not transient
0, //doesn't replace anything built-in
{ 0x65e1a7f4, 0x1408, 0x4462, { 0xb8, 0xfd, 0x9d, 0xab, 0xb8, 0x37, 0x1f, 0x81 } } // {65E1A7F4-1408-4462-B8FD-9DABB8371F81}
};
extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) {
hInst=hinstDLL;
return TRUE;
}
extern "C" __declspec (dllexport) PLUGININFOEX* __cdecl MirandaPluginInfoEx(DWORD mirandaVersion) {
return &pluginInfo;
}
static const MUUID interfaces[] = {MIID_PROTOCOL, MIID_LAST};
__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
{
return interfaces;
}
int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
if(ServiceExists(MS_UPDATE_REGISTER)) {
// register with updater
Update update = {0};
char szVersion[16];
update.cbSize = sizeof(Update);
update.szComponentName = pluginInfo.shortName;
update.pbVersion = (BYTE *)CreateVersionString(pluginInfo.version, szVersion);
update.cpbVersion = strlen((char *)update.pbVersion);
update.szUpdateURL = UPDATER_AUTOREGISTER;
// these are the three lines that matter - the archive, the page containing the version string, and the text (or data)
// before the version that we use to locate it on the page
// (note that if the update URL and the version URL point to standard file listing entries, the backend xml
// data will be used to check for updates rather than the actual web page - this is not true for beta urls)
update.szBetaUpdateURL = "http://www.scottellis.com.au/miranda_plugins/iax.zip";
update.szBetaVersionURL = "http://www.scottellis.com.au/miranda_plugins/ver_iax.html";
update.pbBetaVersionPrefix = (BYTE *)"IAX, version ";
update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix);
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
}
InitIcons();
InitMenu();
return 0;
}
int PreShutdown(WPARAM wParam, LPARAM lParam) {
DeinitIAXInterface();
return 0;
}
HANDLE hModulesLoaded, hPreShutdown;
extern "C" __declspec (dllexport) int __cdecl Load(PLUGINLINK *link) {
pluginLink=link;
DWORD mirandaVersion = CallService(MS_SYSTEM_GETVERSION, 0, 0);
if(mirandaVersion < (MIRANDA_VER << 8)) {
MessageBox(0, Translate("This plugin requires Miranda version 0.6+. Plugin disabled."), Translate("IAX Plugin error"), MB_OK | MB_ICONERROR);
return 1;
}
PreInitOptions();
if(!InitIAXInterface()) {
MessageBox(0, Translate("Failed to initialize IAX Client library. Plugin disabled."), Translate("IAX Plugin error"), MB_OK | MB_ICONERROR);
return 1;
}
if(ServiceExists(MS_DB_SETSETTINGRESIDENT)) { // 0.6+
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULE "/Status"));
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULE "/LineNo"));
}
INITCOMMONCONTROLSEX icex;
// Ensure that the common control DLL is loaded (for listview)
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&icex);
InitServices();
PROTOCOLDESCRIPTOR pd = {0};
pd.cbSize = sizeof(pd);
pd.szName = MODULE;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
// since we can call people when not registered...
SetContactStatus(ID_STATUS_ONLINE);
InitOptions();
// hook modules loaded
hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
return 0;
}
extern "C" __declspec (dllexport) int __cdecl Unload(void) {
DeinitOptions();
DeinitServices();
DeinitMenu();
DeinitIcons();
return 0;
}
|