summaryrefslogtreecommitdiff
path: root/plugins/MirFox/src/MirandaInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirFox/src/MirandaInterface.cpp')
-rw-r--r--plugins/MirFox/src/MirandaInterface.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/plugins/MirFox/src/MirandaInterface.cpp b/plugins/MirFox/src/MirandaInterface.cpp
index 8b1b7a0e74..299a3635d6 100644
--- a/plugins/MirFox/src/MirandaInterface.cpp
+++ b/plugins/MirFox/src/MirandaInterface.cpp
@@ -46,6 +46,60 @@ extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirand
}
+
+
+
+static int __cdecl onAccListChanged(WPARAM wParam, LPARAM lParam)
+{
+ if (mirfoxMiranda.getMirfoxData().Plugin_Terminated) return 0;
+ mirfoxMiranda.onAccListChanged(wParam, lParam);
+ return 0;
+}
+
+static int __cdecl onContactAdded(WPARAM wParam, LPARAM)
+{
+ if (mirfoxMiranda.getMirfoxData().Plugin_Terminated) return 0;
+ OnContactAsyncThreadArgStruct* onContactAsyncThreadArgStruct = new(OnContactAsyncThreadArgStruct);
+ onContactAsyncThreadArgStruct->hContact = wParam;
+ onContactAsyncThreadArgStruct->mirfoxMiranda = &mirfoxMiranda;
+ mir_forkthread(CMirfoxMiranda::onContactAdded_async, onContactAsyncThreadArgStruct);
+ return 0;
+}
+
+static int __cdecl onContactDeleted(WPARAM wParam, LPARAM)
+{
+ if (mirfoxMiranda.getMirfoxData().Plugin_Terminated) return 0;
+ mirfoxMiranda.onContactDeleted(wParam);
+ return 0;
+}
+
+static int __cdecl onContactSettingChanged(WPARAM hContact, LPARAM lParam){
+
+ if (mirfoxMiranda.getMirfoxData().Plugin_Terminated)
+ return 0;
+ if (hContact == NULL || lParam == NULL)
+ return 0;
+
+ DBCONTACTWRITESETTING* cws = (DBCONTACTWRITESETTING*)lParam;
+ if (!strcmp(cws->szModule, "CList")) {
+
+ if (!strcmp(cws->szSetting, "Hidden")) {
+ mirfoxMiranda.onContactSettingChanged(hContact, lParam);
+ }
+
+ if (!strcmp(cws->szSetting, "MyHandle")) {
+ OnContactAsyncThreadArgStruct* onContactAsyncThreadArgStruct = new(OnContactAsyncThreadArgStruct);
+ onContactAsyncThreadArgStruct->hContact = hContact;
+ onContactAsyncThreadArgStruct->mirfoxMiranda = &mirfoxMiranda;
+ mir_forkthread(CMirfoxMiranda::onContactSettingChanged_async, onContactAsyncThreadArgStruct);
+ }
+ }
+
+ return 0;
+}
+
+
+
/*
* hook on ME_SYSTEM_MODULESLOADED at Load()
*/
@@ -72,6 +126,14 @@ static int onModulesLoaded(WPARAM, LPARAM)
puc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_PE));
hPopupError = Popup_RegisterClass(&puc);
+
+ //init refresh hooks
+ HookEvent(ME_PROTO_ACCLISTCHANGED, onAccListChanged);
+ HookEvent(ME_DB_CONTACT_ADDED, onContactAdded);
+ HookEvent(ME_DB_CONTACT_DELETED, onContactDeleted);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
+
+
return 0;
}