summaryrefslogtreecommitdiff
path: root/plugins/NewEventNotify/options.cpp
blob: 2e22a9f5cde86e9e6dabfbaa7fa73329999fff1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
/*
  Name: NewEventNotify - Plugin for Miranda IM
  File: options.c - Manages Option Dialogs and Settings
  Version: 0.0.4
  Description: Notifies you about some events
  Author: icebreaker, <icebreaker@newmail.net>
  Date: 22.07.02 13:06 / Update: 16.09.02 17:45
  Copyright: (C) 2002 Starzinger Michael

    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 "neweventnotify.h"

PLUGIN_OPTIONS* options;
BOOL bWmNotify;

int OptionsRead(void)
{
  options->bDisable = DBGetContactSettingByte(NULL, MODULE, OPT_DISABLE, FALSE);
  options->bPreview = DBGetContactSettingByte(NULL, MODULE, OPT_PREVIEW, TRUE);
  options->bMenuitem = DBGetContactSettingByte(NULL, MODULE, OPT_MENUITEM, FALSE);
  options->bDefaultColorMsg = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, FALSE);
  options->bDefaultColorUrl = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_URL, FALSE);
  options->bDefaultColorFile = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_FILE, FALSE);
  options->bDefaultColorOthers = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_OTHERS, FALSE);
  options->colBackMsg = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
  options->colTextMsg = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
  options->colBackUrl = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_URL, DEFAULT_COLBACK);
  options->colTextUrl = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLTEXT_URL, DEFAULT_COLTEXT);
  options->colBackFile = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_FILE, DEFAULT_COLBACK);
  options->colTextFile = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLTEXT_FILE, DEFAULT_COLTEXT);
  options->colBackOthers = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
  options->colTextOthers = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
  options->maskNotify = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKNOTIFY, DEFAULT_MASKNOTIFY);
  options->maskActL = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKACTL, DEFAULT_MASKACTL);
  options->maskActR = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKACTR, DEFAULT_MASKACTR);
  options->maskActTE = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKACTTE, DEFAULT_MASKACTE);
  options->bMsgWindowCheck = DBGetContactSettingByte(NULL, MODULE, OPT_MSGWINDOWCHECK, TRUE);
  options->bMsgReplyWindow = DBGetContactSettingByte(NULL, MODULE, OPT_MSGREPLYWINDOW, FALSE);
  options->bMergePopup = DBGetContactSettingByte(NULL, MODULE, OPT_MERGEPOPUP, TRUE);
  options->iDelayMsg = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
  options->iDelayUrl = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_URL, DEFAULT_DELAY);
  options->iDelayFile = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_FILE, DEFAULT_DELAY);
  options->iDelayOthers = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY);
  options->iDelayDefault = (int)DBGetContactSettingRangedWord(NULL, "PopUp", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
  options->bShowDate = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_DATE, TRUE);
  options->bShowTime = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_TIME, TRUE);
  options->bShowHeaders = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_HEADERS, TRUE);
  options->iNumberMsg = (BYTE)DBGetContactSettingByte(NULL, MODULE, OPT_NUMBER_MSG, TRUE);
  options->bShowON = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_ON, TRUE);
  options->bHideSend = DBGetContactSettingByte(NULL, MODULE, OPT_HIDESEND, TRUE);
  options->bNoRSS = DBGetContactSettingByte(NULL, MODULE, OPT_NORSS, FALSE);
  options->bReadCheck = DBGetContactSettingByte(NULL, MODULE, OPT_READCHECK, FALSE);
  return 0;
}

int OptionsWrite(void)
{
  DBWriteContactSettingByte(NULL, MODULE, OPT_DISABLE,  options->bDisable);
  DBWriteContactSettingByte(NULL, MODULE, OPT_PREVIEW,  options->bPreview);
  DBWriteContactSettingByte(NULL, MODULE, OPT_MENUITEM, options->bMenuitem);
  DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, options->bDefaultColorMsg);
  DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_URL,     options->bDefaultColorUrl);
  DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_FILE,    options->bDefaultColorFile);
  DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_OTHERS,  options->bDefaultColorOthers);
  DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_MESSAGE, (DWORD)options->colBackMsg);
  DBWriteContactSettingDword(NULL, MODULE, OPT_COLTEXT_MESSAGE, (DWORD)options->colTextMsg);
  DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_URL, (DWORD)options->colBackUrl);
  DBWriteContactSettingDword(NULL, MODULE, OPT_COLTEXT_URL, (DWORD)options->colTextUrl);
  DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_FILE, (DWORD)options->colBackFile);
  DBWriteContactSettingDword(NULL, MODULE, OPT_COLTEXT_FILE, (DWORD)options->colTextFile);
  DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_OTHERS, (DWORD)options->colBackOthers);
  DBWriteContactSettingDword(NULL, MODULE, OPT_COLTEXT_OTHERS, (DWORD)options->colTextOthers);
  DBWriteContactSettingByte(NULL, MODULE, OPT_MASKNOTIFY, (BYTE)options->maskNotify);
  DBWriteContactSettingByte(NULL, MODULE, OPT_MASKACTL, (BYTE)options->maskActL);
  DBWriteContactSettingByte(NULL, MODULE, OPT_MASKACTR, (BYTE)options->maskActR);
  DBWriteContactSettingByte(NULL, MODULE, OPT_MASKACTTE, (BYTE)options->maskActTE);
  DBWriteContactSettingByte(NULL, MODULE, OPT_MSGWINDOWCHECK, options->bMsgWindowCheck);
  DBWriteContactSettingByte(NULL, MODULE, OPT_MSGREPLYWINDOW, options->bMsgReplyWindow);
  DBWriteContactSettingByte(NULL, MODULE, OPT_MERGEPOPUP,     options->bMergePopup);
  DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_MESSAGE, (DWORD)options->iDelayMsg);
  DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_URL, (DWORD)options->iDelayUrl);
  DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_FILE, (DWORD)options->iDelayFile);
  DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_OTHERS, (DWORD)options->iDelayOthers);
  DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_DATE,    options->bShowDate);
  DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_TIME,    options->bShowTime);
  DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_HEADERS, options->bShowHeaders);
  DBWriteContactSettingByte(NULL, MODULE, OPT_NUMBER_MSG, (BYTE)options->iNumberMsg);
  DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_ON,    options->bShowON);
  DBWriteContactSettingByte(NULL, MODULE, OPT_HIDESEND,   options->bHideSend);
  DBWriteContactSettingByte(NULL, MODULE, OPT_NORSS,      options->bNoRSS);
  DBWriteContactSettingByte(NULL, MODULE, OPT_READCHECK,  options->bReadCheck);
  return 0;
}

static void SetCheckBoxState(HWND hWnd, int iCtrl, BOOL bState)
{
  CheckDlgButton(hWnd, iCtrl, bState ? BST_CHECKED : BST_UNCHECKED);
}

static void EnableDlgItem(HWND hWnd, int iCtrl, BOOL bEnable)
{
  EnableWindow(GetDlgItem(hWnd, iCtrl), bEnable); 
}

static void UpdateOptionsDlgItemsState(HWND hWnd)
{
  //disable color picker when using default colors
  EnableDlgItem(hWnd, IDC_COLBACK_MESSAGE,  !options->bDefaultColorMsg);
  EnableDlgItem(hWnd, IDC_COLTEXT_MESSAGE,  !options->bDefaultColorMsg);
  EnableDlgItem(hWnd, IDC_COLBACK_URL,      !options->bDefaultColorUrl);
  EnableDlgItem(hWnd, IDC_COLTEXT_URL,      !options->bDefaultColorUrl);
  EnableDlgItem(hWnd, IDC_COLBACK_FILE,     !options->bDefaultColorFile);
  EnableDlgItem(hWnd, IDC_COLTEXT_FILE,     !options->bDefaultColorFile);
  EnableDlgItem(hWnd, IDC_COLBACK_OTHERS,   !options->bDefaultColorOthers);
  EnableDlgItem(hWnd, IDC_COLTEXT_OTHERS,   !options->bDefaultColorOthers);
	//disable merge messages options when is not using
	EnableDlgItem(hWnd, IDC_CHKSHOWDATE,    options->bMergePopup);
	EnableDlgItem(hWnd, IDC_CHKSHOWTIME,    options->bMergePopup);
	EnableDlgItem(hWnd, IDC_CHKSHOWHEADERS, options->bMergePopup);
	EnableDlgItem(hWnd, IDC_CMDEDITHEADERS, options->bMergePopup && options->bShowHeaders);
	EnableDlgItem(hWnd, IDC_NUMBERMSG,      options->bMergePopup);
	EnableDlgItem(hWnd, IDC_LBNUMBERMSG,    options->bMergePopup);
	EnableDlgItem(hWnd, IDC_RDNEW,          options->bMergePopup && options->iNumberMsg);
	EnableDlgItem(hWnd, IDC_RDOLD,          options->bMergePopup && options->iNumberMsg);
	//disable delay textbox when infinite is checked
	EnableDlgItem(hWnd, IDC_DELAY_MESSAGE,  options->iDelayMsg != -1);
	EnableDlgItem(hWnd, IDC_DELAY_URL,      options->iDelayUrl != -1);
	EnableDlgItem(hWnd, IDC_DELAY_FILE,     options->iDelayFile != -1);
	EnableDlgItem(hWnd, IDC_DELAY_OTHERS,   options->iDelayOthers != -1);
}

static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
  {
    case WM_INITDIALOG:
      TranslateDialogDefault(hWnd);
      //make dialog represent the current options
      bWmNotify = TRUE;
			SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, options->colBackMsg);
      SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, options->colTextMsg);
      SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_SETCOLOUR, 0, options->colBackUrl);
      SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_SETCOLOUR, 0, options->colTextUrl);
      SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_SETCOLOUR, 0, options->colBackFile);
      SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_SETCOLOUR, 0, options->colTextFile);
      SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, options->colBackOthers);
      SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_SETCOLOUR, 0, options->colTextOthers);
      SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_MESSAGE, options->bDefaultColorMsg);
      SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_URL,     options->bDefaultColorUrl);
      SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_FILE,    options->bDefaultColorFile);
      SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_OTHERS,  options->bDefaultColorOthers);
      SetCheckBoxState(hWnd, IDC_CHKMENUITEM,   options->bMenuitem);
      SetCheckBoxState(hWnd, IDC_CHKDISABLE,    options->bDisable);
      SetCheckBoxState(hWnd, IDC_CHKPREVIEW,    options->bPreview);
			SetCheckBoxState(hWnd, IDC_CHKMERGEPOPUP, options->bMergePopup);
      SetCheckBoxState(hWnd, IDC_CHKNOTIFY_MESSAGE, options->maskNotify & MASK_MESSAGE);
      SetCheckBoxState(hWnd, IDC_CHKNOTIFY_URL,     options->maskNotify & MASK_URL);
      SetCheckBoxState(hWnd, IDC_CHKNOTIFY_FILE,    options->maskNotify & MASK_FILE);
      SetCheckBoxState(hWnd, IDC_CHKNOTIFY_OTHER,   options->maskNotify & MASK_OTHER);
      SetCheckBoxState(hWnd, IDC_CHKACTL_DISMISS,   options->maskActL & MASK_DISMISS);
      SetCheckBoxState(hWnd, IDC_CHKACTL_OPEN,      options->maskActL & MASK_OPEN);
      SetCheckBoxState(hWnd, IDC_CHKACTL_REMOVE,    options->maskActL & MASK_REMOVE);
      SetCheckBoxState(hWnd, IDC_CHKACTR_DISMISS,   options->maskActR & MASK_DISMISS);
      SetCheckBoxState(hWnd, IDC_CHKACTR_OPEN,      options->maskActR & MASK_OPEN);
      SetCheckBoxState(hWnd, IDC_CHKACTR_REMOVE,    options->maskActR & MASK_REMOVE);
			SetCheckBoxState(hWnd, IDC_CHKACTTE_DISMISS,  options->maskActTE & MASK_DISMISS);
      SetCheckBoxState(hWnd, IDC_CHKACTTE_OPEN,     options->maskActTE & MASK_OPEN);
      SetCheckBoxState(hWnd, IDC_CHKACTTE_REMOVE,   options->maskActTE & MASK_REMOVE);
      SetCheckBoxState(hWnd, IDC_CHKWINDOWCHECK,  options->bMsgWindowCheck);
      SetCheckBoxState(hWnd, IDC_CHKREPLYWINDOW,  options->bMsgReplyWindow);
			SetCheckBoxState(hWnd, IDC_CHKSHOWDATE,     options->bShowDate);
			SetCheckBoxState(hWnd, IDC_CHKSHOWTIME,     options->bShowTime);
			SetCheckBoxState(hWnd, IDC_CHKSHOWHEADERS,  options->bShowHeaders);
			SetCheckBoxState(hWnd, IDC_RDNEW,           !options->bShowON);
			SetCheckBoxState(hWnd, IDC_RDOLD,           options->bShowON);
			SetCheckBoxState(hWnd, IDC_CHKHIDESEND,     options->bHideSend);
			SetCheckBoxState(hWnd, IDC_SUPRESSRSS,      options->bNoRSS);
			SetCheckBoxState(hWnd, IDC_READCHECK,       options->bReadCheck);
			SetCheckBoxState(hWnd, IDC_CHKINFINITE_MESSAGE, options->iDelayMsg == -1);
			SetCheckBoxState(hWnd, IDC_CHKINFINITE_URL,     options->iDelayUrl == -1);
			SetCheckBoxState(hWnd, IDC_CHKINFINITE_FILE,    options->iDelayFile == -1);
			SetCheckBoxState(hWnd, IDC_CHKINFINITE_OTHERS,  options->iDelayOthers == -1);
      SetDlgItemInt(hWnd, IDC_DELAY_MESSAGE,  options->iDelayMsg != -1?options->iDelayMsg:0, TRUE);
			SetDlgItemInt(hWnd, IDC_DELAY_URL,      options->iDelayUrl != -1?options->iDelayUrl:0, TRUE);
			SetDlgItemInt(hWnd, IDC_DELAY_FILE,     options->iDelayFile != -1?options->iDelayFile:0, TRUE);
			SetDlgItemInt(hWnd, IDC_DELAY_OTHERS,   options->iDelayOthers != -1?options->iDelayOthers:0, TRUE);
			SetDlgItemInt(hWnd, IDC_NUMBERMSG,      options->iNumberMsg, FALSE);
      //update items' states 
      UpdateOptionsDlgItemsState(hWnd);
      bWmNotify = FALSE;
      return TRUE;

    case WM_COMMAND:
			if (!bWmNotify) 
			{
				switch (LOWORD(wParam))
					{
						case IDC_PREVIEW:
				      PopupPreview(options);
							break;
						default:
						  //update options
							options->maskNotify = (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_MESSAGE)?MASK_MESSAGE:0) |
														        (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_URL)?MASK_URL:0) |
				                            (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_FILE)?MASK_FILE:0) |
					                          (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_OTHER)?MASK_OTHER:0);
					    options->maskActL = (IsDlgButtonChecked(hWnd, IDC_CHKACTL_DISMISS)?MASK_DISMISS:0) |
							                    (IsDlgButtonChecked(hWnd, IDC_CHKACTL_OPEN)?MASK_OPEN:0) |
								                  (IsDlgButtonChecked(hWnd, IDC_CHKACTL_REMOVE)?MASK_REMOVE:0);
							options->maskActR = (IsDlgButtonChecked(hWnd, IDC_CHKACTR_DISMISS)?MASK_DISMISS:0) |
	                                (IsDlgButtonChecked(hWnd, IDC_CHKACTR_OPEN)?MASK_OPEN:0) |
		                              (IsDlgButtonChecked(hWnd, IDC_CHKACTR_REMOVE)?MASK_REMOVE:0);
							options->maskActTE = (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_DISMISS)?MASK_DISMISS:0) |
	                                 (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_OPEN)?MASK_OPEN:0) |
		                               (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_REMOVE)?MASK_REMOVE:0);
			        options->bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE);
				      options->bDefaultColorUrl = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_URL);
					    options->bDefaultColorFile = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_FILE);
						  options->bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS);
			    		options->bMenuitem = IsDlgButtonChecked(hWnd, IDC_CHKMENUITEM);
							options->bDisable = IsDlgButtonChecked(hWnd, IDC_CHKDISABLE);
	            options->bPreview = IsDlgButtonChecked(hWnd, IDC_CHKPREVIEW);
							options->iDelayMsg = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_MESSAGE)?-1:(DWORD)GetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, NULL, FALSE);
							options->iDelayUrl = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_URL)?-1:(DWORD)GetDlgItemInt(hWnd, IDC_DELAY_URL, NULL, FALSE);
							options->iDelayFile = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_FILE)?-1:(DWORD)GetDlgItemInt(hWnd, IDC_DELAY_FILE, NULL, FALSE);
							options->iDelayOthers = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_OTHERS)?-1:(DWORD)GetDlgItemInt(hWnd, IDC_DELAY_OTHERS, NULL, FALSE);
							options->bMergePopup = IsDlgButtonChecked(hWnd, IDC_CHKMERGEPOPUP);
							options->bMsgWindowCheck = IsDlgButtonChecked(hWnd, IDC_CHKWINDOWCHECK);
							options->bMsgReplyWindow = IsDlgButtonChecked(hWnd, IDC_CHKREPLYWINDOW);
	            options->bShowDate = IsDlgButtonChecked(hWnd, IDC_CHKSHOWDATE);
							options->bShowTime = IsDlgButtonChecked(hWnd, IDC_CHKSHOWTIME);
							options->bShowHeaders = IsDlgButtonChecked(hWnd, IDC_CHKSHOWHEADERS);
							options->bShowON = IsDlgButtonChecked(hWnd, IDC_RDOLD);
							options->bShowON = !IsDlgButtonChecked(hWnd, IDC_RDNEW);
							options->bHideSend = IsDlgButtonChecked(hWnd, IDC_CHKHIDESEND);
							options->iNumberMsg = GetDlgItemInt(hWnd, IDC_NUMBERMSG, NULL, FALSE);
							options->bNoRSS = IsDlgButtonChecked(hWnd, IDC_SUPRESSRSS);
							options->bReadCheck = IsDlgButtonChecked(hWnd, IDC_READCHECK);
              //update items' states
              UpdateOptionsDlgItemsState(hWnd);
							if (HIWORD(wParam) == CPN_COLOURCHANGED)
							{
								options->colBackMsg = SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0);
								options->colTextMsg = SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0);
								options->colBackUrl = SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_GETCOLOUR, 0, 0);
								options->colTextUrl = SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_GETCOLOUR, 0, 0);
								options->colBackFile = SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_GETCOLOUR, 0, 0);
								options->colTextFile = SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_GETCOLOUR, 0, 0);
								options->colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0);
								options->colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0);
							}
							//send changes to menuitem
							MenuitemUpdate(!options->bDisable);
							//enable "Apply" button
							SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
							break;
					}
			}
      break;

    case WM_NOTIFY:
      switch (((LPNMHDR)lParam)->code)
				{
          case PSN_APPLY:
            OptionsWrite();
            break;

          case PSN_RESET:
            OptionsRead();

            //maybe something changed with the menuitem
            MenuitemUpdate(!options->bDisable);
            break;
				}
			break;

    default:
      break;
  }
  return FALSE;
}

int OptionsAdd(HINSTANCE hInst, WPARAM addInfo)
{
	if (ServiceExists(MS_POPUP_ADDPOPUP)) {
		OPTIONSDIALOGPAGE odp = { 0 };
		odp.cbSize = sizeof(odp);
		odp.hInstance = hInst;
		odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
		odp.pszTitle = LPGEN("Event Notify");
		odp.pszGroup = LPGEN("PopUps");
		odp.flags = ODPF_BOLDGROUPS;
		odp.pfnDlgProc = OptionsDlgProc;
		Options_AddPage( addInfo, &odp);
	}

	return 0;
}

int OptionsInit(PLUGIN_OPTIONS* pluginOptions)
{
  options = pluginOptions;

  OptionsRead();

  return 0;
}

int Opt_DisableNEN(BOOL Status)
{
  options->bDisable = Status;
  OptionsWrite(); // JK: really necessary to write everything here ????
    
    //BUG!
    //Update options dialog if open!

	return 0;
}