summaryrefslogtreecommitdiff
path: root/clist_classic_sje/init.c
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-02-02 14:13:23 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-02-02 14:13:23 +0000
commitd72729b46f37b9ff953a12ba2926e0b6b71f1142 (patch)
tree7767534818c0989b51c961f6799abcc17a9f66df /clist_classic_sje/init.c
parent35ded165ba1c21cd526191a47101da56c101d1a9 (diff)
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@105 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'clist_classic_sje/init.c')
-rw-r--r--clist_classic_sje/init.c182
1 files changed, 182 insertions, 0 deletions
diff --git a/clist_classic_sje/init.c b/clist_classic_sje/init.c
new file mode 100644
index 0000000..b9a26c2
--- /dev/null
+++ b/clist_classic_sje/init.c
@@ -0,0 +1,182 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2005 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "commonheaders.h"
+
+HINSTANCE g_hInst = 0;
+PLUGINLINK *pluginLink;
+CLIST_INTERFACE* pcli = NULL;
+HIMAGELIST himlCListClc = NULL;
+
+extern int currentDesiredStatusMode;
+
+struct MM_INTERFACE mmi;
+BOOL(WINAPI * MySetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD) = NULL;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// external functions
+
+void InitCustomMenus( void );
+void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint);
+
+int ClcOptInit(WPARAM wParam, LPARAM lParam);
+int CluiOptInit(WPARAM wParam, LPARAM lParam);
+int CListOptInit(WPARAM wParam, LPARAM lParam);
+
+void ReplaceCListWndProc(CLIST_INTERFACE *pcli);
+void AddMetaMods(CLIST_INTERFACE *pcli);
+
+void InitFrames();
+int FramesModulesLoaded(WPARAM wParam, LPARAM lParam);
+void DeinitFrames();
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// dll stub
+
+BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved)
+{
+ g_hInst = hInstDLL;
+ DisableThreadLibraryCalls(g_hInst);
+ return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// returns the plugin information
+
+PLUGININFO pluginInfo = {
+ sizeof(PLUGININFO),
+ #if defined( _UNICODE )
+ "Classic contact list [sje mod] (Unicode)",
+ #else
+ "Classic contact list [sje mod]",
+ #endif
+ PLUGIN_MAKE_VERSION(0, 2, 4, 1),
+
+ "Display contacts, event notifications, protocol status",
+ "Miranda IM project",
+ "mail@scottellis.com.au",
+ "Copyright 2000-2006 Miranda IM project, 2006 Scott Ellis",
+ "http://www.scottellis.com.au",
+ UNICODE_AWARE,
+ DEFMOD_CLISTALL
+};
+
+__declspec(dllexport) PLUGININFO *MirandaPluginInfo(DWORD mirandaVersion)
+{
+ if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 4, 3, 0))
+ return NULL;
+ return &pluginInfo;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// called when all modules got loaded
+
+static int OnModulesLoaded( WPARAM wParam, LPARAM lParam )
+{
+
+ himlCListClc = (HIMAGELIST) CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
+
+ if(ServiceExists(MS_MC_DISABLEHIDDENGROUP))
+ CallService(MS_MC_DISABLEHIDDENGROUP, 1, 0);
+
+ //HookEvent(ME_SYSTEM_MODULESLOADED, FramesModulesLoaded);
+
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// options iniatialization
+
+static int OnOptsInit(WPARAM wParam, LPARAM lParam)
+{
+ ClcOptInit(wParam, lParam);
+ CluiOptInit(wParam, lParam);
+ CListOptInit(wParam, lParam);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// menu status services
+
+static int GetStatusMode(WPARAM wParam, LPARAM lParam)
+{
+ return pcli->currentDesiredStatusMode;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// main clist initialization routine
+
+int __declspec(dllexport) CListInitialise(PLUGINLINK * link)
+{
+ int rc = 0;
+ pluginLink = link;
+ #ifdef _DEBUG
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+ #endif
+
+ // get the internal malloc/free()
+ mir_getMMI( &mmi );
+
+ pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst);
+ if ( (int)pcli == CALLSERVICE_NOTFOUND ) {
+LBL_Error:
+ MessageBoxA( NULL, "This version of plugin requires Miranda IM 0.7.0.8 or later", "Fatal error", MB_OK );
+ return 1;
+ }
+ if ( pcli->version < 4 )
+ goto LBL_Error;
+
+ pcli->pfnPaintClc = PaintClc;
+
+ ReplaceCListWndProc(pcli);
+ AddMetaMods(pcli);
+ //InitFrames();
+
+ MySetLayeredWindowAttributes = (BOOL(WINAPI *) (HWND, COLORREF, BYTE, DWORD)) GetProcAddress(
+ LoadLibraryA("user32.dll"), "SetLayeredWindowAttributes");
+
+ CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode);
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, OnOptsInit);
+
+ InitCustomMenus();
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// a plugin loader aware of CList exports will never call this.
+
+int __declspec(dllexport) Load(PLUGINLINK * link)
+{
+ return 1;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// a plugin unloader
+
+int __declspec(dllexport) Unload(void)
+{
+ //DeinitFrames();
+ return 0;
+}