summaryrefslogtreecommitdiff
path: root/plugins/NewXstatusNotify
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-07-31 14:34:46 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-07-31 14:34:46 +0000
commit35586e08f45e41070186cd32038da1af98adc9d2 (patch)
tree48be4432293f835f91a77d00c42f890ce866a215 /plugins/NewXstatusNotify
parent3bdff57b5868e9d333f61297021f7943ed160500 (diff)
options refactoring (thx slotwin)
git-svn-id: http://svn.miranda-ng.org/main/trunk@10003 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewXstatusNotify')
-rw-r--r--plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj4
-rw-r--r--plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj.filters11
-rw-r--r--plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj2
-rw-r--r--plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj.filters6
-rw-r--r--plugins/NewXstatusNotify/res/logging_status_message.icobin0 -> 1150 bytes
-rw-r--r--plugins/NewXstatusNotify/res/logging_xstatus.icobin0 -> 1150 bytes
-rw-r--r--plugins/NewXstatusNotify/res/resource.rc504
-rw-r--r--plugins/NewXstatusNotify/src/common.h57
-rw-r--r--plugins/NewXstatusNotify/src/indsnd.cpp297
-rw-r--r--plugins/NewXstatusNotify/src/indsnd.h18
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp1133
-rw-r--r--plugins/NewXstatusNotify/src/options.cpp1129
-rw-r--r--plugins/NewXstatusNotify/src/options.h71
-rw-r--r--plugins/NewXstatusNotify/src/popup.cpp58
-rw-r--r--plugins/NewXstatusNotify/src/popup.h10
-rw-r--r--plugins/NewXstatusNotify/src/resource.h58
-rw-r--r--plugins/NewXstatusNotify/src/utils.cpp76
-rw-r--r--plugins/NewXstatusNotify/src/utils.h7
-rw-r--r--plugins/NewXstatusNotify/src/xstatus.cpp486
-rw-r--r--plugins/NewXstatusNotify/src/xstatus.h68
20 files changed, 2344 insertions, 1651 deletions
diff --git a/plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj b/plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj
index 0c0121c66b..b86f01a2a6 100644
--- a/plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj
+++ b/plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj
@@ -224,6 +224,10 @@
<Image Include="res\variables.ico" />
<Image Include="res\xstatus.ico" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="res\logging_status_message.ico" />
+ <None Include="res\logging_xstatus.ico" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj.filters b/plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj.filters
index eace4f77c5..4f27d9777f 100644
--- a/plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj.filters
+++ b/plugins/NewXstatusNotify/NewXstatusNotify_10.vcxproj.filters
@@ -81,9 +81,6 @@
<Image Include="res\enable_all.ico">
<Filter>Resource Files\Icons</Filter>
</Image>
- <Image Include="res\logging.ico">
- <Filter>Resource Files\Icons</Filter>
- </Image>
<Image Include="res\main_off.ico">
<Filter>Resource Files\Icons</Filter>
</Image>
@@ -109,4 +106,12 @@
<Filter>Resource Files\Icons</Filter>
</Image>
</ItemGroup>
+ <ItemGroup>
+ <None Include="res\logging_status_message.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </None>
+ <None Include="res\logging_xstatus.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </None>
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj b/plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj
index 674f36da83..b266e975ab 100644
--- a/plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj
+++ b/plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj
@@ -218,6 +218,8 @@
<Image Include="res\disable_all.ico" />
<Image Include="res\enable_all.ico" />
<Image Include="res\logging.ico" />
+ <Image Include="res\logging_status_message.ico" />
+ <Image Include="res\logging_xstatus.ico" />
<Image Include="res\main_off.ico" />
<Image Include="res\main_on.ico" />
<Image Include="res\popup.ico" />
diff --git a/plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj.filters b/plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj.filters
index eace4f77c5..12dddc8305 100644
--- a/plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj.filters
+++ b/plugins/NewXstatusNotify/NewXstatusNotify_12.vcxproj.filters
@@ -108,5 +108,11 @@
<Image Include="res\xstatus.ico">
<Filter>Resource Files\Icons</Filter>
</Image>
+ <Image Include="res\logging_status_message.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
+ <Image Include="res\logging_xstatus.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/plugins/NewXstatusNotify/res/logging_status_message.ico b/plugins/NewXstatusNotify/res/logging_status_message.ico
new file mode 100644
index 0000000000..269aeea58f
--- /dev/null
+++ b/plugins/NewXstatusNotify/res/logging_status_message.ico
Binary files differ
diff --git a/plugins/NewXstatusNotify/res/logging_xstatus.ico b/plugins/NewXstatusNotify/res/logging_xstatus.ico
new file mode 100644
index 0000000000..c6173dd9e2
--- /dev/null
+++ b/plugins/NewXstatusNotify/res/logging_xstatus.ico
Binary files differ
diff --git a/plugins/NewXstatusNotify/res/resource.rc b/plugins/NewXstatusNotify/res/resource.rc
index ac75fbf41e..76e89008ad 100644
--- a/plugins/NewXstatusNotify/res/resource.rc
+++ b/plugins/NewXstatusNotify/res/resource.rc
@@ -17,8 +17,7 @@
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-
+#pragma code_page(1250)
/////////////////////////////////////////////////////////////////////////////
//
@@ -26,43 +25,41 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
//
IDD_OPT_GENERAL DIALOGEX 0, 0, 300, 234
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Notify when a contact changes to one of these statuses",IDC_STATIC,4,1,292,72,WS_GROUP
- CONTROL "Online",IDC_CHK_ONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,14,89,10
- CONTROL "Offline",IDC_CHK_OFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,14,89,10
- CONTROL "Invisible",IDC_CHK_INVISIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,208,14,83,10
- CONTROL "Free for chat",IDC_CHK_FREECHAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,25,89,10
- CONTROL "Away",IDC_CHK_AWAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,25,89,10
- CONTROL "NA",IDC_CHK_NA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,208,25,83,10
- CONTROL "Occupied",IDC_CHK_OCCUPIED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,36,89,10
- CONTROL "DND",IDC_CHK_DND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,36,89,10
- CONTROL "Out to lunch",IDC_CHK_OUTTOLUNCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,208,36,83,10
- CONTROL "On the phone",IDC_CHK_ONTHEPHONE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,47,89,10
+ GROUPBOX "Notify when contact changes to one of these statuses",IDC_STATIC,3,3,294,58,WS_GROUP
+ CONTROL "Online",IDC_CHK_ONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,14,89,8
+ CONTROL "Offline",IDC_CHK_OFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,14,87,8
+ CONTROL "Invisible",IDC_CHK_INVISIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,14,94,8
+ CONTROL "Free for chat",IDC_CHK_FREECHAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,25,89,8
+ CONTROL "Away",IDC_CHK_AWAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,25,87,8
+ CONTROL "NA",IDC_CHK_NA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,25,94,8
+ CONTROL "Occupied",IDC_CHK_OCCUPIED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,36,89,8
+ CONTROL "DND",IDC_CHK_DND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,36,87,8
+ CONTROL "Out to lunch",IDC_CHK_OUTTOLUNCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,36,94,8
+ CONTROL "On the phone",IDC_CHK_ONTHEPHONE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,47,89,8
CONTROL "Always when changing from offline",IDC_CHK_FROMOFFLINE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,58,163,10
- GROUPBOX "Plugin activation",IDC_STATIC,4,76,292,82,WS_GROUP
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,47,187,8
+ GROUPBOX "Plugin activation",IDC_STATIC,3,92,294,80,WS_GROUP
CONTROL "Automatically turn off Popups and Sounds on status change",IDC_AUTODISABLE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,90,232,10
- PUSHBUTTON "Configure",IDC_CONFIGUREAUTODISABLE,242,88,46,14
- CONTROL "Notify me for people not in my Contact List",IDC_HIDDENCONTACTSTOO,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,103,278,10
- CONTROL "Blink icon in the system tray",IDC_BLINKICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,129,278,10
- CONTROL "Use status icon",IDC_BLINKICON_STATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,142,278,10
- CONTROL "Use individual sounds",IDC_USEINDIVSOUNDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,116,278,10
- GROUPBOX "Log to file",IDC_STATIC,4,161,292,28
- CONTROL "Enable",IDC_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,173,57,10
- CONTROL "Extra status",IDC_CHK_XSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,47,89,10
- EDITTEXT IDC_LOGFILE,72,170,154,14,ES_AUTOHSCROLL | ES_READONLY
- PUSHBUTTON "...",IDC_BT_CHOOSELOGFILE,229,170,18,14
- PUSHBUTTON "Open",IDC_BT_VIEWLOG,249,170,42,14
- CONTROL "Status message",IDC_CHK_STATUS_MESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,208,47,84,10
- GROUPBOX "Log in history",IDC_STATIC,4,190,292,38
- CONTROL "Log status changes in history",IDC_LOGTODB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,201,278,8
- CONTROL "Only when message window is open",IDC_CHECKMESSAGEWINDOW,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,213,270,11
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,103,228,10
+ PUSHBUTTON "Configure",IDC_CONFIGUREAUTODISABLE,242,101,46,14
+ CONTROL "Notify me for people not on my contact list",IDC_HIDDENCONTACTSTOO,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,114,228,10
+ CONTROL "Blink icon in the system tray",IDC_BLINKICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,136,280,10
+ CONTROL "Use status icon",IDC_BLINKICON_STATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,158,272,10
+ CONTROL "Use individual sounds",IDC_USEINDIVSOUNDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,125,280,10
+ GROUPBOX "Log to file",IDC_STATIC,3,175,294,34
+ CONTROL "Extra status",IDC_CHK_XSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,75,87,8
+ EDITTEXT IDC_LOGFILE,10,186,216,14,ES_AUTOHSCROLL | ES_READONLY
+ PUSHBUTTON "...",IDC_BT_CHOOSELOGFILE,229,186,18,14
+ PUSHBUTTON "Open",IDC_BT_VIEWLOG,249,186,41,14
+ CONTROL "Status message",IDC_CHK_STATUS_MESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,75,87,8
+ CONTROL "Also when extra status or status message changes",IDC_BLINKICON_FORMSGS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,147,272,10
+ GROUPBOX "Notify when contact changes",IDC_STATIC,3,64,294,25,WS_GROUP
END
IDD_INFO_SOUNDS DIALOGEX 0, 0, 222, 152
@@ -85,114 +82,129 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_INDSNDLIST,"CListControl",WS_TABSTOP | 0x1d0,5,6,290,185,WS_EX_CLIENTEDGE
- LTEXT "Sounds",IDC_STATIC,26,200,70,9
- LTEXT "Popups",IDC_STATIC,26,214,70,9
- ICON IDI_SOUND,IDC_SOUNDICON,8,196,16,16,SS_CENTERIMAGE
- ICON IDI_POPUP,IDC_POPUPICON,8,210,16,16,SS_CENTERIMAGE
- LTEXT "Extra status notify",IDC_STATIC,119,200,86,9
- LTEXT "Extra status logging",IDC_STATIC,119,214,86,9
- ICON IDI_XSTATUS,IDC_XSTATUSICON,101,196,16,16,SS_CENTERIMAGE
- ICON IDI_LOGGING,IDC_LOGGINGICON,101,210,16,16,SS_CENTERIMAGE
- LTEXT "Disable all",IDC_STATIC,229,200,60,9
- LTEXT "Enable all",IDC_STATIC,229,214,60,9
- ICON IDI_DISABLEALL,IDC_DISABLEALLICON,211,196,16,16,SS_CENTERIMAGE
- ICON IDI_ENABLEALL,IDC_ENABLEALLICON,211,210,16,16,SS_CENTERIMAGE
+ CONTROL "",IDC_INDSNDLIST,"CListControl",WS_TABSTOP | 0x1d0,5,5,290,170,WS_EX_CLIENTEDGE
+ ICON IDI_SOUND,IDC_SOUNDICON,8,178,21,20,SS_CENTERIMAGE
+ ICON IDI_POPUP,IDC_POPUPICON,109,178,21,20,SS_CENTERIMAGE
+ LTEXT "Sounds",IDC_STATIC,26,182,80,9
+ LTEXT "Popups",IDC_STATIC,127,182,80,9
+ ICON IDI_XSTATUS,IDC_XSTATUSICON,8,194,21,20,SS_CENTERIMAGE
+ ICON IDI_LOGGING_XSTATUS,IDC_XLOGGINGICON,109,194,21,20,SS_CENTERIMAGE
+ LTEXT "Extra status notify",IDC_STATIC,26,198,80,9
+ LTEXT "Extra status logging",IDC_STATIC,127,198,80,9
+ ICON IDI_DISABLEALL,IDC_DISABLEALLICON,211,178,21,20,SS_CENTERIMAGE
+ ICON IDI_ENABLEALL,IDC_ENABLEALLICON,211,194,21,20,SS_CENTERIMAGE
+ LTEXT "Disable all",IDC_STATIC,229,182,60,9
+ LTEXT "Enable all",IDC_STATIC,229,198,60,9
+ ICON IDI_STATUS_MESSAGE,IDC_SMSGICON,8,210,20,20,SS_CENTERIMAGE
+ ICON IDI_LOGGING_SMSG,IDC_SMSGLOGGINGICON,109,210,20,20,SS_CENTERIMAGE
+ LTEXT "Status message notify",IDC_STATIC,26,214,80,9
+ LTEXT "Status message logging",IDC_STATIC,127,214,80,9
END
IDD_OPT_POPUP DIALOGEX 0, 0, 309, 233
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CTEXT "Background",IDC_STATIC,64,11,44,8
- CTEXT "Text",IDC_STATIC,107,11,24,8
- CONTROL "",IDC_OFFLINE_BG,"ColourPicker",WS_TABSTOP,73,22,24,12
- CONTROL "",IDC_OFFLINE_TX,"ColourPicker",WS_TABSTOP,106,22,24,12
- CONTROL "",IDC_ONLINE_BG,"ColourPicker",WS_TABSTOP,73,38,24,12
- CONTROL "",IDC_ONLINE_TX,"ColourPicker",WS_TABSTOP,106,38,24,12
- CONTROL "",IDC_AWAY_BG,"ColourPicker",WS_TABSTOP,73,54,24,12
- CONTROL "",IDC_AWAY_TX,"ColourPicker",WS_TABSTOP,106,54,24,12
- CONTROL "",IDC_NA_BG,"ColourPicker",WS_TABSTOP,73,70,24,12
- CONTROL "",IDC_NA_TX,"ColourPicker",WS_TABSTOP,106,70,24,12
+ CTEXT "Background",IDC_STATIC,64,13,44,8
+ CTEXT "Text",IDC_STATIC,107,13,24,8
+ CONTROL "",IDC_OFFLINE_BG,"ColourPicker",WS_TABSTOP,73,26,24,12
+ CONTROL "",IDC_OFFLINE_TX,"ColourPicker",WS_TABSTOP,106,26,24,12
+ CONTROL "",IDC_ONLINE_BG,"ColourPicker",WS_TABSTOP,73,41,24,12
+ CONTROL "",IDC_ONLINE_TX,"ColourPicker",WS_TABSTOP,106,41,24,12
+ CONTROL "",IDC_AWAY_BG,"ColourPicker",WS_TABSTOP,73,56,24,12
+ CONTROL "",IDC_AWAY_TX,"ColourPicker",WS_TABSTOP,106,56,24,12
+ CONTROL "",IDC_NA_BG,"ColourPicker",WS_TABSTOP,73,71,24,12
+ CONTROL "",IDC_NA_TX,"ColourPicker",WS_TABSTOP,106,71,24,12
CONTROL "",IDC_OCCUPIED_BG,"ColourPicker",WS_TABSTOP,73,86,24,12
CONTROL "",IDC_OCCUPIED_TX,"ColourPicker",WS_TABSTOP,106,86,24,12
- CONTROL "",IDC_DND_BG,"ColourPicker",WS_TABSTOP,73,102,24,12
- CONTROL "",IDC_DND_TX,"ColourPicker",WS_TABSTOP,106,102,24,12
- CONTROL "",IDC_FREEFORCHAT_BG,"ColourPicker",WS_TABSTOP,73,118,24,12
- CONTROL "",IDC_FREEFORCHAT_TX,"ColourPicker",WS_TABSTOP,106,118,24,12
- CONTROL "",IDC_INVISIBLE_BG,"ColourPicker",WS_TABSTOP,73,134,24,12
- CONTROL "",IDC_INVISIBLE_TX,"ColourPicker",WS_TABSTOP,106,134,24,12
- CONTROL "",IDC_OUTTOLUNCH_BG,"ColourPicker",WS_TABSTOP,73,150,24,12
- CONTROL "",IDC_OUTTOLUNCH_TX,"ColourPicker",WS_TABSTOP,106,150,24,12
- CONTROL "",IDC_ONTHEPHONE_BG,"ColourPicker",WS_TABSTOP,73,166,24,12
- CONTROL "",IDC_ONTHEPHONE_TX,"ColourPicker",WS_TABSTOP,106,166,24,12
- GROUPBOX "Colors",IDC_STATIC,143,0,164,44,WS_GROUP
- CONTROL "Use custom colors",IDC_USEOWNCOLORS,"Button",BS_AUTORADIOBUTTON | BS_MULTILINE | BS_NOTIFY,149,8,151,13
- CONTROL "Use Windows colors",IDC_USEWINCOLORS,"Button",BS_AUTORADIOBUTTON | BS_MULTILINE | BS_NOTIFY,149,30,151,13
- CONTROL "Use Popup colors",IDC_USEPOPUPCOLORS,"Button",BS_AUTORADIOBUTTON | BS_MULTILINE | BS_NOTIFY,149,19,151,13
- GROUPBOX "Popup text",IDC_STATIC,144,44,164,85,WS_GROUP
- CONTROL "Read status message",IDC_READAWAYMSG,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,148,102,151,13
- CONTROL "Show previous status too",IDC_SHOWPREVIOUSSTATUS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,148,90,151,13
- GROUPBOX "Timeout",IDC_STATIC,143,129,164,42
- EDITTEXT IDC_TIMEOUT_VALUE,159,138,32,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_TIMEOUT_VALUE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,180,138,11,12
- PUSHBUTTON "Preview",IDC_PREVIEW,43,206,57,15
- GROUPBOX "Popups when status changes to:",IDC_STATIC,1,0,138,200,WS_GROUP
- GROUPBOX "Click action",IDC_STATIC,143,172,164,59,WS_GROUP
- CONTROL "Show contact group name",IDC_SHOWGROUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,56,151,9
- CONTROL "Use alternative descriptions",IDC_SHOWALTDESCS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,78,151,13
- CTEXT "0 = Default",IDC_STATIC,224,135,76,8
- CTEXT "-1 = Infinite",IDC_STATIC,222,145,76,8
- LTEXT "Sec",IDC_STATIC,196,139,21,8
- COMBOBOX IDC_STATUS_LC,150,190,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_STATUS_RC,150,215,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "On left click",IDC_STATIC,152,180,151,8
- LTEXT "On right click",IDC_STATIC,152,205,151,8
- CONTROL "",IDC_XSTATUS_TX,"ColourPicker",WS_TABSTOP,106,182,24,12
- CONTROL "",IDC_XSTATUS_BG,"ColourPicker",WS_TABSTOP,73,182,24,12
- LTEXT "Offline",IDC_STATIC,6,24,56,8
- LTEXT "Online",IDC_STATIC,6,40,56,8
- LTEXT "Away",IDC_STATIC,6,56,56,8
- LTEXT "NA",IDC_STATIC,6,72,56,8
- LTEXT "Occupied",IDC_STATIC,6,88,56,8
- LTEXT "DND",IDC_STATIC,6,104,56,8
- LTEXT "Free for chat",IDC_STATIC,6,120,56,8
- LTEXT "Invisible",IDC_STATIC,6,136,56,8
- LTEXT "Out to lunch",IDC_STATIC,6,152,56,8
- LTEXT "On the phone",IDC_STATIC,6,168,56,8
- LTEXT "Extra status",IDC_STATIC,6,184,56,8
- CONTROL "Show status description",IDC_SHOWSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,66,151,13
- CONTROL "Ignore empty status and xStatus messages",IDC_PUIGNOREREMOVE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,117,152,8
- EDITTEXT IDC_CONNECTIONTIMEOUT_VALUE,159,154,32,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_CONNECTIONTIMEOUT_VALUE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,179,154,11,12
- LTEXT "Sec",IDC_STATIC,195,156,21,8
- LTEXT "Connection timeout",IDC_STATIC,222,156,79,8
+ CONTROL "",IDC_DND_BG,"ColourPicker",WS_TABSTOP,73,101,24,12
+ CONTROL "",IDC_DND_TX,"ColourPicker",WS_TABSTOP,106,101,24,12
+ CONTROL "",IDC_FREEFORCHAT_BG,"ColourPicker",WS_TABSTOP,73,116,24,12
+ CONTROL "",IDC_FREEFORCHAT_TX,"ColourPicker",WS_TABSTOP,106,116,24,12
+ CONTROL "",IDC_INVISIBLE_BG,"ColourPicker",WS_TABSTOP,73,131,24,12
+ CONTROL "",IDC_INVISIBLE_TX,"ColourPicker",WS_TABSTOP,106,131,24,12
+ CONTROL "",IDC_OUTTOLUNCH_BG,"ColourPicker",WS_TABSTOP,73,146,24,12
+ CONTROL "",IDC_OUTTOLUNCH_TX,"ColourPicker",WS_TABSTOP,106,146,24,12
+ CONTROL "",IDC_ONTHEPHONE_BG,"ColourPicker",WS_TABSTOP,73,161,24,12
+ CONTROL "",IDC_ONTHEPHONE_TX,"ColourPicker",WS_TABSTOP,106,161,24,12
+ GROUPBOX "Colors",IDC_STATIC,144,3,162,42,WS_GROUP
+ CONTROL "Use custom colors",IDC_USEOWNCOLORS,"Button",BS_AUTORADIOBUTTON | BS_MULTILINE | BS_NOTIFY,151,13,148,8
+ CONTROL "Use Windows colors",IDC_USEWINCOLORS,"Button",BS_AUTORADIOBUTTON | BS_MULTILINE | BS_NOTIFY,151,33,148,8
+ CONTROL "Use Popup colors",IDC_USEPOPUPCOLORS,"Button",BS_AUTORADIOBUTTON | BS_MULTILINE | BS_NOTIFY,151,23,148,8
+ GROUPBOX "Popup text",IDC_STATIC,144,45,162,72,WS_GROUP
+ CONTROL "Read status message",IDC_READAWAYMSG,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,151,105,148,8
+ CONTROL "Show previous status too",IDC_SHOWPREVIOUSSTATUS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,160,93,139,8
+ GROUPBOX "Timeout",IDC_STATIC,144,117,162,48
+ EDITTEXT IDC_TIMEOUT_VALUE,151,129,32,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_TIMEOUT_VALUE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,174,131,11,12
+ PUSHBUTTON "Preview",IDC_PREVIEW,41,214,60,16
+ GROUPBOX "Popups when status changes to:",IDC_STATIC,3,3,136,208,WS_GROUP
+ GROUPBOX "Click action",IDC_STATIC,144,165,162,65,WS_GROUP
+ CONTROL "Show contact group name",IDC_SHOWGROUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,151,57,148,8
+ CONTROL "Use alternative descriptions",IDC_SHOWALTDESCS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,81,139,8
+ CTEXT "0 = Default",IDC_STATIC,217,130,82,8
+ CTEXT "-1 = Infinite",IDC_STATIC,217,140,82,8
+ LTEXT "Sec",IDC_STATIC,188,132,29,8
+ COMBOBOX IDC_STATUS_LC,151,185,148,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_STATUS_RC,151,211,148,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "On left click",IDC_STATIC,151,175,148,8
+ LTEXT "On right click",IDC_STATIC,151,201,148,8
+ CONTROL "",IDC_XSTATUS_TX,"ColourPicker",WS_TABSTOP,106,176,24,12
+ CONTROL "",IDC_XSTATUS_BG,"ColourPicker",WS_TABSTOP,73,176,24,12
+ LTEXT "Offline",IDC_STATIC,10,28,56,8
+ LTEXT "Online",IDC_STATIC,10,43,56,8
+ LTEXT "Away",IDC_STATIC,10,58,56,8
+ LTEXT "NA",IDC_STATIC,10,73,56,8
+ LTEXT "Occupied",IDC_STATIC,10,88,56,8
+ LTEXT "DND",IDC_STATIC,10,103,56,8
+ LTEXT "Free for chat",IDC_STATIC,10,118,56,8
+ LTEXT "Invisible",IDC_STATIC,10,133,56,8
+ LTEXT "Out to lunch",IDC_STATIC,10,148,56,8
+ LTEXT "On the phone",IDC_STATIC,10,163,56,8
+ LTEXT "Extra status",IDC_STATIC,10,178,56,8
+ CONTROL "Show status description",IDC_SHOWSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,151,69,148,8
+ EDITTEXT IDC_CONNECTIONTIMEOUT_VALUE,151,147,32,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_CONNECTIONTIMEOUT_VALUE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,173,148,11,12
+ LTEXT "Sec",IDC_STATIC,188,150,29,8
+ LTEXT "Connection timeout",IDC_STATIC,217,150,82,8
+ LTEXT "Status message",IDC_STATIC,10,193,56,8
+ CONTROL "",IDC_STATUSMSG_BG,"ColourPicker",WS_TABSTOP,73,191,24,12
+ CONTROL "",IDC_STATUSMSG_TX,"ColourPicker",WS_TABSTOP,106,191,24,12
END
IDD_OPT_XPOPUP DIALOGEX 0, 0, 305, 230
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_CHILD
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- GROUPBOX "Notification",IDC_STATIC,5,6,292,45
+ GROUPBOX "Notification",IDC_STATIC,3,6,299,50
CONTROL "Disable for extra status 'Music'",IDC_CHK_DISABLEMUSIC,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,19,276,10
- CONTROL "Truncate message length to:",IDC_CHK_CUTMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,34,137,10
- EDITTEXT IDC_ED_MSGLEN,153,33,34,12,ES_AUTOHSCROLL
- CONTROL "",IDC_UD_MSGLEN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,179,30,11,14
- LTEXT "characters",IDC_STATIC,191,35,85,8
- GROUPBOX "Templates",IDC_STATIC,5,55,292,89
- EDITTEXT IDC_ED_TCHANGE,89,70,202,12,ES_AUTOHSCROLL
- EDITTEXT IDC_ED_TCHANGEMSG,89,87,202,12,ES_AUTOHSCROLL
- EDITTEXT IDC_ED_TREMOVE,89,104,202,12,ES_AUTOHSCROLL
- EDITTEXT IDC_ED_TDELIMITER,259,121,32,12,ES_AUTOHSCROLL
- RTEXT "Title - text delimiter:",IDC_STATIC,89,123,167,8
- CONTROL "Remove:",IDC_CHK_REMOVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,106,73,10
- CONTROL "New message:",IDC_CHK_MSGCHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,88,73,10
- CONTROL "New status:",IDC_CHK_XSTATUSCHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,70,73,10
- CONTROL "Variables",IDC_BT_VARIABLES,"MButtonClass",WS_TABSTOP,11,123,16,14
- CONTROL "Reset",IDC_BT_RESET,"MButtonClass",WS_TABSTOP,29,123,16,14
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,30,285,8
+ CONTROL "Truncate message length to:",IDC_CHK_CUTMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,42,140,8
+ EDITTEXT IDC_ED_MSGLEN,153,38,34,14,ES_AUTOHSCROLL
+ CONTROL "",IDC_UD_MSGLEN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,176,38,11,14
+ LTEXT "characters",IDC_STATIC,191,42,104,8
+ GROUPBOX "Templates",IDC_STATIC,3,60,299,161
+ EDITTEXT IDC_ED_TCHANGE,74,87,221,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_ED_TCHANGEMSG,74,147,221,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_ED_TREMOVE,74,117,221,12,ES_AUTOHSCROLL
+ LTEXT "Template:",IDC_STATIC,22,87,45,8
+ CONTROL "Notify when contact removes extra status",IDC_CHK_REMOVE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,105,285,8
+ CONTROL "Notify when contact changes extra status message",IDC_CHK_MSGCHANGE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,135,285,8
+ CONTROL "Notify when contact changes extra status",IDC_CHK_XSTATUSCHANGE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,75,285,8
+ CONTROL "Variables",IDC_BT_VARIABLES,"MButtonClass",WS_TABSTOP,10,199,16,14
+ CONTROL "Reset",IDC_BT_RESET,"MButtonClass",WS_TABSTOP,29,199,16,14
+ LTEXT "Template:",IDC_STATIC,22,117,45,8
+ LTEXT "Template:",IDC_STATIC,22,147,45,8
+ CONTROL "Notify when contact removes extra status message",IDC_CHK_MSGREMOVE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,165,285,8
+ LTEXT "Template:",IDC_STATIC,22,177,45,8
+ EDITTEXT IDC_ED_TREMOVEMSG,74,177,221,12,ES_AUTOHSCROLL
+ CONTROL "Show Popups when I connect",IDC_XONCONNECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,18,285,8
END
IDD_AUTODISABLE DIALOGEX 0, 0, 286, 192
@@ -231,49 +243,109 @@ BEGIN
LTEXT "Disable when my status is:",IDC_STATIC,157,36,116,8
END
-IDD_OPT_XLOG DIALOGEX 0, 0, 305, 230
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_CHILD
+IDD_OPT_XLOG DIALOGEX 0, 0, 300, 234
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- GROUPBOX "Extra status log",65534,5,6,294,83
- CONTROL "Enable logging extra status to message window",IDC_CHK_LOGGING,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,19,276,10
- CONTROL "Keep events in history",IDC_CHK_SAVETOHISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,45,276,10
- CONTROL "Prevent identical logs",IDC_CHK_PREVENTIDENTICAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,32,276,10
+ GROUPBOX "Log extra status changes",65534,3,3,294,69
+ CONTROL "Log extra status changes to file",IDC_XLOGTOFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,14,280,8
+ CONTROL "Only when message window is open",IDC_XLOGTODB_WINOPEN,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,36,272,8
+ CONTROL "Log extra status changes to history",IDC_XLOGTODB,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,25,280,8
CONTROL "Disable for extra status 'Music'",IDC_CHK_DISABLEMUSIC,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,276,10
- CONTROL "Truncate message length to:",IDC_CHK_CUTMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,71,133,10
- EDITTEXT IDC_ED_MSGLEN,150,70,34,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_UD_MSGLEN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,175,70,11,14
- LTEXT "characters",IDC_STATIC,188,73,84,8
- GROUPBOX "Templates",IDC_STATIC,5,94,294,107
- EDITTEXT IDC_ED_TCHANGE,89,107,202,12,ES_AUTOHSCROLL
- EDITTEXT IDC_ED_TOPENING,89,161,202,12,ES_AUTOHSCROLL
- EDITTEXT IDC_ED_TCHANGEMSG,89,125,202,12,ES_AUTOHSCROLL
- EDITTEXT IDC_ED_TREMOVE,89,143,202,12,ES_AUTOHSCROLL
- EDITTEXT IDC_ED_TDELIMITER,259,180,32,12,ES_AUTOHSCROLL
- RTEXT "Title - text delimiter:",IDC_STATIC,89,182,167,8
- CONTROL "Remove:",IDC_CHK_REMOVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,144,73,10
- CONTROL "New message:",IDC_CHK_MSGCHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,126,73,10
- CONTROL "New status:",IDC_CHK_XSTATUSCHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,108,73,10
- CONTROL "On opening ML:",IDC_CHK_OPENING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,162,73,10
- CONTROL "Variables",IDC_BT_VARIABLES,"MButtonClass",WS_TABSTOP,11,180,16,14
- CONTROL "Reset",IDC_BT_RESET,"MButtonClass",WS_TABSTOP,29,180,16,14
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,58,280,8
+ CONTROL "Remove events from history when closing message window",IDC_XLOGTODB_REMOVE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,47,264,10
+ GROUPBOX "Templates",IDC_STATIC,3,75,294,156
+ EDITTEXT IDC_ED_TXSTATUSCHANGED,74,96,216,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_ED_TXSTATUSOPENING,74,192,216,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_ED_TMSGCHANGED,74,144,216,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_ED_TXSTATUSREMOVED,74,120,216,12,ES_AUTOHSCROLL
+ CONTROL "Log when contact removes extra status",IDC_CHK_XSTATUSREMOVED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,110,280,8
+ CONTROL "Log when contact changes extra status message",IDC_CHK_MSGCHANGED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,134,280,8
+ CONTROL "Log when contact changes extra status",IDC_CHK_XSTATUSCHANGED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,86,280,8
+ CONTROL "Log extra status when opening message window",IDC_CHK_XSTATUSOPENING,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,182,280,8
+ CONTROL "Variables",IDC_BT_VARIABLES,"MButtonClass",WS_TABSTOP,10,212,16,14
+ CONTROL "Reset",IDC_BT_RESET,"MButtonClass",WS_TABSTOP,29,212,16,14
+ LTEXT "Template:",IDC_STATIC,18,98,50,8
+ LTEXT "Template:",IDC_STATIC,18,122,50,8
+ LTEXT "Template:",IDC_STATIC,18,146,50,8
+ LTEXT "Template:",IDC_STATIC,18,194,50,8
+ CONTROL "Log when contact removes extra status message",IDC_CHK_MSGREMOVED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,158,280,8
+ LTEXT "Template:",IDC_STATIC,18,170,50,8
+ EDITTEXT IDC_ED_TMSGREMOVED,74,168,216,12,ES_AUTOHSCROLL
+END
+
+IDD_OPT_SMPOPUP DIALOGEX 0, 0, 300, 234
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "General",IDC_STATIC,3,3,294,35
+ CONTROL "Show Popups when I connect",IDC_ONCONNECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,13,280,8
+ GROUPBOX "Accounts",IDC_STATIC,3,40,294,106
+ CTEXT "Enable/Disable accounts which you don't wish to be notified for:",IDC_STATIC,10,50,280,10
+ CONTROL "",IDC_PROTOCOLLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,50,60,201,80
+ GROUPBOX "Templates",IDC_STATIC,3,148,294,83
+ EDITTEXT IDC_ED_TNEWSMSG,74,170,216,12,ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_STATICEDGE
+ CONTROL "Variables",IDC_BT_VARIABLES,"MButtonClass",WS_TABSTOP,10,211,16,14
+ CONTROL "Reset",IDC_BT_RESET,"MButtonClass",WS_TABSTOP,29,211,16,14
+ CONTROL "Notify when contact changes status message",IDC_CHK_NEWSMSG,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,160,280,8
+ CONTROL "Notify when contact removes status message",IDC_CHK_SMSGREMOVE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,184,280,8
+ EDITTEXT IDC_ED_TSMSGREMOVE,74,194,216,12,ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_STATICEDGE
+ CONTROL "Truncate message length to:",IDC_CHK_CUTSMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,25,131,8
+ EDITTEXT IDC_ED_SMSGLEN,152,21,34,14,ES_AUTOHSCROLL
+ CONTROL "",IDC_UD_SMSGLEN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,174,20,11,14
+ LTEXT "characters",IDC_STATIC,191,25,99,8
+ LTEXT "Template:",IDC_STATIC,18,172,49,8
+ LTEXT "Template:",IDC_STATIC,18,196,49,8
END
-IDD_OPT_SMPOPUP DIALOGEX 0, 0, 305, 226
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_CHILD
+IDD_OPT_LOG DIALOGEX 0, 0, 300, 234
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- GROUPBOX "General",IDC_STATIC,7,0,289,27
- CONTROL "Show Popups when I connect",IDC_ONCONNECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,11,274,8
- GROUPBOX "Accounts",IDC_STATIC,7,41,289,124
- CTEXT "Enable/Disable accounts which you don't wish to be notified for:",IDC_STATIC,14,52,274,10
- CONTROL "",IDC_PROTOCOLLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,51,66,201,90
- GROUPBOX "Text",IDC_STATIC,7,170,289,38
- EDITTEXT IDC_POPUPTEXT,14,182,222,20,ES_MULTILINE | ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_STATICEDGE
- CONTROL "Variables",IDC_BT_VARIABLES,"MButtonClass",WS_TABSTOP,241,185,16,14
- CONTROL "Reset",IDC_BT_RESET,"MButtonClass",WS_TABSTOP,262,185,16,14
+ GROUPBOX "Log status changes",IDC_STATIC,3,3,294,69
+ CONTROL "Log status changes to file",IDC_LOGTOFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,14,280,8
+ CONTROL "Log status changes to history",IDC_LOGTODB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,25,280,8
+ CONTROL "Only when message window is open",IDC_LOGTODB_WINOPEN,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,36,272,8
+ CONTROL "Remove events from history when closing message window",IDC_LOGTODB_REMOVE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,47,264,8
+ CONTROL "Log previous status too",IDC_LOGPREVIOUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,58,280,8
+ GROUPBOX "Log status message changes",IDC_STATIC,3,75,294,151
+ CONTROL "Log status message changes to file",IDC_SMSGLOGTOFILE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,86,280,8
+ CONTROL "Log status message changes to history",IDC_SMSGLOGTODB,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,97,280,8
+ CONTROL "Only when message window is open",IDC_SMSGLOGTODB_WINOPEN,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,108,272,8
+ CONTROL "Remove events from history when closing message window",IDC_SMSGLOGTODB_REMOVE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,119,264,8
+ EDITTEXT IDC_LOG_TSMSGCHANGED,74,140,216,12,ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_STATICEDGE
+ CONTROL "Variables",IDC_BT_VARIABLES,"MButtonClass",WS_TABSTOP,10,206,16,14
+ CONTROL "Reset",IDC_BT_RESET,"MButtonClass",WS_TABSTOP,29,206,16,14
+ CONTROL "Log when contact changes status message",IDC_LOG_SMSGCHANGED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,130,280,8
+ CONTROL "Log when contact removes status message",IDC_LOG_SMSGREMOVED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,154,280,8
+ EDITTEXT IDC_LOG_TSMSGREMOVED,74,164,216,12,ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_STATICEDGE
+ LTEXT "Template:",IDC_STATIC,18,142,50,8
+ LTEXT "Template:",IDC_STATIC,18,166,50,8
+ CONTROL "Log status message when opening message window",IDC_LOG_SMSGOPENING,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,178,280,8
+ EDITTEXT IDC_LOG_TSMSGOPENING,74,188,216,12,ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_STATICEDGE
+ LTEXT "Template:",IDC_STATIC,18,190,50,8
END
@@ -286,7 +358,6 @@ END
// remains consistent on all systems.
IDI_RESET ICON "reset.ico"
IDI_POPUP ICON "popup.ico"
-IDI_LOGGING ICON "logging.ico"
IDI_SOUND ICON "sound.ico"
IDI_NOTIFICATION_OFF ICON "main_off.ico"
IDI_NOTIFICATION_ON ICON "main_on.ico"
@@ -295,6 +366,8 @@ IDI_DISABLEALL ICON "disable_all.ico"
IDI_ENABLEALL ICON "enable_all.ico"
IDI_VARIABLES ICON "variables.ico"
IDI_STATUS_MESSAGE ICON "status_message.ico"
+IDI_LOGGING_XSTATUS ICON "logging_xstatus.ico"
+IDI_LOGGING_SMSG ICON "logging_status_message.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -321,6 +394,107 @@ END
#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPT_GENERAL, DIALOG
+ BEGIN
+ LEFTMARGIN, 3
+ RIGHTMARGIN, 297
+ VERTGUIDE, 10
+ VERTGUIDE, 18
+ VERTGUIDE, 97
+ VERTGUIDE, 103
+ VERTGUIDE, 190
+ VERTGUIDE, 196
+ VERTGUIDE, 238
+ VERTGUIDE, 290
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 231
+ END
+
+ IDD_INFO_SOUNDS, DIALOG
+ BEGIN
+ END
+
+ IDD_OPT_FILTERS, DIALOG
+ BEGIN
+ END
+
+ IDD_OPT_POPUP, DIALOG
+ BEGIN
+ LEFTMARGIN, 3
+ RIGHTMARGIN, 306
+ VERTGUIDE, 10
+ VERTGUIDE, 66
+ VERTGUIDE, 144
+ VERTGUIDE, 151
+ VERTGUIDE, 160
+ VERTGUIDE, 217
+ VERTGUIDE, 299
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 230
+ END
+
+ IDD_OPT_XPOPUP, DIALOG
+ BEGIN
+ LEFTMARGIN, 3
+ RIGHTMARGIN, 302
+ VERTGUIDE, 10
+ VERTGUIDE, 74
+ VERTGUIDE, 295
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 227
+ END
+
+ IDD_OPT_XLOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 3
+ RIGHTMARGIN, 297
+ VERTGUIDE, 10
+ VERTGUIDE, 18
+ VERTGUIDE, 26
+ VERTGUIDE, 74
+ VERTGUIDE, 290
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 231
+ END
+
+ IDD_OPT_SMPOPUP, DIALOG
+ BEGIN
+ LEFTMARGIN, 3
+ RIGHTMARGIN, 297
+ VERTGUIDE, 10
+ VERTGUIDE, 18
+ VERTGUIDE, 74
+ VERTGUIDE, 150
+ VERTGUIDE, 191
+ VERTGUIDE, 290
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 231
+ END
+
+ IDD_OPT_LOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 3
+ RIGHTMARGIN, 297
+ VERTGUIDE, 10
+ VERTGUIDE, 18
+ VERTGUIDE, 26
+ VERTGUIDE, 74
+ VERTGUIDE, 290
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 231
+ END
+END
+#endif // APSTUDIO_INVOKED
+
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/NewXstatusNotify/src/common.h b/plugins/NewXstatusNotify/src/common.h
index bd83b6b609..981f91e750 100644
--- a/plugins/NewXstatusNotify/src/common.h
+++ b/plugins/NewXstatusNotify/src/common.h
@@ -80,27 +80,38 @@
#define GENDER_MALE 1
#define GENDER_FEMALE 2
-#define ID_STATUS_FROMOFFLINE 1
-#define ID_STATUS_EXTRASTATUS 40081
-#define ID_STATUS_MIN ID_STATUS_OFFLINE
-#define ID_STATUS_MAX ID_STATUS_OUTTOLUNCH
-#define ID_STATUS_MAX2 ID_STATUS_EXTRASTATUS + 1
-#define STATUS_COUNT ID_STATUS_MAX2 - ID_STATUS_MIN
-#define Index(ID_STATUS) ID_STATUS - ID_STATUS_OFFLINE
+#define ID_STATUS_FROMOFFLINE 0
+#define ID_STATUS_SMSGREMOVED 1
+#define ID_STATUS_SMSGCHANGED 2
+#define ID_STATUS_XREMOVED 3
+#define ID_STATUS_XCHANGED 4
+#define ID_STATUS_XMSGCHANGED 5
+#define ID_STATUS_XMSGREMOVED 6
+#define ID_STATUSEX_MAX 6
+#define STATUSEX_COUNT ID_STATUSEX_MAX + 1
+#define ID_STATUS_EXTRASTATUS 40081
+#define ID_STATUS_STATUSMSG 40082
+#define ID_STATUS_MIN ID_STATUS_OFFLINE
+#define ID_STATUS_MAX ID_STATUS_OUTTOLUNCH
+#define ID_STATUS_MAX2 ID_STATUS_STATUSMSG
+#define STATUS_COUNT ID_STATUS_MAX2 - ID_STATUS_MIN + 1
+#define Index(ID_STATUS) ID_STATUS - ID_STATUS_OFFLINE
#define COLOR_BG_AVAILDEFAULT RGB(173,206,247)
-#define COLOR_BG_NAVAILDEFAULT RGB(255,189,189)
+#define COLOR_BG_NAVAILDEFAULT RGB(255,189,189)
#define COLOR_TX_DEFAULT RGB(0,0,0)
-#define ICO_NOTIFICATION_OFF "notification_off"
-#define ICO_NOTIFICATION_ON "notification_on"
+#define ICO_NOTIFICATION_OFF "notification_off"
+#define ICO_NOTIFICATION_ON "notification_on"
-#define JS_PARSE_XMPP_URI "/ParseXmppURI"
+#define JS_PARSE_XMPP_URI "/ParseXmppURI"
+
+#define COMPARE_SAME 0
+#define COMPARE_DIFF 1
+#define COMPARE_DEL 2
typedef struct tagSTATUS
{
- int ID;
- int icon;
TCHAR lpzMStatusText[MAX_STATUSTEXT];
TCHAR lpzFStatusText[MAX_STATUSTEXT];
TCHAR lpzUStatusText[MAX_STATUSTEXT];
@@ -112,18 +123,8 @@ typedef struct tagSTATUS
COLORREF colorText;
} STATUS;
-typedef struct tagPLUGINDATA
-{
- WORD newStatus;
- WORD oldStatus;
- HWND hWnd;
- HANDLE hAwayMsgProcess;
- HANDLE hAwayMsgHook;
-} PLUGINDATA;
-
typedef struct {
MCONTACT hContact;
- TCHAR *cust;
TCHAR *oldstatusmsg;
TCHAR *newstatusmsg;
char *proto;
@@ -143,11 +144,17 @@ Cast them to (int) if you need them that way.
#define MS_STATUSCHANGE_MENUCOMMAND "NewStatusNotify/EnableDisableMenuCommand"
extern OPTIONS opt;
-extern LIST<DBEVENT> eventList;
+extern LIST<DBEVENT> eventListXStatus;
+extern LIST<DBEVENT> eventListStatus;
+extern LIST<DBEVENT> eventListSMsg;
extern TEMPLATES templates;
extern HINSTANCE hInst;
extern HGENMENU hEnableDisableMenu;
extern STATUS StatusList[STATUS_COUNT];
+extern STATUS StatusListEx[STATUSEX_COUNT];
-bool CheckMsgWnd(MCONTACT hContact);
+TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt);
+void LogSMsgToDB(STATUSMSGINFO *smi, const TCHAR *tmplt);
+void BlinkIcon(MCONTACT hContact, char *szProto, HICON hIcon, TCHAR *stzText);
+void PlayChangeSound(MCONTACT hContact, const char *name);
#endif //COMMON_H
diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp
index b1776c9898..1d00167947 100644
--- a/plugins/NewXstatusNotify/src/indsnd.cpp
+++ b/plugins/NewXstatusNotify/src/indsnd.cpp
@@ -33,15 +33,13 @@ void PreviewSound(HWND hList)
int hlpStatus = lvi.lParam;
ListView_GetItemText(hList, lvi.iItem, 1, buff, SIZEOF(buff));
- if (_tcscmp(buff, TranslateT(DEFAULT_SOUND)) == 0)
- {
- if (hlpStatus == ID_STATUS_FROMOFFLINE)
- SkinPlaySound("UserFromOffline");
- else
+ if (_tcscmp(buff, TranslateT(DEFAULT_SOUND)) == 0) {
+ if (hlpStatus < ID_STATUS_MIN)
+ SkinPlaySound(StatusListEx[hlpStatus].lpzSkinSoundName);
+ else
SkinPlaySound(StatusList[Index(hlpStatus)].lpzSkinSoundName);
}
- else
- {
+ else {
PathToAbsoluteT(buff, stzSoundPath);
SkinPlaySoundFile(stzSoundPath);
}
@@ -50,8 +48,7 @@ void PreviewSound(HWND hList)
BOOL RemoveSoundFromList(HWND hList)
{
int iSel = ListView_GetSelectionMark(hList);
- if (iSel != -1)
- {
+ if (iSel != -1) {
iSel = -1;
while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1)
ListView_SetItemText(hList, iSel, 1, TranslateT(DEFAULT_SOUND));
@@ -61,12 +58,14 @@ BOOL RemoveSoundFromList(HWND hList)
return FALSE;
}
-TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff)
+TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff)
{
OPENFILENAME ofn = {0};
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
- ListView_GetItemText(hList, ListView_GetNextItem(hList,- 1, LVNI_SELECTED), 1, buff, SIZEOF(buff));
+ ListView_GetItemText(hList, ListView_GetNextItem(hList, -1, LVNI_SELECTED), 1, buff, SIZEOF(buff));
+ if (_tcscmp(buff, TranslateT(DEFAULT_SOUND)) == 0)
+ buff = NULL;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = GetParent(hwndDlg);
@@ -88,16 +87,14 @@ TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff)
return NULL;
}
-HIMAGELIST GetStatusIconsImgList(char *szProto)
+HIMAGELIST GetStatusIconsImgList(char *szProto)
{
HIMAGELIST hList = NULL;
- if (szProto)
- {
- hList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, STATUS_COUNT, 0);
- if (hList != NULL)
- {
+ if (szProto) {
+ hList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, STATUS_COUNT - 1, 0);
+ if (hList != NULL) {
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
- ImageList_AddIcon(hList, LoadSkinnedProtoIcon(szProto, StatusList[Index(i)].ID));
+ ImageList_AddIcon(hList, LoadSkinnedProtoIcon(szProto, i));
ImageList_AddIcon(hList, LoadSkinnedIcon(SKINICON_OTHER_USERONLINE));
}
}
@@ -105,7 +102,7 @@ HIMAGELIST GetStatusIconsImgList(char *szProto)
return hList;
}
-INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static MCONTACT hContact = NULL;
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
@@ -120,17 +117,17 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ListView_SetImageList(hList, GetStatusIconsImgList(szProto), LVSIL_SMALL);
ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);
- RECT rc = { 0 };
+ RECT rc = {0};
GetClientRect(hList, &rc);
- LV_COLUMN lvc = { 0 };
+ LV_COLUMN lvc = {0};
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
lvc.cx = STATUS_COLUMN;
lvc.pszText = TranslateT("Status");
ListView_InsertColumn(hList, 0, &lvc);
lvc.cx = rc.right - STATUS_COLUMN - GetSystemMetrics(SM_CXVSCROLL);
- lvc.pszText = TranslateT("Sound for the status");
+ lvc.pszText = TranslateT("Sound file");
ListView_InsertColumn(hList, 1, &lvc);
if (szProto) {
@@ -143,13 +140,13 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
flags = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
if ((flags & Proto_Status2Flag(i)) || i == ID_STATUS_OFFLINE) {
- LV_ITEM lvi = { 0 };
+ LV_ITEM lvi = {0};
lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
lvi.iItem = 0;
lvi.iSubItem = 0;
lvi.iImage = Index(i);
lvi.lParam = (LPARAM)i;
- lvi.pszText = TranslateTS(StatusList[Index(i)].lpzStandardText);
+ lvi.pszText = StatusList[Index(i)].lpzSkinSoundDesc;
lvi.iItem = ListView_InsertItem(hList, &lvi);
if (!db_get_ts(hContact, MODULE, StatusList[Index(i)].lpzSkinSoundName, &dbv)) {
@@ -163,22 +160,25 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
}
- LV_ITEM lvi = { 0 };
- lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
- lvi.iItem = 0;
- lvi.iSubItem = 0;
- lvi.iImage = Index(ID_STATUS_MAX) + 1; // additional icon
- lvi.lParam = (LPARAM)ID_STATUS_FROMOFFLINE;
- lvi.pszText = TranslateT("From offline");
- lvi.iItem = ListView_InsertItem(hList, &lvi);
-
- if (!db_get_ts(hContact, MODULE, "UserFromOffline", &dbv)) {
- _tcscpy(buff, dbv.ptszVal);
- db_free(&dbv);
- }
- else _tcscpy(buff, TranslateT(DEFAULT_SOUND));
+ for (int i = 0; i <= ID_STATUSEX_MAX; i++) {
+ LV_ITEM lvi = {0};
+ lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
+ lvi.iItem = 0;
+ lvi.iSubItem = 0;
+ lvi.iImage = Index(ID_STATUS_MAX) + 1; // additional icon
+ lvi.lParam = (LPARAM)i;
+ lvi.pszText = StatusListEx[i].lpzSkinSoundDesc;
+ lvi.iItem = ListView_InsertItem(hList, &lvi);
+
+ if (!db_get_ts(hContact, MODULE, StatusList[i].lpzSkinSoundName, &dbv)) {
+ _tcscpy(buff, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else
+ _tcscpy(buff, TranslateT(DEFAULT_SOUND));
- ListView_SetItemText(hList, lvi.iItem, 1, buff);
+ ListView_SetItemText(hList, lvi.iItem, 1, buff);
+ }
}
CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYSOUNDS, db_get_b(hContact, MODULE, "EnableSounds", 1));
@@ -198,7 +198,6 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (ListView_GetSelectionMark(hList) != -1)
PreviewSound(hList);
break;
-
case IDC_CHANGE:
{
int iSel = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_INDSNDLIST), -1, LVNI_SELECTED);
@@ -219,11 +218,9 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (RemoveSoundFromList(GetDlgItem(hwndDlg, IDC_INDSNDLIST)))
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
-
case IDC_CHECK_NOTIFYSOUNDS:
db_set_b(hContact, MODULE, "EnableSounds", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYSOUNDS) ? 1 : 0);
break;
-
case IDC_CHECK_NOTIFYPOPUPS:
db_set_b(hContact, MODULE, "EnablePopups", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYPOPUPS) ? 1 : 0);
break;
@@ -235,7 +232,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
TCHAR buff[MAX_PATH];
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
- LVITEM lvi = { 0 };
+ LVITEM lvi = {0};
lvi.mask = LVIF_PARAM;
//Cycle through the list reading the text associated to each status.
for (lvi.iItem = ListView_GetItemCount(hList) - 1; lvi.iItem >= 0; lvi.iItem--) {
@@ -243,16 +240,16 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ListView_GetItemText(hList, lvi.iItem, 1, buff, SIZEOF(buff));
if (!_tcscmp(buff, TranslateT(DEFAULT_SOUND))) {
- if (lvi.lParam == ID_STATUS_FROMOFFLINE)
- db_unset(hContact, MODULE, "UserFromOffline");
+ if (lvi.lParam < ID_STATUS_MIN)
+ db_unset(hContact, MODULE, StatusListEx[lvi.lParam].lpzSkinSoundName);
else
db_unset(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName);
}
else {
- TCHAR stzSoundPath[MAX_PATH] = { 0 };
+ TCHAR stzSoundPath[MAX_PATH] = {0};
PathToRelativeT(buff, stzSoundPath);
- if (lvi.lParam == ID_STATUS_FROMOFFLINE)
- db_set_ws(hContact, MODULE, "UserFromOffline", stzSoundPath);
+ if (lvi.lParam < ID_STATUS_MIN)
+ db_set_ws(hContact, MODULE, StatusListEx[lvi.lParam].lpzSkinSoundName, stzSoundPath);
else
db_set_ws(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName, stzSoundPath);
}
@@ -289,23 +286,9 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return FALSE;
}
-int UserInfoInitialise(WPARAM wParam, LPARAM lParam)
-{
- if (lParam) {
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.position = 100000000;
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SOUNDS);
- odp.pszTitle = LPGEN("Status Notify");
- odp.pfnDlgProc = DlgProcSoundUIPage;
- UserInfo_AddPage(wParam, &odp);
- }
- return 0;
-}
-
-void ResetListOptions(HWND hwndList)
+void ResetListOptions(HWND hwndList)
{
- SetWindowLongPtr(hwndList, GWL_STYLE, GetWindowLongPtr(hwndList,GWL_STYLE) | CLS_SHOWHIDDEN);
+ SetWindowLongPtr(hwndList, GWL_STYLE, GetWindowLongPtr(hwndList, GWL_STYLE) | CLS_SHOWHIDDEN);
}
__inline int GetExtraImage(HWND hwndList, HANDLE hItem, int column)
@@ -320,7 +303,7 @@ __inline void SetExtraImage(HWND hwndList, HANDLE hItem, int column, int imageID
void SetAllContactsIcons(HWND hwndList)
{
- BYTE EnableSounds, EnablePopups, EnableXStatus, EnableLogging;
+ BYTE EnableSounds, EnablePopups, EnableXStatus, EnableXLogging, EnableStatusMsg, EnableSMsgLogging;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
@@ -330,14 +313,19 @@ void SetAllContactsIcons(HWND hwndList)
EnableSounds = db_get_b(hContact, MODULE, "EnableSounds", 1);
EnablePopups = db_get_b(hContact, MODULE, "EnablePopups", 1);
EnableXStatus = db_get_b(hContact, MODULE, "EnableXStatusNotify", 1);
- EnableLogging = db_get_b(hContact, MODULE, "EnableLogging", 1);
+ EnableXLogging = db_get_b(hContact, MODULE, "EnableXLogging", 1);
+ EnableStatusMsg = db_get_b(hContact, MODULE, "EnableSMsgNotify", 1);
+ EnableSMsgLogging = db_get_b(hContact, MODULE, "EnableSMsgLogging", 1);
}
- else EnableSounds = EnablePopups = EnableXStatus = EnableLogging = 0;
+ else
+ EnableSounds = EnablePopups = EnableXStatus = EnableXLogging = EnableStatusMsg = EnableSMsgLogging = 0;
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_SOUND, EnableSounds ? EXTRA_IMAGE_SOUND : EXTRA_IMAGE_DOT);
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_POPUP, EnablePopups? EXTRA_IMAGE_POPUP : EXTRA_IMAGE_DOT);
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_XSTATUS, EnableXStatus ? EXTRA_IMAGE_XSTATUS : EXTRA_IMAGE_DOT);
- SetExtraImage(hwndList, hItem, EXTRA_IMAGE_LOGGING, EnableLogging ? EXTRA_IMAGE_LOGGING : EXTRA_IMAGE_DOT);
+ SetExtraImage(hwndList, hItem, EXTRA_IMAGE_XLOGGING, EnableXLogging ? EXTRA_IMAGE_XLOGGING : EXTRA_IMAGE_DOT);
+ SetExtraImage(hwndList, hItem, EXTRA_IMAGE_STATUSMSG, EnableStatusMsg ? EXTRA_IMAGE_STATUSMSG : EXTRA_IMAGE_DOT);
+ SetExtraImage(hwndList, hItem, EXTRA_IMAGE_SMSGLOGGING, EnableSMsgLogging ? EXTRA_IMAGE_SMSGLOGGING : EXTRA_IMAGE_DOT);
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_DISABLEALL, EXTRA_IMAGE_DISABLEALL);
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_ENABLEALL, EXTRA_IMAGE_ENABLEALL);
}
@@ -346,25 +334,23 @@ void SetAllContactsIcons(HWND hwndList)
void SetGroupsIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount)
{
- int iconOn[6] = {1,1,1,1,1,1};
- int childCount[6] = {0};
+ int iconOn[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
+ int childCount[8] = {0};
HANDLE hItem;
int typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
- if (typeOfFirst == CLCIT_GROUP)
+ if (typeOfFirst == CLCIT_GROUP)
hItem = hFirstItem;
- else
+ else
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
- while (hItem)
- {
+ while (hItem) {
HANDLE hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hChildItem)
+ if (hChildItem)
SetGroupsIcons(hwndList, hChildItem, hItem, childCount);
- for (int i = 0; i < SIZEOF(iconOn); i++)
- {
- if (iconOn[i] && GetExtraImage(hwndList, hItem, i) == EXTRA_IMAGE_DOT)
+ for (int i = 0; i < SIZEOF(iconOn); i++) {
+ if (iconOn[i] && GetExtraImage(hwndList, hItem, i) == EXTRA_IMAGE_DOT)
iconOn[i] = 0;
}
@@ -372,20 +358,18 @@ void SetGroupsIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *g
}
//check contacts
- if (typeOfFirst == CLCIT_CONTACT)
+ if (typeOfFirst == CLCIT_CONTACT)
hItem = hFirstItem;
- else
+ else
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
- while(hItem)
- {
- for (int i = 0; i < SIZEOF(iconOn); i++)
- {
+ while (hItem) {
+ for (int i = 0; i < SIZEOF(iconOn); i++) {
int image = GetExtraImage(hwndList, hItem, i);
- if (iconOn[i] && image == EXTRA_IMAGE_DOT)
+ if (iconOn[i] && image == EXTRA_IMAGE_DOT)
iconOn[i] = 0;
- if (image != EMPTY_EXTRA_ICON)
+ if (image != EMPTY_EXTRA_ICON)
childCount[i]++;
}
@@ -393,10 +377,9 @@ void SetGroupsIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *g
}
//set icons
- for(int i = 0; i < SIZEOF(iconOn); i++)
- {
+ for (int i = 0; i < SIZEOF(iconOn); i++) {
SetExtraImage(hwndList, hParentItem, i, childCount[i] ? (iconOn[i] ? i : EXTRA_IMAGE_DOT) : EMPTY_EXTRA_ICON);
- if (groupChildCount)
+ if (groupChildCount)
groupChildCount[i] += childCount[i];
}
}
@@ -406,62 +389,64 @@ void SetAllChildrenIcons(HWND hwndList, HANDLE hFirstItem, int column, int image
HANDLE hItem, hChildItem;
int typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
- if (typeOfFirst == CLCIT_GROUP)
+ if (typeOfFirst == CLCIT_GROUP)
hItem = hFirstItem;
- else
+ else
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
- while(hItem)
- {
- hChildItem = (HANDLE)SendMessage(hwndList ,CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hChildItem)
+ while (hItem) {
+ hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ if (hChildItem)
SetAllChildrenIcons(hwndList, hChildItem, column, image);
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
- if (typeOfFirst == CLCIT_CONTACT)
+ if (typeOfFirst == CLCIT_CONTACT)
hItem = hFirstItem;
- else
+ else
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
- while(hItem)
- {
+ while (hItem) {
int oldIcon = GetExtraImage(hwndList, hItem, column);
- if (oldIcon != EMPTY_EXTRA_ICON && oldIcon != image)
+ if (oldIcon != EMPTY_EXTRA_ICON && oldIcon != image)
SetExtraImage(hwndList, hItem, column, image);
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
}
-INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HANDLE hItemAll;
switch (msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
HIMAGELIST hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 3, 3);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_SOUND)));
- SendDlgItemMessage(hwndDlg,IDC_SOUNDICON,STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_SOUND, ILD_NORMAL), 0);
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_SOUND)));
+ SendDlgItemMessage(hwndDlg, IDC_SOUNDICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_SOUND, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_POPUP)));
SendDlgItemMessage(hwndDlg, IDC_POPUPICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_POPUP, ILD_NORMAL), 0);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_XSTATUS)));
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_XSTATUS)));
SendDlgItemMessage(hwndDlg, IDC_XSTATUSICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_XSTATUS, ILD_NORMAL), 0);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_LOGGING)));
- SendDlgItemMessage(hwndDlg, IDC_LOGGINGICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_LOGGING, ILD_NORMAL), 0);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_DISABLEALL)));
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_LOGGING_XSTATUS)));
+ SendDlgItemMessage(hwndDlg, IDC_XLOGGINGICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_XLOGGING, ILD_NORMAL), 0);
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_STATUS_MESSAGE)));
+ SendDlgItemMessage(hwndDlg, IDC_SMSGICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_STATUSMSG, ILD_NORMAL), 0);
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_LOGGING_SMSG)));
+ SendDlgItemMessage(hwndDlg, IDC_SMSGLOGGINGICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_SMSGLOGGING, ILD_NORMAL), 0);
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_DISABLEALL)));
SendDlgItemMessage(hwndDlg, IDC_DISABLEALLICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_DISABLEALL, ILD_NORMAL), 0);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_ENABLEALL)));
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLEALL)));
SendDlgItemMessage(hwndDlg, IDC_ENABLEALLICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_ENABLEALL, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT));
SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hImageList);
- SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRACOLUMNS, 6, 0);
+ SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRACOLUMNS, 8, 0);
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
ResetListOptions(hList);
@@ -481,7 +466,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case WM_NOTIFY:
{
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_INDSNDLIST:
switch (((LPNMHDR)lParam)->code) {
case CLN_NEWCONTACT:
@@ -494,59 +479,59 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case CLN_OPTIONSCHANGED:
ResetListOptions(hList);
break;
- case NM_CLICK:
+ case NM_CLICK:
{
- NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
+ NMCLISTCONTROL *nm = (NMCLISTCONTROL *)lParam;
DWORD hitFlags;
// Make sure we have an extra column
- if (nm->iColumn == -1) break;
+ if (nm->iColumn == -1)
+ break;
// Find clicked item
HANDLE hItem = (HANDLE)SendMessage(hList, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL) break;
- if (!(hitFlags & CLCHT_ONITEMEXTRA)) break;
+ if (hItem == NULL)
+ break;
+ if (!(hitFlags & CLCHT_ONITEMEXTRA))
+ break;
int itemType = SendMessage(hList, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
// Get image in clicked column
int image = GetExtraImage(hList, hItem, nm->iColumn);
- if (image == EXTRA_IMAGE_DOT)
+ if (image == EXTRA_IMAGE_DOT)
image = nm->iColumn;
- else if (image >= EXTRA_IMAGE_SOUND && image <= EXTRA_IMAGE_LOGGING)
+ else if (image >= EXTRA_IMAGE_SOUND && image <= EXTRA_IMAGE_SMSGLOGGING)
image = EXTRA_IMAGE_DOT;
// Get item type (contact, group, etc...)
- if (itemType == CLCIT_CONTACT)
- {
- if (image == EXTRA_IMAGE_DISABLEALL)
- {
- for (int i = 0; i < 4; i++)
+ if (itemType == CLCIT_CONTACT) {
+ if (image == EXTRA_IMAGE_DISABLEALL) {
+ for (int i = 0; i < 6; i++)
SetExtraImage(hList, hItem, i, EXTRA_IMAGE_DOT);
}
- else if (image == EXTRA_IMAGE_ENABLEALL)
- {
- for (int i = 0; i < 4; i++)
+ else if (image == EXTRA_IMAGE_ENABLEALL) {
+ for (int i = 0; i < 6; i++)
SetExtraImage(hList, hItem, i, i);
}
- else SetExtraImage(hList, hItem, nm->iColumn, image);
+ else
+ SetExtraImage(hList, hItem, nm->iColumn, image);
}
else if (itemType == CLCIT_INFO || itemType == CLCIT_GROUP) {
if (itemType == CLCIT_GROUP)
hItem = (HANDLE)SendMessage(hList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hItem) {
- if (image == EXTRA_IMAGE_DISABLEALL)
- {
- for (int i = 0; i < 4; i++)
+ if (image == EXTRA_IMAGE_DISABLEALL) {
+ for (int i = 0; i < 6; i++)
SetAllChildrenIcons(hList, hItem, i, EXTRA_IMAGE_DOT);
}
- else if (image == EXTRA_IMAGE_ENABLEALL)
- {
- for (int i = 0; i < 4; i++)
+ else if (image == EXTRA_IMAGE_ENABLEALL) {
+ for (int i = 0; i < 6; i++)
SetAllChildrenIcons(hList, hItem, i, i);
}
- else SetAllChildrenIcons(hList, hItem, nm->iColumn, image);
+ else
+ SetAllChildrenIcons(hList, hItem, nm->iColumn, image);
}
}
@@ -560,29 +545,39 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
break;
case 0:
switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
+ case PSN_APPLY:
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendMessage(hList, CLM_FINDCONTACT, hContact, 0);
if (hItem) {
- if (GetExtraImage(hList, hItem, EXTRA_IMAGE_SOUND) == EXTRA_IMAGE_SOUND)
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_SOUND) == EXTRA_IMAGE_SOUND)
db_unset(hContact, MODULE, "EnableSounds");
- else
+ else
db_set_b(hContact, MODULE, "EnableSounds", 0);
- if (GetExtraImage(hList, hItem, EXTRA_IMAGE_POPUP) == EXTRA_IMAGE_POPUP)
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_POPUP) == EXTRA_IMAGE_POPUP)
db_unset(hContact, MODULE, "EnablePopups");
- else
+ else
db_set_b(hContact, MODULE, "EnablePopups", 0);
- if (GetExtraImage(hList, hItem, EXTRA_IMAGE_XSTATUS) == EXTRA_IMAGE_XSTATUS)
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_XSTATUS) == EXTRA_IMAGE_XSTATUS)
db_unset(hContact, MODULE, "EnableXStatusNotify");
else
db_set_b(hContact, MODULE, "EnableXStatusNotify", 0);
- if (GetExtraImage(hList, hItem, EXTRA_IMAGE_LOGGING) == EXTRA_IMAGE_LOGGING)
- db_unset(hContact, MODULE, "EnableLogging");
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_XLOGGING) == EXTRA_IMAGE_XLOGGING)
+ db_unset(hContact, MODULE, "EnableXLogging");
+ else
+ db_set_b(hContact, MODULE, "EnableXLogging", 0);
+
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_STATUSMSG) == EXTRA_IMAGE_STATUSMSG)
+ db_unset(hContact, MODULE, "EnableSMsgNotify");
else
- db_set_b(hContact, MODULE, "EnableLogging", 0);
+ db_set_b(hContact, MODULE, "EnableSMsgNotify", 0);
+
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_SMSGLOGGING) == EXTRA_IMAGE_SMSGLOGGING)
+ db_unset(hContact, MODULE, "EnableSMsgLogging");
+ else
+ db_set_b(hContact, MODULE, "EnableSMsgLogging", 0);
}
}
return TRUE;
@@ -591,7 +586,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
break;
- case WM_DESTROY:
+ case WM_DESTROY:
HIMAGELIST hImageList = (HIMAGELIST)SendMessage(GetDlgItem(hwndDlg, IDC_INDSNDLIST), CLM_GETEXTRAIMAGELIST, 0, 0);
for (int i = 0; i < ImageList_GetImageCount(hImageList); i++)
DestroyIcon(ImageList_GetIcon(hImageList, i, ILD_NORMAL));
@@ -600,3 +595,17 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
return FALSE;
}
+
+int UserInfoInitialise(WPARAM wParam, LPARAM lParam)
+{
+ if (lParam) {
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.position = 100000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SOUNDS);
+ odp.pszTitle = LPGEN("Status Notify");
+ odp.pfnDlgProc = DlgProcSoundUIPage;
+ UserInfo_AddPage(wParam, &odp);
+ }
+ return 0;
+}
diff --git a/plugins/NewXstatusNotify/src/indsnd.h b/plugins/NewXstatusNotify/src/indsnd.h
index a95e076cd9..ea7d25fc9c 100644
--- a/plugins/NewXstatusNotify/src/indsnd.h
+++ b/plugins/NewXstatusNotify/src/indsnd.h
@@ -22,19 +22,21 @@
#ifndef INDSND_H
#define INDSND_H
-#define EXTRA_IMAGE_SOUND 0
-#define EXTRA_IMAGE_POPUP 1
-#define EXTRA_IMAGE_XSTATUS 2
-#define EXTRA_IMAGE_LOGGING 3
-#define EXTRA_IMAGE_DISABLEALL 4
-#define EXTRA_IMAGE_ENABLEALL 5
-#define EXTRA_IMAGE_DOT 6
+#define EXTRA_IMAGE_SOUND 0
+#define EXTRA_IMAGE_POPUP 1
+#define EXTRA_IMAGE_XSTATUS 2
+#define EXTRA_IMAGE_XLOGGING 3
+#define EXTRA_IMAGE_STATUSMSG 4
+#define EXTRA_IMAGE_SMSGLOGGING 5
+#define EXTRA_IMAGE_DISABLEALL 6
+#define EXTRA_IMAGE_ENABLEALL 7
+#define EXTRA_IMAGE_DOT 8
#define STATUS_COLUMN 110
#define DEFAULT_SOUND LPGEN("(default sound)")
int UserInfoInitialise(WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcFiltering(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK DlgProcFiltering(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
#endif \ No newline at end of file
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index 081f7e9ec0..344c7acf01 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -23,18 +23,19 @@
HINSTANCE hInst;
-LIST<DBEVENT> eventList( 10 );
+LIST<DBEVENT> eventListXStatus(10);
+LIST<DBEVENT> eventListStatus(10);
+LIST<DBEVENT> eventListSMsg(10);
HANDLE hStatusModeChange, hServiceMenu, hHookContactStatusChanged, hToolbarButton;
HGENMENU hEnableDisableMenu;
STATUS StatusList[STATUS_COUNT];
+STATUS StatusListEx[STATUSEX_COUNT];
HWND SecretWnd;
int hLangpack;
-
-int ContactStatusChanged(MCONTACT hContact, WORD oldStatus,WORD newStatus);
-
+int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus);
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
@@ -65,12 +66,14 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_USERONL
BYTE GetGender(MCONTACT hContact)
{
- char *szProto =GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (szProto) {
switch (db_get_b(hContact, szProto, "Gender", 0)) {
- case 'M': case 'm':
+ case 'M':
+ case 'm':
return GENDER_MALE;
- case 'F': case 'f':
+ case 'F':
+ case 'f':
return GENDER_FEMALE;
default:
return GENDER_UNSPECIFIED;
@@ -87,172 +90,53 @@ HANDLE GetIconHandle(char *szIcon)
return Skin_GetIconHandle(szSettingName);
}
-bool IsNewExtraStatus(MCONTACT hContact, char *szSetting, TCHAR *newStatusTitle)
-{
- DBVARIANT dbv;
- bool result = true;
-
- if ( !db_get_ts(hContact, MODULE, szSetting, &dbv)) {
- result = _tcscmp(newStatusTitle, dbv.ptszVal) ? true : false;
- db_free(&dbv);
- }
-
- return result;
-}
-
-int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
+static int __inline CheckStr(char *str, int not_empty, int empty)
{
- XSTATUSCHANGE *xsc;
- char *szProto = GetContactProto(hContact);
-
- if ( ProtoServiceExists(szProto, JS_PARSE_XMPP_URI)) {
- if (cws->value.type == DBVT_DELETED)
- return 0;
-
- if (hContact == NULL)
- return 0;
-
- if (strstr(cws->szSetting, "/mood/") || strstr(cws->szSetting, "/activity/")) { // Jabber mood or activity changed
- char *szSetting;
- int type;
-
- if (strstr(cws->szSetting, "/mood/")) {
- type = TYPE_JABBER_MOOD;
- szSetting = "LastJabberMood";
- }
- else {
- type = TYPE_JABBER_ACTIVITY;
- szSetting = "LastJabberActivity";
- }
-
- if (strstr(cws->szSetting, "title")) {
- TCHAR *stzValue = db2t(&cws->value);
- if (stzValue) {
- if ( !IsNewExtraStatus(hContact, szSetting, stzValue)) {
- mir_free(stzValue);
- return 0;
- }
-
- xsc = NewXSC(hContact, szProto, type, NOTIFY_NEW_XSTATUS, stzValue, NULL);
- db_set_ws(hContact, MODULE, szSetting, stzValue);
- }
- else {
- xsc = NewXSC(hContact, szProto, type, NOTIFY_REMOVE, NULL, NULL);
- db_set_ws(hContact, MODULE, szSetting, _T(""));
- }
-
- ExtraStatusChanged(xsc);
- }
- else if (strstr(cws->szSetting, "text")) {
- TCHAR *stzValue = db2t(&cws->value);
- xsc = NewXSC(hContact, szProto, type, NOTIFY_NEW_MESSAGE, NULL, stzValue);
- ExtraStatusChanged(xsc);
- }
-
- return 1;
- }
- }
- else if (strstr(cws->szSetting, "XStatus")/* || strcmp(cws->szSetting, "StatusNote") == 0*/) {
- if (strcmp(cws->szSetting, "XStatusName") == 0) {
- if (cws->value.type == DBVT_DELETED)
- xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, NOTIFY_REMOVE, NULL, NULL);
- else {
- TCHAR *stzValue = db2t(&cws->value);
- if ( !stzValue) {
- TCHAR buff[64];
- int statusID = db_get_b(hContact, szProto, "XStatusId", -1);
- GetDefaultXstatusName(statusID, szProto, buff, SIZEOF(buff));
- stzValue = mir_tstrdup(buff);
- }
-
- xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, NOTIFY_NEW_XSTATUS, stzValue, NULL);
- }
-
- ExtraStatusChanged(xsc);
- }
- else if (strstr(cws->szSetting, "XStatusMsg")/* || strcmp(cws->szSetting, "StatusNote") == 0*/) {
- if (cws->value.type == DBVT_DELETED)
- return 1;
-
- TCHAR *stzValue = db2t(&cws->value);
- xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, NOTIFY_NEW_MESSAGE, NULL, stzValue);
- ExtraStatusChanged(xsc);
- }
-
- return 1;
- }
-
- return 0;
-}
-
-static int __inline CheckStr(char *str, int not_empty, int empty) {
if (str == NULL || str[0] == '\0')
return empty;
else
return not_empty;
}
-
-static int __inline CheckStrW(WCHAR *str, int not_empty, int empty) {
+static int __inline CheckStrW(WCHAR *str, int not_empty, int empty)
+{
if (str == NULL || str[0] == L'\0')
return empty;
else
return not_empty;
}
-
-WCHAR *mir_dupToUnicodeEx(char *ptr, UINT CodePage)
-{
- if (ptr == NULL)
- return NULL;
-
- size_t size = strlen(ptr) + 1;
- WCHAR *tmp = (WCHAR *) mir_alloc(size * sizeof(WCHAR));
-
- MultiByteToWideChar(CodePage, 0, ptr, -1, tmp, (int)size * sizeof(WCHAR));
- return tmp;
-}
-
-static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) {
+static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new, char *szSetting) {
DBVARIANT dbv_old;
int ret;
switch (cws_new->value.type) {
- case DBVT_DELETED:
- smi->newstatusmsg = NULL;
- break;
-
case DBVT_ASCIIZ:
smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(cws_new->value.pszVal, CP_ACP));
break;
-
case DBVT_UTF8:
smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(cws_new->value.pszVal, CP_UTF8));
break;
-
case DBVT_WCHAR:
smi->newstatusmsg = (CheckStrW(cws_new->value.pwszVal, 0, 1) ? NULL : mir_wstrdup(cws_new->value.pwszVal));
break;
-
+ case DBVT_DELETED:
default:
smi->newstatusmsg = NULL;
break;
}
- if ( !db_get_s(smi->hContact, "UserOnline", "OldStatusMsg", &dbv_old, 0)) {
+ if (!db_get_s(smi->hContact, "UserOnline", szSetting, &dbv_old, 0)) {
switch (dbv_old.type) {
case DBVT_ASCIIZ:
smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(dbv_old.pszVal, CP_ACP));
break;
-
case DBVT_UTF8:
smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(dbv_old.pszVal, CP_UTF8));
break;
-
case DBVT_WCHAR:
smi->oldstatusmsg = (CheckStrW(dbv_old.pwszVal, 0, 1) ? NULL : mir_wstrdup(dbv_old.pwszVal));
break;
-
default:
smi->oldstatusmsg = NULL;
break;
@@ -260,36 +144,35 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new)
if (cws_new->value.type == DBVT_DELETED) {
if (dbv_old.type == DBVT_WCHAR)
- ret = CheckStrW(dbv_old.pwszVal, 2, 0);
+ ret = CheckStrW(dbv_old.pwszVal, COMPARE_DEL, COMPARE_SAME);
else if (dbv_old.type == DBVT_UTF8 || dbv_old.type == DBVT_ASCIIZ)
- ret = CheckStr(dbv_old.pszVal, 2, 0);
+ ret = CheckStr(dbv_old.pszVal, COMPARE_DEL, COMPARE_SAME);
else
- ret = 2;
+ ret = COMPARE_DEL;
}
else if (dbv_old.type != cws_new->value.type)
- ret = (lstrcmpW(smi->newstatusmsg, smi->oldstatusmsg) ? CheckStrW(smi->newstatusmsg, 1, 2) : 0);
+ ret = (lstrcmpW(smi->newstatusmsg, smi->oldstatusmsg) ? CheckStrW(smi->newstatusmsg, COMPARE_DIFF, COMPARE_DEL) : COMPARE_SAME);
else if (dbv_old.type == DBVT_ASCIIZ)
- ret = (lstrcmpA(cws_new->value.pszVal, dbv_old.pszVal) ? CheckStr(cws_new->value.pszVal, 1, 2) : 0);
+ ret = (lstrcmpA(cws_new->value.pszVal, dbv_old.pszVal) ? CheckStr(cws_new->value.pszVal, COMPARE_DIFF, COMPARE_DEL) : COMPARE_SAME);
else if (dbv_old.type == DBVT_UTF8)
- ret = (lstrcmpA(cws_new->value.pszVal, dbv_old.pszVal) ? CheckStr(cws_new->value.pszVal, 1, 2) : 0);
+ ret = (lstrcmpA(cws_new->value.pszVal, dbv_old.pszVal) ? CheckStr(cws_new->value.pszVal, COMPARE_DIFF, COMPARE_DEL) : COMPARE_SAME);
else if (dbv_old.type == DBVT_WCHAR)
- ret = (lstrcmpW(cws_new->value.pwszVal, dbv_old.pwszVal) ? CheckStrW(cws_new->value.pwszVal, 1, 2) : 0);
+ ret = (lstrcmpW(cws_new->value.pwszVal, dbv_old.pwszVal) ? CheckStrW(cws_new->value.pwszVal, COMPARE_DIFF, COMPARE_DEL) : COMPARE_SAME);
db_free(&dbv_old);
}
else {
if (cws_new->value.type == DBVT_DELETED)
- ret = 0;
+ ret = COMPARE_SAME;
else if (cws_new->value.type == DBVT_WCHAR)
- ret = CheckStrW(cws_new->value.pwszVal, 1, 0);
- else if (cws_new->value.type == DBVT_UTF8 ||
- cws_new->value.type == DBVT_ASCIIZ)
- ret = CheckStr(cws_new->value.pszVal, 1, 0);
+ ret = CheckStrW(cws_new->value.pwszVal, COMPARE_DIFF, COMPARE_SAME);
+ else if (cws_new->value.type == DBVT_UTF8 || cws_new->value.type == DBVT_ASCIIZ)
+ ret = CheckStr(cws_new->value.pszVal, COMPARE_DIFF, COMPARE_SAME);
else
- ret = 1;
+ ret = COMPARE_DIFF;
smi->oldstatusmsg = NULL;
}
@@ -297,46 +180,14 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new)
return ret;
}
-BOOL FreeSmiStr(STATUSMSGINFO *smi)
-{
- mir_free(smi->newstatusmsg);
- mir_free(smi->oldstatusmsg);
- return 0;
-}
-
-TCHAR* AddCR(const TCHAR *statusmsg)
-{
- const TCHAR *found;
- int i = 0, len = lstrlen(statusmsg), j;
- TCHAR *tmp = (TCHAR*)mir_alloc(1024 * sizeof(TCHAR));
- *tmp = _T('\0');
- while((found = _tcsstr((statusmsg + i), _T("\n"))) != NULL && _tcslen(tmp) + 1 < 1024){
- j = (int)(found - statusmsg);
- if (lstrlen(tmp) + j - i + 2 < 1024)
- tmp = _tcsncat(tmp, statusmsg + i, j - i);
- else
- break;
-
- if (j == 0 || *(statusmsg + j - 1) != _T('\r'))
- tmp = lstrcat(tmp, _T("\r"));
-
- tmp = lstrcat(tmp, _T("\n"));
- i = j + 1;
- }
- if (lstrlen(tmp) + len - i + 1 < 1024)
- tmp = lstrcat(tmp, statusmsg + i);
-
- return tmp;
-}
-
-TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt)
+TCHAR *GetStr(STATUSMSGINFO *n, const TCHAR *tmplt)
{
TCHAR tmp[1024];
if (tmplt == NULL || tmplt[0] == _T('\0'))
return NULL;
- TCHAR *str = (TCHAR*)mir_alloc(2048 * sizeof(TCHAR));
+ TCHAR *str = (TCHAR *)mir_alloc(2048 * sizeof(TCHAR));
str[0] = _T('\0');
int len = lstrlen(tmplt);
@@ -347,7 +198,7 @@ TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt)
i++;
switch (tmplt[i]) {
case 'n':
- if (n->compare == 2 || _tcscmp(n->newstatusmsg, TranslateT("<no status message>")) == 0)
+ if (n->compare == COMPARE_DEL || _tcscmp(n->newstatusmsg, TranslateT("<no status message>")) == 0)
lstrcpyn(tmp, TranslateT("<no status message>"), SIZEOF(tmp));
else {
TCHAR *_tmp = AddCR(n->newstatusmsg);
@@ -367,12 +218,21 @@ TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt)
break;
case 'c':
- if (n->cust == NULL || n->cust[0] == _T('\0')) lstrcpyn(tmp, TranslateT("Contact"), SIZEOF(tmp));
- else lstrcpyn(tmp, n->cust, SIZEOF(tmp));
+ if (n->hContact == NULL)
+ lstrcpyn(tmp, TranslateT("Contact"), SIZEOF(tmp));
+ else
+ lstrcpyn(tmp, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)n->hContact, GCDNF_TCHAR), SIZEOF(tmp));
+ break;
+
+ case 's':
+ if (n->hContact == NULL)
+ lstrcpyn(tmp, TranslateT("<unknown>"), SIZEOF(tmp));
+ else
+
+ lstrcpyn(tmp, StatusList[Index(db_get_w(n->hContact, n->proto, "Status", ID_STATUS_ONLINE))].lpzStandardText, SIZEOF(tmp));
break;
default:
- //lstrcpyn(tmp, _T("%"), TMPMAX);
i--;
tmp[0] = tmplt[i], tmp[1] = _T('\0');
break;
@@ -382,15 +242,12 @@ TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt)
i++;
switch (tmplt[i]) {
case 'n':
- //_tcscat_s(tmp, TMPMAX, _T("\r\n"));
tmp[0] = _T('\r'), tmp[1] = _T('\n'), tmp[2] = _T('\0');
break;
case 't':
- //_tcscat_s(tmp, TMPMAX, _T("\t"));
tmp[0] = _T('\t'), tmp[1] = _T('\0');
break;
default:
- //lstrcpyn(tmp, _T("\\"), TMPMAX);
i--;
tmp[0] = tmplt[i], tmp[1] = _T('\0');
break;
@@ -416,220 +273,51 @@ bool SkipHiddenContact(MCONTACT hContact)
return (!opt.HiddenContactsToo && (db_get_b(hContact, "CList", "Hidden", 0) == 1));
}
-int ProcessStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
+void LogSMsgToDB(STATUSMSGINFO *smi, const TCHAR *tmplt)
{
- if ( !strcmp(cws->szSetting, "Status")) {
- WORD newStatus = cws->value.wVal;
- if (newStatus < ID_STATUS_MIN || newStatus > ID_STATUS_MAX)
- return 0;
-
- char *proto = GetContactProto(hContact);
- if(strcmp(cws->szModule,proto))
- {
- return 0;
- }
-
- WORD oldStatus = DBGetContactSettingRangedWord(hContact, "UserOnline", "OldStatus", ID_STATUS_OFFLINE, ID_STATUS_MIN, ID_STATUS_MAX);
- if (oldStatus == newStatus)
- return 0;
-
- //If we get here, the two stauses differ, so we can proceed.
- db_set_w(hContact, "UserOnline", "OldStatus", newStatus);
-
- //If *Miranda* ignores the UserOnline event, exit!
- if (CallService(MS_IGNORE_ISIGNORED, hContact, IGNOREEVENT_USERONLINE))
- return 0;
-
- //If we get here, we have to notify the Hooks.
- ContactStatusChanged(hContact,oldStatus, newStatus);
- NotifyEventHooks(hHookContactStatusChanged, hContact, (LPARAM)MAKELPARAM(oldStatus, newStatus));
- return 1;
- }
- else if ( !strcmp(cws->szModule, "CList") && !strcmp(cws->szSetting, "StatusMsg")) {
- if(SkipHiddenContact(hContact))
- return 0;
-
- char *proto = GetContactProto(hContact);
- if(!proto)
- return 0;
-
- char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", proto);
- if (!db_get_b(NULL, MODULE, dbSetting, 1))
- return 0;
-
- BOOL retem = TRUE, rettime = TRUE;
- STATUSMSGINFO smi;
- smi.proto = proto;
-
- //don't show popup when mradio connecting and disconnecting
- if (_stricmp(smi.proto, "mRadio") == 0 && !cws->value.type == DBVT_DELETED) {
- TCHAR buf[MAX_PATH];
- mir_sntprintf(buf, SIZEOF(buf), _T(" (%s)"), TranslateT("connecting"));
- ptrA pszUtf( mir_utf8encodeT(buf));
- mir_sntprintf(buf, SIZEOF(buf), _T(" (%s)"), TranslateT("aborting"));
- ptrA pszUtf2( mir_utf8encodeT(buf));
- mir_sntprintf(buf, SIZEOF(buf), _T(" (%s)"), TranslateT("playing"));
- ptrA pszUtf3( mir_utf8encodeT(buf));
- if (_stricmp(cws->value.pszVal, pszUtf) == 0 || _stricmp(cws->value.pszVal, pszUtf2) == 0 || _stricmp(cws->value.pszVal, pszUtf3) == 0)
- return 0;
- }
-
- if (smi.proto != NULL && CallProtoService(smi.proto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) {
- smi.hContact = hContact;
- smi.compare = CompareStatusMsg(&smi, cws);
- if ((smi.compare == 0) || (opt.IgnoreEmpty && (smi.compare == 2)))
- return FreeSmiStr(&smi);
-
- if (cws->value.type == DBVT_DELETED)
- db_unset(smi.hContact, "UserOnline", "OldStatusMsg");
- else
- db_set(smi.hContact, "UserOnline", "OldStatusMsg", &cws->value);
-
- smi.cust = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)smi.hContact, GCDNF_TCHAR);
-
- if (opt.IgnoreEmpty && (smi.compare == 2))
- retem = FALSE;
- else if (!db_get_b(0, MODULE, smi.proto, 1) && !opt.PopupOnConnect)
- rettime = FALSE;
-
- char status[8];
- mir_snprintf(status, SIZEOF(status), "%d", IDC_CHK_STATUS_MESSAGE);
- if ( db_get_b(hContact, MODULE, "EnablePopups", 1) && db_get_b(0, MODULE, status, 1) && retem && rettime) {
- char* protoname = (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)smi.hContact, 0);
- PROTOACCOUNT *pdescr = ProtoGetAccount(protoname);
- protoname = mir_t2a(pdescr->tszAccountName);
- protoname = (char*)mir_realloc(protoname, lstrlenA(protoname) + lstrlenA("_TSMChange") + 1);
- lstrcatA(protoname, "_TSMChange");
- TCHAR *str;
- DBVARIANT dbVar = {0};
- if (!db_get_ts(NULL, MODULE, protoname, &dbVar)) {
- str = GetStr(&smi, dbVar.ptszVal);
- db_free(&dbVar);
- }
- else
- {
- str = GetStr(&smi, TranslateT(DEFAULT_POPUP_STATUSMESSAGE));
- }
- mir_free(protoname);
-
- POPUPDATAT ppd = {0};
- ppd.lchContact = smi.hContact;
- ppd.lchIcon = LoadSkinnedProtoIcon(smi.proto, db_get_w(smi.hContact, smi.proto, "Status", ID_STATUS_ONLINE));
- lstrcpyn(ppd.lptzContactName, smi.cust, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, str, MAX_SECONDLINE);
- switch (opt.Colors) {
- case POPUP_COLOR_OWN:
- ppd.colorBack = StatusList[Index(db_get_w(smi.hContact, smi.proto, "Status", ID_STATUS_ONLINE))].colorBack;
- ppd.colorText = StatusList[Index(db_get_w(smi.hContact, smi.proto, "Status", ID_STATUS_ONLINE))].colorText;
- break;
- case POPUP_COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- break;
- case POPUP_COLOR_POPUP:
- ppd.colorBack = ppd.colorText = 0;
- break;
- }
- ppd.PluginWindowProc = PopupDlgProc;
- ppd.PluginData = NULL;
- ppd.iSeconds = opt.PopupTimeout;
- PUAddPopupT(&ppd);
- mir_free(str);
- }
- mir_free(smi.newstatusmsg);
- mir_free(smi.oldstatusmsg);
- return 1;
- }
+ TCHAR *str;
+ str = GetStr(smi, tmplt);
+
+ char *blob = mir_utf8encodeT(str);
+
+ DBEVENTINFO dbei = {0};
+ dbei.cbSize = sizeof(dbei);
+ dbei.cbBlob = (DWORD)strlen(blob) + 1;
+ dbei.pBlob = (PBYTE)blob;
+ dbei.eventType = EVENTTYPE_STATUSCHANGE;
+ dbei.flags = DBEF_READ | DBEF_UTF;
+
+ dbei.timestamp = (DWORD)time(NULL);
+ dbei.szModule = MODULE;
+ HANDLE hDBEvent = db_event_add(smi->hContact, &dbei);
+ mir_free(blob);
+ mir_free(str);
+
+ if (opt.SMsgLogToDB_WinOpen && opt.SMsgLogToDB_Remove) {
+ DBEVENT *dbevent = (DBEVENT *)mir_alloc(sizeof(DBEVENT));
+ dbevent->hContact = smi->hContact;
+ dbevent->hDBEvent = hDBEvent;
+ eventListSMsg.insert(dbevent);
}
- return 0;
}
-int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
+void GetStatusText(MCONTACT hContact, WORD newStatus, WORD oldStatus, TCHAR *stzStatusText)
{
- if (hContact == NULL)
- return 0;
-
- char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return 0;
-
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
- if (db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- if (ProcessExtraStatus(cws, hContact))
- return 0;
-
- ProcessStatus(cws, hContact);
- return 0;
-}
-
-int StatusModeChanged(WPARAM wParam, LPARAM lParam)
-{
- char *szProto = (char *)lParam;
- if (opt.AutoDisable && (!opt.OnlyGlobalChanges || szProto == NULL)) {
- if (opt.DisablePopupGlobally && ServiceExists(MS_POPUP_QUERY)) {
- char szSetting[12];
- mir_snprintf(szSetting, SIZEOF(szSetting), "p%d", wParam);
- BYTE hlpDisablePopup = db_get_b(0, MODULE, szSetting, 0);
-
- if (hlpDisablePopup != opt.PopupAutoDisabled) {
- BYTE hlpPopupStatus = (BYTE)CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0);
- opt.PopupAutoDisabled = hlpDisablePopup;
-
- if (hlpDisablePopup) {
- db_set_b(0, MODULE, "OldPopupStatus", hlpPopupStatus);
- CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
- }
- else {
- if (hlpPopupStatus == FALSE) {
- if (db_get_b(0, MODULE, "OldPopupStatus", TRUE) == TRUE)
- CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0);
- else
- CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
- }
- }
- }
- }
-
- if (opt.DisableSoundGlobally) {
- char szSetting[12];
- mir_snprintf(szSetting, SIZEOF(szSetting), "s%d", wParam);
- BYTE hlpDisableSound = db_get_b(0, MODULE, szSetting, 0);
-
- if (hlpDisableSound != opt.SoundAutoDisabled) {
- BYTE hlpUseSound = db_get_b(NULL, "Skin", "UseSound", 1);
- opt.SoundAutoDisabled = hlpDisableSound;
-
- if (hlpDisableSound) {
- db_set_b(0, MODULE, "OldUseSound", hlpUseSound);
- db_set_b(0, "Skin", "UseSound", FALSE);
- }
- else {
- if (hlpUseSound == FALSE)
- db_set_b(0, "Skin", "UseSound", db_get_b(0, MODULE, "OldUseSound", 1));
- }
- }
- }
- }
-
- return 0;
-}
-
-void GetStatusText(MCONTACT hContact, WORD newStatus, WORD oldStatus, TCHAR *stzStatusText) {
if (opt.UseAlternativeText) {
switch (GetGender(hContact)) {
case GENDER_MALE:
- _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzMStatusText, MAX_STATUSTEXT);
+ _tcsncpy(stzStatusText, _tcsninc(StatusList[Index(newStatus)].lpzMStatusText, 4), MAX_STATUSTEXT);
break;
case GENDER_FEMALE:
- _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzFStatusText, MAX_STATUSTEXT);
+ _tcsncpy(stzStatusText, _tcsninc(StatusList[Index(newStatus)].lpzFStatusText, 4), MAX_STATUSTEXT);
break;
case GENDER_UNSPECIFIED:
- _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzUStatusText, MAX_STATUSTEXT);
+ _tcsncpy(stzStatusText, _tcsninc(StatusList[Index(newStatus)].lpzUStatusText, 4), MAX_STATUSTEXT);
break;
}
}
- else _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzStandardText, MAX_STATUSTEXT);
+ else
+ _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzStandardText, MAX_STATUSTEXT);
if (opt.ShowPreviousStatus) {
TCHAR buff[MAX_STATUSTEXT];
@@ -638,93 +326,28 @@ void GetStatusText(MCONTACT hContact, WORD newStatus, WORD oldStatus, TCHAR *stz
}
}
-
-void ShowStatusChangePopup(MCONTACT hContact, char *szProto, WORD oldStatus, WORD newStatus)
-{
- WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
-
- POPUPDATAT ppd = {0};
- ppd.lchContact = hContact;
- ppd.lchIcon = LoadSkinnedProtoIcon(szProto, newStatus);
- _tcsncpy(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GSMDF_TCHAR), MAX_CONTACTNAME);
-
- if (opt.ShowGroup) { //add group name to popup title
- DBVARIANT dbv;
- if (!db_get_ts(hContact, "CList", "Group", &dbv)) {
- _tcsncat(ppd.lptzContactName, _T(" ("), MAX_CONTACTNAME);
- _tcsncat(ppd.lptzContactName, dbv.ptszVal, MAX_CONTACTNAME);
- _tcsncat(ppd.lptzContactName, _T(")"), MAX_CONTACTNAME);
- db_free(&dbv);
- }
- }
-
- TCHAR stzStatusText[MAX_SECONDLINE] = {0};
- if (opt.ShowStatus) {
- GetStatusText(hContact,newStatus,oldStatus,stzStatusText);
- }
-
- if (opt.ReadAwayMsg && myStatus != ID_STATUS_INVISIBLE && StatusHasAwayMessage(szProto, newStatus))
- db_set_ws(hContact, MODULE, "LastPopupText", stzStatusText);
-
- _tcsncpy(ppd.lptzText, stzStatusText, MAX_SECONDLINE);
-
- switch (opt.Colors) {
- case POPUP_COLOR_OWN:
- ppd.colorBack = StatusList[Index(newStatus)].colorBack;
- ppd.colorText = StatusList[Index(newStatus)].colorText;
- break;
- case POPUP_COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- break;
- case POPUP_COLOR_POPUP:
- ppd.colorBack = ppd.colorText = 0;
- break;
- }
-
- ppd.PluginWindowProc = PopupDlgProc;
-
- PLUGINDATA *pdp = (PLUGINDATA *)mir_calloc(sizeof(PLUGINDATA));
- pdp->oldStatus = oldStatus;
- pdp->newStatus = newStatus;
- pdp->hAwayMsgHook = NULL;
- pdp->hAwayMsgProcess = NULL;
- ppd.PluginData = pdp;
- ppd.iSeconds = opt.PopupTimeout;
- PUAddPopupT(&ppd);
-}
-
-void BlinkIcon(MCONTACT hContact, char* szProto, WORD status)
+void BlinkIcon(MCONTACT hContact, char *szProto, HICON hIcon, TCHAR *stzText)
{
CLISTEVENT cle = {0};
- TCHAR stzTooltip[256];
-
cle.cbSize = sizeof(cle);
cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR;
cle.hContact = hContact;
cle.hDbEvent = (HANDLE)hContact;
- cle.hIcon = (opt.BlinkIcon_Status ? LoadSkinnedProtoIcon(szProto, status) : LoadSkinnedIcon(SKINICON_OTHER_USERONLINE));
+ cle.hIcon = hIcon;
cle.pszService = "UserOnline/Description";
- cle.ptszTooltip = stzTooltip;
-
- mir_sntprintf(stzTooltip, SIZEOF(stzTooltip), TranslateT("%s is now %s"),
- CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), StatusList[Index(status)].lpzStandardText);
+ cle.ptszTooltip = stzText;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
-void PlayChangeSound(MCONTACT hContact, WORD oldStatus, WORD newStatus)
+void PlayChangeSound(MCONTACT hContact, const char *name)
{
- DBVARIANT dbv;
if (opt.UseIndSnd) {
+ DBVARIANT dbv;
TCHAR stzSoundFile[MAX_PATH] = {0};
- if (!db_get_ts(hContact, MODULE, "UserFromOffline", &dbv) && oldStatus == ID_STATUS_OFFLINE) {
+ if (!db_get_ts(hContact, MODULE, name, &dbv)) {
_tcscpy(stzSoundFile, dbv.ptszVal);
db_free(&dbv);
}
- else if (!db_get_ts(hContact, MODULE, StatusList[Index(newStatus)].lpzSkinSoundName, &dbv)) {
- lstrcpy(stzSoundFile, dbv.ptszVal);
- db_free(&dbv);
- }
if (stzSoundFile[0]) {
//Now make path to IndSound absolute, as it isn't registered
@@ -735,23 +358,21 @@ void PlayChangeSound(MCONTACT hContact, WORD oldStatus, WORD newStatus)
}
}
- if (!db_get_b(0, "SkinSoundsOff", "UserFromOffline", 0) && oldStatus == ID_STATUS_OFFLINE)
- SkinPlaySound("UserFromOffline");
- else if (!db_get_b(0, "SkinSoundsOff", StatusList[Index(newStatus)].lpzSkinSoundName, 0))
- SkinPlaySound(StatusList[Index(newStatus)].lpzSkinSoundName);
+ if (db_get_b(0, "SkinSoundsOff", name, 0) == 0)
+ SkinPlaySound(name);
}
-int ContactStatusChanged(MCONTACT hContact, WORD oldStatus,WORD newStatus)
+int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
{
- if(opt.LogToDB && (!opt.CheckMessageWindow || CheckMsgWnd(hContact))) {
- TCHAR stzStatusText[MAX_SECONDLINE] = {0};
- GetStatusText(hContact,newStatus,oldStatus,stzStatusText);
+ if (opt.LogToDB && (!opt.LogToDB_WinOpen || CheckMsgWnd(hContact))) {
+ TCHAR stzStatusText[MAX_SECONDLINE] = { 0 };
+ GetStatusText(hContact, newStatus, oldStatus, stzStatusText);
char *blob = mir_utf8encodeT(stzStatusText);
- DBEVENTINFO dbei = {0};
+ DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
dbei.cbBlob = (DWORD)strlen(blob) + 1;
- dbei.pBlob = (PBYTE) blob;
+ dbei.pBlob = (PBYTE)blob;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.flags = DBEF_READ | DBEF_UTF;
@@ -759,30 +380,19 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus,WORD newStatus)
dbei.szModule = MODULE;
HANDLE hDBEvent = db_event_add(hContact, &dbei);
mir_free(blob);
- }
- bool bEnablePopup = true, bEnableSound = true;
+ if (opt.LogToDB_WinOpen && opt.LogToDB_Remove) {
+ DBEVENT *dbevent = (DBEVENT *)mir_alloc(sizeof(DBEVENT));
+ dbevent->hContact = hContact;
+ dbevent->hDBEvent = hDBEvent;
+ eventListStatus.insert(dbevent);
+ }
+ }
+ bool bEnablePopup = true, bEnableSound = true;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL || opt.TempDisabled)
- return 0;
-
WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
- if (opt.EnableLastSeen && newStatus == ID_STATUS_OFFLINE && oldStatus > ID_STATUS_OFFLINE) {
- // A simple implementation of Last Seen module, please don't touch this.
- SYSTEMTIME systime;
- GetLocalTime(&systime);
-
- db_set_w(hContact, "SeenModule", "Year", systime.wYear);
- db_set_w(hContact, "SeenModule", "Month", systime.wMonth);
- db_set_w(hContact, "SeenModule", "Day", systime.wDay);
- db_set_w(hContact, "SeenModule", "Hours", systime.wHour);
- db_set_w(hContact, "SeenModule", "Minutes", systime.wMinute);
- db_set_w(hContact, "SeenModule", "Seconds", systime.wSecond);
- db_set_w(hContact, "SeenModule", "Status", oldStatus);
- }
-
if (!strcmp(szProto, META_PROTO)) { //this contact is Meta
MCONTACT hSubContact = db_mc_getMostOnline(hContact);
char *szSubProto = GetContactProto(hSubContact);
@@ -790,7 +400,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus,WORD newStatus)
return 0;
if (newStatus == ID_STATUS_OFFLINE) {
- // read last online proto for metaconatct if exists,
+ // read last online proto for metacontact if exists,
// to avoid notifying when meta went offline but default contact's proto still online
DBVARIANT dbv;
if (!db_get_s(hContact, szProto, "LastOnline", &dbv)) {
@@ -798,15 +408,16 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus,WORD newStatus)
db_free(&dbv);
}
}
- else db_set_s(hContact, szProto, "LastOnline", szSubProto);
+ else
+ db_set_s(hContact, szProto, "LastOnline", szSubProto);
- if (!db_get_b(0, MODULE, szSubProto, 1))
+ if (db_get_b(0, MODULE, szSubProto, 1) == 0)
return 0;
szProto = szSubProto;
}
else {
- if (myStatus == ID_STATUS_OFFLINE || !db_get_b(0, MODULE, szProto, 1))
+ if (myStatus == ID_STATUS_OFFLINE || db_get_b(0, MODULE, szProto, 1) == 0)
return 0;
}
@@ -820,10 +431,6 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus,WORD newStatus)
if (SkipHiddenContact(hContact))
return 0;
- // we don't want to be notified if new chatroom comes online
- if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
- return 0;
-
// check if that proto from which we received statuschange notification, isn't in autodisable list
if (opt.AutoDisable) {
char statusIDs[12], statusIDp[12];
@@ -833,21 +440,45 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus,WORD newStatus)
bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE;
}
- if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1))
- ShowStatusChangePopup(hContact, szProto, oldStatus, newStatus);
+ if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled) {
+ WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ TCHAR str[MAX_SECONDLINE] = {0};
+ if (opt.ShowStatus) {
+ GetStatusText(hContact, newStatus, oldStatus, str);
+ }
+
+ if (opt.ReadAwayMsg && myStatus != ID_STATUS_INVISIBLE && StatusHasAwayMessage(szProto, newStatus))
+ db_set_ws(hContact, MODULE, "LastPopupText", str);
+
+ PLUGINDATA *pdp = (PLUGINDATA *)mir_calloc(sizeof(PLUGINDATA));
+ pdp->oldStatus = oldStatus;
+ pdp->newStatus = newStatus;
+ pdp->hAwayMsgHook = NULL;
+ pdp->hAwayMsgProcess = NULL;
+ ShowChangePopup(hContact, szProto, LoadSkinnedProtoIcon(szProto, newStatus), newStatus, str, pdp);
+ }
- if (opt.BlinkIcon)
- BlinkIcon(hContact, szProto, newStatus);
+ if (opt.BlinkIcon && !opt.TempDisabled) {
+ HICON hIcon = opt.BlinkIcon_Status ? LoadSkinnedProtoIcon(szProto, newStatus) : LoadSkinnedIcon(SKINICON_OTHER_USERONLINE);
+ TCHAR str[256];
+ mir_sntprintf(str, SIZEOF(str), TranslateT("%s is now %s"),
+ CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), StatusList[Index(newStatus)].lpzStandardText);
+ BlinkIcon(hContact, szProto, hIcon, str);
+ }
- if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && db_get_b(hContact, MODULE, "EnableSounds", 1))
- PlayChangeSound(hContact, oldStatus, newStatus);
+ if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && db_get_b(hContact, MODULE, "EnableSounds", 1) && !opt.TempDisabled) {
+ if (oldStatus == ID_STATUS_OFFLINE)
+ PlayChangeSound(hContact, StatusListEx[ID_STATUS_FROMOFFLINE].lpzSkinSoundName);
+ else
+ PlayChangeSound(hContact, StatusList[Index(newStatus)].lpzSkinSoundName);
+ }
- if (opt.Log) {
- TCHAR stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[1024];
+ if (opt.LogToFile) {
+ TCHAR stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN];
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("HH':'mm"), stzTime, SIZEOF(stzTime));
GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("dd/MM/yyyy"), stzDate, SIZEOF(stzDate));
- mir_sntprintf(stzText, SIZEOF(stzText), TranslateT("%s, %s. %s changed to: %s (was: %s).\r\n"),
+ mir_sntprintf(stzText, SIZEOF(stzText), TranslateT("%s, %s. %s changed status to %s (was %s)\r\n"),
stzDate, stzTime, CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), StatusList[Index(newStatus)].lpzStandardText,
StatusList[Index(oldStatus)].lpzStandardText);
LogToFile(stzText);
@@ -856,13 +487,394 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus,WORD newStatus)
return 0;
}
+int ProcessStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
+{
+ WORD newStatus = cws->value.wVal;
+ if (newStatus < ID_STATUS_MIN || newStatus > ID_STATUS_MAX)
+ return 0;
+
+ char *szProto = GetContactProto(hContact);
+ if (strcmp(cws->szModule, szProto))
+ return 0;
+
+ // we don't want to be notified if new chatroom comes online
+ if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
+ return 0;
+
+ WORD oldStatus = DBGetContactSettingRangedWord(hContact, "UserOnline", "LastStatus", ID_STATUS_OFFLINE, ID_STATUS_MIN, ID_STATUS_MAX);
+ if (oldStatus == newStatus)
+ return 0;
+
+ //If we get here, the two statuses differ, so we can proceed.
+ db_set_w(hContact, "UserOnline", "LastStatus", newStatus);
+
+ // A simple implementation of Last Seen module, please don't touch this.
+ if (opt.EnableLastSeen && newStatus == ID_STATUS_OFFLINE && oldStatus > ID_STATUS_OFFLINE) {
+ SYSTEMTIME systime;
+ GetLocalTime(&systime);
+
+ db_set_w(hContact, "SeenModule", "Year", systime.wYear);
+ db_set_w(hContact, "SeenModule", "Month", systime.wMonth);
+ db_set_w(hContact, "SeenModule", "Day", systime.wDay);
+ db_set_w(hContact, "SeenModule", "Hours", systime.wHour);
+ db_set_w(hContact, "SeenModule", "Minutes", systime.wMinute);
+ db_set_w(hContact, "SeenModule", "Seconds", systime.wSecond);
+ db_set_w(hContact, "SeenModule", "Status", oldStatus);
+ }
+
+ //If *Miranda* ignores the UserOnline event, exit!
+ if (CallService(MS_IGNORE_ISIGNORED, hContact, IGNOREEVENT_USERONLINE))
+ return 0;
+
+ //If we get here, we have to notify the Hooks.
+ ContactStatusChanged(hContact, oldStatus, newStatus);
+ NotifyEventHooks(hHookContactStatusChanged, hContact, (LPARAM)MAKELPARAM(oldStatus, newStatus));
+ return 1;
+}
+
+int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
+{
+ XSTATUSCHANGE *xsc;
+ STATUSMSGINFO smi;
+ char *szProto = GetContactProto(hContact);
+ smi.hContact = hContact;
+
+ if (ProtoServiceExists(szProto, JS_PARSE_XMPP_URI)) {
+ if (strstr(cws->szSetting, "/mood/") || strstr(cws->szSetting, "/activity/")) { // Jabber mood or activity changed
+ char *szSetting;
+ int type;
+
+ if (strstr(cws->szSetting, "/mood/")) {
+ type = TYPE_JABBER_MOOD;
+ szSetting = "LastJabberMood";
+ }
+ else {
+ type = TYPE_JABBER_ACTIVITY;
+ szSetting = "LastJabberActivity";
+ }
+
+ if (strstr(cws->szSetting, "title")) {
+ smi.compare = CompareStatusMsg(&smi, cws, szSetting);
+ if (smi.compare == COMPARE_SAME) {
+ mir_free(smi.newstatusmsg);
+ mir_free(smi.oldstatusmsg);
+ }
+
+ if (cws->value.type == DBVT_DELETED)
+ db_unset(hContact, "UserOnline", szSetting);
+ else
+ db_set(hContact, "UserOnline", szSetting, &cws->value);
+
+ xsc = NewXSC(hContact, szProto, type, smi.compare, smi.newstatusmsg, NULL);
+ ExtraStatusChanged(xsc);
+ }
+ else if (strstr(cws->szSetting, "text")) {
+ char dbSetting[128];
+ mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%s", szSetting, "Msg");
+ smi.compare = CompareStatusMsg(&smi, cws, dbSetting);
+ if (smi.compare == COMPARE_SAME) {
+ mir_free(smi.newstatusmsg);
+ mir_free(smi.oldstatusmsg);
+ }
+
+ if (cws->value.type == DBVT_DELETED)
+ db_unset(hContact, "UserOnline", dbSetting);
+ else
+ db_set(hContact, "UserOnline", dbSetting, &cws->value);
+
+ xsc = NewXSC(hContact, szProto, type, smi.compare * 4, NULL, smi.newstatusmsg);
+ ExtraStatusChanged(xsc);
+ }
+ return 1;
+ }
+ }
+ else if (strstr(cws->szSetting, "XStatus")/* || strcmp(cws->szSetting, "StatusNote") == 0*/) {
+ if (strcmp(cws->szModule, szProto))
+ return 0;
+
+ if (strcmp(cws->szSetting, "XStatusName") == 0) {
+ smi.compare = CompareStatusMsg(&smi, cws, "LastXStatusName");
+ if (smi.compare == COMPARE_SAME) {
+ mir_free(smi.newstatusmsg);
+ mir_free(smi.oldstatusmsg);
+ }
+
+ if (cws->value.type == DBVT_DELETED)
+ db_unset(hContact, "UserOnline", "LastXStatusName");
+ else
+ db_set(hContact, "UserOnline", "LastXStatusName", &cws->value);
+
+ xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, smi.compare, smi.newstatusmsg, NULL);
+ ExtraStatusChanged(xsc);
+ }
+ else if (!strcmp(cws->szSetting, "XStatusMsg")/* || strcmp(cws->szSetting, "StatusNote") == 0*/) {
+ smi.compare = CompareStatusMsg(&smi, cws, "LastXStatusMsg");
+ if (smi.compare == COMPARE_SAME) {
+ mir_free(smi.newstatusmsg);
+ mir_free(smi.oldstatusmsg);
+ }
+
+ if (cws->value.type == DBVT_DELETED)
+ db_unset(hContact, "UserOnline", "LastXStatusMsg");
+ else
+ db_set(hContact, "UserOnline", "LastXStatusMsg", &cws->value);
+
+ xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, smi.compare * 4, NULL, smi.newstatusmsg);
+ ExtraStatusChanged(xsc);
+ }
+ return 1;
+ }
+
+ return 0;
+}
+
+int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
+{
+ STATUSMSGINFO smi;
+ bool bEnablePopup = true, bEnableSound = true;
+ char *szProto = GetContactProto(hContact);
+
+ smi.proto = szProto;
+ smi.hContact = hContact;
+ smi.compare = CompareStatusMsg(&smi, cws, "LastStatusMsg");
+ if (smi.compare == COMPARE_SAME)
+ goto skip_notify;
+
+ if (cws->value.type == DBVT_DELETED)
+ db_unset(hContact, "UserOnline", "LastStatusMsg");
+ else
+ db_set(hContact, "UserOnline", "LastStatusMsg", &cws->value);
+
+ //don't show popup when mradio connecting and disconnecting
+ if (_stricmp(szProto, "mRadio") == 0 && !cws->value.type == DBVT_DELETED) {
+ TCHAR buf[MAX_PATH];
+ mir_sntprintf(buf, SIZEOF(buf), _T(" (%s)"), TranslateT("connecting"));
+ ptrA pszUtf(mir_utf8encodeT(buf));
+ mir_sntprintf(buf, SIZEOF(buf), _T(" (%s)"), TranslateT("aborting"));
+ ptrA pszUtf2(mir_utf8encodeT(buf));
+ mir_sntprintf(buf, SIZEOF(buf), _T(" (%s)"), TranslateT("playing"));
+ ptrA pszUtf3(mir_utf8encodeT(buf));
+ if (_stricmp(cws->value.pszVal, pszUtf) == 0 || _stricmp(cws->value.pszVal, pszUtf2) == 0 || _stricmp(cws->value.pszVal, pszUtf3) == 0)
+ goto skip_notify;
+ }
+
+ // check per-contact ignored events
+ if (db_get_b(hContact, MODULE, "EnableSMsgNotify", 1) == 0)
+ bEnableSound = bEnablePopup = false;
+
+ // we're offline or just connecting
+ WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ if (myStatus == ID_STATUS_OFFLINE)
+ goto skip_notify;
+
+ char dbSetting[64];
+ mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", szProto);
+ // this proto is not set for status message notifications
+ if (db_get_b(NULL, MODULE, dbSetting, 1) == 0)
+ goto skip_notify;
+ mir_snprintf(dbSetting, SIZEOF(dbSetting), "%d", IDC_CHK_STATUS_MESSAGE);
+ // status message change notifications are disabled
+ if (db_get_b(NULL, MODULE, dbSetting, 1) == 0)
+ goto skip_notify;
+
+ if (SkipHiddenContact(hContact))
+ goto skip_notify;
+
+ // check if our status isn't on autodisable list
+ if (opt.AutoDisable) {
+ char statusIDs[12], statusIDp[12];
+ mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus);
+ mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus);
+ bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : bEnableSound;
+ bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : bEnablePopup;
+ }
+
+ // check flags
+ if ((!(templates.PopupSMsgFlags & NOTIFY_REMOVE_MESSAGE) && (smi.compare == COMPARE_DEL))
+ || (!(templates.PopupSMsgFlags & NOTIFY_NEW_MESSAGE) && (smi.compare == COMPARE_DIFF)))
+ bEnablePopup = false;
+
+ if (db_get_b(0, MODULE, szProto, 1) == 0 && !opt.PSMsgOnConnect)
+ bEnablePopup = false;
+
+ if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled) {
+ // cut message if needed
+ TCHAR *copyText = NULL;
+ if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (_tcslen(smi.newstatusmsg) > opt.PSMsgLen)) {
+ TCHAR buff[MAX_TEXT_LEN + 3];
+ copyText = mir_tstrdup(smi.newstatusmsg);
+ _tcsncpy(buff, smi.newstatusmsg, opt.PSMsgLen);
+ buff[opt.PSMsgLen] = 0;
+ _tcscat(buff, _T("..."));
+ mir_free(smi.newstatusmsg);
+ smi.newstatusmsg = mir_tstrdup(buff);
+ }
+
+ TCHAR *str, protoname[MAX_PATH] = { 0 };
+ char *szprotoname;
+ PROTOACCOUNT *pa = ProtoGetAccount(szProto);
+ if (smi.compare == COMPARE_DEL) {
+ mir_sntprintf(protoname, SIZEOF(protoname), _T("%s_TPopupSMsgRemoved"), pa->tszAccountName);
+ szprotoname = mir_t2a(protoname);
+ DBVARIANT dbVar = { 0 };
+ db_get_ts(NULL, MODULE, szprotoname, &dbVar);
+ if (lstrcmp(dbVar.ptszVal, NULL) == 0) {
+ db_free(&dbVar);
+ str = GetStr(&smi, DEFAULT_POPUP_SMSGREMOVED);
+ }
+ else str = GetStr(&smi, dbVar.ptszVal);
+ }
+ else {
+ mir_sntprintf(protoname, SIZEOF(protoname), _T("%s_TPopupSMsgChanged"), pa->tszAccountName);
+ szprotoname = mir_t2a(protoname);
+ DBVARIANT dbVar = { 0 };
+ db_get_ts(NULL, MODULE, szprotoname, &dbVar);
+ if (lstrcmp(dbVar.ptszVal, NULL) == 0) {
+ db_free(&dbVar);
+ str = GetStr(&smi, DEFAULT_POPUP_SMSGCHANGED);
+ }
+ else str = GetStr(&smi, dbVar.ptszVal);
+ }
+ mir_free(szprotoname);
+
+ ShowChangePopup(hContact, szProto,
+ LoadSkinnedProtoIcon(szProto, db_get_w(hContact, szProto, "Status", ID_STATUS_ONLINE)),
+ ID_STATUS_STATUSMSG, str);
+
+ mir_free(str);
+
+ if (copyText) {
+ mir_free(smi.newstatusmsg);
+ smi.newstatusmsg = mir_tstrdup(copyText);
+ mir_free(copyText);
+ }
+ }
+
+ if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && !opt.TempDisabled) {
+ HICON hIcon = opt.BlinkIcon_Status ? LoadSkinnedProtoIcon(szProto, db_get_w(hContact, szProto, "Status", ID_STATUS_ONLINE)) : LoadSkinnedIcon(SKINICON_OTHER_USERONLINE);
+ TCHAR str[256];
+ mir_sntprintf(str, SIZEOF(str), TranslateT("%s changed status message to %s"),
+ CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), smi.newstatusmsg);
+ BlinkIcon(hContact, szProto, hIcon, str);
+ }
+
+ if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && db_get_b(hContact, MODULE, "EnableSounds", 1) && !opt.TempDisabled) {
+ if (smi.compare == COMPARE_DEL)
+ PlayChangeSound(hContact, StatusListEx[ID_STATUS_SMSGREMOVED].lpzSkinSoundName);
+ else
+ PlayChangeSound(hContact, StatusListEx[ID_STATUS_SMSGCHANGED].lpzSkinSoundName);
+ }
+
+ BOOL bEnableLog = opt.SMsgLogToDB && db_get_b(hContact, MODULE, "EnableSMsgLogging", 1);
+ if (bEnableLog && (!opt.SMsgLogToDB_WinOpen || CheckMsgWnd(hContact)))
+ LogSMsgToDB(&smi, smi.compare == COMPARE_DEL ? templates.LogSMsgRemoved : templates.LogSMsgChanged);
+
+ if (opt.SMsgLogToFile && db_get_b(hContact, MODULE, "EnableSMsgLogging", 1)) {
+ TCHAR stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN];
+
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("HH':'mm"), stzTime, SIZEOF(stzTime));
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("dd/MM/yyyy"), stzDate, SIZEOF(stzDate));
+
+ TCHAR *str;
+ if (smi.compare == COMPARE_DEL)
+ str = GetStr(&smi, templates.LogSMsgRemoved);
+ else
+ str = GetStr(&smi, templates.LogSMsgChanged);
+
+ mir_sntprintf(stzText, SIZEOF(stzText), TranslateT("%s, %s. %s %s\r\n"), stzDate, stzTime,
+ CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), str);
+
+ LogToFile(stzText);
+ mir_free(str);
+ }
+skip_notify:
+ mir_free(smi.newstatusmsg);
+ mir_free(smi.oldstatusmsg);
+ return 1;
+}
+
+int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
+{
+ if (hContact == NULL)
+ return 0;
+
+ char *szProto = GetContactProto(hContact);
+ if (szProto == NULL)
+ return 0;
+
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
+ if (db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ if (ProcessExtraStatus(cws, hContact))
+ return 1;
+
+ if (!strcmp(cws->szSetting, "Status"))
+ if (ProcessStatus(cws, hContact))
+ return 1;
+
+ if (!strcmp(cws->szModule, "CList") && !strcmp(cws->szSetting, "StatusMsg"))
+ if (ProcessStatusMessage(cws, hContact))
+ return 1;
+
+ return 0;
+}
+
+int StatusModeChanged(WPARAM wParam, LPARAM lParam)
+{
+ char *szProto = (char *)lParam;
+ if (opt.AutoDisable && (!opt.OnlyGlobalChanges || szProto == NULL)) {
+ if (opt.DisablePopupGlobally && ServiceExists(MS_POPUP_QUERY)) {
+ char szSetting[12];
+ mir_snprintf(szSetting, SIZEOF(szSetting), "p%d", wParam);
+ BYTE hlpDisablePopup = db_get_b(0, MODULE, szSetting, 0);
+
+ if (hlpDisablePopup != opt.PopupAutoDisabled) {
+ BYTE hlpPopupStatus = (BYTE)CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0);
+ opt.PopupAutoDisabled = hlpDisablePopup;
+
+ if (hlpDisablePopup) {
+ db_set_b(0, MODULE, "OldPopupStatus", hlpPopupStatus);
+ CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
+ }
+ else {
+ if (hlpPopupStatus == FALSE) {
+ if (db_get_b(0, MODULE, "OldPopupStatus", TRUE) == TRUE)
+ CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0);
+ else
+ CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
+ }
+ }
+ }
+ }
+
+ if (opt.DisableSoundGlobally) {
+ char szSetting[12];
+ mir_snprintf(szSetting, SIZEOF(szSetting), "s%d", wParam);
+ BYTE hlpDisableSound = db_get_b(0, MODULE, szSetting, 0);
+
+ if (hlpDisableSound != opt.SoundAutoDisabled) {
+ BYTE hlpUseSound = db_get_b(NULL, "Skin", "UseSound", 1);
+ opt.SoundAutoDisabled = hlpDisableSound;
+
+ if (hlpDisableSound) {
+ db_set_b(0, MODULE, "OldUseSound", hlpUseSound);
+ db_set_b(0, "Skin", "UseSound", FALSE);
+ }
+ else {
+ if (hlpUseSound == FALSE)
+ db_set_b(0, "Skin", "UseSound", db_get_b(0, MODULE, "OldUseSound", 1));
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
void InitStatusList()
{
int index = 0;
//Online
index = Index(ID_STATUS_ONLINE);
- StatusList[index].ID = ID_STATUS_ONLINE;
- StatusList[index].icon = SKINICON_STATUS_ONLINE;
lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) is back online!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) is back online!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) is back online!"), MAX_STATUSTEXT);
@@ -875,8 +887,6 @@ void InitStatusList()
//Offline
index = Index(ID_STATUS_OFFLINE);
- StatusList[index].ID = ID_STATUS_OFFLINE;
- StatusList[index].icon = SKINICON_STATUS_OFFLINE;
lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) went offline! :("), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) went offline! :("), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) went offline! :("), MAX_STATUSTEXT);
@@ -889,8 +899,6 @@ void InitStatusList()
//Invisible
index = Index(ID_STATUS_INVISIBLE);
- StatusList[index].ID = ID_STATUS_INVISIBLE;
- StatusList[index].icon = SKINICON_STATUS_INVISIBLE;
lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) hides in shadows..."), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) hides in shadows..."), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) hides in shadows..."), MAX_STATUSTEXT);
@@ -903,25 +911,21 @@ void InitStatusList()
//Free for chat
index = Index(ID_STATUS_FREECHAT);
- StatusList[index].ID = ID_STATUS_FREECHAT;
- StatusList[index].icon = SKINICON_STATUS_FREE4CHAT;
lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) feels talkative!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) feels talkative!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) feels talkative!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Free for chat"), MAX_STANDARDTEXT);
lstrcpynA(StatusList[index].lpzSkinSoundName, "UserFreeForChat", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Free For Chat"), MAX_SKINSOUNDDESC);
+ lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Free for chat"), MAX_SKINSOUNDDESC);
lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("free4chat.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40077bg", COLOR_BG_AVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40077tx", COLOR_TX_DEFAULT);
//Away
index = Index(ID_STATUS_AWAY);
- StatusList[index].ID = ID_STATUS_AWAY;
- StatusList[index].icon = SKINICON_STATUS_AWAY;
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) went Away"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) went Away"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) went Away"), MAX_STATUSTEXT);
+ lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) went away"), MAX_STATUSTEXT);
+ lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) went away"), MAX_STATUSTEXT);
+ lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) went away"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Away"), MAX_STANDARDTEXT);
lstrcpynA(StatusList[index].lpzSkinSoundName, "UserAway", MAX_SKINSOUNDNAME);
lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Away"), MAX_SKINSOUNDDESC);
@@ -931,25 +935,21 @@ void InitStatusList()
//NA
index = Index(ID_STATUS_NA);
- StatusList[index].ID = ID_STATUS_NA;
- StatusList[index].icon = SKINICON_STATUS_NA;
lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) isn't there anymore!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) isn't there anymore!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) isn't there anymore!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzStandardText, TranslateT("NA"), MAX_STANDARDTEXT);
lstrcpynA(StatusList[index].lpzSkinSoundName, "UserNA", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Not Available"), MAX_SKINSOUNDDESC);
+ lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Not available"), MAX_SKINSOUNDDESC);
lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("na.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40075bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40075tx", COLOR_TX_DEFAULT);
//Occupied
index = Index(ID_STATUS_OCCUPIED);
- StatusList[index].ID = ID_STATUS_OCCUPIED;
- StatusList[index].icon = SKINICON_STATUS_OCCUPIED;
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) has something else to do."), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) has something else to do."), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) has something else to do."), MAX_STATUSTEXT);
+ lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) has something else to do"), MAX_STATUSTEXT);
+ lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) has something else to do"), MAX_STATUSTEXT);
+ lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) has something else to do"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Occupied"), MAX_STANDARDTEXT);
lstrcpynA(StatusList[index].lpzSkinSoundName, "UserOccupied", MAX_SKINSOUNDNAME);
lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Occupied"), MAX_SKINSOUNDDESC);
@@ -959,68 +959,101 @@ void InitStatusList()
//DND
index = Index(ID_STATUS_DND);
- StatusList[index].ID = ID_STATUS_DND;
- StatusList[index].icon = SKINICON_STATUS_DND;
lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) doesn't want to be disturbed!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) doesn't want to be disturbed!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) doesn't want to be disturbed!"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzStandardText, TranslateT("DND"), MAX_STANDARDTEXT);
lstrcpynA(StatusList[index].lpzSkinSoundName, "UserDND", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Do Not Disturb"), MAX_SKINSOUNDDESC);
+ lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Do not disturb"), MAX_SKINSOUNDDESC);
lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("dnd.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40074bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40074tx", COLOR_TX_DEFAULT);
- //OutToLunch
+ //Out to lunch
index = Index(ID_STATUS_OUTTOLUNCH);
- StatusList[index].ID = ID_STATUS_OUTTOLUNCH;
- StatusList[index].icon = SKINICON_STATUS_OUTTOLUNCH;
lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) is eating something"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) is eating something"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) is eating something"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Out to lunch"), MAX_STANDARDTEXT);
lstrcpynA(StatusList[index].lpzSkinSoundName, "UserOutToLunch", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Out To Lunch"), MAX_SKINSOUNDDESC);
+ lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Out to lunch"), MAX_SKINSOUNDDESC);
lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("lunch.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40080bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40080tx", COLOR_TX_DEFAULT);
- //OnThePhone
+ //On the phone
index = Index(ID_STATUS_ONTHEPHONE);
- StatusList[index].ID = ID_STATUS_ONTHEPHONE;
- StatusList[index].icon = SKINICON_STATUS_ONTHEPHONE;
lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) had to answer the phone"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) had to answer the phone"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) had to answer the phone"), MAX_STATUSTEXT);
lstrcpyn(StatusList[index].lpzStandardText, TranslateT("On the phone"), MAX_STANDARDTEXT);
lstrcpynA(StatusList[index].lpzSkinSoundName, "UserOnThePhone", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: On The Phone"), MAX_SKINSOUNDDESC);
+ lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: On the phone"), MAX_SKINSOUNDDESC);
lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("phone.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40079bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40079tx", COLOR_TX_DEFAULT);
//Extra status
index = Index(ID_STATUS_EXTRASTATUS);
- StatusList[index].ID = ID_STATUS_EXTRASTATUS;
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40081bg", COLOR_BG_AVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40081tx", COLOR_TX_DEFAULT);
+
+ //Status message
+ index = Index(ID_STATUS_STATUSMSG);
+ StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40082bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(NULL, MODULE, "40082tx", COLOR_TX_DEFAULT);
+
+ //From offline
+ index = ID_STATUS_FROMOFFLINE;
+ lstrcpynA(StatusListEx[index].lpzSkinSoundName, "UserFromOffline", MAX_SKINSOUNDNAME);
+ lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("User: from offline (has priority!)"), MAX_SKINSOUNDDESC);
+
+ //Status message removed
+ index = ID_STATUS_SMSGREMOVED;
+ lstrcpynA(StatusListEx[index].lpzSkinSoundName, "StatusMsgRemoved", MAX_SKINSOUNDNAME);
+ lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Status message removed"), MAX_SKINSOUNDDESC);
+
+ //Status message changed
+ index = ID_STATUS_SMSGCHANGED;
+ lstrcpynA(StatusListEx[index].lpzSkinSoundName, "StatusMsgChanged", MAX_SKINSOUNDNAME);
+ lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Status message changed"), MAX_SKINSOUNDDESC);
+
+ //Extra status removed
+ index = ID_STATUS_XREMOVED;
+ lstrcpynA(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_REMOVED, MAX_SKINSOUNDNAME);
+ lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status removed"), MAX_SKINSOUNDDESC);
+
+ //Extra status message changed
+ index = ID_STATUS_XMSGCHANGED;
+ lstrcpynA(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGCHANGED, MAX_SKINSOUNDNAME);
+ lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status message changed"), MAX_SKINSOUNDDESC);
+
+ //Extra status changed
+ index = ID_STATUS_XCHANGED;
+ lstrcpynA(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_CHANGED, MAX_SKINSOUNDNAME);
+ lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status changed"), MAX_SKINSOUNDDESC);
+
+ //Extra status message removed
+ index = ID_STATUS_XMSGREMOVED;
+ lstrcpynA(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGREMOVED, MAX_SKINSOUNDNAME);
+ lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status message removed"), MAX_SKINSOUNDDESC);
}
-VOID CALLBACK ConnectionTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+VOID CALLBACK ConnectionTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
if (uMsg == WM_TIMER) {
KillTimer(hwnd, idEvent);
//We've received a timer message: enable the popups for a specified protocol.
char szProto[256];
- if ( GetAtomNameA((ATOM)idEvent, szProto, sizeof(szProto)) > 0) {
+ if (GetAtomNameA((ATOM)idEvent, szProto, sizeof(szProto)) > 0) {
db_set_b(0, MODULE, szProto, 1);
DeleteAtom((ATOM)idEvent);
}
}
}
-int ProtoAck(WPARAM wParam,LPARAM lParam)
+int ProtoAck(WPARAM wParam, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA *)lParam;
@@ -1041,7 +1074,7 @@ int ProtoAck(WPARAM wParam,LPARAM lParam)
//Enable the popups for this protocol.
int idTimer = AddAtomA(szProto);
if (idTimer)
- SetTimer(SecretWnd, idTimer, (UINT)opt.PopupConnectionTimeout*1000, ConnectionTimerProc);
+ SetTimer(SecretWnd, idTimer, (UINT)opt.PopupConnectionTimeout * 1000, ConnectionTimerProc);
}
}
@@ -1083,8 +1116,8 @@ void InitMainMenuItem()
static IconItem iconList[] =
{
- { LPGEN("Notification enabled"), ICO_NOTIFICATION_OFF, IDI_NOTIFICATION_OFF },
- { LPGEN("Notification disabled"), ICO_NOTIFICATION_ON, IDI_NOTIFICATION_ON }
+ { LPGEN("Notification enabled"), ICO_NOTIFICATION_OFF, IDI_NOTIFICATION_OFF },
+ { LPGEN("Notification disabled"), ICO_NOTIFICATION_ON, IDI_NOTIFICATION_ON }
};
void InitIcolib()
@@ -1097,10 +1130,8 @@ void InitSound()
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
SkinAddNewSoundExT(StatusList[Index(i)].lpzSkinSoundName, LPGENT("Status Notify"), StatusList[Index(i)].lpzSkinSoundDesc);
- SkinAddNewSoundExT("UserFromOffline", LPGENT("Status Notify"), LPGENT("User: from offline (has priority!)"));
- SkinAddNewSoundExT(XSTATUS_SOUND_CHANGED, LPGENT("Status Notify"), LPGENT("Extra status changed"));
- SkinAddNewSoundExT(XSTATUS_SOUND_MSGCHANGED, LPGENT("Status Notify"), LPGENT("Extra status message changed"));
- SkinAddNewSoundExT(XSTATUS_SOUND_REMOVED, LPGENT("Status Notify"), LPGENT("Extra status removed"));
+ for (int i = 0; i <= ID_STATUSEX_MAX; i++)
+ SkinAddNewSoundExT(StatusListEx[i].lpzSkinSoundName, LPGENT("Status Notify"), StatusListEx[i].lpzSkinSoundDesc);
}
int InitTopToolbar(WPARAM, LPARAM)
@@ -1126,9 +1157,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent);
HookEvent(ME_TTB_MODULELOADED, InitTopToolbar);
- SecretWnd = CreateWindowEx(WS_EX_TOOLWINDOW,_T("static"),_T("ConnectionTimerWindow"),0,
- CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,HWND_DESKTOP,
- NULL,hInst,NULL);
+ SecretWnd = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), _T("ConnectionTimerWindow"), 0,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP,
+ NULL, hInst, NULL);
int count = 0;
PROTOACCOUNT **accounts = NULL;
@@ -1152,12 +1183,16 @@ extern "C" int __declspec(dllexport) Load(void)
//"Service" Hook, used when the DB settings change: we'll monitor the "status" setting.
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
+
//We create this Hook which will notify everyone when a contact changes his status.
hHookContactStatusChanged = CreateHookableEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED);
+
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
+
//We add the option page and the user info page (it's needed because options are loaded after plugins)
HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
+
//This is needed for "NoSound"-like routines.
HookEvent(ME_CLIST_STATUSMODECHANGE, StatusModeChanged);
HookEvent(ME_PROTO_ACK, ProtoAck);
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp
index e7b3d3b9ba..d63f90feec 100644
--- a/plugins/NewXstatusNotify/src/options.cpp
+++ b/plugins/NewXstatusNotify/src/options.cpp
@@ -31,93 +31,121 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
void LoadTemplates()
{
- DBGetStringDefault(0, MODULE, "TPopupDelimiter", templates.PopupDelimiter, SIZEOF(templates.PopupDelimiter), DEFAULT_POPUP_DELIMITER);
- DBGetStringDefault(0, MODULE, "TPopupChange", templates.PopupNewXstatus, SIZEOF(templates.PopupNewXstatus), DEFAULT_POPUP_NEW);
- DBGetStringDefault(0, MODULE, "TPopupChangeMsg", templates.PopupNewMsg, SIZEOF(templates.PopupNewMsg), DEFAULT_POPUP_CHANGEMSG);
- DBGetStringDefault(0, MODULE, "TPopupRemoval", templates.PopupRemove, SIZEOF(templates.PopupRemove), DEFAULT_POPUP_REMOVE);
-
- DBGetStringDefault(0, MODULE, "TLogDelimiter", templates.LogDelimiter, SIZEOF(templates.LogDelimiter), DEFAULT_LOG_DELIMITER);
- DBGetStringDefault(0, MODULE, "TLogChange", templates.LogNewXstatus, SIZEOF(templates.LogNewXstatus), DEFAULT_LOG_NEW);
- DBGetStringDefault(0, MODULE, "TLogChangeMsg", templates.LogNewMsg, SIZEOF(templates.LogNewMsg), DEFAULT_LOG_CHANGEMSG);
- DBGetStringDefault(0, MODULE, "TLogRemoval", templates.LogRemove, SIZEOF(templates.LogRemove), DEFAULT_LOG_REMOVE);
- DBGetStringDefault(0, MODULE, "TLogOpening", templates.LogOpening, SIZEOF(templates.LogOpening), DEFAULT_LOG_OPENING);
- templates.PopupFlags = db_get_b(0, MODULE, "TPopupFlags", NOTIFY_NEW_XSTATUS | NOTIFY_NEW_MESSAGE);
- templates.LogFlags = db_get_b(0, MODULE, "TLogFlags", NOTIFY_NEW_XSTATUS | NOTIFY_NEW_MESSAGE | NOTIFY_OPENING_ML);
+ DBGetStringDefault(0, MODULE, "TPopupXChanged", templates.PopupXstatusChanged, SIZEOF(templates.PopupXstatusChanged), DEFAULT_POPUP_CHANGED);
+ DBGetStringDefault(0, MODULE, "TPopupXRemoved", templates.PopupXstatusRemoved, SIZEOF(templates.PopupXstatusRemoved), DEFAULT_POPUP_REMOVED);
+ DBGetStringDefault(0, MODULE, "TPopupXMsgChanged", templates.PopupXMsgChanged, SIZEOF(templates.PopupXMsgChanged), DEFAULT_POPUP_MSGCHANGED);
+ DBGetStringDefault(0, MODULE, "TPopupXMsgRemoved", templates.PopupXMsgRemoved, SIZEOF(templates.PopupXMsgRemoved), DEFAULT_POPUP_MSGREMOVED);
+
+ DBGetStringDefault(0, MODULE, "TLogXChanged", templates.LogXstatusChanged, SIZEOF(templates.LogXstatusChanged), DEFAULT_LOG_CHANGED);
+ DBGetStringDefault(0, MODULE, "TLogXRemoved", templates.LogXstatusRemoved, SIZEOF(templates.LogXstatusRemoved), DEFAULT_LOG_REMOVED);
+ DBGetStringDefault(0, MODULE, "TLogXMsgChanged", templates.LogXMsgChanged, SIZEOF(templates.LogXMsgChanged), DEFAULT_LOG_MSGCHANGED);
+ DBGetStringDefault(0, MODULE, "TLogXMsgRemoved", templates.LogXMsgRemoved, SIZEOF(templates.LogXMsgRemoved), DEFAULT_LOG_MSGREMOVED);
+ DBGetStringDefault(0, MODULE, "TLogXOpening", templates.LogXstatusOpening, SIZEOF(templates.LogXstatusOpening), DEFAULT_LOG_OPENING);
+
+ DBGetStringDefault(0, MODULE, "TLogSMsgChanged", templates.LogSMsgChanged, SIZEOF(templates.LogSMsgChanged), DEFAULT_LOG_SMSGCHANGED);
+ DBGetStringDefault(0, MODULE, "TLogSMsgRemoved", templates.LogSMsgRemoved, SIZEOF(templates.LogSMsgRemoved), DEFAULT_LOG_SMSGREMOVED);
+ DBGetStringDefault(0, MODULE, "TLogSMsgOpening", templates.LogSMsgOpening, SIZEOF(templates.LogSMsgOpening), DEFAULT_LOG_SMSGOPENING);
+
+ templates.PopupXFlags = db_get_b(0, MODULE, "TPopupXFlags", NOTIFY_NEW_XSTATUS | NOTIFY_NEW_MESSAGE);
+ templates.PopupSMsgFlags = db_get_b(0, MODULE, "TPopupSMsgFlags", NOTIFY_NEW_MESSAGE);
+ templates.LogXFlags = db_get_b(0, MODULE, "TLogXFlags", NOTIFY_NEW_XSTATUS | NOTIFY_NEW_MESSAGE | NOTIFY_OPENING_ML);
+ templates.LogSMsgFlags = db_get_b(0, MODULE, "TLogSMsgFlags", NOTIFY_NEW_MESSAGE | NOTIFY_OPENING_ML);
}
-void LoadOptions()
+void LoadOptions()
{
// IDD_OPT_POPUP
- opt.Colors = db_get_b(0,MODULE, "Colors", DEFAULT_COLORS);
- opt.ShowGroup = db_get_b(0, MODULE, "ShowGroup", 0);
- opt.ShowStatus = db_get_b(0, MODULE, "ShowStatus", 1);
- opt.UseAlternativeText = db_get_b(0, MODULE, "UseAlternativeText", 0);
- opt.ShowPreviousStatus = db_get_b(0, MODULE, "ShowPreviousStatus", 0);
- opt.ReadAwayMsg = db_get_b(0, MODULE, "ReadAwayMsg", 0);
- opt.PopupTimeout = db_get_dw(0, MODULE, "PopupTimeout", 0);
+ opt.Colors = db_get_b(0, MODULE, "Colors", DEFAULT_COLORS);
+ opt.ShowGroup = db_get_b(0, MODULE, "ShowGroup", 0);
+ opt.ShowStatus = db_get_b(0, MODULE, "ShowStatus", 1);
+ opt.UseAlternativeText = db_get_b(0, MODULE, "UseAlternativeText", 0);
+ opt.ShowPreviousStatus = db_get_b(0, MODULE, "ShowPreviousStatus", 0);
+ opt.ReadAwayMsg = db_get_b(0, MODULE, "ReadAwayMsg", 0);
+ opt.PopupTimeout = db_get_dw(0, MODULE, "PopupTimeout", 0);
opt.PopupConnectionTimeout = db_get_dw(0, MODULE, "PopupConnectionTimeout", 15);
- opt.LeftClickAction= db_get_b(0, MODULE, "LeftClickAction", 5);
- opt.RightClickAction = db_get_b(0, MODULE, "RightClickAction", 1);
- opt.IgnoreEmpty = db_get_b(0, MODULE, "IgnoreEmpty", 1);
+ opt.LeftClickAction = db_get_b(0, MODULE, "LeftClickAction", 5);
+ opt.RightClickAction = db_get_b(0, MODULE, "RightClickAction", 1);
// IDD_OPT_XPOPUP
- opt.PDisableForMusic = db_get_b(0, MODULE, "PDisableForMusic", 1);
- opt.PTruncateMsg = db_get_b(0, MODULE, "PTruncateMsg", 0);
- opt.PMsgLen = db_get_dw(0, MODULE, "PMsgLen", 64);
+ opt.PXOnConnect = db_get_b(0, MODULE, "PXOnConnect", 0);
+ opt.PXDisableForMusic = db_get_b(0, MODULE, "PXDisableForMusic", 1);
+ opt.PXMsgTruncate = db_get_b(0, MODULE, "PXMsgTruncate", 0);
+ opt.PXMsgLen = db_get_dw(0, MODULE, "PXMsgLen", 64);
// IDD_OPT_GENERAL
- opt.FromOffline = db_get_b(0, MODULE, "FromOffline", 1);
- opt.AutoDisable = db_get_b(0, MODULE, "AutoDisable", 0);
- opt.HiddenContactsToo = db_get_b(0, MODULE, "HiddenContactsToo", 0);
- opt.UseIndSnd = db_get_b(0, MODULE, "UseIndSounds", 1);
- opt.BlinkIcon = db_get_b(0, MODULE, "BlinkIcon", 0);
- opt.BlinkIcon_Status = db_get_b(0, MODULE, "BlinkIcon_Status", 0);
- opt.Log = db_get_b(0, MODULE, "Log", 0);
- opt.LogToDB = db_get_b(0, MODULE, "LogToDB", 0);
- opt.CheckMessageWindow = db_get_b(0, MODULE, "CheckMessageWindow", 1);
+ opt.FromOffline = db_get_b(0, MODULE, "FromOffline", 1);
+ opt.AutoDisable = db_get_b(0, MODULE, "AutoDisable", 0);
+ opt.HiddenContactsToo = db_get_b(0, MODULE, "HiddenContactsToo", 0);
+ opt.UseIndSnd = db_get_b(0, MODULE, "UseIndSounds", 1);
+ opt.BlinkIcon = db_get_b(0, MODULE, "BlinkIcon", 0);
+ opt.BlinkIcon_Status = db_get_b(0, MODULE, "BlinkIcon_Status", 0);
+ opt.BlinkIcon_ForMsgs = db_get_b(0, MODULE, "BlinkIcon_ForMsgs", 0);
DBGetStringDefault(0, MODULE, "LogFilePath", opt.LogFilePath, MAX_PATH, _T(""));
// IDD_AUTODISABLE
- opt.OnlyGlobalChanges = db_get_b(0, MODULE, "OnlyGlobalChanges", 0);
+ opt.OnlyGlobalChanges = db_get_b(0, MODULE, "OnlyGlobalChanges", 0);
opt.DisablePopupGlobally = db_get_b(0, MODULE, "DisablePopupGlobally", 0);
opt.DisableSoundGlobally = db_get_b(0, MODULE, "DisableSoundGlobally", 0);
+ // IDD_OPT_LOG
+ opt.LogToFile = db_get_b(0, MODULE, "LogToFile", 0);
+ opt.LogToDB = db_get_b(0, MODULE, "LogToDB", 0);
+ opt.LogToDB_WinOpen = db_get_b(0, MODULE, "LogToDB_WinOpen", 1);
+ opt.LogToDB_Remove = db_get_b(0, MODULE, "LogToDB_Remove", 0);
+ opt.LogPrevious = db_get_b(0, MODULE, "LogToPrevious", 0);
+ opt.SMsgLogToFile = db_get_b(0, MODULE, "SMsgLogToFile", 0);
+ opt.SMsgLogToDB = db_get_b(0, MODULE, "SMsgLogToDB", 0);
+ opt.SMsgLogToDB_WinOpen = db_get_b(0, MODULE, "SMsgLogToDB_WinOpen", 1);
+ opt.SMsgLogToDB_Remove = db_get_b(0, MODULE, "SMsgLogToDB_Remove", 0);
// IDD_OPT_XLOG
- opt.EnableLogging = db_get_b(0, MODULE, "EnableLogging", 0);
- opt.PreventIdentical = db_get_b(0, MODULE, "PreventIdentical", 1);
- opt.KeepInHistory = db_get_b(0, MODULE, "KeepInHistory", 0);
- opt.LDisableForMusic = db_get_b(0, MODULE, "LDisableForMusic", 1);
- opt.LTruncateMsg = db_get_b(0, MODULE, "LTruncateMsg", 0);
- opt.LMsgLen = db_get_dw(0, MODULE, "LMsgLen", 128);
- //IDD_OPT_SMPOPUP
- opt.PopupOnConnect = db_get_b(0, MODULE, "PopupOnConnect", 0);
+ opt.XLogToFile = db_get_b(0, MODULE, "XLogToFile", 0);
+ opt.XLogToDB = db_get_b(0, MODULE, "XLogToDB", 0);
+ opt.XLogToDB_WinOpen = db_get_b(0, MODULE, "XLogToDB_WinOpen", 1);
+ opt.XLogToDB_Remove = db_get_b(0, MODULE, "XLogToDB_Remove", 0);
+ opt.XLogDisableForMusic = db_get_b(0, MODULE, "XLogDisableForMusic", 1);
+ // IDD_OPT_SMPOPUP
+ opt.PSMsgOnConnect = db_get_b(0, MODULE, "PSMsgOnConnect", 0);
+ opt.PSMsgTruncate = db_get_b(0, MODULE, "PSMsgTruncate", 0);
+ opt.PSMsgLen = db_get_dw(0, MODULE, "PSMsgLen", 64);
// OTHER
- opt.TempDisabled = db_get_b(0, MODULE, "TempDisable", 0);
- opt.EnableLastSeen = db_get_b(0, MODULE, "EnableLastSeen", 0);
+ opt.TempDisabled = db_get_b(0, MODULE, "TempDisable", 0);
+ opt.EnableLastSeen = db_get_b(0, MODULE, "EnableLastSeen", 0);
LoadTemplates();
}
void SaveTemplates()
{
- db_set_ts(0, MODULE, "TPopupDelimiter", templates.PopupDelimiter);
- db_set_ts(0, MODULE, "TPopupChange", templates.PopupNewXstatus);
- db_set_ts(0, MODULE, "TPopupChangeMsg", templates.PopupNewMsg);
- db_set_ts(0, MODULE, "TPopupRemoval", templates.PopupRemove);
- db_set_ts(0, MODULE, "TLogDelimiter", templates.LogDelimiter);
- db_set_ts(0, MODULE, "TLogChange", templates.LogNewXstatus);
- db_set_ts(0, MODULE, "TLogChangeMsg", templates.LogNewMsg);
- db_set_ts(0, MODULE, "TLogRemoval", templates.LogRemove);
- db_set_ts(0, MODULE, "TLogOpening", templates.LogOpening);
- db_set_b(0, MODULE, "TPopupFlags", templates.PopupFlags);
- db_set_b(0, MODULE, "TLogFlags", templates.LogFlags);
+ db_set_ts(0, MODULE, "TPopupChanged", templates.PopupXstatusChanged);
+ db_set_ts(0, MODULE, "TPopupRemoved", templates.PopupXstatusRemoved);
+ db_set_ts(0, MODULE, "TPopupXMsgChanged", templates.PopupXMsgChanged);
+ db_set_ts(0, MODULE, "TPopupXMsgRemoved", templates.PopupXMsgRemoved);
+
+ db_set_ts(0, MODULE, "TLogXChanged", templates.LogXstatusChanged);
+ db_set_ts(0, MODULE, "TLogXRemoved", templates.LogXstatusRemoved);
+ db_set_ts(0, MODULE, "TLogXMsgChanged", templates.LogXMsgChanged);
+ db_set_ts(0, MODULE, "TLogXMsgRemoved", templates.LogXMsgRemoved);
+ db_set_ts(0, MODULE, "TLogXOpening", templates.LogXstatusOpening);
+
+ db_set_ts(0, MODULE, "TLogSMsgChanged", templates.LogSMsgChanged);
+ db_set_ts(0, MODULE, "TLogSMsgRemoved", templates.LogSMsgRemoved);
+ db_set_ts(0, MODULE, "TLogSMsgOpening", templates.LogSMsgOpening);
+
+ db_set_b(0, MODULE, "TPopupXFlags", templates.PopupXFlags);
+ db_set_b(0, MODULE, "TPopupSMsgFlags", templates.PopupSMsgFlags);
+ db_set_b(0, MODULE, "TLogXFlags", templates.LogXFlags);
+ db_set_b(0, MODULE, "TLogSMsgFlags", templates.LogSMsgFlags);
for (int i = 0; i < ProtoTemplates.getCount(); i++) {
PROTOTEMPLATE *prototemplate = ProtoTemplates[i];
TCHAR str[MAX_PATH];
- mir_sntprintf(str, SIZEOF(str), _T("%s_TSMChange"), prototemplate->ProtoName);
+ mir_sntprintf(str, SIZEOF(str), _T("%s_TPopupSMsgChanged"), prototemplate->ProtoName);
char *szstr = mir_t2a(str);
- db_set_ts(0, MODULE, szstr, prototemplate->ProtoTemplate);
+ db_set_ts(0, MODULE, szstr, prototemplate->ProtoTemplateMsg);
+ mir_sntprintf(str, SIZEOF(str), _T("%s_TPopupSMsgRemoved"), prototemplate->ProtoName);
+ szstr = mir_t2a(str);
+ db_set_ts(0, MODULE, szstr, prototemplate->ProtoTemplateRemoved);
+ mir_free(szstr);
}
}
-void SaveOptions()
+void SaveOptions()
{
// IDD_OPT_POPUP
db_set_b(0, MODULE, "Colors", opt.Colors);
@@ -130,11 +158,11 @@ void SaveOptions()
db_set_dw(0, MODULE, "PopupConnectionTimeout", opt.PopupConnectionTimeout);
db_set_b(0, MODULE, "LeftClickAction", opt.LeftClickAction);
db_set_b(0, MODULE, "RightClickAction", opt.RightClickAction);
- db_set_b(0, MODULE, "IgnoreEmpty", opt.IgnoreEmpty);
// IDD_OPT_XPOPUP
- db_set_b(0, MODULE, "PDisableForMusic", opt.PDisableForMusic);
- db_set_b(0, MODULE, "PTruncateMsg", opt.PTruncateMsg);
- db_set_dw(0, MODULE, "PMsgLen", opt.PMsgLen);
+ db_set_b(0, MODULE, "PXOnConnect", opt.PXOnConnect);
+ db_set_b(0, MODULE, "PXDisableForMusic", opt.PXDisableForMusic);
+ db_set_b(0, MODULE, "PXMsgTruncate", opt.PXMsgTruncate);
+ db_set_dw(0, MODULE, "PXMsgLen", opt.PXMsgLen);
// IDD_OPT_GENERAL
db_set_b(0, MODULE, "FromOffline", opt.FromOffline);
db_set_b(0, MODULE, "AutoDisable", opt.AutoDisable);
@@ -142,23 +170,32 @@ void SaveOptions()
db_set_b(0, MODULE, "UseIndSounds", opt.UseIndSnd);
db_set_b(0, MODULE, "BlinkIcon", opt.BlinkIcon);
db_set_b(0, MODULE, "BlinkIcon_Status", opt.BlinkIcon_Status);
- db_set_b(0, MODULE, "Log", opt.Log);
- db_set_b(0, MODULE, "LogToDB", opt.LogToDB);
- db_set_b(0, MODULE, "CheckMessageWindow", opt.CheckMessageWindow);
+ db_set_b(0, MODULE, "BlinkIcon_ForMsgs", opt.BlinkIcon_ForMsgs);
db_set_ws(0, MODULE, "LogFilePath", opt.LogFilePath);
// IDD_AUTODISABLE
db_set_b(0, MODULE, "OnlyGlobalChanges", opt.OnlyGlobalChanges);
db_set_b(0, MODULE, "DisablePopupGlobally", opt.DisablePopupGlobally);
db_set_b(0, MODULE, "DisableSoundGlobally", opt.DisableSoundGlobally);
+ // IDD_OPT_LOG
+ db_set_b(0, MODULE, "LogToFile", opt.LogToFile);
+ db_set_b(0, MODULE, "LogToDB", opt.LogToDB);
+ db_set_b(0, MODULE, "LogToDB_WinOpen", opt.LogToDB_WinOpen);
+ db_set_b(0, MODULE, "LogToDB_Remove", opt.LogToDB_Remove);
+ db_set_b(0, MODULE, "LogPrevious", opt.LogPrevious);
+ db_set_b(0, MODULE, "SMsgLogToFile", opt.SMsgLogToFile);
+ db_set_b(0, MODULE, "SMsgLogToDB", opt.SMsgLogToDB);
+ db_set_b(0, MODULE, "SMsgLogToDB_WinOpen", opt.SMsgLogToDB_WinOpen);
+ db_set_b(0, MODULE, "SMsgLogToDB_Remove", opt.SMsgLogToDB_Remove);
// IDD_OPT_XLOG
- db_set_b(0, MODULE, "EnableLogging", opt.EnableLogging);
- db_set_b(0, MODULE, "PreventIdentical", opt.PreventIdentical);
- db_set_b(0, MODULE, "KeepInHistory", opt.KeepInHistory);
- db_set_b(0, MODULE, "LDisableForMusic", opt.LDisableForMusic);
- db_set_b(0, MODULE, "LTruncateMsg", opt.LTruncateMsg);
- db_set_dw(0, MODULE, "LMsgLen", opt.LMsgLen);
- //IDD_OPT_SMPOPUP
- db_set_b(0, MODULE, "PopupOnConnect", opt.PopupOnConnect);
+ db_set_b(0, MODULE, "XLogToFile", opt.XLogToFile);
+ db_set_b(0, MODULE, "XLogToDB", opt.XLogToDB);
+ db_set_b(0, MODULE, "XLogToDB_WinOpen", opt.XLogToDB_WinOpen);
+ db_set_b(0, MODULE, "XLogToDB_Remove", opt.XLogToDB_Remove);
+ db_set_b(0, MODULE, "XLogDisableForMusic", opt.XLogDisableForMusic);
+ // IDD_OPT_SMPOPUP
+ db_set_b(0, MODULE, "PSMsgOnConnect", opt.PSMsgOnConnect);
+ db_set_b(0, MODULE, "PSMsgTruncate", opt.PSMsgTruncate);
+ db_set_dw(0, MODULE, "PSMsgLen", opt.PSMsgLen);
}
INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -175,20 +212,13 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
CheckDlgButton(hwndDlg, IDC_USEINDIVSOUNDS, opt.UseIndSnd);
CheckDlgButton(hwndDlg, IDC_BLINKICON, opt.BlinkIcon);
CheckDlgButton(hwndDlg, IDC_BLINKICON_STATUS, opt.BlinkIcon_Status);
+ CheckDlgButton(hwndDlg, IDC_BLINKICON_FORMSGS, opt.BlinkIcon_ForMsgs);
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKICON_STATUS), opt.BlinkIcon);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKICON_FORMSGS), opt.BlinkIcon);
- CheckDlgButton(hwndDlg, IDC_LOG, opt.Log);
SetDlgItemText(hwndDlg, IDC_LOGFILE, opt.LogFilePath);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGFILE), opt.Log);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BT_CHOOSELOGFILE), opt.Log);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BT_VIEWLOG), opt.Log);
- CheckDlgButton(hwndDlg, IDC_LOGTODB, opt.LogToDB);
- CheckDlgButton(hwndDlg, IDC_CHECKMESSAGEWINDOW, opt.CheckMessageWindow);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKMESSAGEWINDOW), opt.LogToDB);
-
- for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++)
- {
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) {
//Statuses notified
char status[8];
mir_snprintf(status, SIZEOF(status), "%d", i);
@@ -199,7 +229,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return TRUE;
case WM_COMMAND:
{
- switch(LOWORD(wParam))
+ switch (LOWORD(wParam))
{
case IDC_CONFIGUREAUTODISABLE:
CreateDialog(hInst, MAKEINTRESOURCE(IDD_AUTODISABLE), hwndDlg, DlgProcAutoDisableOpts);
@@ -209,6 +239,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
break;
case IDC_BLINKICON:
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKICON_STATUS), IsDlgButtonChecked(hwndDlg, IDC_BLINKICON));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKICON_FORMSGS), IsDlgButtonChecked(hwndDlg, IDC_BLINKICON));
break;
case IDC_BT_VIEWLOG:
ShowLog(opt.LogFilePath);
@@ -235,14 +266,6 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SetDlgItemText(hwndDlg, IDC_LOGFILE, buff);
break;
}
- case IDC_LOG:
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGFILE), IsDlgButtonChecked(hwndDlg, IDC_LOG));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BT_CHOOSELOGFILE), IsDlgButtonChecked(hwndDlg, IDC_LOG));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BT_VIEWLOG), IsDlgButtonChecked(hwndDlg, IDC_LOG));
- break;
- case IDC_LOGTODB:
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKMESSAGEWINDOW), IsDlgButtonChecked(hwndDlg, IDC_LOGTODB));
- break;
}
if (HIWORD(wParam) == BN_CLICKED || (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()))
@@ -251,23 +274,18 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
break;
}
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == PSN_APPLY)
- {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
opt.AutoDisable = IsDlgButtonChecked(hwndDlg, IDC_AUTODISABLE);
opt.BlinkIcon = IsDlgButtonChecked(hwndDlg, IDC_BLINKICON);
opt.BlinkIcon_Status = IsDlgButtonChecked(hwndDlg, IDC_BLINKICON_STATUS);
+ opt.BlinkIcon_ForMsgs = IsDlgButtonChecked(hwndDlg, IDC_BLINKICON_FORMSGS);
opt.HiddenContactsToo = IsDlgButtonChecked(hwndDlg, IDC_HIDDENCONTACTSTOO);
opt.UseIndSnd = IsDlgButtonChecked(hwndDlg, IDC_USEINDIVSOUNDS);
- opt.Log = IsDlgButtonChecked(hwndDlg, IDC_LOG);
GetDlgItemText(hwndDlg, IDC_LOGFILE, opt.LogFilePath, SIZEOF(opt.LogFilePath));
- opt.LogToDB = IsDlgButtonChecked(hwndDlg, IDC_LOGTODB);
- opt.CheckMessageWindow = IsDlgButtonChecked(hwndDlg, IDC_CHECKMESSAGEWINDOW);
-
//Notified statuses
- for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++)
- {
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) {
char status[8];
mir_snprintf(status, SIZEOF(status), "%d", i);
db_set_b(NULL, MODULE, status, (BYTE)IsDlgButtonChecked(hwndDlg, i));
@@ -282,13 +300,6 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return FALSE;
}
-void EnablePopupTextControls(HWND hwndDlg, BOOL bEnable)
-{
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWALTDESCS), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWPREVIOUSSTATUS), bEnable);
- //EnableWindow(GetDlgItem(hwndDlg, IDC_READAWAYMSG), bEnable);
-}
-
INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
@@ -301,12 +312,11 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, (opt.Colors == POPUP_COLOR_POPUP) ? 1 : 0);
CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, (opt.Colors == POPUP_COLOR_WINDOWS) ? 1 : 0);
- for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2 - 1; i++)
- {
- SendDlgItemMessage(hwndDlg, (i+2000), CPM_SETCOLOUR, 0, StatusList[Index(i)].colorBack);
- SendDlgItemMessage(hwndDlg, (i+1000), CPM_SETCOLOUR, 0, StatusList[Index(i)].colorText);
- EnableWindow(GetDlgItem(hwndDlg, (i+2000)), (opt.Colors == POPUP_COLOR_OWN));
- EnableWindow(GetDlgItem(hwndDlg, (i+1000)), (opt.Colors == POPUP_COLOR_OWN));
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) {
+ SendDlgItemMessage(hwndDlg, (i + 2000), CPM_SETCOLOUR, 0, StatusList[Index(i)].colorBack);
+ SendDlgItemMessage(hwndDlg, (i + 1000), CPM_SETCOLOUR, 0, StatusList[Index(i)].colorText);
+ EnableWindow(GetDlgItem(hwndDlg, (i + 2000)), (opt.Colors == POPUP_COLOR_OWN));
+ EnableWindow(GetDlgItem(hwndDlg, (i + 1000)), (opt.Colors == POPUP_COLOR_OWN));
}
CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, opt.ShowStatus);
@@ -314,7 +324,6 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
CheckDlgButton(hwndDlg, IDC_READAWAYMSG, opt.ReadAwayMsg);
CheckDlgButton(hwndDlg, IDC_SHOWPREVIOUSSTATUS, opt.ShowPreviousStatus);
CheckDlgButton(hwndDlg, IDC_SHOWGROUP, opt.ShowGroup);
- CheckDlgButton(hwndDlg, IDC_PUIGNOREREMOVE, opt.IgnoreEmpty);
SendDlgItemMessage(hwndDlg, IDC_TIMEOUT_VALUE, EM_LIMITTEXT, 3, 0);
SendDlgItemMessage(hwndDlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 999);
@@ -325,8 +334,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SetDlgItemInt(hwndDlg, IDC_CONNECTIONTIMEOUT_VALUE, opt.PopupConnectionTimeout, TRUE);
//Mouse actions
- for (int i = 0; i < SIZEOF(PopupActions); i++)
- {
+ for (int i = 0; i < SIZEOF(PopupActions); i++) {
SendMessage(GetDlgItem(hwndDlg, IDC_STATUS_LC), CB_SETITEMDATA, SendMessage(GetDlgItem(hwndDlg, IDC_STATUS_LC), CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
SendMessage(GetDlgItem(hwndDlg, IDC_STATUS_RC), CB_SETITEMDATA, SendMessage(GetDlgItem(hwndDlg, IDC_STATUS_RC), CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
}
@@ -334,17 +342,15 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SendDlgItemMessage(hwndDlg, IDC_STATUS_LC, CB_SETCURSEL, opt.LeftClickAction, 0);
SendDlgItemMessage(hwndDlg, IDC_STATUS_RC, CB_SETCURSEL, opt.RightClickAction, 0);
- EnablePopupTextControls(hwndDlg, opt.ShowStatus);
+ SendMessage(hwndDlg, WM_USER + 1, (WPARAM)opt.ShowStatus, 0);
return TRUE;
}
case WM_COMMAND:
{
WORD idCtrl = LOWORD(wParam);
- if (HIWORD(wParam) == CPN_COLOURCHANGED)
- {
- if (idCtrl > 40070)
- {
+ if (HIWORD(wParam) == CPN_COLOURCHANGED) {
+ if (idCtrl > 40070) {
COLORREF colour = SendDlgItemMessage(hwndDlg, idCtrl, CPM_GETCOLOUR, 0, 0);
if ((idCtrl > 41070) && (idCtrl < 42070)) //Text colour
StatusList[Index(idCtrl - 1000)].colorText = colour;
@@ -355,78 +361,51 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
}
- if (HIWORD(wParam) == BN_CLICKED)
- {
- switch(idCtrl)
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (idCtrl)
{
case IDC_USEOWNCOLORS:
case IDC_USEWINCOLORS:
case IDC_USEPOPUPCOLORS:
- {
- for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2 - 1; i++)
- {
- EnableWindow(GetDlgItem(hwndDlg, (i+2000)), idCtrl == IDC_USEOWNCOLORS); //Background
- EnableWindow(GetDlgItem(hwndDlg, (i+1000)), idCtrl == IDC_USEOWNCOLORS); //Text
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) {
+ EnableWindow(GetDlgItem(hwndDlg, (i + 2000)), idCtrl == IDC_USEOWNCOLORS); //Background
+ EnableWindow(GetDlgItem(hwndDlg, (i + 1000)), idCtrl == IDC_USEOWNCOLORS); //Text
}
-
break;
- }
case IDC_SHOWSTATUS:
- {
- EnablePopupTextControls(hwndDlg, IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS));
+ SendMessage(hwndDlg, WM_USER + 1, (WPARAM)IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS), 0);
break;
- }
case IDC_PREVIEW:
{
- POPUPDATAT ppd = {0};
- ppd.iSeconds = opt.PopupTimeout;
-
- for (int i = ID_STATUS_MIN; i <= (ID_STATUS_MAX+1); i++)
- {
- WORD status = i <= ID_STATUS_MAX2 ? i : ID_STATUS_MIN;
- ppd.lchIcon = LoadSkinnedIcon(StatusList[Index(status)].icon);
+ TCHAR str[MAX_SECONDLINE] = {0};
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
+ _tcscpy(str, _T(""));
- _tcscpy(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, 0, GSMDF_TCHAR));
- _tcscpy(ppd.lptzText, _T(""));
-
- if (opt.ShowStatus)
- {
+ if (opt.ShowStatus) {
if (opt.UseAlternativeText == 1)
- _tcscpy(ppd.lptzText, StatusList[Index(status)].lpzUStatusText);
+ _tcscpy(str, _tcsninc(StatusList[Index(i)].lpzUStatusText, 4));
else
- _tcscpy(ppd.lptzText, StatusList[Index(status)].lpzStandardText);
+ _tcscpy(str, StatusList[Index(i)].lpzStandardText);
- if (opt.ShowPreviousStatus)
- {
+ if (opt.ShowPreviousStatus) {
TCHAR buff[MAX_STATUSTEXT];
- mir_sntprintf(buff, SIZEOF(buff), TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(status)].lpzStandardText);
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), _T("%s %s"), ppd.lptzText, buff);
+ mir_sntprintf(buff, SIZEOF(buff), TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(i)].lpzStandardText);
+ mir_sntprintf(str, SIZEOF(str), _T("%s %s"), str, buff);
}
}
- if (opt.ReadAwayMsg)
- {
- if (ppd.lptzText[0]) _tcscat(ppd.lptzText, _T("\n"));
- _tcscat(ppd.lptzText, TranslateT("This is status message"));
- }
-
- switch (opt.Colors)
- {
- case POPUP_COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- break;
- case POPUP_COLOR_OWN:
- ppd.colorBack = StatusList[Index(status)].colorBack;
- ppd.colorText = StatusList[Index(status)].colorText;
- break;
- case POPUP_COLOR_POPUP:
- ppd.colorBack = ppd.colorText = 0;
- break;
+ if (opt.ReadAwayMsg) {
+ if (str[0])
+ _tcscat(str, _T("\n"));
+ _tcscat(str, TranslateT("This is status message"));
}
- PUAddPopupT(&ppd);
+ ShowChangePopup(NULL, NULL, LoadSkinnedProtoIcon(NULL, i), i, str);
}
+ _tcscpy(str, TranslateT("This is extra status"));
+ ShowChangePopup(NULL, NULL, LoadSkinnedProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_EXTRASTATUS, str);
+ _tcscpy(str, TranslateT("This is status message"));
+ ShowChangePopup(NULL, NULL, LoadSkinnedProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_STATUSMSG, str);
return FALSE;
}
@@ -440,18 +419,16 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
case WM_NOTIFY:
{
- if (((LPNMHDR)lParam)->code == PSN_APPLY)
- {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
char str[8];
DWORD ctlColour = 0;
- for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2 - 1; i++)
- {
- ctlColour = SendDlgItemMessage(hwndDlg, (i+2000), CPM_GETCOLOUR, 0, 0);
- StatusList[Index(i)].colorBack = SendDlgItemMessage(hwndDlg, (i+2000), CPM_GETCOLOUR, 0, 0);
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) {
+ ctlColour = SendDlgItemMessage(hwndDlg, (i + 2000), CPM_GETCOLOUR, 0, 0);
+ StatusList[Index(i)].colorBack = SendDlgItemMessage(hwndDlg, (i + 2000), CPM_GETCOLOUR, 0, 0);
mir_snprintf(str, SIZEOF(str), "%ibg", i);
db_set_dw(0, MODULE, str, ctlColour);
- ctlColour = SendDlgItemMessage(hwndDlg, (i+1000), CPM_GETCOLOUR, 0, 0);
+ ctlColour = SendDlgItemMessage(hwndDlg, (i + 1000), CPM_GETCOLOUR, 0, 0);
StatusList[Index(i)].colorText = ctlColour;
mir_snprintf(str, SIZEOF(str), "%itx", i);
db_set_dw(0, MODULE, str, ctlColour);
@@ -473,7 +450,6 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
opt.PopupConnectionTimeout = GetDlgItemInt(hwndDlg, IDC_CONNECTIONTIMEOUT_VALUE, 0, TRUE);
opt.LeftClickAction = (BYTE)SendDlgItemMessage(hwndDlg, IDC_STATUS_LC, CB_GETCURSEL, 0, 0);
opt.RightClickAction = (BYTE)SendDlgItemMessage(hwndDlg, IDC_STATUS_RC, CB_GETCURSEL, 0, 0);
- opt.IgnoreEmpty = IsDlgButtonChecked(hwndDlg, IDC_PUIGNOREREMOVE);
SaveOptions();
return TRUE;
@@ -481,6 +457,10 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
break;
}
+ case WM_USER + 1:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWALTDESCS), wParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWPREVIOUSSTATUS), wParam);
+ return TRUE;
}
return FALSE;
@@ -488,121 +468,88 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_CHK_PGLOBAL, opt.DisablePopupGlobally);
- CheckDlgButton(hwndDlg, IDC_CHK_SGLOBAL, opt.DisableSoundGlobally);
- CheckDlgButton(hwndDlg, IDC_CHK_ONLYGLOBAL, opt.OnlyGlobalChanges);
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_CHK_PGLOBAL, opt.DisablePopupGlobally);
+ CheckDlgButton(hwndDlg, IDC_CHK_SGLOBAL, opt.DisableSoundGlobally);
+ CheckDlgButton(hwndDlg, IDC_CHK_ONLYGLOBAL, opt.OnlyGlobalChanges);
+
+ char str[8];
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
+ mir_snprintf(str, SIZEOF(str), "p%d", i);
+ CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, str, 0));
+ }
+
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
+ mir_snprintf(str, SIZEOF(str), "s%d", i);
+ CheckDlgButton(hwndDlg, (i + 2000), db_get_b(NULL, MODULE, str, 0));
+ }
+ return TRUE;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_OK:
char str[8];
- for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
- {
+ opt.DisablePopupGlobally = IsDlgButtonChecked(hwndDlg, IDC_CHK_PGLOBAL);
+ opt.DisableSoundGlobally = IsDlgButtonChecked(hwndDlg, IDC_CHK_SGLOBAL);
+ opt.OnlyGlobalChanges = IsDlgButtonChecked(hwndDlg, IDC_CHK_ONLYGLOBAL);
+
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
mir_snprintf(str, SIZEOF(str), "p%d", i);
- CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, str, 0));
+ db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i));
}
- for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
- {
+ for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
mir_snprintf(str, SIZEOF(str), "s%d", i);
- CheckDlgButton(hwndDlg, (i+2000),db_get_b(NULL, MODULE, str, 0));
+ db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i + 2000));
}
- return TRUE;
- }
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_OK:
- char str[8];
- opt.DisablePopupGlobally = IsDlgButtonChecked(hwndDlg, IDC_CHK_PGLOBAL);
- opt.DisableSoundGlobally = IsDlgButtonChecked(hwndDlg, IDC_CHK_SGLOBAL);
- opt.OnlyGlobalChanges = IsDlgButtonChecked(hwndDlg, IDC_CHK_ONLYGLOBAL);
-
- for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
- {
- mir_snprintf(str, SIZEOF(str), "p%d", i);
- db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i));
- }
- for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
- {
- mir_snprintf(str, SIZEOF(str), "s%d", i);
- db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i+2000));
- }
-
- SaveOptions();
- //Fall through
- case IDC_CANCEL:
- DestroyWindow(hwndDlg);
- break;
- }
- break;
- }
- case WM_CLOSE:
- {
+ SaveOptions();
+ //Fall through
+ case IDC_CANCEL:
DestroyWindow(hwndDlg);
break;
}
+ break;
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
+ break;
}
return FALSE;
}
-int ResetTemplatesToDefault(HWND hwndDlg)
-{
- int result = MessageBox(hwndDlg,
- TranslateT("Do you want to reset all templates to default?"),
- TranslateT("Reset templates"),
- MB_ICONQUESTION | MB_YESNO);
- if (result == IDYES)
- {
- SetDlgItemText(hwndDlg, IDC_ED_TDELIMITER, DEFAULT_POPUP_DELIMITER);
- SetDlgItemText(hwndDlg, IDC_ED_TCHANGE, DEFAULT_POPUP_NEW);
- SetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, DEFAULT_POPUP_CHANGEMSG);
- SetDlgItemText(hwndDlg, IDC_ED_TREMOVE, DEFAULT_POPUP_REMOVE);
- SetDlgItemText(hwndDlg, IDC_POPUPTEXT, TranslateT(DEFAULT_POPUP_STATUSMESSAGE));
- CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSCHANGE, 1);
- CheckDlgButton(hwndDlg, IDC_CHK_MSGCHANGE, 1);
- CheckDlgButton(hwndDlg, IDC_CHK_REMOVE, 1);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGE), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGEMSG), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVE), TRUE);
- }
-
- return result;
-}
-
INT_PTR CALLBACK DlgProcXPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_ED_MSGLEN, EM_LIMITTEXT, 3, 0);
SendDlgItemMessage(hwndDlg, IDC_UD_MSGLEN, UDM_SETRANGE, 0, MAKELONG(999, 1));
- CheckDlgButton(hwndDlg, IDC_CHK_DISABLEMUSIC, opt.PDisableForMusic);
- CheckDlgButton(hwndDlg, IDC_CHK_CUTMSG, opt.PTruncateMsg);
- SetDlgItemInt(hwndDlg, IDC_ED_MSGLEN, opt.PMsgLen, FALSE);
+ CheckDlgButton(hwndDlg, IDC_XONCONNECT, opt.PXOnConnect);
+ CheckDlgButton(hwndDlg, IDC_CHK_DISABLEMUSIC, opt.PXDisableForMusic);
+ CheckDlgButton(hwndDlg, IDC_CHK_CUTMSG, opt.PXMsgTruncate);
+ SetDlgItemInt(hwndDlg, IDC_ED_MSGLEN, opt.PXMsgLen, FALSE);
// Templates
- CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSCHANGE, templates.PopupFlags & NOTIFY_NEW_XSTATUS ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_CHK_MSGCHANGE, templates.PopupFlags & NOTIFY_NEW_MESSAGE ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_CHK_REMOVE, templates.PopupFlags & NOTIFY_REMOVE ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSCHANGE, templates.PopupXFlags & NOTIFY_NEW_XSTATUS ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHK_MSGCHANGE, templates.PopupXFlags & NOTIFY_NEW_MESSAGE ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHK_REMOVE, templates.PopupXFlags & NOTIFY_REMOVE_XSTATUS ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHK_MSGREMOVE, templates.PopupXFlags & NOTIFY_REMOVE_MESSAGE ? 1 : 0);
- SetDlgItemText(hwndDlg, IDC_ED_TDELIMITER, templates.PopupDelimiter);
- SetDlgItemText(hwndDlg, IDC_ED_TCHANGE, templates.PopupNewXstatus);
- SetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, templates.PopupNewMsg);
- SetDlgItemText(hwndDlg, IDC_ED_TREMOVE, templates.PopupRemove);
+ SetDlgItemText(hwndDlg, IDC_ED_TCHANGE, templates.PopupXstatusChanged);
+ SetDlgItemText(hwndDlg, IDC_ED_TREMOVE, templates.PopupXstatusRemoved);
+ SetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, templates.PopupXMsgChanged);
+ SetDlgItemText(hwndDlg, IDC_ED_TREMOVEMSG, templates.PopupXMsgRemoved);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGE), templates.PopupFlags & NOTIFY_NEW_XSTATUS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGEMSG), templates.PopupFlags & NOTIFY_NEW_MESSAGE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVE), templates.PopupFlags & NOTIFY_REMOVE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGE), templates.PopupXFlags & NOTIFY_NEW_XSTATUS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGEMSG), templates.PopupXFlags & NOTIFY_NEW_MESSAGE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVE), templates.PopupXFlags & NOTIFY_REMOVE_XSTATUS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVEMSG), templates.PopupXFlags & NOTIFY_REMOVE_MESSAGE);
// Buttons
SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show available variables"), BATF_TCHAR);
@@ -617,68 +564,71 @@ INT_PTR CALLBACK DlgProcXPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
return TRUE;
}
- case WM_COMMAND:
+ case WM_COMMAND:
{
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
- {
- switch (LOWORD(wParam))
- {
- case IDC_CHK_CUTMSG:
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_MSGLEN), IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTMSG));
- break;
- case IDC_CHK_XSTATUSCHANGE:
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGE), IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGE));
- break;
- case IDC_CHK_MSGCHANGE:
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGEMSG), IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGCHANGE));
- break;
- case IDC_CHK_REMOVE:
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVE), IsDlgButtonChecked(hwndDlg, IDC_CHK_REMOVE));
- break;
- case IDC_BT_VARIABLES:
- MessageBox(hwndDlg, VARIABLES_HELP_TEXT, TranslateT("Variables"), MB_OK | MB_ICONINFORMATION);
- break;
- case IDC_BT_RESET:
- if (ResetTemplatesToDefault(hwndDlg) == IDYES) break;
- else return FALSE;
- }
-
- if (LOWORD(wParam) != IDC_BT_VARIABLES)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- break;
- }
- case EN_CHANGE:
- {
- if ((HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ switch (LOWORD(wParam)) {
+ case IDC_CHK_CUTMSG:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_MSGLEN), IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTMSG));
+ break;
+ case IDC_CHK_XSTATUSCHANGE:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGE), IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGE));
+ break;
+ case IDC_CHK_REMOVE:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVE), IsDlgButtonChecked(hwndDlg, IDC_CHK_REMOVE));
+ break;
+ case IDC_CHK_MSGCHANGE:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGEMSG), IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGCHANGE));
+ break;
+ case IDC_CHK_MSGREMOVE:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVEMSG), IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGREMOVE));
+ break;
+ case IDC_BT_VARIABLES:
+ MessageBox(hwndDlg, VARIABLES_HELP_TEXT, TranslateT("Variables"), MB_OK | MB_ICONINFORMATION);
+ break;
+ case IDC_BT_RESET:
+ if (MessageBox(hwndDlg,
+ TranslateT("Do you want to reset all templates to default?"),
+ TranslateT("Reset templates"),
+ MB_ICONQUESTION | MB_YESNO) == IDYES)
+ SendMessage(hwndDlg, WM_USER + 1, 0, 0);
+ else
+ return FALSE;
+ break;
}
+ if (LOWORD(wParam) != IDC_BT_VARIABLES)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
+ break;
+ case EN_CHANGE:
+ if ((HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
}
return TRUE;
}
- case WM_NOTIFY:
+ case WM_NOTIFY:
{
- if (((LPNMHDR)lParam)->code == PSN_APPLY )
- {
- opt.PDisableForMusic = IsDlgButtonChecked(hwndDlg, IDC_CHK_DISABLEMUSIC);
- opt.PTruncateMsg = IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTMSG);
- opt.PMsgLen = GetDlgItemInt(hwndDlg, IDC_ED_MSGLEN, 0, FALSE);
-
- templates.PopupFlags = 0;
- templates.PopupFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGE) ? NOTIFY_NEW_XSTATUS : 0) |
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+ opt.PXOnConnect = IsDlgButtonChecked(hwndDlg, IDC_XONCONNECT);
+ opt.PXDisableForMusic = IsDlgButtonChecked(hwndDlg, IDC_CHK_DISABLEMUSIC);
+ opt.PXMsgTruncate = IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTMSG);
+ opt.PXMsgLen = GetDlgItemInt(hwndDlg, IDC_ED_MSGLEN, 0, FALSE);
+
+ templates.PopupXFlags = 0;
+ templates.PopupXFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGE) ? NOTIFY_NEW_XSTATUS : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGCHANGE) ? NOTIFY_NEW_MESSAGE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_CHK_REMOVE) ? NOTIFY_REMOVE : 0);
+ (IsDlgButtonChecked(hwndDlg, IDC_CHK_REMOVE) ? NOTIFY_REMOVE_XSTATUS : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGREMOVE) ? NOTIFY_REMOVE_MESSAGE : 0);
// Templates
- GetDlgItemText(hwndDlg, IDC_ED_TDELIMITER, templates.PopupDelimiter, SIZEOF(templates.PopupDelimiter));
- GetDlgItemText(hwndDlg, IDC_ED_TCHANGE, templates.PopupNewXstatus, SIZEOF(templates.PopupNewXstatus));
- GetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, templates.PopupNewMsg, SIZEOF(templates.PopupNewMsg));
- GetDlgItemText(hwndDlg, IDC_ED_TREMOVE, templates.PopupRemove, SIZEOF(templates.PopupRemove));
+ GetDlgItemText(hwndDlg, IDC_ED_TCHANGE, templates.PopupXstatusChanged, SIZEOF(templates.PopupXstatusChanged));
+ GetDlgItemText(hwndDlg, IDC_ED_TREMOVE, templates.PopupXstatusRemoved, SIZEOF(templates.PopupXstatusRemoved));
+ GetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, templates.PopupXMsgChanged, SIZEOF(templates.PopupXMsgChanged));
+ GetDlgItemText(hwndDlg, IDC_ED_TREMOVEMSG, templates.PopupXMsgRemoved, SIZEOF(templates.PopupXMsgRemoved));
// Save options to db
SaveOptions();
@@ -687,6 +637,23 @@ INT_PTR CALLBACK DlgProcXPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
return TRUE;
}
+ case WM_USER + 1:
+ SetDlgItemText(hwndDlg, IDC_ED_TCHANGE, DEFAULT_POPUP_CHANGED);
+ SetDlgItemText(hwndDlg, IDC_ED_TREMOVE, DEFAULT_POPUP_REMOVED);
+ SetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, DEFAULT_POPUP_MSGCHANGED);
+ SetDlgItemText(hwndDlg, IDC_ED_TREMOVEMSG, DEFAULT_POPUP_MSGREMOVED);
+
+ CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSCHANGE, 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_REMOVE, 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_MSGCHANGE, 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_MSGREMOVE, 1);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGE), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVE), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGEMSG), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVEMSG), TRUE);
+
+ return TRUE;
}
return FALSE;
@@ -694,16 +661,29 @@ INT_PTR CALLBACK DlgProcXPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
bool IsSuitableProto(PROTOACCOUNT *pa)
{
- return ( pa != NULL && !pa->bDynDisabled && pa->bIsEnabled && CallProtoService( pa->szProtoName, PS_GETCAPS, PFLAGNUM_2, 0 ) != 0 );
+ return (pa != NULL && !pa->bDynDisabled && pa->bIsEnabled && CallProtoService(pa->szProtoName, PS_GETCAPS, PFLAGNUM_2, 0) != 0);
}
INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
{
- CheckDlgButton(hwndDlg, IDC_ONCONNECT, opt.PopupOnConnect);
+ TranslateDialogDefault(hwndDlg);
+
+ SendDlgItemMessage(hwndDlg, IDC_ED_SMSGLEN, EM_LIMITTEXT, 3, 0);
+ SendDlgItemMessage(hwndDlg, IDC_UD_SMSGLEN, UDM_SETRANGE, 0, MAKELONG(999, 1));
+
+ CheckDlgButton(hwndDlg, IDC_ONCONNECT, opt.PSMsgOnConnect);
+ CheckDlgButton(hwndDlg, IDC_CHK_CUTSMSG, opt.PSMsgTruncate);
+ SetDlgItemInt(hwndDlg, IDC_ED_SMSGLEN, opt.PSMsgLen, FALSE);
+
+ // Templates
+ CheckDlgButton(hwndDlg, IDC_CHK_NEWSMSG, templates.PopupSMsgFlags & NOTIFY_NEW_MESSAGE ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHK_SMSGREMOVE, templates.PopupSMsgFlags & NOTIFY_REMOVE_MESSAGE ? 1 : 0);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TNEWSMSG), templates.PopupSMsgFlags & NOTIFY_NEW_MESSAGE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TSMSGREMOVE), templates.PopupSMsgFlags & NOTIFY_REMOVE_MESSAGE);
// Buttons
SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Show available variables"), BATF_TCHAR);
@@ -721,7 +701,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SendMessage(hList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
LVCOLUMN lvCol = {0};
lvCol.mask = LVCF_WIDTH | LVCF_TEXT;
- lvCol.pszText=TranslateT("Protocol");
+ lvCol.pszText = TranslateT("Protocol");
lvCol.cx = 118;
ListView_InsertColumn(hList, 0, &lvCol);
// fill the list
@@ -734,7 +714,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
PROTOACCOUNT** protos;
ProtoEnumAccounts(&count, &protos);
- for(int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
if (!IsSuitableProto(protos[i]))
continue;
@@ -744,15 +724,24 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
PROTOTEMPLATE *prototemplate = (PROTOTEMPLATE *)mir_alloc(sizeof(PROTOTEMPLATE));
prototemplate->ProtoName = protos[i]->tszAccountName;
TCHAR protoname[MAX_PATH] = {0};
- mir_sntprintf(protoname, SIZEOF(protoname), _T("%s_TSMChange"), protos[i]->tszAccountName);
+ mir_sntprintf(protoname, SIZEOF(protoname), _T("%s_TPopupSMsgChanged"), protos[i]->tszAccountName);
char *szprotoname = mir_t2a(protoname);
DBVARIANT dbVar = {0};
db_get_ts(NULL, MODULE, szprotoname, &dbVar);
if (lstrcmp(dbVar.ptszVal, NULL) == 0) {
db_free(&dbVar);
- _tcsncpy(prototemplate->ProtoTemplate, TranslateT(DEFAULT_POPUP_STATUSMESSAGE), SIZEOF(prototemplate->ProtoTemplate));
+ _tcsncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, SIZEOF(prototemplate->ProtoTemplateMsg));
+ }
+ else _tcsncpy(prototemplate->ProtoTemplateMsg, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateMsg));
+
+ mir_sntprintf(protoname, SIZEOF(protoname), _T("%s_TPopupSMsgRemoved"), protos[i]->tszAccountName);
+ szprotoname = mir_t2a(protoname);
+ db_get_ts(NULL, MODULE, szprotoname, &dbVar);
+ if (lstrcmp(dbVar.ptszVal, NULL) == 0) {
+ db_free(&dbVar);
+ _tcsncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, SIZEOF(prototemplate->ProtoTemplateRemoved));
}
- else _tcsncpy(prototemplate->ProtoTemplate, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplate));
+ else _tcsncpy(prototemplate->ProtoTemplateRemoved, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateRemoved));
mir_free(szprotoname);
ListView_InsertItem(hList, &lvItem);
@@ -763,11 +752,13 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULE, dbSetting, TRUE));
lvItem.iItem++;
}
+
if (lvItem.iItem)
{
ListView_SetItemState(hList, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
PROTOTEMPLATE *prototemplate = ProtoTemplates[0];
- SetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate);
+ SetDlgItemText(hwndDlg, IDC_ED_TNEWSMSG, prototemplate->ProtoTemplateMsg);
+ SetDlgItemText(hwndDlg, IDC_ED_TSMSGREMOVE, prototemplate->ProtoTemplateRemoved);
}
UpdateListFlag = FALSE;
}
@@ -777,20 +768,33 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
switch (HIWORD(wParam)) {
case BN_CLICKED:
switch (LOWORD(wParam)) {
- case IDC_BT_VARIABLES:
- MessageBox(hwndDlg, VARIABLES_SM_HELP_TEXT, TranslateT("Variables"), MB_OK | MB_ICONINFORMATION);
- break;
-
- case IDC_BT_RESET:
- if (ResetTemplatesToDefault(hwndDlg) == IDYES) break;
- else return FALSE;
+ case IDC_CHK_CUTSMSG:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_SMSGLEN), IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTSMSG));
+ break;
+ case IDC_CHK_NEWSMSG:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TNEWSMSG), IsDlgButtonChecked(hwndDlg, IDC_CHK_NEWSMSG));
+ break;
+ case IDC_CHK_SMSGREMOVE:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TSMSGREMOVE), IsDlgButtonChecked(hwndDlg, IDC_CHK_SMSGREMOVE));
+ break;
+ case IDC_BT_VARIABLES:
+ MessageBox(hwndDlg, VARIABLES_SM_HELP_TEXT, TranslateT("Variables"), MB_OK | MB_ICONINFORMATION);
+ break;
+ case IDC_BT_RESET:
+ if (MessageBox(hwndDlg,
+ TranslateT("Do you want to reset all templates to default?"),
+ TranslateT("Reset templates"),
+ MB_ICONQUESTION | MB_YESNO) == IDYES)
+ SendMessage(hwndDlg, WM_USER + 1, 0, 0);
+ else
+ return FALSE;
+ break;
}
if (LOWORD(wParam) != IDC_BT_VARIABLES)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
-
case EN_CHANGE:
if ((HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -799,8 +803,8 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return TRUE;
case WM_NOTIFY:
- if (((NMHDR*)lParam)->idFrom == IDC_PROTOCOLLIST) {
- switch(((NMHDR*)lParam)->code) {
+ if (((NMHDR *)lParam)->idFrom == IDC_PROTOCOLLIST) {
+ switch (((NMHDR *)lParam)->code) {
case LVN_ITEMCHANGED:
{
NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
@@ -810,40 +814,49 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
PROTOTEMPLATE *prototemplate;
if (ListView_GetHotItem(hList) != ListView_GetSelectionMark(hList)) {
prototemplate = ProtoTemplates[ListView_GetSelectionMark(hList)];
- GetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_ED_TNEWSMSG, prototemplate->ProtoTemplateMsg, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_ED_TSMSGREMOVE, prototemplate->ProtoTemplateRemoved, MAX_PATH);
ProtoTemplates.remove(ListView_GetSelectionMark(hList));
ProtoTemplates.insert(prototemplate, ListView_GetSelectionMark(hList));
}
LastItem = ListView_GetHotItem(hList);
prototemplate = ProtoTemplates[LastItem];
- SetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate);
+ SetDlgItemText(hwndDlg, IDC_ED_TNEWSMSG, prototemplate->ProtoTemplateMsg);
+ SetDlgItemText(hwndDlg, IDC_ED_TSMSGREMOVE, prototemplate->ProtoTemplateRemoved);
}
- if ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK && !UpdateListFlag)
+ if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK && !UpdateListFlag)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
}
}
- if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
- opt.PopupOnConnect = IsDlgButtonChecked(hwndDlg, IDC_ONCONNECT);
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+ opt.PSMsgOnConnect = IsDlgButtonChecked(hwndDlg, IDC_ONCONNECT);
+ opt.PSMsgTruncate = IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTSMSG);
+ opt.PSMsgLen = GetDlgItemInt(hwndDlg, IDC_ED_SMSGLEN, 0, FALSE);
+
+ templates.PopupSMsgFlags = 0;
+ templates.PopupSMsgFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_NEWSMSG) ? NOTIFY_NEW_MESSAGE : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_CHK_SMSGREMOVE) ? NOTIFY_REMOVE_MESSAGE : 0);
// Templates
PROTOTEMPLATE *prototemplate = ProtoTemplates[LastItem];
- GetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_ED_TNEWSMSG, prototemplate->ProtoTemplateMsg, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_ED_TSMSGREMOVE, prototemplate->ProtoTemplateRemoved, MAX_PATH);
ProtoTemplates.remove(LastItem);
ProtoTemplates.insert(prototemplate, LastItem);
// Save options to db
SaveOptions();
SaveTemplates();
- HWND hList = GetDlgItem(hwndDlg,IDC_PROTOCOLLIST);
+ HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST);
LVITEM lvItem = {0};
- lvItem.mask=LVIF_PARAM;
- for (int i=0;i<ListView_GetItemCount(hList);i++) {
- lvItem.iItem=i;
- lvItem.iSubItem=0;
+ lvItem.mask = LVIF_PARAM;
+ for (int i = 0; i < ListView_GetItemCount(hList); i++) {
+ lvItem.iItem = i;
+ lvItem.iSubItem = 0;
ListView_GetItem(hList, &lvItem);
char dbSetting[128];
@@ -853,6 +866,17 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
return TRUE;
+ case WM_USER + 1:
+ SetDlgItemText(hwndDlg, IDC_ED_TNEWSMSG, DEFAULT_POPUP_SMSGCHANGED);
+ SetDlgItemText(hwndDlg, IDC_ED_TSMSGREMOVE, DEFAULT_POPUP_SMSGREMOVED);
+
+ CheckDlgButton(hwndDlg, IDC_CHK_NEWSMSG, 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_SMSGREMOVE, 1);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TNEWSMSG), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TSMSGREMOVE), TRUE);
+
+ return TRUE;
case WM_DESTROY:
ProtoTemplates.destroy();
@@ -862,55 +886,31 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return FALSE;
}
-void EnableLogControls(HWND hwndDlg, BOOL state)
-{
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SAVETOHISTORY), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_PREVENTIDENTICAL), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DISABLEMUSIC), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_CUTMSG), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_MSGLEN), state & IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTMSG));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_XSTATUSCHANGE), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_MSGCHANGE), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_REMOVE), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_OPENING), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TDELIMITER), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGE), state & IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGEMSG), state & IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGCHANGE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVE), state & IsDlgButtonChecked(hwndDlg, IDC_CHK_REMOVE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TOPENING), state & IsDlgButtonChecked(hwndDlg, IDC_CHK_OPENING));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BT_VARIABLES), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BT_RESET), state);
-}
-
INT_PTR CALLBACK DlgProcXLogOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_CHK_LOGGING, opt.EnableLogging);
- CheckDlgButton(hwndDlg, IDC_CHK_SAVETOHISTORY, opt.KeepInHistory);
- CheckDlgButton(hwndDlg, IDC_CHK_PREVENTIDENTICAL, opt.PreventIdentical);
- CheckDlgButton(hwndDlg, IDC_CHK_DISABLEMUSIC, opt.LDisableForMusic);
- CheckDlgButton(hwndDlg, IDC_CHK_CUTMSG, opt.LTruncateMsg);
-
- SendDlgItemMessage(hwndDlg, IDC_ED_MSGLEN, EM_LIMITTEXT, 3, 0);
- SendDlgItemMessage(hwndDlg, IDC_UD_MSGLEN, UDM_SETRANGE, 0, MAKELONG(999, 1));
- SetDlgItemInt(hwndDlg, IDC_ED_MSGLEN, opt.LMsgLen, FALSE);
+ CheckDlgButton(hwndDlg, IDC_XLOGTOFILE, opt.XLogToFile);
+ CheckDlgButton(hwndDlg, IDC_XLOGTODB, opt.XLogToDB);
+ CheckDlgButton(hwndDlg, IDC_XLOGTODB_WINOPEN, opt.XLogToDB_WinOpen);
+ CheckDlgButton(hwndDlg, IDC_XLOGTODB_REMOVE, opt.XLogToDB_Remove);
+ CheckDlgButton(hwndDlg, IDC_CHK_DISABLEMUSIC, opt.XLogDisableForMusic);
//Templates
- CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSCHANGE, (templates.LogFlags & NOTIFY_NEW_XSTATUS) ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_CHK_MSGCHANGE, (templates.LogFlags & NOTIFY_NEW_MESSAGE) ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_CHK_REMOVE, (templates.LogFlags & NOTIFY_REMOVE) ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_CHK_OPENING, (templates.LogFlags & NOTIFY_OPENING_ML) ? 1 : 0);
-
- SetDlgItemText(hwndDlg, IDC_ED_TDELIMITER, templates.LogDelimiter);
- SetDlgItemText(hwndDlg, IDC_ED_TCHANGE, templates.LogNewXstatus);
- SetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, templates.LogNewMsg);
- SetDlgItemText(hwndDlg, IDC_ED_TREMOVE, templates.LogRemove);
- SetDlgItemText(hwndDlg, IDC_ED_TOPENING, templates.LogOpening);
+ CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSCHANGED, (templates.LogXFlags & NOTIFY_NEW_XSTATUS) ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSREMOVED, (templates.LogXFlags & NOTIFY_REMOVE_XSTATUS) ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHK_MSGCHANGED, (templates.LogXFlags & NOTIFY_NEW_MESSAGE) ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHK_MSGREMOVED, (templates.LogXFlags & NOTIFY_REMOVE_MESSAGE) ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSOPENING, (templates.LogXFlags & NOTIFY_OPENING_ML) ? 1 : 0);
+
+ SetDlgItemText(hwndDlg, IDC_ED_TXSTATUSCHANGED, templates.LogXstatusChanged);
+ SetDlgItemText(hwndDlg, IDC_ED_TXSTATUSREMOVED, templates.LogXstatusRemoved);
+ SetDlgItemText(hwndDlg, IDC_ED_TMSGCHANGED, templates.LogXMsgChanged);
+ SetDlgItemText(hwndDlg, IDC_ED_TMSGREMOVED, templates.LogXMsgRemoved);
+ SetDlgItemText(hwndDlg, IDC_ED_TXSTATUSOPENING, templates.LogXstatusOpening);
// Buttons
SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Show available variables"), BATF_TCHAR);
@@ -923,98 +923,296 @@ INT_PTR CALLBACK DlgProcXLogOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
DestroyIcon(hIcon);
- EnableLogControls(hwndDlg, opt.EnableLogging);
+ SendMessage(hwndDlg, WM_USER + 2, (WPARAM)opt.XLogToFile || opt.XLogToDB, 0);
return TRUE;
}
- case WM_COMMAND:
+ case WM_COMMAND:
{
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
- {
- switch (LOWORD(wParam))
- {
- case IDC_CHK_LOGGING:
- EnableLogControls(hwndDlg, IsDlgButtonChecked(hwndDlg, IDC_CHK_LOGGING) ? TRUE : FALSE);
- break;
- case IDC_CHK_CUTMSG:
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_MSGLEN), IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTMSG));
- break;
- case IDC_CHK_XSTATUSCHANGE:
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGE), IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGE));
- break;
- case IDC_CHK_MSGCHANGE:
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TCHANGEMSG), IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGCHANGE));
- break;
- case IDC_CHK_REMOVE:
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVE), IsDlgButtonChecked(hwndDlg, IDC_CHK_REMOVE));
- break;
- case IDC_CHK_OPENING:
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TOPENING), IsDlgButtonChecked(hwndDlg, IDC_CHK_OPENING));
- break;
- case IDC_BT_VARIABLES:
- MessageBox(hwndDlg, VARIABLES_HELP_TEXT, TranslateT("Variables"), MB_OK | MB_ICONINFORMATION);
- break;
- case IDC_BT_RESET:
- if (ResetTemplatesToDefault(hwndDlg) == IDYES)
- {
- SetDlgItemText(hwndDlg, IDC_ED_TOPENING, DEFAULT_LOG_OPENING);
- CheckDlgButton(hwndDlg, IDC_CHK_OPENING, 1);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TOPENING), TRUE);
- }
- else
- {
- return FALSE;
- }
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ switch (LOWORD(wParam)) {
+ case IDC_XLOGTOFILE:
+ case IDC_XLOGTODB:
+ SendMessage(hwndDlg, WM_USER + 2, (WPARAM)IsDlgButtonChecked(hwndDlg, IDC_XLOGTOFILE) || IsDlgButtonChecked(hwndDlg, IDC_XLOGTODB), 0);
+ break;
+ case IDC_XLOGTODB_WINOPEN:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_XLOGTODB_REMOVE), IsDlgButtonChecked(hwndDlg, IDC_XLOGTODB_WINOPEN));
+ break;
+ case IDC_CHK_XSTATUSCHANGED:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TXSTATUSCHANGED), IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGED));
+ break;
+ case IDC_CHK_XSTATUSREMOVED:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TXSTATUSREMOVED), IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSREMOVED));
+ break;
+ case IDC_CHK_MSGCHANGED:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TMSGCHANGED), IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGCHANGED));
+ break;
+ case IDC_CHK_MSGREMOVED:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TMSGREMOVED), IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGREMOVED));
+ break;
+ case IDC_CHK_XSTATUSOPENING:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TXSTATUSOPENING), IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSOPENING));
+ break;
+ case IDC_BT_VARIABLES:
+ MessageBox(hwndDlg, VARIABLES_HELP_TEXT, TranslateT("Variables"), MB_OK | MB_ICONINFORMATION);
+ break;
+ case IDC_BT_RESET:
+ if (MessageBox(hwndDlg,
+ TranslateT("Do you want to reset all templates to default?"),
+ TranslateT("Reset templates"),
+ MB_ICONQUESTION | MB_YESNO) == IDYES)
+ SendMessage(hwndDlg, WM_USER + 1, 0, 0);
+ else
+ return FALSE;
+ break;
+ }
- break;
- }
+ if (LOWORD(wParam) != IDC_BT_VARIABLES)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- if (LOWORD(wParam) != IDC_BT_VARIABLES)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- break;
- }
+ case EN_CHANGE:
+ if ((HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ return TRUE;
+ }
+ case WM_NOTIFY:
+ {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+ opt.XLogToFile = IsDlgButtonChecked(hwndDlg, IDC_XLOGTOFILE);
+ opt.XLogToDB = IsDlgButtonChecked(hwndDlg, IDC_XLOGTODB);
+ opt.XLogToDB_WinOpen = IsDlgButtonChecked(hwndDlg, IDC_XLOGTODB_WINOPEN);
+ opt.XLogToDB_Remove = IsDlgButtonChecked(hwndDlg, IDC_XLOGTODB_REMOVE);
+ opt.XLogDisableForMusic = IsDlgButtonChecked(hwndDlg, IDC_CHK_DISABLEMUSIC);
+
+ templates.LogXFlags = 0;
+ templates.LogXFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGED) ? NOTIFY_NEW_XSTATUS : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSREMOVED) ? NOTIFY_REMOVE_XSTATUS : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGCHANGED) ? NOTIFY_NEW_MESSAGE : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGREMOVED) ? NOTIFY_REMOVE_MESSAGE : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSOPENING) ? NOTIFY_OPENING_ML : 0);
- case EN_CHANGE:
- {
- if ((HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ // Templates
+ GetDlgItemText(hwndDlg, IDC_ED_TXSTATUSCHANGED, templates.LogXstatusChanged, SIZEOF(templates.LogXstatusChanged));
+ GetDlgItemText(hwndDlg, IDC_ED_TXSTATUSREMOVED, templates.LogXstatusRemoved, SIZEOF(templates.LogXstatusRemoved));
+ GetDlgItemText(hwndDlg, IDC_ED_TMSGCHANGED, templates.LogXMsgChanged, SIZEOF(templates.LogXMsgChanged));
+ GetDlgItemText(hwndDlg, IDC_ED_TMSGREMOVED, templates.LogXMsgRemoved, SIZEOF(templates.LogXMsgRemoved));
+ GetDlgItemText(hwndDlg, IDC_ED_TXSTATUSOPENING, templates.LogXstatusOpening, SIZEOF(templates.LogXstatusOpening));
+
+ SaveOptions();
+ SaveTemplates();
+ }
+ return TRUE;
+ }
+ case WM_USER + 1:
+ CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSCHANGED, 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSREMOVED, 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_MSGCHANGED, 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_MSGREMOVED, 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_XSTATUSOPENING, 1);
+
+ SetDlgItemText(hwndDlg, IDC_ED_TXSTATUSCHANGED, DEFAULT_LOG_CHANGED);
+ SetDlgItemText(hwndDlg, IDC_ED_TXSTATUSREMOVED, DEFAULT_LOG_REMOVED);
+ SetDlgItemText(hwndDlg, IDC_ED_TMSGCHANGED, DEFAULT_LOG_MSGCHANGED);
+ SetDlgItemText(hwndDlg, IDC_ED_TMSGREMOVED, DEFAULT_LOG_MSGREMOVED);
+ SetDlgItemText(hwndDlg, IDC_ED_TXSTATUSOPENING, DEFAULT_LOG_OPENING);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TXSTATUSCHANGED), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TXSTATUSREMOVED), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TMSGCHANGED), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TMSGREMOVED), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TXSTATUSOPENING), TRUE);
+
+ return TRUE;
+ case WM_USER + 2:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_XLOGTODB_WINOPEN), IsDlgButtonChecked(hwndDlg, IDC_XLOGTODB));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_XLOGTODB_REMOVE), IsDlgButtonChecked(hwndDlg, IDC_XLOGTODB) && IsDlgButtonChecked(hwndDlg, IDC_XLOGTODB_WINOPEN));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_XSTATUSCHANGED), wParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_XSTATUSREMOVED), wParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_MSGCHANGED), wParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_MSGREMOVED), wParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_XSTATUSOPENING), wParam);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TXSTATUSCHANGED), wParam && IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGED));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TXSTATUSREMOVED), wParam && IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSREMOVED));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TMSGCHANGED), wParam && IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGCHANGED));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TMSGREMOVED), wParam && IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGREMOVED));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TXSTATUSOPENING), wParam && IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSOPENING));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BT_VARIABLES), wParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BT_RESET), wParam);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+INT_PTR CALLBACK DlgProcLogOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg) {
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+
+ CheckDlgButton(hwndDlg, IDC_LOGTOFILE, opt.LogToFile);
+ CheckDlgButton(hwndDlg, IDC_LOGTODB, opt.LogToDB);
+ CheckDlgButton(hwndDlg, IDC_LOGTODB_WINOPEN, opt.LogToDB_WinOpen);
+ CheckDlgButton(hwndDlg, IDC_LOGTODB_REMOVE, opt.LogToDB_Remove);
+ CheckDlgButton(hwndDlg, IDC_LOGPREVIOUS, opt.LogPrevious);
+ CheckDlgButton(hwndDlg, IDC_SMSGLOGTOFILE, opt.SMsgLogToFile);
+ CheckDlgButton(hwndDlg, IDC_SMSGLOGTODB, opt.SMsgLogToDB);
+ CheckDlgButton(hwndDlg, IDC_SMSGLOGTODB_WINOPEN, opt.SMsgLogToDB_WinOpen);
+ CheckDlgButton(hwndDlg, IDC_SMSGLOGTODB_REMOVE, opt.SMsgLogToDB_Remove);
+
+ //Templates
+ CheckDlgButton(hwndDlg, IDC_LOG_SMSGCHANGED, (templates.LogSMsgFlags & NOTIFY_NEW_MESSAGE) ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_LOG_SMSGREMOVED, (templates.LogSMsgFlags & NOTIFY_REMOVE_MESSAGE) ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_LOG_SMSGOPENING, (templates.LogSMsgFlags & NOTIFY_OPENING_ML) ? 1 : 0);
+
+ SetDlgItemText(hwndDlg, IDC_LOG_TSMSGCHANGED, templates.LogSMsgChanged);
+ SetDlgItemText(hwndDlg, IDC_LOG_TSMSGREMOVED, templates.LogSMsgRemoved);
+ SetDlgItemText(hwndDlg, IDC_LOG_TSMSGOPENING, templates.LogSMsgOpening);
+
+ // Buttons
+ SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Show available variables"), BATF_TCHAR);
+ HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_VARIABLES));
+ SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
+ DestroyIcon(hIcon);
+
+ SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Reset all templates to default"), BATF_TCHAR);
+ hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RESET));
+ SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
+ DestroyIcon(hIcon);
+
+ SendMessage(hwndDlg, WM_USER + 2, (WPARAM)opt.LogToFile || opt.LogToDB, 0);
+ SendMessage(hwndDlg, WM_USER + 3, (WPARAM)opt.SMsgLogToFile || opt.SMsgLogToDB, 0);
+
+ return TRUE;
+ }
+ case WM_COMMAND:
+ {
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ switch (LOWORD(wParam)) {
+ case IDC_LOGTOFILE:
+ case IDC_LOGTODB:
+ SendMessage(hwndDlg, WM_USER + 2, (WPARAM)IsDlgButtonChecked(hwndDlg, IDC_LOGTOFILE) || IsDlgButtonChecked(hwndDlg, IDC_LOGTODB), 0);
+ break;
+ case IDC_SMSGLOGTOFILE:
+ case IDC_SMSGLOGTODB:
+ SendMessage(hwndDlg, WM_USER + 3, (WPARAM)IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTOFILE) || IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTODB), 0);
+ break;
+ case IDC_LOGTODB_WINOPEN:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGTODB_REMOVE), IsDlgButtonChecked(hwndDlg, IDC_LOGTODB_WINOPEN));
+ break;
+ case IDC_SMSGLOGTODB_WINOPEN:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SMSGLOGTODB_REMOVE), IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTODB_WINOPEN));
+ break;
+ case IDC_LOG_SMSGCHANGED:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_TSMSGCHANGED), IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGCHANGED));
+ break;
+ case IDC_LOG_SMSGREMOVED:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_TSMSGREMOVED), IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGREMOVED));
+ break;
+ case IDC_LOG_SMSGOPENING:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_TSMSGOPENING), IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGOPENING));
+ break;
+ case IDC_BT_VARIABLES:
+ MessageBox(hwndDlg, VARIABLES_SM_HELP_TEXT, TranslateT("Variables"), MB_OK | MB_ICONINFORMATION);
+ break;
+ case IDC_BT_RESET:
+ if (MessageBox(hwndDlg,
+ TranslateT("Do you want to reset all templates to default?"),
+ TranslateT("Reset templates"),
+ MB_ICONQUESTION | MB_YESNO) == IDYES)
+ SendMessage(hwndDlg, WM_USER + 1, 0, 0);
+ else
+ return FALSE;
break;
}
+
+ if (LOWORD(wParam) != IDC_BT_VARIABLES)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
+ break;
+
+ case EN_CHANGE:
+ if ((HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
}
return TRUE;
}
- case WM_NOTIFY:
+ case WM_NOTIFY:
{
- if (((LPNMHDR)lParam)->code == PSN_APPLY )
- {
- opt.EnableLogging = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOGGING);
- opt.KeepInHistory = IsDlgButtonChecked(hwndDlg, IDC_CHK_SAVETOHISTORY);
- opt.PreventIdentical = IsDlgButtonChecked(hwndDlg, IDC_CHK_PREVENTIDENTICAL);
- opt.LDisableForMusic = IsDlgButtonChecked(hwndDlg, IDC_CHK_DISABLEMUSIC);
- opt.LTruncateMsg = IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTMSG);
- opt.LMsgLen = GetDlgItemInt(hwndDlg, IDC_ED_MSGLEN, 0, FALSE);
-
- templates.LogFlags = 0;
- templates.LogFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGE) ? NOTIFY_NEW_XSTATUS : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGCHANGE) ? NOTIFY_NEW_MESSAGE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_CHK_REMOVE) ? NOTIFY_REMOVE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_CHK_OPENING) ? NOTIFY_OPENING_ML : 0);
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+ opt.LogToFile = IsDlgButtonChecked(hwndDlg, IDC_LOGTOFILE);
+ opt.LogToDB = IsDlgButtonChecked(hwndDlg, IDC_LOGTODB);
+ opt.LogToDB_WinOpen = IsDlgButtonChecked(hwndDlg, IDC_LOGTODB_WINOPEN);
+ opt.LogToDB_Remove = IsDlgButtonChecked(hwndDlg, IDC_LOGTODB_REMOVE);
+ opt.LogPrevious = IsDlgButtonChecked(hwndDlg, IDC_LOGPREVIOUS);
+ opt.SMsgLogToFile = IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTOFILE);
+ opt.SMsgLogToDB = IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTODB);
+ opt.SMsgLogToDB_WinOpen = IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTODB_WINOPEN);
+ opt.SMsgLogToDB_Remove = IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTODB_REMOVE);
+
+ templates.LogSMsgFlags = 0;
+ templates.LogSMsgFlags |= (IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGCHANGED) ? NOTIFY_NEW_MESSAGE : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGREMOVED) ? NOTIFY_REMOVE_MESSAGE : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGOPENING) ? NOTIFY_OPENING_ML : 0);
// Templates
- GetDlgItemText(hwndDlg, IDC_ED_TDELIMITER, templates.LogDelimiter, SIZEOF(templates.LogDelimiter));
- GetDlgItemText(hwndDlg, IDC_ED_TCHANGE, templates.LogNewXstatus, SIZEOF(templates.LogNewXstatus));
- GetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, templates.LogNewMsg, SIZEOF(templates.LogNewMsg));
- GetDlgItemText(hwndDlg, IDC_ED_TREMOVE, templates.LogRemove, SIZEOF(templates.LogRemove));
- GetDlgItemText(hwndDlg, IDC_ED_TOPENING, templates.LogOpening, SIZEOF(templates.LogOpening));
+ GetDlgItemText(hwndDlg, IDC_LOG_TSMSGCHANGED, templates.LogSMsgChanged, SIZEOF(templates.LogSMsgChanged));
+ GetDlgItemText(hwndDlg, IDC_LOG_TSMSGREMOVED, templates.LogSMsgRemoved, SIZEOF(templates.LogSMsgRemoved));
+ GetDlgItemText(hwndDlg, IDC_LOG_TSMSGOPENING, templates.LogSMsgOpening, SIZEOF(templates.LogSMsgOpening));
SaveOptions();
SaveTemplates();
}
return TRUE;
}
+ case WM_USER + 1:
+ CheckDlgButton(hwndDlg, IDC_LOG_SMSGCHANGED, 1);
+ CheckDlgButton(hwndDlg, IDC_LOG_SMSGREMOVED, 1);
+ CheckDlgButton(hwndDlg, IDC_LOG_SMSGOPENING, 1);
+
+ SetDlgItemText(hwndDlg, IDC_LOG_TSMSGCHANGED, DEFAULT_LOG_SMSGCHANGED);
+ SetDlgItemText(hwndDlg, IDC_LOG_TSMSGREMOVED, DEFAULT_LOG_SMSGREMOVED);
+ SetDlgItemText(hwndDlg, IDC_LOG_TSMSGOPENING, DEFAULT_LOG_SMSGOPENING);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_TSMSGCHANGED), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_TSMSGREMOVED), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_TSMSGOPENING), TRUE);
+
+ return TRUE;
+ case WM_USER + 2:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGTODB_WINOPEN), IsDlgButtonChecked(hwndDlg, IDC_LOGTODB));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGTODB_REMOVE), IsDlgButtonChecked(hwndDlg, IDC_LOGTODB) && IsDlgButtonChecked(hwndDlg, IDC_LOGTODB_WINOPEN));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGPREVIOUS), wParam);
+
+ return TRUE;
+ case WM_USER + 3:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SMSGLOGTODB_WINOPEN), IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTODB));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SMSGLOGTODB_REMOVE), IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTODB) && IsDlgButtonChecked(hwndDlg, IDC_SMSGLOGTODB_WINOPEN));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SMSGCHANGED), wParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SMSGREMOVED), wParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SMSGOPENING), wParam);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_TSMSGCHANGED), wParam && IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGCHANGED));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_TSMSGREMOVED), wParam && IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGREMOVED));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_TSMSGOPENING), wParam && IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGOPENING));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BT_VARIABLES), wParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BT_RESET), wParam);
+
+ return TRUE;
}
return FALSE;
@@ -1033,6 +1231,11 @@ int OptionsInitialize(WPARAM wParam, LPARAM)
odp.pfnDlgProc = DlgProcGeneralOpts;
Options_AddPage(wParam, &odp);
+ odp.pszTab = LPGEN("Logging");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LOG);
+ odp.pfnDlgProc = DlgProcLogOpts;
+ Options_AddPage(wParam, &odp);
+
odp.pszTab = LPGEN("Filtering");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILTERS);
odp.pfnDlgProc = DlgProcFiltering;
@@ -1043,7 +1246,7 @@ int OptionsInitialize(WPARAM wParam, LPARAM)
odp.pfnDlgProc = DlgProcXLogOpts;
Options_AddPage(wParam, &odp);
- if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
odp.pszTitle = LPGEN("Status Notify");
odp.pszGroup = LPGEN("Popups");
odp.pszTab = LPGEN("General");
diff --git a/plugins/NewXstatusNotify/src/options.h b/plugins/NewXstatusNotify/src/options.h
index c0ebc30a29..f8f8657966 100644
--- a/plugins/NewXstatusNotify/src/options.h
+++ b/plugins/NewXstatusNotify/src/options.h
@@ -37,9 +37,10 @@ typedef struct tagOPTIONS {
BYTE LeftClickAction;
BYTE RightClickAction;
// IDD_OPT_XPOPUP
- BYTE PDisableForMusic;
- BYTE PTruncateMsg;
- DWORD PMsgLen;
+ BYTE PXOnConnect;
+ BYTE PXDisableForMusic;
+ BYTE PXMsgTruncate;
+ DWORD PXMsgLen;
// IDD_OPT_GENERAL
BYTE FromOffline;
BYTE AutoDisable;
@@ -47,23 +48,32 @@ typedef struct tagOPTIONS {
BYTE UseIndSnd;
BYTE BlinkIcon;
BYTE BlinkIcon_Status;
- BYTE Log;
- BYTE LogToDB, CheckMessageWindow;
+ BYTE BlinkIcon_ForMsgs;
TCHAR LogFilePath[MAX_PATH];
// IDD_AUTODISABLE
BYTE OnlyGlobalChanges;
BYTE DisableSoundGlobally;
BYTE DisablePopupGlobally;
+ // IDD_OPT_LOG
+ BYTE LogToFile;
+ BYTE LogToDB;
+ BYTE LogToDB_WinOpen;
+ BYTE LogToDB_Remove;
+ BYTE LogPrevious;
+ BYTE SMsgLogToFile;
+ BYTE SMsgLogToDB;
+ BYTE SMsgLogToDB_WinOpen;
+ BYTE SMsgLogToDB_Remove;
// IDD_OPT_XLOG
- BYTE EnableLogging;
- BYTE PreventIdentical;
- BYTE KeepInHistory;
- BYTE LDisableForMusic;
- BYTE LTruncateMsg;
- DWORD LMsgLen;
- //IDD_OPT_SMPOPUP
- BYTE PopupOnConnect;
- BYTE IgnoreEmpty;
+ BYTE XLogToFile;
+ BYTE XLogToDB;
+ BYTE XLogToDB_WinOpen;
+ BYTE XLogToDB_Remove;
+ BYTE XLogDisableForMusic;
+ // IDD_OPT_SMPOPUP
+ BYTE PSMsgOnConnect;
+ BYTE PSMsgTruncate;
+ DWORD PSMsgLen;
// OTHER
BYTE TempDisabled;
BYTE PopupAutoDisabled;
@@ -72,20 +82,25 @@ typedef struct tagOPTIONS {
} OPTIONS;
typedef struct tagTEMPLATES {
- BYTE PopupFlags;
- BYTE LogFlags;
- TCHAR PopupDelimiter[32];
- TCHAR PopupNewXstatus[256];
- TCHAR PopupNewMsg[256];
- TCHAR PopupRemove[256];
- TCHAR LogDelimiter[32];
- TCHAR LogNewXstatus[256];
- TCHAR LogNewMsg[256];
- TCHAR LogRemove[256];
- TCHAR LogOpening[256];
+ BYTE PopupXFlags;
+ BYTE PopupSMsgFlags;
+ BYTE LogXFlags;
+ BYTE LogSMsgFlags;
+ TCHAR PopupXstatusChanged[256];
+ TCHAR PopupXstatusRemoved[256];
+ TCHAR PopupXMsgChanged[256];
+ TCHAR PopupXMsgRemoved[256];
+ TCHAR LogXstatusChanged[256];
+ TCHAR LogXstatusRemoved[256];
+ TCHAR LogXMsgChanged[256];
+ TCHAR LogXMsgRemoved[256];
+ TCHAR LogXstatusOpening[256];
+ TCHAR LogSMsgChanged[256];
+ TCHAR LogSMsgRemoved[256];
+ TCHAR LogSMsgOpening[256];
} TEMPLATES;
-int OptionsInitialize(WPARAM wParam, LPARAM lParam);
-void LoadOptions();
+int OptionsInitialize(WPARAM wParam, LPARAM lParam);
+void LoadOptions();
-#endif \ No newline at end of file
+#endif
diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp
index d691d12118..bb7aab3295 100644
--- a/plugins/NewXstatusNotify/src/popup.cpp
+++ b/plugins/NewXstatusNotify/src/popup.cpp
@@ -21,9 +21,50 @@
#include "common.h"
+void ShowChangePopup(MCONTACT hContact, char *szProto, HICON hIcon, WORD newStatus, TCHAR *stzText, PLUGINDATA *pdp)
+{
+ POPUPDATAT ppd = {0};
+ ppd.lchContact = hContact;
+ ppd.lchIcon = hIcon;//LoadSkinnedProtoIcon(szProto, iconStatus);
+ _tcsncpy(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GSMDF_TCHAR), MAX_CONTACTNAME);
+
+ // add group name to popup title
+ if (opt.ShowGroup) {
+ DBVARIANT dbv;
+ if (!db_get_ts(hContact, "CList", "Group", &dbv)) {
+ _tcsncat(ppd.lptzContactName, _T(" ("), MAX_CONTACTNAME);
+ _tcsncat(ppd.lptzContactName, dbv.ptszVal, MAX_CONTACTNAME);
+ _tcsncat(ppd.lptzContactName, _T(")"), MAX_CONTACTNAME);
+ db_free(&dbv);
+ }
+ }
+
+ _tcsncpy(ppd.lptzText, stzText, MAX_SECONDLINE);
+
+ switch (opt.Colors) {
+ case POPUP_COLOR_OWN:
+ ppd.colorBack = StatusList[Index(newStatus)].colorBack;
+ ppd.colorText = StatusList[Index(newStatus)].colorText;
+ break;
+ case POPUP_COLOR_WINDOWS:
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ break;
+ case POPUP_COLOR_POPUP:
+ ppd.colorBack = ppd.colorText = 0;
+ break;
+ }
+
+ ppd.PluginWindowProc = PopupDlgProc;
+
+ ppd.PluginData = pdp;
+ ppd.iSeconds = opt.PopupTimeout;
+ PUAddPopupT(&ppd);
+}
+
static int AwayMsgHook(WPARAM wParam, LPARAM lParam, LPARAM pObj)
{
- PLUGINDATA *pdp = (PLUGINDATA*)pObj;
+ PLUGINDATA *pdp = (PLUGINDATA *)pObj;
if (pdp == NULL)
return 0;
@@ -31,7 +72,7 @@ static int AwayMsgHook(WPARAM wParam, LPARAM lParam, LPARAM pObj)
if (ack->type != ACKTYPE_AWAYMSG || ack->hProcess != pdp->hAwayMsgProcess)
return 0;
- //The first thing we go is removing the hook from the chain to avoid useless calls.
+ //The first thing we do is removing the hook from the chain to avoid useless calls.
UnhookEvent(pdp->hAwayMsgHook);
pdp->hAwayMsgHook = NULL;
@@ -39,9 +80,9 @@ static int AwayMsgHook(WPARAM wParam, LPARAM lParam, LPARAM pObj)
return 0;
MCONTACT hContact = PUGetContact(pdp->hWnd);
- ptrT pstzLast( db_get_tsa(hContact, MODULE, "LastPopupText"));
+ ptrT pstzLast(db_get_tsa(hContact, MODULE, "LastPopupText"));
- TCHAR *tszStatus = (TCHAR*)ack->lParam;
+ TCHAR *tszStatus = (TCHAR *)ack->lParam;
if (tszStatus == NULL || *tszStatus == 0)
return 0;
@@ -60,9 +101,8 @@ void QueryAwayMessage(HWND hWnd, PLUGINDATA *pdp)
{
MCONTACT hContact = PUGetContact(hWnd);
char *szProto = GetContactProto(hContact);
- if (szProto)
- {
- if ((CallProtoService(szProto, PS_GETCAPS,PFLAGNUM_1, 0) & PF1_MODEMSGRECV) &&
+ if (szProto) {
+ if ((CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) &&
(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(pdp->newStatus)))
{
pdp->hWnd = hWnd;
@@ -116,7 +156,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{
PLUGINDATA *pdp = NULL;
- switch(message) {
+ switch (message) {
case WM_MEASUREITEM: //Needed by the contact's context menu
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
@@ -150,7 +190,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case UM_INITPOPUP:
pdp = (PLUGINDATA *)PUGetPluginData(hwnd);
if (pdp != NULL) {
- char *szProto = GetContactProto( PUGetContact(hwnd));
+ char *szProto = GetContactProto(PUGetContact(hwnd));
if (szProto && opt.ReadAwayMsg && StatusHasAwayMessage(szProto, pdp->newStatus)) {
WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if (myStatus != ID_STATUS_INVISIBLE)
diff --git a/plugins/NewXstatusNotify/src/popup.h b/plugins/NewXstatusNotify/src/popup.h
index 784ea05973..f96ab28904 100644
--- a/plugins/NewXstatusNotify/src/popup.h
+++ b/plugins/NewXstatusNotify/src/popup.h
@@ -37,6 +37,15 @@
#define STRING_SHOWPREVIOUSSTATUS LPGENT("(was %s)")
+typedef struct tagPLUGINDATA
+{
+ WORD newStatus;
+ WORD oldStatus;
+ HWND hWnd;
+ HANDLE hAwayMsgProcess;
+ HANDLE hAwayMsgHook;
+} PLUGINDATA;
+
static struct {
TCHAR *Text;
int Action;
@@ -49,6 +58,7 @@ static struct {
LPGENT("Do nothing"), PCA_DONOTHING
};
+void ShowChangePopup(MCONTACT hContact, char *szProto, HICON hIcon, WORD newStatus, TCHAR *stzText, PLUGINDATA *pdp = NULL);
LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
#endif \ No newline at end of file
diff --git a/plugins/NewXstatusNotify/src/resource.h b/plugins/NewXstatusNotify/src/resource.h
index 3e2cfe9fd3..e827187708 100644
--- a/plugins/NewXstatusNotify/src/resource.h
+++ b/plugins/NewXstatusNotify/src/resource.h
@@ -7,14 +7,16 @@
#define IDD_OPT_GENERAL 103
#define IDI_RESET 109
#define IDI_VARIABLES 110
+#define IDI_LOGGING_XSTATUS 112
#define IDD_AUTODISABLE 113
+#define IDI_LOGGING_SMSG 113
#define IDD_OPT_FILTERS 114
#define IDD_OPT_POPUP 115
#define IDD_OPT_XLOG 116
#define IDI_POPUP 117
#define IDD_OPT_SMPOPUP 117
#define IDI_SOUND 118
-#define IDI_LOGGING 119
+#define IDD_OPT_LOG 118
#define IDI_XSTATUS 120
#define IDI_DISABLEALL 121
#define IDI_ENABLEALL 122
@@ -37,8 +39,10 @@
#define IDC_USEPOPUPCOLORS 1013
#define IDC_ED_MSGLEN 1013
#define IDC_ED_TOPENING 1018
+#define IDC_ED_TXSTATUSOPENING 1018
#define IDC_ED_TCHANGE 1024
#define IDC_ED_TCHANGEMSG 1025
+#define IDC_ED_TREMOVEMSG 1026
#define IDC_BT_VARIABLES 1028
#define IDC_BT_RESET 1029
#define IDC_PREVIEW 1030
@@ -47,6 +51,8 @@
#define IDC_DELETE 1032
#define IDC_CHK_XSTATUSCHANGE 1032
#define IDC_CHK_OPENING 1033
+#define IDC_CHK_MSGREMOVE 1033
+#define IDC_CHK_XSTATUSOPENING 1033
#define IDC_UD_MSGLEN 1034
#define IDC_CHK_PGLOBAL 1035
#define IDC_CHK_SGLOBAL 1036
@@ -58,18 +64,47 @@
#define IDC_INDSNDLIST 1044
#define IDC_LOGTODB 1044
#define IDC_CHECKMESSAGEWINDOW 1045
+#define IDC_SMSGLOGTODB 1045
+#define IDC_ED_SMSGLEN 1046
+#define IDC_LOGTODB_WINOPEN 1046
+#define IDC_UD_SMSGLEN 1047
+#define IDC_LOGTODB_REMOVE 1047
+#define IDC_XONCONNECT 1048
+#define IDC_SMSGLOGTODB_WINOPEN 1048
+#define IDC_LOGTOFILE 1049
+#define IDC_LOGPREVIOUS 1050
+#define IDC_SMSGLOGTOFILE 1051
#define IDC_HIDDENCONTACTSTOO 1052
+#define IDC_SMSGLOGTODB_REMOVE 1052
#define IDC_USEINDIVSOUNDS 1053
+#define IDC_LOG_SMSGCHANGED 1053
+#define IDC_LOG_SMSGREMOVED 1054
#define IDC_OK 1055
+#define IDC_LOG_TSMSGCHANGED 1055
#define IDC_CANCEL 1056
+#define IDC_LOG_TSMSGREMOVED 1056
#define IDC_CONFIGUREAUTODISABLE 1057
+#define IDC_LOG_SMSG_OPENING 1057
+#define IDC_LOG_SMSGOPENING 1057
+#define IDC_XLOGTODB_REMOVE 1057
+#define IDC_LOG_TSMSGOPENING 1058
+#define IDC_CHK_XSTATUSCHANGED 1058
+#define IDC_CHK_MSGCHANGED 1059
#define IDC_AUTODISABLE 1060
+#define IDC_CHK_XSTATUSREMOVED 1060
#define IDC_LOG 1061
+#define IDC_ED_TXSTATUSCHANGED 1061
+#define IDC_ED_TXSTATUSREMOVED 1062
+#define IDC_ED_TMSGCHANGED 1063
+#define IDC_CHK_MSGREMOVED 1064
+#define IDC_ED_TMSGCHANGED2 1065
+#define IDC_ED_TMSGREMOVED 1065
#define IDC_TIMEOUT_VALUE 1066
#define IDC_BLINKICON 1067
#define IDC_CONNECTIONTIMEOUT_VALUE 1067
#define IDC_BLINKICON_STATUS 1068
#define IDC_SOUNDICON 1069
+#define IDC_BLINKICON_FORMSGS 1069
#define IDC_POPUPICON 1070
#define IDC_CHECK_NOTIFYSOUNDS 1071
#define IDC_CHECK_NOTIFYPOPUPS 1073
@@ -78,21 +113,34 @@
#define IDC_SHOWALTDESCS 1077
#define IDC_LOGGINGICON 1078
#define IDC_SHOWSTATUS 1078
+#define IDC_XLOGGINGICON 1078
#define IDC_XSTATUSICON 1079
#define IDC_DISABLEALLICON 1080
#define IDC_ENABLEALLICON 1081
#define IDC_SHOWGROUP 1082
#define IDC_STATUSMESSAGEICON 1082
+#define IDC_SMSGICON 1082
+#define IDC_XLOGGINGICON2 1083
+#define IDC_SMSGLOGGINGICON 1083
#define IDC_ONCONNECT 1101
#define IDC_PUIGNOREREMOVE 1102
+#define IDC_CHK_NEWSMSG 1102
+#define IDC_CHK_SMSGREMOVE 1103
+#define IDC_CUTSMSG 1104
+#define IDC_CHK_CUTSMSG 1104
#define IDC_POPUPTEXT 1115
+#define IDC_ED_TNEWSMSG 1115
+#define IDC_ED_TSMSGREMOVE 1116
#define IDC_PROTOCOLLIST 1207
#define IDC_LOGFILE 2029
#define IDC_BT_CHOOSELOGFILE 2030
#define IDC_BT_VIEWLOG 2031
#define IDC_CHK_LOGGING 2034
+#define IDC_XLOGTOFILE 2034
#define IDC_CHK_SAVETOHISTORY 2039
+#define IDC_XLOGTODB_WINOPEN 2039
#define IDC_CHK_PREVENTIDENTICAL 2040
+#define IDC_XLOGTODB 2040
#define IDC_CHK_OFFLINE 40071
#define IDC_CHK_ONLINE 40072
#define IDC_CHK_AWAY 40073
@@ -117,7 +165,7 @@
#define IDC_ONTHEPHONE_TX 41079
#define IDC_OUTTOLUNCH_TX 41080
#define IDC_XSTATUS_TX 41081
-#define IDC_STATUSMESSAGE_TX 41082
+#define IDC_STATUSMSG_TX 41082
#define IDC_OFFLINE_BG 42071
#define IDC_ONLINE_BG 42072
#define IDC_CHK_ONLINE2 42072
@@ -138,15 +186,15 @@
#define IDC_OUTTOLUNCH_BG 42080
#define IDC_CHK_OUTTOLUNCH2 42080
#define IDC_XSTATUS_BG 42081
-#define IDC_STATUSMESSAGE_BG 42082
+#define IDC_STATUSMSG_BG 42082
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 111
+#define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1046
+#define _APS_NEXT_CONTROL_VALUE 1064
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp
index 08e61f1dd2..0ab6804695 100644
--- a/plugins/NewXstatusNotify/src/utils.cpp
+++ b/plugins/NewXstatusNotify/src/utils.cpp
@@ -21,7 +21,6 @@
#include "common.h"
-
// From NewEventNotify :-)
bool CheckMsgWnd(MCONTACT hContact)
{
@@ -33,7 +32,7 @@ bool CheckMsgWnd(MCONTACT hContact)
MessageWindowData mwd;
mwd.cbSize = sizeof(MessageWindowData);
mwd.hContact = hContact;
- if (CallService(MS_MSG_GETWINDOWDATA, (WPARAM) &mwid, (LPARAM) &mwd) != NULL)
+ if (CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd) != NULL)
return false;
if (mwd.hwndWindow != NULL && (mwd.uState & MSG_WINDOW_STATE_EXISTS))
@@ -42,45 +41,19 @@ bool CheckMsgWnd(MCONTACT hContact)
return false;
}
-
-
-TCHAR *db2t(DBVARIANT *dbv)
-{
- TCHAR *buff;
- switch (dbv->type) {
- case DBVT_ASCIIZ: buff = mir_a2t(dbv->pszVal); break;
- case DBVT_WCHAR: buff = mir_tstrdup(dbv->ptszVal); break;
- case DBVT_UTF8: buff = mir_utf8decodeT(dbv->pszVal); break;
- default: return NULL;
- }
-
- if (buff[0] == 0) {
- mir_free(buff);
- buff = NULL;
- }
-
- return buff;
-}
-
int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSetting, TCHAR *setting, int size, const TCHAR *defaultValue)
{
DBVARIANT dbv;
- if ( !db_get_ts(hContact, szModule, szSetting, &dbv)) {
+ if (!db_get_ts(hContact, szModule, szSetting, &dbv)) {
_tcsncpy(setting, dbv.ptszVal, size);
db_free(&dbv);
return 0;
- }
+ }
_tcsncpy(setting, defaultValue, size);
return 1;
}
-void HigherLower(int maxValue, int minValue)
-{
- TCHAR str[64] = { 0 };
- mir_sntprintf(str, SIZEOF(str), TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue);
-}
-
void ShowLog(TCHAR *file)
{
int res = (int)ShellExecute(NULL, _T("open"), file, NULL, NULL, SW_SHOW);
@@ -88,7 +61,7 @@ void ShowLog(TCHAR *file)
MessageBox(0, TranslateT("Can't open the log file!"), TranslateT("NewXstatusNotify"), MB_OK | MB_ICONERROR);
}
-BOOL StatusHasAwayMessage(char *szProto, int status)
+BOOL StatusHasAwayMessage(char *szProto, int status)
{
if (szProto != NULL) {
unsigned long iSupportsSM = (unsigned long)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0);
@@ -111,9 +84,9 @@ BOOL StatusHasAwayMessage(char *szProto, int status)
}
void LogToFile(TCHAR *stzText)
-{
+{
FILE *fp = _tfopen(opt.LogFilePath, _T("a+b, ccs=UTF-8"));
- if (fp) {
+ if (fp) {
char *encodedText = mir_utf8encodeT(stzText);
if (encodedText) {
fprintf(fp, encodedText);
@@ -122,3 +95,40 @@ void LogToFile(TCHAR *stzText)
fclose(fp);
}
}
+
+WCHAR *mir_dupToUnicodeEx(char *ptr, UINT CodePage)
+{
+ if (ptr == NULL)
+ return NULL;
+
+ size_t size = strlen(ptr) + 1;
+ WCHAR *tmp = (WCHAR *)mir_alloc(size * sizeof(WCHAR));
+
+ MultiByteToWideChar(CodePage, 0, ptr, -1, tmp, (int)size * sizeof(WCHAR));
+ return tmp;
+}
+
+TCHAR *AddCR(const TCHAR *stzText)
+{
+ const TCHAR *found;
+ int i = 0, len = lstrlen(stzText), j;
+ TCHAR *tmp = (TCHAR *)mir_alloc(1024 * sizeof(TCHAR));
+ *tmp = _T('\0');
+ while ((found = _tcsstr((stzText + i), _T("\n"))) != NULL && _tcslen(tmp) + 1 < 1024) {
+ j = (int)(found - stzText);
+ if (lstrlen(tmp) + j - i + 2 < 1024)
+ tmp = _tcsncat(tmp, stzText + i, j - i);
+ else
+ break;
+
+ if (j == 0 || *(stzText + j - 1) != _T('\r'))
+ tmp = lstrcat(tmp, _T("\r"));
+
+ tmp = lstrcat(tmp, _T("\n"));
+ i = j + 1;
+ }
+ if (lstrlen(tmp) + len - i + 1 < 1024)
+ tmp = lstrcat(tmp, stzText + i);
+
+ return tmp;
+}
diff --git a/plugins/NewXstatusNotify/src/utils.h b/plugins/NewXstatusNotify/src/utils.h
index e1a33b8de6..9d4cd1b35f 100644
--- a/plugins/NewXstatusNotify/src/utils.h
+++ b/plugins/NewXstatusNotify/src/utils.h
@@ -22,11 +22,12 @@
#ifndef UTILS_H
#define UTILS_H
-TCHAR *db2t(DBVARIANT *dbv);
+bool CheckMsgWnd(MCONTACT hContact);
int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSetting, TCHAR *setting, int size, const TCHAR *defaultValue);
-void HigherLower(int maxValue, int minValue);
void ShowLog(TCHAR *file);
BOOL StatusHasAwayMessage(char *szProto, int status);
void LogToFile(TCHAR *stzText);
+WCHAR *mir_dupToUnicodeEx(char *ptr, UINT CodePage);
+TCHAR *AddCR(const TCHAR *statusmsg);
-#endif \ No newline at end of file
+#endif
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp
index b6478f3a6f..366a750dc8 100644
--- a/plugins/NewXstatusNotify/src/xstatus.cpp
+++ b/plugins/NewXstatusNotify/src/xstatus.cpp
@@ -41,13 +41,37 @@ void FreeXSC(XSTATUSCHANGE *xsc)
}
}
-void RemoveLoggedEvents(MCONTACT hContact)
+void RemoveLoggedEventsXStatus(MCONTACT hContact)
{
- for (int i = eventList.getCount()-1; i >= 0; i--) {
- DBEVENT *dbevent = eventList[i];
+ for (int i = eventListXStatus.getCount() - 1; i >= 0; i--) {
+ DBEVENT *dbevent = eventListXStatus[i];
if (dbevent->hContact == hContact) {
db_event_delete(dbevent->hContact, dbevent->hDBEvent);
- eventList.remove(i);
+ eventListXStatus.remove(i);
+ mir_free(dbevent);
+ }
+ }
+}
+
+void RemoveLoggedEventsStatus(MCONTACT hContact)
+{
+ for (int i = eventListStatus.getCount() - 1; i >= 0; i--) {
+ DBEVENT *dbevent = eventListStatus[i];
+ if (dbevent->hContact == hContact) {
+ db_event_delete(dbevent->hContact, dbevent->hDBEvent);
+ eventListStatus.remove(i);
+ mir_free(dbevent);
+ }
+ }
+}
+
+void RemoveLoggedEventsSMsg(MCONTACT hContact)
+{
+ for (int i = eventListSMsg.getCount() - 1; i >= 0; i--) {
+ DBEVENT *dbevent = eventListSMsg[i];
+ if (dbevent->hContact == hContact) {
+ db_event_delete(dbevent->hContact, dbevent->hDBEvent);
+ eventListSMsg.remove(i);
mir_free(dbevent);
}
}
@@ -69,120 +93,125 @@ TCHAR *GetStatusTypeAsString(int type, TCHAR *buff)
return buff;
}
-void ReplaceVars(XSTATUSCHANGE *xsc , TCHAR *Template, TCHAR *delimiter, TCHAR *buff)
+TCHAR *ReplaceVars(XSTATUSCHANGE *xsc, const TCHAR *tmplt)
{
- buff[0] = 0;
- TCHAR *pch = _tcschr(Template, _T('%'));
- while (pch != NULL) {
- size_t len = _tcslen(buff);
- _tcsncat(buff, Template, pch - Template);
- buff[len + pch - Template] = 0;
-
- if (pch[1] == _T('N') || pch[1] == _T('T') || pch[1] == _T('I') || pch[1] == _T('D') || pch[1] == _T('B')) {
- switch (pch[1]) {
- case _T('N'):
+ TCHAR tmp[1024];
+
+ if (tmplt == NULL || tmplt[0] == _T('\0'))
+ return NULL;
+
+ TCHAR *str = (TCHAR *)mir_alloc(2048 * sizeof(TCHAR));
+ str[0] = _T('\0');
+ int len = lstrlen(tmplt);
+
+ for (int i = 0; i < len; i++) {
+ tmp[0] = _T('\0');
+
+ if (tmplt[i] == _T('%')) {
+ i++;
+ switch (tmplt[i]) {
+ case 'n':
{
TCHAR stzType[32];
- _tcscat(buff, GetStatusTypeAsString(xsc->type, stzType));
+ lstrcpyn(tmp, GetStatusTypeAsString(xsc->type, stzType), SIZEOF(tmp));
}
break;
- case _T('T'):
- if (xsc->stzTitle)
- _tcscat(buff, xsc->stzTitle);
- break;
- case _T('I'):
- if (xsc->stzText)
- _tcscat(buff, xsc->stzText);
+
+ case 't':
+ if (xsc->stzTitle == NULL || xsc->stzTitle[0] == _T('\0'))
+ lstrcpyn(tmp, TranslateT("<no title>"), SIZEOF(tmp));
+ else
+ lstrcpyn(tmp, xsc->stzTitle, SIZEOF(tmp));
break;
- case _T('D'):
- if (xsc->stzText) {
- if (_tcscmp(delimiter, _T("%B")) == 0)
- _tcscat(buff, _T("\r\n"));
- else
- _tcscat(buff, delimiter);
+
+ case 'm':
+ if (xsc->stzText == NULL || xsc->stzText[0] == _T('\0'))
+ lstrcpyn(tmp, TranslateT("<no status message>"), SIZEOF(tmp));
+ else {
+ TCHAR *_tmp = AddCR(xsc->stzText);
+ lstrcpyn(tmp, _tmp, SIZEOF(tmp));
+ mir_free(_tmp);
}
break;
- case _T('B'):
- _tcscat(buff, _T("\r\n"));
+
+ case 'c':
+ if (xsc->hContact == NULL)
+ lstrcpyn(tmp, TranslateT("Contact"), SIZEOF(tmp));
+ else
+ lstrcpyn(tmp, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)xsc->hContact, GCDNF_TCHAR), SIZEOF(tmp));
break;
- }
- Template = pch + 2;
+ default:
+ i--;
+ tmp[0] = tmplt[i], tmp[1] = _T('\0');
+ break;
+ }
}
- else {
- _tcscat(buff, _T("%"));
- Template = pch + 1;
+ else if (tmplt[i] == _T('\\')) {
+ i++;
+ switch (tmplt[i]) {
+ case 'n':
+ tmp[0] = _T('\r'), tmp[1] = _T('\n'), tmp[2] = _T('\0');
+ break;
+ case 't':
+ tmp[0] = _T('\t'), tmp[1] = _T('\0');
+ break;
+ default:
+ i--;
+ tmp[0] = tmplt[i], tmp[1] = _T('\0');
+ break;
+ }
+ }
+ else
+ tmp[0] = tmplt[i], tmp[1] = _T('\0');
+
+ if (tmp[0] != _T('\0')) {
+ if (lstrlen(tmp) + lstrlen(str) < 2044)
+ lstrcat(str, tmp);
+ else {
+ lstrcat(str, _T("..."));
+ break;
+ }
}
-
- pch = _tcschr(Template, _T('%'));
}
- // append rest of the text
- if (Template != NULL)
- _tcscat(buff, Template);
+ return str;
}
-void ShowPopup(XSTATUSCHANGE *xsc)
+void ShowXStatusPopup(XSTATUSCHANGE *xsc)
{
- DBVARIANT dbv;
- char szSetting[64];
+ HICON hIcon = NULL;
- POPUPDATAT ppd = {0};
- ppd.lchContact = xsc->hContact;
-
- switch(xsc->type) {
+ switch (xsc->type) {
case TYPE_JABBER_MOOD:
case TYPE_JABBER_ACTIVITY:
- mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", xsc->szProto, (xsc->type == TYPE_JABBER_MOOD) ? "mood" : "activity", "icon");
- if (!db_get_s(xsc->hContact, "AdvStatus", szSetting, &dbv)) {
- ppd.lchIcon = Skin_GetIcon(dbv.pszVal);
- db_free(&dbv);
+ {
+ DBVARIANT dbv;
+ char szSetting[64];
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", xsc->szProto, (xsc->type == TYPE_JABBER_MOOD) ? "mood" : "activity", "icon");
+ if (!db_get_s(xsc->hContact, "AdvStatus", szSetting, &dbv)) {
+ hIcon = Skin_GetIcon(dbv.pszVal);
+ db_free(&dbv);
+ }
+ break;
}
- break;
-
case TYPE_ICQ_XSTATUS:
{
int statusId = db_get_b(xsc->hContact, xsc->szProto, "XStatusId", 0);
- ppd.lchIcon = (HICON)CallProtoService(xsc->szProto, PS_GETCUSTOMSTATUSICON, statusId, LR_SHARED);
+ hIcon = (HICON)CallProtoService(xsc->szProto, PS_GETCUSTOMSTATUSICON, statusId, LR_SHARED);
}
}
- if (ppd.lchIcon == NULL)
- ppd.lchIcon = LoadSkinnedProtoIcon(xsc->szProto, db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_ONLINE));
-
- switch (opt.Colors) {
- case POPUP_COLOR_OWN:
- ppd.colorBack = db_get_dw(0, MODULE, "40081bg", COLOR_BG_AVAILDEFAULT);
- ppd.colorText = db_get_dw(0, MODULE, "40081tx", COLOR_TX_DEFAULT);
- break;
- case POPUP_COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- break;
- case POPUP_COLOR_POPUP:
- ppd.colorBack = ppd.colorText = 0;
- break;
- }
-
- TCHAR *ptszGroup = NULL;
- TCHAR *ptszNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)xsc->hContact, GSMDF_TCHAR);
- if (opt.ShowGroup) { //add group name to popup title
- if (!db_get_ts(xsc->hContact, "CList", "Group", &dbv)) {
- ptszGroup = NEWTSTR_ALLOCA(dbv.ptszVal);
- db_free(&dbv);
- }
- }
-
- if (ptszGroup)
- mir_sntprintf(ppd.lptzContactName, MAX_CONTACTNAME,_T("%s (%s)"), ptszNick, ptszGroup);
- else
- _tcsncpy(ppd.lptzContactName, ptszNick, MAX_CONTACTNAME);
+ if (hIcon == NULL)
+ hIcon = LoadSkinnedProtoIcon(xsc->szProto, db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_ONLINE));
// cut message if needed
- if (opt.PTruncateMsg && (opt.PMsgLen > 0) && xsc->stzText && (_tcslen(xsc->stzText) > opt.PMsgLen)) {
+ TCHAR *copyText = NULL;
+ if (opt.PXMsgTruncate && (opt.PXMsgLen > 0) && xsc->stzText && (_tcslen(xsc->stzText) > opt.PXMsgLen)) {
TCHAR buff[MAX_TEXT_LEN + 3];
- _tcsncpy(buff, xsc->stzText, opt.PMsgLen);
- buff[opt.PMsgLen] = 0;
+ copyText = mir_tstrdup(xsc->stzText);
+ _tcsncpy(buff, xsc->stzText, opt.PXMsgLen);
+ buff[opt.PXMsgLen] = 0;
_tcscat(buff, _T("..."));
mir_free(xsc->stzText);
xsc->stzText = mir_tstrdup(buff);
@@ -191,66 +220,102 @@ void ShowPopup(XSTATUSCHANGE *xsc)
TCHAR *Template = _T("");
switch (xsc->action) {
case NOTIFY_NEW_XSTATUS:
- Template = templates.PopupNewXstatus; break;
+ Template = templates.PopupXstatusChanged; break;
case NOTIFY_NEW_MESSAGE:
- Template = templates.PopupNewMsg; break;
- case NOTIFY_REMOVE:
- Template = templates.PopupRemove; break;
- case NOTIFY_OPENING_ML:
- Template = templates.LogOpening; break;
+ Template = templates.PopupXMsgChanged; break;
+ case NOTIFY_REMOVE_XSTATUS:
+ Template = templates.PopupXstatusRemoved; break;
+ case NOTIFY_REMOVE_MESSAGE:
+ Template = templates.PopupXMsgRemoved; break;
+ }
+
+ TCHAR *stzPopupText = ReplaceVars(xsc, Template);
+
+ ShowChangePopup(xsc->hContact, xsc->szProto, hIcon, ID_STATUS_EXTRASTATUS, stzPopupText);
+ mir_free(stzPopupText);
+
+ if (copyText) {
+ mir_free(xsc->stzText);
+ xsc->stzText = mir_tstrdup(copyText);
+ mir_free(copyText);
+ }
+}
+
+void BlinkXStatusIcon(XSTATUSCHANGE *xsc)
+{
+ HICON hIcon = NULL;
+ TCHAR str[256] = {0};
+ TCHAR stzType[32];
+ mir_sntprintf(str, SIZEOF(str), TranslateT("%s changed %s"),
+ CallService(MS_CLIST_GETCONTACTDISPLAYNAME, xsc->hContact, GCDNF_TCHAR), GetStatusTypeAsString(xsc->type, stzType));
+
+ if (opt.BlinkIcon_Status) {
+ DBVARIANT dbv;
+ char szSetting[64];
+
+ switch (xsc->type) {
+ case TYPE_JABBER_MOOD:
+ case TYPE_JABBER_ACTIVITY:
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", xsc->szProto, (xsc->type == TYPE_JABBER_MOOD) ? "mood" : "activity", "icon");
+ if (!db_get_s(xsc->hContact, "AdvStatus", szSetting, &dbv)) {
+ hIcon = Skin_GetIcon(dbv.pszVal);
+ db_free(&dbv);
+ }
+ break;
+ case TYPE_ICQ_XSTATUS:
+ {
+ int statusId = db_get_b(xsc->hContact, xsc->szProto, "XStatusId", 0);
+ hIcon = (HICON)CallProtoService(xsc->szProto, PS_GETCUSTOMSTATUSICON, statusId, LR_SHARED);
+ }
+ }
}
- TCHAR stzPopupText[2*MAX_TEXT_LEN];
- ReplaceVars(xsc, Template, templates.PopupDelimiter, stzPopupText);
- _tcsncpy(ppd.lptzText, stzPopupText, SIZEOF(ppd.lptzText));
- ppd.lptzText[SIZEOF(ppd.lptzText) - 1] = 0;
+ if (hIcon == NULL)
+ hIcon = LoadSkinnedIcon(SKINICON_OTHER_USERONLINE);
- ppd.PluginWindowProc = PopupDlgProc;
- ppd.iSeconds = opt.PopupTimeout;
- PUAddPopupT(&ppd);
+ BlinkIcon(xsc->hContact, xsc->szProto, hIcon, str);
+ mir_free(str);
}
-void PlayXStatusSound(int action)
+void PlayXStatusSound(MCONTACT hContact, int action)
{
switch (action) {
case NOTIFY_NEW_XSTATUS:
- SkinPlaySound(XSTATUS_SOUND_CHANGED); break;
+ PlayChangeSound(hContact, XSTATUS_SOUND_CHANGED); break;
+ case NOTIFY_REMOVE_XSTATUS:
+ PlayChangeSound(hContact, XSTATUS_SOUND_REMOVED); break;
case NOTIFY_NEW_MESSAGE:
- SkinPlaySound(XSTATUS_SOUND_MSGCHANGED); break;
- case NOTIFY_REMOVE:
- SkinPlaySound(XSTATUS_SOUND_REMOVED); break;
+ PlayChangeSound(hContact, XSTATUS_SOUND_MSGCHANGED); break;
+ case NOTIFY_REMOVE_MESSAGE:
+ PlayChangeSound(hContact, XSTATUS_SOUND_MSGREMOVED); break;
}
}
-void LogToMessageWindow(XSTATUSCHANGE *xsc, BOOL opening)
+void LogChangeToDB(XSTATUSCHANGE *xsc)
{
- // cut message if needed
- if (opt.LTruncateMsg && (opt.LMsgLen > 0) && xsc->stzText && (_tcslen(xsc->stzText) > opt.LMsgLen)) {
- TCHAR buff[MAX_TEXT_LEN + 3];
- _tcsncpy(buff, xsc->stzText, opt.LMsgLen);
- buff[opt.LMsgLen] = 0;
- _tcscat(buff, _T("..."));
- mir_free(xsc->stzText);
- xsc->stzText = mir_tstrdup(buff);
- }
+ if (opt.XLogToDB_WinOpen && (CheckMsgWnd(xsc->hContact) == false))
+ return;
TCHAR *Template = _T("");
switch (xsc->action) {
case NOTIFY_NEW_XSTATUS:
- Template = templates.LogNewXstatus; break;
+ Template = templates.LogXstatusChanged; break;
+ case NOTIFY_REMOVE_XSTATUS:
+ Template = templates.LogXstatusRemoved; break;
case NOTIFY_NEW_MESSAGE:
- Template = templates.LogNewMsg; break;
- case NOTIFY_REMOVE:
- Template = templates.LogRemove; break;
+ Template = templates.LogXMsgChanged; break;
+ case NOTIFY_REMOVE_MESSAGE:
+ Template = templates.LogXMsgRemoved; break;
case NOTIFY_OPENING_ML:
- Template = templates.LogOpening; break;
+ Template = templates.LogXstatusOpening; break;
}
- TCHAR stzLogText[2*MAX_TEXT_LEN], stzLastLog[2*MAX_TEXT_LEN];
- ReplaceVars(xsc, Template, templates.LogDelimiter, stzLogText);
+ TCHAR *stzLogText, stzLastLog[2 * MAX_TEXT_LEN];
+ stzLogText = ReplaceVars(xsc, Template);
DBGetStringDefault(xsc->hContact, MODULE, DB_LASTLOG, stzLastLog, SIZEOF(stzLastLog), _T(""));
- if (!opt.KeepInHistory || !(opt.PreventIdentical && _tcscmp(stzLastLog, stzLogText) == 0)) {
+// if (!opt.KeepInHistory || !(opt.PreventIdentical && _tcscmp(stzLastLog, stzLogText) == 0)) {
+ if (opt.XLogToDB/* || !(opt.PreventIdentical && _tcscmp(stzLastLog, stzLogText) == 0)*/) {
db_set_ws(xsc->hContact, MODULE, DB_LASTLOG, stzLogText);
char *blob = mir_utf8encodeT(stzLogText);
@@ -258,7 +323,7 @@ void LogToMessageWindow(XSTATUSCHANGE *xsc, BOOL opening)
DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
dbei.cbBlob = (DWORD)strlen(blob) + 1;
- dbei.pBlob = (PBYTE) blob;
+ dbei.pBlob = (PBYTE)blob;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.flags = DBEF_READ | DBEF_UTF;
@@ -267,32 +332,43 @@ void LogToMessageWindow(XSTATUSCHANGE *xsc, BOOL opening)
HANDLE hDBEvent = db_event_add(xsc->hContact, &dbei);
mir_free(blob);
- if (!opt.KeepInHistory) {
+ if (opt.XLogToDB_WinOpen && opt.XLogToDB_Remove) {
DBEVENT *dbevent = (DBEVENT *)mir_alloc(sizeof(DBEVENT));
dbevent->hContact = xsc->hContact;
dbevent->hDBEvent = hDBEvent;
- eventList.insert(dbevent);
+ eventListXStatus.insert(dbevent);
}
}
+ mir_free(stzLogText);
}
void LogChangeToFile(XSTATUSCHANGE *xsc)
{
- TCHAR stzType[32], stzDate[32], stzTime[32], stzText[MAX_TEXT_LEN];
-
- GetStatusTypeAsString(xsc->type, stzType);
-
- INT_PTR stzName = CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)xsc->hContact, GCDNF_TCHAR);
+ TCHAR stzDate[32], stzTime[32], stzText[MAX_TEXT_LEN];
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("HH':'mm"), stzTime, SIZEOF(stzTime));
GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("dd/MM/yyyy"), stzDate, SIZEOF(stzDate));
- if (xsc->action == NOTIFY_REMOVE)
- mir_sntprintf(stzText, SIZEOF(stzText), TranslateT("%s, %s. %s removed %s.\r\n"), stzDate, stzTime, stzName, stzType);
- else
- mir_sntprintf(stzText, SIZEOF(stzText), TranslateT("%s, %s. %s changed %s to: %s.\r\n"), stzDate, stzTime, stzName, stzType, xsc->stzTitle);
+ TCHAR *Template = _T("");
+ switch (xsc->action) {
+ case NOTIFY_NEW_XSTATUS:
+ Template = templates.LogXstatusChanged; break;
+ case NOTIFY_REMOVE_XSTATUS:
+ Template = templates.LogXstatusRemoved; break;
+ case NOTIFY_NEW_MESSAGE:
+ Template = templates.LogXMsgChanged; break;
+ case NOTIFY_REMOVE_MESSAGE:
+ Template = templates.LogXMsgRemoved; break;
+ }
+
+ TCHAR *stzLogText;
+ stzLogText = ReplaceVars(xsc, Template);
+
+ mir_sntprintf(stzText, SIZEOF(stzText), TranslateT("%s, %s. %s %s\r\n"), stzDate, stzTime,
+ CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)xsc->hContact, GCDNF_TCHAR), stzLogText);
LogToFile(stzText);
+ mir_free(stzLogText);
}
void ExtraStatusChanged(XSTATUSCHANGE *xsc)
@@ -300,53 +376,62 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc)
if (xsc == NULL)
return;
- BOOL bEnablePopup = true, bEnableSound = true;
- char buff[12] = {0};
+ BOOL bEnablePopup = true, bEnableSound = true, bEnableLog = opt.XLogToDB;
+ char buff[12] = {0};
mir_snprintf(buff, SIZEOF(buff), "%d", ID_STATUS_EXTRASTATUS);
-
- if (( db_get_b(0, MODULE, buff, 1) == 0)
+ if ((db_get_b(0, MODULE, buff, 1) == 0)
|| (db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
- || (!opt.HiddenContactsToo && db_get_b(xsc->hContact, "CList", "Hidden", 0))
- || (opt.TempDisabled)
- || (opt.IgnoreEmpty && (xsc->stzTitle == NULL || xsc->stzTitle[0] == '\0') && (xsc->stzText == NULL || xsc->stzText[0] == '\0'))) {
- FreeXSC(xsc);
- return;
+ || (!opt.HiddenContactsToo && (db_get_b(xsc->hContact, "CList", "Hidden", 0) == 1))
+ || (CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0) == ID_STATUS_OFFLINE))
+ {
+ FreeXSC(xsc);
+ return;
}
- char statusIDs[12], statusIDp[12];
+ // check per-contact ignored events
+ if (db_get_b(xsc->hContact, MODULE, "EnableXStatusNotify", 1) == 0)
+ bEnableSound = bEnablePopup = false;
+
+ // check if our status isn't on autodisable list
if (opt.AutoDisable) {
+ char statusIDs[12], statusIDp[12];
WORD myStatus = (WORD)CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0);
mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus);
mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus);
- bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE;
- bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE;
+ bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : bEnableSound;
+ bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : bEnablePopup;
}
- if (!(templates.PopupFlags & xsc->action))
- bEnableSound = bEnablePopup = false;
+ if (!(templates.PopupXFlags & xsc->action))
+ bEnablePopup = false;
+
+ if (db_get_b(0, MODULE, xsc->szProto, 1) == 0 && !opt.PXOnConnect)
+ bEnablePopup = false;
int xstatusID = db_get_b(xsc->hContact, xsc->szProto, "XStatusId", 0);
- if (opt.PDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
+ if (opt.PXDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
bEnableSound = bEnablePopup = false;
- if (bEnablePopup && db_get_b(xsc->hContact, MODULE, "EnableXStatusNotify", 1) && db_get_b(0, MODULE, xsc->szProto, 1))
- ShowPopup(xsc);
+ if (bEnablePopup && db_get_b(xsc->hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled)
+ ShowXStatusPopup(xsc);
+
+ if (bEnableSound && db_get_b(0, "Skin", "UseSound", 1) && db_get_b(xsc->hContact, MODULE, "EnableSounds", 1) && !opt.TempDisabled)
+ PlayXStatusSound(xsc->hContact, xsc->action);
- if (bEnableSound && db_get_b(xsc->hContact, MODULE, "EnableXStatusNotify", 1))
- PlayXStatusSound(xsc->action);
+ if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && !opt.TempDisabled)
+ BlinkXStatusIcon(xsc);
- BYTE enableLog = opt.EnableLogging;
- if (opt.LDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
- enableLog = FALSE;
+ if (opt.XLogDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
+ bEnableLog = false;
- if (!(templates.LogFlags & xsc->action))
- enableLog = FALSE;
+ if (!(templates.LogXFlags & xsc->action))
+ bEnableLog = false;
- if (enableLog && db_get_b(xsc->hContact, MODULE, "EnableLogging", 1) && CheckMsgWnd(xsc->hContact))
- LogToMessageWindow(xsc, FALSE);
+ if (bEnableLog && db_get_b(xsc->hContact, MODULE, "EnableXLogging", 1))
+ LogChangeToDB(xsc);
- if (opt.Log)
+ if (opt.XLogToFile && db_get_b(xsc->hContact, MODULE, "EnableXLogging", 1))
LogChangeToFile(xsc);
FreeXSC(xsc);
@@ -398,7 +483,7 @@ TCHAR *GetJabberAdvStatusText(MCONTACT hContact, char *szProto, char *szSlot, ch
buff[0] = 0;
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", szProto, szSlot, szValue);
- if ( !db_get_ts(hContact, "AdvStatus", szSetting, &dbv)) {
+ if (!db_get_ts(hContact, "AdvStatus", szSetting, &dbv)) {
_tcsncpy(buff, dbv.ptszVal, bufflen);
buff[bufflen - 1] = 0;
db_free(&dbv);
@@ -409,21 +494,13 @@ TCHAR *GetJabberAdvStatusText(MCONTACT hContact, char *szProto, char *szSlot, ch
void LogXstatusChange(MCONTACT hContact, char *szProto, int xstatusType, TCHAR *stzTitle, TCHAR *stzText)
{
- XSTATUSCHANGE *xsc =
- NewXSC(
- hContact,
- szProto,
- xstatusType,
- NOTIFY_OPENING_ML,
- stzTitle[0] ? mir_tstrdup(stzTitle): NULL,
- stzText[0] ? mir_tstrdup(stzText) : NULL
- );
-
- LogToMessageWindow(xsc, TRUE);
+ XSTATUSCHANGE *xsc = NewXSC(hContact, szProto, xstatusType, NOTIFY_OPENING_ML, stzTitle[0] ? mir_tstrdup(stzTitle) : NULL, stzText[0] ? mir_tstrdup(stzText) : NULL);
+
+ LogChangeToDB(xsc);
FreeXSC(xsc);
}
-void AddEventThread(void *arg)
+void AddXStatusEventThread(void *arg)
{
MCONTACT hContact = (MCONTACT)arg;
TCHAR stzTitle[MAX_TITLE_LEN], stzText[MAX_TEXT_LEN];
@@ -454,22 +531,57 @@ void AddEventThread(void *arg)
}
}
+void AddSMsgEventThread(void *arg)
+{
+ MCONTACT hContact = (MCONTACT)arg;
+ STATUSMSGINFO smi;
+
+ smi.hContact = hContact;
+ smi.proto = GetContactProto(hContact);
+ if (smi.proto == NULL)
+ return;
+
+ DBVARIANT dbv;
+ if (!db_get_s(smi.hContact, "CList", "StatusMsg", &dbv, 0)) {
+ switch (dbv.type) {
+ case DBVT_ASCIIZ:
+ smi.newstatusmsg = mir_dupToUnicodeEx(dbv.pszVal, CP_ACP);
+ break;
+ case DBVT_UTF8:
+ smi.newstatusmsg = mir_dupToUnicodeEx(dbv.pszVal, CP_UTF8);
+ break;
+ case DBVT_WCHAR:
+ smi.newstatusmsg = mir_wstrdup(dbv.pwszVal);
+ break;
+ default:
+ smi.newstatusmsg = NULL;
+ break;
+ }
+ db_free(&dbv);
+ }
+
+ LogSMsgToDB(&smi, templates.LogSMsgOpening);
+ mir_free(smi.newstatusmsg);
+}
+
int OnWindowEvent(WPARAM wParam, LPARAM lParam)
{
MessageWindowEventData *mwed = (MessageWindowEventData *)lParam;
- if (mwed->uType == MSG_WINDOW_EVT_CLOSE && !opt.KeepInHistory) {
- RemoveLoggedEvents(mwed->hContact);
- return 0;
- }
+ if ((mwed->uType == MSG_WINDOW_EVT_CLOSE) && opt.XLogToDB && opt.XLogToDB_WinOpen && opt.XLogToDB_Remove)
+ RemoveLoggedEventsXStatus(mwed->hContact);
- if (opt.EnableLogging &&
- (mwed->uType == MSG_WINDOW_EVT_OPEN) &&
- (templates.LogFlags & NOTIFY_OPENING_ML) &&
- (db_get_b(mwed->hContact, MODULE, "EnableLogging", 1) == 1))
- {
- mir_forkthread(AddEventThread, (void*)mwed->hContact);
- }
+ if ((mwed->uType == MSG_WINDOW_EVT_CLOSE) && opt.LogToDB && opt.LogToDB_WinOpen && opt.LogToDB_Remove)
+ RemoveLoggedEventsStatus(mwed->hContact);
+
+ if ((mwed->uType == MSG_WINDOW_EVT_CLOSE) && opt.SMsgLogToDB && opt.SMsgLogToDB_WinOpen && opt.SMsgLogToDB_Remove)
+ RemoveLoggedEventsSMsg(mwed->hContact);
+
+ if ((mwed->uType == MSG_WINDOW_EVT_OPEN) && opt.XLogToDB && (templates.LogXFlags & NOTIFY_OPENING_ML) && db_get_b(mwed->hContact, MODULE, "EnableXLogging", 1))
+ mir_forkthread(AddXStatusEventThread, (void *)mwed->hContact);
+
+ if ((mwed->uType == MSG_WINDOW_EVT_OPEN) && opt.SMsgLogToDB && (templates.LogSMsgFlags & NOTIFY_OPENING_ML) && db_get_b(mwed->hContact, MODULE, "EnableSMsgLogging", 1))
+ mir_forkthread(AddSMsgEventThread, (void *)mwed->hContact);
return 0;
}
diff --git a/plugins/NewXstatusNotify/src/xstatus.h b/plugins/NewXstatusNotify/src/xstatus.h
index 9ee53fae30..eae4d3cbfd 100644
--- a/plugins/NewXstatusNotify/src/xstatus.h
+++ b/plugins/NewXstatusNotify/src/xstatus.h
@@ -21,9 +21,10 @@
#define XSTATUS_H
#define NOTIFY_NEW_XSTATUS 1
-#define NOTIFY_NEW_MESSAGE 2
-#define NOTIFY_REMOVE 4
-#define NOTIFY_OPENING_ML 8
+#define NOTIFY_REMOVE_XSTATUS 2
+#define NOTIFY_NEW_MESSAGE 4
+#define NOTIFY_REMOVE_MESSAGE 8
+#define NOTIFY_OPENING_ML 16
#define TYPE_ICQ_XSTATUS 1
#define TYPE_JABBER_MOOD 2
@@ -40,40 +41,48 @@
// Sounds
#define XSTATUS_SOUND_CHANGED "XStatusChanged"
#define XSTATUS_SOUND_MSGCHANGED "XStatusMsgChanged"
-#define XSTATUS_SOUND_REMOVED "XStatusRemove"
+#define XSTATUS_SOUND_REMOVED "XStatusRemoved"
+#define XSTATUS_SOUND_MSGREMOVED "XStatusMsgRemoved"
// tabSRMM stuff (logging to message window)
-#define EVENTTYPE_STATUSCHANGE 25368
+#define EVENTTYPE_STATUSCHANGE 25368
// Default templates
-#define DEFAULT_POPUP_DELIMITER _T("%B")
-#define DEFAULT_POPUP_NEW TranslateT("changed %N to: %T%D%I")
-#define DEFAULT_POPUP_CHANGEMSG TranslateT("changed %N message to:%D%I")
-#define DEFAULT_POPUP_REMOVE TranslateT("removed %N")
-#define DEFAULT_POPUP_STATUSMESSAGE LPGEN("changed his/her status message to %n")
-
-#define DEFAULT_LOG_DELIMITER _T(": ")
-#define DEFAULT_LOG_NEW TranslateT("changed %N @ %T%D%I")
-#define DEFAULT_LOG_CHANGEMSG TranslateT("changed %N message @ %I")
-#define DEFAULT_LOG_REMOVE TranslateT("removed %N")
-#define DEFAULT_LOG_OPENING TranslateT("has %N @ %T%D%I")
+#define DEFAULT_POPUP_CHANGED TranslateT("changed %n to: %t")
+#define DEFAULT_POPUP_REMOVED TranslateT("removed %n")
+#define DEFAULT_POPUP_MSGCHANGED TranslateT("changed %n message to: %m")
+#define DEFAULT_POPUP_MSGREMOVED TranslateT("removed %n message")
+#define DEFAULT_POPUP_SMSGCHANGED TranslateT("changed status message to: %n")
+#define DEFAULT_POPUP_SMSGREMOVED TranslateT("removed status message")
+
+#define DEFAULT_LOG_CHANGED TranslateT("changed %n @ %t: %m")
+#define DEFAULT_LOG_REMOVED TranslateT("removed %n")
+#define DEFAULT_LOG_MSGCHANGED TranslateT("changed %n message @ %m")
+#define DEFAULT_LOG_MSGREMOVED TranslateT("removed %n message")
+#define DEFAULT_LOG_OPENING TranslateT("has %n @ %t: %m")
+
+#define DEFAULT_LOG_SMSGCHANGED TranslateT("changed status message @ %n")
+#define DEFAULT_LOG_SMSGREMOVED TranslateT("removed status message")
+#define DEFAULT_LOG_SMSGOPENING TranslateT("is %s and has status message @ %n")
// Variables help text
#define VARIABLES_HELP_TEXT TranslateT("These variables are available:\r\n\r\n\
-%N\textra status name (Xstatus, Mood, Activity)\r\n\
-%T\textra status title\r\n\
-%I\textra status text\r\n\
-%D\tdelimiter\r\n\
-%B\tline break (can be used as delimiter)")
+%n\textra status name (Xstatus, Mood, Activity)\r\n\
+%t\textra status title\r\n\
+%m\textra status message\r\n\
+%c\tcustom nickname\r\n\
+\\n\tline break\r\n\
+\\t\ttab stop")
#define VARIABLES_SM_HELP_TEXT TranslateT("These variables are available:\r\n\r\n\
-%n\tNew Status Message\r\n\
-%o\tOld Status Message\r\n\
-%c\tCustom Nickname\r\n\
+%n\tnew status message\r\n\
+%o\told status message\r\n\
+%c\tcustom nickname\r\n\
+%s\tcurrent status\r\n\
\\n\tline break\r\n\
\\t\ttab stop")
-typedef struct tagXSTATUSCHANGE
+typedef struct tagXSTATUSCHANGE
{
MCONTACT hContact;
char *szProto;
@@ -83,7 +92,7 @@ typedef struct tagXSTATUSCHANGE
TCHAR *stzText;
} XSTATUSCHANGE;
-typedef struct tagDBEVENT
+typedef struct tagDBEVENT
{
MCONTACT hContact;
HANDLE hDBEvent;
@@ -92,13 +101,14 @@ typedef struct tagDBEVENT
typedef struct tagPROTOTEMPLATE
{
TCHAR *ProtoName;
- TCHAR ProtoTemplate[MAX_PATH];
+ TCHAR ProtoTemplateMsg[MAX_PATH];
+ TCHAR ProtoTemplateRemoved[MAX_PATH];
} PROTOTEMPLATE;
TCHAR *GetDefaultXstatusName(int statusID, char *szProto, TCHAR *buff, int bufflen);
XSTATUSCHANGE *NewXSC(MCONTACT hContact, char *szProto, int xstatusType, int action, TCHAR *stzTitle, TCHAR *stzText);
void ExtraStatusChanged(XSTATUSCHANGE *xsc);
void FreeXSC(XSTATUSCHANGE *xsc);
-int OnWindowEvent(WPARAM wParam, LPARAM lParam);
+int OnWindowEvent(WPARAM wParam, LPARAM lParam);
-#endif \ No newline at end of file
+#endif