diff options
| author | George Hazan <george.hazan@gmail.com> | 2014-07-23 19:35:41 +0000 | 
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2014-07-23 19:35:41 +0000 | 
| commit | ecbc38dec485f26b80889f104c68636f67a1251f (patch) | |
| tree | 490cc2d05a318307b1daa83f03b1a64f2d63cfc3 | |
| parent | 45c2ed059fdbfb2f5e9a9281f2e0538704f17017 (diff) | |
rest of MetaProto/Enabled
git-svn-id: http://svn.miranda-ng.org/main/trunk@9929 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
| -rw-r--r-- | plugins/Clist_nicer/src/clc.cpp | 17 | ||||
| -rw-r--r-- | plugins/Clist_nicer/src/init.cpp | 2 | ||||
| -rw-r--r-- | plugins/KeyboardNotify/src/main.cpp | 105 | ||||
| -rw-r--r-- | plugins/QuickContacts/src/quickcontacts.cpp | 2 | 
4 files changed, 52 insertions, 74 deletions
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 2821d6c39a..e9c7520c6a 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -97,6 +97,15 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam)  	return 0;
  }
 +static int ClcMetamodeChanged(WPARAM bMetaEnabled, LPARAM lParam)
 +{
 +	if (bMetaEnabled != cfg::dat.bMetaEnabled) {
 +		cfg::dat.bMetaEnabled = (BYTE)bMetaEnabled;
 +		pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
 +	}
 +	return 0;
 +}
 +
  static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
  {
  	char *szProto = NULL;
 @@ -159,13 +168,6 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)  				pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, hContact, lParam);
  		}
  	}
 -	else if (!__strcmp(cws->szModule, META_PROTO)) {
 -		BYTE bMetaEnabled = cfg::getByte(META_PROTO, "Enabled", 1);
 -		if (bMetaEnabled != (BYTE)cfg::dat.bMetaEnabled) {
 -			cfg::dat.bMetaEnabled = bMetaEnabled;
 -			pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
 -		}
 -	}
  	else if (!__strcmp(cws->szModule, "Skin") && !__strcmp(cws->szSetting, "UseSound")) {
  		cfg::dat.soundsOff = cfg::getByte(cws->szModule, cws->szSetting, 0) ? 0 : 1;
  		ClcSetButtonState(IDC_TBSOUND, cfg::dat.soundsOff ? BST_CHECKED : BST_UNCHECKED);
 @@ -217,6 +219,7 @@ int LoadCLCModule(void)  	hCListImages = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
 +	HookEvent(ME_MC_ENABLED, ClcMetamodeChanged);
  	HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ClcSettingChanged);
  	HookEvent(ME_DB_EVENT_ADDED, ClcEventAdded);
  	HookEvent(ME_OPT_INITIALISE, ClcOptInit);
 diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index d19ea44be7..de0efb2551 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -173,7 +173,7 @@ static int systemModulesLoaded(WPARAM wParam, LPARAM lParam)  	GetSystemTime(&cfg::dat.st);
  	SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft);
 -	cfg::dat.bMetaEnabled = cfg::getByte(META_PROTO, "Enabled", 1);
 +	cfg::dat.bMetaEnabled = db_mc_isEnabled();
  	cfg::dat.bAvatarServiceAvail = ServiceExists(MS_AV_GETAVATARBITMAP) ? TRUE : FALSE;
  	if (cfg::dat.bAvatarServiceAvail)
 diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index fa49ad2906..7f5f072fc5 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -26,7 +26,6 @@  #define NCONVERS_BLINKID ((HANDLE)123456) //nconvers' random identifier used to flash an icon for "incoming message" on contact list
 -
  HINSTANCE hInst;
  int hLangpack;
 @@ -36,16 +35,6 @@ HANDLE hThread = NULL;  HANDLE hFlashEvent;
  HANDLE hExitEvent;
 -HANDLE hModulesLoaded = NULL;
 -HANDLE hMsgEventHook = NULL;
 -HANDLE hOptionsInitialize = NULL;
 -HANDLE hEnableService = NULL;
 -HANDLE hDisableService = NULL;
 -HANDLE hStartBlinkService = NULL;
 -HANDLE hEventsOpenedService = NULL;
 -HANDLE hFlashingEventService = NULL;
 -HANDLE hNormalizeSequenceService = NULL;
 -
  HHOOK hMirandaMouseHook = NULL;
  HHOOK hMirandaKeyBoardHook = NULL;
  HHOOK hMirandaWndProcHook = NULL;
 @@ -53,7 +42,7 @@ UINT hReminderTimer = 0;  HHOOK hMouseHook = NULL;
  HHOOK hKeyBoardHook = NULL;
 -BYTE bEmulateKeypresses = 0;
 +BYTE  bEmulateKeypresses = 0;
  DWORD dwLastInput = 0;
  POINT lastGlobalMousePos = {0, 0};
 @@ -128,11 +117,9 @@ BOOL checkOpenWindow(MCONTACT hContact)  		return TRUE;
  	BOOL focus, found = CheckMsgWnd(hContact, &focus);
 -	if (!found && bMetaProtoEnabled) {
 -		MCONTACT hMetaContact = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0);
 -		if (hMetaContact && db_mc_getMeta(hContact) == hMetaContact)
 -			found = CheckMsgWnd(hMetaContact, &focus);
 -	}
 +	if (!found && bMetaProtoEnabled)
 +		found = CheckMsgWnd(db_mc_getMeta(hContact), &focus);
 +
  	if (!found)
  		return TRUE;
 @@ -373,7 +360,7 @@ BOOL contactCheckProtocol(char *szProto, MCONTACT hContact, WORD eventType)  			return FALSE;
  	}
 -	return (metaCheckProtocol(szProto, hContact, eventType));
 +	return metaCheckProtocol(szProto, hContact, eventType);
  }
 @@ -635,7 +622,7 @@ void LoadSettings(void)  				ProtoList.protoInfo[i].xstatus.enabled[j] = db_get_b(NULL, KEYBDMODULE, fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), DEF_SETTING_XSTATUS);
  		}
 -	bMetaProtoEnabled = db_get_b(NULL, META_PROTO, "Enabled", 1);
 +	bMetaProtoEnabled = db_mc_isEnabled();
  	destroyProcessList();
  	createProcessList();
 @@ -736,6 +723,11 @@ void createEventPrefix(TCHAR *prefixName, size_t maxLen)  // ** Everything below is just Miranda init/uninit stuff
  // **
 +static int OnMetaChanged(WPARAM wParam, LPARAM)
 +{
 +	bMetaProtoEnabled = wParam;
 +	return 0;
 +}
  static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
  {
 @@ -753,15 +745,16 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam)  	hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)FlashThreadFunction, NULL, 0, &IDThread);
 -	hMsgEventHook = HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);
 -	hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, InitializeOptions);
 -	hEnableService = CreateServiceFunction(MS_KBDNOTIFY_ENABLE, EnableService);
 -	hDisableService = CreateServiceFunction(MS_KBDNOTIFY_DISABLE, DisableService);
 -	hStartBlinkService = CreateServiceFunction(MS_KBDNOTIFY_STARTBLINK, StartBlinkService);
 -	hEventsOpenedService = CreateServiceFunction(MS_KBDNOTIFY_EVENTSOPENED, EventsWereOpenedService);
 -	hFlashingEventService = CreateServiceFunction(MS_KBDNOTIFY_FLASHINGACTIVE, IsFlashingActiveService);
 -	hNormalizeSequenceService = CreateServiceFunction(MS_KBDNOTIFY_NORMALSEQUENCE, NormalizeSequenceService);
 -
 +	HookEvent(ME_MC_ENABLED, OnMetaChanged);
 +	HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);
 +	HookEvent(ME_OPT_INITIALISE, InitializeOptions);
 +	
 +	CreateServiceFunction(MS_KBDNOTIFY_ENABLE, EnableService);
 +	CreateServiceFunction(MS_KBDNOTIFY_DISABLE, DisableService);
 +	CreateServiceFunction(MS_KBDNOTIFY_STARTBLINK, StartBlinkService);
 +	CreateServiceFunction(MS_KBDNOTIFY_EVENTSOPENED, EventsWereOpenedService);
 +	CreateServiceFunction(MS_KBDNOTIFY_FLASHINGACTIVE, IsFlashingActiveService);
 +	CreateServiceFunction(MS_KBDNOTIFY_NORMALSEQUENCE, NormalizeSequenceService);
  	return 0;
  }
 @@ -784,8 +777,8 @@ extern "C" __declspec(dllexport) int Load(void)  	GetWindowsVersion();
  	OpenKeyboardDevice();
 -	hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
 +	HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
  	return 0;
  }
 @@ -809,24 +802,6 @@ void destroyProtocolList(void)  extern "C" __declspec(dllexport) int Unload(void)
  {
  	UnhookWindowsHooks();
 -	if (hModulesLoaded)
 -		UnhookEvent(hModulesLoaded);
 -	if (hMsgEventHook)
 -		UnhookEvent(hMsgEventHook);
 -	if (hOptionsInitialize)
 -		UnhookEvent(hOptionsInitialize);
 -	if (hEnableService)
 -		DestroyServiceFunction(hEnableService);
 -	if (hDisableService)
 -		DestroyServiceFunction(hDisableService);
 -	if (hStartBlinkService)
 -		DestroyServiceFunction(hStartBlinkService);
 -	if (hEventsOpenedService)
 -		DestroyServiceFunction(hEventsOpenedService);
 -	if (hFlashingEventService)
 -		DestroyServiceFunction(hFlashingEventService);
 -	if (hNormalizeSequenceService)
 -		DestroyServiceFunction(hNormalizeSequenceService);
  	// Wait for thread to exit
  	SetEvent(hExitEvent);
 @@ -968,7 +943,7 @@ static LRESULT CALLBACK MirandaWndProcHookFunction(int code, WPARAM wParam, LPAR  BOOL CheckMsgWnd(MCONTACT hContact, BOOL *focus)
  {
 -	if (ServiceExists(MS_MSG_GETWINDOWDATA)) {	// use the new message API
 +	if (hContact) {
  		MessageWindowData mwd = { sizeof(MessageWindowData) };
  		MessageWindowInputData mwid = { sizeof(MessageWindowInputData) };
  		mwid.hContact = hContact;
 @@ -994,23 +969,23 @@ void countUnopenEvents(int *msgCount, int *fileCount, int *urlCount, int *otherC  		DBEVENTINFO einfo = readEventInfo(pCLEvent->hDbEvent, pCLEvent->hContact);
  		if (metaCheckProtocol(einfo.szModule, pCLEvent->hContact, einfo.eventType))
 -			switch (einfo.eventType) {
 -				case EVENTTYPE_MESSAGE:
 -					if (bFlashOnMsg)
 -						(*msgCount)++;
 -					break;
 -				case EVENTTYPE_URL:
 -					if (bFlashOnURL)
 -						(*urlCount)++;
 -					break;
 -				case EVENTTYPE_FILE:
 -					if (bFlashOnFile)
 -						(*fileCount)++;
 -					break;
 -				default:
 -					if (bFlashOnOther)
 -						(*otherCount)++;
 -			}
 +		switch (einfo.eventType) {
 +		case EVENTTYPE_MESSAGE:
 +			if (bFlashOnMsg)
 +				(*msgCount)++;
 +			break;
 +		case EVENTTYPE_URL:
 +			if (bFlashOnURL)
 +				(*urlCount)++;
 +			break;
 +		case EVENTTYPE_FILE:
 +			if (bFlashOnFile)
 +				(*fileCount)++;
 +			break;
 +		default:
 +			if (bFlashOnOther)
 +				(*otherCount)++;
 +		}
  	}
  	if (bFlashOnOther)
  		(*otherCount) += nExternCount;
 diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index fe69dea394..dab75c2726 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -329,7 +329,7 @@ void FreeContacts()  void LoadContacts(HWND hwndDlg, BOOL show_all)
  {
 -	BOOL metacontactsEnabled = db_get_b(0, META_PROTO, "Enabled", 1);
 +	BOOL metacontactsEnabled = db_mc_isEnabled();
  	// Read last-sent-to contact from db and set handle as window-userdata
  	HANDLE hlastsent = (HANDLE)db_get_dw(NULL, MODULE_NAME, "LastSentTo", -1);
  | 
