diff options
Diffstat (limited to 'plugins/CommonLibs')
-rw-r--r-- | plugins/CommonLibs/CString.cpp | 6 | ||||
-rw-r--r-- | plugins/CommonLibs/CString.h | 8 | ||||
-rw-r--r-- | plugins/CommonLibs/Options.cpp | 42 | ||||
-rw-r--r-- | plugins/CommonLibs/Options.h | 2 |
4 files changed, 27 insertions, 31 deletions
diff --git a/plugins/CommonLibs/CString.cpp b/plugins/CommonLibs/CString.cpp index fb8760dc74..fde5e4dc2a 100644 --- a/plugins/CommonLibs/CString.cpp +++ b/plugins/CommonLibs/CString.cpp @@ -286,7 +286,7 @@ template class TString<char>; template class TString<WCHAR>;
-CString DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, const char *szDefaultValue)
+CString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const char *szDefaultValue)
{
DBVARIANT dbv = {0};
DBCONTACTGETSETTING dbcgs;
@@ -311,7 +311,7 @@ CString DBGetContactSettingString(HANDLE hContact, const char *szModule, const c -TCString DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue)
+TCString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue)
{
DBVARIANT dbv = {0};
DBCONTACTGETSETTING dbcgs;
@@ -337,7 +337,7 @@ TCString DBGetContactSettingString(HANDLE hContact, const char *szModule, const -int DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
+int db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
{
return db_get_s(hContact, szModule, szSetting, dbv, DBVT_ASCIIZ);
}
diff --git a/plugins/CommonLibs/CString.h b/plugins/CommonLibs/CString.h index fb956f6e4e..c9a4a9538e 100644 --- a/plugins/CommonLibs/CString.h +++ b/plugins/CommonLibs/CString.h @@ -231,10 +231,10 @@ __inline CHARARRAY WCHAR2UTF8(WCString Str) #endif // CHARARRAY_CONVERT
-#undef DBGetContactSettingString
-CString DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, const char *szDefaultValue);
-TCString DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue);
-int DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
+#undef db_get_s
+CString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const char *szDefaultValue);
+TCString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue);
+int db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
TCString DBGetContactSettingAsString(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue); // also converts numeric values to a string
// various string helpers. their return values are valid only while the class is visible
diff --git a/plugins/CommonLibs/Options.cpp b/plugins/CommonLibs/Options.cpp index 4583cae0b5..36226b0f11 100644 --- a/plugins/CommonLibs/Options.cpp +++ b/plugins/CommonLibs/Options.cpp @@ -182,7 +182,7 @@ void COptItem::SetIntDBVal(CString &sModule, int Value, CString *sDBSettingPrefi cws.value.type = nValueSize;
cws.value.dVal = Value;
-// DBWriteContactSettingByte(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, Value[I].Flags);
+// db_set_b(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, Value[I].Flags);
//itoa(Value[I].ID, StrID.GetBuffer(64), 10);
//StrID.ReleaseBuffer();
@@ -197,7 +197,7 @@ TCString COptItem::GetStrDBVal(CString &sModule, CString *sDBSettingPrefix) if (sDBSetting != NULL)
{
_ASSERT(GetDefValue());
- return DBGetContactSettingString(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, *(TCString*)GetDefValue());
+ return db_get_s(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, *(TCString*)GetDefValue());
}
return *(TCString*)GetDefValue();
}
@@ -206,7 +206,7 @@ void COptItem::SetStrDBVal(CString &sModule, TCString &Str, CString *sDBSettingP {
if (sDBSetting != NULL && !ReadOnly)
{
- DBWriteContactSettingTString(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str);
+ db_set_ts(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str);
}
}
@@ -355,11 +355,11 @@ int TreeReadEnum(const char *szSetting, LPARAM lParam) if (!strncmp(szSetting, TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_TITLE, Len) && isdigit(szSetting[Len]))
{
int ID = atol(szSetting + Len);
- short ParentID = (TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : DBGetContactSettingWord(NULL, *TreeReadEnumData->sModule,
+ short ParentID = (TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(NULL, *TreeReadEnumData->sModule,
*TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_PARENT + (szSetting + Len), -1);
- short Order = DBGetContactSettingWord(NULL, *TreeReadEnumData->sModule,
+ short Order = db_get_w(NULL, *TreeReadEnumData->sModule,
*TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_ORDER + (szSetting + Len), -1);
- char Flags = (TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : DBGetContactSettingByte(NULL, *TreeReadEnumData->sModule,
+ char Flags = (TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : db_get_b(NULL, *TreeReadEnumData->sModule,
*TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_FLAGS + (szSetting + Len), 0);
if (ParentID >= 0 && Order >= 0)
{
@@ -367,9 +367,9 @@ int TreeReadEnum(const char *szSetting, LPARAM lParam) TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).ParentID = ParentID;
TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).Flags = Flags;
TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).hItem = NULL;
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).Title = DBGetContactSettingString(NULL, *TreeReadEnumData->sModule, *TreeReadEnumData->sDBSettingPrefix + szSetting, _T(""));
+ TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).Title = db_get_s(NULL, *TreeReadEnumData->sModule, *TreeReadEnumData->sDBSettingPrefix + szSetting, _T(""));
TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).User_Str1 = (TreeReadEnumData->TreeCtrl->User_Str1_DBName == NULL) ? NULL :
- DBGetContactSettingString(NULL, *TreeReadEnumData->sModule,
+ db_get_s(NULL, *TreeReadEnumData->sModule,
*TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TreeReadEnumData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (TCHAR*)NULL);
}
}
@@ -426,20 +426,16 @@ void COptItem_TreeCtrl::MemToDB(CString &sModule, CString *sDBSettingPrefix) CString StrID;
_itoa(Value[I].ID, StrID.GetBuffer(64), 10);
StrID.ReleaseBuffer();
- DBWriteContactSettingTString(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_TITLE + StrID, Value[I].Title);
+ db_set_ts(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_TITLE + StrID, Value[I].Title);
if (!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL))
- {
- DBWriteContactSettingWord(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_PARENT + StrID, Value[I].ParentID);
- }
- DBWriteContactSettingWord(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_ORDER + StrID, I);
+ db_set_w(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_PARENT + StrID, Value[I].ParentID);
+
+ db_set_w(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_ORDER + StrID, I);
if (!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) || TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)
- {
- DBWriteContactSettingByte(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, Value[I].Flags);
- }
+ db_set_b(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, Value[I].Flags);
+
if (User_Str1_DBName != NULL && Value[I].User_Str1 != NULL)
- {
- DBWriteContactSettingTString(NULL, sModule, *sDBSettingPrefix + sDBSetting + User_Str1_DBName + StrID, Value[I].User_Str1);
- }
+ db_set_ts(NULL, sModule, *sDBSettingPrefix + sDBSetting + User_Str1_DBName + StrID, Value[I].User_Str1);
}
COptItem::MemToDB(sModule, sDBSettingPrefix);
}
@@ -614,7 +610,7 @@ void COptItem_TreeCtrl::CleanDBSettings(CString &sModule, CString *sDBSettingPre int I;
for (I = 0; I < TreeDeleteEnumData.TreeSettings.GetSize(); I++)
{
- DBDeleteContactSetting(NULL, sModule, TreeDeleteEnumData.TreeSettings[I]);
+ db_unset(NULL, sModule, TreeDeleteEnumData.TreeSettings[I]);
}
}
@@ -809,7 +805,7 @@ int ListReadEnum(const char *szSetting, LPARAM lParam) if (!strncmp(szSetting, *ListReadEnumData->sDBSettingPrefix + ListReadEnumData->ListCtrl->sDBSetting + LISTITEM_DBSTR_TEXT, Len) && isdigit(szSetting[Len]))
{
int ID = atol(szSetting + Len);
- ListReadEnumData->ListCtrl->Value.SetAtGrow(ID).Text = DBGetContactSettingString(NULL, *ListReadEnumData->sModule, *ListReadEnumData->sDBSettingPrefix + szSetting, _T(""));
+ ListReadEnumData->ListCtrl->Value.SetAtGrow(ID).Text = db_get_s(NULL, *ListReadEnumData->sModule, *ListReadEnumData->sDBSettingPrefix + szSetting, _T(""));
}
return 0;
}
@@ -864,7 +860,7 @@ void COptItem_ListCtrl::MemToDB(CString &sModule, CString *sDBSettingPrefix) CString StrID;
_itoa(I, StrID.GetBuffer(64), 10);
StrID.ReleaseBuffer();
- DBWriteContactSettingTString(NULL, sModule, *sDBSettingPrefix + sDBSetting + LISTITEM_DBSTR_TEXT + StrID, Value[I].Text);
+ db_set_ts(NULL, sModule, *sDBSettingPrefix + sDBSetting + LISTITEM_DBSTR_TEXT + StrID, Value[I].Text);
}
COptItem::MemToDB(sModule, sDBSettingPrefix);
}
@@ -927,7 +923,7 @@ void COptItem_ListCtrl::CleanDBSettings(CString &sModule, CString *sDBSettingPre int I;
for (I = 0; I < ListDeleteEnumData.ListSettings.GetSize(); I++)
{
- DBDeleteContactSetting(NULL, sModule, ListDeleteEnumData.ListSettings[I]);
+ db_unset(NULL, sModule, ListDeleteEnumData.ListSettings[I]);
}
}
diff --git a/plugins/CommonLibs/Options.h b/plugins/CommonLibs/Options.h index 1b3bb0a284..666162c50a 100644 --- a/plugins/CommonLibs/Options.h +++ b/plugins/CommonLibs/Options.h @@ -43,7 +43,7 @@ public: virtual void MemToWnd(HWND hWnd) {EnableWindow(GetDlgItem(hWnd, DlgItemID), Enabled);}
void DBToMemToWnd(CString &sModule, HWND hWnd, CString *sDBSettingPrefix = NULL) {DBToMem(sModule, sDBSettingPrefix); MemToWnd(hWnd);}
void WndToMemToDB(HWND hWnd, CString &sModule, CString *sDBSettingPrefix = NULL) {WndToMem(hWnd); MemToDB(sModule, sDBSettingPrefix);}
- virtual void CleanDBSettings(CString &sModule, CString *sDBSettingPrefix = NULL) {DBDeleteContactSetting(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting);}; // TODO: also set Value to DefValue?
+ virtual void CleanDBSettings(CString &sModule, CString *sDBSettingPrefix = NULL) {db_unset(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting);}; // TODO: also set Value to DefValue?
virtual void SetValue(int Value) {Modified = true;}
virtual void SetDefValue(int DefValue) {}
|