summaryrefslogtreecommitdiff
path: root/plugins/MirFox/src/MirandaInterface.cpp
diff options
context:
space:
mode:
authorSzymon Tokarz <wsx22@o2.pl>2016-05-31 21:41:30 +0000
committerSzymon Tokarz <wsx22@o2.pl>2016-05-31 21:41:30 +0000
commit9ba730bc48e44630b418f4214aee57c7b7c987bd (patch)
treecc9a0341bcc2ab947b9047890bf0e1b88ad38737 /plugins/MirFox/src/MirandaInterface.cpp
parente2a1d9a9b2cf04583a3e97a9a2305256357cc443 (diff)
[MirFox]
Immediately refresh data in Firefox menu when Miranda contact or account is added, renamed, deleted, enabled or disabled, hide or unhide. Add "Add acount to contact name" option. git-svn-id: http://svn.miranda-ng.org/main/trunk@16892 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
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;
}