diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-04 18:51:53 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-04 18:51:53 +0000 |
commit | ecb177cadbcff850a16c4b9e306beb15f61ac6f9 (patch) | |
tree | da36e3107747a5f37dbd078197d584054057609f /plugins/BuddyExpectator | |
parent | 808f3b5e0fefeb560ce5393bf8311927d0927411 (diff) |
kernel extraicons, part II
git-svn-id: http://svn.miranda-ng.org/main/trunk@2188 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BuddyExpectator')
-rw-r--r-- | plugins/BuddyExpectator/src/BuddyExpectator.cpp | 413 | ||||
-rw-r--r-- | plugins/BuddyExpectator/src/common.h | 3 | ||||
-rw-r--r-- | plugins/BuddyExpectator/src/options.cpp | 727 |
3 files changed, 521 insertions, 622 deletions
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index a1fa12e3b7..03b793ad09 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -31,27 +31,25 @@ int hLangpack; DWORD timer_id = 0;
-HANDLE hEventContactSetting = NULL;
-HANDLE hEventContactAdded = NULL;
-HANDLE hEventUserInfoInit = NULL;
-HANDLE hPrebuildContactMenu = NULL;
-HANDLE hContactMenu = NULL;
-HANDLE hIcoLibIconsChanged = NULL;
-HANDLE hContactReturnedAction = NULL;
-HANDLE hContactStillAbsentAction = NULL;
-HANDLE hMissYouAction = NULL;
-HANDLE hMenuMissYouClick = NULL;
-HANDLE hModulesLoaded = NULL;
-HANDLE hModulesLoaded2 = NULL;
-HANDLE hSystemOKToExit = NULL;
-HANDLE hHookExtraIconsRebuild = NULL;
-HANDLE hHookExtraIconsApply = NULL;
+HANDLE hEventContactSetting = NULL;
+HANDLE hEventContactAdded = NULL;
+HANDLE hEventUserInfoInit = NULL;
+HANDLE hPrebuildContactMenu = NULL;
+HANDLE hContactMenu = NULL;
+HANDLE hIcoLibIconsChanged = NULL;
+HANDLE hContactReturnedAction = NULL;
+HANDLE hContactStillAbsentAction = NULL;
+HANDLE hMissYouAction = NULL;
+HANDLE hMenuMissYouClick = NULL;
+HANDLE hModulesLoaded = NULL;
+HANDLE hModulesLoaded2 = NULL;
+HANDLE hSystemOKToExit = NULL;
+HANDLE hHookExtraIconsRebuild = NULL;
+HANDLE hHookExtraIconsApply = NULL;
HICON hIcon;
HANDLE hEnabledIcon = NULL, hDisabledIcon = NULL;
-
-IconExtraColumn g_IECMissYou = {0};
-IconExtraColumn g_IECClear = {0};
+HANDLE hExtraIcon;
// Popup Actions
POPUPACTION missyouactions[1];
@@ -81,14 +79,14 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) time_t getLastSeen(HANDLE hContact)
{
- return DBGetContactSettingDword(hContact, MODULE_NAME, "LastSeen", DBGetContactSettingDword(hContact, MODULE_NAME, "CreationTime", (DWORD)-1));
+ return db_get_dw(hContact, MODULE_NAME, "LastSeen", db_get_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)-1));
}
void setLastSeen(HANDLE hContact)
{
- DBWriteContactSettingDword(hContact, MODULE_NAME, "LastSeen", (DWORD)time(NULL));
- if (DBGetContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0))
- DBWriteContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0);
+ db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(NULL));
+ if (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0))
+ db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
}
time_t getLastInputMsg(HANDLE hContact)
@@ -116,125 +114,113 @@ time_t getLastInputMsg(HANDLE hContact) LRESULT CALLBACK HidePopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
- case WM_COMMAND:
- if (HIWORD(wParam) == STN_CLICKED)
- {
- DBWriteContactSettingByte(PUGetContact(hWnd), "CList", "Hidden", 1);
- PUDeletePopUp(hWnd);
- }
- break;
- case WM_CONTEXTMENU:
- DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "NeverHide", 1);
- PUDeletePopUp(hWnd);
- break;
- case UM_POPUPACTION:
- if (wParam == 2)
- {
- DBWriteContactSettingByte(PUGetContact(hWnd), "CList", "Hidden", 1);
- PUDeletePopUp(hWnd);
- }
- if (wParam == 3)
- {
- DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "NeverHide", 1);
- PUDeletePopUp(hWnd);
- }
- break;
- case UM_FREEPLUGINDATA:
- return TRUE;
- default:
- break;
+ switch (message) {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ db_set_b(PUGetContact(hWnd), "CList", "Hidden", 1);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ db_set_b(PUGetContact(hWnd), MODULE_NAME, "NeverHide", 1);
+ PUDeletePopUp(hWnd);
+ break;
+
+ case UM_POPUPACTION:
+ if (wParam == 2) {
+ db_set_b(PUGetContact(hWnd), "CList", "Hidden", 1);
+ PUDeletePopUp(hWnd);
+ }
+ if (wParam == 3) {
+ db_set_b(PUGetContact(hWnd), MODULE_NAME, "NeverHide", 1);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+
+ case UM_FREEPLUGINDATA:
+ return TRUE;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
LRESULT CALLBACK MissYouPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
- case WM_COMMAND:
- if (HIWORD(wParam) == STN_CLICKED)
- {
- CallServiceSync("BuddyExpectator/actionMissYou", (WPARAM)PUGetContact(hWnd), 0);
- if (!DBGetContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "MissYouNotifyAlways", 0))
- {
- DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
- if (options.MissYouIcon)
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) PUGetContact(hWnd), (LPARAM) &g_IECClear);
- }
- PUDeletePopUp(hWnd);
- }
- break;
- case WM_CONTEXTMENU:
- PUDeletePopUp(hWnd);
- break;
- case UM_POPUPACTION:
- if (wParam == 1)
- {
- DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
+ switch (message) {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ CallServiceSync("BuddyExpectator/actionMissYou", (WPARAM)PUGetContact(hWnd), 0);
+ if ( !db_get_b(PUGetContact(hWnd), MODULE_NAME, "MissYouNotifyAlways", 0)) {
+ db_set_b(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
if (options.MissYouIcon)
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) PUGetContact(hWnd), (LPARAM) &g_IECClear);
- PUDeletePopUp(hWnd);
+ ExtraIcon_SetIcon(hExtraIcon, PUGetContact(hWnd), "");
}
- break;
- case UM_FREEPLUGINDATA:
- return TRUE;
- default:
- break;
+ PUDeletePopUp(hWnd);
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ PUDeletePopUp(hWnd);
+ break;
+
+ case UM_POPUPACTION:
+ if (wParam == 1) {
+ db_set_b(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
+ if (options.MissYouIcon)
+ ExtraIcon_SetIcon(hExtraIcon, PUGetContact(hWnd), "");
+ PUDeletePopUp(hWnd);
+ }
+ break;
+
+ case UM_FREEPLUGINDATA:
+ return TRUE;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
- case WM_COMMAND:
- if (HIWORD(wParam) == STN_CLICKED)
- {
- CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
- CallServiceSync("BuddyExpectator/actionReturned", (WPARAM)PUGetContact(hWnd), 0);
- PUDeletePopUp(hWnd);
- }
- break;
- case WM_CONTEXTMENU:
- CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
- setLastSeen(PUGetContact(hWnd));
- PUDeletePopUp(hWnd);
- break;
- case UM_FREEPLUGINDATA:
- if (options.iShowEvent == 0)
- {
- setLastSeen(PUGetContact(hWnd));
- }
- return TRUE;
- default:
- break;
+ switch (message) {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
+ CallServiceSync("BuddyExpectator/actionReturned", (WPARAM)PUGetContact(hWnd), 0);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
+ setLastSeen(PUGetContact(hWnd));
+ PUDeletePopUp(hWnd);
+ break;
+
+ case UM_FREEPLUGINDATA:
+ if (options.iShowEvent == 0)
+ setLastSeen(PUGetContact(hWnd));
+ return TRUE;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
LRESULT CALLBACK PopupDlgProcNoSet(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
- case WM_COMMAND:
- if (HIWORD(wParam) == STN_CLICKED)
- {
- CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
- CallServiceSync("BuddyExpectator/actionStillAbsent", (WPARAM)PUGetContact(hWnd), 0);
- PUDeletePopUp(hWnd);
- }
- break;
- case WM_CONTEXTMENU:
- CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
- PUDeletePopUp(hWnd);
- break;
- case UM_FREEPLUGINDATA:
- return TRUE;
- default:
- break;
+ switch (message) {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
+ CallServiceSync("BuddyExpectator/actionStillAbsent", (WPARAM)PUGetContact(hWnd), 0);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
+ PUDeletePopUp(hWnd);
+ break;
+
+ case UM_FREEPLUGINDATA:
+ return TRUE;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
@@ -244,21 +230,19 @@ LRESULT CALLBACK PopupDlgProcNoSet(HWND hWnd, UINT message, WPARAM wParam, LPARA */
bool isContactGoneFor(HANDLE hContact, int days)
{
- time_t lastSeen = getLastSeen(hContact);
- time_t lastInputMsg = getLastInputMsg(hContact);
- time_t currentTime = time(NULL);
+ time_t lastSeen = getLastSeen(hContact);
+ time_t lastInputMsg = getLastInputMsg(hContact);
+ time_t currentTime = time(NULL);
- int daysSinceOnline = -1;
- if (lastSeen != -1) daysSinceOnline = (int)((currentTime - lastSeen)/(60*60*24));
+ int daysSinceOnline = -1;
+ if (lastSeen != -1) daysSinceOnline = (int)((currentTime - lastSeen)/(60*60*24));
- int daysSinceMessage = -1;
+ int daysSinceMessage = -1;
if (lastInputMsg != -1) daysSinceMessage = (int)((currentTime - lastInputMsg)/(60*60*24));
- if (options.hideInactive)
- {
+ if (options.hideInactive) {
if (daysSinceMessage >= options.iSilencePeriod)
- if (!DBGetContactSettingByte(hContact, "CList", "Hidden", 0) && !DBGetContactSettingByte(hContact, MODULE_NAME, "NeverHide", 0))
- {
+ if (!db_get_b(hContact, "CList", "Hidden", 0) && !db_get_b(hContact, MODULE_NAME, "NeverHide", 0)) {
TCHAR szInfo[200];
POPUPDATAT_V2 ppd = {0};
@@ -271,8 +255,7 @@ bool isContactGoneFor(HANDLE hContact, int days) _tcsncpy(ppd.lptzContactName, szInfo, MAX_CONTACTNAME);
mir_sntprintf(szInfo, 200, TranslateT("%d days since last message"), daysSinceMessage);
_tcsncpy(ppd.lptzText, szInfo, MAX_SECONDLINE);
- if (!options.iUsePopupColors)
- {
+ if (!options.iUsePopupColors) {
ppd.colorBack = options.iPopUpColorBack;
ppd.colorText = options.iPopUpColorFore;
}
@@ -295,23 +278,20 @@ bool isContactGoneFor(HANDLE hContact, int days) void ReturnNotify(HANDLE hContact, TCHAR *message)
{
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1 || DBGetContactSettingByte(hContact, "CList", "Hidden", 0) == 1)
+ if (db_get_b(hContact, "CList", "NotOnList", 0) == 1 || db_get_b(hContact, "CList", "Hidden", 0) == 1)
return;
SkinPlaySound("buddyExpectatorReturn");
- if (options.iShowPopUp > 0)
- {
+ if (options.iShowPopUp > 0) {
// Display PopUp
- POPUPDATAT_V2 ppd = {0};
- ppd.cbSize = sizeof(POPUPDATAT_V2);
-
+ POPUPDATAT_V2 ppd = { 0 };
+ ppd.cbSize = sizeof(ppd);
ppd.lchContact = hContact;
ppd.lchIcon = hIcon;
_tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR), MAX_CONTACTNAME);
_tcsncpy(ppd.lptzText, message, MAX_SECONDLINE);
- if (!options.iUsePopupColors)
- {
+ if (!options.iUsePopupColors) {
ppd.colorBack = options.iPopUpColorBack;
ppd.colorText = options.iPopUpColorFore;
}
@@ -322,11 +302,8 @@ void ReturnNotify(HANDLE hContact, TCHAR *message) PUAddPopUpT(&ppd);
}
- if (options.iShowEvent > 0)
- {
- CLISTEVENT cle = {0};
-
- cle.cbSize = sizeof(cle);
+ if (options.iShowEvent > 0) {
+ CLISTEVENT cle = { sizeof(cle) };
cle.hContact = hContact;
cle.hIcon = hIcon;
cle.pszService = "BuddyExpectator/actionReturned";
@@ -343,11 +320,10 @@ void ReturnNotify(HANDLE hContact, TCHAR *message) void GoneNotify(HANDLE hContact, TCHAR *message)
{
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1 || DBGetContactSettingByte(hContact, "CList", "Hidden", 0) == 1)
+ if (db_get_b(hContact, "CList", "NotOnList", 0) == 1 || db_get_b(hContact, "CList", "Hidden", 0) == 1)
return;
- if (options.iShowPopUp2 > 0)
- {
+ if (options.iShowPopUp2 > 0) {
// Display PopUp
POPUPDATAT_V2 ppd = {0};
ppd.cbSize = sizeof(POPUPDATAT_V2);
@@ -356,8 +332,7 @@ void GoneNotify(HANDLE hContact, TCHAR *message) ppd.lchIcon = hIcon;
_tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR), MAX_CONTACTNAME);
_tcsncpy(ppd.lptzText, message, MAX_SECONDLINE);
- if (!options.iUsePopupColors)
- {
+ if (!options.iUsePopupColors) {
ppd.colorBack = options.iPopUpColorBack;
ppd.colorText = options.iPopUpColorFore;
}
@@ -368,11 +343,8 @@ void GoneNotify(HANDLE hContact, TCHAR *message) PUAddPopUpT(&ppd);
}
- if (options.iShowEvent2 > 0)
- {
- CLISTEVENT cle = {0};
-
- cle.cbSize = sizeof(cle);
+ if (options.iShowEvent2 > 0) {
+ CLISTEVENT cle = { sizeof(cle) };
cle.hContact = hContact;
cle.hIcon = hIcon;
cle.pszService = "BuddyExpectator/actionStillAbsent";
@@ -395,16 +367,14 @@ void GoneNotify(HANDLE hContact, TCHAR *message) INT_PTR MissYouAction(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact;
- if (lParam)
- {
- CLISTEVENT* cle = (CLISTEVENT*)lParam;
+ if (lParam) {
+ CLISTEVENT* cle = (CLISTEVENT*)lParam;
hContact = cle->hContact;
- } else
- hContact = (HANDLE)wParam;
-
- CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0);
+ }
+ else hContact = (HANDLE)wParam;
- return 0;
+ CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0);
+ return 0;
}
/**
@@ -415,26 +385,20 @@ INT_PTR MissYouAction(WPARAM wParam, LPARAM lParam) INT_PTR ContactReturnedAction(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact;
- if (lParam)
- {
- CLISTEVENT* cle = (CLISTEVENT*)lParam;
+ if (lParam) {
+ CLISTEVENT* cle = (CLISTEVENT*)lParam;
hContact = cle->hContact;
- } else
- hContact = (HANDLE)wParam;
+ }
+ else hContact = (HANDLE)wParam;
- if (options.iShowMessageWindow>0)
- {
- CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0);
- }
+ if (options.iShowMessageWindow>0)
+ CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0);
- if (options.iShowUDetails>0)
- {
- CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
- }
+ if (options.iShowUDetails>0)
+ CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
setLastSeen(hContact);
-
- return 0;
+ return 0;
}
/**
@@ -445,25 +409,23 @@ INT_PTR ContactReturnedAction(WPARAM wParam, LPARAM lParam) INT_PTR ContactStillAbsentAction(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact;
- if (lParam)
- {
- CLISTEVENT* cle = (CLISTEVENT*)lParam;
+ if (lParam) {
+ CLISTEVENT* cle = (CLISTEVENT*)lParam;
hContact = cle->hContact;
- } else
- hContact = (HANDLE)wParam;
+ }
+ else hContact = (HANDLE)wParam;
- switch (options.action2)
- {
- case GCA_DELETE:
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ switch (options.action2) {
+ case GCA_DELETE:
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
break;
- case GCA_UDETAILS:
- CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
+ case GCA_UDETAILS:
+ CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
break;
- case GCA_MESSAGE:
- CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
+ case GCA_MESSAGE:
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
break;
- case GCA_NOACTION:
+ case GCA_NOACTION:
break;
}
@@ -484,15 +446,15 @@ int onIconsChanged(WPARAM wParam, LPARAM lParam) */
INT_PTR MenuMissYouClick(WPARAM wParam, LPARAM lParam)
{
- if (DBGetContactSettingByte((HANDLE)wParam, MODULE_NAME, "MissYou", 0))
- {
- DBWriteContactSettingByte((HANDLE)wParam, MODULE_NAME, "MissYou", 0);
- if (options.MissYouIcon) CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECClear);
+ if (db_get_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0)) {
+ db_set_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0);
+ if (options.MissYouIcon)
+ ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, "");
}
- else
- {
- DBWriteContactSettingByte((HANDLE)wParam, MODULE_NAME, "MissYou", 1);
- if (options.MissYouIcon) CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECMissYou);
+ else {
+ db_set_b((HANDLE)wParam, MODULE_NAME, "MissYou", 1);
+ if (options.MissYouIcon)
+ ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, "enabled_icon");
}
return 0;
@@ -509,12 +471,12 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(CLISTMENUITEM);
- if (DBGetContactSettingByte((HANDLE)wParam, proto, "ChatRoom", 0) || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
+ if (db_get_b((HANDLE)wParam, proto, "ChatRoom", 0) || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
else
mi.flags = CMIM_FLAGS;
- if (DBGetContactSettingByte((HANDLE)wParam, MODULE_NAME, "MissYou", 0))
+ if (db_get_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0))
{
mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.ptszName = LPGENT("Disable Miss You");
@@ -534,23 +496,12 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) int onExtraImageApplying(WPARAM wParam, LPARAM lParam)
{
- if (DBGetContactSettingByte((HANDLE)wParam,MODULE_NAME,"MissYou",0))
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECMissYou);
+ if ( db_get_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0))
+ ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, "enabled_icon");
return 0;
}
-int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam)
-{
- g_IECMissYou.cbSize = sizeof(IconExtraColumn);
- g_IECMissYou.ColumnType = options.MissYouIcon;
-
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- g_IECMissYou.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("enabled_icon"), 0);
-
- return 0;
-}
-
/**
* ContactSettingChanged callback
*/
@@ -562,11 +513,11 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) if (hContact == NULL || inf->value.type == DBVT_DELETED || strcmp(inf->szSetting, "Status") != 0)
return 0;
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1)
+ if (db_get_b(hContact, "CList", "NotOnList", 0) == 1)
return 0;
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (proto == 0 || (DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 1)
+ if (proto == 0 || (db_get_b(hContact, proto, "ChatRoom", 0) == 1)
|| !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
return 0;
@@ -577,11 +528,11 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) return 0;
// Last status
- DBWriteContactSettingDword(hContact, MODULE_NAME, "LastStatus", prevStatus);
+ db_set_dw(hContact, MODULE_NAME, "LastStatus", prevStatus);
if (prevStatus == ID_STATUS_OFFLINE)
{
- if (DBGetContactSettingByte(hContact, MODULE_NAME, "MissYou", 0))
+ if (db_get_b(hContact, MODULE_NAME, "MissYou", 0))
{
// Display PopUp
POPUPDATAT_V2 ppd = {0};
@@ -616,14 +567,14 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) return 0;
}
- if (DBGetContactSettingDword(hContact, MODULE_NAME, "LastSeen", (DWORD)-1) == (DWORD)-1 && options.notifyFirstOnline)
+ if (db_get_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)-1) == (DWORD)-1 && options.notifyFirstOnline)
{
ReturnNotify(hContact, TranslateT("has gone online for the first time."));
setLastSeen(hContact);
}
- unsigned int AbsencePeriod = DBGetContactSettingDword(hContact, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
+ unsigned int AbsencePeriod = db_get_dw(hContact, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
if (isContactGoneFor(hContact, AbsencePeriod))
{
TCHAR* message = TranslateT("has returned after a long absence.");
@@ -662,9 +613,9 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) while (hContact != 0)
{
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (proto && (DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) && isContactGoneFor(hContact, options.iAbsencePeriod2) && (DBGetContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0) == 0))
+ if (proto && (db_get_b(hContact, proto, "ChatRoom", 0) == 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) && isContactGoneFor(hContact, options.iAbsencePeriod2) && (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0) == 0))
{
- DBWriteContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 1);
+ db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 1);
SkinPlaySound("buddyExpectatorStillAbsent");
TCHAR* message = TranslateT("has not returned after a long absence.");
@@ -720,13 +671,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) hModulesLoaded2 = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded2);
if (options.MissYouIcon)
- {
- hHookExtraIconsRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, onExtraImageListRebuild);
- hHookExtraIconsApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
- g_IECClear.cbSize = sizeof(IconExtraColumn);
- g_IECClear.ColumnType = options.MissYouIcon;
- g_IECClear.hImage = (HANDLE) -1;
- }
+ hExtraIcon = ExtraIcon_Register("buddy_exp", "Buddy Expectator", "enabled_icon");
+
+ ////////////////////////////////////////////////////////////////////////////
TCHAR szFile[MAX_PATH];
GetModuleFileName(hInst, szFile, MAX_PATH);
@@ -805,7 +752,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda int ContactAdded(WPARAM wParam, LPARAM lParam)
{
- DBWriteContactSettingDword((HANDLE)wParam, MODULE_NAME, "CreationTime", (DWORD)time(0));
+ db_set_dw((HANDLE)wParam, MODULE_NAME, "CreationTime", (DWORD)time(0));
return 0;
}
@@ -864,7 +811,7 @@ extern "C" int __declspec(dllexport) Load(void) if ( !DBGetContactSetting(hContact, MODULE_NAME, "CreationTime", &dbv))
DBFreeVariant(&dbv);
else
- DBWriteContactSettingDword(hContact, MODULE_NAME, "CreationTime", current_time);
+ db_set_dw(hContact, MODULE_NAME, "CreationTime", current_time);
hContact = db_find_next(hContact);
}
diff --git a/plugins/BuddyExpectator/src/common.h b/plugins/BuddyExpectator/src/common.h index c2d4d80303..4317679036 100644 --- a/plugins/BuddyExpectator/src/common.h +++ b/plugins/BuddyExpectator/src/common.h @@ -51,7 +51,7 @@ #include <m_userinfo.h>
#include <m_icolib.h>
#include <m_popup.h>
-#include <m_cluiframes.h>
+#include <m_extraicons.h>
#include "m_popup2.h"
@@ -62,6 +62,7 @@ #define MODULE_NAME "BuddyExpectator"
extern HINSTANCE hInst;
+extern HANDLE hExtraIcon;
void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
extern DWORD timer_id;
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index 23c0acdea9..d20101ee49 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -38,54 +38,58 @@ Options options; void LoadOptions()
{
- options.iAbsencePeriod = DBGetContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod", 14);
- options.iAbsencePeriod2 = DBGetContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod2", 30 * 3);
- options.iSilencePeriod = DBGetContactSettingDword(NULL, MODULE_NAME, "iSilencePeriod", 30);
- options.iShowPopUp = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowPopUp", 1);
- options.iShowEvent = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowEvent", 0);
- options.iShowUDetails = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowUDetails", 0);
- options.iShowMessageWindow = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowMessageWindow", 1);
- options.iPopUpColorBack = DBGetContactSettingDword(NULL, MODULE_NAME, "iPopUpColorBack", DEF_COLOR_BACK);
- options.iPopUpColorFore = DBGetContactSettingDword(NULL, MODULE_NAME, "iPopUpColorFore", DEF_COLOR_FORE);
- options.iUsePopupColors = DBGetContactSettingByte(NULL, MODULE_NAME, "iUsePopupColors", 0);
- options.iUseWinColors = DBGetContactSettingByte(NULL, MODULE_NAME, "iUseWinColors", 0);
- options.iPopUpDelay = DBGetContactSettingByte(NULL, MODULE_NAME, "iPopUpDelay", 0);
-
- options.iShowPopUp2 = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowPopUp2", 1);
- options.iShowEvent2 = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowEvent2", 0);
- options.action2 = (GoneContactAction)DBGetContactSettingByte(NULL, MODULE_NAME, "Action2", (BYTE)GCA_NOACTION);
- options.notifyFirstOnline = DBGetContactSettingByte(NULL, MODULE_NAME, "bShowFirstSight", 0) ? true : false;
- options.hideInactive = DBGetContactSettingByte(NULL, MODULE_NAME, "bHideInactive", 0) ? true : false;
- options.enableMissYou = DBGetContactSettingByte(NULL, MODULE_NAME, "bMissYouEnabled", 1) ? true : false;
- options.MissYouIcon = DBGetContactSettingByte(NULL, MODULE_NAME, "bMissYouIcon", 0);
+ options.iAbsencePeriod = db_get_dw(NULL, MODULE_NAME, "iAbsencePeriod", 14);
+ options.iAbsencePeriod2 = db_get_dw(NULL, MODULE_NAME, "iAbsencePeriod2", 30 * 3);
+ options.iSilencePeriod = db_get_dw(NULL, MODULE_NAME, "iSilencePeriod", 30);
+
+ options.iShowPopUp = db_get_b(NULL, MODULE_NAME, "iShowPopUp", 1);
+ options.iShowEvent = db_get_b(NULL, MODULE_NAME, "iShowEvent", 0);
+ options.iShowUDetails = db_get_b(NULL, MODULE_NAME, "iShowUDetails", 0);
+ options.iShowMessageWindow = db_get_b(NULL, MODULE_NAME, "iShowMessageWindow", 1);
+
+ options.iPopUpColorBack = db_get_dw(NULL, MODULE_NAME, "iPopUpColorBack", DEF_COLOR_BACK);
+ options.iPopUpColorFore = db_get_dw(NULL, MODULE_NAME, "iPopUpColorFore", DEF_COLOR_FORE);
+
+ options.iUsePopupColors = db_get_b(NULL, MODULE_NAME, "iUsePopupColors", 0);
+ options.iUseWinColors = db_get_b(NULL, MODULE_NAME, "iUseWinColors", 0);
+ options.iPopUpDelay = db_get_b(NULL, MODULE_NAME, "iPopUpDelay", 0);
+
+ options.iShowPopUp2 = db_get_b(NULL, MODULE_NAME, "iShowPopUp2", 1);
+ options.iShowEvent2 = db_get_b(NULL, MODULE_NAME, "iShowEvent2", 0);
+ options.action2 = (GoneContactAction)db_get_b(NULL, MODULE_NAME, "Action2", (BYTE)GCA_NOACTION);
+ options.notifyFirstOnline = db_get_b(NULL, MODULE_NAME, "bShowFirstSight", 0) ? true : false;
+ options.hideInactive = db_get_b(NULL, MODULE_NAME, "bHideInactive", 0) ? true : false;
+ options.enableMissYou = db_get_b(NULL, MODULE_NAME, "bMissYouEnabled", 1) ? true : false;
+ options.MissYouIcon = db_get_b(NULL, MODULE_NAME, "bMissYouIcon", 0);
}
void SaveOptions()
{
- DBWriteContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod2", options.iAbsencePeriod2);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "iSilencePeriod", options.iSilencePeriod);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowPopUp", options.iShowPopUp);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowEvent", options.iShowEvent);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowUDetails", options.iShowUDetails);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowMessageWindow", options.iShowMessageWindow);
-
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowPopUp2", options.iShowPopUp2);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowEvent2", options.iShowEvent2);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "Action2", (BYTE)options.action2);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "bShowFirstSight", options.notifyFirstOnline ? 1 : 0);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "bHideInactive", options.hideInactive ? 1 : 0);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "bMissYouEnabled", options.enableMissYou ? 1 : 0);
+ db_set_dw(NULL, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
+ db_set_dw(NULL, MODULE_NAME, "iAbsencePeriod2", options.iAbsencePeriod2);
+ db_set_dw(NULL, MODULE_NAME, "iSilencePeriod", options.iSilencePeriod);
+
+ db_set_b(NULL, MODULE_NAME, "iShowPopUp", options.iShowPopUp);
+ db_set_b(NULL, MODULE_NAME, "iShowEvent", options.iShowEvent);
+ db_set_b(NULL, MODULE_NAME, "iShowUDetails", options.iShowUDetails);
+ db_set_b(NULL, MODULE_NAME, "iShowMessageWindow", options.iShowMessageWindow);
+
+ db_set_b(NULL, MODULE_NAME, "iShowPopUp2", options.iShowPopUp2);
+ db_set_b(NULL, MODULE_NAME, "iShowEvent2", options.iShowEvent2);
+ db_set_b(NULL, MODULE_NAME, "Action2", (BYTE)options.action2);
+ db_set_b(NULL, MODULE_NAME, "bShowFirstSight", options.notifyFirstOnline ? 1 : 0);
+ db_set_b(NULL, MODULE_NAME, "bHideInactive", options.hideInactive ? 1 : 0);
+ db_set_b(NULL, MODULE_NAME, "bMissYouEnabled", options.enableMissYou ? 1 : 0);
}
-
void SavePopupOptions()
{
- DBWriteContactSettingDword(NULL, MODULE_NAME, "iPopUpColorBack", options.iPopUpColorBack);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "iPopUpColorFore", options.iPopUpColorFore);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iUsePopupColors", options.iUsePopupColors);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iUseWinColors", options.iUseWinColors);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iPopUpDelay", options.iPopUpDelay);
+ db_set_dw(NULL, MODULE_NAME, "iPopUpColorBack", options.iPopUpColorBack);
+ db_set_dw(NULL, MODULE_NAME, "iPopUpColorFore", options.iPopUpColorFore);
+
+ db_set_b(NULL, MODULE_NAME, "iUsePopupColors", options.iUsePopupColors);
+ db_set_b(NULL, MODULE_NAME, "iUseWinColors", options.iUseWinColors);
+ db_set_b(NULL, MODULE_NAME, "iPopUpDelay", options.iPopUpDelay);
}
/**
@@ -93,194 +97,175 @@ void SavePopupOptions() */
static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ if (!ServiceExists(MS_POPUP_ADDPOPUP))
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), FALSE);
+
+ //iAbsencePeriod
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) TranslateT("days"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) TranslateT("weeks"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) TranslateT("months"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) TranslateT("years"));
+ if (options.iAbsencePeriod % 365 == 0) {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod/365, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 3, 0);
+ }
+ else if (options.iAbsencePeriod % 30 == 0) {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod/30, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 2, 0);
+ }
+ else if (options.iAbsencePeriod % 7 == 0) {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod/7, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 1, 0);
+ }
+ else {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 0, 0);
+ }
- if (!ServiceExists(MS_POPUP_ADDPOPUP))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), FALSE);
- }
-
- //iAbsencePeriod
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_RESETCONTENT, 0, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) TranslateT("days"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) TranslateT("weeks"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) TranslateT("months"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) TranslateT("years"));
- if (options.iAbsencePeriod % 365 == 0)
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod/365, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 3, 0);
- }
- else if (options.iAbsencePeriod % 30 == 0)
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod/30, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 2, 0);
- }
- else if (options.iAbsencePeriod % 7 == 0)
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod/7, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 1, 0);
- }
- else
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 0, 0);
- }
-
- //iAbsencePeriod2
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_RESETCONTENT, 0, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) TranslateT("days"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) TranslateT("weeks"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) TranslateT("months"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) TranslateT("years"));
- if (options.iAbsencePeriod2 % 365 == 0)
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, options.iAbsencePeriod2/365, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 3, 0);
- }
- else if (options.iAbsencePeriod2 % 30 == 0)
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, options.iAbsencePeriod2/30, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 2, 0);
- }
- else if (options.iAbsencePeriod2 % 7 == 0)
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, options.iAbsencePeriod2/7, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 1, 0);
- }
- else
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2,options.iAbsencePeriod2, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 0, 0);
- }
-
- //iSilencePeriod
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_RESETCONTENT, 0, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) TranslateT("days"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) TranslateT("weeks"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) TranslateT("months"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) TranslateT("years"));
- if (options.iSilencePeriod % 365 == 0)
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, options.iSilencePeriod/365, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 3, 0);
- }
- else if (options.iSilencePeriod % 30 == 0)
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, options.iSilencePeriod/30, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 2, 0);
- }
- else if (options.iSilencePeriod % 7 == 0)
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, options.iSilencePeriod/7, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 1, 0);
- }
- else
- {
- SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR,options.iSilencePeriod, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 0, 0);
- }
+ //iAbsencePeriod2
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) TranslateT("days"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) TranslateT("weeks"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) TranslateT("months"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) TranslateT("years"));
+
+ if (options.iAbsencePeriod2 % 365 == 0) {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, options.iAbsencePeriod2/365, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 3, 0);
+ }
+ else if (options.iAbsencePeriod2 % 30 == 0) {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, options.iAbsencePeriod2/30, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 2, 0);
+ }
+ else if (options.iAbsencePeriod2 % 7 == 0) {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, options.iAbsencePeriod2/7, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 1, 0);
+ }
+ else {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2,options.iAbsencePeriod2, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 0, 0);
+ }
- SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), BM_SETCHECK, options.iShowPopUp > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON), BM_SETCHECK, options.iShowEvent > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_UDETAILS), BM_SETCHECK, (options.iShowUDetails > 0 ? BST_CHECKED : BST_UNCHECKED), 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MSGWINDOW), BM_SETCHECK, (options.iShowMessageWindow > 0 ? BST_CHECKED : BST_UNCHECKED), 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FIRSTSIGHT), BM_SETCHECK, options.notifyFirstOnline ? BST_CHECKED : BST_UNCHECKED, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_NOMSGS), BM_SETCHECK, options.hideInactive ? BST_CHECKED : BST_UNCHECKED, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MISSYOU), BM_SETCHECK, options.enableMissYou ? BST_CHECKED : BST_UNCHECKED, 0);
+ //iSilencePeriod
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) TranslateT("days"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) TranslateT("weeks"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) TranslateT("months"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) TranslateT("years"));
- SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP2), BM_SETCHECK, options.iShowPopUp2 > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON2), BM_SETCHECK, options.iShowEvent2 > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
+ if (options.iSilencePeriod % 365 == 0) {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, options.iSilencePeriod/365, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 3, 0);
+ }
+ else if (options.iSilencePeriod % 30 == 0) {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, options.iSilencePeriod/30, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 2, 0);
+ }
+ else if (options.iSilencePeriod % 7 == 0) {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, options.iSilencePeriod/7, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 1, 0);
+ }
+ else {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR,options.iSilencePeriod, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 0, 0);
+ }
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), BM_SETCHECK, options.iShowPopUp > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON), BM_SETCHECK, options.iShowEvent > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_UDETAILS), BM_SETCHECK, (options.iShowUDetails > 0 ? BST_CHECKED : BST_UNCHECKED), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MSGWINDOW), BM_SETCHECK, (options.iShowMessageWindow > 0 ? BST_CHECKED : BST_UNCHECKED), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FIRSTSIGHT), BM_SETCHECK, options.notifyFirstOnline ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_NOMSGS), BM_SETCHECK, options.hideInactive ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MISSYOU), BM_SETCHECK, options.enableMissYou ? BST_CHECKED : BST_UNCHECKED, 0);
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP2), BM_SETCHECK, options.iShowPopUp2 > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON2), BM_SETCHECK, options.iShowEvent2 > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) TranslateT("Do nothing"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) TranslateT("Delete the contact"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) TranslateT("Open User Details"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) TranslateT("Open message window"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_SETCURSEL, options.action2, 0);
+ return TRUE;
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_RESETCONTENT, 0, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) TranslateT("Do nothing"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) TranslateT("Delete the contact"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) TranslateT("Open User Details"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) TranslateT("Open message window"));
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_SETCURSEL, options.action2, 0);
+ case WM_COMMAND:
+ if ((HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == CBN_SELCHANGE)
+ || ((HIWORD(wParam) == EN_CHANGE) && (SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_ABSENCE), EM_GETMODIFY, 0, 0)))
+ || ((HIWORD(wParam) == EN_CHANGE) && (SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_ABSENCE2), EM_GETMODIFY, 0, 0)))
+ || ((HIWORD(wParam) == EN_CHANGE) && (SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_SILENTFOR), EM_GETMODIFY, 0, 0))))
+ {
+ SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ }
+ break;
- return TRUE;
- case WM_COMMAND:
- if ((HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == CBN_SELCHANGE)
- || ((HIWORD(wParam) == EN_CHANGE) && (SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_ABSENCE), EM_GETMODIFY, 0, 0)))
- || ((HIWORD(wParam) == EN_CHANGE) && (SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_ABSENCE2), EM_GETMODIFY, 0, 0)))
- || ((HIWORD(wParam) == EN_CHANGE) && (SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_SILENTFOR), EM_GETMODIFY, 0, 0))))
- {
- SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
- }
- break;
- case WM_NOTIFY:
- {
+ case WM_NOTIFY:
+ {
NMHDR* nmhdr = (NMHDR*)lParam;
- switch (nmhdr->code)
- {
- case PSN_APPLY:
+ switch (nmhdr->code) {
+ case PSN_APPLY:
+ //iAbsencePeriod
+ int num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, 0, FALSE);
+ switch (SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_GETCURSEL, 0, 0)) {
+ case 1: options.iAbsencePeriod = 7 * num; break;
+ case 2: options.iAbsencePeriod = 30 * num; break;
+ case 3: options.iAbsencePeriod = 365 * num; break;
+ default: options.iAbsencePeriod = num; break;
+ }
- //iAbsencePeriod
- int num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, 0, FALSE);
- switch (SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_GETCURSEL, 0, 0))
- {
- case 1: options.iAbsencePeriod = 7 * num; break;
- case 2: options.iAbsencePeriod = 30 * num; break;
- case 3: options.iAbsencePeriod = 365 * num; break;
- default: options.iAbsencePeriod = num; break;
- }
-
- //iAbsencePeriod2
- num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, 0, FALSE);
- switch (SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_GETCURSEL, 0, 0))
- {
- case 1: options.iAbsencePeriod2 = 7 * num; break;
- case 2: options.iAbsencePeriod2 = 30 * num; break;
- case 3: options.iAbsencePeriod2 = 365 * num; break;
- default: options.iAbsencePeriod2 = num; break;
- }
-
- //iSilencePeriod
- num = GetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, 0, FALSE);
- switch (SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_GETCURSEL, 0, 0))
- {
- case 1: options.iSilencePeriod = 7 * num; break;
- case 2: options.iSilencePeriod = 30 * num; break;
- case 3: options.iSilencePeriod = 365 * num; break;
- default: options.iSilencePeriod = num; break;
- }
+ //iAbsencePeriod2
+ num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, 0, FALSE);
+ switch (SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_GETCURSEL, 0, 0)) {
+ case 1: options.iAbsencePeriod2 = 7 * num; break;
+ case 2: options.iAbsencePeriod2 = 30 * num; break;
+ case 3: options.iAbsencePeriod2 = 365 * num; break;
+ default: options.iAbsencePeriod2 = num; break;
+ }
- options.iShowPopUp = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
- options.iShowEvent = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
- options.iShowUDetails = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_UDETAILS), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
- options.iShowMessageWindow = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MSGWINDOW), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
- options.notifyFirstOnline = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FIRSTSIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false;
- options.hideInactive = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_NOMSGS), BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false;
- options.enableMissYou = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MISSYOU), BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false;
+ //iSilencePeriod
+ num = GetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, 0, FALSE);
+ switch (SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_GETCURSEL, 0, 0)) {
+ case 1: options.iSilencePeriod = 7 * num; break;
+ case 2: options.iSilencePeriod = 30 * num; break;
+ case 3: options.iSilencePeriod = 365 * num; break;
+ default: options.iSilencePeriod = num; break;
+ }
- options.iShowPopUp2 = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP2), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
- options.iShowEvent2 = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON2), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.iShowPopUp = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.iShowEvent = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.iShowUDetails = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_UDETAILS), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.iShowMessageWindow = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MSGWINDOW), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.notifyFirstOnline = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FIRSTSIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false;
+ options.hideInactive = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_NOMSGS), BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false;
+ options.enableMissYou = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MISSYOU), BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false;
- options.action2 = (GoneContactAction)SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_GETCURSEL, 0, 0);
+ options.iShowPopUp2 = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP2), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.iShowEvent2 = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON2), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
- // save values to the DB
- SaveOptions();
+ options.action2 = (GoneContactAction)SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_GETCURSEL, 0, 0);
- // clear all notified settings
- HANDLE hContact = db_find_first();
- while (hContact != 0)
- {
- if(DBGetContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0))
- DBWriteContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0);
+ // save values to the DB
+ SaveOptions();
- hContact = db_find_next(hContact);
- }
+ // clear all notified settings
+ HANDLE hContact = db_find_first();
+ while (hContact != 0) {
+ if(db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0))
+ db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
- // restart timer & run check
- KillTimer(0, timer_id);
- timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
- TimerProc(0, 0, 0, 0);
- return TRUE;
+ hContact = db_find_next(hContact);
+ }
+
+ // restart timer & run check
+ KillTimer(0, timer_id);
+ timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
+ TimerProc(0, 0, 0, 0);
+ return TRUE;
}
break;
}
@@ -294,189 +279,157 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, static INT_PTR CALLBACK PopUpOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static int ChangeLock = 0;
- switch (uMsg)
- {
- case WM_INITDIALOG:
-
- ChangeLock++;
- TranslateDialogDefault(hwndDlg);
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ ChangeLock++;
+ TranslateDialogDefault(hwndDlg);
- //iPopUpColorBack
- SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_SETCOLOUR, 0, options.iPopUpColorBack);
+ //iPopUpColorBack
+ SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_SETCOLOUR, 0, options.iPopUpColorBack);
- //iPopUpColorFore
- SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_SETCOLOUR, 0, options.iPopUpColorFore);
+ //iPopUpColorFore
+ SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_SETCOLOUR, 0, options.iPopUpColorFore);
- if (options.iUsePopupColors)
- {
- CheckDlgButton(hwndDlg, IDC_COLORS_POPUP, BST_CHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_WIN), false);
- }
+ if (options.iUsePopupColors) {
+ CheckDlgButton(hwndDlg, IDC_COLORS_POPUP, BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_WIN), false);
+ }
- if (options.iUseWinColors)
- {
- CheckDlgButton(hwndDlg, IDC_COLORS_WIN, BST_CHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_POPUP), false);
- }
+ if (options.iUseWinColors) {
+ CheckDlgButton(hwndDlg, IDC_COLORS_WIN, BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_POPUP), false);
+ }
- //iPopUpDelay
- SetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 5, FALSE);
- if (options.iPopUpDelay < 0)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_PERM), BM_SETCHECK, BST_CHECKED, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), false);
- }
- else if(options.iPopUpDelay == 0)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_DEF), BM_SETCHECK, BST_CHECKED, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), false);
- }
- else
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_CUST), BM_SETCHECK, BST_CHECKED, 0);
- SetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, options.iPopUpDelay, FALSE);
- }
+ //iPopUpDelay
+ SetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 5, FALSE);
+ if (options.iPopUpDelay < 0) {
+ SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_PERM), BM_SETCHECK, BST_CHECKED, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), false);
+ }
+ else if(options.iPopUpDelay == 0) {
+ SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_DEF), BM_SETCHECK, BST_CHECKED, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), false);
+ }
+ else {
+ SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_CUST), BM_SETCHECK, BST_CHECKED, 0);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, options.iPopUpDelay, FALSE);
+ }
- ChangeLock--;
- return TRUE;
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_PREVIEW)
- {
- POPUPDATAT ppd;
- ZeroMemory(&ppd, sizeof(ppd));
+ ChangeLock--;
+ return TRUE;
- //iPopUpDelay
- options.iPopUpDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
- if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_PERM), BM_GETCHECK, 0, 0) == BST_CHECKED)
- {
- options.iPopUpDelay = -1;
- }
- else if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_DEF), BM_GETCHECK, 0, 0) == BST_CHECKED)
- {
- options.iPopUpDelay = 0;
- }
- ppd.lchContact = NULL;
- ppd.lchIcon = hIcon;
- _tcsncpy(ppd.lptzContactName, TranslateT("Contact name"), MAX_CONTACTNAME);
- TCHAR szPreviewText[50];
- mir_sntprintf(szPreviewText,50,TranslateT("has returned after being absent since %d days"),rand() % 30);
- _tcsncpy(ppd.lptzText, szPreviewText, MAX_SECONDLINE);
-
- // Get current popups colors options
- if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP))
- {
- ppd.colorBack = ppd.colorText = 0;
- }
- else if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_WIN))
- {
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- }
- else
- {
- ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_GETCOLOUR, 0, 0);
- ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_GETCOLOUR, 0, 0);
- }
- ppd.PluginData = NULL;
- ppd.iSeconds = options.iPopUpDelay;
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDC_PREVIEW) {
+ POPUPDATAT ppd;
+ ZeroMemory(&ppd, sizeof(ppd));
+
+ //iPopUpDelay
+ options.iPopUpDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
+ if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_PERM), BM_GETCHECK, 0, 0) == BST_CHECKED)
+ options.iPopUpDelay = -1;
+ else if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_DEF), BM_GETCHECK, 0, 0) == BST_CHECKED)
+ options.iPopUpDelay = 0;
+
+ ppd.lchContact = NULL;
+ ppd.lchIcon = hIcon;
+ _tcsncpy(ppd.lptzContactName, TranslateT("Contact name"), MAX_CONTACTNAME);
+ TCHAR szPreviewText[50];
+ mir_sntprintf(szPreviewText,50,TranslateT("has returned after being absent since %d days"),rand() % 30);
+ _tcsncpy(ppd.lptzText, szPreviewText, MAX_SECONDLINE);
+
+ // Get current popups colors options
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP))
+ ppd.colorBack = ppd.colorText = 0;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_WIN)) {
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ else {
+ ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_GETCOLOUR, 0, 0);
+ ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_GETCOLOUR, 0, 0);
+ }
+ ppd.PluginData = NULL;
+ ppd.iSeconds = options.iPopUpDelay;
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &ppd, APF_NO_HISTORY);
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &ppd, APF_NO_HISTORY);
- _tcsncpy(ppd.lptzText, TranslateT("You awaited this contact!"), MAX_SECONDLINE);
- ppd.lchIcon = Skin_GetIcon("enabled_icon");;
+ _tcsncpy(ppd.lptzText, TranslateT("You awaited this contact!"), MAX_SECONDLINE);
+ ppd.lchIcon = Skin_GetIcon("enabled_icon");;
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &ppd, APF_NO_HISTORY);
- }
- else
- {
- if ((HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == CBN_SELCHANGE) || ((HIWORD(wParam) == EN_CHANGE) && !ChangeLock)) {
- SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
- }
- if (LOWORD(wParam) == IDC_COLORS_POPUP)
- {
- if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_WIN), false);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), true);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), true);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_WIN), true);
- }
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &ppd, APF_NO_HISTORY);
+ }
+ else {
+ if ((HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == CBN_SELCHANGE) || ((HIWORD(wParam) == EN_CHANGE) && !ChangeLock))
+ SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+
+ if (LOWORD(wParam) == IDC_COLORS_POPUP) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_WIN), false);
}
- if (LOWORD(wParam) == IDC_COLORS_WIN)
- {
- if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_WIN))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_POPUP), false);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), true);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), true);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_POPUP), true);
- }
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_WIN), true);
}
- if (LOWORD(wParam) == IDC_DELAY_DEF || LOWORD(wParam) == IDC_DELAY_PERM)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), false);
+ }
+ if (LOWORD(wParam) == IDC_COLORS_WIN) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_WIN)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_POPUP), false);
}
- else if (LOWORD(wParam) == IDC_DELAY_CUST)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), true);
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_POPUP), true);
}
}
- break;
- case WM_NOTIFY:{
- NMHDR* nmhdr = (NMHDR*)lParam;
- switch (nmhdr->code)
- {
- case PSN_APPLY:
+ if (LOWORD(wParam) == IDC_DELAY_DEF || LOWORD(wParam) == IDC_DELAY_PERM)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), false);
+ else if (LOWORD(wParam) == IDC_DELAY_CUST)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), true);
+ }
- if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP))
- {
- options.iUsePopupColors = 1;
- options.iUseWinColors = 0;
- }
- else if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_WIN))
- {
- options.iUseWinColors = 1;
- options.iUsePopupColors = 0;
- options.iPopUpColorBack = GetSysColor(COLOR_BTNFACE);
- options.iPopUpColorFore = GetSysColor(COLOR_WINDOWTEXT);
- }
- else
- {
- options.iUseWinColors = options.iUsePopupColors = 0;
- options.iPopUpColorBack = SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_GETCOLOUR, 0, 0);
- options.iPopUpColorFore = SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_GETCOLOUR, 0, 0);
- }
+ break;
+ case WM_NOTIFY:
+ {
+ NMHDR* nmhdr = (NMHDR*)lParam;
+ switch (nmhdr->code) {
+ case PSN_APPLY:
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP)) {
+ options.iUsePopupColors = 1;
+ options.iUseWinColors = 0;
+ }
+ else if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_WIN)) {
+ options.iUseWinColors = 1;
+ options.iUsePopupColors = 0;
+ options.iPopUpColorBack = GetSysColor(COLOR_BTNFACE);
+ options.iPopUpColorFore = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ else {
+ options.iUseWinColors = options.iUsePopupColors = 0;
+ options.iPopUpColorBack = SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_GETCOLOUR, 0, 0);
+ options.iPopUpColorFore = SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_GETCOLOUR, 0, 0);
+ }
- //iPopUpDelay
- options.iPopUpDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
- if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_PERM), BM_GETCHECK, 0, 0) == BST_CHECKED)
- {
- options.iPopUpDelay = -1;
- }
- else if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_DEF), BM_GETCHECK, 0, 0) == BST_CHECKED)
- {
- options.iPopUpDelay = 0;
- }
+ //iPopUpDelay
+ options.iPopUpDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
+ if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_PERM), BM_GETCHECK, 0, 0) == BST_CHECKED)
+ options.iPopUpDelay = -1;
+ else if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_DEF), BM_GETCHECK, 0, 0) == BST_CHECKED)
+ options.iPopUpDelay = 0;
- // save value to the DB
- SavePopupOptions();
+ // save value to the DB
+ SavePopupOptions();
- return TRUE;
+ return TRUE;
}
break;
}
@@ -489,15 +442,13 @@ static INT_PTR CALLBACK PopUpOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP */
static int OptionsInit(WPARAM wParam, LPARAM lParam)
{
- OPTIONSDIALOGPAGE odp;
- ZeroMemory(&odp, sizeof(odp));
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = hInst;
odp.ptszGroup = LPGENT("Plugins");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPANEL);
odp.ptszTitle = LPGENT("Buddy Expectator");
odp.pfnDlgProc = OptionsFrameProc;
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
+ odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
Options_AddPage(wParam, &odp);
if (ServiceExists(MS_POPUP_ADDPOPUP)) {
@@ -540,7 +491,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar SetDlgItemText(hdlg, IDC_EDIT_LASTINPUT, tmpBuf);
}
- unsigned int AbsencePeriod = DBGetContactSettingDword((HANDLE)lparam, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
+ unsigned int AbsencePeriod = db_get_dw((HANDLE)lparam, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
SendDlgItemMessage(hdlg, IDC_SPINABSENCE, UDM_SETRANGE, 0, MAKELONG(999, 1));
SetDlgItemInt(hdlg, IDC_EDITABSENCE, AbsencePeriod, FALSE);
@@ -554,9 +505,9 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar SetDlgItemText(hdlg, IDC_EDIT_WILLNOTICE, _T(""));
}
- SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_SETCHECK, DBGetContactSettingByte((HANDLE)lparam, MODULE_NAME, "MissYou", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
- SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_SETCHECK, DBGetContactSettingByte((HANDLE)lparam, MODULE_NAME, "MissYouNotifyAlways", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
- SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_SETCHECK, DBGetContactSettingByte((HANDLE)lparam, MODULE_NAME, "NeverHide", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_SETCHECK, db_get_b((HANDLE)lparam, MODULE_NAME, "MissYou", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_SETCHECK, db_get_b((HANDLE)lparam, MODULE_NAME, "MissYouNotifyAlways", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_SETCHECK, db_get_b((HANDLE)lparam, MODULE_NAME, "NeverHide", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
TranslateDialogDefault(hdlg);
@@ -574,10 +525,10 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lparam)->lParam;
if (hContact)
{
- DBWriteContactSettingDword(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, 0, FALSE));
- DBWriteContactSettingByte(hContact, MODULE_NAME, "MissYou", (SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_GETCHECK, 0, 0) == BST_CHECKED) ? 1 : 0);
- DBWriteContactSettingByte(hContact, MODULE_NAME, "MissYouNotifyAlways", (SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_GETCHECK, 0, 0) == BST_CHECKED) ? 1 : 0);
- DBWriteContactSettingByte(hContact, MODULE_NAME, "NeverHide", (SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_GETCHECK, 0, 0) == BST_CHECKED) ? 1 : 0);
+ db_set_dw(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, 0, FALSE));
+ db_set_b(hContact, MODULE_NAME, "MissYou", (SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_GETCHECK, 0, 0) == BST_CHECKED) ? 1 : 0);
+ db_set_b(hContact, MODULE_NAME, "MissYouNotifyAlways", (SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_GETCHECK, 0, 0) == BST_CHECKED) ? 1 : 0);
+ db_set_b(hContact, MODULE_NAME, "NeverHide", (SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_GETCHECK, 0, 0) == BST_CHECKED) ? 1 : 0);
}
break;
}
|