diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-15 16:26:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-15 16:26:10 +0000 |
commit | 7fe6e93058f0e9253e2a79d7fc2d7a136784f791 (patch) | |
tree | 861225801bcda335939cac2fa6ddc6083f52f51f /plugins | |
parent | 21e84e8d5012cc0b600f27a4d796d3813b29a16c (diff) |
various popup related code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4056 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Clist_modern/src/modern_popup.cpp | 14 | ||||
-rw-r--r-- | plugins/NotifyAnything/src/main.cpp | 2 | ||||
-rw-r--r-- | plugins/Ping/src/utils.cpp | 2 | ||||
-rw-r--r-- | plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 82 | ||||
-rw-r--r-- | plugins/StatusPlugins/KeepStatus/options.cpp | 48 | ||||
-rw-r--r-- | plugins/StatusPlugins/commonstatus.cpp | 2 |
6 files changed, 65 insertions, 85 deletions
diff --git a/plugins/Clist_modern/src/modern_popup.cpp b/plugins/Clist_modern/src/modern_popup.cpp index 93b6a8d084..0064089438 100644 --- a/plugins/Clist_modern/src/modern_popup.cpp +++ b/plugins/Clist_modern/src/modern_popup.cpp @@ -55,7 +55,6 @@ void ShowPopup(const char *title, const char *description, int type) // Make popup
POPUPDATA ppd = { 0 };
- ppd.lchContact = 0;
ppd.lchIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
strncpy(ppd.lpzContactName, title == NULL ? "Modern Contact List" : title, SIZEOF(ppd.lpzContactName)-1);
@@ -66,23 +65,12 @@ void ShowPopup(const char *title, const char *description, int type) ppd.lpzText[SIZEOF(ppd.lpzText)-1] = '\0';
}
- if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST) {
- ppd.colorBack = 0;
- ppd.colorText = 0;
- }
- else {
+ if (type != POPUP_TYPE_NORMAL && type != POPUP_TYPE_TEST) {
ppd.colorBack = -1;
ppd.colorText = RGB(255,255,255);
}
ppd.PluginWindowProc = DumbPopupDlgProc;
-
- if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST)
- ppd.iSeconds = 0;
- else
- ppd.iSeconds = 0;
-
- // Now that every field has been filled, we want to see the popup.
PUAddPopUp(&ppd);
}
diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp index 3d020de41f..af677b4ce4 100644 --- a/plugins/NotifyAnything/src/main.cpp +++ b/plugins/NotifyAnything/src/main.cpp @@ -583,7 +583,7 @@ void replaceMessage(const popup_t &msg) LeaveCS(&g_popups_cs);
- CallServiceSync(MS_POPUP_CHANGETEXT, (WPARAM)i->second->hwnd, (LPARAM)strip(i->second->message).c_str());
+ PUChangeText(i->second->hwnd, strip(i->second->message).c_str());
return;
}
}
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index a193888635..972d60845c 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -45,7 +45,7 @@ void __stdcall ShowPopup( const char* line1, const char* line2, int flags ) ppd->PluginWindowProc = NullWindowProc;
ppd->PluginData = NULL;
- QueueUserAPC( sttMainThreadCallback , mainThread, ( ULONG )ppd );
+ QueueUserAPC(sttMainThreadCallback, mainThread, ( ULONG )ppd );
}
else if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
POPUPDATACLASS d = {sizeof(d), "pingpopups"};
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 9d3ca24c14..40a9400030 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -141,9 +141,9 @@ int LoadMainOptions() GetCurrentConnectionSettings();
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_CHECKCONNECTION, FALSE)) {
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_CONTCHECK, FALSE)) {
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_BYPING, FALSE)) {
+ if ( db_get_b(NULL, MODULENAME, SETTING_CHECKCONNECTION, FALSE)) {
+ if ( db_get_b(NULL, MODULENAME, SETTING_CONTCHECK, FALSE)) {
+ if ( db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE)) {
WSADATA wsaData;
WSAStartup(MAKEWORD(2, 2), &wsaData);
@@ -154,10 +154,10 @@ int LoadMainOptions() }
StartTimer(IDT_CHECKCONTIN, 0, FALSE);
}
- increaseExponential = DBGetContactSettingByte(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL, FALSE);
+ increaseExponential = db_get_b(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL, FALSE);
currentDelay = initDelay = 1000*DBGetContactSettingDword(NULL, MODULENAME, SETTING_INITDELAY, DEFAULT_INITDELAY);
maxDelay = 1000*DBGetContactSettingDword(NULL, MODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY);
- maxRetries = DBGetContactSettingByte(NULL, MODULENAME, SETTING_MAXRETRIES,0);
+ maxRetries = db_get_b(NULL, MODULENAME, SETTING_MAXRETRIES,0);
if (maxRetries == 0)
maxRetries = -1;
hProtoAckHook = HookEvent(ME_PROTO_ACK, ProcessProtoAck);
@@ -165,7 +165,7 @@ int LoadMainOptions() if (ServiceExists(ME_CS_STATUSCHANGE))
hCSStatusChangeHook = HookEvent(ME_CS_STATUSCHANGE, CSStatusChange);
hCSStatusChangeExHook = HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChangeEx);
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_CHECKAPMRESUME, 0)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000)) {
+ if ( db_get_b(NULL, MODULENAME, SETTING_CHECKAPMRESUME, 0)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000)) {
if (!IsWindow(hMessageWindow)) {
hMessageWindow = CreateWindowEx(0, _T("STATIC"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
SetWindowLongPtr(hMessageWindow, GWLP_WNDPROC, (LONG_PTR)MessageWndProc);
@@ -241,7 +241,7 @@ static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, TCH char dbSetting[128];
_snprintf(dbSetting, sizeof(dbSetting), "%s_enabled", cs->szName);
cs->lastStatus = lastStatus == 0 ? cs->status : lastStatus;
- if (!DBGetContactSettingByte(NULL, MODULENAME, dbSetting, 1))
+ if (!db_get_b(NULL, MODULENAME, dbSetting, 1))
cs->status = ID_STATUS_DISABLED;
else if (status == ID_STATUS_LAST)
cs->status = cs->lastStatus;
@@ -280,10 +280,10 @@ static int SetCurrentStatus() PROTOCOLSETTINGEX **ps = GetCurrentProtoSettingsCopy();
for (i=0; i < connectionSettings.getCount(); i++) {
realStatus = CallProtoService(ps[i]->szName, PS_GETSTATUS, 0, 0);
- if ( (ps[i]->status == ID_STATUS_DISABLED) || (ps[i]->status == realStatus) || (DBGetContactSettingByte(NULL, ps[i]->szName, SETTING_PROTORETRY, 0))) { // ignore this proto by removing it's name (not so nice)
+ if ( (ps[i]->status == ID_STATUS_DISABLED) || (ps[i]->status == realStatus) || ( db_get_b(NULL, ps[i]->szName, SETTING_PROTORETRY, 0))) { // ignore this proto by removing it's name (not so nice)
ps[i]->szName = "";
}
- else if ( (ps[i]->status != ID_STATUS_DISABLED) && (ps[i]->status != realStatus) && (realStatus != ID_STATUS_OFFLINE) && (DBGetContactSettingByte(NULL, MODULENAME, SETTING_FIRSTOFFLINE, FALSE))) {
+ else if ( (ps[i]->status != ID_STATUS_DISABLED) && (ps[i]->status != realStatus) && (realStatus != ID_STATUS_OFFLINE) && ( db_get_b(NULL, MODULENAME, SETTING_FIRSTOFFLINE, FALSE))) {
// force offline before reconnecting
log_infoA("KeepStatus: Setting %s offline before making a new connection attempt", ps[i]->szName);
CallProtoService(ps[i]->szName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0);
@@ -303,8 +303,8 @@ static int StatusChange(WPARAM wParam, LPARAM lParam) for (int i=0;i<connectionSettings.getCount();i++) {
TConnectionSettings& cs = connectionSettings[i];
if (GetStatus(cs) != ID_STATUS_DISABLED)
- if ( DBGetContactSettingByte(NULL, MODULENAME, SETTING_NOLOCKED, 0) ||
- !DBGetContactSettingByte(NULL, cs.szName, "LockMainStatus", 0 ))
+ if ( db_get_b(NULL, MODULENAME, SETTING_NOLOCKED, 0) ||
+ !db_get_b(NULL, cs.szName, "LockMainStatus", 0 ))
AssignStatus(&cs, wParam, 0, cs.szMsg);
}
}
@@ -537,10 +537,10 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam) return 0;
mir_snprintf(dbSetting, sizeof(dbSetting), "%s_enabled", ack->szModule);
- if (!DBGetContactSettingByte(NULL, MODULENAME, dbSetting, 1))
+ if (!db_get_b(NULL, MODULENAME, dbSetting, 1))
return 0;
- if (DBGetContactSettingByte(NULL, ack->szModule, SETTING_PROTORETRY, 0)) {
+ if ( db_get_b(NULL, ack->szModule, SETTING_PROTORETRY, 0)) {
log_infoA("KeepStatus: %s has built-in reconnection enabled", ack->szModule);
return 0;
}
@@ -563,7 +563,7 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam) TConnectionSettings& cs = connectionSettings[i];
if (!strcmp(ack->szModule, cs.szName)) {
AssignStatus(&cs, ID_STATUS_OFFLINE, 0, NULL);
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_CNCOTHERLOC, 0)) {
+ if ( db_get_b(NULL, MODULENAME, SETTING_CNCOTHERLOC, 0)) {
StopTimer(IDT_PROCESSACK);
for (j=0;j<connectionSettings.getCount();j++) {
AssignStatus(&connectionSettings[j], ID_STATUS_OFFLINE, 0, NULL);
@@ -576,7 +576,7 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam) else if (ack->result == ACKRESULT_FAILED) {
// login failed
NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_LOGINERROR, (LPARAM)ack->szModule);
- switch (DBGetContactSettingByte(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING)) {
+ switch ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING)) {
case LOGINERR_CANCEL:
{
log_infoA("KeepStatus: cancel on login error (%s)", ack->szModule);
@@ -695,7 +695,7 @@ static VOID CALLBACK CheckConnectionTimer(HWND hwnd,UINT message,UINT_PTR idEven if (increaseExponential)
currentDelay = min(2*currentDelay,maxDelay);
- if ( ((DBGetContactSettingByte(NULL, MODULENAME, SETTING_CHKINET, 0)) && (!InternetGetConnectedState(NULL, 0))) || ((DBGetContactSettingByte(NULL, MODULENAME, SETTING_BYPING, FALSE)) && (!bLastPingResult))) {
+ if ( (( db_get_b(NULL, MODULENAME, SETTING_CHKINET, 0)) && (!InternetGetConnectedState(NULL, 0))) || (( db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE)) && (!bLastPingResult))) {
// no network
NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_RETRYNOCONN, (LPARAM)retryCount+1);
ProcessPopup(KS_CONN_STATE_RETRYNOCONN, 0);
@@ -796,7 +796,7 @@ static void CheckContinueslyFunction(void *arg) return;
}
- BOOL ping = DBGetContactSettingByte(NULL, MODULENAME, SETTING_BYPING, FALSE);
+ BOOL ping = db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE);
if (ping) {
DBVARIANT dbv;
if (DBGetContactSetting(NULL, MODULENAME, SETTING_PINGHOST, &dbv))
@@ -890,7 +890,7 @@ static void CheckContinueslyFunction(void *arg) log_infoA("KeepStatus: connection lost! (continuesly check)");
NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_LOST, 0);
ProcessPopup(KS_CONN_STATE_LOST, 0);
- maxRetries = DBGetContactSettingByte(NULL, MODULENAME, SETTING_MAXRETRIES, 0);
+ maxRetries = db_get_b(NULL, MODULENAME, SETTING_MAXRETRIES, 0);
if (maxRetries == 0)
maxRetries = -1;
StartTimer(IDT_CHECKCONN, initDelay, FALSE);
@@ -900,7 +900,7 @@ static void CheckContinueslyFunction(void *arg) static VOID CALLBACK CheckContinueslyTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime)
{
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_BYPING, FALSE))
+ if ( db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE))
mir_forkthread(CheckContinueslyFunction, NULL);
else
CheckContinueslyFunction(NULL);
@@ -912,7 +912,7 @@ static int ProcessPopup(int reason, LPARAM lParam) HICON hIcon;
char text[MAX_SECONDLINE], protoName[128], *szProto;
- if ( !DBGetContactSettingByte(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS,FALSE) || !ServiceExists(MS_POPUP_ADDPOPUP))
+ if ( !db_get_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS,FALSE) || !ServiceExists(MS_POPUP_ADDPOPUP))
return -1;
memset(protoName, '\0', sizeof(protoName));
@@ -922,7 +922,7 @@ static int ProcessPopup(int reason, LPARAM lParam) switch(reason) {
case KS_CONN_STATE_OTHERLOCATION: // lParam = 1 proto
- if (!DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
+ if (!db_get_b(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
return -1;
szProto = (char *)lParam;
@@ -935,16 +935,16 @@ static int ProcessPopup(int reason, LPARAM lParam) /*******************
rethink this
********************/
- if (!DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
+ if (!db_get_b(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
return -1;
szProto = (char *)lParam;
hIcon = (HICON)CallService(MS_SKIN_LOADPROTOICON, (WPARAM)szProto, (LPARAM)SKINICON_STATUS_OFFLINE);
CallProtoService(szProto, PS_GETNAME, sizeof(protoName), (LPARAM)protoName);
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_CANCEL)
+ if ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_CANCEL)
_snprintf(text, sizeof(text), Translate("%s Login error, cancel reconnecting"), protoName);
- else if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_SETDELAY)
+ else if ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_SETDELAY)
_snprintf(text, sizeof(text), Translate("%s Login error (next retry (%d) in %ds)"), protoName, retryCount+1, DBGetContactSettingDword(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY));
else
@@ -953,7 +953,7 @@ static int ProcessPopup(int reason, LPARAM lParam) break;
case KS_CONN_STATE_LOST: // lParam = 1 proto, or NULL
- if (!DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUCONNLOST, TRUE))
+ if (!db_get_b(NULL, MODULENAME, SETTING_PUCONNLOST, TRUE))
return -1;
szProto = (char *)lParam;
@@ -974,7 +974,7 @@ static int ProcessPopup(int reason, LPARAM lParam) PROTOCOLSETTINGEX **ps;
char protoInfoLine[512], protoInfo[MAX_SECONDLINE];
- if (!DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUCONNRETRY, TRUE))
+ if (!db_get_b(NULL, MODULENAME, SETTING_PUCONNRETRY, TRUE))
return -1;
memset(protoInfoLine, '\0', sizeof(protoInfoLine));
@@ -987,7 +987,7 @@ static int ProcessPopup(int reason, LPARAM lParam) if (szProto == NULL) {
szProto = ps[i]->szName;
}
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)) {
+ if ( db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)) {
CallProtoService(ps[i]->szName, PS_GETNAME, sizeof(protoName), (LPARAM)protoName);
//_snprintf(protoInfoLine, sizeof(protoInfoLine), Translate("%s\t(will be set to %s)\r\n"), protoName, (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)ps[i]->status, 0));
_snprintf(protoInfoLine, sizeof(protoInfoLine), "%s\t(%s %s)\r\n", protoName, Translate("will be set to"), (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)ps[i]->status, 0));
@@ -1012,7 +1012,7 @@ static int ProcessPopup(int reason, LPARAM lParam) break;
case KS_CONN_STATE_RETRYNOCONN: // lParam = NULL
- if (!DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
+ if (!db_get_b(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
return -1;
hIcon = (HICON)CallService(MS_SKIN_LOADICON, (WPARAM)SKINICON_STATUS_OFFLINE, 0);
@@ -1023,7 +1023,7 @@ static int ProcessPopup(int reason, LPARAM lParam) break;
case KS_CONN_STATE_STOPPEDCHECKING: // lParam == BOOL succes
- if (!DBGetContactSettingByte(NULL, MODULENAME, SETTING_PURESULT, TRUE))
+ if (!db_get_b(NULL, MODULENAME, SETTING_PURESULT, TRUE))
return -1;
if (lParam) {
@@ -1045,31 +1045,23 @@ static int ProcessPopup(int reason, LPARAM lParam) static INT_PTR ShowPopup(char* msg, HICON hIcon)
{
- POPUPDATA ppd = { NULL };
- ppd.lchContact = NULL;
+ POPUPDATA ppd = { 0 };
ppd.lchIcon = hIcon;
- memset(ppd.lpzContactName, '\0', sizeof(ppd.lpzContactName));
- memset(ppd.lpzText, '\0', sizeof(ppd.lpzText));
strncpy(ppd.lpzContactName, Translate("KeepStatus"), sizeof(ppd.lpzContactName)-1);
strncpy(ppd.lpzText, msg, sizeof(ppd.lpzText)-1);
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0))
+ if ( db_get_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0))
{
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- else if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_POPUP_USEDEFCOLORS, 0))
- {
- ppd.colorBack = NULL;
- ppd.colorText = NULL;
- }
- else
+ else if ( !db_get_b(NULL, MODULENAME, SETTING_POPUP_USEDEFCOLORS, 0))
{
ppd.colorBack = DBGetContactSettingDword(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA);
ppd.colorText = DBGetContactSettingDword(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC);
}
ppd.PluginWindowProc = PopupDlgProc;
- ppd.PluginData = NULL;
- switch (DBGetContactSettingByte(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
+
+ switch ( db_get_b(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
case POPUP_DELAYCUSTOM:
ppd.iSeconds = (int)DBGetContactSettingDword(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, 0);
if (ppd.iSeconds == 0) {
@@ -1092,7 +1084,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa switch(message) {
case WM_CONTEXTMENU: // right
case WM_COMMAND: // left
- switch( DBGetContactSettingByte( NULL, MODULENAME,
+ switch( db_get_b( NULL, MODULENAME,
(message == WM_COMMAND) ? SETTING_POPUP_LEFTCLICK : SETTING_POPUP_RIGHTCLICK,
POPUP_ACT_CLOSEPOPUP )) {
case POPUP_ACT_CANCEL:
@@ -1131,7 +1123,7 @@ INT_PTR EnableProtocolService(WPARAM wParam, LPARAM lParam) char dbSetting[128];
_snprintf(dbSetting, sizeof(dbSetting), "%s_enabled", szProto);
- if (!DBGetContactSettingByte(NULL, MODULENAME, dbSetting, 1)) // 'hard' disabled
+ if (!db_get_b(NULL, MODULENAME, dbSetting, 1)) // 'hard' disabled
return -1;
int ret = -2;
@@ -1158,7 +1150,7 @@ INT_PTR IsProtocolEnabledService(WPARAM wParam, LPARAM lParam) char dbSetting[128];
_snprintf(dbSetting, sizeof(dbSetting), "%s_enabled", szProto);
- if ( !DBGetContactSettingByte(NULL, MODULENAME, dbSetting, 1 ))
+ if ( !db_get_b(NULL, MODULENAME, dbSetting, 1 ))
return FALSE;
for ( int i=0; i < connectionSettings.getCount(); i++ ) {
diff --git a/plugins/StatusPlugins/KeepStatus/options.cpp b/plugins/StatusPlugins/KeepStatus/options.cpp index c62510fade..15b1996748 100644 --- a/plugins/StatusPlugins/KeepStatus/options.cpp +++ b/plugins/StatusPlugins/KeepStatus/options.cpp @@ -45,13 +45,13 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L int i;
DBVARIANT dbv;
- SetDlgItemInt(hwndDlg, IDC_MAXRETRIES, DBGetContactSettingByte(NULL,MODULENAME,SETTING_MAXRETRIES,DEFAULT_MAXRETRIES),FALSE);
+ SetDlgItemInt(hwndDlg, IDC_MAXRETRIES, db_get_b(NULL,MODULENAME,SETTING_MAXRETRIES,DEFAULT_MAXRETRIES),FALSE);
SetDlgItemInt(hwndDlg, IDC_INITDELAY, DBGetContactSettingDword(NULL,MODULENAME,SETTING_INITDELAY,DEFAULT_INITDELAY),FALSE);
- CheckDlgButton(hwndDlg, IDC_CHECKCONNECTION, DBGetContactSettingByte(NULL, MODULENAME, SETTING_CHECKCONNECTION,FALSE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWCONNECTIONPOPUPS, (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS,FALSE)&&ServiceExists(MS_POPUP_SHOWMESSAGE))?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHKINET, DBGetContactSettingByte(NULL, MODULENAME, SETTING_CHKINET, FALSE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CONTCHECK, DBGetContactSettingByte(NULL, MODULENAME, SETTING_CONTCHECK, FALSE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_BYPING, DBGetContactSettingByte(NULL, MODULENAME, SETTING_BYPING, FALSE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECKCONNECTION, db_get_b(NULL, MODULENAME, SETTING_CHECKCONNECTION,FALSE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWCONNECTIONPOPUPS, ( db_get_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS,FALSE)&&ServiceExists(MS_POPUP_SHOWMESSAGE))?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHKINET, db_get_b(NULL, MODULENAME, SETTING_CHKINET, FALSE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CONTCHECK, db_get_b(NULL, MODULENAME, SETTING_CONTCHECK, FALSE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_BYPING, db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE)?BST_CHECKED:BST_UNCHECKED);
if (!DBGetContactSetting(NULL, MODULENAME, SETTING_PINGHOST, &dbv))
SetDlgItemTextA(hwndDlg, IDC_PINGHOST, dbv.pszVal);
// proto list
@@ -82,7 +82,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L char dbSetting[128];
_snprintf(dbSetting, sizeof(dbSetting), "%s_enabled", protos[i]->szModuleName);
- ListView_SetCheckState(hList, lvItem.iItem, DBGetContactSettingByte(NULL, MODULENAME, dbSetting, TRUE));
+ ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULENAME, dbSetting, TRUE));
lvItem.iItem++;
}
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXRETRIES), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION));
@@ -178,16 +178,16 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg,UINT msg,WPARAM wParam,LPA TranslateDialogDefault(hwndDlg);
SetDlgItemInt(hwndDlg, IDC_MAXDELAY, DBGetContactSettingDword(NULL,MODULENAME,SETTING_MAXDELAY,DEFAULT_MAXDELAY),FALSE);
SetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, DBGetContactSettingDword(NULL,MODULENAME,SETTING_MAXCONNECTINGTIME,0),FALSE);
- CheckDlgButton(hwndDlg, IDC_INCREASEEXPONENTIAL, DBGetContactSettingByte(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL,FALSE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CNCOTHERLOC, (DBGetContactSettingByte(NULL, MODULENAME, SETTING_CNCOTHERLOC, FALSE)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000))?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOGINERR, DBGetContactSettingByte(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING)==LOGINERR_NOTHING?FALSE:TRUE);
- CheckDlgButton(hwndDlg, IDC_CHECKAPMRESUME, (DBGetContactSettingByte(NULL, MODULENAME, SETTING_CHECKAPMRESUME, FALSE)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000))?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_FIRSTOFFLINE, (DBGetContactSettingByte(NULL, MODULENAME, SETTING_FIRSTOFFLINE, FALSE)));
- CheckDlgButton(hwndDlg, IDC_NOLOCKED, (DBGetContactSettingByte(NULL, MODULENAME, SETTING_NOLOCKED, FALSE)));
+ CheckDlgButton(hwndDlg, IDC_INCREASEEXPONENTIAL, db_get_b(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL,FALSE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CNCOTHERLOC, ( db_get_b(NULL, MODULENAME, SETTING_CNCOTHERLOC, FALSE)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000))?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOGINERR, db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING)==LOGINERR_NOTHING?FALSE:TRUE);
+ CheckDlgButton(hwndDlg, IDC_CHECKAPMRESUME, ( db_get_b(NULL, MODULENAME, SETTING_CHECKAPMRESUME, FALSE)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000))?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FIRSTOFFLINE, ( db_get_b(NULL, MODULENAME, SETTING_FIRSTOFFLINE, FALSE)));
+ CheckDlgButton(hwndDlg, IDC_NOLOCKED, ( db_get_b(NULL, MODULENAME, SETTING_NOLOCKED, FALSE)));
SetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, DBGetContactSettingDword(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY), FALSE);
SetDlgItemInt(hwndDlg, IDC_PINGCOUNT, DBGetContactSettingWord(NULL, MODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT), FALSE);
SetDlgItemInt(hwndDlg, IDC_CNTDELAY, DBGetContactSettingDword(NULL, MODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), FALSE);
- switch (DBGetContactSettingByte(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL)) {
+ switch ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL)) {
case LOGINERR_SETDELAY:
CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_SETDELAY);
break;
@@ -371,7 +371,7 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar bFreeze = true;
// left action
- switch ( DBGetContactSettingByte( NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL )) {
+ switch ( db_get_b( NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL )) {
case POPUP_ACT_CLOSEPOPUP:
CheckDlgButton(hwndDlg, IDC_LCLOSE, BST_CHECKED);
break;
@@ -386,7 +386,7 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar break;
}
// right action
- switch ( DBGetContactSettingByte( NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL )) {
+ switch ( db_get_b( NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL )) {
case POPUP_ACT_CLOSEPOPUP:
CheckDlgButton(hwndDlg, IDC_RCLOSE, BST_CHECKED);
break;
@@ -405,7 +405,7 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYFROMPU), ServiceExists(MS_POPUP_ADDPOPUP));
EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYPERMANENT), ServiceExists(MS_POPUP_ADDPOPUP));
EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), ServiceExists(MS_POPUP_ADDPOPUP));
- switch (DBGetContactSettingByte(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
+ switch ( db_get_b(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
case POPUP_DELAYCUSTOM:
CheckDlgButton(hwndDlg, IDC_DELAYCUSTOM, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), ServiceExists(MS_POPUP_ADDPOPUP));
@@ -429,19 +429,19 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar // text
SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC));
// wincolors
- CheckDlgButton(hwndDlg, IDC_WINCOLORS, DBGetContactSettingByte(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0));
+ CheckDlgButton(hwndDlg, IDC_WINCOLORS, db_get_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0));
// defaultcolors
- CheckDlgButton(hwndDlg, IDC_DEFAULTCOLORS, ( (DBGetContactSettingByte(NULL, MODULENAME, SETTING_POPUP_USEDEFCOLORS, 0)) && (!IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS))));
+ CheckDlgButton(hwndDlg, IDC_DEFAULTCOLORS, ( ( db_get_b(NULL, MODULENAME, SETTING_POPUP_USEDEFCOLORS, 0)) && (!IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS))));
EnableWindow(GetDlgItem(hwndDlg, IDC_BGCOLOR), ((!IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)) && (!IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS))));
EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOR), ((!IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)) && (!IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS))));
EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULTCOLORS), (!IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_WINCOLORS), (!IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS)));
// popup types
- CheckDlgButton(hwndDlg, IDC_PUCONNLOST, DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUCONNLOST, TRUE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_PUOTHER, DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUOTHER, TRUE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_PUCONNRETRY, DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUCONNRETRY, TRUE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_PURESULT, DBGetContactSettingByte(NULL, MODULENAME, SETTING_PURESULT, TRUE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_PUSHOWEXTRA, DBGetContactSettingByte(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_PUCONNLOST, db_get_b(NULL, MODULENAME, SETTING_PUCONNLOST, TRUE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_PUOTHER, db_get_b(NULL, MODULENAME, SETTING_PUOTHER, TRUE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_PUCONNRETRY, db_get_b(NULL, MODULENAME, SETTING_PUCONNRETRY, TRUE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_PURESULT, db_get_b(NULL, MODULENAME, SETTING_PURESULT, TRUE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_PUSHOWEXTRA, db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)?BST_CHECKED:BST_UNCHECKED);
bFreeze = false;
break;
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp index 9ca9e15e35..c788042af3 100644 --- a/plugins/StatusPlugins/commonstatus.cpp +++ b/plugins/StatusPlugins/commonstatus.cpp @@ -179,7 +179,7 @@ static int equalsGlobalStatus(PROTOCOLSETTINGEX **ps) { if (pstatus == 0)
pstatus = CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0);
- if (DBGetContactSettingByte(NULL, protos[i]->szModuleName, "LockMainStatus", 0)) {
+ if ( db_get_b(NULL, protos[i]->szModuleName, "LockMainStatus", 0)) {
// if proto is locked, pstatus must be the current status
if (pstatus != CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0))
return 0;
|