summaryrefslogtreecommitdiff
path: root/iax/dllmain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'iax/dllmain.cpp')
-rw-r--r--iax/dllmain.cpp121
1 files changed, 121 insertions, 0 deletions
diff --git a/iax/dllmain.cpp b/iax/dllmain.cpp
new file mode 100644
index 0000000..a96ab4c
--- /dev/null
+++ b/iax/dllmain.cpp
@@ -0,0 +1,121 @@
+/* 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
+PLUGININFO pluginInfo={
+ sizeof(PLUGININFO),
+ 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
+};
+
+extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) {
+ hInst=hinstDLL;
+ return TRUE;
+}
+
+extern "C" __declspec (dllexport) PLUGININFO* __cdecl MirandaPluginInfo(DWORD mirandaVersion) {
+ return &pluginInfo;
+}
+
+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;
+}
+
+HANDLE hModulesLoaded;
+extern "C" __declspec (dllexport) int __cdecl Load(PLUGINLINK *link) {
+ pluginLink=link;
+
+ 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);
+ return 0;
+}
+
+extern "C" __declspec (dllexport) int __cdecl Unload(void) {
+ DeinitOptions();
+ DeinitServices();
+ DeinitMenu();
+ DeinitIcons();
+ DeinitIAXInterface();
+ return 0;
+}