From 007b4c7301f0d26a72f89f74e9929f42e24eb3e6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Apr 2013 22:27:16 +0000 Subject: - rest of menus cleared; - old database macroses wiped out from all plugins (left in m_database.h for compatibility) git-svn-id: http://svn.miranda-ng.org/main/trunk@4324 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/src/action_variables.cpp | 4 +-- plugins/Variables/src/condition_variables.cpp | 4 +-- plugins/Variables/src/contact.cpp | 14 +++++----- plugins/Variables/src/dbhelpers.h | 38 ++++++++++++------------- plugins/Variables/src/help.cpp | 2 +- plugins/Variables/src/options.cpp | 4 +-- plugins/Variables/src/parse_miranda.cpp | 40 +++++++++++++-------------- plugins/Variables/src/trigger_variables.cpp | 6 ++-- 8 files changed, 56 insertions(+), 56 deletions(-) (limited to 'plugins/Variables/src') diff --git a/plugins/Variables/src/action_variables.cpp b/plugins/Variables/src/action_variables.cpp index 2d7f60a015..deb9a1b3fb 100644 --- a/plugins/Variables/src/action_variables.cpp +++ b/plugins/Variables/src/action_variables.cpp @@ -66,7 +66,7 @@ int ParseStringAction(DWORD actionID, REPORTINFO *ri) { else { mir_free(variables_parsedup(dbv.ptszVal, ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?ri->td->tszText:NULL, ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL)); } - DBFreeVariant(&dbv); + db_free(&dbv); } } if (ri->flags&ACT_CLEANUP) { @@ -94,7 +94,7 @@ INT_PTR CALLBACK DlgProcOptsParseString(HWND hwndDlg, UINT msg, WPARAM wParam, L actionID = (DWORD)lParam; if (!DBGetActionSettingTString(actionID, NULL, MODULENAME, SETTING_PARSESTRING, &dbv)) { SetDlgItemText(hwndDlg, IDC_PARSESTRING, dbv.ptszVal); - DBFreeVariant(&dbv); + db_free(&dbv); } CheckDlgButton(hwndDlg, IDC_PARSEASYNC, DBGetActionSettingByte(actionID, NULL, MODULENAME, SETTING_PARSEASYNC, 0)?BST_CHECKED:BST_UNCHECKED); variables_skin_helpbutton(hwndDlg, IDC_SHOWHELP); diff --git a/plugins/Variables/src/condition_variables.cpp b/plugins/Variables/src/condition_variables.cpp index 4ebe86a05d..964e34bec7 100644 --- a/plugins/Variables/src/condition_variables.cpp +++ b/plugins/Variables/src/condition_variables.cpp @@ -40,7 +40,7 @@ int ParseStringCondition(DWORD conditionID, REPORTINFO *ri) { mir_free((TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0)); log_debugA("err: %d", fi.eCount); res = fi.eCount==0?CRV_TRUE:CRV_FALSE; - DBFreeVariant(&dbv); + db_free(&dbv); } } if (ri->flags&CND_CLEANUP) { @@ -68,7 +68,7 @@ INT_PTR CALLBACK DlgProcOptsCondition(HWND hwndDlg, UINT msg, WPARAM wParam, LPA conditionID = (DWORD)lParam; if (!DBGetConditionSettingTString(conditionID, NULL, MODULENAME, SETTING_PARSESTRING, &dbv)) { SetDlgItemText(hwndDlg, IDC_PARSESTRING, dbv.ptszVal); - DBFreeVariant(&dbv); + db_free(&dbv); } break; } diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index f83653836e..c281d02ed3 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -143,7 +143,7 @@ TCHAR* getContactInfoT(BYTE type, HANDLE hContact) case CCNF_STATUS: szStatus = (TCHAR*)CallService( MS_CLIST_GETSTATUSMODEDESCRIPTION, - (WPARAM)DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), + (WPARAM)db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), (LPARAM)GSMDF_UNICODE); if (szStatus == NULL) return NULL; @@ -152,7 +152,7 @@ TCHAR* getContactInfoT(BYTE type, HANDLE hContact) case CCNF_INTERNALIP: case CCNF_EXTERNALIP: { - DWORD ip = DBGetContactSettingDword(hContact, szProto, (type == CCNF_INTERNALIP) ? "RealIP" : "IP", 0); + DWORD ip = db_get_dw(hContact, szProto, (type == CCNF_INTERNALIP) ? "RealIP" : "IP", 0); if (ip == 0) return NULL; @@ -165,23 +165,23 @@ TCHAR* getContactInfoT(BYTE type, HANDLE hContact) } case CCNF_GROUP: - if (!DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) + if (!db_get_ts(hContact, "CList", "Group", &dbv)) { res = (TCHAR*)mir_wstrdup(dbv.pwszVal); - DBFreeVariant(&dbv); + db_free(&dbv); return res; } break; case CNF_UNIQUEID: //UID for ChatRoom - if (DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0) == 1) + if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1) { DBVARIANT dbv; - if (!DBGetContactSettingTString(hContact, szProto, "ChatRoomID", &dbv )) + if (!db_get_ts(hContact, szProto, "ChatRoomID", &dbv )) { res = mir_tstrdup( dbv.ptszVal ); - DBFreeVariant( &dbv ); + db_free( &dbv ); return res; } diff --git a/plugins/Variables/src/dbhelpers.h b/plugins/Variables/src/dbhelpers.h index c121d9c0a3..2315d2eab4 100644 --- a/plugins/Variables/src/dbhelpers.h +++ b/plugins/Variables/src/dbhelpers.h @@ -27,7 +27,7 @@ static int __inline DBWriteIthSettingByte(DWORD i, HANDLE hContact,const char *s char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting); - return DBWriteContactSettingByte(hContact, szModule, dbSetting, val); + return db_set_b(hContact, szModule, dbSetting, val); } static int __inline DBWriteIthSettingWord(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,WORD val) { @@ -35,7 +35,7 @@ static int __inline DBWriteIthSettingWord(DWORD i, HANDLE hContact,const char *s char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting); - return DBWriteContactSettingWord(hContact, szModule, dbSetting, val); + return db_set_w(hContact, szModule, dbSetting, val); } static int __inline DBWriteIthSettingDword(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val) { @@ -43,7 +43,7 @@ static int __inline DBWriteIthSettingDword(DWORD i, HANDLE hContact,const char * char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting); - return DBWriteContactSettingDword(hContact, szModule, dbSetting, val); + return db_set_dw(hContact, szModule, dbSetting, val); } static int __inline DBWriteIthSettingString(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,const char *val) { @@ -51,7 +51,7 @@ static int __inline DBWriteIthSettingString(DWORD i, HANDLE hContact,const char char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting); - return DBWriteContactSettingString(hContact, szModule, dbSetting, val); + return db_set_s(hContact, szModule, dbSetting, val); } static int __inline DBGetIthSettingByte(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) { @@ -60,7 +60,7 @@ static int __inline DBGetIthSettingByte(DWORD i, HANDLE hContact, const char *sz char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting); - return DBGetContactSettingByte(hContact, szModule, dbSetting, errorValue); + return db_get_b(hContact, szModule, dbSetting, errorValue); } static WORD __inline DBGetIthSettingWord(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) { @@ -69,7 +69,7 @@ static WORD __inline DBGetIthSettingWord(DWORD i, HANDLE hContact, const char *s char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting); - return DBGetContactSettingWord(hContact, szModule, dbSetting, errorValue); + return db_get_w(hContact, szModule, dbSetting, errorValue); } static DWORD __inline DBGetIthSettingDword(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) { @@ -78,7 +78,7 @@ static DWORD __inline DBGetIthSettingDword(DWORD i, HANDLE hContact, const char char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting); - return DBGetContactSettingDword(hContact, szModule, dbSetting, errorValue); + return db_get_dw(hContact, szModule, dbSetting, errorValue); } static int __inline DBGetIthSetting(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { @@ -87,7 +87,7 @@ static int __inline DBGetIthSetting(DWORD i, HANDLE hContact, const char *szModu char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting); - return DBGetContactSetting(hContact, szModule, dbSetting, dbv); + return db_get(hContact, szModule, dbSetting, dbv); } static int __inline DBDeleteIthSetting(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting) { @@ -95,19 +95,19 @@ static int __inline DBDeleteIthSetting(DWORD i, HANDLE hContact,const char *szMo char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting); - return DBDeleteContactSetting(hContact, szModule, dbSetting); + return db_unset(hContact, szModule, dbSetting); } -#define db_getb(a,b) DBGetContactSettingByte(NULL, MODULENAME, a, b) -#define db_getw(a,b) DBGetContactSettingWord(NULL, MODULENAME, a, b) -#define db_getd(a,b) DBGetContactSettingDword(NULL, MODULENAME, a, b) -#define db_gets(a,b) DBGetContactSetting(NULL, MODULENAME, a, b) -#define db_setb(a,b) DBWriteContactSettingByte(NULL, MODULENAME, a, (BYTE)(b)) -#define db_sets(a,b) DBWriteContactSettingString(NULL, MODULENAME, a, b) -#define db_setts(a,b) DBWriteContactSettingTString(NULL, MODULENAME, a, b) -#define db_setw(a,b) DBWriteContactSettingWord(NULL, MODULENAME, a, (WORD)(b)) -#define db_setd(a,b) DBWriteContactSettingDword(NULL, MODULENAME, a, (DWORD)(b)) -#define db_del(a) DBDeleteContactSetting(NULL, MODULENAME, a); +#define db_getb(a,b) db_get_b(NULL, MODULENAME, a, b) +#define db_getw(a,b) db_get_w(NULL, MODULENAME, a, b) +#define db_getd(a,b) db_get_dw(NULL, MODULENAME, a, b) +#define db_gets(a,b) db_get(NULL, MODULENAME, a, b) +#define db_setb(a,b) db_set_b(NULL, MODULENAME, a, (BYTE)(b)) +#define db_sets(a,b) db_set_s(NULL, MODULENAME, a, b) +#define db_setts(a,b) db_set_ts(NULL, MODULENAME, a, b) +#define db_setw(a,b) db_set_w(NULL, MODULENAME, a, (WORD)(b)) +#define db_setd(a,b) db_set_dw(NULL, MODULENAME, a, (DWORD)(b)) +#define db_del(a) db_unset(NULL, MODULENAME, a); #define dbi_getb(a,b,c) DBGetIthSettingByte(a, NULL, MODULENAME, b, c) #define dbi_getw(a,b,c) DBGetIthSettingWord(a, NULL, MODULENAME, b, c) diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index 5569ef522d..59476e1a77 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -102,7 +102,7 @@ void ResetCList(HWND hwndDlg) { int i; - if ((CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT)) || !(GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE)&CLS_USEGROUPS)) + if ((CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT)) || !(GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE)&CLS_USEGROUPS)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) FALSE, 0); else SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) TRUE, 0); diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp index e6d3577fb3..047ec195e9 100644 --- a/plugins/Variables/src/options.cpp +++ b/plugins/Variables/src/options.cpp @@ -26,9 +26,9 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA TranslateDialogDefault(hwndDlg); { DBVARIANT dbv; - if (!DBGetContactSettingTString( NULL, MODULENAME, SETTING_STARTUPTEXT, &dbv )) { + if (!db_get_ts( NULL, MODULENAME, SETTING_STARTUPTEXT, &dbv )) { SetDlgItemText(hwndDlg, IDC_FORMATTEXT, dbv.ptszVal); - DBFreeVariant(&dbv); + db_free(&dbv); } } CheckDlgButton(hwndDlg, IDC_PARSEATSTARTUP, db_get_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, 0)); diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 3a28fcde05..acd369ec6a 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -201,7 +201,7 @@ static TCHAR* getDBSetting(HANDLE hContact, char* module, char* setting, TCHAR* break; } - DBFreeVariant(&dbv); + db_free(&dbv); return var; } @@ -272,21 +272,21 @@ static TCHAR *parseLastSeenDate(ARGUMENTSINFO *ai) SYSTEMTIME lsTime = { 0 }; char *szModule = CEX_MODULE; - lsTime.wYear = DBGetContactSettingWord(hContact, szModule, "Year", 0); + lsTime.wYear = db_get_w(hContact, szModule, "Year", 0); if (lsTime.wYear == 0) szModule = SEEN_MODULE; - lsTime.wYear = DBGetContactSettingWord(hContact, szModule, "Year", 0); + lsTime.wYear = db_get_w(hContact, szModule, "Year", 0); if (lsTime.wYear == 0) return NULL; lsTime.wMilliseconds = 0; - lsTime.wSecond = DBGetContactSettingWord(hContact, szModule, "Seconds", 0); - lsTime.wMinute = DBGetContactSettingWord(hContact, szModule, "Minutes", 0); - lsTime.wHour = DBGetContactSettingWord(hContact, szModule, "Hours", 0); - lsTime.wDay = DBGetContactSettingWord(hContact, szModule, "Day", 0); - lsTime.wDayOfWeek = DBGetContactSettingWord(hContact, szModule, "WeekDay", 0); - lsTime.wMonth = DBGetContactSettingWord(hContact, szModule, "Month", 0); + lsTime.wSecond = db_get_w(hContact, szModule, "Seconds", 0); + lsTime.wMinute = db_get_w(hContact, szModule, "Minutes", 0); + lsTime.wHour = db_get_w(hContact, szModule, "Hours", 0); + lsTime.wDay = db_get_w(hContact, szModule, "Day", 0); + lsTime.wDayOfWeek = db_get_w(hContact, szModule, "WeekDay", 0); + lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0); int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0); TCHAR *res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR)); @@ -330,22 +330,22 @@ static TCHAR *parseLastSeenTime(ARGUMENTSINFO *ai) SYSTEMTIME lsTime = { 0 }; char *szModule = CEX_MODULE; - lsTime.wYear = DBGetContactSettingWord(hContact, szModule, "Year", 0); + lsTime.wYear = db_get_w(hContact, szModule, "Year", 0); if (lsTime.wYear == 0) szModule = SEEN_MODULE; - lsTime.wYear = DBGetContactSettingWord(hContact, szModule, "Year", 0); + lsTime.wYear = db_get_w(hContact, szModule, "Year", 0); if (lsTime.wYear == 0) return NULL; lsTime.wMilliseconds = 0; - lsTime.wSecond = DBGetContactSettingWord(hContact, szModule, "Seconds", 0); - lsTime.wMinute = DBGetContactSettingWord(hContact, szModule, "Minutes", 0); - lsTime.wHour = DBGetContactSettingWord(hContact, szModule, "Hours", 0); - lsTime.wDay = DBGetContactSettingWord(hContact, szModule, "Day", 0); - lsTime.wDayOfWeek = DBGetContactSettingWord(hContact, szModule, "WeekDay", 0); - lsTime.wMonth = DBGetContactSettingWord(hContact, szModule, "Month", 0); - lsTime.wYear = DBGetContactSettingWord(hContact, szModule, "Year", 0); + lsTime.wSecond = db_get_w(hContact, szModule, "Seconds", 0); + lsTime.wMinute = db_get_w(hContact, szModule, "Minutes", 0); + lsTime.wHour = db_get_w(hContact, szModule, "Hours", 0); + lsTime.wDay = db_get_w(hContact, szModule, "Day", 0); + lsTime.wDayOfWeek = db_get_w(hContact, szModule, "WeekDay", 0); + lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0); + lsTime.wYear = db_get_w(hContact, szModule, "Year", 0); int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0); TCHAR *res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR)); @@ -380,11 +380,11 @@ static TCHAR *parseLastSeenStatus(ARGUMENTSINFO *ai) return NULL; } char *szModule = CEX_MODULE; - int status = DBGetContactSettingWord(hContact, szModule, "Status", 0); + int status = db_get_w(hContact, szModule, "Status", 0); if (status == 0) szModule = SEEN_MODULE; - status = DBGetContactSettingWord(hContact, szModule, "Status", 0); + status = db_get_w(hContact, szModule, "Status", 0); if (status == 0) return NULL; diff --git a/plugins/Variables/src/trigger_variables.cpp b/plugins/Variables/src/trigger_variables.cpp index f00b02d969..75920eb453 100644 --- a/plugins/Variables/src/trigger_variables.cpp +++ b/plugins/Variables/src/trigger_variables.cpp @@ -49,7 +49,7 @@ static int addToCache(DWORD triggerID) return -1; tvcCount += 1; - DBFreeVariant(&dbv); + db_free(&dbv); return 0; } @@ -106,7 +106,7 @@ static VOID CALLBACK checkStringsTimer(HWND hwnd,UINT message,UINT_PTR idEvent,D CallService(MS_TRIGGER_REPORTEVENT, 0, (LPARAM)&ri); mir_free(tvc[i].parsedText); tvc[i].parsedText = parsedText; - DBFreeVariant(&dbv); + db_free(&dbv); } } } @@ -125,7 +125,7 @@ INT_PTR CALLBACK DlgProcOptsStringChange(HWND hwndDlg, UINT msg, WPARAM wParam, triggerID = (DWORD)lParam; if (!DBGetTriggerSetting(triggerID, NULL, MODULENAME, SETTING_TRIGGERTEXT, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_FORMATTEXT, dbv.pszVal); - DBFreeVariant(&dbv); + db_free(&dbv); } variables_skin_helpbutton(hwndDlg, IDC_SHOWHELP); } -- cgit v1.2.3