diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-05 22:27:16 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-05 22:27:16 +0000 |
commit | 007b4c7301f0d26a72f89f74e9929f42e24eb3e6 (patch) | |
tree | b1ee30b70c6e36d1a06aed6885cb80dc560a68ca | |
parent | f4a1bbc6ba4b8137cb868639ac146aa97e97e9df (diff) |
- 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
614 files changed, 7004 insertions, 7481 deletions
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index beff99167f..7cee95c5ff 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -248,7 +248,7 @@ static void NotifyMetaAware(HANDLE hContact, struct CacheNode *node = NULL, AVAT char *szProto = GetContactProto(hContact);
if (szProto != NULL) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingString(hContact, szProto, "AvatarHash", &dbv)) {
+ if ( !db_get_s(hContact, szProto, "AvatarHash", &dbv)) {
if (dbv.type == DBVT_TCHAR) {
_tcsncpy(cacn.hash, dbv.ptszVal, SIZEOF(cacn.hash));
} else if (dbv.type == DBVT_BLOB) {
@@ -372,7 +372,7 @@ void MakePathRelative(HANDLE hContact, TCHAR *path) static void MakePathRelative(HANDLE hContact)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(hContact, "ContactPhoto", "File", &dbv)) {
+ if ( !db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
MakePathRelative(hContact, dbv.ptszVal);
db_free(&dbv);
}
@@ -390,10 +390,10 @@ static TCHAR *getJGMailID(char *szProto) static TCHAR szJID[MAX_PATH+1]; szJID[0] = '\0';
DBVARIANT dbva, dbvb;
- if ( DBGetContactSettingTString(NULL, szProto, "LoginName", &dbva))
+ if ( db_get_ts(NULL, szProto, "LoginName", &dbva))
return szJID;
- if ( DBGetContactSettingTString(NULL, szProto, "LoginServer", &dbvb)) {
+ if ( db_get_ts(NULL, szProto, "LoginServer", &dbvb)) {
db_free(&dbva);
return szJID;
}
@@ -430,15 +430,15 @@ int CreateAvatarInCache(HANDLE hContact, avatarCacheEntry *ace, char *szProto) }
if (db_get_b(hContact, "ContactPhoto", "Locked", 0)
- && !DBGetContactSettingTString(hContact, "ContactPhoto", "Backup", &dbv)) {
+ && !db_get_ts(hContact, "ContactPhoto", "Backup", &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, tszFilename);
db_free(&dbv);
}
- else if ( !DBGetContactSettingTString(hContact, "ContactPhoto", "RFile", &dbv)) {
+ else if ( !db_get_ts(hContact, "ContactPhoto", "RFile", &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, tszFilename);
db_free(&dbv);
}
- else if ( !DBGetContactSettingTString(hContact, "ContactPhoto", "File", &dbv)) {
+ else if ( !db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, tszFilename);
db_free(&dbv);
}
@@ -448,13 +448,13 @@ int CreateAvatarInCache(HANDLE hContact, avatarCacheEntry *ace, char *szProto) }
else {
if (hContact == 0) { // create a protocol picture in the proto picture cache
- if ( !DBGetContactSettingTString(NULL, PPICT_MODULE, szProto, &dbv)) {
+ if ( !db_get_ts(NULL, PPICT_MODULE, szProto, &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, tszFilename);
db_free(&dbv);
}
else {
if (lstrcmpA(szProto, AVS_DEFAULT)) {
- if ( !DBGetContactSettingTString(NULL, PPICT_MODULE, AVS_DEFAULT, &dbv)) {
+ if ( !db_get_ts(NULL, PPICT_MODULE, AVS_DEFAULT, &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, tszFilename);
db_free(&dbv);
}
@@ -465,7 +465,7 @@ int CreateAvatarInCache(HANDLE hContact, avatarCacheEntry *ace, char *szProto) return -1;
char key[MAX_PATH];
mir_snprintf(key, SIZEOF(key), "Global avatar for %s accounts", pdescr->szProtoName);
- if ( !DBGetContactSettingTString(NULL, PPICT_MODULE, key, &dbv)) {
+ if ( !db_get_ts(NULL, PPICT_MODULE, key, &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, tszFilename);
db_free(&dbv);
}
@@ -477,7 +477,7 @@ int CreateAvatarInCache(HANDLE hContact, avatarCacheEntry *ace, char *szProto) // startup and everytime they are changed.
if (szProto[0] == '\0') {
// Global avatar
- if ( DBGetContactSettingTString(NULL, AVS_MODULE, "GlobalUserAvatarFile", &dbv))
+ if ( db_get_ts(NULL, AVS_MODULE, "GlobalUserAvatarFile", &dbv))
return -10;
AVS_pathToAbsolute(dbv.ptszVal, tszFilename);
@@ -494,7 +494,7 @@ int CreateAvatarInCache(HANDLE hContact, avatarCacheEntry *ace, char *szProto) else
MultiByteToWideChar( CP_ACP, 0, szFileName, -1, tszFilename, SIZEOF(tszFilename));
}
- else if ( !DBGetContactSettingTString(NULL, szProto, "AvatarFile", &dbv)) {
+ else if ( !db_get_ts(NULL, szProto, "AvatarFile", &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, tszFilename);
db_free(&dbv);
}
@@ -546,7 +546,7 @@ int CreateAvatarInCache(HANDLE hContact, avatarCacheEntry *ace, char *szProto) if (imgHash != db_get_dw(hContact, "ContactPhoto", "ImageHash", 0))
{
ResetTranspSettings(hContact);
- DBWriteContactSettingDword(hContact, "ContactPhoto", "ImageHash", imgHash);
+ db_set_dw(hContact, "ContactPhoto", "ImageHash", imgHash);
}
// Make transparent?
@@ -1095,7 +1095,7 @@ static void FilterGetStrings(TCHAR *filter, int bytesLeft, BOOL xml, BOOL swf) static void DeleteGlobalUserAvatar()
{
DBVARIANT dbv = {0};
- if (DBGetContactSettingTString(NULL, AVS_MODULE, "GlobalUserAvatarFile", &dbv))
+ if (db_get_ts(NULL, AVS_MODULE, "GlobalUserAvatarFile", &dbv))
return;
TCHAR szFilename[MAX_PATH];
@@ -1135,7 +1135,7 @@ static int InternalRemoveMyAvatar(char *protocol) {
// Has global avatar?
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(NULL, AVS_MODULE, "GlobalUserAvatarFile", &dbv)) {
+ if ( !db_get_ts(NULL, AVS_MODULE, "GlobalUserAvatarFile", &dbv)) {
db_free(&dbv);
db_set_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1);
DeleteGlobalUserAvatar();
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index b720b900fc..46908870fa 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -400,7 +400,7 @@ INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wParam, LPA g_selectedProto = GetProtoFromList(hwndDlg, iItem);
if ( g_selectedProto ) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, PPICT_MODULE, g_selectedProto, &dbv)) {
+ if ( !db_get_ts(NULL, PPICT_MODULE, g_selectedProto, &dbv)) {
if ( !AVS_pathIsAbsolute(dbv.ptszVal)) {
TCHAR szFinalPath[MAX_PATH];
mir_sntprintf(szFinalPath, SIZEOF(szFinalPath), _T("%%miranda_path%%\\%s"), dbv.ptszVal);
@@ -616,7 +616,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA ProtectAvatar((WPARAM)hContact, 0);
if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
- if ( !DBGetContactSettingTString(hContact, "ContactPhoto", "File", &dbv)) {
+ if ( !db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
DeleteFile(dbv.ptszVal);
db_free(&dbv);
}
@@ -641,7 +641,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA DBVARIANT dbv = {0};
ProtectAvatar((WPARAM)hContact, 0);
if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
- if ( !DBGetContactSettingTString(hContact, "ContactPhoto", "File", &dbv)) {
+ if ( !db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
DeleteFile(dbv.ptszVal);
db_free(&dbv);
}
@@ -708,15 +708,15 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA szFinalName[0] = 0;
- if (is_locked && !DBGetContactSettingTString(hContact, "ContactPhoto", "Backup", &dbv)) {
+ if (is_locked && !db_get_ts(hContact, "ContactPhoto", "Backup", &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, szFinalName);
db_free(&dbv);
}
- else if ( !DBGetContactSettingTString(hContact, "ContactPhoto", "RFile", &dbv)) {
+ else if ( !db_get_ts(hContact, "ContactPhoto", "RFile", &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, szFinalName);
db_free(&dbv);
}
- else if ( !DBGetContactSettingTString(hContact, "ContactPhoto", "File", &dbv)) {
+ else if ( !db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
AVS_pathToAbsolute(dbv.ptszVal, szFinalName);
db_free(&dbv);
}
@@ -847,7 +847,7 @@ INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wParam, LP ProtectAvatar((WPARAM)hContact, 0);
if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
- if ( !DBGetContactSettingTString(hContact, "ContactPhoto", "File", &dbv)) {
+ if ( !db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
DeleteFile(dbv.ptszVal);
db_free(&dbv);
}
@@ -870,7 +870,7 @@ INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wParam, LP ProtectAvatar((WPARAM)hContact, 0);
if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
- if ( !DBGetContactSettingTString(hContact, "ContactPhoto", "File", &dbv)) {
+ if ( !db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
DeleteFile(dbv.ptszVal);
db_free(&dbv);
}
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index 814e5658ef..15de673f7d 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -203,10 +203,10 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp DBVARIANT dbv;
char idstr[4];
_itoa(groupId, idstr, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv)) break;
+ if (db_get_ts(NULL, "CListGroups", idstr, &dbv)) break;
int id = SendDlgItemMessage(hdlg, IDC_GROUP, CB_ADDSTRING, 0, (LPARAM)(dbv.ptszVal + 1));
SendDlgItemMessage(hdlg, IDC_GROUP, CB_SETITEMDATA, (WPARAM)id, (LPARAM)groupId + 1);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
SendDlgItemMessage(hdlg, IDC_GROUP, CB_INSERTSTRING, 0, (LPARAM)TranslateT("None"));
@@ -214,10 +214,10 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp {
DBVARIANT dbv = {0};
- if(!DBGetContactSettingString(NULL,"AddContact","LastProto",&dbv))
+ if(!db_get_s(NULL,"AddContact","LastProto",&dbv))
{
acs->szProto = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
if(AddContactDlgAccounts(hdlg, acs))
@@ -348,7 +348,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp TCHAR szHandle[256];
if (GetDlgItemText(hdlg, IDC_MYHANDLE, szHandle, SIZEOF(szHandle)))
- DBWriteContactSettingTString(hContact, "CList", "MyHandle", szHandle);
+ db_set_ts(hContact, "CList", "MyHandle", szHandle);
int item = SendDlgItemMessage(hdlg, IDC_GROUP, CB_GETCURSEL, 0, 0);
if (item > 0)
@@ -359,7 +359,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp if (!IsDlgButtonChecked(hdlg, IDC_ADDTEMP))
{
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
if (IsDlgButtonChecked(hdlg, IDC_ADDED))
CallContactService(hContact, PSS_ADDED, 0, 0);
@@ -420,7 +420,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp if (acs)
{
if(acs->szProto)
- DBWriteContactSettingString(NULL,"AddContact","LastProto",acs->szProto);
+ db_set_s(NULL,"AddContact","LastProto",acs->szProto);
if (acs->psr)
{
mir_free(acs->psr->nick);
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 1e550be85d..15956ca62d 100644 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -192,12 +192,12 @@ void LoadAlarms() { memset(&alarm, 0, sizeof(ALARM));
sprintf(buff, "Title%d", i);
- if (!DBGetContactSettingTString(0, MODULE, buff, &dbv)) {
+ if (!db_get_ts(0, MODULE, buff, &dbv)) {
alarm.szTitle = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
sprintf(buff, "Desc%d", i);
- if (!DBGetContactSettingTString(0, MODULE, buff, &dbv)) {
+ if (!db_get_ts(0, MODULE, buff, &dbv)) {
alarm.szDesc = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -249,11 +249,11 @@ void LoadAlarms() { alarm.action = (unsigned short)db_get_dw(0, MODULE, buff, AAF_POPUP | AAF_SOUND);
if (alarm.action & AAF_COMMAND) {
sprintf(buff, "ActionCommand%d", i);
- if (!DBGetContactSettingTString(0, MODULE, buff, &dbv)) {
+ if (!db_get_ts(0, MODULE, buff, &dbv)) {
alarm.szCommand = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
sprintf(buff, "ActionParams%d", i);
- if (!DBGetContactSettingTString(0, MODULE, buff, &dbv)) {
+ if (!db_get_ts(0, MODULE, buff, &dbv)) {
alarm.szCommandParams = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -308,14 +308,14 @@ void SaveAlarms() { sprintf(buff, "Desc%d", index);
db_set_ts(0, MODULE, buff, i->szDesc);
sprintf(buff, "Occ%d", index);
- DBWriteContactSettingWord(0, MODULE, buff, i->occurrence);
+ db_set_w(0, MODULE, buff, i->occurrence);
sprintf(buff, "STHour%d", index);
- DBWriteContactSettingWord(0, MODULE, buff, i->time.wHour);
+ db_set_w(0, MODULE, buff, i->time.wHour);
sprintf(buff, "STMinute%d", index);
- DBWriteContactSettingWord(0, MODULE, buff, i->time.wMinute);
+ db_set_w(0, MODULE, buff, i->time.wMinute);
sprintf(buff, "STSecond%d", index);
- DBWriteContactSettingWord(0, MODULE, buff, i->time.wSecond);
+ db_set_w(0, MODULE, buff, i->time.wSecond);
switch(i->occurrence) {
case OC_DAILY:
@@ -324,22 +324,22 @@ void SaveAlarms() { break;
case OC_WEEKLY:
sprintf(buff, "STDayOfWeek%d", index);
- DBWriteContactSettingWord(0, MODULE, buff, i->time.wDayOfWeek);
+ db_set_w(0, MODULE, buff, i->time.wDayOfWeek);
break;
case OC_ONCE:
sprintf(buff, "STYear%d", index);
- DBWriteContactSettingWord(0, MODULE, buff, i->time.wYear);
+ db_set_w(0, MODULE, buff, i->time.wYear);
case OC_YEARLY:
sprintf(buff, "STMonth%d", index);
- DBWriteContactSettingWord(0, MODULE, buff, i->time.wMonth);
+ db_set_w(0, MODULE, buff, i->time.wMonth);
case OC_MONTHLY:
sprintf(buff, "STDay%d", index);
- DBWriteContactSettingWord(0, MODULE, buff, i->time.wDay);
+ db_set_w(0, MODULE, buff, i->time.wDay);
break;
}
sprintf(buff, "ActionFlags%d", index);
- DBWriteContactSettingDword(0, MODULE, buff, i->action);
+ db_set_dw(0, MODULE, buff, i->action);
if (i->action & AAF_COMMAND) {
if (_tcslen(i->szCommand)) {
sprintf(buff, "ActionCommand%d", index);
@@ -358,12 +358,12 @@ void SaveAlarms() { db_set_b(0, MODULE, buff, i->snoozer ? 1 : 0);
sprintf(buff, "Flags%d", index);
- DBWriteContactSettingDword(0, MODULE, buff, i->flags);
+ db_set_dw(0, MODULE, buff, i->flags);
sprintf(buff, "TriggerID%d", index);
- DBWriteContactSettingDword(0, MODULE, buff, i->trigger_id);
+ db_set_dw(0, MODULE, buff, i->trigger_id);
}
- DBWriteContactSettingWord(0, MODULE, "Count", index);
+ db_set_w(0, MODULE, "Count", index);
LeaveCriticalSection(&alarm_cs);
}
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index 3a263d4188..39c4713838 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -1176,9 +1176,9 @@ void LoadOptions() void SaveOptions()
{
db_set_b(0, MODULE, "UsePopupModule", options.use_popup_module ? 1 : 0);
- DBWriteContactSettingDword(0, MODULE, "SnoozeMinutes", options.snooze_minutes);
- DBWriteContactSettingDword(0, MODULE, "RowHeight", options.row_height);
- DBWriteContactSettingDword(0, MODULE, "Indent", options.indent);
+ db_set_dw(0, MODULE, "SnoozeMinutes", options.snooze_minutes);
+ db_set_dw(0, MODULE, "RowHeight", options.row_height);
+ db_set_dw(0, MODULE, "Indent", options.indent);
db_set_b(0, MODULE, "Transparency", options.aw_trans);
db_set_b(0, MODULE, "RoundCorners", options.aw_roundcorners ? 1 : 0);
db_set_b(0, MODULE, "DontStealFocus", options.aw_dontstealfocus ? 1 : 0);
@@ -1186,7 +1186,7 @@ void SaveOptions() db_set_b(0, MODULE, "HideWithClist", options.hide_with_clist ? 1 : 0);
db_set_b(0, MODULE, "LoopSound", options.loop_sound ? 1 : 0);
db_set_b(0, MODULE, "AutoSize", options.auto_size_vert ? 1 : 0);
- DBWriteContactSettingDword(0, MODULE, "ReminderPeriod", options.reminder_period);
+ db_set_dw(0, MODULE, "ReminderPeriod", options.reminder_period);
}
INT_PTR NewAlarmMenuFunc(WPARAM wParam, LPARAM lParam)
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index cc2a58828a..4124b493f4 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -51,7 +51,7 @@ static BOOL IsAssocEnabled(const ASSOCDATA *assoc) {
char szSetting[MAXMODULELABELLENGTH];
mir_snprintf(szSetting, sizeof(szSetting), "enabled_%s", assoc->pszClassName);
- return DBGetContactSettingByte(NULL, "AssocMgr", szSetting, (BYTE)!(assoc->flags&FTDF_DEFAULTDISABLED))!= 0;
+ return db_get_b(NULL, "AssocMgr", szSetting, (BYTE)!(assoc->flags&FTDF_DEFAULTDISABLED))!= 0;
}
static void SetAssocEnabled(const ASSOCDATA *assoc, BOOL fEnabled)
@@ -59,13 +59,13 @@ static void SetAssocEnabled(const ASSOCDATA *assoc, BOOL fEnabled) char szSetting[MAXMODULELABELLENGTH];
TCHAR szDLL[MAX_PATH], szBuf[MAX_PATH];
mir_snprintf(szSetting, sizeof(szSetting), "enabled_%s", assoc->pszClassName);
- DBWriteContactSettingByte(NULL, "AssocMgr", szSetting, (BYTE)fEnabled);
+ db_set_b(NULL, "AssocMgr", szSetting, (BYTE)fEnabled);
/* dll name for uninstall */
if(assoc->hInstance!= NULL && assoc->hInstance!= hInst && assoc->hInstance!= GetModuleHandle(NULL))
if( GetModuleFileName(assoc->hInstance, szBuf, SIZEOF(szBuf)))
if( PathToRelativeT(szBuf, szDLL)) {
mir_snprintf(szSetting, sizeof(szSetting), "module_%s", assoc->pszClassName);
- DBWriteContactSettingTString(NULL, "AssocMgr", szSetting, szDLL);
+ db_set_ts(NULL, "AssocMgr", szSetting, szDLL);
}
}
@@ -73,10 +73,10 @@ static void DeleteAssocEnabledSetting(const ASSOCDATA *assoc) {
char szSetting[MAXMODULELABELLENGTH];
mir_snprintf(szSetting, sizeof(szSetting), "enabled_%s", assoc->pszClassName);
- DBDeleteContactSetting(NULL, "AssocMgr", szSetting);
+ db_unset(NULL, "AssocMgr", szSetting);
/* dll name for uninstall */
mir_snprintf(szSetting, sizeof(szSetting), "module_%s", assoc->pszClassName);
- DBDeleteContactSetting(NULL, "AssocMgr", szSetting);
+ db_unset(NULL, "AssocMgr", szSetting);
}
void CleanupAssocEnabledSettings(void)
@@ -95,13 +95,13 @@ void CleanupAssocEnabledSettings(void) for(i = 0;i<nSettingsCount;++i) {
pszSuffix = &ppszSettings[i][8];
mir_snprintf(szSetting, sizeof(szSetting), "module_%s", pszSuffix);
- if (!DBGetContactSettingTString(NULL, "AssocMgr", szSetting, &dbv)) {
+ if (!db_get_ts(NULL, "AssocMgr", szSetting, &dbv)) {
if( PathToAbsoluteT(dbv.ptszVal, szDLL)) {
/* file still exists? */
hFile = CreateFile(szDLL, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if(hFile == INVALID_HANDLE_VALUE) {
- DBDeleteContactSetting(NULL, "AssocMgr", ppszSettings[i]);
- DBDeleteContactSetting(NULL, "AssocMgr", szSetting);
+ db_unset(NULL, "AssocMgr", ppszSettings[i]);
+ db_unset(NULL, "AssocMgr", szSetting);
} else CloseHandle(hFile);
}
mir_free(dbv.ptszVal);
@@ -119,8 +119,8 @@ static __inline void RememberMimeTypeAdded(const char *pszMimeType, const char * {
char szSetting[MAXMODULELABELLENGTH];
mir_snprintf(szSetting, sizeof(szSetting), "mime_%s", pszMimeType);
- if(fAdded) DBWriteContactSettingString(NULL, "AssocMgr", szSetting, pszFileExt);
- else DBDeleteContactSetting(NULL, "AssocMgr", szSetting);
+ if(fAdded) db_set_s(NULL, "AssocMgr", szSetting, pszFileExt);
+ else db_unset(NULL, "AssocMgr", szSetting);
}
static __inline BOOL WasMimeTypeAdded(const char *pszMimeType)
@@ -129,8 +129,8 @@ static __inline BOOL WasMimeTypeAdded(const char *pszMimeType) DBVARIANT dbv;
BOOL fAdded = FALSE;
mir_snprintf(szSetting, sizeof(szSetting), "mime_%s", pszMimeType);
- if (!DBGetContactSetting(NULL, "AssocMgr", szSetting, &dbv)) fAdded = TRUE;
- else DBFreeVariant(&dbv);
+ if (!db_get(NULL, "AssocMgr", szSetting, &dbv)) fAdded = TRUE;
+ else db_free(&dbv);
return fAdded;
}
@@ -150,12 +150,12 @@ void CleanupMimeTypeAddedSettings(void) if (!lstrcmpA(pszSuffix, pAssocList[j].pszMimeType))
break; /* mime type in current list */
if(j == nAssocListCount) { /* mime type not in current list */
- if (!DBGetContactSetting(NULL, "AssocMgr", ppszSettings[i], &dbv)) {
+ if (!db_get(NULL, "AssocMgr", ppszSettings[i], &dbv)) {
if(dbv.type == DBVT_ASCIIZ)
RemoveRegMimeType(pszSuffix, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- DBDeleteContactSetting(NULL, "AssocMgr", ppszSettings[i]);
+ db_unset(NULL, "AssocMgr", ppszSettings[i]);
}
mir_free(ppszSettings[i]);
}
@@ -769,7 +769,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara ListView_SetItemState(hwndList, lvi.iItem, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE_USEHEADER); /* size to fit window */
/* only while running */
- CheckDlgButton(hwndDlg, IDC_ONLYWHILERUNNING, (BOOL)DBGetContactSettingByte(NULL, "AssocMgr", "OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT));
+ CheckDlgButton(hwndDlg, IDC_ONLYWHILERUNNING, (BOOL)db_get_b(NULL, "AssocMgr", "OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT));
/* autostart */
{ TCHAR *pszRunCmd;
pszRunCmd = MakeRunCommand(TRUE, TRUE);
@@ -915,7 +915,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara ASSOCDATA *assoc;
/* only while running */
- DBWriteContactSettingByte(NULL, "AssocMgr", "OnlyWhileRunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONLYWHILERUNNING)!= 0));
+ db_set_b(NULL, "AssocMgr", "OnlyWhileRunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONLYWHILERUNNING)!= 0));
/* save enabled assoc items */
hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
@@ -1063,7 +1063,7 @@ void UninitAssocList(void) DestroyServiceFunction(hServiceRemoveUrl);
/* Assoc List */
- fOnlyWhileRunning = DBGetContactSettingByte(NULL, "AssocMgr", "OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT);
+ fOnlyWhileRunning = db_get_b(NULL, "AssocMgr", "OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT);
for(i = 0;i<nAssocListCount;++i) {
assoc = &pAssocList[i];
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index 41e724025d..a34b02918a 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -509,7 +509,7 @@ static LONG RestoreRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPref mir_free(pData);
} else res=ERROR_INVALID_DATA;
if (res) break;
- DBDeleteContactSetting(NULL,"AssocMgr",ppszSettings[i]);
+ db_unset(NULL,"AssocMgr",ppszSettings[i]);
if (hSubKey!=hKey) RegCloseKey(hSubKey);
}
mir_free(ppszSettings[i]);
@@ -532,7 +532,7 @@ static void DeleteRegTreeBackup(const char *pszSubKey,const char *pszDbPrefix) if (pszPrefixWithSubKey!=NULL) {
if (EnumDbPrefixSettings("AssocMgr",pszPrefixWithSubKey,&ppszSettings,&nSettingsCount)) {
for(i=0;i<nSettingsCount;++i) {
- DBDeleteContactSetting(NULL,"AssocMgr",ppszSettings[i]);
+ db_unset(NULL,"AssocMgr",ppszSettings[i]);
mir_free(ppszSettings[i]);
}
mir_free(ppszSettings);
diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp index 2bf0149d52..db07567c82 100644 --- a/plugins/AssocMgr/src/test.cpp +++ b/plugins/AssocMgr/src/test.cpp @@ -143,7 +143,7 @@ static int ServiceParseAimLink(WPARAM wParam,LPARAM lParam) if(hContact==NULL) {
hContact=add_contact(sn); /* does not yet check if sn is current user */
if(hContact!=NULL)
- DBWriteContactSettingByte(hContact,MOD_KEY_CL,AIM_KEY_NL,1);
+ db_set_b(hContact,MOD_KEY_CL,AIM_KEY_NL,1);
}
if(hContact!=NULL)
CallService(MS_MSG_SENDMESSAGE,(WPARAM)hContact,(LPARAM)msg);
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 6627dd9219..14e3159a1d 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -119,7 +119,7 @@ int onContactSettingChanged(WPARAM wParam,LPARAM lParam) int onDBContactAdded(WPARAM wParam, LPARAM lParam)
{
// A new contact added, mark it as recent
- DBWriteContactSettingByte((HANDLE)wParam, MODULENAME, "ShowIcons", 1);
+ db_set_b((HANDLE)wParam, MODULENAME, "ShowIcons", 1);
onExtraImageApplying(wParam, 0);
return 0;
@@ -128,7 +128,7 @@ int onDBContactAdded(WPARAM wParam, LPARAM lParam) INT_PTR onAuthMenuSelected(WPARAM wParam, LPARAM lParam)
{
byte enabled = db_get_b((HANDLE)wParam,"AuthState","ShowIcons",1);
- DBWriteContactSettingByte((HANDLE)wParam, MODULENAME, "ShowIcons", !enabled);
+ db_set_b((HANDLE)wParam, MODULENAME, "ShowIcons", !enabled);
onExtraImageApplying(wParam, 0);
return 0;
diff --git a/plugins/AuthState/src/options.cpp b/plugins/AuthState/src/options.cpp index 823269e648..43f6118658 100644 --- a/plugins/AuthState/src/options.cpp +++ b/plugins/AuthState/src/options.cpp @@ -63,10 +63,10 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
//Store options values to DB
- DBWriteContactSettingByte(NULL, MODULENAME, "EnableAuthIcon", bUseAuthIcon);
- DBWriteContactSettingByte(NULL, MODULENAME, "EnableGrantIcon", bUseGrantIcon);
- DBWriteContactSettingByte(NULL, MODULENAME, "MenuItem", bContactMenuItem);
- DBWriteContactSettingByte(NULL, MODULENAME, "EnableOnlyForRecent", bIconsForRecentContacts);
+ db_set_b(NULL, MODULENAME, "EnableAuthIcon", bUseAuthIcon);
+ db_set_b(NULL, MODULENAME, "EnableGrantIcon", bUseGrantIcon);
+ db_set_b(NULL, MODULENAME, "MenuItem", bContactMenuItem);
+ db_set_b(NULL, MODULENAME, "EnableOnlyForRecent", bIconsForRecentContacts);
return TRUE;
}
}
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index 7e4f7ad155..20662698a5 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -39,7 +39,7 @@ static COLORREF GetDefaultColor(BYTE id) case FRAMEELEMENT_BAR:
return RGB(250,0,0); /* same color as used on header icon */
case FRAMEELEMENT_BKGRND:
- return (COLORREF)DBGetContactSettingDword(NULL,"CLC","BkColour",CLCDEFAULT_BKCOLOUR);
+ return (COLORREF)db_get_dw(NULL,"CLC","BkColour",CLCDEFAULT_BKCOLOUR);
case FRAMEELEMENT_TEXT:
return GetSysColor(COLOR_WINDOWTEXT);
}
@@ -332,14 +332,14 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA }
case M_SET_COUNTDOWN:
if(dat->fTimeFlags&SDWTF_ST_TIME) {
- dat->settingLastTime=(time_t)DBGetContactSettingDword(NULL,"AutoShutdown","TimeStamp",SETTING_TIMESTAMP_DEFAULT);
+ dat->settingLastTime=(time_t)db_get_dw(NULL,"AutoShutdown","TimeStamp",SETTING_TIMESTAMP_DEFAULT);
dat->countdown=time(NULL);
if(dat->settingLastTime>dat->countdown) dat->countdown=dat->settingLastTime-dat->countdown;
else dat->countdown=0;
}
else if(dat->flags&FWPDF_COUNTDOWNINVALID) {
- dat->countdown=(time_t)DBGetContactSettingDword(NULL,"AutoShutdown","Countdown",SETTING_COUNTDOWN_DEFAULT);
- dat->countdown*=(time_t)DBGetContactSettingDword(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
+ dat->countdown=(time_t)db_get_dw(NULL,"AutoShutdown","Countdown",SETTING_COUNTDOWN_DEFAULT);
+ dat->countdown*=(time_t)db_get_dw(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
}
dat->flags&=~FWPDF_COUNTDOWNINVALID;
/* commctl 4.70+, Win95: 1-100 will work fine (wrap around) */
diff --git a/plugins/AutoShutdown/src/options.cpp b/plugins/AutoShutdown/src/options.cpp index 0db48e2a6f..6b6fb3039b 100644 --- a/plugins/AutoShutdown/src/options.cpp +++ b/plugins/AutoShutdown/src/options.cpp @@ -36,25 +36,25 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L switch(msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- { WORD setting=DBGetContactSettingWord(NULL,"AutoShutdown","ConfirmDlgCountdown",SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
+ { WORD setting=db_get_w(NULL,"AutoShutdown","ConfirmDlgCountdown",SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
if(setting<3) setting=SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg,IDC_SPIN_CONFIRMDLGCOUNTDOWN,UDM_SETRANGE,0,MAKELPARAM(999,3));
SendDlgItemMessage(hwndDlg,IDC_EDIT_CONFIRMDLGCOUNTDOWN,EM_SETLIMITTEXT,3,0);
SendDlgItemMessage(hwndDlg,IDC_SPIN_CONFIRMDLGCOUNTDOWN,UDM_SETPOS,0,MAKELPARAM(setting,0));
SetDlgItemInt(hwndDlg,IDC_EDIT_CONFIRMDLGCOUNTDOWN,setting,FALSE);
}
- CheckDlgButton(hwndDlg,IDC_CHECK_SMARTOFFLINECHECK,DBGetContactSettingByte(NULL,"AutoShutdown","SmartOfflineCheck",SETTING_SMARTOFFLINECHECK_DEFAULT)!=0);
- CheckDlgButton(hwndDlg,IDC_CHECK_REMEMBERONRESTART,DBGetContactSettingByte(NULL,"AutoShutdown","RememberOnRestart",SETTING_REMEMBERONRESTART_DEFAULT)!=0);
- CheckDlgButton(hwndDlg,IDC_CHECK_SHOWCONFIRMDLG,DBGetContactSettingByte(NULL,"AutoShutdown","ShowConfirmDlg",SETTING_SHOWCONFIRMDLG_DEFAULT)!=0);
+ CheckDlgButton(hwndDlg,IDC_CHECK_SMARTOFFLINECHECK,db_get_b(NULL,"AutoShutdown","SmartOfflineCheck",SETTING_SMARTOFFLINECHECK_DEFAULT)!=0);
+ CheckDlgButton(hwndDlg,IDC_CHECK_REMEMBERONRESTART,db_get_b(NULL,"AutoShutdown","RememberOnRestart",SETTING_REMEMBERONRESTART_DEFAULT)!=0);
+ CheckDlgButton(hwndDlg,IDC_CHECK_SHOWCONFIRMDLG,db_get_b(NULL,"AutoShutdown","ShowConfirmDlg",SETTING_SHOWCONFIRMDLG_DEFAULT)!=0);
{ BOOL enabled=ServiceIsTypeEnabled(SDSDT_SHUTDOWN,0);
if(enabled) {
if(ServiceExists(MS_SYSINFO_HDDTEMP)) {
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_HDDOVERHEAT),TRUE);
- CheckDlgButton(hwndDlg,IDC_CHECK_HDDOVERHEAT,DBGetContactSettingByte(NULL,"AutoShutdown","HddOverheatShutdown",SETTING_HDDOVERHEATSHUTDOWN_DEFAULT)!=0);
+ CheckDlgButton(hwndDlg,IDC_CHECK_HDDOVERHEAT,db_get_b(NULL,"AutoShutdown","HddOverheatShutdown",SETTING_HDDOVERHEATSHUTDOWN_DEFAULT)!=0);
}
if(ServiceExists(MS_WEATHER_UPDATE)) {
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_WEATHER),TRUE);
- CheckDlgButton(hwndDlg,IDC_CHECK_WEATHER,DBGetContactSettingByte(NULL,"AutoShutdown","WeatherShutdown",SETTING_WEATHERSHUTDOWN_DEFAULT)!=0);
+ CheckDlgButton(hwndDlg,IDC_CHECK_WEATHER,db_get_b(NULL,"AutoShutdown","WeatherShutdown",SETTING_WEATHERSHUTDOWN_DEFAULT)!=0);
}
}
}
@@ -88,14 +88,14 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L case WM_NOTIFY:
switch(((NMHDR*)lParam)->code) {
case PSN_APPLY:
- DBWriteContactSettingByte(NULL,"AutoShutdown","ShowConfirmDlg",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWCONFIRMDLG)!=0));
- DBWriteContactSettingWord(NULL,"AutoShutdown","ConfirmDlgCountdown",(WORD)GetDlgItemInt(hwndDlg,IDC_EDIT_CONFIRMDLGCOUNTDOWN,NULL,FALSE));
- DBWriteContactSettingByte(NULL,"AutoShutdown","RememberOnRestart",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_REMEMBERONRESTART)!=0));
- DBWriteContactSettingByte(NULL,"AutoShutdown","SmartOfflineCheck",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SMARTOFFLINECHECK)!=0));
+ db_set_b(NULL,"AutoShutdown","ShowConfirmDlg",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWCONFIRMDLG)!=0));
+ db_set_w(NULL,"AutoShutdown","ConfirmDlgCountdown",(WORD)GetDlgItemInt(hwndDlg,IDC_EDIT_CONFIRMDLGCOUNTDOWN,NULL,FALSE));
+ db_set_b(NULL,"AutoShutdown","RememberOnRestart",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_REMEMBERONRESTART)!=0));
+ db_set_b(NULL,"AutoShutdown","SmartOfflineCheck",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SMARTOFFLINECHECK)!=0));
if(IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_WEATHER)))
- DBWriteContactSettingByte(NULL,"AutoShutdown","WeatherShutdown",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_WEATHER)!=0));
+ db_set_b(NULL,"AutoShutdown","WeatherShutdown",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_WEATHER)!=0));
if(IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_HDDOVERHEAT)))
- DBWriteContactSettingByte(NULL,"AutoShutdown","HddOverheatShutdown",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_HDDOVERHEAT)!=0));
+ db_set_b(NULL,"AutoShutdown","HddOverheatShutdown",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_HDDOVERHEAT)!=0));
return TRUE;
}
break;
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index 84fa86b5e4..c26d570aa0 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -80,7 +80,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR }
/* read-in watcher flags */
{ WORD watcherType;
- watcherType=DBGetContactSettingWord(NULL,"AutoShutdown","WatcherFlags",SETTING_WATCHERFLAGS_DEFAULT);
+ watcherType=db_get_w(NULL,"AutoShutdown","WatcherFlags",SETTING_WATCHERFLAGS_DEFAULT);
CheckRadioButton(hwndDlg,IDC_RADIO_STTIME,IDC_RADIO_STCOUNTDOWN,(watcherType&SDWTF_ST_TIME)?IDC_RADIO_STTIME:IDC_RADIO_STCOUNTDOWN);
CheckDlgButton(hwndDlg,IDC_CHECK_SPECIFICTIME,(watcherType&SDWTF_SPECIFICTIME)!=0);
CheckDlgButton(hwndDlg,IDC_CHECK_MESSAGE,(watcherType&SDWTF_MESSAGE)!=0);
@@ -91,14 +91,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR }
/* read-in countdown val */
{ SYSTEMTIME st;
- if(!TimeStampToSystemTime((time_t)DBGetContactSettingDword(NULL,"AutoShutdown","TimeStamp",SETTING_TIMESTAMP_DEFAULT),&st))
+ if(!TimeStampToSystemTime((time_t)db_get_dw(NULL,"AutoShutdown","TimeStamp",SETTING_TIMESTAMP_DEFAULT),&st))
GetLocalTime(&st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg,IDC_TIME_TIMESTAMP),GDT_VALID,&st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg,IDC_DATE_TIMESTAMP),GDT_VALID,&st);
SendMessage(hwndDlg,M_CHECK_DATETIME,0,0);
}
{ DWORD setting;
- setting=DBGetContactSettingDword(NULL,"AutoShutdown","Countdown",SETTING_COUNTDOWN_DEFAULT);
+ setting=db_get_dw(NULL,"AutoShutdown","Countdown",SETTING_COUNTDOWN_DEFAULT);
if(setting<1) setting=SETTING_COUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg,IDC_SPIN_COUNTDOWN,UDM_SETRANGE,0,MAKELPARAM(UD_MAXVAL,1));
SendDlgItemMessage(hwndDlg,IDC_EDIT_COUNTDOWN,EM_SETLIMITTEXT,(WPARAM)10,0);
@@ -112,7 +112,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR const TCHAR *unitNames[]={TranslateT("Second(s)"), TranslateT("Minute(s)"), TranslateT("Hour(s)"),
TranslateT("Day(s)"), TranslateT("Week(s)"), TranslateT("Month(s)")};
hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_COUNTDOWNUNIT);
- lastUnit=DBGetContactSettingDword(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
+ lastUnit=db_get_dw(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo,CB_SETLOCALE,(WPARAM)locale,0); /* sort order */
SendMessage(hwndCombo,CB_INITSTORAGE,SIZEOF(unitNames),SIZEOF(unitNames)*16); /* approx. */
for(i=0;i<SIZEOF(unitNames);++i) {
@@ -124,7 +124,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR }
}
{ DBVARIANT dbv;
- if(!DBGetContactSettingTString(NULL,"AutoShutdown","Message",&dbv)) {
+ if(!db_get_ts(NULL,"AutoShutdown","Message",&dbv)) {
SetDlgItemText(hwndDlg,IDC_EDIT_MESSAGE,dbv.ptszVal);
mir_free(dbv.ptszVal);
}
@@ -146,7 +146,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR int index;
TCHAR *pszText;
hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_SHUTDOWNTYPE);
- lastShutdownType=DBGetContactSettingByte(NULL,"AutoShutdown","ShutdownType",SETTING_SHUTDOWNTYPE_DEFAULT);
+ lastShutdownType=db_get_b(NULL,"AutoShutdown","ShutdownType",SETTING_SHUTDOWNTYPE_DEFAULT);
SendMessage(hwndCombo,CB_SETLOCALE,(WPARAM)locale,0); /* sort order */
SendMessage(hwndCombo,CB_SETEXTENDEDUI,TRUE,0);
SendMessage(hwndCombo,CB_INITSTORAGE,SDSDT_MAX,SDSDT_MAX*32);
@@ -344,7 +344,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR TCHAR *pszText=(TCHAR*)mir_alloc(len*sizeof(TCHAR));
if(pszText!=NULL && GetWindowText(hwndEdit,pszText,len+1)) {
TrimString(pszText);
- DBWriteContactSettingTString(NULL,"AutoShutdown","Message",pszText);
+ db_set_ts(NULL,"AutoShutdown","Message",pszText);
}
mir_free(pszText); /* does NULL check */
}
@@ -354,16 +354,16 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR DateTime_GetSystemtime(GetDlgItem(hwndDlg,IDC_TIME_TIMESTAMP),&st); /* time gets synchronized */
if(!SystemTimeToTimeStamp(&st,×tamp))
timestamp=time(NULL);
- DBWriteContactSettingDword(NULL,"AutoShutdown","TimeStamp",(DWORD)timestamp);
+ db_set_dw(NULL,"AutoShutdown","TimeStamp",(DWORD)timestamp);
}
/* shutdown type */
{ int index;
index=SendDlgItemMessage(hwndDlg,IDC_COMBO_SHUTDOWNTYPE,CB_GETCURSEL,0,0);
- if(index!=LB_ERR) DBWriteContactSettingByte(NULL,"AutoShutdown","ShutdownType",(BYTE)SendDlgItemMessage(hwndDlg,IDC_COMBO_SHUTDOWNTYPE,CB_GETITEMDATA,(WPARAM)index,0));
+ if(index!=LB_ERR) db_set_b(NULL,"AutoShutdown","ShutdownType",(BYTE)SendDlgItemMessage(hwndDlg,IDC_COMBO_SHUTDOWNTYPE,CB_GETITEMDATA,(WPARAM)index,0));
index=SendDlgItemMessage(hwndDlg,IDC_COMBO_COUNTDOWNUNIT,CB_GETCURSEL,0,0);
- if(index!=LB_ERR) DBWriteContactSettingDword(NULL,"AutoShutdown","CountdownUnit",(DWORD)SendDlgItemMessage(hwndDlg,IDC_COMBO_COUNTDOWNUNIT,CB_GETITEMDATA,(WPARAM)index,0));
- DBWriteContactSettingDword(NULL,"AutoShutdown","Countdown",(DWORD)GetDlgItemInt(hwndDlg,IDC_EDIT_COUNTDOWN,NULL,FALSE));
- DBWriteContactSettingByte(NULL,"AutoShutdown","CpuUsageThreshold",(BYTE)GetDlgItemInt(hwndDlg,IDC_EDIT_CPUUSAGE,NULL,FALSE));
+ if(index!=LB_ERR) db_set_dw(NULL,"AutoShutdown","CountdownUnit",(DWORD)SendDlgItemMessage(hwndDlg,IDC_COMBO_COUNTDOWNUNIT,CB_GETITEMDATA,(WPARAM)index,0));
+ db_set_dw(NULL,"AutoShutdown","Countdown",(DWORD)GetDlgItemInt(hwndDlg,IDC_EDIT_COUNTDOWN,NULL,FALSE));
+ db_set_b(NULL,"AutoShutdown","CpuUsageThreshold",(BYTE)GetDlgItemInt(hwndDlg,IDC_EDIT_CPUUSAGE,NULL,FALSE));
}
/* watcher type */
{ WORD watcherType;
@@ -374,7 +374,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR if(IsDlgButtonChecked(hwndDlg,IDC_CHECK_IDLE)) watcherType|=SDWTF_IDLE;
if(IsDlgButtonChecked(hwndDlg,IDC_CHECK_STATUS)) watcherType|=SDWTF_STATUS;
if(IsDlgButtonChecked(hwndDlg,IDC_CHECK_CPUUSAGE)) watcherType|=SDWTF_CPUUSAGE;
- DBWriteContactSettingWord(NULL,"AutoShutdown","WatcherFlags",watcherType);
+ db_set_w(NULL,"AutoShutdown","WatcherFlags",watcherType);
ServiceStartWatcher(0,watcherType);
}
/* fall through */
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index 889040cc03..b5e57da955 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -379,7 +379,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,(WPARAM)hBoldFont,FALSE);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, (LONG)hBoldFont);
}
- { WORD countdown=DBGetContactSettingWord(NULL,"AutoShutdown","ConfirmDlgCountdown",SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
+ { WORD countdown=db_get_w(NULL,"AutoShutdown","ConfirmDlgCountdown",SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
if(countdown<3) countdown=SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, countdown);
SendMessage(hwndDlg,M_UPDATE_COUNTDOWN,0,countdown);
@@ -480,7 +480,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR INT_PTR ServiceShutdown(WPARAM wParam,LPARAM lParam)
{
/* passing 0 as wParam is only to be used internally, undocumented */
- if(!wParam) wParam=DBGetContactSettingByte(NULL,"AutoShutdown","ShutdownType",SETTING_SHUTDOWNTYPE_DEFAULT);
+ if(!wParam) wParam=db_get_b(NULL,"AutoShutdown","ShutdownType",SETTING_SHUTDOWNTYPE_DEFAULT);
if(!IsShutdownTypeEnabled((BYTE)wParam)) return 1; /* does shutdownType range check */
if((BOOL)lParam && hwndShutdownDlg!=NULL) return 2;
@@ -492,7 +492,7 @@ INT_PTR ServiceShutdown(WPARAM wParam,LPARAM lParam) /* tell others */
NotifyEventHooks(hEventShutdown,wParam,lParam);
/* show dialog */
- if(lParam && DBGetContactSettingByte(NULL,"AutoShutdown","ShowConfirmDlg",SETTING_SHOWCONFIRMDLG_DEFAULT))
+ if(lParam && db_get_b(NULL,"AutoShutdown","ShowConfirmDlg",SETTING_SHOWCONFIRMDLG_DEFAULT))
if(CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SHUTDOWNNOW), NULL, ShutdownDlgProc, (LPARAM)(BYTE)wParam) != NULL)
return 0;
/* show error */
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index 10323614d6..acbd8c31ad 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -102,7 +102,7 @@ static int MsgEventAdded(WPARAM wParam,LPARAM lParam) if (!db_event_get(hDbEvent, &dbe))
if(dbe.eventType == EVENTTYPE_MESSAGE && !(dbe.flags & DBEF_SENT)) {
DBVARIANT dbv;
- if(!DBGetContactSettingTString(NULL,"AutoShutdown","Message",&dbv)) {
+ if(!db_get_ts(NULL,"AutoShutdown","Message",&dbv)) {
TrimString(dbv.ptszVal);
TCHAR *pszMsg = GetMessageText(&dbe.pBlob,&dbe.cbBlob);
if(pszMsg!=NULL && _tcsstr(pszMsg,dbv.ptszVal)!=NULL)
@@ -178,16 +178,16 @@ static int IdleChanged(WPARAM wParam,LPARAM lParam) static BOOL CheckAllContactsOffline(void)
{
BOOL fSmartCheck,fAllOffline=TRUE; /* tentatively */
- fSmartCheck=DBGetContactSettingByte(NULL,"AutoShutdown","SmartOfflineCheck",SETTING_SMARTOFFLINECHECK_DEFAULT);
+ fSmartCheck=db_get_b(NULL,"AutoShutdown","SmartOfflineCheck",SETTING_SMARTOFFLINECHECK_DEFAULT);
HANDLE hContact = db_find_first();
while(hContact != NULL) {
char *pszProto = GetContactProto(hContact);
if(pszProto != NULL && CallProtoService(pszProto,PS_GETSTATUS,0,0)!=ID_STATUS_OFFLINE)
- if(DBGetContactSettingByte(hContact,pszProto,"ChatRoom",0)) continue;
- if(DBGetContactSettingWord(hContact,pszProto,"Status",0)!=ID_STATUS_OFFLINE) {
+ if(db_get_b(hContact,pszProto,"ChatRoom",0)) continue;
+ if(db_get_w(hContact,pszProto,"Status",0)!=ID_STATUS_OFFLINE) {
if(fSmartCheck) {
- if(DBGetContactSettingByte(hContact,"CList","Hidden",0)) continue;
- if(DBGetContactSettingByte(hContact,"CList","NotOnList",0)) continue;
+ if(db_get_b(hContact,"CList","Hidden",0)) continue;
+ if(db_get_b(hContact,"CList","NotOnList",0)) continue;
}
fAllOffline=FALSE;
break;
@@ -240,7 +240,7 @@ static int WeatherUpdated(WPARAM wParam,LPARAM lParam) {
char *pszProto = GetContactProto((HANDLE)wParam);
if((BOOL)lParam && pszProto!=NULL && CallProtoService(pszProto,PS_GETSTATUS,0,0)==THUNDER)
- if(DBGetContactSettingByte(NULL,"AutoShutdown","WeatherShutdown",SETTING_WEATHERSHUTDOWN_DEFAULT))
+ if(db_get_b(NULL,"AutoShutdown","WeatherShutdown",SETTING_WEATHERSHUTDOWN_DEFAULT))
ServiceShutdown(SDSDT_SHUTDOWN,TRUE);
return 0;
}
@@ -249,7 +249,7 @@ static int WeatherUpdated(WPARAM wParam,LPARAM lParam) static int HddOverheat(WPARAM wParam,LPARAM lParam)
{
- if(DBGetContactSettingByte(NULL,"AutoShutdown","HddOverheatShutdown",SETTING_HDDOVERHEATSHUTDOWN_DEFAULT))
+ if(db_get_b(NULL,"AutoShutdown","HddOverheatShutdown",SETTING_HDDOVERHEATSHUTDOWN_DEFAULT))
ServiceShutdown(SDSDT_SHUTDOWN,TRUE);
return 0;
}
@@ -259,7 +259,7 @@ static int HddOverheat(WPARAM wParam,LPARAM lParam) INT_PTR ServiceStartWatcher(WPARAM wParam,LPARAM lParam)
{
/* passing watcherType as lParam is only to be used internally, undocumented */
- if(lParam==0) lParam=(LPARAM)DBGetContactSettingWord(NULL,"AutoShutdown","WatcherFlags",0);
+ if(lParam==0) lParam=(LPARAM)db_get_w(NULL,"AutoShutdown","WatcherFlags",0);
if(!(lParam&SDWTF_MASK)) return 1; /* invalid flags or empty? */
if(lParam&SDWTF_SPECIFICTIME && !(lParam&SDWTF_ST_MASK)) return 2; /* no specific time choice? */
@@ -325,8 +325,8 @@ static int WatcherModulesLoaded(WPARAM wParam,LPARAM lParam) hHookHddOverheat=HookEvent(ME_SYSINFO_HDDOVERHEAT,HddOverheat);
/* restore watcher if it was running on last exit */
- if(DBGetContactSettingByte(NULL,"AutoShutdown","RememberOnRestart",0)==SDROR_RUNNING) {
- DBWriteContactSettingByte(NULL,"AutoShutdown","RememberOnRestart",1);
+ if(db_get_b(NULL,"AutoShutdown","RememberOnRestart",0)==SDROR_RUNNING) {
+ db_set_b(NULL,"AutoShutdown","RememberOnRestart",1);
ServiceStartWatcher(0,0); /* after modules loaded */
}
return 0;
@@ -363,8 +363,8 @@ void UninitWatcher(void) {
/* remember watcher if running */
if(!ServiceStopWatcher(0,0))
- if(DBGetContactSettingByte(NULL,"AutoShutdown","RememberOnRestart",SETTING_REMEMBERONRESTART_DEFAULT))
- DBWriteContactSettingByte(NULL,"AutoShutdown","RememberOnRestart",SDROR_RUNNING);
+ if(db_get_b(NULL,"AutoShutdown","RememberOnRestart",SETTING_REMEMBERONRESTART_DEFAULT))
+ db_set_b(NULL,"AutoShutdown","RememberOnRestart",SDROR_RUNNING);
/* Message Shutdown */
UnhookEvent(hHookEventAdded);
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index d4d5bdcb32..ffe177923d 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -20,7 +20,7 @@ Avatar History Plugin #include "AvatarHistory.h"
-HANDLE hMenu = NULL;
+HGENMENU hMenu = NULL;
DWORD WINAPI AvatarDialogThread(LPVOID param);
static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
int ShowSaveDialog(HWND hwnd, TCHAR* fn,HANDLE hContact = NULL);
@@ -524,15 +524,8 @@ int CleanupAvatarPic(HWND hwnd) int PreBuildContactMenu(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
-
char *proto = GetContactProto((HANDLE)wParam);
- if (!ProtocolEnabled(proto))
- clmi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenu, (LPARAM)&clmi);
-
+ Menu_ShowItem(hMenu, ProtocolEnabled(proto));
return 0;
}
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 2c4e8e1ee2..eb77df785a 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -117,7 +117,7 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam) return 0;
DBVARIANT dbvOldHash = {0};
- bool ret = (DBGetContactSettingTString(hContact,MODULE_NAME,"AvatarHash",&dbvOldHash) == 0);
+ bool ret = (db_get_ts(hContact,MODULE_NAME,"AvatarHash",&dbvOldHash) == 0);
CONTACTAVATARCHANGEDNOTIFICATION* avatar = (CONTACTAVATARCHANGEDNOTIFICATION*)lParam;
if (avatar == NULL) {
@@ -125,13 +125,13 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam) //avoid duplicate "removed avatar" notifications
//do not notify on an empty profile
ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Removed avatar, no avatar before...skipping"));
- DBFreeVariant(&dbvOldHash);
+ db_free(&dbvOldHash);
return 0;
}
SkinPlaySound("avatar_removed");
// Is a flash avatar or avs could not load it
- DBWriteContactSettingTString(hContact, MODULE_NAME, "AvatarHash", _T("-"));
+ db_set_ts(hContact, MODULE_NAME, "AvatarHash", _T("-"));
if (ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_removed)
ShowPopup(hContact, NULL, opts.popup_removed);
@@ -140,11 +140,11 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam) if (ret && !_tcscmp(dbvOldHash.ptszVal, avatar->hash)) {
// same avatar hash, skipping
ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Hashes are the same... skipping"));
- DBFreeVariant(&dbvOldHash);
+ db_free(&dbvOldHash);
return 0;
}
SkinPlaySound("avatar_changed");
- DBWriteContactSettingTString(hContact, "AvatarHistory", "AvatarHash", avatar->hash);
+ db_set_ts(hContact, "AvatarHistory", "AvatarHash", avatar->hash);
TCHAR history_filename[MAX_PATH] = _T("");
diff --git a/plugins/AvatarHistory/src/AvatarHistory.h b/plugins/AvatarHistory/src/AvatarHistory.h index af3986890a..70ac3dfd1e 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.h +++ b/plugins/AvatarHistory/src/AvatarHistory.h @@ -32,7 +32,7 @@ // Globals
extern HINSTANCE hInst;
-extern HANDLE hMenu;
+extern HGENMENU hMenu;
extern DWORD mirVer;
extern HANDLE hAvatarWindowsList;
extern Options opts;
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index afe581386d..56dcb80d01 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -185,7 +185,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if ( !lstrcmp(dbv.ptszVal, _A2T(info.name)))
SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_SETCURSEL, i, 0);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return TRUE;
@@ -503,7 +503,7 @@ void LoadBassLibrary(TCHAR CurrBassPath[MAX_PATH]) if ( !lstrcmp(dbv.ptszVal, _A2T(info.name)))
device = i;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
sndLimSnd = db_get_b(NULL, ModuleName, OPT_MAXCHAN, MAXCHAN);
if (sndLimSnd > MAXCHAN)
@@ -560,7 +560,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) }
else {
lstrcpy(CurrBassPath, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 7083ac7e4a..1a4c589d4e 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -79,18 +79,8 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) int count = EventList::GetContactMessageNumber((HANDLE)wParam);
bool isInList = HistoryWindow::IsInList(GetForegroundWindow());
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
-
- if (!count) mi.flags |= CMIF_HIDDEN;
- else mi.flags &= ~CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS;
- if (!count || !isInList) mi.flags |= CMIF_HIDDEN;
- else mi.flags &= ~CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDeleteContactMenu, (LPARAM)&mi);
-
+ Menu_ShowItem(hContactMenu, count != 0);
+ Menu_ShowItem(hDeleteContactMenu, count != 0 && isInList);
return 0;
}
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index ea2e1edc69..e5cd9c7384 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1776,7 +1776,7 @@ void HistoryWindow::ReloadContacts() HANDLE _hContact = db_find_first();
while(_hContact)
{
- if(EventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || DBGetContactSettingByte(_hContact, metaContactProto, "IsSubcontact", 0) == 0))
+ if(EventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || db_get_b(_hContact, metaContactProto, "IsSubcontact", 0) == 0))
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
if(hItem == NULL)
@@ -1921,18 +1921,18 @@ void HistoryWindow::RestorePos() Utils_RestoreWindowPosition(hWnd,NULL,MODULE,"history_");
contactToLoad = NULL;
}
- if(DBGetContactSettingByte(contactToLoad, MODULE, "history_ismax", 0))
+ if(db_get_b(contactToLoad, MODULE, "history_ismax", 0))
{
ShowWindow(hWnd, SW_SHOWMAXIMIZED);
}
- LONG pos = DBGetContactSettingDword(contactToLoad, MODULE, "history_splitterv", 0);
+ LONG pos = db_get_dw(contactToLoad, MODULE, "history_splitterv", 0);
if(pos > 0)
{
SplitterMoved(splitterYhWnd, pos, false);
}
- pos = DBGetContactSettingDword(contactToLoad, MODULE, "history_splitter", 0);
+ pos = db_get_dw(contactToLoad, MODULE, "history_splitter", 0);
if(pos > 0)
{
SplitterMoved(splitterXhWnd, pos, false);
@@ -1947,13 +1947,13 @@ void HistoryWindow::SavePos(bool all) HANDLE _hContact = db_find_first();
while(_hContact)
{
- DBDeleteContactSetting(_hContact, MODULE, "history_x");
- DBDeleteContactSetting(_hContact, MODULE, "history_y");
- DBDeleteContactSetting(_hContact, MODULE, "history_width");
- DBDeleteContactSetting(_hContact, MODULE, "history_height");
- DBDeleteContactSetting(_hContact, MODULE, "history_ismax");
- DBDeleteContactSetting(_hContact, MODULE, "history_splitterv");
- DBDeleteContactSetting(_hContact, MODULE, "history_splitter");
+ db_unset(_hContact, MODULE, "history_x");
+ db_unset(_hContact, MODULE, "history_y");
+ db_unset(_hContact, MODULE, "history_width");
+ db_unset(_hContact, MODULE, "history_height");
+ db_unset(_hContact, MODULE, "history_ismax");
+ db_unset(_hContact, MODULE, "history_splitterv");
+ db_unset(_hContact, MODULE, "history_splitter");
_hContact = db_find_next(_hContact);
}
@@ -1964,9 +1964,9 @@ void HistoryWindow::SavePos(bool all) WINDOWPLACEMENT wp;
wp.length=sizeof(wp);
GetWindowPlacement(hWnd,&wp);
- DBWriteContactSettingByte(contactToSave, MODULE, "history_ismax", wp.showCmd == SW_MAXIMIZE ? 1 : 0);
- DBWriteContactSettingDword(contactToSave, MODULE, "history_splitterv", splitterX);
- DBWriteContactSettingDword(contactToSave, MODULE, "history_splitter", splitterY);
+ db_set_b(contactToSave, MODULE, "history_ismax", wp.showCmd == SW_MAXIMIZE ? 1 : 0);
+ db_set_dw(contactToSave, MODULE, "history_splitterv", splitterX);
+ db_set_dw(contactToSave, MODULE, "history_splitter", splitterY);
}
#define DEF_FILTERS_START 50000
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 4d8b759d7e..3e9283df10 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -288,60 +288,60 @@ void Options::Load(void) Hotkey_Register(&hid);
}
- showContacts = DBGetContactSettingByte(0, MODULE, "showContacts", 0) ? true : false;
- showContactGroups = DBGetContactSettingByte(0, MODULE, "showContactGroups", 1) ? true : false;
- noFindBorder = DBGetContactSettingByte(0, MODULE, "noFindBorder", 0) ? true : false;
- groupNewOnTop = DBGetContactSettingByte(0, MODULE, "groupNewOnTop", 1) ? true : false;
- groupShowEvents = DBGetContactSettingByte(0, MODULE, "groupShowEvents", 1) ? true : false;
- groupShowTime = DBGetContactSettingByte(0, MODULE, "groupShowTime", 1) ? true : false;
- groupShowName = DBGetContactSettingByte(0, MODULE, "groupShowName", 0) ? true : false;
- groupShowMessage = DBGetContactSettingByte(0, MODULE, "groupShowMessage", 1) ? true : false;
- groupMessageLen = DBGetContactSettingDword(0, MODULE, "groupMessageLen", 43);
+ showContacts = db_get_b(0, MODULE, "showContacts", 0) ? true : false;
+ showContactGroups = db_get_b(0, MODULE, "showContactGroups", 1) ? true : false;
+ noFindBorder = db_get_b(0, MODULE, "noFindBorder", 0) ? true : false;
+ groupNewOnTop = db_get_b(0, MODULE, "groupNewOnTop", 1) ? true : false;
+ groupShowEvents = db_get_b(0, MODULE, "groupShowEvents", 1) ? true : false;
+ groupShowTime = db_get_b(0, MODULE, "groupShowTime", 1) ? true : false;
+ groupShowName = db_get_b(0, MODULE, "groupShowName", 0) ? true : false;
+ groupShowMessage = db_get_b(0, MODULE, "groupShowMessage", 1) ? true : false;
+ groupMessageLen = db_get_dw(0, MODULE, "groupMessageLen", 43);
if(groupMessageLen < 5) groupMessageLen = 5;
- groupTime = DBGetContactSettingDword(0, MODULE, "groupTime", 5);
+ groupTime = db_get_dw(0, MODULE, "groupTime", 5);
if(groupTime < 1) groupTime = 1;
- groupMessagesNumber = DBGetContactSettingDword(0, MODULE, "groupMessagesNumber", 100);
+ groupMessagesNumber = db_get_dw(0, MODULE, "groupMessagesNumber", 100);
if(groupMessagesNumber < 1) groupMessagesNumber = 1;
- messagesNewOnTop = DBGetContactSettingByte(0, MODULE, "messagesNewOnTop", 0) ? true : false;
- messagesShowDate = DBGetContactSettingByte(0, MODULE, "messagesShowDate", 0) ? true : false;
- messagesShowSec = DBGetContactSettingByte(0, MODULE, "messagesShowSec", 0) ? true : false;
- messagesShowName = DBGetContactSettingByte(0, MODULE, "messagesShowName", 1) ? true : false;
- messagesShowEvents = DBGetContactSettingByte(0, MODULE, "messagesShowEvents", 0) ? true : false;
- messagesUseSmileys = DBGetContactSettingByte(0, MODULE, "messagesUseSmileys", 1) ? true : false;
- searchForInList = DBGetContactSettingByte(0, MODULE, "searchForInList", 1) ? true : false;
- searchForInMess = DBGetContactSettingByte(0, MODULE, "searchForInMess", 1) ? true : false;
- searchMatchCase = DBGetContactSettingByte(0, MODULE, "searchMatchCase", 0) ? true : false;
- searchMatchWhole = DBGetContactSettingByte(0, MODULE, "searchMatchWhole", 0) ? true : false;
- searchOnlyIn = DBGetContactSettingByte(0, MODULE, "searchOnlyIn", 0) ? true : false;
- searchOnlyOut = DBGetContactSettingByte(0, MODULE, "searchOnlyOut", 0) ? true : false;
- searchOnlyGroup = DBGetContactSettingByte(0, MODULE, "searchOnlyGroup", 0) ? true : false;
- searchAllContacts = DBGetContactSettingByte(0, MODULE, "searchAllContacts", 0) ? true : false;
- schedulerAlerts = DBGetContactSettingByte(0, MODULE, "schedulerAlerts", 1) ? true : false;
- schedulerHistoryAlerts = DBGetContactSettingByte(0, MODULE, "schedulerHistoryAlerts", 1) ? true : false;
-
- defFilter = DBGetContactSettingByte(0, MODULE, "defFilter", defFilter);
- int filtersCount = DBGetContactSettingDword(0, MODULE, "customFiltersCount", 0);
+ messagesNewOnTop = db_get_b(0, MODULE, "messagesNewOnTop", 0) ? true : false;
+ messagesShowDate = db_get_b(0, MODULE, "messagesShowDate", 0) ? true : false;
+ messagesShowSec = db_get_b(0, MODULE, "messagesShowSec", 0) ? true : false;
+ messagesShowName = db_get_b(0, MODULE, "messagesShowName", 1) ? true : false;
+ messagesShowEvents = db_get_b(0, MODULE, "messagesShowEvents", 0) ? true : false;
+ messagesUseSmileys = db_get_b(0, MODULE, "messagesUseSmileys", 1) ? true : false;
+ searchForInList = db_get_b(0, MODULE, "searchForInList", 1) ? true : false;
+ searchForInMess = db_get_b(0, MODULE, "searchForInMess", 1) ? true : false;
+ searchMatchCase = db_get_b(0, MODULE, "searchMatchCase", 0) ? true : false;
+ searchMatchWhole = db_get_b(0, MODULE, "searchMatchWhole", 0) ? true : false;
+ searchOnlyIn = db_get_b(0, MODULE, "searchOnlyIn", 0) ? true : false;
+ searchOnlyOut = db_get_b(0, MODULE, "searchOnlyOut", 0) ? true : false;
+ searchOnlyGroup = db_get_b(0, MODULE, "searchOnlyGroup", 0) ? true : false;
+ searchAllContacts = db_get_b(0, MODULE, "searchAllContacts", 0) ? true : false;
+ schedulerAlerts = db_get_b(0, MODULE, "schedulerAlerts", 1) ? true : false;
+ schedulerHistoryAlerts = db_get_b(0, MODULE, "schedulerHistoryAlerts", 1) ? true : false;
+
+ defFilter = db_get_b(0, MODULE, "defFilter", defFilter);
+ int filtersCount = db_get_dw(0, MODULE, "customFiltersCount", 0);
for(int i = 0; i < filtersCount; ++i)
{
char buf[256];
FilterOptions fo;
sprintf_s(buf, "filterName_%d", i);
DBVARIANT nameV;
- if(!DBGetContactSettingWString(0, MODULE, buf, &nameV))
+ if(!db_get_ws(0, MODULE, buf, &nameV))
{
fo.name = nameV.pwszVal;
- DBFreeVariant(&nameV);
+ db_free(&nameV);
}
else break;
sprintf_s(buf, "filterInOut_%d", i);
- int inOut = DBGetContactSettingByte(0, MODULE, buf, 0);
+ int inOut = db_get_b(0, MODULE, buf, 0);
if(inOut == 1)
fo.onlyIncomming = true;
else if(inOut == 2)
fo.onlyOutgoing = true;
sprintf_s(buf, "filterEvents_%d", i);
DBVARIANT eventsV;
- if(!DBGetContactSettingString(0, MODULE, buf, &eventsV))
+ if(!db_get_s(0, MODULE, buf, &eventsV))
{
int k = 0;
char* id = eventsV.pszVal;
@@ -356,7 +356,7 @@ void Options::Load(void) ++k;
}
- DBFreeVariant(&eventsV);
+ db_free(&eventsV);
}
else break;
@@ -368,7 +368,7 @@ void Options::Load(void) defFilter = 0;
DBVARIANT defFilterStrV;
- if(!DBGetContactSettingWString(0, MODULE, "defFilterStr", &defFilterStrV))
+ if(!db_get_ws(0, MODULE, "defFilterStr", &defFilterStrV))
{
std::wstring filterName = defFilterStrV.pwszVal;
for(int i = 0; i < (int)customFilters.size(); ++i)
@@ -379,65 +379,65 @@ void Options::Load(void) break;
}
}
- DBFreeVariant(&defFilterStrV);
+ db_free(&defFilterStrV);
}
}
- codepageTxt = DBGetContactSettingDword(0, MODULE, "codepageTxt", CP_UTF8);
- codepageHtml1 = DBGetContactSettingDword(0, MODULE, "codepageHtml1", CP_UTF8);
- codepageHtml2 = DBGetContactSettingDword(0, MODULE, "codepageHtml2", CP_UTF8);
+ codepageTxt = db_get_dw(0, MODULE, "codepageTxt", CP_UTF8);
+ codepageHtml1 = db_get_dw(0, MODULE, "codepageHtml1", CP_UTF8);
+ codepageHtml2 = db_get_dw(0, MODULE, "codepageHtml2", CP_UTF8);
DBVARIANT encodingV;
- if(!DBGetContactSettingWString(0, MODULE, "encodingTxt", &encodingV))
+ if(!db_get_ws(0, MODULE, "encodingTxt", &encodingV))
{
encodingTxt = encodingV.pwszVal;
- DBFreeVariant(&encodingV);
+ db_free(&encodingV);
}
else
{
encodingTxt = _T("UTF-8");
}
- if(!DBGetContactSettingWString(0, MODULE, "encodingHtml1", &encodingV))
+ if(!db_get_ws(0, MODULE, "encodingHtml1", &encodingV))
{
encodingHtml1 = encodingV.pwszVal;
- DBFreeVariant(&encodingV);
+ db_free(&encodingV);
}
else
{
encodingHtml1 = _T("UTF-8");
}
- if(!DBGetContactSettingWString(0, MODULE, "encodingHtml2", &encodingV))
+ if(!db_get_ws(0, MODULE, "encodingHtml2", &encodingV))
{
encodingHtml2 = encodingV.pwszVal;
- DBFreeVariant(&encodingV);
+ db_free(&encodingV);
}
else
{
encodingHtml2 = _T("UTF-8");
}
- exportHtml1ShowDate = DBGetContactSettingByte(0, MODULE, "exportHtml1ShowDate", 1) ? true : false;
- exportHtml2ShowDate = DBGetContactSettingByte(0, MODULE, "exportHtml2ShowDate", 0) ? true : false;
- exportHtml2UseSmileys = DBGetContactSettingByte(0, MODULE, "exportHtml2UseSmileys", 1) ? true : false;
- if(!DBGetContactSettingWString(0, MODULE, "extCssHtml2", &encodingV))
+ exportHtml1ShowDate = db_get_b(0, MODULE, "exportHtml1ShowDate", 1) ? true : false;
+ exportHtml2ShowDate = db_get_b(0, MODULE, "exportHtml2ShowDate", 0) ? true : false;
+ exportHtml2UseSmileys = db_get_b(0, MODULE, "exportHtml2UseSmileys", 1) ? true : false;
+ if(!db_get_ws(0, MODULE, "extCssHtml2", &encodingV))
{
extCssHtml2 = encodingV.pwszVal;
- DBFreeVariant(&encodingV);
+ db_free(&encodingV);
}
else
{
extCssHtml2 = _T("");
}
- if(!DBGetContactSettingWString(0, MODULE, "ftpLogPath", &encodingV))
+ if(!db_get_ws(0, MODULE, "ftpLogPath", &encodingV))
{
ftpLogPath = encodingV.pwszVal;
- DBFreeVariant(&encodingV);
+ db_free(&encodingV);
}
- if(!DBGetContactSettingWString(0, MODULE, "ftpExePath", &encodingV))
+ if(!db_get_ws(0, MODULE, "ftpExePath", &encodingV))
{
ftpExePath = encodingV.pwszVal;
- DBFreeVariant(&encodingV);
+ db_free(&encodingV);
}
else
{
@@ -467,48 +467,48 @@ COLORREF Options::GetColor(Colors colorId) void Options::Save()
{
- DBWriteContactSettingByte(0, MODULE, "showContacts", showContacts ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "showContactGroups", showContactGroups ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "noFindBorder", noFindBorder ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "groupNewOnTop", groupNewOnTop ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "groupShowEvents", groupShowEvents ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "groupShowTime", groupShowTime ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "groupShowName", groupShowName ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "groupShowMessage", groupShowMessage ? 1 : 0);
+ db_set_b(0, MODULE, "showContacts", showContacts ? 1 : 0);
+ db_set_b(0, MODULE, "showContactGroups", showContactGroups ? 1 : 0);
+ db_set_b(0, MODULE, "noFindBorder", noFindBorder ? 1 : 0);
+ db_set_b(0, MODULE, "groupNewOnTop", groupNewOnTop ? 1 : 0);
+ db_set_b(0, MODULE, "groupShowEvents", groupShowEvents ? 1 : 0);
+ db_set_b(0, MODULE, "groupShowTime", groupShowTime ? 1 : 0);
+ db_set_b(0, MODULE, "groupShowName", groupShowName ? 1 : 0);
+ db_set_b(0, MODULE, "groupShowMessage", groupShowMessage ? 1 : 0);
if(groupMessageLen < 5) groupMessageLen = 5;
- DBWriteContactSettingDword(0, MODULE, "groupMessageLen", groupMessageLen);
+ db_set_dw(0, MODULE, "groupMessageLen", groupMessageLen);
if(groupTime < 1) groupTime = 1;
- DBWriteContactSettingDword(0, MODULE, "groupTime", groupTime);
+ db_set_dw(0, MODULE, "groupTime", groupTime);
if(groupMessagesNumber < 1) groupMessagesNumber = 1;
- DBWriteContactSettingDword(0, MODULE, "groupMessagesNumber", groupMessagesNumber);
- DBWriteContactSettingByte(0, MODULE, "messagesNewOnTop", messagesNewOnTop ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "messagesShowDate", messagesShowDate ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "messagesShowSec", messagesShowSec ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "messagesShowName", messagesShowName ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "messagesShowEvents", messagesShowEvents ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "messagesUseSmileys", messagesUseSmileys ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "searchForInList", searchForInList ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "searchForInMess", searchForInMess ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "searchMatchCase", searchMatchCase ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "searchMatchWhole", searchMatchWhole ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "searchOnlyIn", searchOnlyIn ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "searchOnlyOut", searchOnlyOut ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "searchOnlyGroup", searchOnlyGroup ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "searchAllContacts", searchAllContacts ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "schedulerAlerts", schedulerAlerts ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "schedulerHistoryAlerts", schedulerHistoryAlerts ? 1 : 0);
+ db_set_dw(0, MODULE, "groupMessagesNumber", groupMessagesNumber);
+ db_set_b(0, MODULE, "messagesNewOnTop", messagesNewOnTop ? 1 : 0);
+ db_set_b(0, MODULE, "messagesShowDate", messagesShowDate ? 1 : 0);
+ db_set_b(0, MODULE, "messagesShowSec", messagesShowSec ? 1 : 0);
+ db_set_b(0, MODULE, "messagesShowName", messagesShowName ? 1 : 0);
+ db_set_b(0, MODULE, "messagesShowEvents", messagesShowEvents ? 1 : 0);
+ db_set_b(0, MODULE, "messagesUseSmileys", messagesUseSmileys ? 1 : 0);
+ db_set_b(0, MODULE, "searchForInList", searchForInList ? 1 : 0);
+ db_set_b(0, MODULE, "searchForInMess", searchForInMess ? 1 : 0);
+ db_set_b(0, MODULE, "searchMatchCase", searchMatchCase ? 1 : 0);
+ db_set_b(0, MODULE, "searchMatchWhole", searchMatchWhole ? 1 : 0);
+ db_set_b(0, MODULE, "searchOnlyIn", searchOnlyIn ? 1 : 0);
+ db_set_b(0, MODULE, "searchOnlyOut", searchOnlyOut ? 1 : 0);
+ db_set_b(0, MODULE, "searchOnlyGroup", searchOnlyGroup ? 1 : 0);
+ db_set_b(0, MODULE, "searchAllContacts", searchAllContacts ? 1 : 0);
+ db_set_b(0, MODULE, "schedulerAlerts", schedulerAlerts ? 1 : 0);
+ db_set_b(0, MODULE, "schedulerHistoryAlerts", schedulerHistoryAlerts ? 1 : 0);
if(defFilter < 0 || defFilter - 2 >= (int)customFilters.size()) defFilter = 0;
- DBWriteContactSettingByte(0, MODULE, "defFilter", defFilter < 2 ? defFilter : 2);
+ db_set_b(0, MODULE, "defFilter", defFilter < 2 ? defFilter : 2);
if(defFilter >= 2)
- DBWriteContactSettingWString(0, MODULE, "defFilterStr", customFilters[defFilter - 2].name.c_str());
- DBWriteContactSettingDword(0, MODULE, "customFiltersCount", (DWORD)customFilters.size());
+ db_set_ws(0, MODULE, "defFilterStr", customFilters[defFilter - 2].name.c_str());
+ db_set_dw(0, MODULE, "customFiltersCount", (DWORD)customFilters.size());
for(int i = 0 ; i < (int)customFilters.size(); ++i)
{
char buf[256];
sprintf_s(buf, "filterName_%d", i);
- DBWriteContactSettingWString(0, MODULE, buf, customFilters[i].name.c_str());
+ db_set_ws(0, MODULE, buf, customFilters[i].name.c_str());
sprintf_s(buf, "filterInOut_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, customFilters[i].onlyIncomming ? 1 : (customFilters[i].onlyOutgoing ? 2 : 0));
+ db_set_b(0, MODULE, buf, customFilters[i].onlyIncomming ? 1 : (customFilters[i].onlyOutgoing ? 2 : 0));
std::string events;
for(std::vector<int>::iterator it = customFilters[i].events.begin(); it != customFilters[i].events.end(); ++it)
{
@@ -518,27 +518,27 @@ void Options::Save() }
sprintf_s(buf, "filterEvents_%d", i);
- DBWriteContactSettingString(0, MODULE, buf, events.c_str());
+ db_set_s(0, MODULE, buf, events.c_str());
}
- DBWriteContactSettingDword(0, MODULE, "codepageTxt", codepageTxt);
- DBWriteContactSettingDword(0, MODULE, "codepageHtml1", codepageHtml1);
- DBWriteContactSettingDword(0, MODULE, "codepageHtml2", codepageHtml2);
- DBWriteContactSettingWString(0, MODULE, "encodingTxt", encodingTxt.c_str());
- DBWriteContactSettingWString(0, MODULE, "encodingHtml1", encodingHtml1.c_str());
- DBWriteContactSettingWString(0, MODULE, "encodingHtml2", encodingHtml2.c_str());
- DBWriteContactSettingByte(0, MODULE, "exportHtml1ShowDate", exportHtml1ShowDate ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "exportHtml2ShowDate", exportHtml2ShowDate ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "exportHtml2UseSmileys", exportHtml2UseSmileys ? 1 : 0);
- DBWriteContactSettingWString(0, MODULE, "extCssHtml2", extCssHtml2.c_str());
- DBWriteContactSettingWString(0, MODULE, "ftpLogPath", ftpLogPath.c_str());
+ db_set_dw(0, MODULE, "codepageTxt", codepageTxt);
+ db_set_dw(0, MODULE, "codepageHtml1", codepageHtml1);
+ db_set_dw(0, MODULE, "codepageHtml2", codepageHtml2);
+ db_set_ws(0, MODULE, "encodingTxt", encodingTxt.c_str());
+ db_set_ws(0, MODULE, "encodingHtml1", encodingHtml1.c_str());
+ db_set_ws(0, MODULE, "encodingHtml2", encodingHtml2.c_str());
+ db_set_b(0, MODULE, "exportHtml1ShowDate", exportHtml1ShowDate ? 1 : 0);
+ db_set_b(0, MODULE, "exportHtml2ShowDate", exportHtml2ShowDate ? 1 : 0);
+ db_set_b(0, MODULE, "exportHtml2UseSmileys", exportHtml2UseSmileys ? 1 : 0);
+ db_set_ws(0, MODULE, "extCssHtml2", extCssHtml2.c_str());
+ db_set_ws(0, MODULE, "ftpLogPath", ftpLogPath.c_str());
if(ftpExePath != ftpExePathDef)
{
- DBWriteContactSettingWString(0, MODULE, "ftpExePath", ftpExePath.c_str());
+ db_set_ws(0, MODULE, "ftpExePath", ftpExePath.c_str());
}
else
{
- DBDeleteContactSetting(0, MODULE, "ftpExePath");
+ db_unset(0, MODULE, "ftpExePath");
}
}
@@ -552,119 +552,119 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks) for(std::list<TaskOptions>::iterator it = tasks->begin(); it != tasks->end(); ++it)
{
sprintf_s(buf, "Task_compress_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->compress);
+ db_set_b(0, MODULE, buf, it->compress);
sprintf_s(buf, "Task_useFtp_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->useFtp);
+ db_set_b(0, MODULE, buf, it->useFtp);
sprintf_s(buf, "Task_isSystem_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->isSystem);
+ db_set_b(0, MODULE, buf, it->isSystem);
sprintf_s(buf, "Task_active_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->active);
+ db_set_b(0, MODULE, buf, it->active);
sprintf_s(buf, "Task_exportImported_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->exportImported);
+ db_set_b(0, MODULE, buf, it->exportImported);
sprintf_s(buf, "Task_type_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->type);
+ db_set_b(0, MODULE, buf, it->type);
sprintf_s(buf, "Task_eventUnit_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->eventUnit);
+ db_set_b(0, MODULE, buf, it->eventUnit);
sprintf_s(buf, "Task_trigerType_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->trigerType);
+ db_set_b(0, MODULE, buf, it->trigerType);
sprintf_s(buf, "Task_exportType_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->exportType);
+ db_set_b(0, MODULE, buf, it->exportType);
sprintf_s(buf, "Task_importType_%d", i);
- DBWriteContactSettingByte(0, MODULE, buf, it->importType);
+ db_set_b(0, MODULE, buf, it->importType);
sprintf_s(buf, "Task_eventDeltaTime_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, it->eventDeltaTime);
+ db_set_dw(0, MODULE, buf, it->eventDeltaTime);
sprintf_s(buf, "Task_filterId_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, it->filterId);
+ db_set_dw(0, MODULE, buf, it->filterId);
sprintf_s(buf, "Task_dayTime_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, it->dayTime);
+ db_set_dw(0, MODULE, buf, it->dayTime);
sprintf_s(buf, "Task_dayOfWeek_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, it->dayOfWeek);
+ db_set_dw(0, MODULE, buf, it->dayOfWeek);
sprintf_s(buf, "Task_dayOfMonth_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, it->dayOfMonth);
+ db_set_dw(0, MODULE, buf, it->dayOfMonth);
sprintf_s(buf, "Task_deltaTime_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, it->deltaTime);
+ db_set_dw(0, MODULE, buf, it->deltaTime);
sprintf_s(buf, "Task_lastExport_low_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, (int)it->lastExport);
+ db_set_dw(0, MODULE, buf, (int)it->lastExport);
sprintf_s(buf, "Task_lastExport_hi_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, ((unsigned long long int)it->lastExport) >> 32);
+ db_set_dw(0, MODULE, buf, ((unsigned long long int)it->lastExport) >> 32);
sprintf_s(buf, "Task_ftpName_%d", i);
- DBWriteContactSettingWString(0, MODULE, buf, it->ftpName.c_str());
+ db_set_ws(0, MODULE, buf, it->ftpName.c_str());
sprintf_s(buf, "Task_filterName_%d", i);
- DBWriteContactSettingWString(0, MODULE, buf, it->filterName.c_str());
+ db_set_ws(0, MODULE, buf, it->filterName.c_str());
sprintf_s(buf, "Task_filePath_%d", i);
- DBWriteContactSettingWString(0, MODULE, buf, it->filePath.c_str());
+ db_set_ws(0, MODULE, buf, it->filePath.c_str());
sprintf_s(buf, "Task_taskName_%d", i);
- DBWriteContactSettingWString(0, MODULE, buf, it->taskName.c_str());
+ db_set_ws(0, MODULE, buf, it->taskName.c_str());
sprintf_s(buf, "Task_zipPassword_%d", i);
- DBWriteContactSettingString(0, MODULE, buf, it->zipPassword.c_str());
+ db_set_s(0, MODULE, buf, it->zipPassword.c_str());
HANDLE _hContact = db_find_first();
sprintf_s(buf, "IsInTask_%d", i);
while(_hContact)
{
- DBDeleteContactSetting(_hContact, MODULE, buf);
+ db_unset(_hContact, MODULE, buf);
_hContact = db_find_next(_hContact);
}
for(size_t j = 0; j < it->contacts.size(); ++j)
{
- DBWriteContactSettingByte(it->contacts[j], MODULE, buf, 1);
+ db_set_b(it->contacts[j], MODULE, buf, 1);
}
it->orderNr = i++;
taskOptions.push_back(*it);
}
- DBWriteContactSettingDword(0, MODULE, "Task_count", i);
+ db_set_dw(0, MODULE, "Task_count", i);
for(i = (int)tasks->size(); i < oldTaskNr; ++i)
{
sprintf_s(buf, "Task_compress_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_useFtp_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_isSystem_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_active_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_type_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_eventUnit_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_trigerType_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_exportType_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_eventDeltaTime_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_filterId_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_dayTime_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_dayOfWeek_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_dayOfMonth_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_deltaTime_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_lastExport_low_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_lastExport_hi_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_ftpName_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_filterName_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_filePath_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
sprintf_s(buf, "Task_taskName_%d", i);
- DBDeleteContactSetting(NULL, MODULE, buf);
+ db_unset(NULL, MODULE, buf);
HANDLE _hContact = db_find_first();
sprintf_s(buf, "IsInTask_%d", i);
while(_hContact)
{
- DBDeleteContactSetting(_hContact, MODULE, buf);
+ db_unset(_hContact, MODULE, buf);
_hContact = db_find_next(_hContact);
}
}
@@ -677,92 +677,92 @@ void Options::SaveTaskTime(TaskOptions& to) int i = to.orderNr;
char buf[256];
sprintf_s(buf, "Task_lastExport_low_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, (int)to.lastExport);
+ db_set_dw(0, MODULE, buf, (int)to.lastExport);
sprintf_s(buf, "Task_lastExport_hi_%d", i);
- DBWriteContactSettingDword(0, MODULE, buf, ((unsigned long long int)to.lastExport) >> 32);
+ db_set_dw(0, MODULE, buf, ((unsigned long long int)to.lastExport) >> 32);
}
void Options::LoadTasks()
{
- int taskCount = DBGetContactSettingDword(0, MODULE, "Task_count", 0);
+ int taskCount = db_get_dw(0, MODULE, "Task_count", 0);
char buf[256];
for(int i = 0; i < taskCount; ++i)
{
TaskOptions to;
sprintf_s(buf, "Task_compress_%d", i);
- to.compress = DBGetContactSettingByte(0, MODULE, buf, to.compress) != 0;
+ to.compress = db_get_b(0, MODULE, buf, to.compress) != 0;
sprintf_s(buf, "Task_useFtp_%d", i);
- to.useFtp = DBGetContactSettingByte(0, MODULE, buf, to.useFtp) != 0;
+ to.useFtp = db_get_b(0, MODULE, buf, to.useFtp) != 0;
sprintf_s(buf, "Task_isSystem_%d", i);
- to.isSystem = DBGetContactSettingByte(0, MODULE, buf, to.isSystem) != 0;
+ to.isSystem = db_get_b(0, MODULE, buf, to.isSystem) != 0;
sprintf_s(buf, "Task_active_%d", i);
- to.active = DBGetContactSettingByte(0, MODULE, buf, to.active) != 0;
+ to.active = db_get_b(0, MODULE, buf, to.active) != 0;
sprintf_s(buf, "Task_exportImported_%d", i);
- to.exportImported = DBGetContactSettingByte(0, MODULE, buf, to.exportImported) != 0;
+ to.exportImported = db_get_b(0, MODULE, buf, to.exportImported) != 0;
sprintf_s(buf, "Task_type_%d", i);
- to.type = (TaskOptions::TaskType)DBGetContactSettingByte(0, MODULE, buf, to.type);
+ to.type = (TaskOptions::TaskType)db_get_b(0, MODULE, buf, to.type);
sprintf_s(buf, "Task_eventUnit_%d", i);
- to.eventUnit = (TaskOptions::EventUnit)DBGetContactSettingByte(0, MODULE, buf, to.eventUnit);
+ to.eventUnit = (TaskOptions::EventUnit)db_get_b(0, MODULE, buf, to.eventUnit);
sprintf_s(buf, "Task_trigerType_%d", i);
- to.trigerType = (TaskOptions::TrigerType)DBGetContactSettingByte(0, MODULE, buf, to.trigerType);
+ to.trigerType = (TaskOptions::TrigerType)db_get_b(0, MODULE, buf, to.trigerType);
sprintf_s(buf, "Task_exportType_%d", i);
- to.exportType = (IExport::ExportType)DBGetContactSettingByte(0, MODULE, buf, to.exportType);
+ to.exportType = (IExport::ExportType)db_get_b(0, MODULE, buf, to.exportType);
sprintf_s(buf, "Task_importType_%d", i);
- to.importType = (IImport::ImportType)DBGetContactSettingByte(0, MODULE, buf, to.importType);
+ to.importType = (IImport::ImportType)db_get_b(0, MODULE, buf, to.importType);
sprintf_s(buf, "Task_eventDeltaTime_%d", i);
- to.eventDeltaTime = DBGetContactSettingDword(0, MODULE, buf, to.eventDeltaTime);
+ to.eventDeltaTime = db_get_dw(0, MODULE, buf, to.eventDeltaTime);
sprintf_s(buf, "Task_filterId_%d", i);
- to.filterId = DBGetContactSettingDword(0, MODULE, buf, to.filterId);
+ to.filterId = db_get_dw(0, MODULE, buf, to.filterId);
sprintf_s(buf, "Task_dayTime_%d", i);
- to.dayTime = DBGetContactSettingDword(0, MODULE, buf, to.dayTime);
+ to.dayTime = db_get_dw(0, MODULE, buf, to.dayTime);
sprintf_s(buf, "Task_dayOfWeek_%d", i);
- to.dayOfWeek = DBGetContactSettingDword(0, MODULE, buf, to.dayOfWeek);
+ to.dayOfWeek = db_get_dw(0, MODULE, buf, to.dayOfWeek);
sprintf_s(buf, "Task_dayOfMonth_%d", i);
- to.dayOfMonth = DBGetContactSettingDword(0, MODULE, buf, to.dayOfMonth);
+ to.dayOfMonth = db_get_dw(0, MODULE, buf, to.dayOfMonth);
sprintf_s(buf, "Task_deltaTime_%d", i);
- to.deltaTime = DBGetContactSettingDword(0, MODULE, buf, to.deltaTime);
+ to.deltaTime = db_get_dw(0, MODULE, buf, to.deltaTime);
unsigned long long int le = to.lastExport;
sprintf_s(buf, "Task_lastExport_low_%d", i);
- to.lastExport = DBGetContactSettingDword(0, MODULE, buf, (int)le) & 0xffffffff;
+ to.lastExport = db_get_dw(0, MODULE, buf, (int)le) & 0xffffffff;
sprintf_s(buf, "Task_lastExport_hi_%d", i);
- to.lastExport |= ((unsigned long long int)DBGetContactSettingDword(0, MODULE, buf, le >> 32)) << 32;
+ to.lastExport |= ((unsigned long long int)db_get_dw(0, MODULE, buf, le >> 32)) << 32;
sprintf_s(buf, "Task_ftpName_%d", i);
DBVARIANT var;
- if(!DBGetContactSettingWString(0, MODULE, buf, &var))
+ if(!db_get_ws(0, MODULE, buf, &var))
{
to.ftpName = var.ptszVal;
- DBFreeVariant(&var);
+ db_free(&var);
}
sprintf_s(buf, "Task_filterName_%d", i);
- if(!DBGetContactSettingWString(0, MODULE, buf, &var))
+ if(!db_get_ws(0, MODULE, buf, &var))
{
to.filterName = var.ptszVal;
- DBFreeVariant(&var);
+ db_free(&var);
}
sprintf_s(buf, "Task_filePath_%d", i);
- if(!DBGetContactSettingWString(0, MODULE, buf, &var))
+ if(!db_get_ws(0, MODULE, buf, &var))
{
to.filePath = var.ptszVal;
- DBFreeVariant(&var);
+ db_free(&var);
}
sprintf_s(buf, "Task_taskName_%d", i);
- if(!DBGetContactSettingWString(0, MODULE, buf, &var))
+ if(!db_get_ws(0, MODULE, buf, &var))
{
to.taskName = var.ptszVal;
- DBFreeVariant(&var);
+ db_free(&var);
}
sprintf_s(buf, "Task_zipPassword_%d", i);
- if(!DBGetContactSettingString(0, MODULE, buf, &var))
+ if(!db_get_s(0, MODULE, buf, &var))
{
to.zipPassword = var.pszVal;
- DBFreeVariant(&var);
+ db_free(&var);
}
HANDLE _hContact = db_find_first();
sprintf_s(buf, "IsInTask_%d", i);
while(_hContact)
{
- if(DBGetContactSettingByte(_hContact, MODULE, buf, 0) == 1)
+ if(db_get_b(_hContact, MODULE, buf, 0) == 1)
{
to.contacts.push_back(_hContact);
}
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index e652ce8061..a3915bf255 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -75,9 +75,9 @@ void UpdateTimer() static bool NotifyTyping(HANDLE hContact)
{
- int res = DBGetContactSettingByte(hContact, "SRMsg", "SupportTyping", 2);
+ int res = db_get_b(hContact, "SRMsg", "SupportTyping", 2);
if (res == 2)
- res = DBGetContactSettingByte(NULL, "SRMsg", "DefaultTyping", 1);
+ res = db_get_b(NULL, "SRMsg", "DefaultTyping", 1);
return res != 0;
}
@@ -226,11 +226,11 @@ void DoAnswer(HANDLE hContact, const TalkBot::MessageInfo *info, bool sticky = f void AnswerToContact(HANDLE hContact, const TCHAR* messageToAnswer)
{
- if (Config.TalkWarnContacts && DBGetContactSettingByte(hContact, BOLTUN_KEY,
+ if (Config.TalkWarnContacts && db_get_b(hContact, BOLTUN_KEY,
DB_CONTACT_WARNED, FALSE) == FALSE)
{
DoAnswer(hContact, new TalkBot::MessageInfo((const TCHAR*)Config.WarnText), true);
- DBWriteContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, TRUE);
+ db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, TRUE);
}
else
DoAnswer(hContact, bot->Reply(hContact, messageToAnswer, false));
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index fdf9fbf78c..69cc4f0055 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -188,7 +188,7 @@ static bool LoadMind(const TCHAR* filename, int &line) static bool BoltunAutoChat(HANDLE hContact)
{
- if (DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT
+ if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT
, FALSE) == TRUE)
return false;
@@ -207,11 +207,11 @@ static bool BoltunAutoChat(HANDLE hContact) return true;
}
- if ((DBGetContactSettingByte(hContact,"CList","NotOnList",0) == 1) &&
+ if ((db_get_b(hContact,"CList","NotOnList",0) == 1) &&
Config.TalkWithNotInList)
return true;
- if (DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT,
+ if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT,
FALSE) == TRUE)
return true;
@@ -512,8 +512,8 @@ static int ContactClick(WPARAM wParam, LPARAM lParam, BOOL clickNotToChat) {
HANDLE hContact = (HANDLE)wParam;
- BOOL boltunautochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
- BOOL boltunnottochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
+ BOOL boltunautochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
+ BOOL boltunnottochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
if (clickNotToChat)
{
@@ -532,12 +532,12 @@ static int ContactClick(WPARAM wParam, LPARAM lParam, BOOL clickNotToChat) }
else
{
- DBWriteContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, FALSE);
+ db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, FALSE);
}
}
- DBWriteContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, (BYTE)boltunautochat);
- DBWriteContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, (BYTE)boltunnottochat);
+ db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, (BYTE)boltunautochat);
+ db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, (BYTE)boltunnottochat);
return 0;
}
@@ -564,7 +564,7 @@ static int MessagePrebuild(WPARAM wParam, LPARAM lParam) CLISTMENUITEM clmi = { sizeof(clmi) };
HANDLE hContact = (HANDLE)wParam;
- if (!blInit || (DBGetContactSettingByte(hContact,"CList","NotOnList",0) == 1))
+ if (!blInit || (db_get_b(hContact,"CList","NotOnList",0) == 1))
{
clmi.flags = CMIM_FLAGS | CMIF_GRAYED;
@@ -573,8 +573,8 @@ static int MessagePrebuild(WPARAM wParam, LPARAM lParam) }
else
{
- BOOL boltunautochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
- BOOL boltunnottochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
+ BOOL boltunautochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
+ BOOL boltunnottochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
clmi.flags = CMIM_FLAGS | CMIM_ICON | (boltunautochat ? CMIF_CHECKED : 0);
clmi.hIcon = LoadIcon( GetModuleHandle(NULL), MAKEINTRESOURCE((boltunautochat ? IDI_TICK : IDI_NOTICK)));
@@ -649,7 +649,7 @@ extern "C" int __declspec(dllexport) Load(void) MessageBox(NULL, path, TranslateTS(BOLTUN_ERROR), MB_ICONERROR|MB_TASKMODAL|MB_OK);
}
/*record for Uninstall plugin*/
- DBWriteContactSettingString(NULL, "Uninstall", BOLTUN_NAME, BOLTUN_KEY);
+ db_set_s(NULL, "Uninstall", BOLTUN_NAME, BOLTUN_KEY);
return 0;
}
diff --git a/plugins/Boltun/src/config.cpp b/plugins/Boltun/src/config.cpp index b2dcf3849f..b05a560b2b 100644 --- a/plugins/Boltun/src/config.cpp +++ b/plugins/Boltun/src/config.cpp @@ -40,12 +40,12 @@ inline TCHAR* GetString(char* key, const TCHAR* def) {
DBVARIANT dbv;
TCHAR* val;
- if (!DBGetContactSettingTString(NULL, BOLTUN_KEY, key, &dbv))
+ if (!db_get_ts(NULL, BOLTUN_KEY, key, &dbv))
{
size_t len = wcslen(dbv.ptszVal) + 1;
val = new TCHAR[len];
_tcscpy_s(val, len, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
@@ -61,22 +61,22 @@ inline const TCHAR* SetString(char* key, const TCHAR* value) size_t len = _tcslen(value) + 1;
TCHAR* val = new TCHAR[len];
_tcscpy_s(val, len, value);
- DBWriteContactSettingTString(NULL, BOLTUN_KEY, key, val);
+ db_set_ts(NULL, BOLTUN_KEY, key, val);
return val;
}
#define BUILDETTERS(x, str, def) \
const bool BoltunConfig::Get##x() { \
- return DBGetContactSettingDword(NULL, BOLTUN_KEY, str, def) != 0; } \
+ return db_get_dw(NULL, BOLTUN_KEY, str, def) != 0; } \
const bool BoltunConfig::Set##x(const bool value) { \
- DBWriteContactSettingDword(NULL, BOLTUN_KEY, str, value); \
+ db_set_dw(NULL, BOLTUN_KEY, str, value); \
return value; }
#define BUILDINTETTERS(x, str, def) \
const int BoltunConfig::Get##x() { \
- return DBGetContactSettingDword(NULL, BOLTUN_KEY, str, def); } \
+ return db_get_dw(NULL, BOLTUN_KEY, str, def); } \
const int BoltunConfig::Set##x(const int value) { \
- DBWriteContactSettingDword(NULL, BOLTUN_KEY, str, value); \
+ db_set_dw(NULL, BOLTUN_KEY, str, value); \
return value; }
#define BUILDSTRETTERS(x, str, def) \
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 4802db7834..f760da383e 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -309,10 +309,10 @@ static void CreateTrayIcon(bool create) {
NOTIFYICONDATA nim;
DBVARIANT dbVar;
- if (!DBGetContactSettingTString(NULL,MOD_NAME,"ToolTipText",&dbVar))
+ if (!db_get_ts(NULL,MOD_NAME,"ToolTipText",&dbVar))
{
mir_sntprintf(nim.szTip, 64, _T("%s"), dbVar.ptszVal);
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
}
else
lstrcpy(nim.szTip, _T("Miranda NG"));
@@ -333,14 +333,14 @@ static void RestoreOldSettings(void) CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0);
if (g_bOldSetting & OLD_SOUND)
- DBWriteContactSettingByte(NULL,"Skin","UseSound", 1);
+ db_set_b(NULL,"Skin","UseSound", 1);
if (g_bOldSetting & OLD_FLTCONT) // show Floating contacts if needed
{
if(ServiceExists("FloatingContacts/MainHideAllThumbs"))
CallService("FloatingContacts/MainHideAllThumbs",0,0);
else
- DBWriteContactSettingByte(NULL,"FloatingContacts","HideAll", 0);
+ db_set_b(NULL,"FloatingContacts","HideAll", 0);
}
g_bOldSetting = 0;
}
@@ -381,10 +381,10 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) if (g_wMask & OPT_CHANGESTATUS) // is this even needed?
{
- BYTE bReqMode = DBGetContactSettingByte(NULL, MOD_NAME, "stattype", 2);
+ BYTE bReqMode = db_get_b(NULL, MOD_NAME, "stattype", 2);
unsigned uMode = (STATUS_ARR_TO_ID[bReqMode]);
DBVARIANT dbVar;
- if (g_wMask & OPT_USEDEFMSG || DBGetContactSettingTString(NULL,MOD_NAME,"statmsg",&dbVar))
+ if (g_wMask & OPT_USEDEFMSG || db_get_ts(NULL,MOD_NAME,"statmsg",&dbVar))
{
TCHAR *ptszDefMsg = GetDefStatusMsg(uMode, 0);
ChangeAllProtoStatuses(uMode, ptszDefMsg);
@@ -408,7 +408,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) mir_free(ptszParsed);
}else
ChangeAllProtoStatuses(uMode, dbVar.ptszVal);
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
}
}
@@ -427,17 +427,17 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) }
// disable sounds
- if ((g_wMask & OPT_DISABLESNDS) && DBGetContactSettingByte(NULL,"Skin","UseSound",1))
+ if ((g_wMask & OPT_DISABLESNDS) && db_get_b(NULL,"Skin","UseSound",1))
{
// save current
g_bOldSetting |= OLD_SOUND;
- DBWriteContactSettingByte(NULL,"Skin","UseSound",0);
+ db_set_b(NULL,"Skin","UseSound",0);
}
g_bWindowHidden = true;
g_bOldSetting |= OLD_WASHIDDEN;
- DBWriteContactSettingByte(NULL, MOD_NAME, "OldSetting", g_bOldSetting);
+ db_set_b(NULL, MOD_NAME, "OldSetting", g_bOldSetting);
return(0);
} break;
case WM_USER+52: // back
@@ -447,12 +447,12 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) if (g_wMask & OPT_REQPASS){ //password request
DBVARIANT dbVar = {0};
- if (!DBGetContactSettingString(NULL,MOD_NAME,"password",&dbVar))
+ if (!db_get_s(NULL,MOD_NAME,"password",&dbVar))
{
g_fPassRequested = true;
strncpy(g_password, dbVar.pszVal, MAXPASSLEN);
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
CallService( MS_DB_CRYPT_DECODESTRING, MAXPASSLEN+1, ( LPARAM )g_password );
int res = DialogBox(g_hInstance,(MAKEINTRESOURCE(IDD_PASSDIALOGNEW)),GetForegroundWindow(),(DLGPROC)DlgStdInProc);
@@ -508,7 +508,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) PostMessage(hWnd, WM_MOUSEMOVE, 0, (LPARAM)MAKELONG(2, 2)); // reset core's IDLE
g_bWindowHidden = false;
- DBWriteContactSettingByte(NULL, MOD_NAME, "OldSetting", 0);
+ db_set_b(NULL, MOD_NAME, "OldSetting", 0);
return(0);
} break;
default:break;
@@ -579,7 +579,7 @@ static TCHAR *HokeyVkToName(WORD vkKey) static TCHAR *GetBossKeyText(void)
{
- WORD wHotKey = DBGetContactSettingWord(NULL,"SkinHotKeys","Hide/Show Miranda",HOTKEYCODE(HOTKEYF_CONTROL, VK_F12));
+ WORD wHotKey = db_get_w(NULL,"SkinHotKeys","Hide/Show Miranda",HOTKEYCODE(HOTKEYF_CONTROL, VK_F12));
BYTE key = LOBYTE(wHotKey);
BYTE shift = HIBYTE(wHotKey);
@@ -715,7 +715,7 @@ static int EnumProtos(WPARAM wParam, LPARAM lParam) int MirandaLoaded(WPARAM wParam,LPARAM lParam)
{
- g_wMask = DBGetContactSettingWord(NULL,MOD_NAME,"optsmask",DEFAULTSETTING);
+ g_wMask = db_get_w(NULL,MOD_NAME,"optsmask",DEFAULTSETTING);
RegisterCoreHotKeys();
@@ -809,20 +809,20 @@ extern "C" int __declspec(dllexport) Load(void) {
mir_getLP(&pluginInfo);
- g_wMaskAdv = DBGetContactSettingWord(NULL,MOD_NAME,"optsmaskadv",0);
- g_bOldSetting = DBGetContactSettingByte(NULL, MOD_NAME, "OldSetting", 0);
+ g_wMaskAdv = db_get_w(NULL,MOD_NAME,"optsmaskadv",0);
+ g_bOldSetting = db_get_b(NULL, MOD_NAME, "OldSetting", 0);
if ((g_bOldSetting & OLD_POPUP) && !(g_wMaskAdv & OPT_RESTORE)) // Restore popup settings if Miranda was crushed or killed in hidden mode and "Restore hiding on startup after failure" option is disabled
{
- if (DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) == 0)
- DBWriteContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1);
- if (DBGetContactSettingByte(NULL, "YAPP", "Enabled", 1) == 0)
- DBWriteContactSettingByte(NULL, "YAPP", "Enabled", 1);
+ if (db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) == 0)
+ db_set_b(NULL, "PopUp", "ModuleIsEnabled", 1);
+ if (db_get_b(NULL, "YAPP", "Enabled", 1) == 0)
+ db_set_b(NULL, "YAPP", "Enabled", 1);
}
- if (g_wMaskAdv & OPT_HIDEONSTART && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 0)) // hack for disabling popup on startup if "Hide Miranda on startup" is enabled
+ if (g_wMaskAdv & OPT_HIDEONSTART && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 0)) // hack for disabling popup on startup if "Hide Miranda on startup" is enabled
{
g_bOldSetting |= OLD_POPUP;
- DBWriteContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 0);
+ db_set_b(NULL, "PopUp", "ModuleIsEnabled", 0);
}
Icon_Register(g_hInstance, "BossKey", iconList, SIZEOF(iconList));
diff --git a/plugins/BossKeyPlus/src/BossKeyIdle.cpp b/plugins/BossKeyPlus/src/BossKeyIdle.cpp index eba26fd29e..a71bd2200c 100644 --- a/plugins/BossKeyPlus/src/BossKeyIdle.cpp +++ b/plugins/BossKeyPlus/src/BossKeyIdle.cpp @@ -80,7 +80,7 @@ VOID CALLBACK IdleTimer(HWND hwnd, UINT umsg, UINT_PTR idEvent, DWORD dwTime) void InitIdleTimer()
{
- minutes = DBGetContactSettingByte(NULL,MOD_NAME,"time",10);
+ minutes = db_get_b(NULL,MOD_NAME,"time",10);
MyGetLastInputInfo=(BOOL (WINAPI *)(LASTINPUTINFO*))GetProcAddress(GetModuleHandleA("user32"), "GetLastInputInfo");
hTimer=SetTimer(NULL, 0, 2000, IdleTimer);
}
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index 9947eb3073..01b0b073ae 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -69,12 +69,12 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) DBVARIANT dbVar;
- if (!DBGetContactSettingString(NULL,MOD_NAME,"password",&dbVar))
+ if (!db_get_s(NULL,MOD_NAME,"password",&dbVar))
{
CallService( MS_DB_CRYPT_DECODESTRING, strlen( dbVar.pszVal )+1, ( LPARAM )dbVar.pszVal );
SetDlgItemTextA(hwndDlg,IDC_MAINOPT_PASS,dbVar.pszVal);
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
}
CheckDlgButton(hwndDlg,IDC_MAINOPT_SETONLINEBACK,(g_wMask & OPT_SETONLINEBACK) ? (BST_CHECKED) : (BST_UNCHECKED));
@@ -90,7 +90,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) for (BYTE i = 0;i < 8; i++)
SendDlgItemMessage(hwndDlg,IDC_MAINOPT_CHGSTS,CB_INSERTSTRING,-1,(LPARAM)TranslateTS(STATUS_ARR_TO_NAME[i]));
- SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_SETCURSEL, DBGetContactSettingByte(NULL, MOD_NAME, "stattype", 2), 0);
+ SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_SETCURSEL, db_get_b(NULL, MOD_NAME, "stattype", 2), 0);
SendMessage(hwndDlg,WM_USER + 60,0,0);
SendMessage(hwndDlg,WM_USER + 50,0,0);
@@ -112,7 +112,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) // write down status type
if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_CHANGESTATUSBOX) == BST_CHECKED)
{
- DBWriteContactSettingByte(NULL,MOD_NAME,"stattype",(BYTE)SendDlgItemMessage(hwndDlg,IDC_MAINOPT_CHGSTS,CB_GETCURSEL,0,0));
+ db_set_b(NULL,MOD_NAME,"stattype",(BYTE)SendDlgItemMessage(hwndDlg,IDC_MAINOPT_CHGSTS,CB_GETCURSEL,0,0));
// status msg, if needed
if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_MAINOPT_STATMSG))) // meaning we should save it
@@ -120,9 +120,9 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) TCHAR tszMsg[1025];
GetDlgItemText(hwndDlg,IDC_MAINOPT_STATMSG,tszMsg,1024);
if (lstrlen(tszMsg) != 0)
- DBWriteContactSettingTString(NULL,MOD_NAME,"statmsg",tszMsg);
+ db_set_ts(NULL,MOD_NAME,"statmsg",tszMsg);
else // delete current setting
- DBDeleteContactSetting(NULL,MOD_NAME,"statmsg");
+ db_unset(NULL,MOD_NAME,"statmsg");
}
wMask |= OPT_CHANGESTATUS;
}
@@ -134,7 +134,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) GetDlgItemTextA(hwndDlg,IDC_MAINOPT_PASS,szPass,MAXPASSLEN+1);
if (strlen(szPass) != 0){
CallService( MS_DB_CRYPT_ENCODESTRING, MAXPASSLEN+1, ( LPARAM )szPass );
- DBWriteContactSettingString(NULL,MOD_NAME,"password",szPass);
+ db_set_s(NULL,MOD_NAME,"password",szPass);
wMask |= OPT_REQPASS;
}
}
@@ -144,7 +144,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_USEDEFMSG) == BST_CHECKED) wMask |= OPT_USEDEFMSG;
if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_TRAYICON) == BST_CHECKED) wMask |= OPT_TRAYICON;
- DBWriteContactSettingWord(NULL,MOD_NAME,"optsmask",wMask);
+ db_set_w(NULL,MOD_NAME,"optsmask",wMask);
g_wMask = wMask;
return(true);
@@ -166,10 +166,10 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) {
DBVARIANT dbVar;
SendDlgItemMessage(hwndDlg,IDC_MAINOPT_STATMSG,EM_LIMITTEXT,1024,0);
- if (!DBGetContactSettingTString(NULL,MOD_NAME,"statmsg",&dbVar))
+ if (!db_get_ts(NULL,MOD_NAME,"statmsg",&dbVar))
{
SetDlgItemText(hwndDlg,IDC_MAINOPT_STATMSG,dbVar.ptszVal);
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
}
}
EnableWindow(GetDlgItem(hwndDlg,IDC_MAINOPT_STATMSG),(IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_CHANGESTATUSBOX) == BST_CHECKED) && (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_USEDEFMSG) != BST_CHECKED));
@@ -283,7 +283,7 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) g_fOptionsOpen = true;
- minutes = DBGetContactSettingByte(NULL,MOD_NAME,"time",10);
+ minutes = db_get_b(NULL,MOD_NAME,"time",10);
char szMinutes[4] = {0};
_itoa(minutes, szMinutes, 10);
SendDlgItemMessage(hwndDlg,IDC_MAINOPT_TIME,EM_LIMITTEXT,2,0);
@@ -324,8 +324,8 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) char szMinutes[4] = {0};
GetDlgItemTextA(hwndDlg,IDC_MAINOPT_TIME,szMinutes,3);
(atoi(szMinutes) > 0) ? minutes = atoi(szMinutes) : minutes = 1;
- DBWriteContactSettingByte(NULL,MOD_NAME,"time",minutes);
- DBWriteContactSettingWord(NULL,MOD_NAME,"optsmaskadv",wMaskAdv);
+ db_set_b(NULL,MOD_NAME,"time",minutes);
+ db_set_w(NULL,MOD_NAME,"optsmaskadv",wMaskAdv);
g_wMaskAdv = wMaskAdv;
return(true);
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index d3a55b4afa..13a6303ee3 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -447,24 +447,17 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) return 0;
CLISTMENUITEM mi = { sizeof(mi) };
-
- 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;
-
+ mi.flags = CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
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");
mi.icolibItem = iconList[1].hIcolib;
}
else {
- mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.ptszName = LPGENT("Enable Miss You");
mi.icolibItem = iconList[2].hIcolib;
}
Menu_ModifyItem(hContactMenu, &mi);
-
+ Menu_ShowItem(hContactMenu, !db_get_b((HANDLE)wParam, proto, "ChatRoom", 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND));
return 0;
}
@@ -496,7 +489,7 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) return 0;
int currentStatus = inf->value.wVal;
- int prevStatus = DBGetContactSettingWord(hContact, "UserOnline", "OldStatus", ID_STATUS_OFFLINE);
+ int prevStatus = db_get_w(hContact, "UserOnline", "OldStatus", ID_STATUS_OFFLINE);
if (currentStatus == prevStatus)
return 0;
@@ -722,8 +715,8 @@ extern "C" int __declspec(dllexport) Load(void) HANDLE hContact = db_find_first();
DWORD current_time = (DWORD)time(0);
while (hContact != 0) {
- if ( !DBGetContactSetting(hContact, MODULE_NAME, "CreationTime", &dbv))
- DBFreeVariant(&dbv);
+ if ( !db_get(hContact, MODULE_NAME, "CreationTime", &dbv))
+ db_free(&dbv);
else
db_set_dw(hContact, MODULE_NAME, "CreationTime", current_time);
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index 202d83d2ff..3cd321b1d7 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -469,7 +469,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar else
{
/*
- int status = DBGetContactSettingWord((HANDLE)lparam, MODULE_NAME, "LastStatus", ID_STATUS_OFFLINE);
+ int status = db_get_w((HANDLE)lparam, MODULE_NAME, "LastStatus", ID_STATUS_OFFLINE);
char *strptr = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, 0);
*/
_tcsftime(tmpBuf, 50, _T("%#x"), gmtime(&tmpTime));
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index a3ff2cb3f0..7730653313 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -76,11 +76,11 @@ void getDefaultMessage(HWND hwnd, UINT control, HANDLE hContact) DBVARIANT dbv;
if (!db_get_ts(hContact, modname, "PounceMsg", &dbv)) {
SetDlgItemText(hwnd, control, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else if (!db_get_ts(NULL, modname, "PounceMsg", &dbv)) {
SetDlgItemText(hwnd, control, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -333,7 +333,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l db_set_w(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfTheirStatusIsFLAG",0));
db_set_b(hContact, modname, "Reuse",(BYTE)db_get_b(NULL, modname, "Reuse",0));
db_set_b(hContact, modname, "GiveUpDays", (BYTE)db_get_b(NULL, modname, "GiveUpDays",0));
- db_set_dw(hContact, modname, "GiveUpDate", (DWORD)DBGetContactSettingDword(NULL, modname, "GiveUpDate",0));
+ db_set_dw(hContact, modname, "GiveUpDate", (DWORD)db_get_dw(NULL, modname, "GiveUpDate",0));
db_set_w(hContact, modname, "ConfirmTimeout", (WORD)db_get_w(NULL, modname, "ConfirmTimeout",0));
}
break;
@@ -536,7 +536,7 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)spdps);
if (db_get_ts(spdps->hContact, modname, "PounceMsg", &dbv)) DestroyWindow(hwnd);
SetDlgItemText(hwnd,IDC_MESSAGE, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SetTimer(hwnd,1,1000,NULL);
SendMessage(hwnd,WM_TIMER,0,0);
}
@@ -587,7 +587,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (db_get_ts(hContact, modname, "PounceMsg", &dbv))
DestroyWindow(hwnd);
SetDlgItemText(hwnd, IDC_MESSAGE, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case WM_COMMAND:
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index f95b995798..1b92532deb 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -186,7 +186,7 @@ int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) else SendPounce(dbv.ptszVal, hContact);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -228,7 +228,7 @@ INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) _tcscat(newPounce, message);
db_set_ws(hContact, modname, "PounceMsg", newPounce);
mir_free(newPounce);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else AddSimpleMessage((WPARAM)hContact, (LPARAM)message);
return 0;
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index bf2f093749..4fe55e4279 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -270,14 +270,14 @@ void importCustomStatuses(CSWindow* csw, int result) si->m_iIcon = i-1;
mir_snprintf(bufTitle, 32, "XStatus%dName", i);
- if ( !DBGetContactSettingTString( NULL, protoName, bufTitle, &dbv )) {
+ if ( !db_get_ts( NULL, protoName, bufTitle, &dbv )) {
lstrcpy(si->m_tszTitle, dbv.ptszVal);
db_free(&dbv);
}
else si->m_tszTitle[0] = 0;
mir_snprintf(bufMessage, 32, "XStatus%dMsg", i);
- if ( !DBGetContactSettingTString( NULL, protoName, bufMessage, &dbv )) {
+ if ( !db_get_ts( NULL, protoName, bufMessage, &dbv )) {
lstrcpy(si->m_tszMessage, dbv.ptszVal);
db_free(&dbv);
}
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index ea788fb912..61da136140 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -27,55 +27,55 @@ INT_PTR APIChangeTextLayout(WPARAM wParam, LPARAM lParam) void ReadMainOptions()
{
- moOptions.dwHotkey_Layout = DBGetContactSettingDword(NULL, ModuleName, "HotkeyLayout", 119);
- moOptions.dwHotkey_Layout2 = DBGetContactSettingDword(NULL, ModuleName, "HotkeyLayout2", 120);
- moOptions.dwHotkey_Case = DBGetContactSettingDword(NULL, ModuleName, "HotkeyCase", 121);
- moOptions.CurrentWordLayout = DBGetContactSettingByte(NULL, ModuleName, "CurrentWordLayout", 0);
- moOptions.CurrentWordLayout2 = DBGetContactSettingByte(NULL, ModuleName, "CurrentWordLayout2", 1);
- moOptions.CurrentWordCase = DBGetContactSettingByte(NULL, ModuleName, "CurrentWordCase", 0);
- moOptions.TwoWay = DBGetContactSettingByte(NULL, ModuleName, "TwoWay", 1);
- moOptions.ChangeSystemLayout = DBGetContactSettingByte(NULL, ModuleName, "ChangeSystemLayout", 1);
- moOptions.CopyToClipboard = DBGetContactSettingByte(NULL, ModuleName, "CopyToClipboard", 0);
- moOptions.ShowPopup = DBGetContactSettingByte(NULL, ModuleName, "ShowPopup", 1);
- moOptions.bCaseOperations = DBGetContactSettingByte(NULL, ModuleName, "CaseOperations", 0);
+ moOptions.dwHotkey_Layout = db_get_dw(NULL, ModuleName, "HotkeyLayout", 119);
+ moOptions.dwHotkey_Layout2 = db_get_dw(NULL, ModuleName, "HotkeyLayout2", 120);
+ moOptions.dwHotkey_Case = db_get_dw(NULL, ModuleName, "HotkeyCase", 121);
+ moOptions.CurrentWordLayout = db_get_b(NULL, ModuleName, "CurrentWordLayout", 0);
+ moOptions.CurrentWordLayout2 = db_get_b(NULL, ModuleName, "CurrentWordLayout2", 1);
+ moOptions.CurrentWordCase = db_get_b(NULL, ModuleName, "CurrentWordCase", 0);
+ moOptions.TwoWay = db_get_b(NULL, ModuleName, "TwoWay", 1);
+ moOptions.ChangeSystemLayout = db_get_b(NULL, ModuleName, "ChangeSystemLayout", 1);
+ moOptions.CopyToClipboard = db_get_b(NULL, ModuleName, "CopyToClipboard", 0);
+ moOptions.ShowPopup = db_get_b(NULL, ModuleName, "ShowPopup", 1);
+ moOptions.bCaseOperations = db_get_b(NULL, ModuleName, "CaseOperations", 0);
}
void WriteMainOptions()
{
- DBWriteContactSettingDword(NULL, ModuleName, "HotkeyLayout", moOptions.dwHotkey_Layout);
- DBWriteContactSettingDword(NULL, ModuleName, "HotkeyLayout2", moOptions.dwHotkey_Layout2);
- DBWriteContactSettingDword(NULL, ModuleName, "HotkeyCase", moOptions.dwHotkey_Case);
- DBWriteContactSettingByte(NULL, ModuleName, "CurrentWordLayout", moOptions.CurrentWordLayout);
- DBWriteContactSettingByte(NULL, ModuleName, "CurrentWordLayout2", moOptions.CurrentWordLayout2);
- DBWriteContactSettingByte(NULL, ModuleName, "CurrentWordCase", moOptions.CurrentWordCase);
- DBWriteContactSettingByte(NULL, ModuleName, "TwoWay", moOptions.TwoWay);
- DBWriteContactSettingByte(NULL, ModuleName, "ChangeSystemLayout", moOptions.ChangeSystemLayout);
- DBWriteContactSettingByte(NULL, ModuleName, "CopyToClipboard", moOptions.CopyToClipboard);
- DBWriteContactSettingByte(NULL, ModuleName, "ShowPopup", moOptions.ShowPopup);
- DBWriteContactSettingByte(NULL, ModuleName, "CaseOperations", moOptions.bCaseOperations);
+ db_set_dw(NULL, ModuleName, "HotkeyLayout", moOptions.dwHotkey_Layout);
+ db_set_dw(NULL, ModuleName, "HotkeyLayout2", moOptions.dwHotkey_Layout2);
+ db_set_dw(NULL, ModuleName, "HotkeyCase", moOptions.dwHotkey_Case);
+ db_set_b(NULL, ModuleName, "CurrentWordLayout", moOptions.CurrentWordLayout);
+ db_set_b(NULL, ModuleName, "CurrentWordLayout2", moOptions.CurrentWordLayout2);
+ db_set_b(NULL, ModuleName, "CurrentWordCase", moOptions.CurrentWordCase);
+ db_set_b(NULL, ModuleName, "TwoWay", moOptions.TwoWay);
+ db_set_b(NULL, ModuleName, "ChangeSystemLayout", moOptions.ChangeSystemLayout);
+ db_set_b(NULL, ModuleName, "CopyToClipboard", moOptions.CopyToClipboard);
+ db_set_b(NULL, ModuleName, "ShowPopup", moOptions.ShowPopup);
+ db_set_b(NULL, ModuleName, "CaseOperations", moOptions.bCaseOperations);
}
void ReadPopupOptions()
{
- poOptions.bColourType = DBGetContactSettingByte(NULL, ModuleName, "ColourType", 0);
- poOptions.crBackColour = (COLORREF)DBGetContactSettingDword(NULL, ModuleName, "BackColor", 0xD2CABF);
- poOptions.crTextColour = (COLORREF)DBGetContactSettingDword(NULL, ModuleName, "TextColor", 0x000000);
- poOptions.bTimeoutType = DBGetContactSettingByte(NULL, ModuleName, "TimeoutType", 0);
- poOptions.bTimeout = DBGetContactSettingByte(NULL, ModuleName, "Timeout", 10);
- poOptions.bLeftClick = DBGetContactSettingByte(NULL, ModuleName, "LeftClick", 0);
- poOptions.bRightClick = DBGetContactSettingByte(NULL, ModuleName, "RightClick", 1);
+ poOptions.bColourType = db_get_b(NULL, ModuleName, "ColourType", 0);
+ poOptions.crBackColour = (COLORREF)db_get_dw(NULL, ModuleName, "BackColor", 0xD2CABF);
+ poOptions.crTextColour = (COLORREF)db_get_dw(NULL, ModuleName, "TextColor", 0x000000);
+ poOptions.bTimeoutType = db_get_b(NULL, ModuleName, "TimeoutType", 0);
+ poOptions.bTimeout = db_get_b(NULL, ModuleName, "Timeout", 10);
+ poOptions.bLeftClick = db_get_b(NULL, ModuleName, "LeftClick", 0);
+ poOptions.bRightClick = db_get_b(NULL, ModuleName, "RightClick", 1);
}
void WritePopupOptions()
{
- DBWriteContactSettingByte(NULL, ModuleName, "ColourType", poOptions.bColourType);
- DBWriteContactSettingDword(NULL, ModuleName, "BackColor", poOptions.crBackColour);
- DBWriteContactSettingDword(NULL, ModuleName, "TextColor", poOptions.crTextColour);
- DBWriteContactSettingByte(NULL, ModuleName, "TimeoutType", poOptions.bTimeoutType);
- DBWriteContactSettingByte(NULL, ModuleName, "Timeout", poOptions.bTimeout);
- DBWriteContactSettingByte(NULL, ModuleName, "LeftClick", poOptions.bLeftClick);
- DBWriteContactSettingByte(NULL, ModuleName, "RightClick", poOptions.bRightClick);
+ db_set_b(NULL, ModuleName, "ColourType", poOptions.bColourType);
+ db_set_dw(NULL, ModuleName, "BackColor", poOptions.crBackColour);
+ db_set_dw(NULL, ModuleName, "TextColor", poOptions.crTextColour);
+ db_set_b(NULL, ModuleName, "TimeoutType", poOptions.bTimeoutType);
+ db_set_b(NULL, ModuleName, "Timeout", poOptions.bTimeout);
+ db_set_b(NULL, ModuleName, "LeftClick", poOptions.bLeftClick);
+ db_set_b(NULL, ModuleName, "RightClick", poOptions.bRightClick);
}
void RegPopupActions()
@@ -117,7 +117,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) for (i = 0; i < bLayNum; i++) {
ptszCurrLayout = GenerateLayoutString(hklLayouts[i]);
ptszTemp = GetNameOfLayout(hklLayouts[i]);
- iRes = DBGetContactSettingTString(NULL, ModuleName, ptszTemp, &dbv);
+ iRes = db_get_ts(NULL, ModuleName, ptszTemp, &dbv);
if (iRes != 0)
ptszLayStrings[i] = ptszCurrLayout;
else
@@ -129,7 +129,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
ptszLayStrings[i] = dbv.ptszVal;
if(_tcscmp(ptszCurrLayout, ptszLayStrings[i]) == 0)
- DBDeleteContactSetting(NULL, ModuleName, ptszTemp);
+ db_unset(NULL, ModuleName, ptszTemp);
mir_free(ptszCurrLayout);
}
mir_free(ptszTemp);
@@ -161,7 +161,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) OnIconsChanged(0, 0);
RegPopupActions();
- DBWriteContactSettingDword(NULL, ModuleName, "CurrentVer", PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM));
+ db_set_dw(NULL, ModuleName, "CurrentVer", PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM));
return 0;
}
diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index 1136e4b15a..3eaab6917f 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -211,9 +211,9 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP pszNameLay = GetNameOfLayout(hklLayouts[i]);
if(_tcscmp(ptszMemLay, ptszGenLay) != 0)
- DBWriteContactSettingTString(NULL, ModuleName, pszNameLay, ptszMemLay);
+ db_set_ts(NULL, ModuleName, pszNameLay, ptszMemLay);
else
- DBDeleteContactSetting(NULL, ModuleName, pszNameLay);
+ db_unset(NULL, ModuleName, pszNameLay);
mir_free(pszNameLay);
mir_free(ptszGenLay);
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index b57836ab78..dac4399850 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -184,7 +184,7 @@ void ShowPopup(SHOWPOPUP_DATA *sd) _ASSERT(ppd.lchIcon);
if (!ppd.lchIcon || (DWORD)ppd.lchIcon == CALLSERVICE_NOTFOUND) {
// if we didn't succeed retrieving client icon, show the usual status icon instead
- ppd.lchIcon = LoadSkinnedProtoIcon(szProto, DBGetContactSettingWord(sd->hContact, szProto, "Status", ID_STATUS_OFFLINE));
+ ppd.lchIcon = LoadSkinnedProtoIcon(szProto, db_get_w(sd->hContact, szProto, "Status", ID_STATUS_OFFLINE));
pdata->hIcon = NULL;
}
_tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)sd->hContact, GCDNF_TCHAR), lengthof(ppd.lptzContactName) - 1);
@@ -216,12 +216,12 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) if (bMetaContactsExists && !strcmp(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) // workaround for metacontacts
return 0;
- sd.MirVer = DBGetContactSettingString(hContact, szProto, DB_MIRVER, _T(""));
+ sd.MirVer = db_get_s(hContact, szProto, DB_MIRVER, _T(""));
if (sd.MirVer.IsEmpty())
return 0;
}
- sd.OldMirVer = DBGetContactSettingString(hContact, MOD_NAME, DB_OLDMIRVER, _T(""));
- DBWriteContactSettingTString(hContact, MOD_NAME, DB_OLDMIRVER, sd.MirVer); // we have to write it here, because we modify sd.OldMirVer and sd.MirVer to conform our settings later
+ sd.OldMirVer = db_get_s(hContact, MOD_NAME, DB_OLDMIRVER, _T(""));
+ db_set_ts(hContact, MOD_NAME, DB_OLDMIRVER, sd.MirVer); // we have to write it here, because we modify sd.OldMirVer and sd.MirVer to conform our settings later
if (sd.OldMirVer.IsEmpty()) // looks like it's the right way to do
return 0;
@@ -237,14 +237,14 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) if (!hContactOrMeta)
hContactOrMeta = hContact;
- if (hContact && DBGetContactSettingByte(hContactOrMeta, "CList", "Hidden", 0))
+ if (hContact && db_get_b(hContactOrMeta, "CList", "Hidden", 0))
return 0;
- int PerContactSetting = hContact ? DBGetContactSettingByte(hContact, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL) : NOTIFY_ALWAYS; // NOTIFY_ALWAYS for preview
+ int PerContactSetting = hContact ? db_get_b(hContact, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL) : NOTIFY_ALWAYS; // NOTIFY_ALWAYS for preview
if (PerContactSetting == NOTIFY_USEGLOBAL && hContactOrMeta != hContact) // subcontact setting has a priority over a metacontact setting
- PerContactSetting = DBGetContactSettingByte(hContactOrMeta, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL);
+ PerContactSetting = db_get_b(hContactOrMeta, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL);
- if (PerContactSetting && (PerContactSetting == NOTIFY_ALMOST_ALWAYS || PerContactSetting == NOTIFY_ALWAYS || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_USESTATUSNOTIFYFLAG) || !(DBGetContactSettingDword(hContactOrMeta, "Ignore", "Mask1", 0) & 0x8))) { // check if we need to notify at all
+ if (PerContactSetting && (PerContactSetting == NOTIFY_ALMOST_ALWAYS || PerContactSetting == NOTIFY_ALWAYS || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_USESTATUSNOTIFYFLAG) || !(db_get_dw(hContactOrMeta, "Ignore", "Mask1", 0) & 0x8))) { // check if we need to notify at all
sd.hContact = hContact;
sd.PopupOptPage = &PopupOptPage;
if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER)) {
@@ -365,7 +365,7 @@ INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case WM_DESTROY:
if (IsDlgButtonChecked(hwndDlg, IDC_DONTREMIND))
- DBWriteContactSettingByte(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 1);
+ db_set_b(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 1);
break;
}
return 0;
@@ -411,7 +411,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) }
// seems that Fingerprint is not installed
- if (!bFingerprintExists && !DBGetContactSettingByte(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0))
+ if (!bFingerprintExists && !db_get_b(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0))
CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), NULL, CCNErrorDlgProc);
logservice_register(LOG_ID, LPGENT("ClientChangeNotify"), _T("ClientChangeNotify?puts(p,?dbsetting(%subject%,Protocol,p))?if2(_?dbsetting(,?get(p),?pinfo(?get(p),uidsetting)),).log"), TranslateT("`[`!cdate()-!ctime()`]` ?cinfo(%subject%,display) (?cinfo(%subject%,id)) changed client to %extratext%"));
@@ -425,16 +425,16 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded);
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &g_hMainThread, THREAD_SET_CONTEXT, false, 0);
InitOptions();
- if (DBGetContactSettingString(NULL, "KnownModules", MOD_NAME, (char*)NULL) == NULL)
- DBWriteContactSettingString(NULL, "KnownModules", MOD_NAME, MOD_NAME);
+ if (db_get_s(NULL, "KnownModules", MOD_NAME, (char*)NULL) == NULL)
+ db_set_s(NULL, "KnownModules", MOD_NAME, MOD_NAME);
- if (DBGetContactSettingByte(NULL, MOD_NAME, DB_SETTINGSVER, 0) < 1) {
+ if (db_get_b(NULL, MOD_NAME, DB_SETTINGSVER, 0) < 1) {
TCString Str;
- Str = DBGetContactSettingString(NULL, MOD_NAME, DB_IGNORESUBSTRINGS, _T(""));
+ Str = db_get_s(NULL, MOD_NAME, DB_IGNORESUBSTRINGS, _T(""));
if (Str.GetLen()) // fix incorrect regexp from v0.1.1.0
- DBWriteContactSettingTString(NULL, MOD_NAME, DB_IGNORESUBSTRINGS, Str.Replace(_T("/Miranda[0-9A-F]{8}/"), _T("/[0-9A-F]{8}(\\W|$)/")));
+ db_set_ts(NULL, MOD_NAME, DB_IGNORESUBSTRINGS, Str.Replace(_T("/Miranda[0-9A-F]{8}/"), _T("/[0-9A-F]{8}(\\W|$)/")));
- DBWriteContactSettingByte(NULL, MOD_NAME, DB_SETTINGSVER, 1);
+ db_set_b(NULL, MOD_NAME, DB_SETTINGSVER, 1);
}
return 0;
}
diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index d86c6a473e..7edc46a53c 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -140,7 +140,7 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara DBCONTACTWRITESETTING cws = {0};
cws.szModule = "ICQ";
cws.szSetting = DB_MIRVER;
- DBWriteContactSettingString(NULL, MOD_NAME, DB_OLDMIRVER, "ICQ Lite v5");
+ db_set_s(NULL, MOD_NAME, DB_OLDMIRVER, "ICQ Lite v5");
ContactSettingChanged(NULL, (LPARAM)&cws); // simulate a version change
delete g_PreviewOptPage;
g_PreviewOptPage = NULL;
diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp index 462fc9d5e7..f81e31abe0 100644 --- a/plugins/Clist_blind/src/clcopts.cpp +++ b/plugins/Clist_blind/src/clcopts.cpp @@ -131,7 +131,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam GetWindowLong(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
{
int i;
- DWORD exStyle = DBGetContactSettingDword(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
+ DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
for (i = 0; i < SIZEOF(checkBoxToStyleEx); i++)
CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id,
(exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag *
@@ -142,24 +142,24 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, SIZEOF(accel), (LPARAM) & accel);
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingWord(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
+ MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
}
- CheckDlgButton(hwndDlg, IDC_IDLE, DBGetContactSettingByte(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IDLE, db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(64, 0));
SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingByte(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN), 0));
+ MAKELONG(db_get_b(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN), 0));
SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0));
SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingByte(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT), 0));
+ MAKELONG(db_get_b(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT), 0));
CheckDlgButton(hwndDlg, IDC_GREYOUT,
- DBGetContactSettingDword(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING));
EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, SIZEOF(greyoutValues),
- DBGetContactSettingDword(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
+ db_get_dw(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, SIZEOF(offlineValues),
- DBGetContactSettingDword(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
- CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, DBGetContactSettingByte(NULL, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
+ CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(NULL, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(hwndDlg, IDC_T_CONTACT, MyDBGetContactSettingTString(NULL, "CLC", "TemplateContact", tmp, 1024, TranslateT("%name% [%status% %protocol%] %status_message%")));
SendDlgItemMessage(hwndDlg, IDC_T_CONTACT, EM_LIMITTEXT, 256, 0);
@@ -212,33 +212,33 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not)
exStyle |= checkBoxToStyleEx[i].flag;
- DBWriteContactSettingDword(NULL, "CLC", "ExStyle", exStyle);
+ db_set_dw(NULL, "CLC", "ExStyle", exStyle);
{
DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS));
- DBWriteContactSettingDword(NULL, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
+ db_set_dw(NULL, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
if (IsDlgButtonChecked(hwndDlg, IDC_GREYOUT))
- DBWriteContactSettingDword(NULL, "CLC", "GreyoutFlags", fullGreyoutFlags);
+ db_set_dw(NULL, "CLC", "GreyoutFlags", fullGreyoutFlags);
else
- DBWriteContactSettingDword(NULL, "CLC", "GreyoutFlags", 0);
+ db_set_dw(NULL, "CLC", "GreyoutFlags", 0);
}
- DBWriteContactSettingByte(NULL, "CLC", "ShowIdle", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0));
- DBWriteContactSettingDword(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
- DBWriteContactSettingByte(NULL, "CLC", "LeftMargin",
+ db_set_b(NULL, "CLC", "ShowIdle", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0));
+ db_set_dw(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
+ db_set_b(NULL, "CLC", "LeftMargin",
(BYTE) SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, "CLC", "ScrollTime",
+ db_set_w(NULL, "CLC", "ScrollTime",
(WORD) SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CLC", "GroupIndent",
+ db_set_b(NULL, "CLC", "GroupIndent",
(BYTE) SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CLC", "NoVScrollBar", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
+ db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
GetDlgItemText(hwndDlg, IDC_T_CONTACT, tmp, 1024);
- DBWriteContactSettingTString(NULL, "CLC", "TemplateContact", tmp);
+ db_set_ts(NULL, "CLC", "TemplateContact", tmp);
GetDlgItemText(hwndDlg, IDC_T_GROUP, tmp, 1024);
- DBWriteContactSettingTString(NULL, "CLC", "TemplateGroup", tmp);
+ db_set_ts(NULL, "CLC", "TemplateGroup", tmp);
GetDlgItemText(hwndDlg, IDC_T_DIVIDER, tmp, 1024);
- DBWriteContactSettingTString(NULL, "CLC", "TemplateDivider", tmp);
+ db_set_ts(NULL, "CLC", "TemplateDivider", tmp);
GetDlgItemText(hwndDlg, IDC_T_INFO, tmp, 1024);
- DBWriteContactSettingTString(NULL, "CLC", "TemplateInfo", tmp);
+ db_set_ts(NULL, "CLC", "TemplateInfo", tmp);
pcli->pfnClcOptionsChanged();
return TRUE;
diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp index e5ad505615..d7811cb19b 100644 --- a/plugins/Clist_blind/src/clistopts.cpp +++ b/plugins/Clist_blind/src/clistopts.cpp @@ -43,23 +43,23 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1));
- CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE,
- DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS,
- DBGetContactSettingByte(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS,
- DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_SORTBYNAME, !DBGetContactSettingByte(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT)
- && !DBGetContactSettingByte(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_SORTBYNAME, !db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT)
+ && !db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS,
- DBGetContactSettingByte(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SORTBYPROTO,
- DBGetContactSettingByte(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE,
- DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTOHIDE,
- DBGetContactSettingByte(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
{
@@ -79,24 +79,24 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1));
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
+ MAKELONG(db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
CheckDlgButton(hwndDlg, IDC_ONECLK,
- DBGetContactSettingByte(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS,
- DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI,
- !DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ !db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DONTCYCLE,
- DBGetContactSettingByte(NULL, "CList", "TrayIcon",
+ db_get_b(NULL, "CList", "TrayIcon",
SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CYCLE,
- DBGetContactSettingByte(NULL, "CList", "TrayIcon",
+ db_get_b(NULL, "CList", "TrayIcon",
SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_MULTITRAY,
- DBGetContactSettingByte(NULL, "CList", "TrayIcon",
+ db_get_b(NULL, "CList", "TrayIcon",
SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEBLINK,
- DBGetContactSettingByte(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKTIME), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
EnableWindow(GetDlgItem(hwndDlg, IDC_STMSDELAY), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
@@ -116,13 +116,13 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1));
SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
+ MAKELONG(db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
{
int i, count, item;
PROTOACCOUNT **accs;
char szName[64];
DBVARIANT dbv = { DBVT_DELETED };
- DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv);
+ db_get(NULL, "CList", "PrimaryStatus", &dbv);
CallService( MS_PROTO_ENUMACCOUNTS, (WPARAM)&count, (LPARAM)&accs);
item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) TranslateT("Global"));
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM) 0);
@@ -135,13 +135,13 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dbv.type == DBVT_ASCIIZ && !lstrcmpA(dbv.pszVal, accs[i]->szModuleName))
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (-1 == (int) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0))
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM) GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy
SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250));
- SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550), 0));
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "IconFlashTime", 550), 0));
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDC_AUTOHIDE) {
@@ -174,48 +174,48 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case 0:
switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
- DBWriteContactSettingByte(NULL, "CList", "HideOffline", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
+ db_set_b(NULL, "CList", "HideOffline", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
{
DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0);
if (caps & CLUIF_HIDEEMPTYGROUPS)
- DBWriteContactSettingByte(NULL, "CList", "HideEmptyGroups",
+ db_set_b(NULL, "CList", "HideEmptyGroups",
(BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
if (caps & CLUIF_DISABLEGROUPS)
- DBWriteContactSettingByte(NULL, "CList", "UseGroups", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
+ db_set_b(NULL, "CList", "UseGroups", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
if (!(caps & CLUIF_HASONTOPOPTION)) {
- DBWriteContactSettingByte(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
+ db_set_b(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
SetWindowPos( pcli->hwndContactList,
IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
}
if (!(caps & CLUIF_HASAUTOHIDEOPTION)) {
- DBWriteContactSettingByte(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- DBWriteContactSettingWord(NULL, "CList", "HideTime",
+ db_set_b(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
+ db_set_w(NULL, "CList", "HideTime",
(WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
}
}
- DBWriteContactSettingByte(NULL, "CList", "SortByStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS));
- DBWriteContactSettingByte(NULL, "CList", "SortByProto", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO));
- DBWriteContactSettingByte(NULL, "CList", "ConfirmDelete", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE));
- DBWriteContactSettingByte(NULL, "CList", "Tray1Click", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
- DBWriteContactSettingByte(NULL, "CList", "AlwaysStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
- DBWriteContactSettingByte(NULL, "CList", "AlwaysMulti", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
- DBWriteContactSettingByte(NULL, "CList", "TrayIcon",
+ db_set_b(NULL, "CList", "SortByStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS));
+ db_set_b(NULL, "CList", "SortByProto", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO));
+ db_set_b(NULL, "CList", "ConfirmDelete", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE));
+ db_set_b(NULL, "CList", "Tray1Click", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
+ db_set_b(NULL, "CList", "AlwaysStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
+ db_set_b(NULL, "CList", "AlwaysMulti", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
+ db_set_b(NULL, "CList", "TrayIcon",
(BYTE) (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE
: (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE :
SETTING_TRAYICON_MULTI)));
- DBWriteContactSettingWord(NULL, "CList", "CycleTime",
+ db_set_w(NULL, "CList", "CycleTime",
(WORD) SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, "CList", "IconFlashTime",
+ db_set_w(NULL, "CList", "IconFlashTime",
(WORD) SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CList", "DisableTrayFlash", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
+ db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
{
int cur = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
PROTOACCOUNT* pa = ( PROTOACCOUNT* )SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cur, 0 );
if ( pa == NULL )
- DBDeleteContactSetting(NULL, "CList", "PrimaryStatus");
+ db_unset(NULL, "CList", "PrimaryStatus");
else
- DBWriteContactSettingString(NULL, "CList", "PrimaryStatus", pa->szModuleName );
+ db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName );
}
pcli->pfnTrayIconIconsChanged();
diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index 937645a848..4c71790871 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -30,37 +30,37 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT,
- DBGetContactSettingByte(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_TOOLWND,
- DBGetContactSettingByte(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_MIN2TRAY,
- DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND))
EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE);
CheckDlgButton(hwndDlg, IDC_SHOWCAPTION,
- DBGetContactSettingByte(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU,
- DBGetContactSettingByte(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CLIENTDRAG,
- DBGetContactSettingByte(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_TOOLWND), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), FALSE);
}
- CheckDlgButton(hwndDlg, IDC_FADEINOUT, DBGetContactSettingByte(NULL, "CLUI", "FadeInOut", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOSIZE, DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DROPSHADOW, DBGetContactSettingByte(NULL, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONDESKTOP, DBGetContactSettingByte(NULL, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(NULL, "CLUI", "FadeInOut", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOSIZE, db_get_b(NULL, "CLUI", "AutoSize", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(NULL, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(NULL, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, DBGetContactSettingByte(NULL, "CLUI", "MaxSizeHeight", 75));
- CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, DBGetContactSettingByte(NULL, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "MaxSizeHeight", 75));
+ CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(NULL, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTOHIDE,
- DBGetContactSettingByte(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1));
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
+ MAKELONG(db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
@@ -73,9 +73,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
{ DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "CList", "TitleText", &dbv)) {
+ if ( !db_get_ts(NULL, "CList", "TitleText", &dbv)) {
SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME);
}
@@ -86,7 +86,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
else
CheckDlgButton(hwndDlg, IDC_TRANSPARENT,
- DBGetContactSettingByte(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (!IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC11), FALSE);
@@ -98,9 +98,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
- SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, DBGetContactSettingByte(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT));
+ SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT));
SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE,
- DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT));
+ db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT));
SendMessage(hwndDlg, WM_HSCROLL, 0x12345678, 0);
return TRUE;
@@ -156,28 +156,28 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_NOTIFY:
if (((LPNMHDR) lParam)->code == PSN_APPLY) {
- DBWriteContactSettingByte(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
- DBWriteContactSettingByte(NULL, "CList", "ToolWindow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TOOLWND));
- DBWriteContactSettingByte(NULL, "CList", "BringToFront", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
- DBWriteContactSettingByte(NULL, "CLUI", "FadeInOut", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
- DBWriteContactSettingByte(NULL, "CLUI", "AutoSize", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- DBWriteContactSettingByte(NULL, "CLUI", "MaxSizeHeight", (BYTE) GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, "CLUI", "AutoSizeUpward", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
- DBWriteContactSettingByte(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- DBWriteContactSettingWord(NULL, "CList", "HideTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CList", "Transparent", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- DBWriteContactSettingByte(NULL, "CList", "Alpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CList", "AutoAlpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CList", "WindowShadow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW));
- DBWriteContactSettingByte(NULL, "CList", "OnDesktop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP));
- DBWriteContactSettingByte(NULL, "CLUI", "ShowCaption", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION));
- DBWriteContactSettingByte(NULL, "CLUI", "ShowMainMenu", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU));
- DBWriteContactSettingByte(NULL, "CLUI", "ClientAreaDrag", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG));
- DBWriteContactSettingByte(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
+ db_set_b(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
+ db_set_b(NULL, "CList", "ToolWindow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TOOLWND));
+ db_set_b(NULL, "CList", "BringToFront", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
+ db_set_b(NULL, "CLUI", "FadeInOut", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
+ db_set_b(NULL, "CLUI", "AutoSize", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
+ db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE) GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE));
+ db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
+ db_set_b(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
+ db_set_w(NULL, "CList", "HideTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, "CList", "Transparent", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
+ db_set_b(NULL, "CList", "Alpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
+ db_set_b(NULL, "CList", "AutoAlpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
+ db_set_b(NULL, "CList", "WindowShadow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW));
+ db_set_b(NULL, "CList", "OnDesktop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP));
+ db_set_b(NULL, "CLUI", "ShowCaption", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION));
+ db_set_b(NULL, "CLUI", "ShowMainMenu", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU));
+ db_set_b(NULL, "CLUI", "ClientAreaDrag", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG));
+ db_set_b(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
{
TCHAR title[256];
GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, SIZEOF(title));
- DBWriteContactSettingTString(NULL, "CList", "TitleText", title);
+ db_set_ts(NULL, "CList", "TitleText", title);
SetWindowText(pcli->hwndContactList, title);
}
pcli->pfnLoadCluiGlobalOpts();
@@ -221,7 +221,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowLong(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
if (MySetLayeredWindowAttributes)
MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0),
- (BYTE) DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT),
+ (BYTE) db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT),
LWA_ALPHA);
}
else SetWindowLong(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED);
@@ -239,18 +239,18 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SHOWSBAR, DBGetContactSettingByte(NULL, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED);
{
- BYTE showOpts = DBGetContactSettingByte(NULL, "CLUI", "SBarShow", 1);
+ BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1);
CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts & 1 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts & 2 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts & 4 ? BST_CHECKED : BST_UNCHECKED);
}
- CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, DBGetContactSettingByte(NULL, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, db_get_b(NULL, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, !IsDlgButtonChecked(hwndDlg, IDC_RIGHTSTATUS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, DBGetContactSettingByte(NULL, "CLUI", "EqualSections", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, DBGetContactSettingByte(NULL, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWGRIP, DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL, "CLUI", "EqualSections", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, db_get_b(NULL, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWGRIP, db_get_b(NULL, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWICON), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWPROTO), FALSE);
@@ -277,23 +277,23 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_NOTIFY:
if (((LPNMHDR) lParam)->code == PSN_APPLY ) {
- DBWriteContactSettingByte(NULL, "CLUI", "ShowSBar", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- DBWriteContactSettingByte(NULL, "CLUI", "SBarShow",
+ db_set_b(NULL, "CLUI", "ShowSBar", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
+ db_set_b(NULL, "CLUI", "SBarShow",
(BYTE) ((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0)));
- DBWriteContactSettingByte(NULL, "CLUI", "SBarRightClk", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
- DBWriteContactSettingByte(NULL, "CLUI", "EqualSections", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
- DBWriteContactSettingByte(NULL, "CLUI", "SBarBevel", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
+ db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
+ db_set_b(NULL, "CLUI", "EqualSections", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
+ db_set_b(NULL, "CLUI", "SBarBevel", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
pcli->pfnLoadCluiGlobalOpts();
- if (DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) != (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
+ if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
HWND parent = GetParent(pcli->hwndStatus);
int flags = WS_CHILD | CCS_BOTTOM;
- DBWriteContactSettingByte(NULL, "CLUI", "ShowGrip", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
+ db_set_b(NULL, "CLUI", "ShowGrip", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
ShowWindow(pcli->hwndStatus, SW_HIDE);
DestroyWindow(pcli->hwndStatus);
- flags |= DBGetContactSettingByte(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
- flags |= DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
+ flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
+ flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, parent, NULL, g_hInst, NULL);
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR))
diff --git a/plugins/Clist_blind/src/commonheaders.h b/plugins/Clist_blind/src/commonheaders.h index 7fe4329c30..0dbece6987 100644 --- a/plugins/Clist_blind/src/commonheaders.h +++ b/plugins/Clist_blind/src/commonheaders.h @@ -54,7 +54,7 @@ extern HINSTANCE g_hInst; all the bad free()'s to good ones, however it's still incorrect code. The reasons for not
changing them include:
- * DBFreeVariant has a CallService() lookup
+ * db_free has a CallService() lookup
* free() is executed in some large loops to do with clist creation of group data
* easy search and replace
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 70fb9e2865..445591c950 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -194,7 +194,7 @@ TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char* setting out[0] = _T('\0');
- if (!DBGetContactSettingTString(hContact, module, setting, &dbv)) {
+ if (!db_get_ts(hContact, module, setting, &dbv)) {
if (dbv.type == DBVT_ASCIIZ)
MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, out, (int)len);
else if (dbv.type == DBVT_UTF8)
@@ -204,7 +204,7 @@ TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char* setting else if (def != NULL)
lstrcpyn(out, def, (int)len);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
if (def != NULL)
@@ -462,7 +462,7 @@ TCHAR *GetStatusName(struct ClcContact *item) return status_name;
// Get status name
- status = DBGetContactSettingWord(item->hContact, item->proto, "Status", ID_STATUS_OFFLINE);
+ status = db_get_w(item->hContact, item->proto, "Status", ID_STATUS_OFFLINE);
lstrcpyn(status_name, pcli->pfnGetStatusModeDescription(status, GSMDF_TCHAR), MAX_REGS(status_name));
return status_name;
diff --git a/plugins/Clist_modern/src/hdr/modern_static_clui.h b/plugins/Clist_modern/src/hdr/modern_static_clui.h index fb15b1e25a..ec4e3acc01 100644 --- a/plugins/Clist_modern/src/hdr/modern_static_clui.h +++ b/plugins/Clist_modern/src/hdr/modern_static_clui.h @@ -165,9 +165,7 @@ static BOOL bTransparentFocus=TRUE, bNeedFixSizingRect=FALSE, bShowEventStarted=FALSE; -static HANDLE hRenameMenuItem, - hShowAvatarMenuItem, - hHideAvatarMenuItem; +static HGENMENU hRenameMenuItem, hShowAvatarMenuItem, hHideAvatarMenuItem; static UINT uMsgGetProfile=0; diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 0c4e280d8d..14c460ed7a 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -299,7 +299,7 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus // Get XStatusName
if ( !noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -321,7 +321,7 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus // Get XStatusName
if ( !noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -347,7 +347,7 @@ void GetListeningTo(TCHAR *text, int text_size, ClcCacheEntry *pdnce) if (wStatus == ID_STATUS_OFFLINE || wStatus == 0)
return;
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) {
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
}
@@ -370,7 +370,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xst // Get XStatusMsg
if ( !noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) {
// Try to get XStatusMsg
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -382,7 +382,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xst // Get StatusMsg
if (pdnce->hContact && text[0] == '\0') {
- if ( !DBGetContactSettingTString(pdnce->hContact, "CList", "StatusMsg", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, "CList", "StatusMsg", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -395,7 +395,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xst // Get XStatusMsg
if ( !noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto && text[0] == '\0') {
// Try to get XStatusMsg
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -424,7 +424,7 @@ int Cache_GetLineText( DBVARIANT dbv = {0};
// Try to get XStatusMsg
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
if (dbv.ptszVal != NULL && dbv.ptszVal[0] != 0) {
TCHAR *tmp = NEWTSTR_ALLOCA(text);
mir_sntprintf(text, text_size, _T("%s: %s"), tmp, dbv.ptszVal);
@@ -439,7 +439,7 @@ int Cache_GetLineText( case TEXT_NICKNAME:
if (pdnce->hContact && pdnce->m_cache_cszProto) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) {
lstrcpyn(text, dbv.ptszVal, text_size);
db_free(&dbv);
CopySkipUnprintableChars(text, text, text_size-1);
@@ -453,7 +453,7 @@ int Cache_GetLineText( DBVARIANT dbv = {0};
// Try to get XStatusName
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
if (dbv.pszVal != NULL && dbv.pszVal[0] != 0) {
TCHAR *tmp = NEWTSTR_ALLOCA(text);
mir_sntprintf(text, text_size, _T("%s: %s"), dbv.pszVal, tmp);
@@ -465,7 +465,7 @@ int Cache_GetLineText( else if (use_name_and_message_for_xstatus && xstatus_has_priority) {
DBVARIANT dbv = {0};
// Try to get XStatusName
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
if (dbv.pszVal != NULL && dbv.pszVal[0] != 0)
mir_sntprintf(text, text_size, _T("%s"), dbv.pszVal);
CopySkipUnprintableChars(text, text, text_size-1);
@@ -525,7 +525,7 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact,0);
if (dat->first_line_append_nick && (!dat->force_in_dialog)) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) {
+ if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) {
TCHAR nick[SIZEOF(contact->szText)];
lstrcpyn(nick, dbv.ptszVal, SIZEOF(contact->szText));
db_free(&dbv);
@@ -856,7 +856,7 @@ void Cache_GetAvatar(ClcData *dat, ClcContact *contact) contact->avatar_pos = AVATAR_POS_DONT_HAVE;
if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(contact->hContact, "ContactPhoto", "File", &dbv)) {
+ if ( !db_get_ts(contact->hContact, "ContactPhoto", "File", &dbv)) {
HBITMAP hBmp = (HBITMAP) CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal);
if (hBmp != NULL) {
// Make bounds
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index fc2edc9c7a..e01d9be1bc 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1842,7 +1842,7 @@ int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack) }
else
{
- //DBDeleteContactSetting(ack->hContact,"CList","StatusMsg");
+ //db_unset(ack->hContact,"CList","StatusMsg");
//char a = '\0';
{//Do not change DB if it is IRC protocol
if (ack->szModule != NULL)
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 08ced8922c..753a8f0682 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -735,7 +735,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, ClcDa filterResult = strstr(g_CluiData.protoFilter, szTemp) ? 1 : 0;
}
if (g_CluiData.bFilterEffective & CLVM_FILTER_GROUPS) {
- if ( !DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "Group", &dbv)) {
mir_sntprintf(szGroupMask, SIZEOF(szGroupMask), _T("%s|"), &dbv.ptszVal[0]);
filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (_tcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (_tcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0));
mir_free(dbv.ptszVal);
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 4dd2d44ec8..7cf0c32840 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -583,12 +583,12 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w CheckDlgButton(hwndDlg,IDC_BITMAP,db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED);
SendMessage(hwndDlg,WM_USER+10, 0, 0);
SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_BKCOLOUR);
- // SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR));
+ // SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR, 0, db_get_dw(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR));
SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_SELBKCOLOUR);
SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR, 0, db_get_dw(NULL,"StatusBar","SelBkColour",CLCDEFAULT_SELBKCOLOUR));
{
DBVARIANT dbv;
- if ( !DBGetContactSettingString(NULL, "StatusBar", "BkBitmap", &dbv)) {
+ if ( !db_get_s(NULL, "StatusBar", "BkBitmap", &dbv)) {
SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal);
char szPath[MAX_PATH];
@@ -1211,7 +1211,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP {
DBVARIANT dbv = {0};
TCHAR *s;
- if ( !DBGetContactSettingTString(NULL,"CList","TitleText",&dbv))
+ if ( !db_get_ts(NULL,"CList","TitleText",&dbv))
s = dbv.ptszVal;
else
s = _T(MIRANDANAME);
@@ -1224,17 +1224,17 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP sprintf(szUin,"%u",db_get_dw(NULL,"ICQ","UIN",0));
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING, 0, (LPARAM)szUin);
- if ( !DBGetContactSettingString(NULL,"ICQ","Nick",&dbv)) {
+ if ( !db_get_s(NULL,"ICQ","Nick",&dbv)) {
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
dbv.pszVal = NULL;
}
- if ( !DBGetContactSettingString(NULL,"ICQ","FirstName",&dbv)) {
+ if ( !db_get_s(NULL,"ICQ","FirstName",&dbv)) {
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
dbv.pszVal = NULL;
}
- if ( !DBGetContactSettingString(NULL,"ICQ","e-mail",&dbv)) {
+ if ( !db_get_s(NULL,"ICQ","e-mail",&dbv)) {
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
dbv.pszVal = NULL;
@@ -1494,7 +1494,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, dat->item[indx].useWinColours = db_get_b(NULL,module, "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
{
DBVARIANT dbv;
- if ( !DBGetContactSettingString(NULL,module,"BkBitmap",&dbv))
+ if ( !db_get_s(NULL,module,"BkBitmap",&dbv))
{
int retval = PathToAbsolute(dbv.pszVal, dat->item[indx].filename);
if ( !retval || retval == CALLSERVICE_NOTFOUND)
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 63a30b58de..037143b7d6 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -629,7 +629,7 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat ) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(NULL, "CList","SecondLineText", &dbv))
+ if ( !db_get_ts(NULL, "CList","SecondLineText", &dbv))
{
lstrcpyn(dat->second_line_text, dbv.ptszVal, SIZEOF(dat->second_line_text)-1);
dat->second_line_text[SIZEOF(dat->second_line_text)-1] = _T('\0');
@@ -667,7 +667,7 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat ) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(NULL, "CList","ThirdLineText", &dbv))
+ if ( !db_get_ts(NULL, "CList","ThirdLineText", &dbv))
{
lstrcpyn(dat->third_line_text, dbv.ptszVal, SIZEOF(dat->third_line_text)-1);
dat->third_line_text[SIZEOF(dat->third_line_text)-1] = _T('\0');
@@ -721,7 +721,7 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat ) {
if ( db_get_b(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP))
{
- if ( !DBGetContactSettingString(NULL,"CLC","BkBitmap",&dbv))
+ if ( !db_get_s(NULL,"CLC","BkBitmap",&dbv))
{
dat->hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
@@ -737,7 +737,7 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat ) dat->MenuTextHiColor = sttGetColor("Menu","SelTextColour",CLCDEFAULT_MODERN_SELTEXTCOLOUR);
if ( db_get_b(NULL,"Menu","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if ( !DBGetContactSettingString(NULL,"Menu","BkBitmap",&dbv)) {
+ if ( !db_get_s(NULL,"Menu","BkBitmap",&dbv)) {
dat->hMenuBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index c335c32bbc..7778b24724 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -278,7 +278,7 @@ static int ehhEventAreaBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
event_area.bkColour = sttGetColor("EventArea","BkColour",CLCDEFAULT_BKCOLOUR);
if ( db_get_b(NULL,"EventArea","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if ( !DBGetContactSettingString(NULL,"EventArea","BkBitmap",&dbv)) {
+ if ( !db_get_s(NULL,"EventArea","BkBitmap",&dbv)) {
event_area.hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp index 7d18bd4c34..ec7a3bdb85 100644 --- a/plugins/Clist_modern/src/modern_clistopts.cpp +++ b/plugins/Clist_modern/src/modern_clistopts.cpp @@ -529,7 +529,7 @@ static INT_PTR CALLBACK DlgProcItemTextOpts(HWND hwndDlg, UINT msg, WPARAM wPara case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_RTL, db_get_b(NULL,"CList","TextRTL",SETTING_TEXT_RTL_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
- //TODO: init IDC_ALIGNGROUPCOMBO from DBGetContactSettingByte(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
+ //TODO: init IDC_ALIGNGROUPCOMBO from db_get_b(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
{
int item;
TCHAR *align[] = {LPGENT("Left align group names"), LPGENT("Center group names"), LPGENT("Right align group names")};
@@ -575,7 +575,7 @@ static INT_PTR CALLBACK DlgProcItemTextOpts(HWND hwndDlg, UINT msg, WPARAM wPara switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
db_set_b(NULL,"CList","TextRTL", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_RTL));
- //TODO: Store IDC_ALIGNGROUPCOMBO at DBGetContactSettingByte(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
+ //TODO: Store IDC_ALIGNGROUPCOMBO at db_get_b(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
db_set_b(NULL,"CList","AlignGroupCaptions",(BYTE)SendDlgItemMessage(hwndDlg,IDC_ALIGNGROUPCOMBO,CB_GETCURSEL, 0, 0));
db_set_b(NULL,"CList","TextAlignToRight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALIGN_RIGHT));
db_set_b(NULL,"CList","TextReplaceSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_REPLACE_SMILEYS));
@@ -610,7 +610,7 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, db_get_b(NULL,"CList","SecondLineDrawSmileys",SETTING_SECONDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "CList","SecondLineText", &dbv)) {
+ if ( !db_get_ts(NULL, "CList","SecondLineText", &dbv)) {
SetWindowText(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), dbv.ptszVal);
db_free(&dbv);
}
@@ -786,7 +786,7 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, db_get_b(NULL,"CList","ThirdLineDrawSmileys",SETTING_THIRDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "CList","ThirdLineText", &dbv)) {
+ if ( !db_get_ts(NULL, "CList","ThirdLineText", &dbv)) {
SetWindowText(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), dbv.ptszVal);
db_free(&dbv);
}
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index dd241971ee..7d2c965705 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -251,7 +251,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) if (pdnce->tszGroup == NULL) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->hContact,"CList","Group",&dbv)) {
+ if ( !db_get_ts(pdnce->hContact,"CList","Group",&dbv)) {
pdnce->tszGroup = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 9a4525ad1f..b4339c7720 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -196,7 +196,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) if ( db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE &&
db_get_b(NULL,"CList","AlwaysPrimary",SETTING_ALWAYSPRIMARY_DEFAULT))
{
- if ( !DBGetContactSettingString(NULL,"CList","PrimaryStatus",&dbv)) {
+ if ( !db_get_s(NULL,"CList","PrimaryStatus",&dbv)) {
szProto = NEWSTR_ALLOCA(dbv.pszVal);
db_free(&dbv);
}
@@ -209,7 +209,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) switch( db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)) {
case SETTING_TRAYICON_SINGLE:
{
- if ( !DBGetContactSettingString(NULL,"CList","PrimaryStatus",&dbv)) {
+ if ( !db_get_s(NULL,"CList","PrimaryStatus",&dbv)) {
szProto = NEWSTR_ALLOCA(dbv.pszVal);
db_free(&dbv);
}
@@ -330,7 +330,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) }
else if (status >= ID_STATUS_OFFLINE && status <= ID_STATUS_IDLE)
{
- if (DBGetContactSettingString(NULL,"CList","PrimaryStatus",&dbv))
+ if (db_get_s(NULL,"CList","PrimaryStatus",&dbv))
szProto = NULL;
else
szProto = dbv.pszVal;
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 012fea9575..3ab3bafa9e 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -107,18 +107,12 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam) if ( lstrcmp( _T(CLISTCONTROL_CLASS), cls))
hwndClist = pcli->hwndContactList;
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
- if ( !hItem)
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hRenameMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hRenameMenuItem, hItem != 0);
if ( !hItem || !IsHContactContact(hItem) || !db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)) {
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowAvatarMenuItem, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideAvatarMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hShowAvatarMenuItem, false);
+ Menu_ShowItem(hHideAvatarMenuItem, false);
}
else {
int has_avatar;
@@ -126,8 +120,8 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam) if ( ServiceExists(MS_AV_GETAVATARBITMAP))
has_avatar = CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hItem, 0);
else {
- DBVARIANT dbv = {0};
- if ( DBGetContactSettingTString(hItem, "ContactPhoto", "File", &dbv))
+ DBVARIANT dbv;
+ if ( db_get_ts(hItem, "ContactPhoto", "File", &dbv))
has_avatar = 0;
else {
has_avatar = 1;
@@ -135,18 +129,9 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam) }
}
- if ( db_get_b(hItem, "CList", "HideContactAvatar", 0)) {
- mi.flags = CMIM_FLAGS | (has_avatar ? 0 : CMIF_GRAYED);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowAvatarMenuItem, (LPARAM)&mi);
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideAvatarMenuItem, (LPARAM)&mi);
- }
- else {
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowAvatarMenuItem, (LPARAM)&mi);
- mi.flags = CMIM_FLAGS | (has_avatar ? 0 : CMIF_GRAYED);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideAvatarMenuItem, (LPARAM)&mi);
- }
+ bool bHideAvatar = db_get_b(hItem, "CList", "HideContactAvatar", 0) != 0;
+ Menu_ShowItem(hShowAvatarMenuItem, bHideAvatar);
+ Menu_ShowItem(hHideAvatarMenuItem, !bHideAvatar);
}
return 0;
@@ -641,7 +626,7 @@ void CLUI_ChangeWindowMode() //4- Set Title
TCHAR titleText[255] = {0};
DBVARIANT dbv;
- if ( DBGetContactSettingTString(NULL, "CList", "TitleText", &dbv))
+ if ( db_get_ts(NULL, "CList", "TitleText", &dbv))
lstrcpyn(titleText,_T(MIRANDANAME),SIZEOF(titleText));
else {
lstrcpyn(titleText,dbv.ptszVal,SIZEOF(titleText));
@@ -1003,7 +988,7 @@ static int CLUI_CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) KillTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->nIndex);
int cnt = CLUI_GetConnectingIconForProtoCount(szProto);
if (cnt != 0) {
- nAnimatedIconStep = 100;/*DBGetContactSettingWord(NULL,"CLUI","DefaultStepConnectingIcon",100);*/
+ nAnimatedIconStep = 100;/*db_get_w(NULL,"CLUI","DefaultStepConnectingIcon",100);*/
pt->nIconsCount = cnt;
if (pt->himlIconList)
ImageList_Destroy(pt->himlIconList);
@@ -1296,7 +1281,7 @@ int CLUI_TestCursorOnBorders() if (g_bTransparentFlag) {
if ( !bTransparentFocus && gf != hwnd) {
CLUI_SmoothAlphaTransition(hwnd, db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
- //g_proc_SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ //g_proc_SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
bTransparentFocus = 1;
CLUI_SafeSetTimer(hwnd, TM_AUTOALPHA,250, NULL);
}
diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index 56357fb542..ff162fc7f7 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -672,7 +672,7 @@ static int DBLoadFrameSettingsAtPos(int pos,int Frameid) _itoa(pos,sadd,10);
- //DBWriteContactSettingString(0, CLUIFrameModule,strcat("Name",sadd),Frames[Frameid].name);
+ //db_set_s(0, CLUIFrameModule,strcat("Name",sadd),Frames[Frameid].name);
//bool
g_pfwFrames[Frameid].collapsed = db_get_b(0, CLUIFrameModule,AS(buf,"Collapse",sadd),g_pfwFrames[Frameid].collapsed);
@@ -735,7 +735,7 @@ static int LocateStorePosition(int Frameid,int maxstored) for (int i=0; i < maxstored; i++) {
mir_snprintf(settingname,SIZEOF(settingname),"Name%d",i);
DBVARIANT dbv = {0};
- if ( DBGetContactSettingTString( NULL, CLUIFrameModule, settingname, &dbv ))
+ if ( db_get_ts( NULL, CLUIFrameModule, settingname, &dbv ))
continue;
if ( lstrcmpi(dbv.ptszVal, g_pfwFrames[Frameid].Name) == 0) {
@@ -2600,7 +2600,7 @@ int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam) }
- //if (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT))GetWindowRect(pcli->hwndStatus,&rcStatus);
+ //if (db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT))GetWindowRect(pcli->hwndStatus,&rcStatus);
//else rcStatus.top = rcStatus.bottom = 0;
// nRect.top--;
/* $$$ rcStatus.top = rcStatus.bottom = 0;
@@ -2663,7 +2663,7 @@ int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam) if (g_CluiData.fDisableSkinEngine)
{
if ( db_get_b(NULL,"FrameTitleBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if ( !DBGetContactSettingString(NULL,"FrameTitleBar","BkBitmap",&dbv)) {
+ if ( !db_get_s(NULL,"FrameTitleBar","BkBitmap",&dbv)) {
hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
diff --git a/plugins/Clist_modern/src/modern_newrowopts.cpp b/plugins/Clist_modern/src/modern_newrowopts.cpp index 3cbb3fc197..7e5d9533cc 100644 --- a/plugins/Clist_modern/src/modern_newrowopts.cpp +++ b/plugins/Clist_modern/src/modern_newrowopts.cpp @@ -173,7 +173,7 @@ BOOL CALLBACK DlgProcItemNewRowOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (RemoveNode(res1)) res1 = 0;
TRACE("*********** Nodes DUMP 2 ***********\n");
TraceTreeLevel(RootNode);
- //CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, DBGetContactSettingByte(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+ //CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, db_get_b(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
MessageBox(hwndDlg,_T("Init NewRow Dialog"),_T("Notify"),MB_OK);
break;
}
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index 8cf08c44d8..496c18ffd4 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -119,7 +119,7 @@ int LoadStatusBarData() DBVARIANT dbv;
g_StatusBarData.bkColour = sttGetColor("StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
if ( db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if ( !DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
+ if ( !db_get_s(NULL,"StatusBar","BkBitmap",&dbv)) {
g_StatusBarData.hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 8b7598c66e..592320f7c9 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -261,7 +261,7 @@ static int FillDialog(HWND hwnd) for (i=0;;i++)
{
mir_snprintf(buf, 20, "%d", i);
- if (DBGetContactSettingTString(NULL, "CListGroups", buf, &dbv))
+ if (db_get_ts(NULL, "CListGroups", buf, &dbv))
break;
item.pszText = &dbv.ptszVal[1];
@@ -557,10 +557,10 @@ static void UpdateFilters() mir_sntprintf(szTemp, 100, TranslateT("Configuring view mode: %s"), szTempBuf);
SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
mir_snprintf(szSetting, 128, "%c%s_PF", 246, szBuf);
- if (DBGetContactSettingString(NULL, CLVM_MODULE, szSetting, &dbv_pf))
+ if (db_get_s(NULL, CLVM_MODULE, szSetting, &dbv_pf))
goto cleanup;
mir_snprintf(szSetting, 128, "%c%s_GF", 246, szBuf);
- if (DBGetContactSettingTString(NULL, CLVM_MODULE, szSetting, &dbv_gf))
+ if (db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv_gf))
goto cleanup;
mir_snprintf(szSetting, 128, "%c%s_OPT", 246, szBuf);
if ((opt = db_get_dw(NULL, CLVM_MODULE, szSetting, -1)) != -1)
@@ -1275,7 +1275,7 @@ static int ehhViewModeBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
view_mode.bkColour = sttGetColor("ViewMode","BkColour",CLCDEFAULT_BKCOLOUR);
if ( db_get_b(NULL,"ViewMode","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if ( !DBGetContactSettingString(NULL,"ViewMode","BkBitmap",&dbv)) {
+ if ( !db_get_s(NULL,"ViewMode","BkBitmap",&dbv)) {
view_mode.hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
@@ -1341,7 +1341,7 @@ void ApplyViewMode(const char *Name, bool onlySelector ) if ( !name) // Name is null - apply last stored view mode
{
- if ( !DBGetContactSettingString(NULL, CLVM_MODULE, szSetting, &dbv))
+ if ( !db_get_s(NULL, CLVM_MODULE, szSetting, &dbv))
{
name = (char*)_alloca(strlen(dbv.pszVal)+1);
strcpy(name,dbv.pszVal);
@@ -1378,7 +1378,7 @@ void ApplyViewMode(const char *Name, bool onlySelector ) if ( !onlySelector )
{
mir_snprintf(szSetting, 256, "%c%s_PF", 246, name);
- if ( !DBGetContactSettingString(NULL, CLVM_MODULE, szSetting, &dbv)) {
+ if ( !db_get_s(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (lstrlenA(dbv.pszVal) >= 2)
{
strncpy(g_CluiData.protoFilter, dbv.pszVal, SIZEOF(g_CluiData.protoFilter));
@@ -1388,7 +1388,7 @@ void ApplyViewMode(const char *Name, bool onlySelector ) mir_free(dbv.pszVal);
}
mir_snprintf(szSetting, 256, "%c%s_GF", 246, name);
- if ( !DBGetContactSettingTString(NULL, CLVM_MODULE, szSetting, &dbv))
+ if ( !db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv))
{
if (lstrlen(dbv.ptszVal) >= 2)
{
diff --git a/plugins/Clist_mw/src/BkgrCfg.cpp b/plugins/Clist_mw/src/BkgrCfg.cpp index 5dced4e4db..237cd6317c 100644 --- a/plugins/Clist_mw/src/BkgrCfg.cpp +++ b/plugins/Clist_mw/src/BkgrCfg.cpp @@ -65,11 +65,11 @@ static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->item[indx].changed = FALSE;
dat->item[indx].useBitmap = db_get_b(NULL,module, "UseBitmap", DEFAULT_USEBITMAP);
- dat->item[indx].bkColor = DBGetContactSettingDword(NULL,module, "BkColour", DEFAULT_BKCOLOUR);
- dat->item[indx].selColor = DBGetContactSettingDword(NULL,module, "SelBkColour", DEFAULT_SELBKCOLOUR);
+ dat->item[indx].bkColor = db_get_dw(NULL,module, "BkColour", DEFAULT_BKCOLOUR);
+ dat->item[indx].selColor = db_get_dw(NULL,module, "SelBkColour", DEFAULT_SELBKCOLOUR);
{
DBVARIANT dbv;
- if ( !DBGetContactSettingString(NULL,module,"BkBitmap",&dbv))
+ if ( !db_get_s(NULL,module,"BkBitmap",&dbv))
{
int retval = PathToAbsolute(dbv.pszVal, dat->item[indx].filename);
if ( !retval || retval == CALLSERVICE_NOTFOUND)
@@ -221,14 +221,14 @@ static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP COLORREF col;
if ((col = dat->item[indx].bkColor) == DEFAULT_BKCOLOUR)
- DBDeleteContactSetting(NULL, module, "BkColour");
+ db_unset(NULL, module, "BkColour");
else
- DBWriteContactSettingDword(NULL, module, "BkColour", col);
+ db_set_dw(NULL, module, "BkColour", col);
if ((col = dat->item[indx].selColor) == DEFAULT_SELBKCOLOUR)
- DBDeleteContactSetting(NULL, module, "SelBkColour");
+ db_unset(NULL, module, "SelBkColour");
else
- DBWriteContactSettingDword(NULL, module, "SelBkColour", col);
+ db_set_dw(NULL, module, "SelBkColour", col);
}
{
char str[MAX_PATH];
@@ -238,7 +238,7 @@ static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else
db_set_s(NULL, module, "BkBitmap", str);
}
- DBWriteContactSettingWord(NULL, module, "BkBmpUse", dat->item[indx].flags);
+ db_set_w(NULL, module, "BkBmpUse", dat->item[indx].flags);
dat->item[indx].changed = FALSE;
NotifyEventHooks(hEventBkgrChanged, (WPARAM)module, 0);
}
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp index b504a96f0e..498dc2e896 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -516,25 +516,25 @@ int DBStoreFrameSettingsAtPos(int pos,int Frameid) _itoa(pos,sadd,10);
- DBWriteContactSettingTString(0,CLUIFrameModule,AS(buf,"Name",sadd),Frames[Frameid].name);
+ db_set_ts(0,CLUIFrameModule,AS(buf,"Name",sadd),Frames[Frameid].name);
//boolean
db_set_b(0,CLUIFrameModule,AS(buf,"Collapse",sadd),(BYTE)btoint(Frames[Frameid].collapsed));
db_set_b(0,CLUIFrameModule,AS(buf,"Locked",sadd),(BYTE)btoint(Frames[Frameid].Locked));
db_set_b(0,CLUIFrameModule,AS(buf,"Visible",sadd),(BYTE)btoint(Frames[Frameid].visible));
db_set_b(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),(BYTE)btoint(Frames[Frameid].TitleBar.ShowTitleBar));
- DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),(WORD)Frames[Frameid].height);
- DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),(WORD)Frames[Frameid].HeightWhenCollapsed);
- DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Align",sadd),(WORD)Frames[Frameid].align);
+ db_set_w(0,CLUIFrameModule,AS(buf,"Height",sadd),(WORD)Frames[Frameid].height);
+ db_set_w(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),(WORD)Frames[Frameid].HeightWhenCollapsed);
+ db_set_w(0,CLUIFrameModule,AS(buf,"Align",sadd),(WORD)Frames[Frameid].align);
//FloatingPos
- DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatX",sadd),(WORD)Frames[Frameid].FloatingPos.x);
- DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatY",sadd),(WORD)Frames[Frameid].FloatingPos.y);
- DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),(WORD)Frames[Frameid].FloatingSize.x);
- DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),(WORD)Frames[Frameid].FloatingSize.y);
+ db_set_w(0,CLUIFrameModule,AS(buf,"FloatX",sadd),(WORD)Frames[Frameid].FloatingPos.x);
+ db_set_w(0,CLUIFrameModule,AS(buf,"FloatY",sadd),(WORD)Frames[Frameid].FloatingPos.y);
+ db_set_w(0,CLUIFrameModule,AS(buf,"FloatW",sadd),(WORD)Frames[Frameid].FloatingSize.x);
+ db_set_w(0,CLUIFrameModule,AS(buf,"FloatH",sadd),(WORD)Frames[Frameid].FloatingSize.y);
db_set_b(0,CLUIFrameModule,AS(buf,"Floating",sadd),(BYTE)btoint(Frames[Frameid].floating));
db_set_b(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),(BYTE)btoint(Frames[Frameid].UseBorder));
- DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),(WORD)Frames[Frameid].order);
+ db_set_w(0,CLUIFrameModule,AS(buf,"Order",sadd),(WORD)Frames[Frameid].order);
//db_set_s(0,CLUIFrameModule,AS(buf,"TBName",sadd),Frames[Frameid].TitleBar.tbname);
return 0;
}
@@ -593,7 +593,7 @@ int CLUIFramesStoreFrameSettings(int Frameid) }
DBStoreFrameSettingsAtPos(storpos,Frameid);
- DBWriteContactSettingWord(0,CLUIFrameModule,"StoredFrames",(WORD)maxstored);
+ db_set_w(0,CLUIFrameModule,"StoredFrames",(WORD)maxstored);
//ulockfrm();
return 0;
}
@@ -1739,9 +1739,9 @@ int CLUIFramesResize(const RECT newsize) int sepw = GapBetweenFrames;
SortData *sdarray;
- GapBetweenTitlebar = (int)DBGetContactSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",1);
- GapBetweenFrames = DBGetContactSettingDword(NULL,"CLUIFrames","GapBetweenFrames",1);
- TitleBarH = DBGetContactSettingDword(NULL,"CLUIFrames","TitleBarH",DEFAULT_TITLEBAR_HEIGHT);
+ GapBetweenTitlebar = (int)db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",1);
+ GapBetweenFrames = db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",1);
+ TitleBarH = db_get_dw(NULL,"CLUIFrames","TitleBarH",DEFAULT_TITLEBAR_HEIGHT);
sepw = GapBetweenFrames;
if (nFramescount < 1)
@@ -1941,12 +1941,12 @@ int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam) AlignCOLLIconToLeft = db_get_b(NULL,"FrameTitleBar","AlignCOLLIconToLeft",0);
- bkColour = DBGetContactSettingDword(NULL,"FrameTitleBar","BkColour",CLCDEFAULT_BKCOLOUR);
- //SelBkColour = DBGetContactSettingDword(NULL,"FrameTitleBar","SelBkColour",0);
+ bkColour = db_get_dw(NULL,"FrameTitleBar","BkColour",CLCDEFAULT_BKCOLOUR);
+ //SelBkColour = db_get_dw(NULL,"FrameTitleBar","SelBkColour",0);
if (hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground = NULL;}
if ( db_get_b(NULL,"FrameTitleBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if ( !DBGetContactSetting(NULL,"FrameTitleBar","BkBitmap",&dbv)) {
+ if ( !db_get(NULL,"FrameTitleBar","BkBitmap",&dbv)) {
hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
mir_free(dbv.pszVal);
}
@@ -2108,7 +2108,7 @@ static int DrawTitleBar(HDC dc,RECT rect,int Frameid) DrawBackGroundTTB(Frames[pos].TitleBar.hwnd,hdcMem);
//hFront = CreateSolidPe (SelBkColour);
//SelectObject(hdcMem,hFront);
- SelBkColour = DBGetContactSettingDword(NULL,"CLUIFrames","FramesTitleBarFontCol",0);
+ SelBkColour = db_get_dw(NULL,"CLUIFrames","FramesTitleBarFontCol",0);
if (SelBkColour) SetTextColor(hdcMem,SelBkColour);
if ( !AlignCOLLIconToLeft) {
@@ -2871,7 +2871,7 @@ int LoadCLUIFramesModule(void) RegisterClass(&cntclass);
//end container helper
- GapBetweenFrames = DBGetContactSettingDword(NULL,"CLUIFrames","GapBetweenFrames",1);
+ GapBetweenFrames = db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",1);
nFramescount = 0;
InitializeCriticalSection(&csFrameHook);
diff --git a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp index f5d577d70c..10a0ad3b4b 100644 --- a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp @@ -30,20 +30,20 @@ int extraspace; int OnStatusBarBackgroundChange()
{
showOpts = db_get_b(NULL,"CLUI","SBarShow",1);
- bkColour = DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
+ bkColour = db_get_dw(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
if (hBmpBackground)
DeleteObject(hBmpBackground), hBmpBackground = NULL;
if ( db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "StatusBar", "BkBitmap", &dbv)) {
+ if ( !db_get_ts(NULL, "StatusBar", "BkBitmap", &dbv)) {
hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal);
db_free(&dbv);
}
}
backgroundBmpUse = db_get_w(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
- extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
+ extraspace = db_get_dw(NULL,"StatusBar","BkExtraSpace",0);
RecreateStatusBar(pcli->hwndContactList);
if (pcli->hwndStatus) InvalidateRect(pcli->hwndStatus,NULL,TRUE);
@@ -228,8 +228,8 @@ void DrawBackGround(HWND hwnd,HDC mhdc) ds.hwndItem = hwnd;
ds.hDC = hdcMem;
- int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
- int extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
+ int startoffset = db_get_dw(NULL,"StatusBar","FirstIconOffset",0);
+ int extraspace = db_get_dw(NULL,"StatusBar","BkExtraSpace",0);
int nParts = SendMessage(hwnd,SB_GETPARTS,0,0);
RECT rc = { 0 }, clrc;
diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index dce9541b22..26924d1f8c 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -219,7 +219,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L ClcGroup *group;
if ( FindItem(hwnd,dat,(HANDLE)wParam,&contact,&group,NULL) && contact != NULL) {
contact->flags &= ~CONTACTF_STATUSMSG;
- if ( !DBGetContactSettingTString((HANDLE)wParam, "CList", "StatusMsg", &dbv)) {
+ if ( !db_get_ts((HANDLE)wParam, "CList", "StatusMsg", &dbv)) {
int j;
if (dbv.ptszVal == NULL||_tcslen(dbv.ptszVal) == 0) break;
lstrcpyn(contact->szStatusMsg, dbv.ptszVal, SIZEOF(contact->szStatusMsg));
@@ -228,7 +228,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L contact->szStatusMsg[j] = ' ';
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (_tcslen(contact->szStatusMsg)>0) {
contact->flags |= CONTACTF_STATUSMSG;
dat->needsResort = TRUE;
diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index bea0430653..245afe3048 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -166,7 +166,7 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group group->cl.items[i]->proto = szProto;
if (dat->style & CLS_SHOWSTATUSMESSAGES) {
- if ( !DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
int j;
lstrcpyn(group->cl.items[i]->szStatusMsg, dbv.ptszVal, SIZEOF(group->cl.items[i]->szStatusMsg));
for (j = (int)_tcslen(group->cl.items[i]->szStatusMsg)-1;j>=0;j--) {
@@ -174,7 +174,7 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group group->cl.items[i]->szStatusMsg[j] = ' ';
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (_tcslen(group->cl.items[i]->szStatusMsg)>0) {
group->cl.items[i]->flags |= CONTACTF_STATUSMSG;
}
@@ -292,7 +292,7 @@ void DeleteItemFromTree(HWND hwnd,HANDLE hItem) if ( !IsHContactContact(hItem)) return;
ClearClcContactCache(dat,hItem);
- if (DBGetContactSettingTString(hItem,"CList","Group",&dbv)) return;
+ if (db_get_ts(hItem,"CList","Group",&dbv)) return;
//decrease member counts of all parent groups too
group = &dat->list;
@@ -423,7 +423,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) sprintf(buf,"RebuildEntireList %d \r\n",tick);
OutputDebugStringA(buf);
- DBWriteContactSettingDword((HANDLE)0,"CLUI","PF:Last RebuildEntireList Time:",tick);
+ db_set_dw((HANDLE)0,"CLUI","PF:Last RebuildEntireList Time:",tick);
}
}
@@ -512,7 +512,7 @@ void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort) if (tick > 5) {
sprintf(buf,"SortCLC %d \r\n",tick);
OutputDebugStringA(buf);
- DBWriteContactSettingDword((HANDLE)0,"CLUI","PF:Last SortCLC Time:",tick);
+ db_set_dw((HANDLE)0,"CLUI","PF:Last SortCLC Time:",tick);
}
}
#endif
diff --git a/plugins/Clist_mw/src/clcopts.cpp b/plugins/Clist_mw/src/clcopts.cpp index 63ee91a856..845e3d104d 100644 --- a/plugins/Clist_mw/src/clcopts.cpp +++ b/plugins/Clist_mw/src/clcopts.cpp @@ -216,7 +216,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
{
- DWORD exStyle = DBGetContactSettingDword(NULL,"CLC","ExStyle",pcli->pfnGetDefaultExStyle());
+ DWORD exStyle = db_get_dw(NULL,"CLC","ExStyle",pcli->pfnGetDefaultExStyle());
for (int i = 0;i < SIZEOF(checkBoxToStyleEx); i++)
CheckDlgButton(hwndDlg,checkBoxToStyleEx[i].id,(exStyle&checkBoxToStyleEx[i].flag)^(checkBoxToStyleEx[i].flag*checkBoxToStyleEx[i].not)?BST_CHECKED:BST_UNCHECKED);
@@ -231,13 +231,13 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETPOS,0,MAKELONG( db_get_b(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN),0));
SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETRANGE,0,MAKELONG(50,0));
SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETPOS,0,MAKELONG( db_get_b(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT),0));
- CheckDlgButton(hwndDlg,IDC_GREYOUT,DBGetContactSettingDword(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg,IDC_GREYOUT,db_get_dw(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS)?BST_CHECKED:BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg,IDC_SMOOTHTIME),IsDlgButtonChecked(hwndDlg,IDC_NOTNOSMOOTHSCROLLING));
EnableWindow(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),IsDlgButtonChecked(hwndDlg,IDC_GREYOUT));
- FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),greyoutValues,SIZEOF(greyoutValues),DBGetContactSettingDword(NULL,"CLC","FullGreyoutFlags",CLCDEFAULT_FULLGREYOUTFLAGS));
- FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),offlineValues,SIZEOF(offlineValues),DBGetContactSettingDword(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES));
+ FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),greyoutValues,SIZEOF(greyoutValues),db_get_dw(NULL,"CLC","FullGreyoutFlags",CLCDEFAULT_FULLGREYOUTFLAGS));
+ FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),offlineValues,SIZEOF(offlineValues),db_get_dw(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES));
CheckDlgButton(hwndDlg,IDC_NOSCROLLBAR,db_get_b(NULL,"CLC","NoVScrollBar",0)?BST_CHECKED:BST_UNCHECKED);
return TRUE;
@@ -283,19 +283,19 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam for (i = 0;i < SIZEOF(checkBoxToStyleEx);i++)
if ((IsDlgButtonChecked(hwndDlg,checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not)
exStyle |= checkBoxToStyleEx[i].flag;
- DBWriteContactSettingDword(NULL,"CLC","ExStyle",exStyle);
+ db_set_dw(NULL,"CLC","ExStyle",exStyle);
DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS));
- DBWriteContactSettingDword(NULL,"CLC","FullGreyoutFlags",fullGreyoutFlags);
+ db_set_dw(NULL,"CLC","FullGreyoutFlags",fullGreyoutFlags);
if (IsDlgButtonChecked(hwndDlg,IDC_GREYOUT))
- DBWriteContactSettingDword(NULL,"CLC","GreyoutFlags",fullGreyoutFlags);
+ db_set_dw(NULL,"CLC","GreyoutFlags",fullGreyoutFlags);
else
- DBWriteContactSettingDword(NULL,"CLC","GreyoutFlags",0);
+ db_set_dw(NULL,"CLC","GreyoutFlags",0);
db_set_b(NULL,"CLC","ShowIdle",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_IDLE)?1:0));
- DBWriteContactSettingDword(NULL,"CLC","OfflineModes",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS)));
+ db_set_dw(NULL,"CLC","OfflineModes",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS)));
db_set_b(NULL,"CLC","LeftMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0));
- DBWriteContactSettingWord(NULL,"CLC","ScrollTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_GETPOS,0,0));
+ db_set_w(NULL,"CLC","ScrollTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_GETPOS,0,0));
db_set_b(NULL,"CLC","GroupIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_GETPOS,0,0));
db_set_b(NULL,"CLC","NoVScrollBar",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_NOSCROLLBAR)?1:0));
@@ -320,12 +320,12 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w CheckDlgButton(hwndDlg,IDC_BITMAP,db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED);
SendMessage(hwndDlg,WM_USER+10,0,0);
SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_BKCOLOUR);
- SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR));
+ SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,db_get_dw(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR));
SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_SELBKCOLOUR);
- SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"StatusBar","SelBkColour",CLCDEFAULT_SELBKCOLOUR));
+ SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,db_get_dw(NULL,"StatusBar","SelBkColour",CLCDEFAULT_SELBKCOLOUR));
{
DBVARIANT dbv;
- if ( !DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
+ if ( !db_get_s(NULL,"StatusBar","BkBitmap",&dbv)) {
SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal);
char szPath[MAX_PATH];
@@ -398,11 +398,11 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w {
COLORREF col;
col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0);
- if (col == CLCDEFAULT_BKCOLOUR) DBDeleteContactSetting(NULL,"StatusBar","BkColour");
- else DBWriteContactSettingDword(NULL,"StatusBar","BkColour",col);
+ if (col == CLCDEFAULT_BKCOLOUR) db_unset(NULL,"StatusBar","BkColour");
+ else db_set_dw(NULL,"StatusBar","BkColour",col);
col = SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_GETCOLOUR,0,0);
- if (col == CLCDEFAULT_SELBKCOLOUR) DBDeleteContactSetting(NULL,"StatusBar","SelBkColour");
- else DBWriteContactSettingDword(NULL,"StatusBar","SelBkColour",col);
+ if (col == CLCDEFAULT_SELBKCOLOUR) db_unset(NULL,"StatusBar","SelBkColour");
+ else db_set_dw(NULL,"StatusBar","SelBkColour",col);
char str[MAX_PATH],strrel[MAX_PATH];
GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str));
@@ -420,7 +420,7 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w if (IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags |= CLBF_PROPORTIONAL;
if (IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags |= CLBF_TILEVTOROWHEIGHT;
- DBWriteContactSettingWord(NULL,"StatusBar","BkBmpUse",flags);
+ db_set_w(NULL,"StatusBar","BkBmpUse",flags);
}
pcli->pfnClcOptionsChanged();
@@ -442,12 +442,12 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, CheckDlgButton(hwndDlg,IDC_BITMAP,db_get_b(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED);
SendMessage(hwndDlg,WM_USER+10,0,0);
SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_BKCOLOUR);
- SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLC","BkColour",CLCDEFAULT_BKCOLOUR));
+ SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,db_get_dw(NULL,"CLC","BkColour",CLCDEFAULT_BKCOLOUR));
SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_SELBKCOLOUR);
- SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLC","SelBkColour",CLCDEFAULT_SELBKCOLOUR));
+ SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,db_get_dw(NULL,"CLC","SelBkColour",CLCDEFAULT_SELBKCOLOUR));
{
DBVARIANT dbv;
- if ( !DBGetContactSettingString(NULL,"CLC","BkBitmap",&dbv)) {
+ if ( !db_get_s(NULL,"CLC","BkBitmap",&dbv)) {
SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal);
char szPath[MAX_PATH];
@@ -517,11 +517,11 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_b(NULL,"CLC","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP));
{ COLORREF col;
col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0);
- if (col == CLCDEFAULT_BKCOLOUR) DBDeleteContactSetting(NULL,"CLC","BkColour");
- else DBWriteContactSettingDword(NULL,"CLC","BkColour",col);
+ if (col == CLCDEFAULT_BKCOLOUR) db_unset(NULL,"CLC","BkColour");
+ else db_set_dw(NULL,"CLC","BkColour",col);
col = SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_GETCOLOUR,0,0);
- if (col == CLCDEFAULT_SELBKCOLOUR) DBDeleteContactSetting(NULL,"CLC","SelBkColour");
- else DBWriteContactSettingDword(NULL,"CLC","SelBkColour",col);
+ if (col == CLCDEFAULT_SELBKCOLOUR) db_unset(NULL,"CLC","SelBkColour");
+ else db_set_dw(NULL,"CLC","SelBkColour",col);
}
{
char str[MAX_PATH],strrel[MAX_PATH];
@@ -540,7 +540,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags |= CLBF_PROPORTIONAL;
if (IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags |= CLBF_TILEVTOROWHEIGHT;
- DBWriteContactSettingWord(NULL,"CLC","BkBmpUse",flags);
+ db_set_w(NULL,"CLC","BkBmpUse",flags);
}
pcli->pfnClcOptionsChanged();
diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp index dda20b767f..41a73e0041 100644 --- a/plugins/Clist_mw/src/clistmod.cpp +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -101,15 +101,15 @@ static int ProtocolAck(WPARAM wParam,LPARAM lParam) ACKDATA *ack = (ACKDATA*)lParam;
if (ack->type == ACKTYPE_AWAYMSG && ack->lParam) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv)) {
+ if ( !db_get_ts(ack->hContact, "CList", "StatusMsg", &dbv)) {
if ( !_tcscmp(dbv.ptszVal, (TCHAR *)ack->lParam)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( db_get_b(NULL,"CList","ShowStatusMsg",0) || db_get_b(ack->hContact,"CList","StatusMsgAuto",0))
- DBWriteContactSettingTString(ack->hContact, "CList", "StatusMsg", (TCHAR *)ack->lParam);
+ db_set_ts(ack->hContact, "CList", "StatusMsg", (TCHAR *)ack->lParam);
}
return 0;
@@ -136,7 +136,7 @@ int LoadContactListModule(void) }
hCListImages = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
- DefaultImageListColorDepth = DBGetContactSettingDword(NULL,"CList","DefaultImageListColorDepth",ILC_COLOR32);
+ DefaultImageListColorDepth = db_get_dw(NULL,"CList","DefaultImageListColorDepth",ILC_COLOR32);
hProtoAckHook = (HANDLE) HookEvent(ME_PROTO_ACK, ProtocolAck);
HookEvent(ME_OPT_INITIALISE,CListOptInit);
diff --git a/plugins/Clist_mw/src/clistopts.cpp b/plugins/Clist_mw/src/clistopts.cpp index 2a927efc75..85a79385ae 100644 --- a/plugins/Clist_mw/src/clistopts.cpp +++ b/plugins/Clist_mw/src/clistopts.cpp @@ -137,7 +137,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { int i,count,item;
PROTOACCOUNT **accs;
DBVARIANT dbv = {DBVT_DELETED};
- DBGetContactSettingString(NULL,"CList","PrimaryStatus",&dbv);
+ db_get_s(NULL,"CList","PrimaryStatus",&dbv);
ProtoEnumAccounts( &count, &accs );
item = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_ADDSTRING,0,(LPARAM)TranslateT("Global"));
SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETITEMDATA,item,0);
@@ -201,7 +201,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
if ( !(caps & CLUIF_HASAUTOHIDEOPTION)) {
db_set_b(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
- DBWriteContactSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0));
+ db_set_w(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0));
}
}
db_set_b(NULL,"CList","SortByStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SORTBYSTATUS));
@@ -215,15 +215,15 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_b(NULL,"CList","AlwaysStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALWAYSSTATUS));
db_set_b(NULL,"CList","AlwaysMulti",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_ALWAYSMULTI));
db_set_b(NULL,"CList","TrayIcon",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)?SETTING_TRAYICON_SINGLE:(IsDlgButtonChecked(hwndDlg,IDC_CYCLE)?SETTING_TRAYICON_CYCLE:SETTING_TRAYICON_MULTI)));
- DBWriteContactSettingWord(NULL,"CList","CycleTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_GETPOS,0,0));
- DBWriteContactSettingWord(NULL,"CList","IconFlashTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_GETPOS,0,0));
+ db_set_w(NULL,"CList","CycleTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_GETPOS,0,0));
+ db_set_w(NULL,"CList","IconFlashTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_GETPOS,0,0));
db_set_b(NULL,"CList","DisableTrayFlash",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISABLEBLINK));
db_set_b(NULL,"CList","NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ICONBLINK));
{
int cursel = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0);
PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETITEMDATA,cursel,0);
if ( pa == NULL )
- DBDeleteContactSetting(NULL, "CList","PrimaryStatus");
+ db_unset(NULL, "CList","PrimaryStatus");
else
db_set_s(NULL,"CList","PrimaryStatus", pa->szModuleName);
}
diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp index c0dd11b077..28b69254ca 100644 --- a/plugins/Clist_mw/src/clistsettings.cpp +++ b/plugins/Clist_mw/src/clistsettings.cpp @@ -120,7 +120,7 @@ void CheckPDNCE(ClcCacheEntry *_pdnce) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(pdnce->hContact,"CList","Group",&dbv))
+ if ( !db_get_ts(pdnce->hContact,"CList","Group",&dbv))
{
pdnce->tszGroup = mir_tstrdup(dbv.ptszVal);
mir_free(dbv.pszVal);
@@ -135,7 +135,7 @@ void CheckPDNCE(ClcCacheEntry *_pdnce) pdnce->noHiddenOffline = db_get_b(pdnce->hContact,"CList","noOffline",0);
if ( pdnce->IdleTS == -1 )
- pdnce->IdleTS = DBGetContactSettingDword(pdnce->hContact,pdnce->szProto,"IdleTS",0);
+ pdnce->IdleTS = db_get_dw(pdnce->hContact,pdnce->szProto,"IdleTS",0);
if (pdnce->ApparentMode == -1)
pdnce->ApparentMode = db_get_w(pdnce->hContact,pdnce->szProto,"ApparentMode",0);
diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index 3e63f9ceff..f96a3a0697 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -419,7 +419,7 @@ int GetStatsuBarProtoRect(HWND hwnd,char *szProto,RECT *rc) {
int nParts,nPanel;
ProtocolData *PD;
- int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
+ int startoffset = db_get_dw(NULL,"StatusBar","FirstIconOffset",0);
if ( !UseOwnerDrawStatusBar) startoffset = 0;
@@ -514,11 +514,11 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l GetWindowRect(hwnd, &rc);
if ( !CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) {
//if docked, dont remember pos (except for width)
- DBWriteContactSettingDword(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top));
- DBWriteContactSettingDword(NULL,"CList","x",(DWORD)rc.left);
- DBWriteContactSettingDword(NULL,"CList","y",(DWORD)rc.top);
+ db_set_dw(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top));
+ db_set_dw(NULL,"CList","x",(DWORD)rc.left);
+ db_set_dw(NULL,"CList","y",(DWORD)rc.top);
}
- DBWriteContactSettingDword(NULL,"CList","Width",(DWORD)(rc.right - rc.left));
+ db_set_dw(NULL,"CList","Width",(DWORD)(rc.right - rc.left));
}
if ( wParam == SIZE_MINIMIZED ) {
if ( db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT )) {
@@ -648,8 +648,8 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l int totcount;
ProtocolData *PD;
int menuid;
- int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
- int extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
+ int startoffset = db_get_dw(NULL,"StatusBar","FirstIconOffset",0);
+ int extraspace = db_get_dw(NULL,"StatusBar","BkExtraSpace",0);
boolean UseOwnerDrawStatusBar = db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0);
hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
@@ -686,7 +686,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break;
} } }
- totcount = DBGetContactSettingDword(0,"Protocols","ProtoCount",0);
+ totcount = db_get_dw(0,"Protocols","ProtoCount",0);
PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
if (PD == NULL){return 0;}
menuid = nPanel;
@@ -756,11 +756,11 @@ int LoadCLUIModule(void) CreateServiceFunction("CLUI/GetConnectingIconForProtocol",GetConnectingIconService);
- if (DBGetContactSettingTString(NULL,"CList","TitleText",&dbv))
+ if (db_get_ts(NULL,"CList","TitleText",&dbv))
lstrcpyn(titleText,_T(MIRANDANAME),SIZEOF(titleText));
else {
lstrcpyn(titleText,dbv.ptszVal,SIZEOF(titleText));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
oldhideoffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
diff --git a/plugins/Clist_mw/src/cluiopts.cpp b/plugins/Clist_mw/src/cluiopts.cpp index 5a70db69b1..3838380564 100644 --- a/plugins/Clist_mw/src/cluiopts.cpp +++ b/plugins/Clist_mw/src/cluiopts.cpp @@ -95,7 +95,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L char *s;
char szUin[20];
- if (DBGetContactSettingString(NULL,"CList","TitleText",&dbv) == 0&&(dbv.pszVal))
+ if (db_get_s(NULL,"CList","TitleText",&dbv) == 0&&(dbv.pszVal))
{
s = mir_strdup(dbv.pszVal);
mir_free(dbv.pszVal);
@@ -112,20 +112,20 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)MIRANDANAME);
- wsprintfA(szUin,"%u",DBGetContactSettingDword(NULL,"ICQ","UIN",0));
+ wsprintfA(szUin,"%u",db_get_dw(NULL,"ICQ","UIN",0));
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)szUin);
- if ( !DBGetContactSettingString(NULL,"ICQ","Nick",&dbv)) {
+ if ( !db_get_s(NULL,"ICQ","Nick",&dbv)) {
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal);
mir_free(dbv.pszVal);
dbv.pszVal = NULL;
}
- if ( !DBGetContactSettingString(NULL,"ICQ","FirstName",&dbv)) {
+ if ( !db_get_s(NULL,"ICQ","FirstName",&dbv)) {
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal);
mir_free(dbv.pszVal);
dbv.pszVal = NULL;
}
- if ( !DBGetContactSettingString(NULL,"ICQ","e-mail",&dbv)) {
+ if ( !db_get_s(NULL,"ICQ","e-mail",&dbv)) {
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal);
mir_free(dbv.pszVal);
dbv.pszVal = NULL;
@@ -249,7 +249,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { TCHAR title[256];
GetDlgItemText(hwndDlg,IDC_TITLETEXT,title,SIZEOF(title));
- DBWriteContactSettingTString(NULL,"CList","TitleText",title);
+ db_set_ts(NULL,"CList","TitleText",title);
SetWindowText(pcli->hwndContactList,title);
}
db_set_b(NULL,"CLUI","FadeInOut",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT));
@@ -257,7 +257,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(NULL,"CLUI","MaxSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MAXSIZEHEIGHT,NULL,FALSE));
db_set_b(NULL,"CLUI","AutoSizeUpward",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZEUPWARD));
db_set_b(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
- DBWriteContactSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0));
+ db_set_w(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0));
db_set_b(NULL,"CList","Transparent",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT));
db_set_b(NULL,"CList","Alpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0));
@@ -298,7 +298,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_USEOWNERDRAW, db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",1) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLUI","SBarBKColor",CLR_DEFAULT));
+ SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,db_get_dw(NULL,"CLUI","SBarBKColor",CLR_DEFAULT));
if ( !IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)) {
EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),FALSE);
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case PSN_APPLY:
{
COLORREF col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0);
- DBWriteContactSettingDword(NULL,"CLUI","SBarBKColor",col);
+ db_set_dw(NULL,"CLUI","SBarBKColor",col);
db_set_b(NULL,"CLUI","ShowSBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR));
db_set_b(NULL,"CLUI","SBarShow",(BYTE)((IsDlgButtonChecked(hwndDlg,IDC_SHOWICON)?1:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWPROTO)?2:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWSTATUS)?4:0)));
diff --git a/plugins/Clist_mw/src/cluiservices.cpp b/plugins/Clist_mw/src/cluiservices.cpp index d57ae77741..095576878c 100644 --- a/plugins/Clist_mw/src/cluiservices.cpp +++ b/plugins/Clist_mw/src/cluiservices.cpp @@ -53,7 +53,7 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) if ( pcli->hwndStatus == 0 )
return;
- FirstIconOffset = DBGetContactSettingDword(NULL,"CLUI","FirstIconOffset",0);
+ FirstIconOffset = db_get_dw(NULL,"CLUI","FirstIconOffset",0);
ProtoEnumAccounts( &protoCount, &accs );
if ( protoCount == 0 )
@@ -65,7 +65,7 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) SendMessage(pcli->hwndStatus,SB_GETBORDERS,0,(LPARAM)&borders);
- SendMessage(pcli->hwndStatus,SB_SETBKCOLOR,0,DBGetContactSettingDword(0,"CLUI","SBarBKColor",CLR_DEFAULT));
+ SendMessage(pcli->hwndStatus,SB_SETBKCOLOR,0,db_get_dw(0,"CLUI","SBarBKColor",CLR_DEFAULT));
partWidths = (int*)alloca((protoCount+1)*sizeof(int));
//partWidths[0] = FirstIconOffset;
if ( db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0)||db_get_b(NULL,"CLUI","EqualSections",1))
@@ -105,8 +105,8 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) HDC hdc;
SIZE textSize;
BYTE showOpts = db_get_b(NULL,"CLUI","SBarShow",5);
- DWORD extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
- DWORD startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
+ DWORD extraspace = db_get_dw(NULL,"StatusBar","BkExtraSpace",0);
+ DWORD startoffset = db_get_dw(NULL,"StatusBar","FirstIconOffset",0);
int x;
hdc = GetDC(pcli->hwndStatus);
diff --git a/plugins/Clist_mw/src/commonheaders.h b/plugins/Clist_mw/src/commonheaders.h index 4faf052f07..8b4c9181de 100644 --- a/plugins/Clist_mw/src/commonheaders.h +++ b/plugins/Clist_mw/src/commonheaders.h @@ -63,7 +63,7 @@ extern HINSTANCE g_hInst; all the bad free()'s to good ones, however it's still incorrect code. The reasons for not
changing them include:
- * DBFreeVariant has a CallService() lookup
+ * db_free has a CallService() lookup
* free() is executed in some large loops to do with clist creation of group data
* easy search and replace
diff --git a/plugins/Clist_mw/src/contact.cpp b/plugins/Clist_mw/src/contact.cpp index e6c4f31805..bd2ad97052 100644 --- a/plugins/Clist_mw/src/contact.cpp +++ b/plugins/Clist_mw/src/contact.cpp @@ -178,7 +178,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam) {
CallService(MS_CLUI_CONTACTDELETED,wParam,0);
if ((HANDLE)lParam == NULL)
- DBDeleteContactSetting((HANDLE)wParam,"CList","Group");
+ db_unset((HANDLE)wParam,"CList","Group");
else
db_set_s((HANDLE)wParam,"CList","Group",(char*)CallService(MS_CLIST_GROUPGETNAME2,lParam,(LPARAM)(int*)NULL));
diff --git a/plugins/Clist_nicer/skineditor/src/main.cpp b/plugins/Clist_nicer/skineditor/src/main.cpp index 465071f7f5..e4a31f61df 100644 --- a/plugins/Clist_nicer/skineditor/src/main.cpp +++ b/plugins/Clist_nicer/skineditor/src/main.cpp @@ -688,8 +688,8 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Bumped"));
SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Etched"));
- SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3ddark", RGB(224,224,224)));
- SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3dbright", RGB(224,224,224)));
+ SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, "CLCExt", "3ddark", RGB(224,224,224)));
+ SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, "CLCExt", "3dbright", RGB(224,224,224)));
return 0;
case WM_DRAWITEM:
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index c63cd319d7..0eb0752233 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -2477,7 +2477,7 @@ int OnFrameTitleBarBackgroundChange() hBmpBackground = NULL;
}
if (cfg::getByte("FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- if ( !DBGetContactSetting(NULL, "FrameTitleBar", "BkBitmap", &dbv)) {
+ if ( !db_get(NULL, "FrameTitleBar", "BkBitmap", &dbv)) {
hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
mir_free(dbv.pszVal);
}
diff --git a/plugins/Clist_nicer/src/Include/commonheaders.h b/plugins/Clist_nicer/src/Include/commonheaders.h index d92f07724b..a094b29235 100644 --- a/plugins/Clist_nicer/src/Include/commonheaders.h +++ b/plugins/Clist_nicer/src/Include/commonheaders.h @@ -183,7 +183,7 @@ extern ImageItem *g_glyphItem; all the bad free()'s to good ones, however it's still incorrect code. The reasons for not
changing them include:
- * DBFreeVariant has a CallService() lookup
+ * db_free has a CallService() lookup
* free() is executed in some large loops to do with clist creation of group data
* easy search and replace
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 757fa029f0..6f49e7c97c 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -248,7 +248,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) szProto = GetContactProto(hContact);
if (szProto) {
if ( !result )
- DBFreeVariant( &dbv );
+ db_free( &dbv );
if ( !( result = cfg::getTString(hContact, szProto, "YMsg", &dbv)) && lstrlen(dbv.ptszVal) > 1)
p->bStatusMsgValid = STATUSMSG_YIM;
else if ( !(result = cfg::getTString(hContact, szProto, "StatusDescr", &dbv)) && lstrlen(dbv.ptszVal) > 1)
@@ -260,7 +260,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if (p->bStatusMsgValid == STATUSMSG_NOTFOUND) { // no status msg, consider xstatus name (if available)
if ( !result )
- DBFreeVariant( &dbv );
+ db_free( &dbv );
result = cfg::getTString(hContact, szProto, "XStatusName", &dbv);
if ( !result && lstrlen(dbv.ptszVal) > 1) {
int iLen = lstrlen(dbv.ptszVal);
@@ -306,7 +306,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) p->statusMsg[j] = (TCHAR)0;
}
if ( !result )
- DBFreeVariant( &dbv );
+ db_free( &dbv );
if (p->bStatusMsgValid != STATUSMSG_NOTFOUND) {
WORD infoTypeC2[12];
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index 49f569fd6c..5f249c17df 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -736,7 +736,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if ( PathToAbsoluteT(dbv.ptszVal, szPath))
SetDlgItemText(hwndDlg, IDC_FILENAME, szPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
WORD bmpUse = cfg::getWord("CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
@@ -817,7 +817,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, COLORREF col;
col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
if (col == CLCDEFAULT_BKCOLOUR)
- DBDeleteContactSetting(NULL, "CLC", "BkColour");
+ db_unset(NULL, "CLC", "BkColour");
else
cfg::writeDword("CLC", "BkColour", col);
cfg::writeByte("CLC", "UseWinColours", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR));
diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index a9706be4c1..22f4e4ea75 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -251,12 +251,12 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA if ((iSel = SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_GETCURSEL, 0, 0)) != CB_ERR) {
if (iSel == 0) {
- DBDeleteContactSetting(hContact, "CList", "CLN_2ndline");
+ db_unset(hContact, "CList", "CLN_2ndline");
if (contact)
contact->bSecondLine = cfg::dat.dualRowMode;
}
else {
- DBWriteContactSettingByte(hContact, "CList", "CLN_2ndline", (BYTE)(iSel - 1));
+ db_set_b(hContact, "CList", "CLN_2ndline", (BYTE)(iSel - 1));
if (contact)
contact->bSecondLine = (BYTE)(iSel - 1);
}
@@ -332,7 +332,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA else if (IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSOFFLINE))
wApparentMode = ID_STATUS_OFFLINE;
- //DBWriteContactSettingWord(hContact, contact->proto, "ApparentMode", wApparentMode);
+ //db_set_w(hContact, contact->proto, "ApparentMode", wApparentMode);
//if (oldApparentMode != wApparentMode)
CallContactService(hContact, PSS_SETAPPARENTMODE, (WPARAM)wApparentMode, 0);
SendMessage(hWnd, WM_USER + 120, 0, 0);
diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index e5e5ae8baf..ae022a4a7f 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -183,7 +183,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) clip = 5;
else
clip = 0;
- //clip = max(clip, DBGetContactSettingByte(NULL, "CLUI", "ignoreframepixels", 2));
+ //clip = max(clip, db_get_b(NULL, "CLUI", "ignoreframepixels", 2));
//rgn = CreateRoundRectRgn(rc.left + clip, rc.top + clip, rc.right - clip, rc.bottom - clip, 10 + clip, 10 + clip);
//rgn = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
//for (i = rc.top + 3 + clip; i < rc.bottom - 3 - clip; i += (height / iStepY)) {
diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index a8210472bd..666b9b2ab8 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -106,7 +106,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBVARIANT dbv = {
DBVT_DELETED
};
- DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv);
+ db_get(NULL, "CList", "PrimaryStatus", &dbv);
ProtoEnumAccounts( &count, &accs );
item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) TranslateT("Global"));
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM) 0);
@@ -191,7 +191,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int cursel = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cursel, 0);
if ( !pa )
- DBDeleteContactSetting(NULL, "CList", "PrimaryStatus");
+ db_unset(NULL, "CList", "PrimaryStatus");
else
cfg::writeString(NULL, "CList", "PrimaryStatus", pa->szModuleName );
}
diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index 24edcfe047..9430ed1f56 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -108,7 +108,7 @@ void TrayIconUpdateBase(const char *szChangedProto) changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), NULL);
else
changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
}
case SETTING_TRAYICON_CYCLE:
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index c4aa28a52e..843e27cccc 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -177,7 +177,7 @@ static HWND PreCreateCLC(HWND parent) WS_CHILD | CLS_CONTACTLIST
| (cfg::getByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0)
| CLS_HIDEOFFLINE
- //|(DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0)
+ //|(db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0)
| (cfg::getByte(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0)
| CLS_MULTICOLUMN
, 0, 0, 0, 0, parent, NULL, g_hInst, (LPVOID)0xff00ff00);
@@ -451,7 +451,7 @@ void SetDBButtonStates(HANDLE hPassedContact) if ( !cfg::getString(hFinalContact, szModule, szSetting, &dbv)) {
result = !strcmp((char *)buttonItem->bValuePush, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else {
switch (buttonItem->type) {
@@ -884,12 +884,12 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (cfg::getByte("CList", "AutoApplyLastViewMode", 0)) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSetting(NULL, "CList", "LastViewMode", &dbv)) {
+ if ( !db_get(NULL, "CList", "LastViewMode", &dbv)) {
if (lstrlenA(dbv.pszVal) > 2) {
if (cfg::getDword(NULL, CLVM_MODULE, dbv.pszVal, -1) != 0xffffffff)
ApplyViewMode((char *)dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
if ( !cfg::dat.autosize)
@@ -1427,7 +1427,7 @@ skipbg: if (fDelete) {
//_DebugTraceA("delete value: %s, %s ON %d", szModule, szSetting, finalhContact);
- DBDeleteContactSetting(finalhContact, szModule, szSetting);
+ db_unset(finalhContact, szModule, szSetting);
} else {
switch (item->type) {
case DBVT_BYTE:
diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index 15ad632d14..c2b5ced4d0 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -94,7 +94,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l DBVARIANT dbv;
if ( !cfg::getTString(NULL, "CList", "TitleText", &dbv)) {
SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME);
}
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index b21bc4d392..8e373e9138 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -204,7 +204,7 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) }
// update the clui button
- if ( !DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv)) {
+ if ( !db_get(NULL, "CList", "PrimaryStatus", &dbv)) {
if (dbv.type == DBVT_ASCIIZ && lstrlenA(dbv.pszVal) > 1) {
wStatus = (WORD) CallProtoService(dbv.pszVal, PS_GETSTATUS, 0, 0);
iIcon = IconFromStatusMode(dbv.pszVal, (int) wStatus, 0, &hIcon);
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index e224682e70..c6b85f5468 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -84,7 +84,7 @@ void cfg::init() DWORD cfg::getDword(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD uDefault = 0)
{
- return((DWORD)DBGetContactSettingDword(hContact, szModule, szSetting, uDefault));
+ return((DWORD)db_get_dw(hContact, szModule, szSetting, uDefault));
}
/*
@@ -93,7 +93,7 @@ DWORD cfg::getDword(const HANDLE hContact = 0, const char *szModule = 0, const c DWORD cfg::getDword(const char *szSetting = 0, DWORD uDefault = 0)
{
- return((DWORD)DBGetContactSettingDword(0, DEFAULT_MODULE, szSetting, uDefault));
+ return((DWORD)db_get_dw(0, DEFAULT_MODULE, szSetting, uDefault));
}
/*
@@ -102,13 +102,13 @@ DWORD cfg::getDword(const char *szSetting = 0, DWORD uDefault = 0) DWORD cfg::getDword(const char *szModule, const char *szSetting, DWORD uDefault)
{
- return((DWORD)DBGetContactSettingDword(0, szModule, szSetting, uDefault));
+ return((DWORD)db_get_dw(0, szModule, szSetting, uDefault));
}
WORD cfg::getWord(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD uDefault = 0)
{
- return((WORD)DBGetContactSettingWord(hContact, szModule, szSetting, uDefault));
+ return((WORD)db_get_w(hContact, szModule, szSetting, uDefault));
}
/*
@@ -117,7 +117,7 @@ WORD cfg::getWord(const HANDLE hContact = 0, const char *szModule = 0, const cha WORD cfg::getWord(const char *szSetting = 0, WORD uDefault = 0)
{
- return((WORD)DBGetContactSettingWord(0, DEFAULT_MODULE, szSetting, uDefault));
+ return((WORD)db_get_w(0, DEFAULT_MODULE, szSetting, uDefault));
}
/*
@@ -126,7 +126,7 @@ WORD cfg::getWord(const char *szSetting = 0, WORD uDefault = 0) WORD cfg::getWord(const char *szModule, const char *szSetting, WORD uDefault)
{
- return((WORD)DBGetContactSettingWord(0, szModule, szSetting, uDefault));
+ return((WORD)db_get_w(0, szModule, szSetting, uDefault));
}
/*
@@ -134,27 +134,27 @@ WORD cfg::getWord(const char *szModule, const char *szSetting, WORD uDefault) */
int cfg::getByte(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, int uDefault = 0)
{
- return(DBGetContactSettingByte(hContact, szModule, szSetting, uDefault));
+ return(db_get_b(hContact, szModule, szSetting, uDefault));
}
int cfg::getByte(const char *szSetting = 0, int uDefault = 0)
{
- return(DBGetContactSettingByte(0, DEFAULT_MODULE, szSetting, uDefault));
+ return(db_get_b(0, DEFAULT_MODULE, szSetting, uDefault));
}
int cfg::getByte(const char *szModule, const char *szSetting, int uDefault)
{
- return(DBGetContactSettingByte(0, szModule, szSetting, uDefault));
+ return(db_get_b(0, szModule, szSetting, uDefault));
}
INT_PTR cfg::getTString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
{
- return(DBGetContactSettingTString(hContact, szModule, szSetting, dbv));
+ return(db_get_ts(hContact, szModule, szSetting, dbv));
}
INT_PTR cfg::getString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
{
- return(DBGetContactSettingString(hContact, szModule, szSetting, dbv));
+ return(db_get_s(hContact, szModule, szSetting, dbv));
}
/*
@@ -163,42 +163,42 @@ INT_PTR cfg::getString(const HANDLE hContact, const char *szModule, const char * INT_PTR cfg::writeDword(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD value = 0)
{
- return(DBWriteContactSettingDword(hContact, szModule, szSetting, value));
+ return(db_set_dw(hContact, szModule, szSetting, value));
}
INT_PTR cfg::writeDword(const char *szModule = 0, const char *szSetting = 0, DWORD value = 0)
{
- return(DBWriteContactSettingDword(0, szModule, szSetting, value));
+ return(db_set_dw(0, szModule, szSetting, value));
}
INT_PTR cfg::writeWord(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD value = 0)
{
- return(DBWriteContactSettingWord(hContact, szModule, szSetting, value));
+ return(db_set_w(hContact, szModule, szSetting, value));
}
INT_PTR cfg::writeWord(const char *szModule = 0, const char *szSetting = 0, WORD value = 0)
{
- return(DBWriteContactSettingWord(0, szModule, szSetting, value));
+ return(db_set_w(0, szModule, szSetting, value));
}
INT_PTR cfg::writeByte(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, BYTE value = 0)
{
- return(DBWriteContactSettingByte(hContact, szModule, szSetting, value));
+ return(db_set_b(hContact, szModule, szSetting, value));
}
INT_PTR cfg::writeByte(const char *szModule = 0, const char *szSetting = 0, BYTE value = 0)
{
- return(DBWriteContactSettingByte(0, szModule, szSetting, value));
+ return(db_set_b(0, szModule, szSetting, value));
}
INT_PTR cfg::writeTString(const HANDLE hContact, const char *szModule = 0, const char *szSetting = 0, const TCHAR *str = 0)
{
- return(DBWriteContactSettingTString(hContact, szModule, szSetting, str));
+ return(db_set_ts(hContact, szModule, szSetting, str));
}
INT_PTR cfg::writeString(const HANDLE hContact, const char *szModule = 0, const char *szSetting = 0, const char *str = 0)
{
- return(DBWriteContactSettingString(hContact, szModule, szSetting, str));
+ return(db_set_s(hContact, szModule, szSetting, str));
}
TExtraCache* cfg::getCache(const HANDLE hContact, const char *szProto)
@@ -211,7 +211,7 @@ TExtraCache* cfg::getCache(const HANDLE hContact, const char *szProto) TExtraCache *p = (TExtraCache*)calloc(sizeof(TExtraCache), 1);
p->hContact = hContact;
LoadSkinItemToCache(p, szProto);
- p->dwDFlags = DBGetContactSettingDword(hContact, "CList", "CLN_Flags", 0);
+ p->dwDFlags = db_get_dw(hContact, "CList", "CLN_Flags", 0);
GetCachedStatusMsg(p, const_cast<char *>(szProto));
p->dwLastMsgTime = INTSORT_GetLastMsgTime(hContact);
cfg::arCache.insert(p);
diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index b6f3de75a3..b96be53a52 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -158,9 +158,9 @@ void LoadContactTree(void) pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(GetContactProto(hContact), status, hContact, NULL), 1);
if (mc_disablehgh && !mc_hgh_removed) {
- if ( !DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if ( !db_get(hContact, "CList", "Group", &dbv)) {
if ( !strcmp(dbv.pszVal, "MetaContacts Hidden Group"))
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
mir_free(dbv.pszVal);
}
}
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 771e36bba0..a41f0f5ff6 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -522,7 +522,7 @@ void extbk_export(char *file) if ( !cfg::getString(NULL, "CLC", "BkBitmap", &dbv)) {
WritePrivateProfileStringA("Global", "BkBitmap", dbv.pszVal, file);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -1177,7 +1177,7 @@ void IMG_LoadItems() WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, szFileName, MAX_PATH, 0, 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if ( !PathFileExists(tszFileName))
return;
@@ -1273,14 +1273,14 @@ void LoadPerContactSkins(TCHAR *tszFileName) if ((INT_PTR) uid != CALLSERVICE_NOTFOUND && uid != NULL) {
DBVARIANT dbv = {0};
- DBGetContactSetting(hContact, szProto, uid, &dbv);
+ db_get(hContact, szProto, uid, &dbv);
switch(dbv.type) {
case DBVT_DWORD:
mir_snprintf(UIN, 40, "%d", dbv.dVal);
break;
case DBVT_ASCIIZ:
mir_snprintf(UIN, 40, "%s", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
default:
UIN[0] = 0;
@@ -1451,7 +1451,7 @@ static void ApplyCLUISkin() SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -1484,7 +1484,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if ( !cfg::getString(NULL, "CLC", "ContactSkins", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_SKINFILE, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
Utils::enableDlgControl(hwndDlg, IDC_RELOAD, TRUE);
}
else
@@ -1492,7 +1492,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_USESKIN, cfg::getByte("CLUI", "useskin", 0) ? BST_CHECKED : BST_UNCHECKED);
if ( !cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) {
SetDlgItemText(hwndDlg, IDC_SKINFILENAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemText(hwndDlg, IDC_SKINFILENAME, _T(""));
@@ -1537,7 +1537,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if ( !cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) {
if (_tcscmp(dbv.ptszVal, final_path))
skinChanged = TRUE;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
skinChanged = TRUE;
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 2e6809b847..d574c00e11 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -223,7 +223,7 @@ static int FillDialog(HWND hwnd) item.pszText = &dbv.ptszVal[1];
newItem = SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);
ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP);
@@ -484,7 +484,7 @@ void UpdateFilters() mir_snprintf(szTemp, 100, Translate("Current view mode: %s"), g_szModename);
SetDlgItemTextA(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
mir_snprintf(szSetting, 128, "%c%s_PF", 246, szBuf);
- if (DBGetContactSetting(NULL, CLVM_MODULE, szSetting, &dbv_pf))
+ if (db_get(NULL, CLVM_MODULE, szSetting, &dbv_pf))
goto cleanup;
mir_snprintf(szSetting, 128, "%c%s_GF", 246, szBuf);
if (cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv_gf))
@@ -580,8 +580,8 @@ void UpdateFilters() ShowPage(clvmHwnd, 0);
cleanup:
- DBFreeVariant(&dbv_pf);
- DBFreeVariant(&dbv_gf);
+ db_free(&dbv_pf);
+ db_free(&dbv_gf);
free(szBuf);
}
@@ -685,16 +685,16 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), (LPARAM)szBuf);
mir_snprintf(szSetting, 256, "%c%s_PF", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
+ db_unset(NULL, CLVM_MODULE, szSetting);
mir_snprintf(szSetting, 256, "%c%s_GF", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
+ db_unset(NULL, CLVM_MODULE, szSetting);
mir_snprintf(szSetting, 256, "%c%s_SM", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
+ db_unset(NULL, CLVM_MODULE, szSetting);
mir_snprintf(szSetting, 256, "%c%s_VA", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
+ db_unset(NULL, CLVM_MODULE, szSetting);
mir_snprintf(szSetting, 256, "%c%s_SSM", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szBuf);
+ db_unset(NULL, CLVM_MODULE, szSetting);
+ db_unset(NULL, CLVM_MODULE, szBuf);
if ( !strcmp(cfg::dat.current_viewmode, szBuf) && lstrlenA(szBuf) == lstrlenA(cfg::dat.current_viewmode)) {
cfg::dat.bFilterEffective = 0;
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 13a73e109f..12d3dc78b7 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -804,7 +804,7 @@ void HandleSoundsCommand(PCommand command, TArgument *argv, int argc, PReply rep case STATE_ON:
{
failure = 0;
- DBWriteContactSettingByte(NULL, "Skin", "UseSound", 1);
+ db_set_b(NULL, "Skin", "UseSound", 1);
state = TRUE;
break;
@@ -813,7 +813,7 @@ void HandleSoundsCommand(PCommand command, TArgument *argv, int argc, PReply rep case STATE_OFF:
{
failure = 0;
- DBWriteContactSettingByte(NULL, "Skin", "UseSound", 0);
+ db_set_b(NULL, "Skin", "UseSound", 0);
state = FALSE;
break;
@@ -821,11 +821,11 @@ void HandleSoundsCommand(PCommand command, TArgument *argv, int argc, PReply rep case STATE_TOGGLE:
{
- state = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1);
+ state = db_get_b(NULL, "Skin", "UseSound", 1);
failure = 0;
state = 1 - state;
- DBWriteContactSettingByte(NULL, "Skin", "UseSound", state);
+ db_set_b(NULL, "Skin", "UseSound", state);
break;
}
@@ -1302,7 +1302,7 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r char *module = argv[3];
char *key = argv[4];
- DBDeleteContactSetting(NULL, module, key);
+ db_unset(NULL, module, key);
reply->code = MIMRES_SUCCESS;
mir_snprintf(reply->message, reply->cMessage, Translate("Setting '%s/%s' deleted."), module, key);
@@ -1330,7 +1330,7 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r {
case VALUE_STRING:
{
- DBWriteContactSettingString(NULL, module, key, (char *) value);
+ db_set_s(NULL, module, key, (char *) value);
wrote = "string";
break;
@@ -1338,7 +1338,7 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r case VALUE_BYTE:
{
- DBWriteContactSettingByte(NULL, module, key, (* (char *) value));
+ db_set_b(NULL, module, key, (* (char *) value));
wrote = "byte";
break;
@@ -1346,7 +1346,7 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r case VALUE_WORD:
{
- DBWriteContactSettingWord(NULL, module, key, (* (WORD *) value));
+ db_set_w(NULL, module, key, (* (WORD *) value));
wrote = "word";
break;
@@ -1354,7 +1354,7 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r case VALUE_DWORD:
{
- DBWriteContactSettingDword(NULL, module, key, (* (DWORD *) value));
+ db_set_dw(NULL, module, key, (* (DWORD *) value));
wrote = "dword";
break;
@@ -1362,7 +1362,7 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r case VALUE_WIDE:
{
- DBWriteContactSettingWString(NULL, module, key, (WCHAR *) value);
+ db_set_ws(NULL, module, key, (WCHAR *) value);
wrote = "wide string";
break;
@@ -1402,7 +1402,7 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r DBVARIANT var = {0};
- int res = DBGetContactSetting(NULL, module, key, &var);
+ int res = db_get(NULL, module, key, &var);
if (!res)
{
char buffer[1024];
@@ -1537,7 +1537,7 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe {
case 4:
{
- int value = DBGetContactSettingByte(NULL, module, "NLUseProxy", 0);
+ int value = db_get_b(NULL, module, "NLUseProxy", 0);
reply->code = MIMRES_SUCCESS;
mir_snprintf(buffer, sizeof(buffer), "%s proxy status is %s", protocol, (value) ? "enabled" : "disabled");
@@ -1552,7 +1552,7 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe {
case STATE_OFF:
{
- DBWriteContactSettingByte(NULL, module, "NLUseProxy", 0);
+ db_set_b(NULL, module, "NLUseProxy", 0);
reply->code = MIMRES_SUCCESS;
mir_snprintf(buffer, sizeof(buffer), Translate("'%s' proxy was disabled."), protocol);
@@ -1562,7 +1562,7 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe case STATE_ON:
{
- DBWriteContactSettingByte(NULL, module, "NLUseProxy", 1);
+ db_set_b(NULL, module, "NLUseProxy", 1);
reply->code = MIMRES_SUCCESS;
mir_snprintf(buffer, sizeof(buffer), Translate("'%s' proxy was enabled."), protocol);
@@ -1572,9 +1572,9 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe case STATE_TOGGLE:
{
- int value = DBGetContactSettingByte(NULL, module, "NLUseProxy", 0);
+ int value = db_get_b(NULL, module, "NLUseProxy", 0);
value = 1 - value;
- DBWriteContactSettingByte(NULL, module, "NLUseProxy", value);
+ db_set_b(NULL, module, "NLUseProxy", value);
reply->code = MIMRES_SUCCESS;
mir_snprintf(buffer, sizeof(buffer), (value) ? Translate("'%s' proxy was enabled.") : Translate("'%s' proxy was disabled."));
@@ -1613,8 +1613,8 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe int port;
char type[256];
GetStringFromDatabase(NULL, module, "NLProxyServer", "<unknown>", host, sizeof(host));
- port = DBGetContactSettingWord(NULL, module, "NLProxyPort", 0);
- PrettyProxyType(DBGetContactSettingByte(NULL, module, "NLProxyType", 0), type, sizeof(type));
+ port = db_get_w(NULL, module, "NLProxyPort", 0);
+ PrettyProxyType(db_get_b(NULL, module, "NLProxyType", 0), type, sizeof(type));
reply->code = MIMRES_SUCCESS;
mir_snprintf(buffer, sizeof(buffer), Translate("%s proxy server: %s %s:%d."), protocol, type, host, port);
@@ -1632,9 +1632,9 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe if ((*stop == 0) && (type > 0))
{
- DBWriteContactSettingString(NULL, module, "NLProxyServer", host);
- DBWriteContactSettingWord(NULL, module, "NLProxyPort", port);
- DBWriteContactSettingByte(NULL, module, "NLProxyType", type);
+ db_set_s(NULL, module, "NLProxyServer", host);
+ db_set_w(NULL, module, "NLProxyPort", port);
+ db_set_b(NULL, module, "NLProxyType", type);
reply->code = MIMRES_SUCCESS;
mir_snprintf(buffer, sizeof(buffer), Translate("%s proxy set to %s %s:%d."), protocol, argv[4], host, port);
@@ -1774,7 +1774,7 @@ int ContactMatchSearch(HANDLE hContact, char *contact, char *id, char *account, char protocol[128];
AccountName2Protocol(account, protocol, sizeof(protocol));
- WORD contactStatus = DBGetContactSettingWord(hContact, protocol, "Status", ID_STATUS_ONLINE);
+ WORD contactStatus = db_get_w(hContact, protocol, "Status", ID_STATUS_ONLINE);
if (searchStatus != contactStatus)
{
diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index f85fb74e43..626141e68f 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -138,7 +138,7 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, int res = 1;
size_t len;
dbv.type = DBVT_ASCIIZ;
- if (DBGetContactSetting(hContact, szModule, szSettingName, &dbv) == 0)
+ if (db_get(hContact, szModule, szSettingName, &dbv) == 0)
{
res = 0;
size_t tmp = strlen(dbv.pszVal);
@@ -169,7 +169,7 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, int res = 1;
size_t len;
dbv.type = DBVT_WCHAR;
- if (DBGetContactSettingWString(hContact, szModule, szSettingName, &dbv) == 0)
+ if (db_get_ws(hContact, szModule, szSettingName, &dbv) == 0)
{
res = 0;
if (dbv.type != DBVT_WCHAR)
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) {}
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index c53c5039db..50373a214f 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -161,7 +161,7 @@ static void ShowConsole(int show) ScrollDown( pActive );
}
ShowWindow(hwndConsole, (show)?SW_SHOW:SW_HIDE);
- DBWriteContactSettingByte(NULL,"Console","Show",(BYTE)((show)?1:0));
+ db_set_b(NULL,"Console","Show",(BYTE)((show)?1:0));
if (hwnd)
SetForegroundWindow(hwnd);
@@ -1005,14 +1005,14 @@ static int OnFastDump(WPARAM wParam,LPARAM lParam) static void LoadSettings()
{
- gIcons = DBGetContactSettingByte(NULL, "Console", "ShowIcons", 1);
- gSeparator = DBGetContactSettingByte(NULL, "Console", "Separator", 1);
- gSingleMode = DBGetContactSettingByte(NULL, "Console", "SingleMode", 0);
+ gIcons = db_get_b(NULL, "Console", "ShowIcons", 1);
+ gSeparator = db_get_b(NULL, "Console", "Separator", 1);
+ gSingleMode = db_get_b(NULL, "Console", "SingleMode", 0);
- gWrapLen = DBGetContactSettingByte(NULL, "Console", "Wrap", DEFAULT_WRAPLEN);
+ gWrapLen = db_get_b(NULL, "Console", "Wrap", DEFAULT_WRAPLEN);
if ( gWrapLen < MIN_WRAPLEN ) gWrapLen = DEFAULT_WRAPLEN;
- gLimit = DBGetContactSettingDword(NULL, "Console", "Limit", MAX_LIMIT);
+ gLimit = db_get_dw(NULL, "Console", "Limit", MAX_LIMIT);
if (gLimit > MAX_LIMIT) gLimit = MAX_LIMIT;
if (gLimit < MIN_LIMIT) gLimit = MIN_LIMIT;
}
@@ -1029,7 +1029,7 @@ static void SaveSettings(HWND hwndDlg) gWrapLen = len;
SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE);
- DBWriteContactSettingByte(NULL, "Console", "Wrap", (BYTE)len);
+ db_set_b(NULL, "Console", "Wrap", (BYTE)len);
len = GetDlgItemInt(hwndDlg, IDC_LIMIT, NULL, FALSE);
if (len < MIN_LIMIT )
@@ -1040,13 +1040,13 @@ static void SaveSettings(HWND hwndDlg) gLimit = len;
SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE);
- DBWriteContactSettingDword(NULL, "Console", "Limit", len);
+ db_set_dw(NULL, "Console", "Limit", len);
- DBWriteContactSettingByte(NULL, "Console", "SingleMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SINGLE));
- DBWriteContactSettingByte(NULL, "Console", "Separator", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATOR));
- DBWriteContactSettingByte(NULL, "Console", "ShowIcons", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWICONS));
+ db_set_b(NULL, "Console", "SingleMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SINGLE));
+ db_set_b(NULL, "Console", "Separator", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATOR));
+ db_set_b(NULL, "Console", "ShowIcons", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWICONS));
- DBWriteContactSettingByte(NULL, "Console", "ShowAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_START));
+ db_set_b(NULL, "Console", "ShowAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_START));
}
@@ -1055,7 +1055,7 @@ static INT_PTR CALLBACK OptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM switch(msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_START, DBGetContactSettingByte(NULL, "Console", "ShowAtStart", 0));
+ CheckDlgButton(hwndDlg, IDC_START, db_get_b(NULL, "Console", "ShowAtStart", 0));
CheckDlgButton(hwndDlg, IDC_SINGLE, gSingleMode);
CheckDlgButton(hwndDlg, IDC_SHOWICONS, gIcons);
CheckDlgButton(hwndDlg, IDC_SEPARATOR, gSeparator);
@@ -1230,7 +1230,7 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) OnFontChange(0,0);
OnColourChange(0,0);
- if (DBGetContactSettingByte(NULL,"Console","ShowAtStart",0) || DBGetContactSettingByte(NULL,"Console","Show",1))
+ if (db_get_b(NULL,"Console","ShowAtStart",0) || db_get_b(NULL,"Console","Show",1))
ShowConsole(1);
else
ShowConsole(0);
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 32534bea8f..2406d660e6 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -34,7 +34,7 @@ HANDLE ghSendWindowList; HANDLE ghRecvWindowList;
gAckList gaAckData;
-HANDLE hContactMenuItem = NULL;
+HGENMENU hContactMenuItem;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -122,7 +122,7 @@ static bool CheckContactsServiceSupport(const char* szProto) static int HookPreBuildContactMenu(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- char* szProto =GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
int bVisible = FALSE;
if (szProto && CheckContactsServiceSupport(szProto)) {
@@ -133,13 +133,7 @@ static int HookPreBuildContactMenu(WPARAM wParam, LPARAM lParam) }
// update contact menu item's visibility
- CLISTMENUITEM mi = { sizeof(mi) };
- if (bVisible)
- mi.flags = CMIM_FLAGS;
- else
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hContactMenuItem, bVisible);
return 0;
}
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 7b1c876a3e..dbb19d3330 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -95,7 +95,7 @@ static void RebuildGroupCombo(HWND hwndDlg) int bHasGroups = !DBGetContactSettingT(NULL, "CListGroups", "0", &dbv);
HWND hGroupsCombo = GetDlgItem(hwndDlg, IDC_GROUPS);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (bHasGroups)
{
int curs = SendMessageT(hGroupsCombo, CB_GETCURSEL, 0, 0);
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index 03d9356062..454bd33b2d 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -227,7 +227,7 @@ static void SetAllContactChecks(HWND hwndList, HANDLE hReceiver) // doubtful nam char* szProto =GetContactProto(hReceiver);
if (szProto == NULL) return;
- if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_HIDEEMPTYGROUPS && DBGetContactSettingByte(NULL, "CList", "HideEmptyGroups", SETTING_USEGROUPS_DEFAULT))
+ if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_HIDEEMPTYGROUPS && db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_USEGROUPS_DEFAULT))
SendMessageT(hwndList, CLM_SETHIDEEMPTYGROUPS, (WPARAM) TRUE, 0);
else
SendMessageT(hwndList, CLM_SETHIDEEMPTYGROUPS, (WPARAM) FALSE, 0);
@@ -385,7 +385,7 @@ INT_PTR CALLBACK SendDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (!wndData->SendContacts(hwndDlg))
break;
- SetTimer(hwndDlg,TIMERID_MSGSEND,DBGetContactSettingDword(NULL,"SRMsg","MessageTimeout",TIMEOUT_MSGSEND),NULL);
+ SetTimer(hwndDlg,TIMERID_MSGSEND,db_get_dw(NULL,"SRMsg","MessageTimeout",TIMEOUT_MSGSEND),NULL);
break;
}
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 5ff85344b8..78f5fa52e6 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -100,7 +100,7 @@ char *GetContactUID(HANDLE hContact, int bTchar) SAFE_FREE((void**)&szAnsi);
}
}
- DBFreeVariant(&vrUid);
+ db_free(&vrUid);
}
}
if (bTchar)
@@ -120,7 +120,7 @@ int DBGetContactSettingT(HANDLE hContact, const char *szModule, const char* szSe if (ServiceExists(MS_DB_CONTACT_GETSETTING_STR))
return DBGetContactSettingW(hContact, szModule, szSetting, dbv);
else
- return DBGetContactSetting(hContact, szModule, szSetting, dbv);
+ return db_get(hContact, szModule, szSetting, dbv);
}
@@ -129,18 +129,18 @@ TCHAR* DBGetContactSettingStringT(HANDLE hContact, const char *szModule, const c DBVARIANT dbv = {DBVT_DELETED};
TCHAR* szRes;
- if (DBGetContactSettingWString(hContact, szModule, szSetting, &dbv))
+ if (db_get_ws(hContact, szModule, szSetting, &dbv))
return strdupT(szDef);
szRes = strdupT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return szRes;
}
int DBWriteContactSettingStringT(HANDLE hContact, const char *szModule, const char* szSetting, TCHAR* szValue)
{
- return DBWriteContactSettingWString(hContact, szModule, szSetting, (WCHAR*)szValue);
+ return db_set_ws(hContact, szModule, szSetting, (WCHAR*)szValue);
}
@@ -193,7 +193,7 @@ void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, char* pszTitleStart) if (strcmpT(uid?uid:contactName, oldTitle))
SetDlgItemTextT(hwndDlg, IDC_NAME, uid?uid:contactName);
- szStatus = MirandaStatusToStringT(szProto==NULL ? ID_STATUS_OFFLINE:DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE));
+ szStatus = MirandaStatusToStringT(szProto==NULL ? ID_STATUS_OFFLINE:db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE));
_snprintfT(newtitle, 256, "%s %s (%s)", SRCTranslateT(pszTitleStart, str), contactName, szStatus);
SAFE_FREE((void**)&uid);
@@ -216,7 +216,7 @@ void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, char* pszTitleStart) void UpdateDialogAddButton(HWND hwndDlg, HANDLE hContact)
{
- int bVisible = DBGetContactSettingByte(hContact,"CList","NotOnList",0);
+ int bVisible = db_get_b(hContact,"CList","NotOnList",0);
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), bVisible?SW_SHOW:SW_HIDE);
}
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index 3301c27249..ab109230ce 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -35,12 +35,12 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) char *pszProto = GetContactProto((HANDLE)wParam);
/* ip detect */
if ( db_get_b(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT))
- countryNumber=ServiceIpToCountry(DBGetContactSettingDword((HANDLE)wParam,pszProto,"RealIP",0),0);
+ countryNumber=ServiceIpToCountry(db_get_dw((HANDLE)wParam,pszProto,"RealIP",0),0);
/* fallback */
if (countryNumber == 0xFFFF)
- countryNumber=DBGetContactSettingWord((HANDLE)wParam,pszProto,"Country",0);
+ countryNumber=db_get_w((HANDLE)wParam,pszProto,"Country",0);
if (countryNumber == 0 || countryNumber == 0xFFFF)
- countryNumber=DBGetContactSettingWord((HANDLE)wParam,pszProto,"CompanyCountry",0);
+ countryNumber=db_get_w((HANDLE)wParam,pszProto,"CompanyCountry",0);
return (countryNumber == 0) ? 0xFFFF : countryNumber;
}
@@ -250,14 +250,14 @@ static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L case WM_NOTIFY:
switch(((NMHDR*)lParam)->code) {
case PSN_APPLY: /* setting change hook will pick these up */
- DBWriteContactSettingByte(NULL,"Flags","UseUnknownFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG) != 0));
- DBWriteContactSettingByte(NULL,"Flags","UseIpToCountry",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY) != 0));
+ db_set_b(NULL,"Flags","UseUnknownFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG) != 0));
+ db_set_b(NULL,"Flags","UseIpToCountry",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY) != 0));
/* Status Icon */
if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG)))
- DBWriteContactSettingByte(NULL,"Flags","ShowStatusIconFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG) != 0));
+ db_set_b(NULL,"Flags","ShowStatusIconFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG) != 0));
/* Extra Image */
if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG)))
- DBWriteContactSettingByte(NULL,"Flags","ShowExtraImgFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG) != 0));
+ db_set_b(NULL,"Flags","ShowExtraImgFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG) != 0));
return TRUE;
}
break;
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index d01e364ee3..8b58bddd20 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -328,7 +328,7 @@ static int ModulesLoaded(WPARAM, LPARAM) if (servicemode)
ViewVersionInfo(0, 0);
- else if (DBGetContactSettingByte(NULL, PluginName, "UploadChanged", 0) && !ProcessVIHash(false))
+ else if (db_get_b(NULL, PluginName, "UploadChanged", 0) && !ProcessVIHash(false))
UploadVersionInfo(0, 0xa1);
CheckForOtherCrashReportingPlugins();
@@ -344,9 +344,9 @@ static int PreShutdown(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(void)
{
- clsdates = DBGetContactSettingByte(NULL, PluginName, "ClassicDates", 1) != 0;
+ clsdates = db_get_b(NULL, PluginName, "ClassicDates", 1) != 0;
- dtsubfldr = DBGetContactSettingByte(NULL, PluginName, "SubFolders", 1) != 0;
+ dtsubfldr = db_get_b(NULL, PluginName, "SubFolders", 1) != 0;
mir_getLP(&pluginInfoEx);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 21eea4fb13..d7366d24b9 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -215,18 +215,18 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TranslateDialogDefault(hwndDlg);
DBVARIANT dbv;
- if (DBGetContactSettingString(NULL, PluginName, "Username", &dbv) == 0)
+ if (db_get_s(NULL, PluginName, "Username", &dbv) == 0)
{
SetDlgItemTextA(hwndDlg, IDC_USERNAME, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (DBGetContactSettingString(NULL, PluginName, "Password", &dbv) == 0)
+ if (db_get_s(NULL, PluginName, "Password", &dbv) == 0)
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM)dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- CheckDlgButton(hwndDlg, IDC_UPLOADCHN, DBGetContactSettingByte(NULL, PluginName, "UploadChanged", 0));
+ CheckDlgButton(hwndDlg, IDC_UPLOADCHN, db_get_b(NULL, PluginName, "UploadChanged", 0));
CheckDlgButton(hwndDlg, IDC_CLASSICDATES, clsdates);
CheckDlgButton(hwndDlg, IDC_DATESUBFOLDER, dtsubfldr);
}
@@ -242,25 +242,25 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
char szSetting[100];
GetDlgItemTextA(hwndDlg, IDC_USERNAME, szSetting, SIZEOF(szSetting));
- DBWriteContactSettingString(NULL, PluginName, "Username", szSetting);
+ db_set_s(NULL, PluginName, "Username", szSetting);
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szSetting, SIZEOF(szSetting));
CallService(MS_DB_CRYPT_ENCODESTRING, SIZEOF(szSetting), (LPARAM)szSetting);
- DBWriteContactSettingString(NULL, PluginName, "Password", szSetting);
+ db_set_s(NULL, PluginName, "Password", szSetting);
- DBWriteContactSettingByte(NULL, PluginName, "UploadChanged",
+ db_set_b(NULL, PluginName, "UploadChanged",
(BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPLOADCHN));
clsdates = IsDlgButtonChecked(hwndDlg, IDC_CLASSICDATES) == BST_CHECKED;
if (clsdates)
- DBWriteContactSettingByte(NULL, PluginName, "ClassicDates", 1);
+ db_set_b(NULL, PluginName, "ClassicDates", 1);
else
- DBDeleteContactSetting(NULL, PluginName, "ClassicDates");
+ db_unset(NULL, PluginName, "ClassicDates");
dtsubfldr = IsDlgButtonChecked(hwndDlg, IDC_DATESUBFOLDER) == BST_CHECKED;
if (dtsubfldr)
- DBWriteContactSettingByte(NULL, PluginName, "SubFolders", 1);
+ db_set_b(NULL, PluginName, "SubFolders", 1);
else
- DBDeleteContactSetting(NULL, PluginName, "SubFolders");
+ db_unset(NULL, PluginName, "SubFolders");
}
break;
}
diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 7b50d9f866..7dd74d65c4 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -40,15 +40,15 @@ void GetLoginStr(char* user, size_t szuser, char* pass) {
DBVARIANT dbv;
- if (DBGetContactSettingString(NULL, PluginName, "Username", &dbv) == 0)
+ if (db_get_s(NULL, PluginName, "Username", &dbv) == 0)
{
mir_snprintf(user, szuser, "%s", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
user[0] = 0;
- if (DBGetContactSettingString(NULL, PluginName, "Password", &dbv) == 0)
+ if (db_get_s(NULL, PluginName, "Password", &dbv) == 0)
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM)dbv.pszVal);
@@ -61,7 +61,7 @@ void GetLoginStr(char* user, size_t szuser, char* pass) arrayToHex(hash, sizeof(hash), pass);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
pass[0] = 0;
@@ -142,7 +142,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) switch(nlhrReply->resultCode)
{
case 200:
- if (DBGetContactSettingByte(NULL, PluginName, "UploadChanged", 0))
+ if (db_get_b(NULL, PluginName, "UploadChanged", 0))
ProcessVIHash(true);
for (i=nlhrReply->headersCount; i--; )
@@ -267,16 +267,16 @@ bool ProcessVIHash(bool store) bool result;
if (store)
{
- DBWriteContactSettingString(NULL, PluginName, "VIHash", hashstr);
+ db_set_s(NULL, PluginName, "VIHash", hashstr);
result = true;
}
else
{
DBVARIANT dbv;
- if (DBGetContactSettingString(NULL, PluginName, "VIHash", &dbv) == 0)
+ if (db_get_s(NULL, PluginName, "VIHash", &dbv) == 0)
{
result = strcmp(hashstr, dbv.pszVal) == 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
result = false;
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 625ca46ae5..1bb3b770aa 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -830,6 +830,6 @@ bool IsPluginEnabled(TCHAR* filename) char* fname;
crsi_t2a(fname, filename);
char* ext = strstr(_strlwr(fname), ".dll");
- bool res = ext && ext[4] == '\0' && DBGetContactSettingByte(NULL, "PluginDisable", fname, 0) == 0;
+ bool res = ext && ext[4] == '\0' && db_get_b(NULL, "PluginDisable", fname, 0) == 0;
return res;
}
diff --git a/plugins/Db3x/src/dbintf3x.cpp b/plugins/Db3x/src/dbintf3x.cpp index fcbfc8ce67..5bca636e1a 100644 --- a/plugins/Db3x/src/dbintf3x.cpp +++ b/plugins/Db3x/src/dbintf3x.cpp @@ -47,7 +47,7 @@ DWORD CDb3x::GetSettingsGroupOfsByModuleNameOfs(DBContact *dbc,DWORD ofsContact, DWORD ofsThis;
for ( int i=0; i < SETTINGSGROUPOFSCOUNT; i++)
- if(settingsGroupOfsCache[i].ofsContact == ofsContact && settingsGroupOfsCache[i].ofsModuleName == ofsModuleName)
+ if (settingsGroupOfsCache[i].ofsContact == ofsContact && settingsGroupOfsCache[i].ofsModuleName == ofsModuleName)
return settingsGroupOfsCache[i].ofsSettingsGroup;
ofsThis = dbc->ofsFirstSettings;
@@ -58,7 +58,7 @@ DWORD CDb3x::GetSettingsGroupOfsByModuleNameOfs(DBContact *dbc,DWORD ofsContact, settingsGroupOfsCache[nextSGOCacheEntry].ofsContact = ofsContact;
settingsGroupOfsCache[nextSGOCacheEntry].ofsModuleName = ofsModuleName;
settingsGroupOfsCache[nextSGOCacheEntry].ofsSettingsGroup = ofsThis;
- if(++nextSGOCacheEntry==SETTINGSGROUPOFSCOUNT) nextSGOCacheEntry = 0;
+ if (++nextSGOCacheEntry==SETTINGSGROUPOFSCOUNT) nextSGOCacheEntry = 0;
return ofsThis;
}
ofsThis = dbcs->ofsNext;
diff --git a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp index 968ee92bc0..1c0b10a32d 100644 --- a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp +++ b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp @@ -11,20 +11,20 @@ static BOOL Convert(HANDLE hContact, char* module, char* setting, int value, int if (value > 0xFF)
Result = 0;
else
- DBWriteContactSettingByte(hContact, module, setting, (BYTE)value);
+ db_set_b(hContact, module, setting, (BYTE)value);
break;
case 1:
if (value > 0xFFFF)
Result = 0;
else
- DBWriteContactSettingWord(hContact, module, setting, (WORD)value);
+ db_set_w(hContact, module, setting, (WORD)value);
break;
case 2:
- DBWriteContactSettingDword(hContact, module, setting, (DWORD)value);
+ db_set_dw(hContact, module, setting, (DWORD)value);
break;
case 3:
- DBDeleteContactSetting(hContact, module, setting);
- DBWriteContactSettingString(hContact, module, setting, itoa(value,temp,10));
+ db_unset(hContact, module, setting);
+ db_set_s(hContact, module, setting, itoa(value,temp,10));
break;
}
return Result;
@@ -56,7 +56,7 @@ BOOL convertSetting(HANDLE hContact, char* module, char* setting, int toType) // int len = (int)strlen(dbv.pszVal) + 1;
WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, wc, len);
- Result = !DBWriteContactSettingWString(hContact, module, setting, wc);
+ Result = !db_set_ws(hContact, module, setting, wc);
}
else if (strlen(dbv.pszVal) < 11 && toType != 3) {
int val = atoi(dbv.pszVal);
@@ -74,7 +74,7 @@ BOOL convertSetting(HANDLE hContact, char* module, char* setting, int toType) // WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len);
WideCharToMultiByte(CP_ACP, 0, wc, -1, sz, len, NULL, NULL);
- Result = !DBWriteContactSettingString(hContact, module, setting, sz);
+ Result = !db_set_s(hContact, module, setting, sz);
}
break;
}
@@ -82,7 +82,7 @@ BOOL convertSetting(HANDLE hContact, char* module, char* setting, int toType) // if (!Result)
msg(Translate("Cannot Convert!"), modFullname);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return Result;
@@ -357,22 +357,22 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l // delete the old setting
if (mir_strcmp(setting, dbsetting->setting) && dbsetting->setting && (dbsetting->setting)[0] != 0)
- DBDeleteContactSetting(dbsetting->hContact, dbsetting->module, dbsetting->setting);
+ db_unset(dbsetting->hContact, dbsetting->module, dbsetting->setting);
// delete the setting if we are saving as a different type
switch (dbsetting->dbv.type)
{
case DBVT_BYTE:
- if (saveAsType(hwnd) != 0) DBDeleteContactSetting(dbsetting->hContact, dbsetting->module, setting);
+ if (saveAsType(hwnd) != 0) db_unset(dbsetting->hContact, dbsetting->module, setting);
break;
case DBVT_WORD:
- if (saveAsType(hwnd) != 1) DBDeleteContactSetting(dbsetting->hContact, dbsetting->module, setting);
+ if (saveAsType(hwnd) != 1) db_unset(dbsetting->hContact, dbsetting->module, setting);
break;
case DBVT_DWORD:
- if (saveAsType(hwnd) != 2) DBDeleteContactSetting(dbsetting->hContact, dbsetting->module, setting);
+ if (saveAsType(hwnd) != 2) db_unset(dbsetting->hContact, dbsetting->module, setting);
break;
//case DBVT_ASCIIZ:
- //DBWriteContactSettingString(dbsetting->hContact, dbsetting->module, setting, value);
+ //db_set_s(dbsetting->hContact, dbsetting->module, setting, value);
//break;
}
// write the setting
@@ -381,25 +381,25 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case 0:
if (IsDlgButtonChecked(hwnd, CHK_HEX)) sscanf(value, "%x", &settingValue);
else sscanf(value, "%d", &settingValue);
- DBWriteContactSettingByte(dbsetting->hContact, dbsetting->module, setting, (BYTE)settingValue);
+ db_set_b(dbsetting->hContact, dbsetting->module, setting, (BYTE)settingValue);
break;
case 1:
if (IsDlgButtonChecked(hwnd, CHK_HEX)) sscanf(value, "%x", &settingValue);
else sscanf(value, "%d", &settingValue);
- DBWriteContactSettingWord(dbsetting->hContact, dbsetting->module, setting, (WORD)settingValue);
+ db_set_w(dbsetting->hContact, dbsetting->module, setting, (WORD)settingValue);
break;
case 2:
if (IsDlgButtonChecked(hwnd, CHK_HEX)) sscanf(value, "%x", &settingValue);
else sscanf(value, "%d", &settingValue);
- DBWriteContactSettingDword(dbsetting->hContact, dbsetting->module, setting, (DWORD)settingValue);
+ db_set_dw(dbsetting->hContact, dbsetting->module, setting, (DWORD)settingValue);
break;
case 3:
if (dbsetting->dbv.type == DBVT_UTF8)
- DBWriteContactSettingWString(dbsetting->hContact, dbsetting->module, setting, (WCHAR*)value);
+ db_set_ws(dbsetting->hContact, dbsetting->module, setting, (WCHAR*)value);
else if (dbsetting->dbv.type == DBVT_BLOB)
WriteBlobFromString(dbsetting->hContact,dbsetting->module,setting,value,valueLength);
else if (dbsetting->dbv.type == DBVT_ASCIIZ)
- DBWriteContactSettingString(dbsetting->hContact, dbsetting->module, setting, value);
+ db_set_s(dbsetting->hContact, dbsetting->module, setting, value);
break;
}
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 28ee01a696..50077160a8 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -16,26 +16,26 @@ void copyModule(char* module, HANDLE hContactFrom, HANDLE hContactTo) switch (dbv.type)
{
case DBVT_BYTE:
- DBWriteContactSettingByte(hContactTo, module, setting->name, dbv.bVal);
+ db_set_b(hContactTo, module, setting->name, dbv.bVal);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(hContactTo, module, setting->name, dbv.wVal);
+ db_set_w(hContactTo, module, setting->name, dbv.wVal);
break;
case DBVT_DWORD:
- DBWriteContactSettingDword(hContactTo, module, setting->name, dbv.dVal);
+ db_set_dw(hContactTo, module, setting->name, dbv.dVal);
break;
case DBVT_ASCIIZ:
- DBWriteContactSettingString(hContactTo, module, setting->name, dbv.pszVal);
+ db_set_s(hContactTo, module, setting->name, dbv.pszVal);
break;
case DBVT_UTF8:
- DBWriteContactSettingStringUtf(hContactTo, module, setting->name, dbv.pszVal);
+ db_set_utf(hContactTo, module, setting->name, dbv.pszVal);
break;
case DBVT_BLOB:
DBWriteContactSettingBlob(hContactTo, module, setting->name, dbv.pbVal, dbv.cpbVal);
break;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
setting = (struct ModSetLinkLinkItem *)setting->next;
}
FreeModuleSettingLL(&msll);
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index e55845d7bb..15998e74ad 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -11,14 +11,11 @@ int deleteModule(char* module, HANDLE hContact, int fromMenu) if (!module) return 0;
- if (!fromMenu)
- {
+ if (!fromMenu) {
mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete module \"%s\"?"), module);
- if (DBGetContactSettingByte(NULL,modname, "WarnOnDelete",1))
- {
+ if (db_get_b(NULL,modname, "WarnOnDelete",1))
if (MessageBox(0,msg, Translate("Confirm Module Deletion"), MB_YESNO|MB_ICONEXCLAMATION) == IDNO)
return 0;
- }
}
if (!EnumSettings(hContact,module,&settinglist)) return 0;
@@ -26,7 +23,7 @@ int deleteModule(char* module, HANDLE hContact, int fromMenu) setting = settinglist.first;
while (setting)
{
- DBDeleteContactSetting(hContact, module, setting->name);
+ db_unset(hContact, module, setting->name);
setting = (struct ModSetLinkLinkItem *)setting->next;
}
FreeModuleSettingLL(&settinglist);
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 5f8006e9ec..4c978e28f2 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -101,15 +101,15 @@ void exportModule(HANDLE hContact, char* module, FILE* file) {
case DBVT_BYTE:
fprintf(file, "\n%s=b%s", setting->name, itoa(dbv.bVal,tmp,10));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
case DBVT_WORD:
fprintf(file, "\n%s=w%s", setting->name, itoa(dbv.wVal,tmp,10));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
case DBVT_DWORD:
fprintf(file, "\n%s=d%s", setting->name, itoa(dbv.dVal,tmp,10));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
case DBVT_ASCIIZ:
case DBVT_UTF8:
@@ -125,7 +125,7 @@ void exportModule(HANDLE hContact, char* module, FILE* file) fprintf(file, "\n%s=u%s", setting->name, dbv.pszVal);
else
fprintf(file, "\n%s=s%s", setting->name, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
case DBVT_BLOB:
{
@@ -143,7 +143,7 @@ void exportModule(HANDLE hContact, char* module, FILE* file) fprintf(file,"\n%s=n%s",setting->name , data);
mir_free(data);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
}
}
@@ -372,10 +372,10 @@ HANDLE Clist_GroupExists(WCHAR *tszGroup) do {
_itoa(i, str, 10);
- result = DBGetContactSettingTString(0, "CListGroups", str, &dbv);
+ result = db_get_ts(0, "CListGroups", str, &dbv);
if (!result) {
match = (!lstrcmpW(tszGroup, (LPCWSTR)&dbv.ptszVal[1]) && (lstrlenW(tszGroup) == lstrlenW((LPCWSTR)&dbv.ptszVal[1])));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if(match)
return((HANDLE)(i + 1));
}
@@ -501,21 +501,21 @@ void importSettings(HANDLE hContact, char *importstring ) case 'b':
case 'B':
if (sscanf((end+2), "%d", &value) == 1)
- DBWriteContactSettingByte(hContact, module, setting, (BYTE)value);
+ db_set_b(hContact, module, setting, (BYTE)value);
break;
case 'w':
case 'W':
if (sscanf((end+2), "%d", &value) == 1)
- DBWriteContactSettingWord(hContact, module, setting, (WORD)value);
+ db_set_w(hContact, module, setting, (WORD)value);
break;
case 'd':
case 'D':
if (sscanf((end+2), "%d", &value) == 1)
- DBWriteContactSettingDword(hContact, module, setting, (DWORD)value);
+ db_set_dw(hContact, module, setting, (DWORD)value);
break;
case 's':
case 'S':
- DBWriteContactSettingString(hContact,module, setting, (end+2));
+ db_set_s(hContact,module, setting, (end+2));
break;
case 'g':
case 'G':
@@ -532,11 +532,11 @@ void importSettings(HANDLE hContact, char *importstring ) } } }
case 'u':
case 'U':
- DBWriteContactSettingStringUtf(hContact,module, setting, (end+2));
+ db_set_utf(hContact,module, setting, (end+2));
break;
case 'l':
case 'L':
- DBDeleteContactSetting(hContact, module, setting);
+ db_unset(hContact, module, setting);
break;
case 'n':
case 'N':
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index e8fd22aa70..08a9a3e5c4 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -353,7 +353,7 @@ int replaceValue(HWND hwnd, HANDLE hContact, const char *module, const char *set if ((!cws.value.pszVal && !replace[0]) || (cws.value.pszVal && !cws.value.pszVal[0]))
{
ItemFound(hwnd,hContact,module,setting,NULL,FW_SETTINGNAME|FW_DELETED);
- DBDeleteContactSetting(hContact,module,setting);
+ db_unset(hContact,module,setting);
mir_free(myreplace);
return 1;
}
@@ -390,7 +390,7 @@ int replaceSetting(HWND hwnd, HANDLE hContact, const char *module, const char *s if (cws.szSetting[0]==0)
{
ItemFound(hwnd,hContact,module,setting,NULL,FW_SETTINGNAME|FW_DELETED);
- DBDeleteContactSetting(hContact,module,setting);
+ db_unset(hContact,module,setting);
mir_free(myreplace);
return 1;
}
@@ -410,12 +410,12 @@ int replaceSetting(HWND hwnd, HANDLE hContact, const char *module, const char *s if (!CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws))
{
count++;
- DBDeleteContactSetting(hContact,module,setting);
+ db_unset(hContact,module,setting);
ItemFound(hwnd,hContact,module,cws.szSetting,NULL,FW_SETTINGNAME|FW_REPLACED);
}
}
else
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
mir_free(myreplace);
@@ -465,27 +465,27 @@ int replaceModule(HWND hwnd, HANDLE hContact, const char *module, const char *fi switch (dbv.type)
{
case DBVT_BYTE:
- DBWriteContactSettingByte(hContact, newModule, setting->name, dbv.bVal);
+ db_set_b(hContact, newModule, setting->name, dbv.bVal);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(hContact, newModule, setting->name, dbv.wVal);
+ db_set_w(hContact, newModule, setting->name, dbv.wVal);
break;
case DBVT_DWORD:
- DBWriteContactSettingDword(hContact, newModule, setting->name, dbv.dVal);
+ db_set_dw(hContact, newModule, setting->name, dbv.dVal);
break;
case DBVT_ASCIIZ:
- DBWriteContactSettingString(hContact, newModule, setting->name, dbv.pszVal);
+ db_set_s(hContact, newModule, setting->name, dbv.pszVal);
break;
case DBVT_UTF8:
- DBWriteContactSettingStringUtf(hContact, newModule, setting->name, dbv.pszVal);
+ db_set_utf(hContact, newModule, setting->name, dbv.pszVal);
break;
case DBVT_BLOB:
DBWriteContactSettingBlob(hContact, newModule, setting->name, dbv.pbVal, dbv.cpbVal);
break;
}
- DBFreeVariant(&dbv);
- DBDeleteContactSetting(hContact, module, setting->name);
+ db_free(&dbv);
+ db_unset(hContact, module, setting->name);
}
setting = (struct ModSetLinkLinkItem *)setting->next;
@@ -645,7 +645,7 @@ void __cdecl FindSettings(LPVOID di) break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -659,7 +659,7 @@ void __cdecl FindSettings(LPVOID di) if (!GetSetting(hContact,module->name,setting->name,&dbv))
{
replaceCount += replaceSetting(hwnd, hContact, module->name, setting->name, &dbv, text, replace, mode);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index 2e8688d5b9..3789be8e32 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -61,7 +61,7 @@ int AddIconToList(HIMAGELIST hil, HICON hIcon); void AddProtoIconsToList(HIMAGELIST hil, int newshift);
int GetProtoIcon(char *szProto);
extern HANDLE hRestore;
-extern HANDLE hUserMenu;
+extern HGENMENU hUserMenu;
/////////////////////
#ifndef NDEBUG
diff --git a/plugins/DbEditorPP/src/knownmodules.cpp b/plugins/DbEditorPP/src/knownmodules.cpp index 13c4379f6b..4e44aa740c 100644 --- a/plugins/DbEditorPP/src/knownmodules.cpp +++ b/plugins/DbEditorPP/src/knownmodules.cpp @@ -60,7 +60,7 @@ void doOldKnownModulesList() setting = msll.first;
while(setting)
{
- if (!DBGetContactSetting(NULL,"KnownModules",setting->name,&dbv) && dbv.type == DBVT_ASCIIZ)
+ if (!db_get(NULL,"KnownModules",setting->name,&dbv) && dbv.type == DBVT_ASCIIZ)
{
temp = (char*)mir_alloc((strlen(dbv.pszVal)+5)*sizeof(char));
if (!temp) break;
@@ -75,10 +75,10 @@ void doOldKnownModulesList() }
mir_free(temp);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
setting = (struct ModSetLinkLinkItem *)setting->next;
}
FreeModuleSettingLL(&msll);
- UseKnownModList = DBGetContactSettingByte(NULL,modname,"UseKnownModList",0);
+ UseKnownModList = db_get_b(NULL,modname,"UseKnownModList",0);
}
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 7bc8b290fa..3c36401da3 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -8,9 +8,9 @@ BOOL usePopUps; HWND hwnd2watchedVarsWindow;
int hLangpack;
BYTE nameOrder[NAMEORDERCOUNT];
-HANDLE hUserMenu;
-HANDLE hRestore;
+HGENMENU hUserMenu;
WatchListArrayStruct WatchListArray;
+HANDLE hRestore;
HANDLE sMenuCommand, sRegisterModule, sRegisterSingleModule, sImport, sServicemodeLaunch;
HANDLE hModulesLoadedHook = NULL, hSettingsChangedHook=NULL, hOptInitHook=NULL, hPreShutdownHook=NULL;
@@ -166,7 +166,7 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) ZeroMemory(&mi, sizeof(mi));
mi.cbSize = sizeof(mi);
mi.position = 1900000001;
- mi.flags = DBGetContactSettingByte(NULL,modname,"UserMenuItem",0)?0:CMIF_HIDDEN;
+ mi.flags = db_get_b(NULL,modname,"UserMenuItem",0) ? 0 : CMIF_HIDDEN;
mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGUSER));
mi.pszName = LPGEN("Open user tree in DBE++");
mi.pszService = "DBEditorpp/MenuCommand";
@@ -187,10 +187,10 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) char mod[64] = "";
TCHAR szModuleFileName[MAX_PATH];
int i=0, len;
- if (!DBGetContactSetting(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ)
+ if (!db_get(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ)
mods = dbv.pszVal;
else {
- DBWriteContactSettingString(NULL,modname,"CoreModules",coreMods);
+ db_set_s(NULL,modname,"CoreModules",coreMods);
mods = coreMods;
}
@@ -218,18 +218,18 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) if (GetModuleFileName(hInst, szModuleFileName, MAX_PATH))
addIcons(szModuleFileName);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
UnhookEvent(hModulesLoadedHook);
- usePopUps = DBGetContactSettingByte(NULL,modname,"UsePopUps",0);
+ usePopUps = db_get_b(NULL,modname,"UsePopUps",0);
// Load the name order
for(i=0; i < NAMEORDERCOUNT; i++)
nameOrder[i] = i;
- if (!DBGetContactSetting(NULL,"Contact","NameOrder",&dbv)) {
+ if (!db_get(NULL,"Contact","NameOrder",&dbv)) {
CopyMemory(nameOrder,dbv.pbVal,dbv.cpbVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded);
@@ -311,21 +311,21 @@ extern "C" __declspec(dllexport) int Unload(void) //=======================================================
-//DBGetContactSettingString (prob shouldnt use this unless u know how big the string is gonna be..)
+//db_get_s (prob shouldnt use this unless u know how big the string is gonna be..)
//=======================================================
int DBGetContactSettingStringStatic(HANDLE hContact, char* szModule, char* szSetting, char* value, int maxLength)
{
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, szModule, szSetting, &dbv))
+ if (!db_get(hContact, szModule, szSetting, &dbv))
{
strncpy(value, dbv.pszVal, maxLength);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
else
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -407,7 +407,7 @@ int GetValue(HANDLE hContact, const char* szModule, const char* szSetting, char* break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
Value[length-1] = 0;
return 1;
@@ -457,7 +457,7 @@ int GetValueW(HANDLE hContact, const char* szModule, const char* szSetting, WCHA break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
Value[length-1] = 0;
return 1;
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 814361037d..64b2534f94 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -122,7 +122,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM }
}
else if ((mtis->type == CONTACT) && hContact) {
- if (DBGetContactSettingByte(NULL,"CList", "ConfirmDelete",1)) {
+ if (db_get_b(NULL,"CList", "ConfirmDelete",1)) {
char msg[1024];
mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete contact \"%s\"?"), module);
if (MessageBox(0,msg, Translate("Confirm Contact Delete"), MB_YESNO|MB_ICONEXCLAMATION) == IDNO)
@@ -199,7 +199,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SetWindowText(hwnd, TranslateT("Database Editor++"));
// setup the splitter
- SetWindowLongPtr(GetDlgItem(hwnd,IDC_SPLITTER),GWLP_USERDATA,(LPARAM)DBGetContactSettingWord(NULL, modname, "Splitter", 300));
+ SetWindowLongPtr(GetDlgItem(hwnd,IDC_SPLITTER),GWLP_USERDATA,(LPARAM)db_get_w(NULL, modname, "Splitter", 300));
SendMessage(hwnd, GC_SPLITTERMOVED, 0,0);
mir_subclassWindow(GetDlgItem(hwnd,IDC_SPLITTER), SplitterSubclassProc);
// module tree
@@ -215,8 +215,8 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) TranslateMenu(GetSubMenu(hMenu,i));
// move the dialog to the users position
- MoveWindow(hwnd,DBGetContactSettingDword(NULL,modname,"x",0),DBGetContactSettingDword(NULL,modname,"y",0),DBGetContactSettingDword(NULL,modname,"width",500),DBGetContactSettingDword(NULL,modname,"height",250),0);
- if (DBGetContactSettingByte(NULL,modname,"Maximised",0)) {
+ MoveWindow(hwnd,db_get_dw(NULL,modname,"x",0),db_get_dw(NULL,modname,"y",0),db_get_dw(NULL,modname,"width",500),db_get_dw(NULL,modname,"height",250),0);
+ if (db_get_b(NULL,modname,"Maximised",0)) {
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
wp.flags = WPF_RESTORETOMAXIMIZED;
@@ -229,14 +229,14 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) Mode = MODE_ALL;
CheckMenuItem(GetSubMenu(hMenu,5),MENU_FILTER_ALL,MF_BYCOMMAND|MF_CHECKED);
- Hex = DBGetContactSettingByte(NULL,modname,"HexMode",0);
+ Hex = db_get_b(NULL,modname,"HexMode",0);
CheckMenuItem(GetSubMenu(hMenu,5),MENU_BYTE_HEX,MF_BYCOMMAND|((Hex & HEX_BYTE)?MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(GetSubMenu(hMenu,5),MENU_WORD_HEX,MF_BYCOMMAND|((Hex & HEX_WORD)?MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(GetSubMenu(hMenu,5),MENU_DWORD_HEX,MF_BYCOMMAND|((Hex & HEX_DWORD)?MF_CHECKED:MF_UNCHECKED));
- CheckMenuItem(GetSubMenu(GetMenu(hwnd),5),MENU_SAVE_POSITION,MF_BYCOMMAND|(DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1)?MF_CHECKED:MF_UNCHECKED));
+ CheckMenuItem(GetSubMenu(GetMenu(hwnd),5),MENU_SAVE_POSITION,MF_BYCOMMAND|(db_get_b(NULL,modname,"RestoreOnOpen",1)?MF_CHECKED:MF_UNCHECKED));
- Order = DBGetContactSettingByte(NULL,modname,"SortMode",1);
+ Order = db_get_b(NULL,modname,"SortMode",1);
CheckMenuItem(GetSubMenu(GetMenu(hwnd),5),MENU_SORT_ORDER,MF_BYCOMMAND|(Order?MF_CHECKED:MF_UNCHECKED));
// image list
@@ -298,7 +298,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int restore;
if (hRestore)
restore = 3;
- else if (DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1))
+ else if (db_get_b(NULL,modname,"RestoreOnOpen",1))
restore = 2;
else
restore = 0;
@@ -327,7 +327,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (splitterPos<65) splitterPos=65;
if (splitterPos > rc2.right-rc2.left-65) splitterPos=rc2.right-rc2.left-65;
SetWindowLongPtr(GetDlgItem(hwnd,IDC_SPLITTER),GWLP_USERDATA, splitterPos);
- DBWriteContactSettingWord(NULL, modname, "Splitter",(WORD)splitterPos);
+ db_set_w(NULL, modname, "Splitter",(WORD)splitterPos);
}
PostMessage(hwnd,WM_SIZE,0,0);
}
@@ -359,14 +359,14 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd);
if (msg == WM_SIZE && wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED)
- DBWriteContactSettingByte(NULL,modname,"Maximised",1);
+ db_set_b(NULL,modname,"Maximised",1);
else if (msg == WM_SIZE && wParam == SIZE_RESTORED)
- DBWriteContactSettingByte(NULL,modname,"Maximised",0);
+ db_set_b(NULL,modname,"Maximised",0);
}
break;
case WM_DESTROY: // free our shit!
- if (DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1)) {
+ if (db_get_b(NULL,modname,"RestoreOnOpen",1)) {
HTREEITEM item;
HWND hwnd2Tree = GetDlgItem(hwnd,IDC_MODULES);
char module[256] = {0};
@@ -385,16 +385,16 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) type = mtis->type;
}
- DBWriteContactSettingDword(NULL,modname,"LastContact",(DWORD)hContact);
+ db_set_dw(NULL,modname,"LastContact",(DWORD)hContact);
if (type == CONTACT)
- DBWriteContactSettingString(NULL,modname,"LastModule","");
+ db_set_s(NULL,modname,"LastModule","");
else
- DBWriteContactSettingString(NULL,modname,"LastModule",module);
+ db_set_s(NULL,modname,"LastModule",module);
}
else {
- DBDeleteContactSetting(NULL,modname,"LastContact");
- DBDeleteContactSetting(NULL,modname,"LastModule");
+ db_unset(NULL,modname,"LastContact");
+ db_unset(NULL,modname,"LastModule");
}
HWND hwnd2Settings = GetDlgItem(hwnd, IDC_SETTINGS);
@@ -403,13 +403,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (pos != -1) {
char text[256];
ListView_GetItemText(hwnd2Settings, pos, 0, text, SIZEOF(text));
- DBWriteContactSettingString(NULL,modname,"LastSetting",text);
+ db_set_s(NULL,modname,"LastSetting",text);
}
- else DBDeleteContactSetting(NULL,modname,"LastSetting");
+ else db_unset(NULL,modname,"LastSetting");
}
}
- DBWriteContactSettingByte(NULL,modname,"HexMode",(byte)Hex);
- DBWriteContactSettingByte(NULL,modname,"SortMode",(byte)Order);
+ db_set_b(NULL,modname,"HexMode",(byte)Hex);
+ db_set_b(NULL,modname,"SortMode",(byte)Order);
saveListSettings(GetDlgItem(hwnd,IDC_SETTINGS));
hwnd2mainWindow = 0;
ClearListview(GetDlgItem(hwnd,IDC_SETTINGS));
@@ -419,13 +419,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (himl2)
ImageList_Destroy(himl2);
- if (!DBGetContactSettingByte(NULL,modname,"Maximised",0)) {
+ if (!db_get_b(NULL,modname,"Maximised",0)) {
RECT rc;
GetWindowRect(hwnd,&rc);
- DBWriteContactSettingDword(NULL,modname,"x",rc.left);
- DBWriteContactSettingDword(NULL,modname,"y",rc.top);
- DBWriteContactSettingDword(NULL,modname,"width",rc.right-rc.left);
- DBWriteContactSettingDword(NULL,modname,"height",rc.bottom-rc.top);
+ db_set_dw(NULL,modname,"x",rc.left);
+ db_set_dw(NULL,modname,"y",rc.top);
+ db_set_dw(NULL,modname,"width",rc.right-rc.left);
+ db_set_dw(NULL,modname,"height",rc.bottom-rc.top);
}
if (hwnd2importWindow) {
@@ -543,9 +543,9 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break;
case MENU_SAVE_POSITION:
{
- BOOL save = !DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1);
+ BOOL save = !db_get_b(NULL,modname,"RestoreOnOpen",1);
CheckMenuItem(GetSubMenu(GetMenu(hwnd),5),MENU_SAVE_POSITION,MF_BYCOMMAND|(save?MF_CHECKED:MF_UNCHECKED));
- DBWriteContactSettingByte(NULL,modname,"RestoreOnOpen", (byte)save);
+ db_set_b(NULL,modname,"RestoreOnOpen", (byte)save);
}
break;
case MENU_SORT_ORDER:
diff --git a/plugins/DbEditorPP/src/modules.cpp b/plugins/DbEditorPP/src/modules.cpp index 2e650b2fe4..faeae05035 100644 --- a/plugins/DbEditorPP/src/modules.cpp +++ b/plugins/DbEditorPP/src/modules.cpp @@ -17,28 +17,28 @@ void renameModule(char* oldName, char* newName, HANDLE hContact) switch (dbv.type)
{
case DBVT_BYTE:
- DBWriteContactSettingByte(hContact, newName, setting->name, dbv.bVal);
+ db_set_b(hContact, newName, setting->name, dbv.bVal);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(hContact, newName, setting->name, dbv.wVal);
+ db_set_w(hContact, newName, setting->name, dbv.wVal);
break;
case DBVT_DWORD:
- DBWriteContactSettingDword(hContact, newName, setting->name, dbv.dVal);
+ db_set_dw(hContact, newName, setting->name, dbv.dVal);
break;
case DBVT_ASCIIZ:
- DBWriteContactSettingString(hContact, newName, setting->name, dbv.pszVal);
+ db_set_s(hContact, newName, setting->name, dbv.pszVal);
break;
case DBVT_UTF8:
- DBWriteContactSettingStringUtf(hContact, newName, setting->name, dbv.pszVal);
+ db_set_utf(hContact, newName, setting->name, dbv.pszVal);
break;
case DBVT_BLOB:
DBWriteContactSettingBlob(hContact, newName, setting->name, dbv.pbVal, dbv.cpbVal);
break;
}
- DBDeleteContactSetting(hContact, oldName, setting->name);
+ db_unset(hContact, oldName, setting->name);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
setting = (struct ModSetLinkLinkItem *)setting->next;
}
FreeModuleSettingLL(&settinglist);
@@ -65,16 +65,16 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam {
HANDLE hContact = db_find_first();
// null contact
- DBWriteContactSettingByte(NULL, modulename, "(Default)", 0);
+ db_set_b(NULL, modulename, "(Default)", 0);
while (hContact)
{
- DBWriteContactSettingByte(hContact, modulename, "(Default)", 0);
+ db_set_b(hContact, modulename, "(Default)", 0);
hContact = db_find_next(hContact);
}
}
else
{
- DBWriteContactSettingByte((HANDLE)GetWindowLongPtr(hwnd,GWLP_USERDATA), modulename, "(Default)", 0);
+ db_set_b((HANDLE)GetWindowLongPtr(hwnd,GWLP_USERDATA), modulename, "(Default)", 0);
}
refreshTree(1);
}
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index ea520eacc2..4c6d4a0e47 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -379,7 +379,7 @@ void replaceTreeItem(HWND hwnd, HANDLE hContact, const char *module, const char void refreshTree(int restore)
{
- UseKnownModList = DBGetContactSettingByte(NULL,modname,"UseKnownModList",0);
+ UseKnownModList = db_get_b(NULL,modname,"UseKnownModList",0);
if (populating) return;
populating = 1;
forkthread(PopulateModuleTreeThreadFunc,0,(HWND)restore);
@@ -433,7 +433,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) }
case 2: // restore saved
if (GetValue(NULL,modname,"LastModule",SelectedModule,SIZEOF(SelectedModule))) {
- hSelectedContact = (HANDLE)DBGetContactSettingDword(NULL,modname,"LastContact",(DWORD)INVALID_HANDLE_VALUE);
+ hSelectedContact = (HANDLE)db_get_dw(NULL,modname,"LastContact",(DWORD)INVALID_HANDLE_VALUE);
if (hSelectedContact != INVALID_HANDLE_VALUE)
Select = 1;
GetValue(NULL,modname,"LastSetting",SelectedSetting,SIZEOF(SelectedSetting));
@@ -527,7 +527,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) module = (struct ModSetLinkLinkItem *)module->next;
}
- if (DBGetContactSettingByte(NULL,modname,"ExpandSettingsOnOpen",0))
+ if (db_get_b(NULL,modname,"ExpandSettingsOnOpen",0))
TreeView_Expand(hwnd2Tree,contact,TVE_EXPAND);
if (Select && hSelectedContact == NULL)
@@ -902,14 +902,14 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here i else strncat(moduletemp,&module[i],1);
}
- if ( !DBGetContactSetting(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ) {
+ if ( !db_get(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ) {
int len = (int)strlen(dbv.pszVal) + 10 + (int)strlen(moduletemp);
char* temp = (char*)_alloca(len);
mir_snprintf(temp, len, "%s, %s", dbv.pszVal, moduletemp);
- DBWriteContactSettingString(NULL,modname,"CoreModules",temp);
- DBFreeVariant(&dbv);
+ db_set_s(NULL,modname,"CoreModules",temp);
+ db_free(&dbv);
}
- else DBWriteContactSettingString(NULL,modname,"CoreModules",moduletemp);
+ else db_set_s(NULL,modname,"CoreModules",moduletemp);
RegisterSingleModule((WPARAM)module,0);
}
break;
@@ -925,7 +925,7 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here i break;
case MENU_DELETE_CONTACT:
- if (DBGetContactSettingByte(NULL,"CList", "ConfirmDelete",1)) {
+ if (db_get_b(NULL,"CList", "ConfirmDelete",1)) {
char msg[1024];
mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete contact \"%s\"?"), module);
if (MessageBox(0,msg, Translate("Confirm Contact Delete"), MB_YESNO|MB_ICONEXCLAMATION) == IDYES) {
diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp index ba822c7321..17d69981d6 100644 --- a/plugins/DbEditorPP/src/options.cpp +++ b/plugins/DbEditorPP/src/options.cpp @@ -9,17 +9,17 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
bInitDone = false;
DBVARIANT dbv;
- CheckDlgButton(hwnd,IDC_EXPANDSETTINGS,DBGetContactSettingByte(NULL,modname,"ExpandSettingsOnOpen",0));
- CheckDlgButton(hwnd,IDC_RESTORESETTINGS,DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1));
- CheckDlgButton(hwnd,IDC_USEKNOWNMODS,DBGetContactSettingByte(NULL,modname,"UseKnownModList",0));
- CheckDlgButton(hwnd,IDC_WARNONDEL,DBGetContactSettingByte(NULL,modname,"WarnOnDelete",1));
- CheckDlgButton(hwnd,IDC_MENU,DBGetContactSettingByte(NULL,modname,"UserMenuItem",0));
+ CheckDlgButton(hwnd,IDC_EXPANDSETTINGS,db_get_b(NULL,modname,"ExpandSettingsOnOpen",0));
+ CheckDlgButton(hwnd,IDC_RESTORESETTINGS,db_get_b(NULL,modname,"RestoreOnOpen",1));
+ CheckDlgButton(hwnd,IDC_USEKNOWNMODS,db_get_b(NULL,modname,"UseKnownModList",0));
+ CheckDlgButton(hwnd,IDC_WARNONDEL,db_get_b(NULL,modname,"WarnOnDelete",1));
+ CheckDlgButton(hwnd,IDC_MENU,db_get_b(NULL,modname,"UserMenuItem",0));
CheckDlgButton(hwnd,IDC_POPUPS,usePopUps);
- if (!DBGetContactSetting(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ)
+ if (!db_get(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ)
SetDlgItemText(hwnd,IDC_MODULES,dbv.pszVal);
- DBFreeVariant(&dbv);
- SetDlgItemInt(hwnd,IDC_POPUPTIMEOUT,DBGetContactSettingWord(NULL,modname,"PopupDelay",4),0);
- SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_SETCOLOUR, 0, (LPARAM)DBGetContactSettingDword(NULL,modname,"PopupColour",RGB(255,0,0)));
+ db_free(&dbv);
+ SetDlgItemInt(hwnd,IDC_POPUPTIMEOUT,db_get_w(NULL,modname,"PopupDelay",4),0);
+ SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(NULL,modname,"PopupColour",RGB(255,0,0)));
TranslateDialogDefault(hwnd);
bInitDone = true;
}
@@ -52,25 +52,19 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case PSN_APPLY:
{
char mods[4096];
- DBWriteContactSettingByte(NULL,modname,"ExpandSettingsOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_EXPANDSETTINGS));
- DBWriteContactSettingByte(NULL,modname,"RestoreOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_RESTORESETTINGS));
- DBWriteContactSettingByte(NULL,modname,"WarnOnDelete",(BYTE)IsDlgButtonChecked(hwnd,IDC_WARNONDEL));
- DBWriteContactSettingByte(NULL,modname,"UserMenuItem",(BYTE)IsDlgButtonChecked(hwnd,IDC_MENU));
- DBWriteContactSettingByte(NULL,modname,"UseKnownModList",(BYTE)IsDlgButtonChecked(hwnd,IDC_USEKNOWNMODS));
+ db_set_b(NULL,modname,"ExpandSettingsOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_EXPANDSETTINGS));
+ db_set_b(NULL,modname,"RestoreOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_RESTORESETTINGS));
+ db_set_b(NULL,modname,"WarnOnDelete",(BYTE)IsDlgButtonChecked(hwnd,IDC_WARNONDEL));
+ db_set_b(NULL,modname,"UserMenuItem",(BYTE)IsDlgButtonChecked(hwnd,IDC_MENU));
+ db_set_b(NULL,modname,"UseKnownModList",(BYTE)IsDlgButtonChecked(hwnd,IDC_USEKNOWNMODS));
usePopUps = IsDlgButtonChecked(hwnd,IDC_POPUPS);
- DBWriteContactSettingByte(NULL,modname,"UsePopUps",(BYTE)usePopUps);
+ db_set_b(NULL,modname,"UsePopUps",(BYTE)usePopUps);
if (GetDlgItemText(hwnd,IDC_MODULES,mods,4096))
- DBWriteContactSettingString(NULL,modname,"CoreModules",mods);
- DBWriteContactSettingWord(NULL,modname,"PopupDelay",(WORD)GetDlgItemInt(hwnd,IDC_POPUPTIMEOUT,NULL,0));
- DBWriteContactSettingDword(NULL,modname,"PopupColour",(DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0));
+ db_set_s(NULL,modname,"CoreModules",mods);
+ db_set_w(NULL,modname,"PopupDelay",(WORD)GetDlgItemInt(hwnd,IDC_POPUPTIMEOUT,NULL,0));
+ db_set_dw(NULL,modname,"PopupColour",(DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0));
- CLISTMENUITEM mi = { sizeof(mi) };
- if (!IsDlgButtonChecked(hwnd,IDC_MENU))
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- else
- mi.flags = CMIM_FLAGS;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hUserMenu, (LPARAM) & mi);
+ Menu_ShowItem(hUserMenu, IsDlgButtonChecked(hwnd,IDC_MENU));
}
return TRUE;
}
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 3afbc56629..816244d8ec 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -11,16 +11,16 @@ void setupSettingsList(HWND hwnd2List) sLC.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH;
sLC.pszText = Translate("Name");
- sLC.cx = DBGetContactSettingWord(NULL, modname, "Column0width", 145);
+ sLC.cx = db_get_w(NULL, modname, "Column0width", 145);
ListView_InsertColumn(hwnd2List,0,&sLC);
sLC.pszText = Translate("Data");
- sLC.cx = DBGetContactSettingWord(NULL, modname, "Column1width", 145);
+ sLC.cx = db_get_w(NULL, modname, "Column1width", 145);
ListView_InsertColumn(hwnd2List,1,&sLC);
sLC.pszText = Translate("Type");
- sLC.cx = DBGetContactSettingWord(NULL, modname, "Column2width", 60);
+ sLC.cx = db_get_w(NULL, modname, "Column2width", 60);
ListView_InsertColumn(hwnd2List,2,&sLC);
sLC.pszText = Translate("Size");
- sLC.cx = DBGetContactSettingWord(NULL, modname, "Column3width", 80);
+ sLC.cx = db_get_w(NULL, modname, "Column3width", 80);
ListView_InsertColumn(hwnd2List,3,&sLC);
}
@@ -37,7 +37,7 @@ void saveListSettings(HWND hwnd2List) if (ListView_GetColumn(hwnd2List,i,&sLC))
{
mir_snprintf(tmp, SIZEOF(tmp), "Column%dwidth", i);
- DBWriteContactSettingWord(NULL, modname, tmp, (WORD)sLC.cx);
+ db_set_w(NULL, modname, tmp, (WORD)sLC.cx);
}
}
@@ -68,7 +68,7 @@ void DeleteSettingsFromList(HWND hSettings, HANDLE hContact, char *module, char else
if (count == 1)
{
- DBDeleteContactSetting(hContact,module,setting);
+ db_unset(hContact,module,setting);
}
else
{
@@ -81,7 +81,7 @@ void DeleteSettingsFromList(HWND hSettings, HANDLE hContact, char *module, char if (ListView_GetItemState(hSettings,i,LVIS_SELECTED))
{
ListView_GetItemText(hSettings, i, 0, text, SIZEOF(text));
- DBDeleteContactSetting(hContact,module,text);
+ db_unset(hContact,module,text);
items--;
}
else
@@ -224,7 +224,7 @@ void additem(HWND hwnd2Settings,HANDLE hContact, char* module, char* setting, in else
ListView_DeleteItem(hwnd2Settings,index);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_free(data);
}
@@ -322,14 +322,14 @@ typedef struct { void writeStandardTextfromLabel(EditLabelInfoStruct* info, char* value, WCHAR *wc, int type)
{
if (type != DBVT_ASCIIZ && type != DBVT_UTF8)
- DBDeleteContactSetting(info->hContact,info->module,info->setting);
+ db_unset(info->hContact,info->module,info->setting);
if (type == DBVT_UTF8 && wc)
{
- DBWriteContactSettingWString(info->hContact,info->module,info->setting,wc);
+ db_set_ws(info->hContact,info->module,info->setting,wc);
mir_free(wc);
}
else
- DBWriteContactSettingString(info->hContact,info->module,info->setting,value);
+ db_set_s(info->hContact,info->module,info->setting,value);
}
@@ -389,32 +389,32 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w case 0:// setting name
if (!mir_strcmp(info->setting,value) || mir_strlen(value)>255)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SendMessage(hwnd,WM_COMMAND,MAKEWPARAM(IDCANCEL,0),0);
return 0;
}
switch (dbv.type)
{
case DBVT_UTF8:
- DBWriteContactSettingStringUtf(info->hContact,info->module,value,dbv.pszVal);
+ db_set_utf(info->hContact,info->module,value,dbv.pszVal);
break;
case DBVT_ASCIIZ:
- DBWriteContactSettingString(info->hContact,info->module,value,dbv.pszVal);
+ db_set_s(info->hContact,info->module,value,dbv.pszVal);
break;
case DBVT_BYTE:
- DBWriteContactSettingByte(info->hContact,info->module,value,dbv.bVal);
+ db_set_b(info->hContact,info->module,value,dbv.bVal);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(info->hContact,info->module,value,dbv.wVal);
+ db_set_w(info->hContact,info->module,value,dbv.wVal);
break;
case DBVT_DWORD:
- DBWriteContactSettingDword(info->hContact,info->module,value,dbv.dVal);
+ db_set_dw(info->hContact,info->module,value,dbv.dVal);
break;
case DBVT_BLOB:
DBWriteContactSettingBlob(info->hContact,info->module,value,dbv.pbVal,dbv.cpbVal);
break;
}
- DBDeleteContactSetting(info->hContact,info->module,info->setting);
+ db_unset(info->hContact,info->module,info->setting);
{
LVFINDINFO lvfi;
int item;
@@ -448,9 +448,9 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w {
val = atoi(&value[1]);
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)
- DBDeleteContactSetting(info->hContact,info->module,info->setting);
+ db_unset(info->hContact,info->module,info->setting);
- DBWriteContactSettingByte(info->hContact,info->module,info->setting,(BYTE)val);
+ db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
}
else
writeStandardTextfromLabel(info, value, wc, dbv.type);
@@ -463,8 +463,8 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w {
val = atoi(&value[1]);
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)
- DBDeleteContactSetting(info->hContact,info->module,info->setting);
- DBWriteContactSettingWord(info->hContact,info->module,info->setting,(WORD)val);
+ db_unset(info->hContact,info->module,info->setting);
+ db_set_w(info->hContact,info->module,info->setting,(WORD)val);
}
else
writeStandardTextfromLabel(info, value, wc, dbv.type);
@@ -477,8 +477,8 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w {
val = atoi(&value[1]);
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)
- DBDeleteContactSetting(info->hContact,info->module,info->setting);
- DBWriteContactSettingDword(info->hContact,info->module,info->setting,val);
+ db_unset(info->hContact,info->module,info->setting);
+ db_set_dw(info->hContact,info->module,info->setting,val);
}
else
writeStandardTextfromLabel(info, value, wc, dbv.type);
@@ -498,13 +498,13 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w writeStandardTextfromLabel(info, value, wc, dbv.type);
break;
case DBVT_BYTE:
- DBWriteContactSettingByte(info->hContact,info->module,info->setting,(BYTE)val);
+ db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(info->hContact,info->module,info->setting,(WORD)val);
+ db_set_w(info->hContact,info->module,info->setting,(WORD)val);
break;
case DBVT_DWORD:
- DBWriteContactSettingDword(info->hContact,info->module,info->setting,(DWORD)val);
+ db_set_dw(info->hContact,info->module,info->setting,(DWORD)val);
break;
}
}
@@ -518,13 +518,13 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w writeStandardTextfromLabel(info, value, wc, dbv.type);
break;
case DBVT_BYTE:
- DBWriteContactSettingByte(info->hContact,info->module,info->setting,(BYTE)val);
+ db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(info->hContact,info->module,info->setting,(WORD)val);
+ db_set_w(info->hContact,info->module,info->setting,(WORD)val);
break;
case DBVT_DWORD:
- DBWriteContactSettingDword(info->hContact,info->module,info->setting,(DWORD)val);
+ db_set_dw(info->hContact,info->module,info->setting,(DWORD)val);
break;
}
}
@@ -563,13 +563,13 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w writeStandardTextfromLabel(info, value, wc, dbv.type);
break;
case DBVT_BYTE:
- DBWriteContactSettingByte(info->hContact,info->module,info->setting,(BYTE)val);
+ db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(info->hContact,info->module,info->setting,(WORD)val);
+ db_set_w(info->hContact,info->module,info->setting,(WORD)val);
break;
case DBVT_DWORD:
- DBWriteContactSettingDword(info->hContact,info->module,info->setting,(DWORD)val);
+ db_set_dw(info->hContact,info->module,info->setting,(DWORD)val);
break;
}
break;
@@ -580,7 +580,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w }
break; // case 1:
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} // fall through
case IDCANCEL:
{
@@ -706,7 +706,7 @@ void EditLabel(HWND hwnd2List, int item, int subitem) default: return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SettingLabelEditSubClass=(WNDPROC)SetWindowLongPtrW(info->hwnd2Edit,GWLP_WNDPROC,(LONG)SettingLabelEditSubClassProc);
@@ -746,7 +746,7 @@ void SettingsListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) LVHITTESTINFO hti;
hti.pt=((NMLISTVIEW*)lParam)->ptAction;
- if (DBGetContactSettingByte(NULL,modname,"DontAllowInLineEdit",0) || !IsWinVer2000Plus()) /* fix for TioDuke and win98 */
+ if (db_get_b(NULL,modname,"DontAllowInLineEdit",0) || !IsWinVer2000Plus()) /* fix for TioDuke and win98 */
break;
if (info && ListView_SubItemHitTest(GetDlgItem(hwnd,IDC_SETTINGS),&hti) >-1)
{
@@ -790,7 +790,7 @@ void SettingsListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) hti.pt=((NMLISTVIEW*)lParam)->ptAction;
if (info && ListView_SubItemHitTest(GetDlgItem(hwnd,IDC_SETTINGS),&hti) >-1)
{
- if ((hti.iSubItem > 1 || hti.flags == LVHT_ONITEMICON) || (DBGetContactSettingByte(NULL,modname,"DontAllowInLineEdit",0) || !IsWinVer2000Plus()/* fix for TioDuke and win98 */ ))
+ if ((hti.iSubItem > 1 || hti.flags == LVHT_ONITEMICON) || (db_get_b(NULL,modname,"DontAllowInLineEdit",0) || !IsWinVer2000Plus()/* fix for TioDuke and win98 */ ))
{
char setting[256];
SendMessage(info->hwnd2Edit,WM_COMMAND,MAKEWPARAM(IDOK,0),0);
@@ -1093,7 +1093,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here ///////////////////////// convert to submenu
case MENU_VIEWDECRYPT:
- if (!DBGetContactSetting(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) {
+ if (!db_get(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) {
if (lstrcmpA(setting, "LoginPassword")) {
char *text = mir_strdup(dbv.pszVal);
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)lstrlenA(dbv.pszVal)+1, (LPARAM)text);
@@ -1113,38 +1113,38 @@ void SettingsListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here mir_free(res);
mir_free(str);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case MENU_VIEWENCRYPT:
- if (!DBGetContactSetting(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) {
+ if (!db_get(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) {
char *text = mir_tstrdup(dbv.pszVal);
CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)strlen(dbv.pszVal)+1, (LPARAM)text);
msg(text, Translate("Encoded string.."));
mir_free(text);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
case MENU_DECRYPT:
- if (!DBGetContactSetting(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) {
+ if (!db_get(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) {
char *text = mir_tstrdup(dbv.pszVal);
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)strlen(dbv.pszVal)+1, (LPARAM)text);
- DBWriteContactSettingString(hContact,module,setting,text);
+ db_set_s(hContact,module,setting,text);
mir_free(text);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
case MENU_ENCRYPT:
- if (!DBGetContactSetting(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) {
+ if (!db_get(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) {
char *text = mir_tstrdup(dbv.pszVal);
CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)strlen(dbv.pszVal)+1, (LPARAM)text);
- DBWriteContactSettingString(hContact,module,setting,text);
+ db_set_s(hContact,module,setting,text);
mir_free(text);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
///////////////////////// divider
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index 66aef8654e..865029c358 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -8,7 +8,7 @@ int addSettingToWatchList(HANDLE hContact, char* module, char* setting) WatchListArray.item = (struct DBsetting*)mir_realloc(WatchListArray.item, sizeof(struct DBsetting)*WatchListArray.size);
}
if (!WatchListArray.item) return 0;
- if (setting && DBGetContactSetting(hContact,module, setting, &(WatchListArray.item[WatchListArray.count].dbv))) return 0;
+ if (setting && db_get(hContact,module, setting, &(WatchListArray.item[WatchListArray.count].dbv))) return 0;
WatchListArray.item[WatchListArray.count].hContact = hContact;
WatchListArray.item[WatchListArray.count].module = mir_tstrdup(module);
if (setting) WatchListArray.item[WatchListArray.count].setting = mir_tstrdup(setting);
@@ -25,7 +25,7 @@ void freeWatchListItem(int item) WatchListArray.item[item].module = 0;
if (WatchListArray.item[item].setting) mir_free(WatchListArray.item[item].setting);
WatchListArray.item[item].setting = 0;
- DBFreeVariant(&(WatchListArray.item[item].dbv));
+ db_free(&(WatchListArray.item[item].dbv));
WatchListArray.item[item].hContact = 0;
}
@@ -64,7 +64,7 @@ void addwatchtolist(HWND hwnd2list, struct DBsetting *lParam) FreeModuleSettingLL(&settinglist);
return;
}
- DBFreeVariant(&(lParam->dbv));
+ db_free(&(lParam->dbv));
if (GetSetting(hContact, module, setting, &(lParam->dbv))) return;
if (!hContact)
@@ -287,9 +287,9 @@ void popupWatchedVar(HANDLE hContact,const char* module,const char* setting) HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT));
char lpzContactName[MAX_CONTACTNAME];
char lpzText[MAX_SECONDLINE];
- COLORREF colorBack = DBGetContactSettingDword(NULL,modname,"PopupColour",RGB(255,0,0));
+ COLORREF colorBack = db_get_dw(NULL,modname,"PopupColour",RGB(255,0,0));
COLORREF colorText = RGB(0,0,0);
- int timeout = DBGetContactSettingByte(NULL,modname,"PopupDelay",3);
+ int timeout = db_get_b(NULL,modname,"PopupDelay",3);
if (hContact) {
// contacts nick
@@ -326,7 +326,7 @@ void popupWatchedVar(HANDLE hContact,const char* module,const char* setting) return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
POPUPDATA ppd = { 0 };
ppd.lchContact = (HANDLE)hContact;
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index 1922212386..2a2495b62b 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -171,7 +171,7 @@ int Backup(TCHAR* backup_filename) {
SendMessage(progress_dialog, PBM_SETPOS, (WPARAM)(int)(100), 0);
UpdateWindow(progress_dialog);
- DBWriteContactSettingDword(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0));
+ db_set_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0));
if (!options.disable_popups)
{
size_t dest_file_len = lstrlen(dest_file);
@@ -204,7 +204,7 @@ int Backup(TCHAR* backup_filename) VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
time_t t = time(NULL);
- time_t diff = t - (time_t)DBGetContactSettingDword(0, "AutoBackups", "LastBackupTimestamp", (DWORD)t);
+ time_t diff = t - (time_t)db_get_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)t);
if(diff > (time_t)(options.period * (options.period_type == PT_MINUTES ? 60 : (options.period_type == PT_HOURS ? 60 * 60 : 60 * 60 * 24 ))))
mir_forkthread(BackupThread, NULL);
}
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index da944bc205..839aacc582 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -4,14 +4,14 @@ Options options; int LoadOptions(void)
{
- options.backup_types = (BackupType)DBGetContactSettingByte(0, "AutoBackups", "BackupType", (BYTE)(BT_PERIODIC));
- options.period = (unsigned int)DBGetContactSettingWord(0, "AutoBackups", "Period", 1);
- options.period_type = (PeriodType)DBGetContactSettingByte(0, "AutoBackups", "PeriodType", (BYTE)PT_DAYS);
+ options.backup_types = (BackupType)db_get_b(0, "AutoBackups", "BackupType", (BYTE)(BT_PERIODIC));
+ options.period = (unsigned int)db_get_w(0, "AutoBackups", "Period", 1);
+ options.period_type = (PeriodType)db_get_b(0, "AutoBackups", "PeriodType", (BYTE)PT_DAYS);
if (!ServiceExists(MS_FOLDERS_GET_PATH)) {
DBVARIANT dbv;
- if (!DBGetContactSettingTString(0, "AutoBackups", "Folder", &dbv)) {
+ if (!db_get_ts(0, "AutoBackups", "Folder", &dbv)) {
TCHAR *tmp = Utils_ReplaceVarsT(dbv.ptszVal);
if(_tcslen(tmp) >= 2 && tmp[1] == ':')
@@ -19,15 +19,15 @@ int LoadOptions(void) else
mir_sntprintf(options.folder, MAX_PATH, _T("%s\\%s"), profilePath, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_free(tmp);
} else
mir_sntprintf(options.folder, MAX_PATH, _T("%s%s"), DIR, SUB_DIR);
}
- options.num_backups = (unsigned int)DBGetContactSettingWord(0, "AutoBackups", "NumBackups", 3);
+ options.num_backups = (unsigned int)db_get_w(0, "AutoBackups", "NumBackups", 3);
- options.disable_progress = (BOOL)DBGetContactSettingByte(0, "AutoBackups", "NoProgress", 0);
- options.disable_popups = (BOOL)DBGetContactSettingByte(0, "AutoBackups", "NoPopups", 0);
+ options.disable_progress = (BOOL)db_get_b(0, "AutoBackups", "NoProgress", 0);
+ options.disable_popups = (BOOL)db_get_b(0, "AutoBackups", "NoPopups", 0);
SetBackupTimer();
return 0;
@@ -37,19 +37,19 @@ int SaveOptions(void) {
TCHAR prof_dir[MAX_PATH];
- DBWriteContactSettingByte(0, "AutoBackups", "BackupType", (BYTE)options.backup_types);
+ db_set_b(0, "AutoBackups", "BackupType", (BYTE)options.backup_types);
if (options.period < 1) options.period = 1;
- DBWriteContactSettingWord(0, "AutoBackups", "Period", (WORD)options.period);
- DBWriteContactSettingByte(0, "AutoBackups", "PeriodType", (BYTE)options.period_type);
+ db_set_w(0, "AutoBackups", "Period", (WORD)options.period);
+ db_set_b(0, "AutoBackups", "PeriodType", (BYTE)options.period_type);
mir_sntprintf(prof_dir, MAX_PATH, _T("%s\\"), profilePath);
size_t prof_len = _tcslen(prof_dir);
size_t opt_len = _tcslen(options.folder);
if(opt_len > prof_len && _tcsncmp(options.folder, prof_dir, prof_len) == 0) {
- DBWriteContactSettingTString(0, "AutoBackups", "Folder", (options.folder + prof_len));
+ db_set_ts(0, "AutoBackups", "Folder", (options.folder + prof_len));
} else
- DBWriteContactSettingTString(0, "AutoBackups", "Folder", options.folder);
+ db_set_ts(0, "AutoBackups", "Folder", options.folder);
TCHAR *tmp = Utils_ReplaceVarsT(options.folder);
if(_tcslen(tmp) < 2 || tmp[1] != ':')
@@ -59,9 +59,9 @@ int SaveOptions(void) mir_free(buf);
}
mir_free(tmp);
- DBWriteContactSettingWord(0, "AutoBackups", "NumBackups", (WORD)options.num_backups);
- DBWriteContactSettingByte(0, "AutoBackups", "NoProgress", (BYTE)options.disable_progress);
- DBWriteContactSettingByte(0, "AutoBackups", "NoPopups", (BYTE)options.disable_popups);
+ db_set_w(0, "AutoBackups", "NumBackups", (WORD)options.num_backups);
+ db_set_b(0, "AutoBackups", "NoProgress", (BYTE)options.disable_progress);
+ db_set_b(0, "AutoBackups", "NoPopups", (BYTE)options.disable_popups);
SetBackupTimer();
return 0;
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 55e8022a39..d0747f234b 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -216,49 +216,21 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) bool bHideRoot = opt.bHideInactive;
for (int i = 0; i < ServerList::FTP_COUNT; i++)
- {
if (ftpList[i]->bEnabled)
bHideRoot = false;
- }
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
if (opt.bUseSubmenu)
- {
- if (!bIsContact || bHideRoot) mi.flags |= CMIF_HIDDEN;
- else mi.flags &= ~CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenu, (LPARAM)&mi);
- }
+ Menu_ShowItem(hMenu, bIsContact && !bHideRoot);
for (int i = 0; i < ServerList::FTP_COUNT; i++)
- {
- mi.flags = CMIM_FLAGS;
- if (!bIsContact)
- {
- mi.flags |= CMIF_HIDDEN;
- }
- else if (!ftpList[i]->bEnabled)
- {
- mi.flags |= opt.bHideInactive ? CMIF_HIDDEN : CMIF_GRAYED;
- }
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hSubMenu[i], (LPARAM)&mi);
- }
-
+ Menu_ShowItem(hSubMenu[i], bIsContact && ftpList[i]->bEnabled);
return 0;
}
void PrebuildMainMenu()
{
- CLISTMENUITEM mi = { sizeof(mi) };
- for (int i=0; i < ServerList::FTP_COUNT; i++) {
- mi.flags = CMIM_FLAGS;
- if (!ftpList[i]->bEnabled)
- mi.flags |= opt.bHideInactive ? CMIF_HIDDEN : CMIF_GRAYED;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainSubMenu[i], (LPARAM)&mi);
- }
+ for (int i=0; i < ServerList::FTP_COUNT; i++)
+ Menu_ShowItem(hMainSubMenu[i], ftpList[i]->bEnabled);
}
int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam)
diff --git a/plugins/FTPFileYM/src/mir_db.cpp b/plugins/FTPFileYM/src/mir_db.cpp index 254734c8db..63e85cc056 100644 --- a/plugins/FTPFileYM/src/mir_db.cpp +++ b/plugins/FTPFileYM/src/mir_db.cpp @@ -85,10 +85,10 @@ int DB::getDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int int DB::getAString(HANDLE hContact, char *szModule, char *szSetting, char *buff)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, szModule, szSetting, &dbv))
+ if (!db_get_s(hContact, szModule, szSetting, &dbv))
{
strcpy(buff, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -106,10 +106,10 @@ int DB::getAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, ch int DB::getString(HANDLE hContact, char *szModule, char *szSetting, TCHAR *buff)
{
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, szModule, szSetting, &dbv))
+ if (!db_get_ts(hContact, szModule, szSetting, &dbv))
{
_tcscpy(buff, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
diff --git a/plugins/FavContacts/src/favlist.h b/plugins/FavContacts/src/favlist.h index dc2dd610e9..40f44b6e6d 100644 --- a/plugins/FavContacts/src/favlist.h +++ b/plugins/FavContacts/src/favlist.h @@ -20,10 +20,10 @@ public: this->bManual = bManual;
this->fRate = fRate;
name = mir_tstrdup((TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
- if (g_Options.bUseGroups && !DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
+ if (g_Options.bUseGroups && !db_get_ts(hContact, "CList", "Group", &dbv))
{
group = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
if (g_Options.bUseGroups)
{
@@ -32,7 +32,7 @@ public: {
group = mir_tstrdup(TranslateT("Favourite Contacts"));
}
- status = DBGetContactSettingWord(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE);
+ status = db_get_w(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE);
}
~TContactInfo()
@@ -105,7 +105,7 @@ public: HANDLE hContact = db_find_first();
for ( ; hContact; hContact = db_find_next(hContact))
- if (DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0))
+ if (db_get_b(hContact, "FavContacts", "IsFavourite", 0))
{
TCHAR *group = addContact(hContact, true)->getGroup();
if (prevGroup && lstrcmp(prevGroup, group))
@@ -118,7 +118,7 @@ public: {
hContact = g_contactCache->get(i);
if (!hContact) break;
- if (!DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0))
+ if (!db_get_b(hContact, "FavContacts", "IsFavourite", 0))
{
TCHAR *group = addContact(hContact, false)->getGroup();
if (prevGroup && lstrcmp(prevGroup, group))
diff --git a/plugins/FavContacts/src/http_api.cpp b/plugins/FavContacts/src/http_api.cpp index c4929e6c3c..0806cddcd9 100644 --- a/plugins/FavContacts/src/http_api.cpp +++ b/plugins/FavContacts/src/http_api.cpp @@ -70,7 +70,7 @@ public: HANDLE hContact = favList[i]->getHandle();
TCHAR *name = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
AVATARCACHEENTRY *avatar = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
- int status = DBGetContactSettingWord(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE);
+ int status = db_get_w(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE);
Send("SetContact(");
Send(i);
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 878b7d01bd..7e065d60fd 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -233,7 +233,7 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_AV_GETAVATARBITMAP)) {
HANDLE hContact = db_find_first();
for ( ; hContact; hContact = db_find_next(hContact))
- if (DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0))
+ if (db_get_b(hContact, "FavContacts", "IsFavourite", 0))
CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
}
@@ -322,36 +322,36 @@ extern "C" __declspec(dllexport) int Unload(void) static void sttLoadOptions()
{
- g_Options.bSecondLine = DBGetContactSettingByte(NULL, "FavContacts", "SecondLine", 1);
- g_Options.bAvatars = DBGetContactSettingByte(NULL, "FavContacts", "Avatars", 1);
- g_Options.bAvatarBorder = DBGetContactSettingByte(NULL, "FavContacts", "AvatarBorder", 0);
- g_Options.wAvatarRadius = DBGetContactSettingWord(NULL, "FavContacts", "AvatarRadius", 3);
- g_Options.bNoTransparentBorder = DBGetContactSettingByte(NULL, "FavContacts", "NoTransparentBorder",
- !DBGetContactSettingByte(NULL, "FavContacts", "AvatarBorderTransparent", 1));
- g_Options.bSysColors = DBGetContactSettingByte(NULL, "FavContacts", "SysColors", 0);
- g_Options.bCenterHotkey = DBGetContactSettingByte(NULL, "FavContacts", "CenterHotkey", 1);
- g_Options.bUseGroups = DBGetContactSettingByte(NULL, "FavContacts", "UseGroups", 0);
- g_Options.bUseColumns = DBGetContactSettingByte(NULL, "FavContacts", "UseColumns", 1);
- g_Options.bRightAvatars = DBGetContactSettingByte(NULL, "FavContacts", "RightAvatars", 0);
- g_Options.bDimIdle = DBGetContactSettingByte(NULL, "FavContacts", "DimIdle", 1);
-
- g_Options.wMaxRecent = DBGetContactSettingByte(NULL, "FavContacts", "MaxRecent", 10);
+ g_Options.bSecondLine = db_get_b(NULL, "FavContacts", "SecondLine", 1);
+ g_Options.bAvatars = db_get_b(NULL, "FavContacts", "Avatars", 1);
+ g_Options.bAvatarBorder = db_get_b(NULL, "FavContacts", "AvatarBorder", 0);
+ g_Options.wAvatarRadius = db_get_w(NULL, "FavContacts", "AvatarRadius", 3);
+ g_Options.bNoTransparentBorder = db_get_b(NULL, "FavContacts", "NoTransparentBorder",
+ !db_get_b(NULL, "FavContacts", "AvatarBorderTransparent", 1));
+ g_Options.bSysColors = db_get_b(NULL, "FavContacts", "SysColors", 0);
+ g_Options.bCenterHotkey = db_get_b(NULL, "FavContacts", "CenterHotkey", 1);
+ g_Options.bUseGroups = db_get_b(NULL, "FavContacts", "UseGroups", 0);
+ g_Options.bUseColumns = db_get_b(NULL, "FavContacts", "UseColumns", 1);
+ g_Options.bRightAvatars = db_get_b(NULL, "FavContacts", "RightAvatars", 0);
+ g_Options.bDimIdle = db_get_b(NULL, "FavContacts", "DimIdle", 1);
+
+ g_Options.wMaxRecent = db_get_b(NULL, "FavContacts", "MaxRecent", 10);
}
static void sttSaveOptions()
{
- DBWriteContactSettingByte(NULL, "FavContacts", "SecondLine", g_Options.bSecondLine);
- DBWriteContactSettingByte(NULL, "FavContacts", "Avatars", g_Options.bAvatars);
- DBWriteContactSettingByte(NULL, "FavContacts", "AvatarBorder", g_Options.bAvatarBorder);
- DBWriteContactSettingWord(NULL, "FavContacts", "AvatarRadius", g_Options.wAvatarRadius);
- DBWriteContactSettingByte(NULL, "FavContacts", "NoTransparentBorder", g_Options.bNoTransparentBorder);
- DBWriteContactSettingByte(NULL, "FavContacts", "SysColors", g_Options.bSysColors);
- DBWriteContactSettingByte(NULL, "FavContacts", "CenterHotkey", g_Options.bCenterHotkey);
- DBWriteContactSettingByte(NULL, "FavContacts", "UseGroups", g_Options.bUseGroups);
- DBWriteContactSettingByte(NULL, "FavContacts", "UseColumns", g_Options.bUseColumns);
- DBWriteContactSettingByte(NULL, "FavContacts", "RightAvatars", g_Options.bRightAvatars);
- DBWriteContactSettingByte(NULL, "FavContacts", "DimIdle", g_Options.bDimIdle);
- DBWriteContactSettingWord(NULL, "FavContacts", "MaxRecent", g_Options.wMaxRecent);
+ db_set_b(NULL, "FavContacts", "SecondLine", g_Options.bSecondLine);
+ db_set_b(NULL, "FavContacts", "Avatars", g_Options.bAvatars);
+ db_set_b(NULL, "FavContacts", "AvatarBorder", g_Options.bAvatarBorder);
+ db_set_w(NULL, "FavContacts", "AvatarRadius", g_Options.wAvatarRadius);
+ db_set_b(NULL, "FavContacts", "NoTransparentBorder", g_Options.bNoTransparentBorder);
+ db_set_b(NULL, "FavContacts", "SysColors", g_Options.bSysColors);
+ db_set_b(NULL, "FavContacts", "CenterHotkey", g_Options.bCenterHotkey);
+ db_set_b(NULL, "FavContacts", "UseGroups", g_Options.bUseGroups);
+ db_set_b(NULL, "FavContacts", "UseColumns", g_Options.bUseColumns);
+ db_set_b(NULL, "FavContacts", "RightAvatars", g_Options.bRightAvatars);
+ db_set_b(NULL, "FavContacts", "DimIdle", g_Options.bDimIdle);
+ db_set_w(NULL, "FavContacts", "MaxRecent", g_Options.wMaxRecent);
}
static bool sttIsGroup(int id)
@@ -361,9 +361,9 @@ static bool sttIsGroup(int id) DBVARIANT dbv = {0};
char buf[32];
wsprintfA(buf, "%d", (int)(id-2));
- if (!DBGetContactSettingTString(NULL, "CListGroups", buf, &dbv))
+ if (!db_get_ts(NULL, "CListGroups", buf, &dbv))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return true;
}
return false;
@@ -381,10 +381,10 @@ static TCHAR *sttGetGroupName(int id) DBVARIANT dbv = {0};
char buf[32];
wsprintfA(buf, "%d", (int)(id-2));
- if (!DBGetContactSettingTString(NULL, "CListGroups", buf, &dbv))
+ if (!db_get_ts(NULL, "CListGroups", buf, &dbv))
{
TCHAR *res = mir_tstrdup(dbv.ptszVal+1);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return res;
}
return NULL;
@@ -397,15 +397,15 @@ static int sttGetGroupId(TCHAR *name) DBVARIANT dbv = {0};
char buf[32];
wsprintfA(buf, "%d", (int)i);
- if (!DBGetContactSettingTString(NULL, "CListGroups", buf, &dbv))
+ if (!db_get_ts(NULL, "CListGroups", buf, &dbv))
{
if (!lstrcmp(dbv.ptszVal+1, name))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return i+2;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
{
// default is root
@@ -459,10 +459,10 @@ static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) DBVARIANT dbv;
TCHAR *title;
bool bFree = false;
- if (DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv) || !*dbv.ptszVal)
+ if (db_get_ts(hContact, "CList", "StatusMsg", &dbv) || !*dbv.ptszVal)
{
char *proto = GetContactProto(hContact);
- int status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
+ int status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
title = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR);
} else
{
@@ -472,7 +472,7 @@ static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) if (!options->bSysColors) SelectObject(hdc, g_Options.hfntSecond);
GetTextExtentPoint32(hdc, title, lstrlen(title), &sz);
- if (bFree) DBFreeVariant(&dbv);
+ if (bFree) db_free(&dbv);
textWidth = sz.cx;
lpmis->itemHeight += sz.cy + 3;
}
@@ -667,7 +667,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) HIMAGELIST hIml = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
int iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0);
- if (DBGetContactSettingDword(hContact, proto, "IdleTS", 0))
+ if (db_get_dw(hContact, proto, "IdleTS", 0))
{
ImageList_DrawDimmed(hIml, iIcon, hdcTemp,
lpdis->rcItem.left, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2,
@@ -682,7 +682,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) lpdis->rcItem.left += 20;
}
- if (options->wMaxRecent && DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0))
+ if (options->wMaxRecent && db_get_b(hContact, "FavContacts", "IsFavourite", 0))
{
DrawIconEx(hdcTemp, lpdis->rcItem.right - 18, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2,
Skin_GetIconByHandle(iconList[0].hIcolib), 16, 16, 0, NULL, DI_NORMAL);
@@ -747,9 +747,9 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) DBVARIANT dbv;
TCHAR *title;
bool bFree = false;
- if (DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv) || !*dbv.ptszVal)
+ if (db_get_ts(hContact, "CList", "StatusMsg", &dbv) || !*dbv.ptszVal)
{
- int status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
+ int status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
title = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR);
} else
{
@@ -761,7 +761,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) SetTextColor(hdcTemp, clLine2);
DrawText(hdcTemp, title, lstrlen(title), &lpdis->rcItem, DT_NOPREFIX|DT_SINGLELINE|DT_TOP|DT_LEFT);
- if (bFree) DBFreeVariant(&dbv);
+ if (bFree) db_free(&dbv);
}
SelectObject(hdcTemp, hfntSave);
@@ -946,7 +946,7 @@ int sttShowMenu(bool centered) szMenu.cy = max(szMenu.cy, szColumn.cy);
szColumn.cx = szColumn.cy = 0;
- unsigned maxWidth = GetSystemMetrics(SM_CXSCREEN) * DBGetContactSettingByte(NULL, "FavContacts", "MenuWidth", 66) / 100;
+ unsigned maxWidth = GetSystemMetrics(SM_CXSCREEN) * db_get_b(NULL, "FavContacts", "MenuWidth", 66) / 100;
if (szMenu.cx > maxWidth) {
g_widthMultiplier = (float)maxWidth / szMenu.cx;
szMenu.cx *= g_widthMultiplier;
@@ -1019,7 +1019,7 @@ int ProcessSrmmEvent( WPARAM wParam, LPARAM lParam ) hDialogsList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
WindowList_Add(hDialogsList, event->hwndWindow, event->hContact);
- BYTE fav = DBGetContactSettingByte(event->hContact, "FavContacts", "IsFavourite", 0);
+ BYTE fav = db_get_b(event->hContact, "FavContacts", "IsFavourite", 0);
StatusIconData sid = {0};
sid.cbSize = sizeof(sid);
sid.szModule = "FavContacts";
@@ -1060,8 +1060,8 @@ int ProcessSrmmIconClick( WPARAM wParam, LPARAM lParam ) if (sicd->flags & MBCF_RIGHTBUTTON)
{
- BYTE fav = !DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0);
- DBWriteContactSettingByte(hContact, "FavContacts", "IsFavourite", fav);
+ BYTE fav = !db_get_b(hContact, "FavContacts", "IsFavourite", 0);
+ db_set_b(hContact, "FavContacts", "IsFavourite", fav);
if (fav) CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
StatusIconData sid = {0};
@@ -1131,7 +1131,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA {
SendDlgItemMessage(hwnd, IDC_CLIST, CLM_SETCHECKMARK,
SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0),
- DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0));
+ db_get_b(hContact, "FavContacts", "IsFavourite", 0));
}
bInitialized = true;
@@ -1268,8 +1268,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA {
BYTE fav = SendDlgItemMessage(hwnd, IDC_CLIST, CLM_GETCHECKMARK,
SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0), 0);
- if (fav != DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0))
- DBWriteContactSettingByte(hContact, "FavContacts", "IsFavourite", fav);
+ if (fav != db_get_b(hContact, "FavContacts", "IsFavourite", 0))
+ db_set_b(hContact, "FavContacts", "IsFavourite", fav);
if (fav) CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
}
} else
@@ -1291,7 +1291,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection)
{
SendDlgItemMessage(hwnd, IDC_CLIST, CLM_SETCHECKMARK, iSelection,
- DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0));
+ db_get_b(hContact, "FavContacts", "IsFavourite", 0));
break;
}
break;
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 6d5069ab5f..466525ce88 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -264,18 +264,18 @@ int RetrieveFileSize(char *filename) FILEECHO::FILEECHO(HANDLE Contact)
{
hContact = Contact;
- dwSendInterval = DBGetContactSettingDword(NULL, SERVICE_NAME, "SendDelay", 6000);
- //dwChunkSize = DBGetContactSettingDword(NULL, SERVICE_NAME, "ChunkSize", 5000);
+ dwSendInterval = db_get_dw(NULL, SERVICE_NAME, "SendDelay", 6000);
+ //dwChunkSize = db_get_dw(NULL, SERVICE_NAME, "ChunkSize", 5000);
- chunkMaxLen = DBGetContactSettingDword(NULL, SERVICE_NAME, "ChunkSize", 5000);
+ chunkMaxLen = db_get_dw(NULL, SERVICE_NAME, "ChunkSize", 5000);
chunkCount = 0;
filename = NULL;
- rgbRecv = DBGetContactSettingDword(NULL, SERVICE_NAME, "colorRecv", RGB(64,255,64));
- rgbSent = DBGetContactSettingDword(NULL, SERVICE_NAME, "colorSent", RGB(255,255,64));
- rgbUnSent = DBGetContactSettingDword(NULL, SERVICE_NAME, "colorUnsent", RGB(128,128,128));
- rgbToSend = DBGetContactSettingDword(NULL, SERVICE_NAME, "colorTosend", RGB(192,192,192));
- asBinary = DBGetContactSettingDword(NULL, SERVICE_NAME, "base64", 1) == 0;
+ rgbRecv = db_get_dw(NULL, SERVICE_NAME, "colorRecv", RGB(64,255,64));
+ rgbSent = db_get_dw(NULL, SERVICE_NAME, "colorSent", RGB(255,255,64));
+ rgbUnSent = db_get_dw(NULL, SERVICE_NAME, "colorUnsent", RGB(128,128,128));
+ rgbToSend = db_get_dw(NULL, SERVICE_NAME, "colorTosend", RGB(192,192,192));
+ asBinary = db_get_dw(NULL, SERVICE_NAME, "base64", 1) == 0;
}
uint controlEnabled[][2] =
@@ -573,8 +573,8 @@ void FILEECHO::incomeRequest(char *param) inSend = FALSE;
SkinPlaySound("RecvFile");
- int AutoMin = DBGetContactSettingByte(NULL,"SRFile","AutoMin",0);
- if(DBGetContactSettingByte(NULL,"SRFile","AutoAccept",0) && !DBGetContactSettingByte((HANDLE)hContact,"CList","NotOnList",0))
+ int AutoMin = db_get_b(NULL,"SRFile","AutoMin",0);
+ if(db_get_b(NULL,"SRFile","AutoAccept",0) && !db_get_b((HANDLE)hContact,"CList","NotOnList",0))
{
PostMessage(hDlg, WM_COMMAND, IDC_PLAY, 0);
if(AutoMin)
@@ -667,7 +667,7 @@ void FILEECHO::onRecvTimer() SetDlgItemText(hDlg, IDC_STATUS, msg);
MakePopupMsg(hDlg, hContact, msg);
setState(STATE_FINISHED);
- if(DBGetContactSettingByte(NULL,"SRFile","AutoClose",0))
+ if(db_get_b(NULL,"SRFile","AutoClose",0))
{
PostMessage(hDlg, WM_CLOSE, 0,0);
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, 0);
@@ -1184,7 +1184,7 @@ INT_PTR CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam if (szProto)
{
int dwStatus;
- dwStatus = DBGetContactSettingWord(dat->hContact,szProto,"Status",ID_STATUS_OFFLINE);
+ dwStatus = db_get_w(dat->hContact,szProto,"Status",ID_STATUS_OFFLINE);
if(dat->inSend && dwStatus != dat->contactStatus)
{
if(dat->contactStatus == ID_STATUS_OFFLINE)
diff --git a/plugins/FileAsMessage/src/optionsdlg.cpp b/plugins/FileAsMessage/src/optionsdlg.cpp index 748a118db5..d1b402c5c8 100644 --- a/plugins/FileAsMessage/src/optionsdlg.cpp +++ b/plugins/FileAsMessage/src/optionsdlg.cpp @@ -45,11 +45,11 @@ INT_PTR CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM for(int indx = 0; indx < SIZEOF(settingId); indx++)
if(settingId[indx] > 0)
- SendDlgItemMessage(hwndDlg, settingId[indx], CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SERVICE_NAME, settingName[indx], settingDefault[indx]));
+ SendDlgItemMessage(hwndDlg, settingId[indx], CPM_SETCOLOUR, 0, db_get_dw(NULL, SERVICE_NAME, settingName[indx], settingDefault[indx]));
else
- SetDlgItemInt(hwndDlg, -settingId[indx], DBGetContactSettingDword(NULL, SERVICE_NAME, settingName[indx], settingDefault[indx]), FALSE);
+ SetDlgItemInt(hwndDlg, -settingId[indx], db_get_dw(NULL, SERVICE_NAME, settingName[indx], settingDefault[indx]), FALSE);
- CheckDlgButton(hwndDlg, IDC_ALPHANUM, DBGetContactSettingDword(NULL, SERVICE_NAME, "base64", 1)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ALPHANUM, db_get_dw(NULL, SERVICE_NAME, "base64", 1)?BST_CHECKED:BST_UNCHECKED);
return TRUE;
@@ -97,9 +97,9 @@ INT_PTR CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM value = GetDlgItemInt(hwndDlg, -settingId[indx], &succ, FALSE);
if(!succ) value = settingDefault[indx];
}
- DBWriteContactSettingDword(NULL,SERVICE_NAME,settingName[indx], value);
+ db_set_dw(NULL,SERVICE_NAME,settingName[indx], value);
}
- DBWriteContactSettingDword(NULL,SERVICE_NAME, "base64", (IsDlgButtonChecked(hwndDlg, IDC_ALPHANUM) == BST_CHECKED)?1:0);
+ db_set_dw(NULL,SERVICE_NAME, "base64", (IsDlgButtonChecked(hwndDlg, IDC_ALPHANUM) == BST_CHECKED)?1:0);
return TRUE;
}
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index b67d2e8b58..6c502acfca 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -213,7 +213,7 @@ int OnExtraImageApply(WPARAM wParam, LPARAM lParam) DBVARIANT dbvMirVer;
if ( !db_get_ts(hContact, szProto, "MirVer", &dbvMirVer)) {
ApplyFingerprintImage(hContact, dbvMirVer.ptszVal);
- DBFreeVariant(&dbvMirVer);
+ db_free(&dbvMirVer);
}
else ApplyFingerprintImage(hContact, NULL);
}
diff --git a/plugins/FlashAvatars/src/cflash.cpp b/plugins/FlashAvatars/src/cflash.cpp index 711a3b2f1c..7153d41c9f 100644 --- a/plugins/FlashAvatars/src/cflash.cpp +++ b/plugins/FlashAvatars/src/cflash.cpp @@ -199,7 +199,7 @@ static void __cdecl loadFlash_Thread(void *p) { // change flash frame according user's status
int status;
if (fai->hFA.hContact)
- status = DBGetContactSettingWord(fai->hFA.hContact, fai->getProto(), "Status", ID_STATUS_OFFLINE);
+ status = db_get_w(fai->hFA.hContact, fai->getProto(), "Status", ID_STATUS_OFFLINE);
else
status = CallProtoService(fai->getProto(), PS_GETSTATUS, 0, 0);
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index ba94e8fd69..ceb9c2d971 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -66,15 +66,14 @@ BOOL bVersionOK = FALSE; BOOL bDockHorz = TRUE;
//UINT nStatus = 0;
HMENU hContactMenu = NULL;
-HANDLE hMenuItemRemove = NULL;
-HANDLE hMenuItemHideAll = NULL;
-HANDLE hMainMenuItemHideAll = NULL;
RECT rcScreen;
DWORD dwOfflineModes = 0;
BOOL bEnableTip = FALSE;
UINT_PTR ToTopTimerID = 0;
BOOL bIsCListShow = TRUE;
+HGENMENU hMenuItemRemove, hMenuItemHideAll, hMainMenuItemHideAll;
+
int hLangpack;
pfnSHAutoComplete fnSHAutoComplete = NULL;
@@ -226,16 +225,15 @@ static int OnContactDrop( WPARAM wParam, LPARAM lParam ) static int OnContactDragStop( WPARAM wParam, LPARAM lParam )
{
- HANDLE hContact = ( HANDLE )wParam;
+ HANDLE hContact = ( HANDLE )wParam;
ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
- if ( ( pThumb != NULL ) && ( hNewContact == hContact ))
- {
+ if (pThumb != NULL && hNewContact == hContact ) {
thumbList.RemoveThumb( pThumb );
hNewContact = NULL;
}
- return( 0 );
+ return 0;
}
@@ -248,7 +246,7 @@ static int OnSkinIconsChanged( WPARAM wParam, LPARAM lParam ) for (int i = 0; i < thumbList.getCount(); ++i)
thumbList[i]->UpdateContent();
- return( 0 );
+ return 0;
}
@@ -269,10 +267,10 @@ static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam ) ApplyOptionsChanges();
}
- return( 0 );
+ return 0;
}
- if ( pThumb == NULL ) return( 0 );
+ if ( pThumb == NULL ) return 0;
// Only on these 2 events we need to refresh
if ( 0 == _stricmp( pdbcws->szSetting, "Status" ))
@@ -302,7 +300,7 @@ static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam ) PostMessage( pThumb->hwnd, WM_REFRESH_CONTACT, 0, idStatus );
}
- return( 0 );
+ return 0;
}
@@ -322,7 +320,7 @@ static int OnStatusModeChange( WPARAM wParam, LPARAM lParam ) // Floating status window will use this
}
- return( 0 );
+ return 0;
}
@@ -331,14 +329,9 @@ static int OnPrebuildContactMenu( WPARAM wParam, LPARAM lParam ) {
ThumbInfo *pThumb = thumbList.FindThumbByContact( (HANDLE) wParam );
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = ( pThumb == NULL ) ? CMIM_FLAGS | CMIF_HIDDEN : CMIM_FLAGS &~CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemRemove, (LPARAM)&clmi );
-
- clmi.flags = fcOpt.bHideAll ? CMIM_FLAGS | CMIF_HIDDEN : CMIM_FLAGS &~CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemHideAll, (LPARAM)&clmi );
-
- return( 0 );
+ Menu_ShowItem(hMenuItemRemove, pThumb != NULL);
+ Menu_ShowItem(hMenuItemHideAll, !fcOpt.bHideAll);
+ return 0;
}
@@ -680,7 +673,7 @@ static void CreateBackgroundBrush() if (db_get_b(NULL, MODULE, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP)) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, MODULE, "BkBitmap", &dbv)) {
+ if ( !db_get_ts(NULL, MODULE, "BkBitmap", &dbv)) {
hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal);
db_free(&dbv);
}
@@ -736,7 +729,7 @@ void RegHotkey( HANDLE hContact, HWND hwnd ) char szBuf[ MAX_PATH ] = {0};
DBVARIANT dbv;
- if (DBGetContactSettingString(hContact, MODULE, "Hotkey", &dbv)) return;
+ if (db_get_s(hContact, MODULE, "Hotkey", &dbv)) return;
strncpy(szBuf, dbv.pszVal, MAX_PATH - 1);
db_free( &dbv );
@@ -1021,7 +1014,7 @@ static int OnModulesLoded( WPARAM wParam, LPARAM lParam ) fcOpt.ToTopTime = (fcOpt.ToTopTime>TOTOPTIME_MAX)?TOTOPTIME_MAX:fcOpt.ToTopTime;
ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
}
- return( 0 );
+ return 0;
}
extern "C" int __declspec(dllexport) Load()
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index 4eb3cf3fd1..0ec7c56a44 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -180,7 +180,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP SendMessage(hwndDlg, M_REFRESHBKGBOXES, 0, 0);
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, MODULE, "BkBitmap", &dbv)) {
+ if ( !db_get_ts(NULL, MODULE, "BkBitmap", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FILENAME, dbv.ptszVal);
db_free(&dbv);
}
@@ -196,7 +196,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP fnSHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
// Windows 2K/XP
- BYTE btOpacity = (BYTE)DBGetContactSettingByte(NULL, MODULE, "Opacity", 100);
+ BYTE btOpacity = (BYTE)db_get_b(NULL, MODULE, "Opacity", 100);
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETRANGE, TRUE, MAKELONG(0, 100));
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETPOS, TRUE, btOpacity);
@@ -306,7 +306,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP TCHAR str[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
- DBWriteContactSettingTString(NULL, MODULE, "BkBitmap", str);
+ db_set_ts(NULL, MODULE, "BkBitmap", str);
WORD flags = 0;
if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH))
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index 407bf18220..c56bff0840 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -407,7 +407,7 @@ void ThumbInfo::RefreshContactStatus(int idStatus) void ThumbInfo::DeleteContactPos()
{
- DBDeleteContactSetting( hContact, MODULE, "ThumbsPos" );
+ db_unset( hContact, MODULE, "ThumbsPos" );
}
void ThumbInfo::OnLButtonDown(int nX, int nY)
diff --git a/plugins/Folders/src/utils.cpp b/plugins/Folders/src/utils.cpp index 69d571990f..93d572cf78 100644 --- a/plugins/Folders/src/utils.cpp +++ b/plugins/Folders/src/utils.cpp @@ -183,7 +183,7 @@ int GetStringFromDatabase(char *szSettingName, const wchar_t *szError, TCHAR *sz {
size_t len;
DBVARIANT dbv;
- if ( DBGetContactSettingWString(NULL, ModuleName, szSettingName, &dbv) == 0) {
+ if ( db_get_ws(NULL, ModuleName, szSettingName, &dbv) == 0) {
size_t tmp = _tcslen(dbv.ptszVal);
len = (tmp < size - 1) ? tmp : size - 1;
_tcsncpy(szResult, dbv.ptszVal, len);
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 1e159b146f..19193efdd4 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -104,7 +104,7 @@ string DBGetString(HANDLE hContact, const char *szModule, const char *szSetting, }
} else
ret = pszError;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return ret;
}
@@ -955,16 +955,16 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
HWND hUserList = GetDlgItem(hwndDlg, IDC_CURRENT_USERS);
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx1", (WORD)ListView_GetColumnWidth(hShareList, 0));
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx2", (WORD)ListView_GetColumnWidth(hShareList, 1));
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx3", (WORD)ListView_GetColumnWidth(hShareList, 2));
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx4", (WORD)ListView_GetColumnWidth(hShareList, 3));
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx5", (WORD)ListView_GetColumnWidth(hShareList, 4));
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx6", (WORD)ListView_GetColumnWidth(hUserList, 0));
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx7", (WORD)ListView_GetColumnWidth(hUserList, 1));
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx8", (WORD)ListView_GetColumnWidth(hUserList, 2));
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx9", (WORD)ListView_GetColumnWidth(hUserList, 3));
- DBWriteContactSettingWord(NULL, MODULE, "StatWnd_cx10", (WORD)ListView_GetColumnWidth(hUserList, 4));
+ db_set_w(NULL, MODULE, "StatWnd_cx1", (WORD)ListView_GetColumnWidth(hShareList, 0));
+ db_set_w(NULL, MODULE, "StatWnd_cx2", (WORD)ListView_GetColumnWidth(hShareList, 1));
+ db_set_w(NULL, MODULE, "StatWnd_cx3", (WORD)ListView_GetColumnWidth(hShareList, 2));
+ db_set_w(NULL, MODULE, "StatWnd_cx4", (WORD)ListView_GetColumnWidth(hShareList, 3));
+ db_set_w(NULL, MODULE, "StatWnd_cx5", (WORD)ListView_GetColumnWidth(hShareList, 4));
+ db_set_w(NULL, MODULE, "StatWnd_cx6", (WORD)ListView_GetColumnWidth(hUserList, 0));
+ db_set_w(NULL, MODULE, "StatWnd_cx7", (WORD)ListView_GetColumnWidth(hUserList, 1));
+ db_set_w(NULL, MODULE, "StatWnd_cx8", (WORD)ListView_GetColumnWidth(hUserList, 2));
+ db_set_w(NULL, MODULE, "StatWnd_cx9", (WORD)ListView_GetColumnWidth(hUserList, 3));
+ db_set_w(NULL, MODULE, "StatWnd_cx10", (WORD)ListView_GetColumnWidth(hUserList, 4));
bool b = IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDDENSHARES) == BST_CHECKED;
db_set_b(NULL, MODULE, "StatWnd_ShowHidden", b);
@@ -1032,7 +1032,7 @@ static INT_PTR nShareNewFile(WPARAM wParam, LPARAM lParam) { if (hContact) {
// Try to locate an IP address.
DBVARIANT dbv = {0};
- if (! DBGetContactSetting(hContact, "Protocol", "p", &dbv)) {
+ if (! db_get(hContact, "Protocol", "p", &dbv)) {
if (dbv.type == DBVT_ASCIIZ) {
stNewShare.dwAllowedIP = db_get_dw(hContact, dbv.pszVal, "IP", 0);
if (! stNewShare.dwAllowedIP)
@@ -1041,7 +1041,7 @@ static INT_PTR nShareNewFile(WPARAM wParam, LPARAM lParam) { stNewShare.dwAllowedIP = db_get_dw(hContact, MODULE, "LastUsedIP", 0);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
stNewShare.dwAllowedMask = db_get_dw(hContact, MODULE, "LastUsedMask", 0);
}
diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index bde839a30c..17ebfa7af0 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -49,23 +49,23 @@ INT_PTR WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) TranslateDialogDefault(hDlg);
TranslateMenu(listMenu);
- if ( DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00) == 0x00 )
+ if ( db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00) == 0x00 )
hContact = NULL;
else
hContact = DlgParam->hContact;
- if ( DBGetContactSettingByte(hContact, LINKLIST_MODULE, LINKLIST_FIRST, 0) == 0 )
+ if ( db_get_b(hContact, LINKLIST_MODULE, LINKLIST_FIRST, 0) == 0 )
{
// First use of this plugin! Set default size!
- DBWriteContactSettingDword(hContact, LINKLIST_MODULE, "LinklistWidth", 400);
- DBWriteContactSettingDword(hContact, LINKLIST_MODULE, "LinklistHeight", 450);
- DBWriteContactSettingDword(hContact, LINKLIST_MODULE, "LinklistX", 0);
- DBWriteContactSettingDword(hContact, LINKLIST_MODULE, "LinklistY", 0);
+ db_set_dw(hContact, LINKLIST_MODULE, "LinklistWidth", 400);
+ db_set_dw(hContact, LINKLIST_MODULE, "LinklistHeight", 450);
+ db_set_dw(hContact, LINKLIST_MODULE, "LinklistX", 0);
+ db_set_dw(hContact, LINKLIST_MODULE, "LinklistY", 0);
- DBWriteContactSettingByte(hContact, LINKLIST_MODULE, LINKLIST_FIRST, 1);
+ db_set_b(hContact, LINKLIST_MODULE, LINKLIST_FIRST, 1);
}
- DlgParam->splitterPosNew = (int)DBGetContactSettingDword(hContact, LINKLIST_MODULE, LINKLIST_SPLITPOS, -1);
+ DlgParam->splitterPosNew = (int)db_get_dw(hContact, LINKLIST_MODULE, LINKLIST_SPLITPOS, -1);
GetWindowRect(GetDlgItem(hDlg, IDC_MAIN), &rc);
DlgParam->minSize.cx = rc.right - rc.left;
@@ -122,7 +122,7 @@ INT_PTR WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) pENLink = (ENLINK*)lpNmhdr;
- mouseEvent = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
+ mouseEvent = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
if ( pENLink->msg == WM_MOUSEMOVE && mouseEvent == 0x01 )
{
@@ -140,7 +140,7 @@ INT_PTR WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL);
else
{
- openNewWindow = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF);
+ openNewWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF);
if ( openNewWindow == 0xFF )
openNewWindow = 0;
@@ -156,7 +156,7 @@ INT_PTR WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) hSubMenu = GetSubMenu(hPopup, 0);
// Disable Menuoption if "mouse over" events are active
- mouseEvent = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
+ mouseEvent = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
if (mouseEvent == 0x01 )
EnableMenuItem(hSubMenu, IDM_SHOWMESSAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
@@ -442,12 +442,12 @@ INT_PTR WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) case WM_DESTROY:
{
HANDLE hContact;
- if ( DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00) == 0x00 )
+ if ( db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00) == 0x00 )
hContact = NULL;
else
hContact = DlgParam->hContact;
Utils_SaveWindowPosition(hDlg, hContact, LINKLIST_MODULE, "Linklist");
- DBWriteContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_SPLITPOS, DlgParam->splitterPosNew);
+ db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_SPLITPOS, DlgParam->splitterPosNew);
RemoveList(DlgParam->listStart);
free(DlgParam);
// Remove entry from Window list
@@ -548,7 +548,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l case WM_INITDIALOG:
{
TranslateDialogDefault(hDlg);
- useDefault = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0xFF);
+ useDefault = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0xFF);
if ( useDefault == 0x01 )
{
mCol = GetMirandaColour(&colourSet);
@@ -838,7 +838,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l options.showTime = 1;
WriteOptionExample(hDlg, colourSet.incoming, colourSet.outgoing, colourSet.background, colourSet.text, &options);
- //DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0x01);
+ //db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0x01);
WriteOptionExample(hDlg, colourSet.incoming, colourSet.outgoing, colourSet.background, colourSet.text, &options);
break;
@@ -853,7 +853,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l options.showDirection = 1;
WriteOptionExample(hDlg, colourSet.incoming, colourSet.outgoing, colourSet.background, colourSet.text, &options);
- //DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0x01);
+ //db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0x01);
WriteOptionExample(hDlg, colourSet.incoming, colourSet.outgoing, colourSet.background, colourSet.text, &options);
break;
@@ -868,7 +868,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l options.showType = 1;
WriteOptionExample(hDlg, colourSet.incoming, colourSet.outgoing, colourSet.background, colourSet.text, &options);
- //DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0x01);
+ //db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0x01);
WriteOptionExample(hDlg, colourSet.incoming, colourSet.outgoing, colourSet.background, colourSet.text, &options);
break;
@@ -882,10 +882,10 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l {
// Write Settings to Database
if ( SendDlgItemMessage(hDlg, IDC_CHECK1, BM_GETCHECK, 0, 0) == BST_CHECKED )
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x01);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x01);
else
{
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
colourSet.incoming = SendDlgItemMessage(hDlg, IDC_INCOMING, CPM_GETCOLOUR, 0, 0);
colourSet.outgoing = SendDlgItemMessage(hDlg, IDC_OUTGOING, CPM_GETCOLOUR, 0, 0);
colourSet.background = SendDlgItemMessage(hDlg, IDC_BACKGROUND, CPM_GETCOLOUR, 0, 0);
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index bc5c5abe61..3e12ced1ef 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -842,77 +842,77 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz void GetListOptions(LISTOPTIONS *options)
{
- options->openNewWindow = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF);
+ options->openNewWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF);
if(options->openNewWindow == 0xFF)
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0x00);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0x00);
options->openNewWindow = 0x00;
}
- options->updateWindow = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
+ options->updateWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
if(options->updateWindow == 0xFF)
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
options->updateWindow = 0x00;
}
- options->mouseEvent = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
+ options->mouseEvent = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
if(options->mouseEvent == 0xFF)
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0x00);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0x00);
options->mouseEvent = 0x00;
}
- options->saveSpecial = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0xFF);
+ options->saveSpecial = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0xFF);
if(options->saveSpecial == 0xFF)
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00);
options->saveSpecial = 0x00;
}
- options->showDate = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0xFF);
+ options->showDate = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0xFF);
if(options->showDate == 0xFF)
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0x01);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0x01);
options->showDate = 0x01;
}
- options->showLine = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0xFF);
+ options->showLine = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0xFF);
if(options->showLine == 0xFF)
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0x01);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0x01);
options->showLine = 0x01;
}
- options->showTime = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0xFF);
+ options->showTime = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0xFF);
if(options->showTime == 0xFF)
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0x01);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0x01);
options->showTime = 0x01;
}
- options->showDirection = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0xFF);
+ options->showDirection = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0xFF);
if(options->showDirection == 0xFF)
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0x01);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0x01);
options->showDirection = 0x01;
}
- options->showType = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0xFF);
+ options->showType = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0xFF);
if(options->showType == 0xFF)
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0x01);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0x01);
options->showType = 0x01;
}
@@ -921,15 +921,15 @@ void GetListOptions(LISTOPTIONS *options) void SetListOptions(LISTOPTIONS *options)
{
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, options->openNewWindow);
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, options->updateWindow);
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, options->mouseEvent);
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, options->saveSpecial);
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, options->showDate);
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, options->showLine);
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, options->showTime);
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, options->showDirection);
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, options->showType);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, options->openNewWindow);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, options->updateWindow);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, options->mouseEvent);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, options->saveSpecial);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, options->showDate);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, options->showLine);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, options->showTime);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, options->showDirection);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, options->showType);
}
/*
@@ -977,11 +977,11 @@ void GetColour(MYCOLOURSET *colourSet) DWORD colour;
BYTE useDefault;
- useDefault = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0xFF);
+ useDefault = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0xFF);
if ( useDefault == 0xFF )
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x01);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x01);
useDefault = 0x01;
}
@@ -990,51 +990,51 @@ void GetColour(MYCOLOURSET *colourSet) // Use Miranda-IM Default colours
// CHANGED AT MIRANDA 0.4!!!!
// Use SRMM... if it is not there try SRMsg (older Miranda Versions)
- colour = DBGetContactSettingDword(NULL, "SRMM", "SRMFont1Col", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMM", "SRMFont1Col", 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->incoming = colour;
else
{
- colour = DBGetContactSettingDword(NULL, "SRMsg", "Font3Col", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMsg", "Font3Col", 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->incoming = colour;
else
{
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
useDefault = 0x00;
}
}
// SRMM
- colour = DBGetContactSettingDword(NULL, "SRMM", "SRMFont0Col", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMM", "SRMFont0Col", 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->outgoing = colour;
else
{
// SRMsg
- colour = DBGetContactSettingDword(NULL, "SRMsg", "Font0Col", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMsg", "Font0Col", 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->outgoing = colour;
else
{
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
useDefault = 0x00;
}
}
// SRMM
- colour = DBGetContactSettingDword(NULL, "SRMM", "BkgColour", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMM", "BkgColour", 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->background = colour;
else
{
// SRMsg
- colour = DBGetContactSettingDword(NULL, "SRMsg", "BkgColour", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMsg", "BkgColour", 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->background = colour;
else
{
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
useDefault = 0x00;
}
}
@@ -1044,25 +1044,25 @@ void GetColour(MYCOLOURSET *colourSet) if ( useDefault == 0x00 )
{
// Use Plugin user defined or default colours
- colour = DBGetContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
+ colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->incoming = colour;
else
colourSet->incoming = IN_COL_DEF;
- colour = DBGetContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
+ colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->outgoing = colour;
else
colourSet->outgoing = OUT_COL_DEF;
- colour = DBGetContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
+ colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->background = colour;
else
colourSet->background = BG_COL_DEF;
- colour = DBGetContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
+ colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
if ( colour != 0xFF000000 )
colourSet->text = colour;
else
@@ -1079,39 +1079,39 @@ void GetDBColour(MYCOLOURSET *colourSet) DWORD colour;
// Use Plugin user defined or default colours
- colour = DBGetContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
+ colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
if(colour != 0xFF000000)
colourSet->incoming = colour;
else
{
- DBWriteContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, IN_COL_DEF);
+ db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, IN_COL_DEF);
colourSet->incoming = IN_COL_DEF;
}
- colour = DBGetContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
+ colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
if(colour != 0xFF000000)
colourSet->outgoing = colour;
else
{
- DBWriteContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, OUT_COL_DEF);
+ db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, OUT_COL_DEF);
colourSet->outgoing = OUT_COL_DEF;
}
- colour = DBGetContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
+ colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
if(colour != 0xFF000000)
colourSet->background = colour;
else
{
- DBWriteContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, BG_COL_DEF);
+ db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, BG_COL_DEF);
colourSet->background = BG_COL_DEF;
}
- colour = DBGetContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
+ colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
if(colour != 0xFF000000)
colourSet->text = colour;
else
{
- DBWriteContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, TXT_COL_DEF);
+ db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, TXT_COL_DEF);
colourSet->text = TXT_COL_DEF;
}
}
@@ -1125,12 +1125,12 @@ int GetMirandaColour(MYCOLOURSET *colourSet) // Use Miranda-IM Default colours
// Try SRMM (Miranda 0.4) .... or SRMsg... for older versions
- colour = DBGetContactSettingDword(NULL, "SRMM", "SRMFont1Col", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMM", "SRMFont1Col", 0xFF000000);
if(colour != 0xFF000000)
colourSet->incoming = colour;
else
{
- colour = DBGetContactSettingDword(NULL, "SRMsg", "Font3Col", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMsg", "Font3Col", 0xFF000000);
if(colour != 0xFF000000)
colourSet->incoming = colour;
else
@@ -1138,24 +1138,24 @@ int GetMirandaColour(MYCOLOURSET *colourSet) }
- colour = DBGetContactSettingDword(NULL, "SRMM", "SRMFont0Col", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMM", "SRMFont0Col", 0xFF000000);
if(colour != 0xFF000000)
colourSet->outgoing = colour;
else
{
- colour = DBGetContactSettingDword(NULL, "SRMsg", "Font0Col", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMsg", "Font0Col", 0xFF000000);
if(colour != 0xFF000000)
colourSet->outgoing = colour;
else
return 1;
}
- colour = DBGetContactSettingDword(NULL, "SRMM", "BkgColour", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMM", "BkgColour", 0xFF000000);
if(colour != 0xFF000000)
colourSet->background = colour;
else
{
- colour = DBGetContactSettingDword(NULL, "SRMsg", "BkgColour", 0xFF000000);
+ colour = db_get_dw(NULL, "SRMsg", "BkgColour", 0xFF000000);
if(colour != 0xFF000000)
colourSet->background = colour;
else
@@ -1172,21 +1172,21 @@ Write user defined colours to the database */
void SetDBColour(MYCOLOURSET *colourSet)
{
- DBWriteContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, colourSet->incoming);
- DBWriteContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, colourSet->outgoing);
- DBWriteContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, colourSet->background);
- DBWriteContactSettingDword(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, colourSet->text);
+ db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, colourSet->incoming);
+ db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, colourSet->outgoing);
+ db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, colourSet->background);
+ db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, colourSet->text);
}
BYTE GetUpdateSetting(void)
{
BYTE updateWindow;
- updateWindow = DBGetContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
+ updateWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
if ( updateWindow == 0xFF )
{
// No DB entry for this Plugin
- DBWriteContactSettingByte(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
+ db_set_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
return 0;
}
if ( updateWindow == 0x00 )
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 8783aafa34..70be70347b 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -132,7 +132,7 @@ static void GetBookmarks(HANDLE hContact, BEventData** books, size_t* bookcnt ) mir_free(tbooks);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -141,15 +141,15 @@ void SweepHistoryFromContact(HANDLE hContact, CriteriaStruct Criteria, BOOL keep {
int lPolicy;
if (hContact == NULL) // for system history
- lPolicy = DBGetContactSettingByte(NULL, ModuleName, "SweepSHistory", 0);
+ lPolicy = db_get_b(NULL, ModuleName, "SweepSHistory", 0);
else // for contact history (or "SweepHistory" - default action)
- lPolicy = DBGetContactSettingByte(hContact, ModuleName, "SweepHistory", DBGetContactSettingByte(NULL, ModuleName, "SweepHistory", 0));
+ lPolicy = db_get_b(hContact, ModuleName, "SweepHistory", db_get_b(NULL, ModuleName, "SweepHistory", 0));
if (lPolicy == 0) return; // nothing to do
int eventsCnt = db_event_count(hContact);
if (eventsCnt != 0) {
- BOOL doDelete, unsafe = DBGetContactSettingByte(NULL, ModuleName, "UnsafeMode", 0);
+ BOOL doDelete, unsafe = db_get_b(NULL, ModuleName, "UnsafeMode", 0);
BEventData *books, *item, ev = { 0 };
size_t bookcnt, btshift;
@@ -211,8 +211,8 @@ void ShutdownAction(void) CriteriaStruct Criteria;
HANDLE hContact = db_find_first();
- Criteria.keep = KeepCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0));
- Criteria.time = BuildCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0));
+ Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0));
+ Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0));
SweepHistoryFromContact(NULL, Criteria, FALSE); // sweep system history, keepunread==0
@@ -228,12 +228,12 @@ int OnWindowEvent(WPARAM wParam, LPARAM lParam) {
MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam;
- if (msgEvData->uType == MSG_WINDOW_EVT_CLOSE && DBGetContactSettingByte(NULL, ModuleName, "SweepOnClose", 0))
+ if (msgEvData->uType == MSG_WINDOW_EVT_CLOSE && db_get_b(NULL, ModuleName, "SweepOnClose", 0))
{
CriteriaStruct Criteria;
- Criteria.keep = KeepCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0));
- Criteria.time = BuildCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0));
+ Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0));
+ Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0));
SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE);
}
diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index 6f1133dbea..3508a6b8dc 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -52,7 +52,7 @@ int OnIconPressed(WPARAM wParam, LPARAM lParam) StatusIconClickData *sicd = (StatusIconClickData *)lParam;
if ( !(sicd->flags & MBCF_RIGHTBUTTON) && !lstrcmpA(sicd->szModule, ModuleName)
- && DBGetContactSettingByte(NULL, ModuleName, "ChangeInMW", 0))
+ && db_get_b(NULL, ModuleName, "ChangeInMW", 0))
{
int nh = sicd->dwId; HANDLE hContact = (HANDLE)wParam; StatusIconData sid = {0};
@@ -63,7 +63,7 @@ int OnIconPressed(WPARAM wParam, LPARAM lParam) CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid);
nh = (nh + 1) % 4;
- DBWriteContactSettingByte((HANDLE)wParam, ModuleName, "SweepHistory", (BYTE)nh);
+ db_set_b((HANDLE)wParam, ModuleName, "SweepHistory", (BYTE)nh);
sid.dwId = nh;
sid.flags = 0;
@@ -76,7 +76,7 @@ int OnIconPressed(WPARAM wParam, LPARAM lParam) int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
StatusIconData sid = {0};
- int i, sweep = DBGetContactSettingByte(NULL, ModuleName, "SweepHistory", 0);
+ int i, sweep = db_get_b(NULL, ModuleName, "SweepHistory", 0);
HANDLE hContact = db_find_first();
sid.cbSize = sizeof(sid);
@@ -87,11 +87,11 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) sid.szTooltip = Translate("Keep all events");
else if (sweep == 1)
{
- sid.szTooltip = Translate(time_stamp_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0)]);
+ sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
}
else if (sweep == 2)
{
- sid.szTooltip = Translate(keep_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
}
else if (sweep == 3)
{
@@ -102,13 +102,13 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) sid.dwId = 1;
sid.hIcon = LoadIconEx("act1");
- sid.szTooltip = Translate(time_stamp_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0)]);
+ sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
sid.flags = MBF_HIDDEN;
CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
sid.dwId = 2;
sid.hIcon = LoadIconEx("act2");
- sid.szTooltip = Translate(keep_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
sid.flags = MBF_HIDDEN;
CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
@@ -123,7 +123,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
ZeroMemory(&sid,sizeof(sid));
- sweep = DBGetContactSettingByte(hContact, ModuleName, "SweepHistory", 0);
+ sweep = db_get_b(hContact, ModuleName, "SweepHistory", 0);
sid.cbSize = sizeof(sid);
sid.szModule = ModuleName;
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index 2d13aefd7f..d77d4946f9 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -105,16 +105,16 @@ static void ShowAllContactIcons(HWND hwndList) HANDLE hContact, hItem;
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hAllContacts,
- MAKELPARAM(0, DBGetContactSettingByte(NULL, ModuleName, "SweepHistory", 0)));
+ MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepHistory", 0)));
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hSystemHistory,
- MAKELPARAM(0, DBGetContactSettingByte(NULL, ModuleName, "SweepSHistory", 0)));
+ MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepSHistory", 0)));
for (hContact=db_find_first(); hContact;
hContact=db_find_next(hContact))
{
hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem,
- MAKELPARAM(0, DBGetContactSettingByte(hContact, ModuleName, "SweepHistory", 0)));
+ MAKELPARAM(0, db_get_b(hContact, ModuleName, "SweepHistory", 0)));
}
}//ShowAllContactIcons
@@ -150,12 +150,12 @@ void LoadSettings(HWND hwndDlg) mir_free(ptszTimeStr);
}
- SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_SETCURSEL, DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0), 0);
- SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_SETCURSEL, DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0), 0);
+ SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_SETCURSEL, db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0), 0);
+ SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_SETCURSEL, db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0), 0);
- CheckDlgButton(hwndDlg, IDC_UNSAFEMODE, DBGetContactSettingByte(NULL, ModuleName, "UnsafeMode", 0));
- CheckDlgButton(hwndDlg, IDC_SWEEPONCLOSE, DBGetContactSettingByte(NULL, ModuleName, "SweepOnClose", 0));
- CheckDlgButton(hwndDlg, IDC_HISTMW, DBGetContactSettingByte(NULL, ModuleName, "ChangeInMW", 0));
+ CheckDlgButton(hwndDlg, IDC_UNSAFEMODE, db_get_b(NULL, ModuleName, "UnsafeMode", 0));
+ CheckDlgButton(hwndDlg, IDC_SWEEPONCLOSE, db_get_b(NULL, ModuleName, "SweepOnClose", 0));
+ CheckDlgButton(hwndDlg, IDC_HISTMW, db_get_b(NULL, ModuleName, "ChangeInMW", 0));
}//LoadSettings
@@ -163,18 +163,18 @@ void SaveSettings(HWND hwndDlg) {
int st, i; StatusIconData sid = {0}; HANDLE hContact, hItem; HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
- DBWriteContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingByte(NULL, ModuleName, "UnsafeMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UNSAFEMODE));
- DBWriteContactSettingByte(NULL, ModuleName, "SweepOnClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SWEEPONCLOSE));
- DBWriteContactSettingByte(NULL, ModuleName, "ChangeInMW", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HISTMW));
+ db_set_b(NULL, ModuleName, "StartupShutdownOlder", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, ModuleName, "StartupShutdownKeep", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, ModuleName, "UnsafeMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UNSAFEMODE));
+ db_set_b(NULL, ModuleName, "SweepOnClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SWEEPONCLOSE));
+ db_set_b(NULL, ModuleName, "ChangeInMW", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HISTMW));
sid.cbSize = sizeof(sid);
sid.szModule = ModuleName;
- DBWriteContactSettingByte(NULL, ModuleName, "SweepHistory",
+ db_set_b(NULL, ModuleName, "SweepHistory",
(BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hAllContacts, 0));
- DBWriteContactSettingByte(NULL, ModuleName, "SweepSHistory",
+ db_set_b(NULL, ModuleName, "SweepSHistory",
(BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hSystemHistory, 0));
for (hContact=db_find_first(); hContact;
@@ -183,8 +183,8 @@ void SaveSettings(HWND hwndDlg) hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
st = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, 0);
- if ( st != 0 ) DBWriteContactSettingByte(hContact, ModuleName, "SweepHistory", (BYTE)st);
- else DBDeleteContactSetting(hContact, ModuleName, "SweepHistory");
+ if ( st != 0 ) db_set_b(hContact, ModuleName, "SweepHistory", (BYTE)st);
+ else db_unset(hContact, ModuleName, "SweepHistory");
// set per-contact icons in status bar
for(i = 0; i < 4; i++)
@@ -196,21 +196,21 @@ void SaveSettings(HWND hwndDlg) }
// set tooltips
- st = DBGetContactSettingByte(NULL, ModuleName, "SweepHistory", 0);
+ st = db_get_b(NULL, ModuleName, "SweepHistory", 0);
sid.dwId = 0;
if (st == 0) sid.szTooltip = Translate("Keep all events");
- else if (st == 1) sid.szTooltip = Translate(time_stamp_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0)]);
- else if (st == 2) sid.szTooltip = Translate(keep_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ else if (st == 1) sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
+ else if (st == 2) sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
else if (st == 3) sid.szTooltip = Translate("Delete all events");
CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid);
sid.dwId = 1;
- sid.szTooltip = Translate(time_stamp_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0)]);
+ sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid);
sid.dwId = 2;
- sid.szTooltip = Translate(keep_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid);
}//SaveSettings
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index 636f070464..ff441a8642 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -49,33 +49,33 @@ void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) { DBVARIANT dbv;
if (colour) {
wsprintfA(str, "Font%dCol", i);
- *colour = DBGetContactSettingDword(NULL, CHATFONTMOD, str, 0x000000);
+ *colour = db_get_dw(NULL, CHATFONTMOD, str, 0x000000);
}
if (lf) {
wsprintfA(str, "Font%dSize", i);
- lf->lfHeight = (char) DBGetContactSettingByte(NULL, CHATFONTMOD, str, 10);
+ lf->lfHeight = (char) db_get_b(NULL, CHATFONTMOD, str, 10);
lf->lfHeight = abs(lf->lfHeight);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
wsprintfA(str, "Font%dSty", i);
- style = DBGetContactSettingByte(NULL, CHATFONTMOD, str, 0);
+ style = db_get_b(NULL, CHATFONTMOD, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
wsprintfA(str, "Font%dSet", i);
- lf->lfCharSet = DBGetContactSettingByte(NULL, CHATFONTMOD, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(NULL, CHATFONTMOD, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
wsprintfA(str, "Font%d", i);
- if (DBGetContactSetting(NULL, CHATFONTMOD, str, &dbv))
+ if (db_get(NULL, CHATFONTMOD, str, &dbv))
lstrcpyA(lf->lfFaceName, "Verdana");
else {
lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -115,7 +115,7 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { ReleaseDC(NULL, hdc);
Utils::appendText(&output, &outputSize, "<html><head>");
Utils::appendText(&output, &outputSize, "<style type=\"text/css\">\n");
- COLORREF bkgColor = DBGetContactSettingDword(NULL, CHATMOD, "BackgroundLog", 0xFFFFFF);
+ COLORREF bkgColor = db_get_dw(NULL, CHATMOD, "BackgroundLog", 0xFFFFFF);
COLORREF inColor, outColor;
bkgColor= (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
inColor = outColor = bkgColor;
@@ -159,7 +159,7 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { */
void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
- DWORD iconFlags = DBGetContactSettingDword(NULL, CHATMOD, CHAT_ICON_FLAGS, 0);
+ DWORD iconFlags = db_get_dw(NULL, CHATMOD, CHAT_ICON_FLAGS, 0);
IEVIEWEVENTDATA* eventData = event->eventData;
for (int eventIdx = 0; eventData!=NULL && (eventIdx < event->count || event->count==-1); eventData = eventData->next, eventIdx++) {
//DWORD dwFlags = eventData->dwFlags;
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index 129941cf5c..bb75c2434f 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -101,38 +101,38 @@ void HistoryHTMLBuilder::loadMsgDlgFont(const char *dbSetting, LOGFONTA * lf, CO DBVARIANT dbv;
if (bkgColour) {
wsprintfA(str, "Back.%s", dbSetting);
- *bkgColour = DBGetContactSettingDword(NULL, HPPMOD, str, 0xFFFFFF);
+ *bkgColour = db_get_dw(NULL, HPPMOD, str, 0xFFFFFF);
}
if (colour) {
wsprintfA(str, "Font.%s.Color", dbSetting);
- *colour = DBGetContactSettingDword(NULL, HPPMOD, str, 0x000000);
+ *colour = db_get_dw(NULL, HPPMOD, str, 0x000000);
}
if (lf) {
wsprintfA(str, "Font.%s.Size", dbSetting);
- lf->lfHeight = (char) DBGetContactSettingByte(NULL, HPPMOD, str, 10);
+ lf->lfHeight = (char) db_get_b(NULL, HPPMOD, str, 10);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
wsprintfA(str, "Font.%s.Style.Bold", dbSetting);
- style = DBGetContactSettingByte(NULL, HPPMOD, str, 0);
+ style = db_get_b(NULL, HPPMOD, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
wsprintfA(str, "Font.%s.Style.Italic", dbSetting);
- style = DBGetContactSettingByte(NULL, HPPMOD, str, 0) << 1;
+ style = db_get_b(NULL, HPPMOD, str, 0) << 1;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
wsprintfA(str, "Font.%s.Charset", dbSetting);
- lf->lfCharSet = DBGetContactSettingByte(NULL, HPPMOD, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(NULL, HPPMOD, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
wsprintfA(str, "Font.%s.Name", dbSetting);
- if (DBGetContactSetting(NULL, HPPMOD, str, &dbv))
+ if (db_get(NULL, HPPMOD, str, &dbv))
lstrcpyA(lf->lfFaceName, "Verdana");
else {
lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -165,7 +165,7 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { } else {
Utils::appendText(&output, &outputSize, "<html><head>");
Utils::appendText(&output, &outputSize, "<style type=\"text/css\">\n");
- COLORREF lineColor = DBGetContactSettingDword(NULL, HPPMOD, "LineColour", 0xFFFFFF);
+ COLORREF lineColor = db_get_dw(NULL, HPPMOD, "LineColour", 0xFFFFFF);
lineColor= 0;//(((lineColor & 0xFF) << 16) | (lineColor & 0xFF00) | ((lineColor & 0xFF0000) >> 16));
bkgColor = 0xFFFFFF;
if (protoSettings->getHistoryFlags() & Options::LOG_IMAGE_ENABLED) {
@@ -222,7 +222,7 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
- DWORD dwFlags = DBGetContactSettingByte(NULL, HPPMOD, SRMSGSET_SHOWICONS, 0) ? SMF_LOG_SHOWICONS : 0;
+ DWORD dwFlags = db_get_b(NULL, HPPMOD, SRMSGSET_SHOWICONS, 0) ? SMF_LOG_SHOWICONS : 0;
char *szRealProto = getRealProto(event->hContact);
IEVIEWEVENTDATA* eventData = event->eventData;
for (int eventIdx = 0; eventData!=NULL && (eventIdx < event->count || event->count==-1); eventData = eventData->next, eventIdx++) {
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index 962fb44b5a..6787de8e11 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -45,33 +45,33 @@ void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) { DBVARIANT dbv;
if (colour) {
wsprintfA(str, "Font%dCol", i);
- *colour = DBGetContactSettingDword(NULL, MUCCMOD, str, 0x000000);
+ *colour = db_get_dw(NULL, MUCCMOD, str, 0x000000);
}
if (lf) {
wsprintfA(str, "Font%dSize", i);
- lf->lfHeight = (char) DBGetContactSettingByte(NULL, MUCCMOD, str, 10);
+ lf->lfHeight = (char) db_get_b(NULL, MUCCMOD, str, 10);
lf->lfHeight = abs(lf->lfHeight);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
wsprintfA(str, "Font%dStyle", i);
- style = DBGetContactSettingByte(NULL, MUCCMOD, str, 0);
+ style = db_get_b(NULL, MUCCMOD, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
wsprintfA(str, "Font%dSet", i);
- lf->lfCharSet = DBGetContactSettingByte(NULL, MUCCMOD, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(NULL, MUCCMOD, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
wsprintfA(str, "Font%dFace", i);
- if (DBGetContactSetting(NULL, MUCCMOD, str, &dbv))
+ if (db_get(NULL, MUCCMOD, str, &dbv))
lstrcpyA(lf->lfFaceName, "Verdana");
else {
lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -137,7 +137,7 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { ReleaseDC(NULL, hdc);
Utils::appendText(&output, &outputSize, "<html><head>");
Utils::appendText(&output, &outputSize, "<style type=\"text/css\">\n");
- COLORREF bkgColor = DBGetContactSettingDword(NULL, MUCCMOD, "BackgroundLog", 0xFFFFFF);
+ COLORREF bkgColor = db_get_dw(NULL, MUCCMOD, "BackgroundLog", 0xFFFFFF);
COLORREF inColor, outColor;
bkgColor= (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
inColor = outColor = bkgColor;
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index 278659d502..d8e34f7c87 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -1506,7 +1506,7 @@ void Options::init() { }
- generalFlags = DBGetContactSettingDword(NULL, ieviewModuleName, DBS_BASICFLAGS, 13);
+ generalFlags = db_get_dw(NULL, ieviewModuleName, DBS_BASICFLAGS, 13);
/* TODO: move to buildProtocolList method */
int protoCount;
@@ -1530,101 +1530,101 @@ void Options::init() { }
/* SRMM settings */
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
- proto->setSRMMEnable(i==0 ? true : DBGetContactSettingByte(NULL, ieviewModuleName, dbsName, FALSE));
+ proto->setSRMMEnable(i==0 ? true : db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
- proto->setSRMMMode(DBGetContactSettingByte(NULL, ieviewModuleName, dbsName, FALSE));
+ proto->setSRMMMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
- proto->setSRMMFlags(DBGetContactSettingDword(NULL, ieviewModuleName, dbsName, 16128));
+ proto->setSRMMFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128));
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
- if (!DBGetContactSetting(NULL, ieviewModuleName, dbsName, &dbv)) {
+ if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
PathToAbsolute(dbv.pszVal, tmpPath);
proto->setSRMMBackgroundFilename(tmpPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
- if (!DBGetContactSetting(NULL, ieviewModuleName, dbsName, &dbv)) {
+ if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
PathToAbsolute(dbv.pszVal, tmpPath);
proto->setSRMMCssFilename(tmpPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
- if (!DBGetContactSetting(NULL, ieviewModuleName, dbsName, &dbv)) {
+ if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
PathToAbsolute(dbv.pszVal, tmpPath);
proto->setSRMMTemplateFilename(tmpPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
/* Group chat settings */
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
- proto->setChatEnable(i==0 ? true : DBGetContactSettingByte(NULL, ieviewModuleName, dbsName, FALSE));
+ proto->setChatEnable(i==0 ? true : db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
- proto->setChatMode(DBGetContactSettingByte(NULL, ieviewModuleName, dbsName, FALSE));
+ proto->setChatMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
- proto->setChatFlags(DBGetContactSettingDword(NULL, ieviewModuleName, dbsName, 16128));
+ proto->setChatFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128));
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
- if (!DBGetContactSetting(NULL, ieviewModuleName, dbsName, &dbv)) {
+ if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
PathToAbsolute(dbv.pszVal, tmpPath);
proto->setChatBackgroundFilename(tmpPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
- if (!DBGetContactSetting(NULL, ieviewModuleName, dbsName, &dbv)) {
+ if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
PathToAbsolute(dbv.pszVal, tmpPath);
proto->setChatCssFilename(tmpPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
- if (!DBGetContactSetting(NULL, ieviewModuleName, dbsName, &dbv)) {
+ if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
PathToAbsolute(dbv.pszVal, tmpPath);
proto->setChatTemplateFilename(tmpPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
/* History settings */
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
- proto->setHistoryEnable(i==0 ? true : DBGetContactSettingByte(NULL, ieviewModuleName, dbsName, FALSE));
+ proto->setHistoryEnable(i==0 ? true : db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
- proto->setHistoryMode(DBGetContactSettingByte(NULL, ieviewModuleName, dbsName, FALSE));
+ proto->setHistoryMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
- proto->setHistoryFlags(DBGetContactSettingDword(NULL, ieviewModuleName, dbsName, 16128));
+ proto->setHistoryFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128));
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
- if (!DBGetContactSetting(NULL, ieviewModuleName, dbsName, &dbv)) {
+ if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
PathToAbsolute(dbv.pszVal, tmpPath);
proto->setHistoryBackgroundFilename(tmpPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
- if (!DBGetContactSetting(NULL, ieviewModuleName, dbsName, &dbv)) {
+ if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
PathToAbsolute(dbv.pszVal, tmpPath);
proto->setHistoryCssFilename(tmpPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
- if (!DBGetContactSetting(NULL, ieviewModuleName, dbsName, &dbv)) {
+ if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
PathToAbsolute(dbv.pszVal, tmpPath);
proto->setHistoryTemplateFilename(tmpPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
proto->copyToTemp();
if (lastProto != NULL) {
@@ -1662,7 +1662,7 @@ void Options::uninit() { void Options::setGeneralFlags(int flags) {
generalFlags = flags;
- DBWriteContactSettingDword(NULL, ieviewModuleName, DBS_BASICFLAGS, (DWORD) flags);
+ db_set_dw(NULL, ieviewModuleName, DBS_BASICFLAGS, (DWORD) flags);
}
int Options::getGeneralFlags() {
@@ -1670,11 +1670,11 @@ int Options::getGeneralFlags() { }
void Options::setEmbedsize(int size){
- DBWriteContactSettingDword(NULL, ieviewModuleName, "Embedsize", (DWORD) size);
+ db_set_dw(NULL, ieviewModuleName, "Embedsize", (DWORD) size);
}
int Options::getEmbedsize() {
- return DBGetContactSettingDword(NULL, ieviewModuleName, "Embedsize", 0);
+ return db_get_dw(NULL, ieviewModuleName, "Embedsize", 0);
}
bool Options::isMathModule() {
@@ -1717,68 +1717,68 @@ void Options::saveProtocolSettings() { proto->copyFromTemp();
/* SRMM settings */
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
- DBWriteContactSettingByte(NULL, ieviewModuleName, dbsName, proto->isSRMMEnable());
+ db_set_b(NULL, ieviewModuleName, dbsName, proto->isSRMMEnable());
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
- DBWriteContactSettingByte(NULL, ieviewModuleName, dbsName, proto->getSRMMMode());
+ db_set_b(NULL, ieviewModuleName, dbsName, proto->getSRMMMode());
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
- DBWriteContactSettingDword(NULL, ieviewModuleName, dbsName, proto->getSRMMFlags());
+ db_set_dw(NULL, ieviewModuleName, dbsName, proto->getSRMMFlags());
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
strcpy(tmpPath, proto->getSRMMBackgroundFilename());
PathToRelative(proto->getSRMMBackgroundFilename(), tmpPath);
- DBWriteContactSettingString(NULL, ieviewModuleName, dbsName, tmpPath);
+ db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
strcpy (tmpPath, proto->getSRMMCssFilename());
PathToRelative(proto->getSRMMCssFilename(), tmpPath);
- DBWriteContactSettingString(NULL, ieviewModuleName, dbsName, tmpPath);
+ db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
strcpy (tmpPath, proto->getSRMMTemplateFilename());
PathToRelative(proto->getSRMMTemplateFilename(), tmpPath);
- DBWriteContactSettingString(NULL, ieviewModuleName, dbsName, tmpPath);
+ db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
/* Group Chat settings */
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
- DBWriteContactSettingByte(NULL, ieviewModuleName, dbsName, proto->isChatEnable());
+ db_set_b(NULL, ieviewModuleName, dbsName, proto->isChatEnable());
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
- DBWriteContactSettingByte(NULL, ieviewModuleName, dbsName, proto->getChatMode());
+ db_set_b(NULL, ieviewModuleName, dbsName, proto->getChatMode());
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
- DBWriteContactSettingDword(NULL, ieviewModuleName, dbsName, proto->getChatFlags());
+ db_set_dw(NULL, ieviewModuleName, dbsName, proto->getChatFlags());
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
strcpy (tmpPath, proto->getChatBackgroundFilename());
PathToRelative(proto->getChatBackgroundFilename(), tmpPath);
- DBWriteContactSettingString(NULL, ieviewModuleName, dbsName, tmpPath);
+ db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
strcpy (tmpPath, proto->getChatCssFilename());
PathToRelative(proto->getChatCssFilename(), tmpPath);
- DBWriteContactSettingString(NULL, ieviewModuleName, dbsName, tmpPath);
+ db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
strcpy (tmpPath, proto->getChatTemplateFilename());
PathToRelative(proto->getChatTemplateFilename(), tmpPath);
- DBWriteContactSettingString(NULL, ieviewModuleName, dbsName, tmpPath);
+ db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
/* History settings */
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
- DBWriteContactSettingByte(NULL, ieviewModuleName, dbsName, proto->isHistoryEnable());
+ db_set_b(NULL, ieviewModuleName, dbsName, proto->isHistoryEnable());
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
- DBWriteContactSettingByte(NULL, ieviewModuleName, dbsName, proto->getHistoryMode());
+ db_set_b(NULL, ieviewModuleName, dbsName, proto->getHistoryMode());
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
- DBWriteContactSettingDword(NULL, ieviewModuleName, dbsName, proto->getHistoryFlags());
+ db_set_dw(NULL, ieviewModuleName, dbsName, proto->getHistoryFlags());
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
strcpy (tmpPath, proto->getHistoryBackgroundFilename());
PathToRelative(proto->getHistoryBackgroundFilename(), tmpPath);
- DBWriteContactSettingString(NULL, ieviewModuleName, dbsName, tmpPath);
+ db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
strcpy (tmpPath, proto->getHistoryCssFilename());
PathToRelative(proto->getHistoryCssFilename(), tmpPath);
- DBWriteContactSettingString(NULL, ieviewModuleName, dbsName, tmpPath);
+ db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
strcpy (tmpPath, proto->getHistoryTemplateFilename());
PathToRelative(proto->getHistoryTemplateFilename(), tmpPath);
- DBWriteContactSettingString(NULL, ieviewModuleName, dbsName, tmpPath);
+ db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
}
}
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index 8d43424b26..666ea3fb74 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -89,33 +89,33 @@ void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) DBVARIANT dbv;
if (colour) {
wsprintfA(str, "SRMFont%dCol", i);
- *colour = DBGetContactSettingDword(NULL, SRMMMOD, str, 0x000000);
+ *colour = db_get_dw(NULL, SRMMMOD, str, 0x000000);
}
if (lf) {
wsprintfA(str, "SRMFont%dSize", i);
- lf->lfHeight = (char) DBGetContactSettingByte(NULL, SRMMMOD, str, 10);
+ lf->lfHeight = (char) db_get_b(NULL, SRMMMOD, str, 10);
lf->lfHeight = abs(lf->lfHeight);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
wsprintfA(str, "SRMFont%dSty", i);
- style = DBGetContactSettingByte(NULL, SRMMMOD, str, 0);
+ style = db_get_b(NULL, SRMMMOD, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
wsprintfA(str, "SRMFont%dSet", i);
- lf->lfCharSet = DBGetContactSettingByte(NULL, SRMMMOD, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
wsprintfA(str, "SRMFont%d", i);
- if (DBGetContactSetting(NULL, SRMMMOD, str, &dbv))
+ if (db_get(NULL, SRMMMOD, str, &dbv))
lstrcpyA(lf->lfFaceName, "Verdana");
else {
lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -204,10 +204,10 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { ReleaseDC(NULL, hdc);
Utils::appendText(&output, &outputSize, "<html><head>");
Utils::appendText(&output, &outputSize, "<style type=\"text/css\">\n");
- COLORREF bkgColor = DBGetContactSettingDword(NULL, SRMMMOD, "BkgColour", 0xFFFFFF);
- COLORREF inColor = DBGetContactSettingDword(NULL, SRMMMOD, "IncomingBkgColour", 0xFFFFFF);
- COLORREF outColor = DBGetContactSettingDword(NULL, SRMMMOD, "OutgoingBkgColour", 0xFFFFFF);
- COLORREF lineColor = DBGetContactSettingDword(NULL, SRMMMOD, "LineColour", 0xFFFFFF);
+ COLORREF bkgColor = db_get_dw(NULL, SRMMMOD, "BkgColour", 0xFFFFFF);
+ COLORREF inColor = db_get_dw(NULL, SRMMMOD, "IncomingBkgColour", 0xFFFFFF);
+ COLORREF outColor = db_get_dw(NULL, SRMMMOD, "OutgoingBkgColour", 0xFFFFFF);
+ COLORREF lineColor = db_get_dw(NULL, SRMMMOD, "LineColour", 0xFFFFFF);
bkgColor= (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
inColor= (((inColor & 0xFF) << 16) | (inColor & 0xFF00) | ((inColor & 0xFF0000) >> 16));
outColor= (((outColor & 0xFF) << 16) | (outColor & 0xFF00) | ((outColor & 0xFF0000) >> 16));
@@ -269,18 +269,18 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
bool showColon;
- DWORD dwFlags = DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, 0) ? SMF_LOG_SHOWTIME : 0;
- dwFlags |= !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, 0) ? SMF_LOG_SHOWNICK : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, 0) ? SMF_LOG_SHOWDATE : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, 0) ? SMF_LOG_SHOWICONS : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCHANGES, 0) ? SMF_LOG_SHOWSTATUSCHANGES : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, 0) ? SMF_LOG_SHOWSECONDS : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, 0) ? SMF_LOG_USERELATIVEDATE : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, 0) ? SMF_LOG_USELONGDATE : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, 0) ? SMF_LOG_GROUPMESSAGES : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, 0) ? SMF_LOG_MARKFOLLOWUPS : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, 0) ? SMF_LOG_MSGONNEWLINE : 0;
- dwFlags |= DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, 0) ? SMF_LOG_DRAWLINES : 0;
+ DWORD dwFlags = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, 0) ? SMF_LOG_SHOWTIME : 0;
+ dwFlags |= !db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, 0) ? SMF_LOG_SHOWNICK : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, 0) ? SMF_LOG_SHOWDATE : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, 0) ? SMF_LOG_SHOWICONS : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCHANGES, 0) ? SMF_LOG_SHOWSTATUSCHANGES : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, 0) ? SMF_LOG_SHOWSECONDS : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, 0) ? SMF_LOG_USERELATIVEDATE : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_USELONGDATE, 0) ? SMF_LOG_USELONGDATE : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, 0) ? SMF_LOG_GROUPMESSAGES : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, 0) ? SMF_LOG_MARKFOLLOWUPS : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, 0) ? SMF_LOG_MSGONNEWLINE : 0;
+ dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_DRAWLINES, 0) ? SMF_LOG_DRAWLINES : 0;
char *szRealProto = getRealProto(event->hContact);
IEVIEWEVENTDATA* eventData = event->eventData;
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index f407dd62b4..23a2706b57 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -105,8 +105,8 @@ bool TabSRMMHTMLBuilder::isDbEventShown(DWORD dwFlags, DBEVENTINFO * dbei) bool TabSRMMHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
{
- DWORD dwFlags2 = DBGetContactSettingByte(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
- dwFlags2 |= DBGetContactSettingByte(NULL, SRMSGMOD_T, SRMSGSET_SHOWFILES, 0) ? MWF_SHOW_FILEEVENTS : 0;
+ DWORD dwFlags2 = db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
+ dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWFILES, 0) ? MWF_SHOW_FILEEVENTS : 0;
return isDbEventShown(dwFlags2, dbei);
}
@@ -116,7 +116,7 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) DBVARIANT dbv;
if (colour) {
wsprintfA(str, "Font%dCol", i);
- *colour = DBGetContactSettingDword(NULL, TABSRMM_FONTMODULE, str, 0x000000);
+ *colour = db_get_dw(NULL, TABSRMM_FONTMODULE, str, 0x000000);
}
if (lf) {
HDC hdc = GetDC(NULL);
@@ -124,7 +124,7 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) // if(i == H_MSGFONTID_DIVIDERS)
// lf->lfHeight = 5;
// else {
- lf->lfHeight = (char) DBGetContactSettingByte(NULL, TABSRMM_FONTMODULE, str, 10);
+ lf->lfHeight = (char) db_get_b(NULL, TABSRMM_FONTMODULE, str, 10);
// lf->lfHeight= MulDiv(lf->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 74);
// }
ReleaseDC(NULL,hdc);
@@ -132,23 +132,23 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) lf->lfEscapement = 0;
lf->lfOrientation = 0;
wsprintfA(str, "Font%dSty", i);
- style = DBGetContactSettingByte(NULL, TABSRMM_FONTMODULE, str, 0);
+ style = db_get_b(NULL, TABSRMM_FONTMODULE, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
wsprintfA(str, "Font%dSet", i);
- lf->lfCharSet = DBGetContactSettingByte(NULL, TABSRMM_FONTMODULE, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(NULL, TABSRMM_FONTMODULE, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
wsprintfA(str, "Font%d", i);
- if (DBGetContactSetting(NULL, TABSRMM_FONTMODULE, str, &dbv))
+ if (db_get(NULL, TABSRMM_FONTMODULE, str, &dbv))
lstrcpyA(lf->lfFaceName, "Verdana");
else {
lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -229,16 +229,16 @@ void TabSRMMHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { HDC hdc = GetDC(NULL);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(NULL, hdc);
- DWORD dwFlags = DBGetContactSettingDword(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
+ DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
Utils::appendText(&output, &outputSize, "<html><head><style type=\"text/css\">\n");
COLORREF inColor, outColor;
- COLORREF bkgColor = DBGetContactSettingDword(NULL, TABSRMM_FONTMODULE, "BkgColour", 0xFFFFFF);
+ COLORREF bkgColor = db_get_dw(NULL, TABSRMM_FONTMODULE, "BkgColour", 0xFFFFFF);
bkgColor= (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
- COLORREF gridColor = DBGetContactSettingDword(NULL, TABSRMM_FONTMODULE, "hgrid", 0xFFFFFF);
+ COLORREF gridColor = db_get_dw(NULL, TABSRMM_FONTMODULE, "hgrid", 0xFFFFFF);
gridColor= (((gridColor & 0xFF) << 16) | (gridColor & 0xFF00) | ((gridColor & 0xFF0000) >> 16));
if (dwFlags & MWF_LOG_INDIVIDUALBKG) {
- inColor = DBGetContactSettingDword(NULL, TABSRMM_FONTMODULE, "inbg", RGB(224,224,224));
- outColor = DBGetContactSettingDword(NULL, TABSRMM_FONTMODULE, "outbg", RGB(224,224,224));
+ inColor = db_get_dw(NULL, TABSRMM_FONTMODULE, "inbg", RGB(224,224,224));
+ outColor = db_get_dw(NULL, TABSRMM_FONTMODULE, "outbg", RGB(224,224,224));
inColor= (((inColor & 0xFF) << 16) | (inColor & 0xFF00) | ((inColor & 0xFF0000) >> 16));
outColor= (((outColor & 0xFF) << 16) | (outColor & 0xFF00) | ((outColor & 0xFF0000) >> 16));
} else {
@@ -300,17 +300,17 @@ time_t TabSRMMHTMLBuilder::getStartedTime() { }
void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
-// int indentLeft = DBGetContactSettingDword(NULL, SRMSGMOD_T, "IndentAmount", 0);
-// int indentRight = DBGetContactSettingDword(NULL, SRMSGMOD_T, "RightIndent", 0);
+// int indentLeft = db_get_dw(NULL, SRMSGMOD_T, "IndentAmount", 0);
+// int indentRight = db_get_dw(NULL, SRMSGMOD_T, "RightIndent", 0);
DWORD today = (DWORD)time(NULL);
today = today - today % 86400;
- DWORD dwFlags = DBGetContactSettingDword(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
- DWORD dwFlags2 = DBGetContactSettingByte(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
- dwFlags2 |= DBGetContactSettingByte(NULL, SRMSGMOD_T, SRMSGSET_SHOWFILES, 0) ? MWF_SHOW_FILEEVENTS : 0;
- dwFlags2 |= DBGetContactSettingByte(NULL, SRMSGMOD_T, "in_out_icons", 0) ? MWF_SHOW_INOUTICONS : 0;
- dwFlags2 |= DBGetContactSettingByte(NULL, SRMSGMOD_T, "emptylinefix", 1) ? MWF_SHOW_EMPTYLINEFIX : 0;
+ DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
+ DWORD dwFlags2 = db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
+ dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWFILES, 0) ? MWF_SHOW_FILEEVENTS : 0;
+ dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, "in_out_icons", 0) ? MWF_SHOW_INOUTICONS : 0;
+ dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, "emptylinefix", 1) ? MWF_SHOW_EMPTYLINEFIX : 0;
dwFlags2 |= MWF_SHOW_MICROLF;
- dwFlags2 |= DBGetContactSettingByte(NULL, SRMSGMOD_T, "followupts", 1) ? MWF_SHOW_MARKFOLLOWUPTS : 0;
+ dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, "followupts", 1) ? MWF_SHOW_MARKFOLLOWUPTS : 0;
char *szRealProto = getRealProto(event->hContact);
IEVIEWEVENTDATA* eventData = event->eventData;
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index 09d2de312f..32ba30ee62 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -64,7 +64,7 @@ char *TemplateHTMLBuilder::getAvatar(HANDLE hContact, const char * szProto) { }
}
}
- if (!DBGetContactSettingTString(hContact, "ContactPhoto", "File", &dbv)) {
+ if (!db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
if (_tcslen(dbv.ptszVal) > 0) {
TCHAR* ext = _tcsrchr(dbv.ptszVal, '.');
if (ext && lstrcmpi(ext, _T(".xml")) == 0) {
@@ -80,7 +80,7 @@ char *TemplateHTMLBuilder::getAvatar(HANDLE hContact, const char * szProto) { }
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
char* res = mir_utf8encodeT(result);
Utils::convertPath(res);
@@ -221,11 +221,11 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr if (szAvatarOut == NULL) {
szAvatarOut = mir_strdup(szNoAvatar);
}
- if (!DBGetContactSetting(event->hContact, "CList", "StatusMsg",&dbv)) {
+ if (!db_get(event->hContact, "CList", "StatusMsg",&dbv)) {
if (strlen(dbv.pszVal) > 0) {
szStatusMsg = mir_utf8encode(dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
ZeroMemory(&ci, sizeof(ci));
ci.cbSize = sizeof(ci);
@@ -404,11 +404,11 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, szAvatarOut = mir_strdup(szNoAvatar);
}
if(event->hContact != NULL) {
- if (!DBGetContactSetting(event->hContact, "CList", "StatusMsg",&dbv)) {
+ if (!db_get(event->hContact, "CList", "StatusMsg",&dbv)) {
if (strlen(dbv.pszVal) > 0) {
szStatusMsg = mir_utf8encode(dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
ZeroMemory(&ci, sizeof(ci));
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index f25fbd35db..15deb3e489 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -117,9 +117,9 @@ static IconItem iconList[] = VOID fill_filter(void)
{
- bUseMirandaSettings = DBGetContactSettingByte(NULL, MODULENAME, "UseMirandaSettings", 0);
+ bUseMirandaSettings = db_get_b(NULL, MODULENAME, "UseMirandaSettings", 0);
- currentFilter = bUseMirandaSettings ? DBGetContactSettingDword(NULL, "Ignore", "Default1", 0) : DBGetContactSettingDword(NULL, MODULENAME, "Filter", 0x8);
+ currentFilter = bUseMirandaSettings ? db_get_dw(NULL, "Ignore", "Default1", 0) : db_get_dw(NULL, MODULENAME, "Filter", 0x8);
for (int i=0; i < SIZEOF(ii); i++) {
if (checkState((ii[i].type)))
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp index 994887e01a..776ed37c78 100644 --- a/plugins/IgnoreState/src/options.cpp +++ b/plugins/IgnoreState/src/options.cpp @@ -85,10 +85,10 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if(TreeView_GetCheckState(hTree,tvi.hItem)) flags|=1<<(tvi.lParam-1);
tvi.hItem=TreeView_GetNextSibling(hTree,tvi.hItem);
}
- DBWriteContactSettingDword(NULL, MODULENAME, "Filter", flags);
+ db_set_dw(NULL, MODULENAME, "Filter", flags);
bUseMirandaSettings = IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL) ? 1 : 0;
- DBWriteContactSettingByte(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
+ db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
fill_filter();
}
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index e77334dde8..6d2d16215e 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -110,7 +110,7 @@ static HANDLE HistoryImportFindContact(HWND hdlgProgress, char* szModuleName, DW hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)szModuleName);
- DBWriteContactSettingDword(hContact, szModuleName, "UIN", uin);
+ db_set_dw(hContact, szModuleName, "UIN", uin);
AddMessage( LPGENT("Added contact %u (found in history)"), uin );
return hContact;
}
diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index e4ac431248..c5cb25aa7e 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -84,7 +84,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_IMPORT, static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- if (DBGetContactSettingByte(NULL, IMPORT_MODULE, IMP_KEY_FR, 0))
+ if (db_get_b(NULL, IMPORT_MODULE, IMP_KEY_FR, 0))
return 0;
// Only autorun import wizard if at least one protocol is installed
@@ -93,7 +93,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) ProtoEnumAccounts(&nProtocols, &ppProtos);
if (nProtocols > 0) {
CallService(IMPORT_SERVICE, 0, 0);
- DBWriteContactSettingByte(NULL, IMPORT_MODULE, IMP_KEY_FR, 1);
+ db_set_b(NULL, IMPORT_MODULE, IMP_KEY_FR, 1);
}
return 0;
}
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp index 71e149c0f4..fc9a654165 100644 --- a/plugins/Import/src/miranda.cpp +++ b/plugins/Import/src/miranda.cpp @@ -243,7 +243,7 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam, struct tm *TM = NULL;
struct _SYSTEMTIME ST = {0};
- dwSinceDate = DBGetContactSettingDword(NULL,IMPORT_MODULE,"ImportSinceTS",time(NULL));
+ dwSinceDate = db_get_dw(NULL,IMPORT_MODULE,"ImportSinceTS",time(NULL));
TM = localtime(&dwSinceDate);
@@ -306,7 +306,7 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam, dwSinceDate = mktime(&TM);
- DBWriteContactSettingDword(NULL,IMPORT_MODULE,"ImportSinceTS",dwSinceDate);
+ db_set_dw(NULL,IMPORT_MODULE,"ImportSinceTS",dwSinceDate);
} }
if (nCustomOptions)
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index 397f5df370..58bad9efc9 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -50,26 +50,26 @@ int CreateGroup(const TCHAR* group, HANDLE hContact) for (int groupId = 0; ; groupId++) {
DBVARIANT dbv;
itoa(groupId, groupIdStr,10);
- if (DBGetContactSettingTString(NULL, "CListGroups", groupIdStr, &dbv))
+ if (db_get_ts(NULL, "CListGroups", groupIdStr, &dbv))
break;
if ( !lstrcmp(dbv.ptszVal + 1, tszGrpName + 1 )) {
if (hContact)
- DBWriteContactSettingTString( hContact, "CList", "Group", tszGrpName+1 );
+ db_set_ts( hContact, "CList", "Group", tszGrpName+1 );
else
AddMessage( LPGENT("Skipping duplicate group %s."), tszGrpName + 1);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- DBWriteContactSettingTString( NULL, "CListGroups", groupIdStr, tszGrpName );
+ db_set_ts( NULL, "CListGroups", groupIdStr, tszGrpName );
if (hContact)
- DBWriteContactSettingTString( hContact, "CList", "Group", tszGrpName+1 );
+ db_set_ts( hContact, "CList", "Group", tszGrpName+1 );
return 1;
}
diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index 8a4b71faf3..71dc010786 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -78,7 +78,7 @@ INT_PTR CALLBACK FinishedPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM // prevent the plugin from disabling/enabling correctly (this fix relies
// on the plugin loader to ignore case)
CharLowerA(pszFileName);
- DBWriteContactSettingByte(NULL, "PluginDisable", pszFileName, 1);
+ db_set_b(NULL, "PluginDisable", pszFileName, 1);
}
PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
break;
diff --git a/plugins/KeyboardNotify/src/flash.cpp b/plugins/KeyboardNotify/src/flash.cpp index 8e2809f31f..e0189f050f 100644 --- a/plugins/KeyboardNotify/src/flash.cpp +++ b/plugins/KeyboardNotify/src/flash.cpp @@ -99,9 +99,9 @@ FLASHING_SEQUENCE *getCustomSeq(void) customStr[0] = _T('\0');
- if (!DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", wCustomTheme), &dbv)) {
+ if (!db_get(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", wCustomTheme), &dbv)) {
wcscpy(customStr, dbv.pwszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
Custom = str2FS(customStr);
@@ -345,8 +345,8 @@ static void TestThread(FLASHING_SEQUENCE *pTest) unsigned int i;
DWORD dwEndTest;
- unsigned int testNum = (unsigned int)DBGetContactSettingByte(NULL, KEYBDMODULE, "testnum", DEF_SETTING_TESTNUM);
- unsigned int testSecs = (unsigned int)DBGetContactSettingByte(NULL, KEYBDMODULE, "testsecs", DEF_SETTING_TESTSECS);
+ unsigned int testNum = (unsigned int)db_get_b(NULL, KEYBDMODULE, "testnum", DEF_SETTING_TESTNUM);
+ unsigned int testSecs = (unsigned int)db_get_b(NULL, KEYBDMODULE, "testsecs", DEF_SETTING_TESTSECS);
for (i=0, dwEndTest=GetTickCount()+testSecs*1000; i < testNum || GetTickCount() < dwEndTest; i++)
for (pTest->index=0; pTest->index < pTest->size; pTest->index++) {
diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index 769cf5bce2..ac83735f01 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -31,15 +31,15 @@ extern BOOL bWindowsNT; static DWORD GetMask(HANDLE hContact)
{
- DWORD mask = DBGetContactSettingDword(hContact, KEYBDMODULE, "Mask1", (DWORD)(-1));
+ DWORD mask = db_get_dw(hContact, KEYBDMODULE, "Mask1", (DWORD)(-1));
if(mask == (DWORD)(-1)) {
if(hContact == NULL)
mask=0;
else {
- if(DBGetContactSettingByte(hContact, "CList", "Hidden", 0) || DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
- mask = DBGetContactSettingDword(NULL, KEYBDMODULE, "Mask1", 0);
+ if(db_get_b(hContact, "CList", "Hidden", 0) || db_get_b(hContact, "CList", "NotOnList", 0))
+ mask = db_get_dw(NULL, KEYBDMODULE, "Mask1", 0);
else
- mask = DBGetContactSettingDword(NULL, KEYBDMODULE, "Default1", 0);
+ mask = db_get_dw(NULL, KEYBDMODULE, "Default1", 0);
}
}
return mask;
@@ -183,7 +183,7 @@ static void SaveItemMask(HWND hwndList, HANDLE hContact, HANDLE hItem, const cha if(iImage && iImage != EMPTY_EXTRA_ICON)
mask |= 1<<i;
}
- DBWriteContactSettingDword(hContact, KEYBDMODULE, pszSetting, mask);
+ db_set_dw(hContact, KEYBDMODULE, pszSetting, mask);
}
static void SetAllContactIcons(HWND hwndList)
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 31b3f94623..5383bc5acd 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -148,7 +148,7 @@ BOOL isMetaContactsSubContact(HANDLE hMetaContact, HANDLE hContact) {
char *szProto = GetContactProto(hMetaContact);
if (szProto && !strcmp(szMetaProto, szProto)) { // Safety check
- int i = DBGetContactSettingDword(hContact, szMetaProto, "ContactNumber", -1);
+ int i = db_get_dw(hContact, szMetaProto, "ContactNumber", -1);
if (i >= 0 && hContact == (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hMetaContact, i))
return TRUE;
}
@@ -165,7 +165,7 @@ BOOL checkOpenWindow(HANDLE hContact) found = CheckMsgWnd(hContact, &focus);
if (!found && szMetaProto && bMetaProtoEnabled) {
- HANDLE hMetaContact = (HANDLE)DBGetContactSettingDword(hContact, szMetaProto, "Handle", 0);
+ HANDLE hMetaContact = (HANDLE)db_get_dw(hContact, szMetaProto, "Handle", 0);
if (hMetaContact && isMetaContactsSubContact(hMetaContact, hContact))
found = CheckMsgWnd(hMetaContact, &focus);
}
@@ -482,7 +482,7 @@ BOOL checkMsgTimestamp(HANDLE hEventCurrent, DWORD timestampCurrent) BOOL contactCheckProtocol(char *szProto, HANDLE hContact, WORD eventType)
{
if (szMetaProto && bMetaProtoEnabled && hContact) {
- HANDLE hMetaContact = (HANDLE)DBGetContactSettingDword(hContact, szMetaProto, "Handle", 0);
+ HANDLE hMetaContact = (HANDLE)db_get_dw(hContact, szMetaProto, "Handle", 0);
if (hMetaContact && isMetaContactsSubContact(hMetaContact, hContact))
return FALSE;
}
@@ -661,19 +661,19 @@ void createProcessList(void) DBVARIANT dbv;
unsigned int i, count;
- count = (unsigned int)DBGetContactSettingWord(NULL, KEYBDMODULE, "processcount", 0);
+ count = (unsigned int)db_get_w(NULL, KEYBDMODULE, "processcount", 0);
ProcessList.count = 0;
ProcessList.szFileName = (TCHAR **)malloc(count * sizeof(TCHAR *));
if (ProcessList.szFileName) {
for(i=0; i < count; i++)
- if (DBGetContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i), &dbv))
+ if (db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i), &dbv))
ProcessList.szFileName[i] = NULL;
else {
ProcessList.szFileName[i] = (TCHAR *)malloc(wcslen(dbv.ptszVal) + 1);
if (ProcessList.szFileName[i])
wcscpy(ProcessList.szFileName[i], dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
ProcessList.count = count;
}
@@ -700,36 +700,36 @@ void destroyProcessList(void) void LoadSettings(void)
{
- bFlashOnMsg = DBGetContactSettingByte(NULL, KEYBDMODULE, "onmsg", DEF_SETTING_ONMSG);
- bFlashOnURL = DBGetContactSettingByte(NULL, KEYBDMODULE, "onurl", DEF_SETTING_ONURL);
- bFlashOnFile = DBGetContactSettingByte(NULL, KEYBDMODULE, "onfile", DEF_SETTING_ONFILE);
- bFlashOnOther = DBGetContactSettingByte(NULL, KEYBDMODULE, "onother", DEF_SETTING_OTHER);
- bFullScreenMode = DBGetContactSettingByte(NULL, KEYBDMODULE, "fscreenmode", DEF_SETTING_FSCREEN);
- bScreenSaverRunning = DBGetContactSettingByte(NULL, KEYBDMODULE, "ssaverrunning", DEF_SETTING_SSAVER);
- bWorkstationLocked = (bWindowsNT ? DBGetContactSettingByte(NULL, KEYBDMODULE, "wstationlocked", DEF_SETTING_LOCKED):0);
- bProcessesAreRunning = DBGetContactSettingByte(NULL, KEYBDMODULE, "procsrunning", DEF_SETTING_PROCS);
- bWorkstationActive = DBGetContactSettingByte(NULL, KEYBDMODULE, "wstationactive", DEF_SETTING_ACTIVE);
- bFlashIfMsgOpen = DBGetContactSettingByte(NULL, KEYBDMODULE, "ifmsgopen", DEF_SETTING_IFMSGOPEN);
- bFlashIfMsgWinNotTop = DBGetContactSettingByte(NULL, KEYBDMODULE, "ifmsgnottop", DEF_SETTING_IFMSGNOTTOP);
- bFlashIfMsgOlder = DBGetContactSettingByte(NULL, KEYBDMODULE, "ifmsgolder", DEF_SETTING_IFMSGOLDER);
- wSecondsOlder = DBGetContactSettingWord(NULL, KEYBDMODULE, "secsolder", DEF_SETTING_SECSOLDER);
- bFlashUntil = DBGetContactSettingByte(NULL, KEYBDMODULE, "funtil", DEF_SETTING_FLASHUNTIL);
- wBlinksNumber = DBGetContactSettingWord(NULL, KEYBDMODULE, "nblinks", DEF_SETTING_NBLINKS);
- bMirandaOrWindows = DBGetContactSettingByte(NULL, KEYBDMODULE, "mirorwin", DEF_SETTING_MIRORWIN);
- wStatusMap = DBGetContactSettingWord(NULL, KEYBDMODULE, "status", DEF_SETTING_STATUS);
- wReminderCheck = DBGetContactSettingWord(NULL, KEYBDMODULE, "remcheck", DEF_SETTING_CHECKTIME);
- bFlashLed[0] = !!DBGetContactSettingByte(NULL, KEYBDMODULE, "fnum", DEF_SETTING_FLASHNUM);
- bFlashLed[1] = !!DBGetContactSettingByte(NULL, KEYBDMODULE, "fcaps", DEF_SETTING_FLASHCAPS);
- bFlashLed[2] = !!DBGetContactSettingByte(NULL, KEYBDMODULE, "fscroll", DEF_SETTING_FLASHSCROLL);
- bFlashEffect = DBGetContactSettingByte(NULL, KEYBDMODULE, "feffect", DEF_SETTING_FLASHEFFECT);
- bSequenceOrder = DBGetContactSettingByte(NULL, KEYBDMODULE, "order", DEF_SETTING_SEQORDER);
- wCustomTheme = DBGetContactSettingWord(NULL, KEYBDMODULE, "custom", DEF_SETTING_CUSTOMTHEME);
- bTrillianLedsMsg = DBGetContactSettingByte(NULL, KEYBDMODULE, "ledsmsg", DEF_SETTING_LEDSMSG);
- bTrillianLedsURL = DBGetContactSettingByte(NULL, KEYBDMODULE, "ledsurl", DEF_SETTING_LEDSURL);
- bTrillianLedsFile = DBGetContactSettingByte(NULL, KEYBDMODULE, "ledsfile", DEF_SETTING_LEDSFILE);
- bTrillianLedsOther = DBGetContactSettingByte(NULL, KEYBDMODULE, "ledsother", DEF_SETTING_LEDSOTHER);
- wStartDelay = DBGetContactSettingWord(NULL, KEYBDMODULE, "sdelay", DEF_SETTING_STARTDELAY);
- bFlashSpeed = DBGetContactSettingByte(NULL, KEYBDMODULE, "speed", DEF_SETTING_FLASHSPEED);
+ bFlashOnMsg = db_get_b(NULL, KEYBDMODULE, "onmsg", DEF_SETTING_ONMSG);
+ bFlashOnURL = db_get_b(NULL, KEYBDMODULE, "onurl", DEF_SETTING_ONURL);
+ bFlashOnFile = db_get_b(NULL, KEYBDMODULE, "onfile", DEF_SETTING_ONFILE);
+ bFlashOnOther = db_get_b(NULL, KEYBDMODULE, "onother", DEF_SETTING_OTHER);
+ bFullScreenMode = db_get_b(NULL, KEYBDMODULE, "fscreenmode", DEF_SETTING_FSCREEN);
+ bScreenSaverRunning = db_get_b(NULL, KEYBDMODULE, "ssaverrunning", DEF_SETTING_SSAVER);
+ bWorkstationLocked = (bWindowsNT ? db_get_b(NULL, KEYBDMODULE, "wstationlocked", DEF_SETTING_LOCKED):0);
+ bProcessesAreRunning = db_get_b(NULL, KEYBDMODULE, "procsrunning", DEF_SETTING_PROCS);
+ bWorkstationActive = db_get_b(NULL, KEYBDMODULE, "wstationactive", DEF_SETTING_ACTIVE);
+ bFlashIfMsgOpen = db_get_b(NULL, KEYBDMODULE, "ifmsgopen", DEF_SETTING_IFMSGOPEN);
+ bFlashIfMsgWinNotTop = db_get_b(NULL, KEYBDMODULE, "ifmsgnottop", DEF_SETTING_IFMSGNOTTOP);
+ bFlashIfMsgOlder = db_get_b(NULL, KEYBDMODULE, "ifmsgolder", DEF_SETTING_IFMSGOLDER);
+ wSecondsOlder = db_get_w(NULL, KEYBDMODULE, "secsolder", DEF_SETTING_SECSOLDER);
+ bFlashUntil = db_get_b(NULL, KEYBDMODULE, "funtil", DEF_SETTING_FLASHUNTIL);
+ wBlinksNumber = db_get_w(NULL, KEYBDMODULE, "nblinks", DEF_SETTING_NBLINKS);
+ bMirandaOrWindows = db_get_b(NULL, KEYBDMODULE, "mirorwin", DEF_SETTING_MIRORWIN);
+ wStatusMap = db_get_w(NULL, KEYBDMODULE, "status", DEF_SETTING_STATUS);
+ wReminderCheck = db_get_w(NULL, KEYBDMODULE, "remcheck", DEF_SETTING_CHECKTIME);
+ bFlashLed[0] = !!db_get_b(NULL, KEYBDMODULE, "fnum", DEF_SETTING_FLASHNUM);
+ bFlashLed[1] = !!db_get_b(NULL, KEYBDMODULE, "fcaps", DEF_SETTING_FLASHCAPS);
+ bFlashLed[2] = !!db_get_b(NULL, KEYBDMODULE, "fscroll", DEF_SETTING_FLASHSCROLL);
+ bFlashEffect = db_get_b(NULL, KEYBDMODULE, "feffect", DEF_SETTING_FLASHEFFECT);
+ bSequenceOrder = db_get_b(NULL, KEYBDMODULE, "order", DEF_SETTING_SEQORDER);
+ wCustomTheme = db_get_w(NULL, KEYBDMODULE, "custom", DEF_SETTING_CUSTOMTHEME);
+ bTrillianLedsMsg = db_get_b(NULL, KEYBDMODULE, "ledsmsg", DEF_SETTING_LEDSMSG);
+ bTrillianLedsURL = db_get_b(NULL, KEYBDMODULE, "ledsurl", DEF_SETTING_LEDSURL);
+ bTrillianLedsFile = db_get_b(NULL, KEYBDMODULE, "ledsfile", DEF_SETTING_LEDSFILE);
+ bTrillianLedsOther = db_get_b(NULL, KEYBDMODULE, "ledsother", DEF_SETTING_LEDSOTHER);
+ wStartDelay = db_get_w(NULL, KEYBDMODULE, "sdelay", DEF_SETTING_STARTDELAY);
+ bFlashSpeed = db_get_b(NULL, KEYBDMODULE, "speed", DEF_SETTING_FLASHSPEED);
switch (bFlashSpeed) {
case 0: nWaitDelay = 1500; break;
case 1: nWaitDelay = 0750; break;
@@ -739,23 +739,23 @@ void LoadSettings(void) default: nWaitDelay = 0050; break;
}
setFlashingSequence();
- bEmulateKeypresses = DBGetContactSettingByte(NULL, KEYBDMODULE, "keypresses", DEF_SETTING_KEYPRESSES);
- bOverride = DBGetContactSettingByte(NULL, KEYBDMODULE, "override", DEF_SETTING_OVERRIDE);
+ bEmulateKeypresses = db_get_b(NULL, KEYBDMODULE, "keypresses", DEF_SETTING_KEYPRESSES);
+ bOverride = db_get_b(NULL, KEYBDMODULE, "override", DEF_SETTING_OVERRIDE);
// Create hidden settings (for test button) if needed
- if (DBGetContactSettingByte(NULL, KEYBDMODULE, "testnum", -1) == -1)
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "testnum", DEF_SETTING_TESTNUM);
- if (DBGetContactSettingByte(NULL, KEYBDMODULE, "testsecs", -1) == -1)
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "testsecs", DEF_SETTING_TESTSECS);
+ if (db_get_b(NULL, KEYBDMODULE, "testnum", -1) == -1)
+ db_set_b(NULL, KEYBDMODULE, "testnum", DEF_SETTING_TESTNUM);
+ if (db_get_b(NULL, KEYBDMODULE, "testsecs", -1) == -1)
+ db_set_b(NULL, KEYBDMODULE, "testsecs", DEF_SETTING_TESTSECS);
for(int i=0; i < ProtoList.protoCount; i++)
if (ProtoList.protoInfo[i].visible) {
unsigned int j;
- ProtoList.protoInfo[i].enabled = DBGetContactSettingByte(NULL, KEYBDMODULE, ProtoList.protoInfo[i].szProto, DEF_SETTING_PROTOCOL);
+ ProtoList.protoInfo[i].enabled = db_get_b(NULL, KEYBDMODULE, ProtoList.protoInfo[i].szProto, DEF_SETTING_PROTOCOL);
for(j=0; j < ProtoList.protoInfo[i].xstatus.count; j++)
- ProtoList.protoInfo[i].xstatus.enabled[j] = DBGetContactSettingByte(NULL, KEYBDMODULE, fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), DEF_SETTING_XSTATUS);
+ ProtoList.protoInfo[i].xstatus.enabled[j] = db_get_b(NULL, KEYBDMODULE, fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), DEF_SETTING_XSTATUS);
}
if (szMetaProto)
- bMetaProtoEnabled = DBGetContactSettingByte(NULL, szMetaProto, "Enabled", 1);
+ bMetaProtoEnabled = db_get_b(NULL, szMetaProto, "Enabled", 1);
destroyProcessList();
createProcessList();
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index e1dd452c01..c0245c5e2f 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -316,7 +316,7 @@ INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR for (i=0; i < ListView_GetItemCount(hList); i++) {
lvItem.iItem = i;
ListView_GetItem(hList, &lvItem);
- DBWriteContactSettingByte(NULL, KEYBDMODULE, (char *)lvItem.lParam, (BYTE)!!ListView_GetCheckState(hList, lvItem.iItem));
+ db_set_b(NULL, KEYBDMODULE, (char *)lvItem.lParam, (BYTE)!!ListView_GetCheckState(hList, lvItem.iItem));
}
}
@@ -517,21 +517,21 @@ INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "onurl", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONURL) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1:0));
-
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1:0));
-
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1:0));
- DBWriteContactSettingWord(NULL, KEYBDMODULE, "secsolder", (WORD)SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, KEYBDMODULE, "onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "onurl", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONURL) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1:0));
+
+ db_set_b(NULL, KEYBDMODULE, "fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1:0));
+
+ db_set_b(NULL, KEYBDMODULE, "ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1:0));
+ db_set_w(NULL, KEYBDMODULE, "secsolder", (WORD)SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_GETPOS, 0, 0));
if(IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED)
untilMap |= UNTIL_NBLINKS;
@@ -541,9 +541,9 @@ INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR untilMap |= UNTIL_EVENTSOPEN;
if (IsDlgButtonChecked(hwndDlg, IDC_UNTILCOND) == BST_CHECKED)
untilMap |= UNTIL_CONDITIONS;
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "funtil", untilMap);
- DBWriteContactSettingWord(NULL, KEYBDMODULE, "nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "mirorwin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETCURSEL, 0, 0), 0));
+ db_set_b(NULL, KEYBDMODULE, "funtil", untilMap);
+ db_set_w(NULL, KEYBDMODULE, "nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, KEYBDMODULE, "mirorwin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETCURSEL, 0, 0), 0));
if(IsDlgButtonChecked(hwndDlg, IDC_ONLINE) == BST_CHECKED)
statusMap |= MAP_ONLINE;
@@ -565,21 +565,21 @@ INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR statusMap |= MAP_OUTTOLUNCH;
if(IsDlgButtonChecked(hwndDlg, IDC_OFFLINE) == BST_CHECKED)
statusMap |= MAP_OFFLINE;
- DBWriteContactSettingWord(NULL, KEYBDMODULE, "status", statusMap);
+ db_set_w(NULL, KEYBDMODULE, "status", statusMap);
- DBWriteContactSettingWord(NULL, KEYBDMODULE, "remcheck", (WORD)SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, KEYBDMODULE, "remcheck", (WORD)SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_GETPOS, 0, 0));
int i = 0;
for (int j = 0; j < ProcessListAux.count; j++)
if (ProcessListAux.szFileName[j])
- DBWriteContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]);
- DBWriteContactSettingWord(NULL, KEYBDMODULE, "processcount", (WORD)i);
- while (!DBDeleteContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++)));
+ db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]);
+ db_set_w(NULL, KEYBDMODULE, "processcount", (WORD)i);
+ while (!db_unset(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++)));
if (XstatusListAux)
for (int i = 0; i < ProtoList.protoCount; i++)
for(int j = 0; j < (int)XstatusListAux[i].count; j++)
- DBWriteContactSettingByte(NULL, KEYBDMODULE, fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), (BYTE)XstatusListAux[i].enabled[j]);
+ db_set_b(NULL, KEYBDMODULE, fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), (BYTE)XstatusListAux[i].enabled[j]);
LoadSettings();
@@ -630,9 +630,9 @@ INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA if (bFlashEffect != FLASH_INSEQUENCE)
EnableWindow(GetDlgItem(hwndDlg, IDC_SEQORDER), FALSE);
CheckDlgButton(hwndDlg, IDC_CUSTOM, bFlashEffect == FLASH_CUSTOM ? BST_CHECKED:BST_UNCHECKED);
- for (i=0; !DBGetContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
+ for (i=0; !db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
int index = SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (index != CB_ERR && index != CB_ERRSPACE)
SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
}
@@ -707,36 +707,36 @@ INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1:0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1:0));
if(IsDlgButtonChecked(hwndDlg, IDC_INTURN) == BST_CHECKED)
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_INTURN);
+ db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_INTURN);
else
if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED)
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_INSEQUENCE);
+ db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_INSEQUENCE);
else
if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED)
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_CUSTOM);
+ db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_CUSTOM);
else
if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED)
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_TRILLIAN);
+ db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_TRILLIAN);
else
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_SAMETIME);
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0));
- DBWriteContactSettingWord(NULL, KEYBDMODULE, "custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 0));
+ db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_SAMETIME);
+ db_set_b(NULL, KEYBDMODULE, "order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0));
+ db_set_w(NULL, KEYBDMODULE, "custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsmsg", trillianLedsMsg);
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsfile", trillianLedsFile);
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsurl", trillianLedsURL);
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsother", trillianLedsOther);
+ db_set_b(NULL, KEYBDMODULE, "ledsmsg", trillianLedsMsg);
+ db_set_b(NULL, KEYBDMODULE, "ledsfile", trillianLedsFile);
+ db_set_b(NULL, KEYBDMODULE, "ledsurl", trillianLedsURL);
+ db_set_b(NULL, KEYBDMODULE, "ledsother", trillianLedsOther);
- DBWriteContactSettingWord(NULL, KEYBDMODULE, "sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, KEYBDMODULE, "sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0));
+ db_set_b(NULL, KEYBDMODULE, "speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "keypresses", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEYPRESSES) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "keypresses", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEYPRESSES) == BST_CHECKED ? 1:0));
LoadSettings();
@@ -770,17 +770,17 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage(hwndDlg, IDC_THEME, EM_LIMITTEXT, MAX_PATH, 0);
SendDlgItemMessage(hwndDlg, IDC_CUSTOMSTRING, EM_LIMITTEXT, MAX_PATH, 0);
- for (i=0; !DBGetContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
+ for (i=0; !db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
int index = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (index != CB_ERR && index != CB_ERRSPACE) {
str = (TCHAR *)malloc(MAX_PATH+1);
if (str)
- if (DBGetContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv))
+ if (db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv))
str[0] = _T('\0');
else {
_tcscpy(str, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETITEMDATA, (WPARAM)index, (LPARAM)str);
}
@@ -1001,7 +1001,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- if (!DBGetContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", wCustomTheme), &dbv))
+ if (!db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", wCustomTheme), &dbv))
_tcscpy(theme, dbv.ptszVal);
else
theme[0] = _T('\0');
@@ -1012,12 +1012,12 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0);
for (i=0, wCustomTheme=0; i < count; i++) {
SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)themeAux);
- DBWriteContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), themeAux);
+ db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), themeAux);
str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0);
if (str)
- DBWriteContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), str);
+ db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), str);
else
- DBWriteContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), _T(""));
+ db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), _T(""));
if (!wcscmp(theme, themeAux))
wCustomTheme = i;
@@ -1026,14 +1026,14 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)i, (LPARAM)themeAux);
SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)i, (LPARAM)i);
}
- for (i=count; !DBDeleteContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i)); i++)
- DBDeleteContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i));
+ for (i=count; !db_unset(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i)); i++)
+ db_unset(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i));
- DBWriteContactSettingWord(NULL, KEYBDMODULE, "custom", wCustomTheme);
+ db_set_w(NULL, KEYBDMODULE, "custom", wCustomTheme);
// Still updating here the the Flashing tab's controls
SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0);
- DBWriteContactSettingByte(NULL, KEYBDMODULE, "override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1:0));
+ db_set_b(NULL, KEYBDMODULE, "override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1:0));
return TRUE;
} // switch code
@@ -1073,14 +1073,14 @@ void exportThemes(const TCHAR *filename) fwprintf(fExport, TranslateT("\n; Automatically generated Keyboard Notify Theme file\n\n\n"));
- for (i=0; !DBGetContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
+ for (i=0; !db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
_ftprintf(fExport, _T("[%s]\n"), dbv.ptszVal);
- DBFreeVariant(&dbv);
- if (DBGetContactSettingTString(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv))
+ db_free(&dbv);
+ if (db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv))
_ftprintf(fExport, _T("0\n\n"));
else {
_ftprintf(fExport, _T("%s\n\n"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/plugins/KeyboardNotify/src/trigger.cpp b/plugins/KeyboardNotify/src/trigger.cpp index e441a8cf60..147744b96d 100644 --- a/plugins/KeyboardNotify/src/trigger.cpp +++ b/plugins/KeyboardNotify/src/trigger.cpp @@ -35,12 +35,12 @@ int getCustomNro(DWORD actionID, HWND hwndDlg, int nItems) for (i=0; i < nItems; i++) {
SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)theme);
if (!strcmp(dbv.pszVal, theme)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return i;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return DEF_SETTING_CUSTOMTHEME;
}
@@ -56,9 +56,9 @@ static INT_PTR CALLBACK DlgProcOptsActionKbdNotify(HWND hwndDlg, UINT msg, WPARA actionID = (DWORD)lParam;
TranslateDialogDefault(hwndDlg);
- for (i=0; !DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
+ for (i=0; !db_get(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
int index = SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (index != CB_ERR && index != CB_ERRSPACE)
SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
}
@@ -106,20 +106,20 @@ char *getCustomString(DWORD actionID) if (DBGetTriggerSetting(actionID, NULL, KEYBDMODULE, "custom", &dbv))
return NULL;
- for (i=0; !DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv2); i++) {
+ for (i=0; !db_get(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv2); i++) {
if (!strcmp(dbv.pszVal, dbv2.pszVal)) {
- DBFreeVariant(&dbv);
- DBFreeVariant(&dbv2);
- if(DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv2))
+ db_free(&dbv);
+ db_free(&dbv2);
+ if(db_get(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv2))
return NULL;
strcpy(customString, dbv2.pszVal);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
return customString;
}
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return NULL;
}
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 75be3cdacf..7070307b18 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -19,7 +19,7 @@ const int vf_default = VF_VS|VF_HFL|VF_IGN|VF_CID|VF_SHOWID|VF_RECV|VF_STAT|VF_S HINSTANCE hinstance;
HGENMENU hmenuVis,hmenuOff,hmenuHide,hmenuIgnore,hmenuProto,hmenuAdded,hmenuAuthReq;
HGENMENU hmenuCopyID,hmenuRecvFiles,hmenuStatusMsg,hmenuCopyIP,hmenuCopyMirVer;
-static HANDLE hIgnoreItem[9], hProtoItem[MAX_PROTOS];
+static HGENMENU hIgnoreItem[9], hProtoItem[MAX_PROTOS];
HICON hIcon[5];
BOOL bMetaContacts = FALSE, bPopUpService = FALSE;
PROTOACCOUNT **accs;
@@ -185,19 +185,19 @@ void RenameDbProto(HANDLE hContact, HANDLE hContactNew, char* oldName, char* new if (!GetSetting(hContact,oldName,setting->name,&dbv)) {
switch (dbv.type) {
case DBVT_BYTE:
- DBWriteContactSettingByte(hContactNew, newName, setting->name, dbv.bVal);
+ db_set_b(hContactNew, newName, setting->name, dbv.bVal);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(hContactNew, newName, setting->name, dbv.wVal);
+ db_set_w(hContactNew, newName, setting->name, dbv.wVal);
break;
case DBVT_DWORD:
- DBWriteContactSettingDword(hContactNew, newName, setting->name, dbv.dVal);
+ db_set_dw(hContactNew, newName, setting->name, dbv.dVal);
break;
case DBVT_ASCIIZ:
- DBWriteContactSettingString(hContactNew, newName, setting->name, dbv.pszVal);
+ db_set_s(hContactNew, newName, setting->name, dbv.pszVal);
break;
case DBVT_UTF8:
- DBWriteContactSettingStringUtf(hContactNew, newName, setting->name, dbv.pszVal);
+ db_set_utf(hContactNew, newName, setting->name, dbv.pszVal);
break;
case DBVT_BLOB:
DBWriteContactSettingBlob(hContactNew, newName, setting->name, dbv.pbVal, dbv.cpbVal);
@@ -205,9 +205,9 @@ void RenameDbProto(HANDLE hContact, HANDLE hContactNew, char* oldName, char* new }
if (delOld)
- DBDeleteContactSetting(hContact, oldName, setting->name);
+ db_unset(hContact, oldName, setting->name);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
setting = (struct ModSetLinkLinkItem *)setting->next;
}
FreeModuleSettingLL(&settinglist);
@@ -273,7 +273,7 @@ void CopyToClipboard(HWND hwnd,LPSTR pszMsg, LPTSTR ptszMsg) BOOL isMetaContact(HANDLE hContact)
{
char *proto;
- if(bMetaContacts) {
+ if (bMetaContacts) {
proto = GetContactProto(hContact);
if ( lstrcmpA(proto, "MetaContacts") == 0 ) {
return TRUE;
@@ -284,14 +284,14 @@ BOOL isMetaContact(HANDLE hContact) HANDLE getDefaultContact(HANDLE hContact)
{
- if(bMetaContacts)
+ if (bMetaContacts)
return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT, (WPARAM)hContact, 0);
return 0;
}
HANDLE getMostOnline(HANDLE hContact)
{
- if(bMetaContacts)
+ if (bMetaContacts)
return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
return 0;
}
@@ -305,7 +305,7 @@ void GetID(HANDLE hContact,LPSTR szProto,LPSTR szID) *szID = '\0';
- if ( uID && DBGetContactSetting(hContact, szProto, uID ,&dbv_uniqueid) == 0 ) {
+ if ( uID && db_get(hContact, szProto, uID ,&dbv_uniqueid) == 0 ) {
if (dbv_uniqueid.type == DBVT_DWORD)
wsprintfA(szID, "%u", dbv_uniqueid.dVal);
else if (dbv_uniqueid.type == DBVT_WORD)
@@ -315,7 +315,7 @@ void GetID(HANDLE hContact,LPSTR szProto,LPSTR szID) else
wsprintfA(szID, "%s", dbv_uniqueid.pszVal);
- DBFreeVariant(&dbv_uniqueid);
+ db_free(&dbv_uniqueid);
}
}
@@ -336,8 +336,8 @@ int StatusMsgExists(HANDLE hContact) strcpy(par, statusMsg[i].name);
msg = DBGetString(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par);
- if(msg) {
- if(strlen(msg))
+ if (msg) {
+ if (strlen(msg))
ret |= statusMsg[i].flag;
mir_free(msg);
}
@@ -353,8 +353,8 @@ BOOL IPExists(HANDLE hContact) szProto = GetContactProto(hContact);
if (!szProto) return 0;
- mIP = DBGetContactSettingDword(hContact, szProto, "IP", 0);
- rIP = DBGetContactSettingDword(hContact, szProto, "RealIP", 0);
+ mIP = db_get_dw(hContact, szProto, "IP", 0);
+ rIP = db_get_dw(hContact, szProto, "RealIP", 0);
return (mIP != 0 || rIP != 0);
}
@@ -368,8 +368,8 @@ BOOL MirVerExists(HANDLE hContact) if (!szProto) return 0;
msg = DBGetString(hContact,szProto,"MirVer");
- if(msg) {
- if(strlen(msg)) ret = 1;
+ if (msg) {
+ if (strlen(msg)) ret = 1;
mir_free(msg);
}
@@ -380,8 +380,8 @@ void getIP(HANDLE hContact,LPSTR szProto,LPSTR szIP) {
char szmIP[64] = {0};
char szrIP[64] = {0};
- DWORD mIP = DBGetContactSettingDword(hContact, szProto, "IP", 0);
- DWORD rIP = DBGetContactSettingDword(hContact, szProto, "RealIP", 0);
+ DWORD mIP = db_get_dw(hContact, szProto, "IP", 0);
+ DWORD rIP = db_get_dw(hContact, szProto, "RealIP", 0);
if ( mIP ) wsprintfA(szmIP, "External IP: %d.%d.%d.%d\r\n", mIP>>24,(mIP>>16)&0xFF,(mIP>>8)&0xFF,mIP&0xFF);
if ( rIP ) wsprintfA(szrIP, "Internal IP: %d.%d.%d.%d\r\n", rIP>>24,(rIP>>16)&0xFF,(rIP>>8)&0xFF,rIP&0xFF);
strcpy(szIP,szrIP);
@@ -396,8 +396,8 @@ LPSTR getMirVer(HANDLE hContact) if (!szProto) return NULL;
msg = DBGetString(hContact,szProto,"MirVer");
- if(msg) {
- if(strlen(msg))
+ if (msg) {
+ if (strlen(msg))
return msg;
mir_free(msg);
}
@@ -409,11 +409,11 @@ static LRESULT CALLBACK AuthReqEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam {
switch(msg) {
case WM_CHAR:
- if(wParam == '\n' && CTRL_IS_PRESSED) { // ctrl + ENTER
+ if (wParam == '\n' && CTRL_IS_PRESSED) { // ctrl + ENTER
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
- if(wParam == 1 && CTRL_IS_PRESSED) { // ctrl + a
+ if (wParam == 1 && CTRL_IS_PRESSED) { // ctrl + a
SendMessage(hwnd, EM_SETSEL, 0, -1);
return 0;
}
@@ -456,20 +456,6 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) return 0;
}
-BOOL isVisSupport(HANDLE hContact)
-{
- char *szProto = GetContactProto(hContact);
- if(szProto == NULL) return 0;
- return CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_1,0)&PF1_INVISLIST;
-}
-
-BOOL isInvSupport(HANDLE hContact)
-{
- char *szProto = GetContactProto(hContact);
- if(szProto == NULL) return 0;
- return CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_1,0)&PF1_VISLIST;
-}
-
BOOL isProtoOnline(char *szProto)
{
//#ifdef _DEBUG
@@ -505,192 +491,159 @@ INT_PTR onSendAdded(WPARAM wparam,LPARAM lparam) // set the invisible-flag in db
INT_PTR onSetInvis(WPARAM wparam,LPARAM lparam)
{
- CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(DBGetContactSettingWord((HANDLE)wparam, GetContactProto((HANDLE)wparam),"ApparentMode",0) == ID_STATUS_OFFLINE)?0:ID_STATUS_OFFLINE,0);
+ CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(db_get_w((HANDLE)wparam, GetContactProto((HANDLE)wparam),"ApparentMode",0) == ID_STATUS_OFFLINE)?0:ID_STATUS_OFFLINE,0);
return 0;
}
// set visible-flag in db
INT_PTR onSetVis(WPARAM wparam,LPARAM lparam)
{
- CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(DBGetContactSettingWord((HANDLE)wparam, GetContactProto((HANDLE)wparam),"ApparentMode",0) == ID_STATUS_ONLINE)?0:ID_STATUS_ONLINE,0);
+ CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(db_get_w((HANDLE)wparam, GetContactProto((HANDLE)wparam),"ApparentMode",0) == ID_STATUS_ONLINE)?0:ID_STATUS_ONLINE,0);
return 0;
}
INT_PTR onHide(WPARAM wparam,LPARAM lparam)
{
- DBWriteContactSettingByte((HANDLE)wparam,"CList","Hidden",(byte)!DBGetContactSettingByte((HANDLE)wparam,"CList","Hidden",0));
+ db_set_b((HANDLE)wparam,"CList","Hidden",(byte)!db_get_b((HANDLE)wparam,"CList","Hidden",0));
CallService(MS_CLUI_SORTLIST,0,0);
return 0;
}
-void ShowItem(CLISTMENUITEM *cli, HANDLE hmenu)
-{
- cli->flags = CMIM_FLAGS | CMIF_TCHAR;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hmenu,(LPARAM)cli);
-}
-
-void HideItem(CLISTMENUITEM *cli,HANDLE hmenu)
-{
- cli->flags|=CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hmenu,(LPARAM)cli);
-}
-
// following 4 functions should be self-explanatory
-void ModifyVisibleSet(CLISTMENUITEM *cli,int mode,BOOL alpha)
+void ModifyVisibleSet(int mode, BOOL alpha)
{
- cli->flags |= CMIM_ICON;
- cli->hIcon = (mode) ? hIcon[1] : (alpha?hIcon[3] : LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT));
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmenuVis, (LPARAM)cli);
-}
-
-void ModifyInvisSet(CLISTMENUITEM *cli,int mode,BOOL alpha)
-{
- cli->flags |= CMIM_ICON;
- cli->hIcon = (mode) ? hIcon[2] : (alpha ? hIcon[4] : LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT));
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmenuOff, (LPARAM)cli);
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_ICON;
+ mi.hIcon = (mode) ? hIcon[1] : (alpha ? hIcon[3] : LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT));
+ Menu_ModifyItem(hmenuVis, &mi);
}
-void ModifyHidden(CLISTMENUITEM *cli,int mode)
+void ModifyInvisSet(int mode,BOOL alpha)
{
- cli->flags |= CMIM_ICON | CMIM_NAME;
- cli->hIcon = Skin_GetIcon((mode) ? "miex_showil" : "miex_hidefl");
- cli->ptszName = mode ? LPGENT("Show in list") : LPGENT("Hide from list");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmenuHide, (LPARAM)cli);
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_ICON;
+ mi.hIcon = (mode) ? hIcon[2] : (alpha ? hIcon[4] : LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT));
+ Menu_ModifyItem(hmenuVis, &mi);
}
-void ModifyCopyID(CLISTMENUITEM *cli, HANDLE hContact, BOOL bShowID, BOOL bTrimID)
+void ModifyCopyID(HANDLE hContact, BOOL bShowID, BOOL bTrimID)
{
- LPSTR szProto;
- char szID[256];
- TCHAR buffer[256];
- HICON hIconCID;
- HANDLE hC;
-
- cli->flags|=CMIM_ICON|CMIM_NAME;
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_ICON | CMIM_NAME;
- if(isMetaContact(hContact)) {
- hC = getMostOnline(hContact);
+ if (isMetaContact(hContact)) {
+ HANDLE hC = getMostOnline(hContact);
if ( !hContact ) hC = getDefaultContact(hContact);
hContact = hC;
}
- szProto = GetContactProto(hContact);
+ LPSTR szProto = GetContactProto(hContact);
if (!szProto) {
- HideItem(cli,hmenuCopyID);
+ Menu_ShowItem(hmenuCopyID, false);
return;
}
- hIconCID = (HICON) CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
- cli->hIcon = BindOverlayIcon(hIconCID, "miex_copyid");
+
+ HICON hIconCID = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ mi.hIcon = BindOverlayIcon(hIconCID, "miex_copyid");
DestroyIcon(hIconCID);
- hIconCID = cli->hIcon;
+ hIconCID = mi.hIcon;
- GetID(hContact,szProto,(LPSTR)&szID);
- if(szID[0])
- {
- if (bShowID)
- {
- TCHAR* tmp;
-
- if (bTrimID && (strlen(szID) > MAX_IDLEN))
- {
+ char szID[256];
+ GetID(hContact, szProto, (LPSTR)&szID);
+ if (szID[0]) {
+ if (bShowID) {
+ if (bTrimID && (strlen(szID) > MAX_IDLEN)) {
szID[MAX_IDLEN - 2] = szID[MAX_IDLEN - 1] = szID[MAX_IDLEN] = '.';
szID[MAX_IDLEN + 1] = 0;
}
- tmp = mir_a2t(szID);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s [%s]"), TranslateT("Copy ID"), tmp);
- mir_free(tmp);
- cli->ptszName = (TCHAR*)&buffer;
+ TCHAR buffer[256];
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s [%S]"), TranslateT("Copy ID"), szID);
+ mi.ptszName = buffer;
}
- else
- cli->ptszName = _T("Copy ID");
- }
- else {
- cli->flags = CMIM_FLAGS|CMIF_HIDDEN;
+ else mi.ptszName = LPGENT("Copy ID");
}
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hmenuCopyID,(LPARAM)cli);
+ else mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
+
+ Menu_ModifyItem(hmenuCopyID, &mi);
DestroyIcon(hIconCID);
}
-void ModifyStatusMsg(CLISTMENUITEM *cli,HANDLE hContact)
+void ModifyStatusMsg(HANDLE hContact)
{
- LPSTR szProto;
- HICON hIconSMsg;
-
- cli->flags|=CMIM_ICON;
-
- szProto = GetContactProto(hContact);
+ LPSTR szProto = GetContactProto(hContact);
if (!szProto) {
- HideItem(cli,hmenuStatusMsg);
+ Menu_ShowItem(hmenuStatusMsg, false);
return;
}
-
- hIconSMsg = (HICON) CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
- cli->hIcon = BindOverlayIcon(hIconSMsg, (StatusMsgExists(hContact)&2) ? "miex_copysm2" : "miex_copysm1");
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_ICON;
+
+ HICON hIconSMsg = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ mi.hIcon = BindOverlayIcon(hIconSMsg, (StatusMsgExists(hContact)&2) ? "miex_copysm2" : "miex_copysm1");
DestroyIcon(hIconSMsg);
- hIconSMsg = cli->hIcon;
+ hIconSMsg = mi.hIcon;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hmenuStatusMsg,(LPARAM)cli);
+ Menu_ModifyItem(hmenuStatusMsg, &mi);
DestroyIcon(hIconSMsg);
}
-void ModifyCopyIP(CLISTMENUITEM *cli,HANDLE hContact)
+void ModifyCopyIP(HANDLE hContact)
{
- LPSTR szProto;
- HICON hIconCIP;
-
- cli->flags |= CMIM_ICON;
-
- szProto = GetContactProto(hContact);
+ LPSTR szProto = GetContactProto(hContact);
if (!szProto) {
- HideItem(cli,hmenuCopyIP);
+ Menu_ShowItem(hmenuCopyIP, false);
return;
}
- hIconCIP = (HICON) CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_ICON;
- cli->hIcon = BindOverlayIcon(hIconCIP, "miex_copyip");
+ HICON hIconCIP = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ mi.hIcon = BindOverlayIcon(hIconCIP, "miex_copyip");
DestroyIcon(hIconCIP);
- hIconCIP = cli->hIcon;
+ hIconCIP = mi.hIcon;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hmenuCopyIP,(LPARAM)cli);
+ Menu_ModifyItem(hmenuCopyIP, &mi);
DestroyIcon(hIconCIP);
}
-void ModifyCopyMirVer(CLISTMENUITEM *cli,HANDLE hContact)
+void ModifyCopyMirVer(HANDLE hContact)
{
- LPSTR msg;
- cli->flags|=CMIM_ICON;
- cli->hIcon = NULL;
- if(ServiceExists(MS_FP_GETCLIENTICON)) {
- msg = getMirVer(hContact);
- if(msg) {
- cli->hIcon = (HICON)CallService(MS_FP_GETCLIENTICON,(WPARAM)msg,(LPARAM)1);
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_ICON;
+
+ if (ServiceExists(MS_FP_GETCLIENTICON)) {
+ LPSTR msg = getMirVer(hContact);
+ if (msg) {
+ mi.hIcon = (HICON)CallService(MS_FP_GETCLIENTICON,(WPARAM)msg,(LPARAM)1);
mir_free(msg);
}
}
- if (!cli->hIcon) cli->hIcon = hIcon[0];
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hmenuCopyMirVer,(LPARAM)cli);
+ if (!mi.hIcon) mi.hIcon = hIcon[0];
+ Menu_ModifyItem(hmenuCopyMirVer, &mi);
}
INT_PTR onCopyID(WPARAM wparam,LPARAM lparam)
{
- LPSTR szProto;
char szID[128] = {0}, buffer[256] = {0};
- HANDLE hContact ,hC;
- hContact = (HANDLE)wparam;
- if(isMetaContact(hContact)) {
- hC = getMostOnline(hContact);
- if ( !hContact ) hC = getDefaultContact(hContact);
+ HANDLE hContact = (HANDLE)wparam;
+ if (isMetaContact(hContact)) {
+ HANDLE hC = getMostOnline(hContact);
+ if (!hContact)
+ hC = getDefaultContact(hContact);
hContact = hC;
}
- if ((szProto = GetContactProto(hContact)) == NULL)
+
+ LPSTR szProto = GetContactProto(hContact);
+ if (szProto == NULL)
return 0;
GetID(hContact, szProto, (LPSTR)&szID);
- if(db_get_dw(NULL, MODULENAME, "flags", vf_default) & VF_CIDN) {
+ if (db_get_dw(NULL, MODULENAME, "flags", vf_default) & VF_CIDN) {
PROTOACCOUNT *pa = ProtoGetAccount(szProto);
if (!pa->bOldProto)
@@ -698,11 +651,10 @@ INT_PTR onCopyID(WPARAM wparam,LPARAM lparam) else
mir_snprintf(buffer, SIZEOF(buffer), "%s: %s", szProto, szID);
}
- else
- strcpy(buffer, szID);
+ else strcpy(buffer, szID);
CopyToClipboard((HWND)lparam, buffer, 0);
- if(CTRL_IS_PRESSED && bPopUpService)
+ if (CTRL_IS_PRESSED && bPopUpService)
ShowPopup(buffer, 0, hContact);
return 0;
@@ -711,7 +663,6 @@ INT_PTR onCopyID(WPARAM wparam,LPARAM lparam) INT_PTR onCopyStatusMsg(WPARAM wparam,LPARAM lparam)
{
LPSTR module;
- LPTSTR msg;
char par[32];
TCHAR buffer[2048];
int i;
@@ -728,13 +679,10 @@ INT_PTR onCopyStatusMsg(WPARAM wparam,LPARAM lparam) else
strcpy(par, statusMsg[i].name);
- msg = DBGetStringT((HANDLE)wparam, (statusMsg[i].module) ? statusMsg[i].module : module, par);
- if(msg)
- {
- if(_tcsclen(msg))
- {
- if (flags&VF_SMNAME)
- {
+ LPTSTR msg = DBGetStringT((HANDLE)wparam, (statusMsg[i].module) ? statusMsg[i].module : module, par);
+ if (msg) {
+ if (_tcsclen(msg)) {
+ if (flags & VF_SMNAME) {
_tcsncat (buffer, TranslateTS(statusMsg[i].fullName), (SIZEOF(buffer) - _tcsclen(buffer) - 1));
_tcsncat (buffer, _T(": "), (SIZEOF(buffer) - _tcsclen(buffer) - 1));
}
@@ -746,7 +694,7 @@ INT_PTR onCopyStatusMsg(WPARAM wparam,LPARAM lparam) }
CopyToClipboard((HWND)lparam, 0, buffer);
- if(CTRL_IS_PRESSED && bPopUpService)
+ if (CTRL_IS_PRESSED && bPopUpService)
ShowPopup(0, buffer, (HANDLE)wparam);
return 0;
@@ -760,7 +708,7 @@ INT_PTR onCopyIP(WPARAM wparam,LPARAM lparam) getIP((HANDLE)wparam,szProto,(LPSTR)&szIP);
CopyToClipboard((HWND)lparam, szIP, 0);
- if(CTRL_IS_PRESSED && bPopUpService)
+ if (CTRL_IS_PRESSED && bPopUpService)
ShowPopup(szIP, 0, (HANDLE)wparam);
return 0;
@@ -769,9 +717,9 @@ INT_PTR onCopyIP(WPARAM wparam,LPARAM lparam) INT_PTR onCopyMirVer(WPARAM wparam,LPARAM lparam)
{
LPSTR msg = getMirVer((HANDLE)wparam);
- if(msg) {
+ if (msg) {
CopyToClipboard((HWND)lparam, msg, 0);
- if(CTRL_IS_PRESSED && bPopUpService)
+ if (CTRL_IS_PRESSED && bPopUpService)
ShowPopup(msg, 0, (HANDLE)wparam);
mir_free(msg);
@@ -800,11 +748,9 @@ INT_PTR onChangeProto(WPARAM wparam,LPARAM lparam) CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)GetContactProto(hContact));
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContactNew, lparam);
}
- else
- {
+ else {
hContactNew = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
- if (hContactNew)
- {
+ if (hContactNew) {
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContactNew, lparam);
RenameDbProto(hContact, hContactNew, GetContactProto(hContact), (char*)lparam, 0);
RenameDbProto(hContact, hContactNew, "CList", "CList", 0);
@@ -812,7 +758,7 @@ INT_PTR onChangeProto(WPARAM wparam,LPARAM lparam) else
return 0;
}
- if(MessageBox(NULL,(LPCTSTR)TranslateT("Do you want to send authorization request\nto new contact?"),
+ if (MessageBox(NULL,(LPCTSTR)TranslateT("Do you want to send authorization request\nto new contact?"),
TranslateT("Miranda NG"), MB_OKCANCEL | MB_SETFOREGROUND | MB_TOPMOST) == IDOK)
onSendAuthRequest((WPARAM)hContactNew, 0);
@@ -822,18 +768,15 @@ INT_PTR onChangeProto(WPARAM wparam,LPARAM lparam) int isIgnored(HANDLE hContact, int type)
{
- int i = 0, all = 0;
- if (type == IGNOREEVENT_ALL)
- {
- for (i = 1; i < SIZEOF(ii); i++)
- {
- if (isIgnored(hContact, ii[i].type))
- all++;
- }
- return (all == SIZEOF(ii) - 1) ? 1 : 0; // ignoring all or not
- }
- else
+ if (type != IGNOREEVENT_ALL)
return CallService(MS_IGNORE_ISIGNORED, (WPARAM)hContact, (LPARAM)type);
+
+ int i = 0, all = 0;
+ for (i = 1; i < SIZEOF(ii); i++)
+ if (isIgnored(hContact, ii[i].type))
+ all++;
+
+ return (all == SIZEOF(ii) - 1) ? 1 : 0; // ignoring all or not
}
INT_PTR onIgnore(WPARAM wparam,LPARAM lparam)
@@ -847,7 +790,7 @@ INT_PTR onIgnore(WPARAM wparam,LPARAM lparam) return 0;
}
-static HANDLE AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD flag, char* service, int pos, int param)
+static HGENMENU AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD flag, char* service, int pos, int param)
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.hParentMenu = hRoot;
@@ -860,59 +803,53 @@ static HANDLE AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD flag return Menu_AddContactMenuItem(&mi);
}
-static void ModifySubmenuItem(HANDLE hItem, TCHAR* name, int checked, int hidden)
+static void ModifySubmenuItem(HGENMENU hItem, TCHAR *name, int checked, int hidden)
{
CLISTMENUITEM mi = { sizeof(mi) };
- mi.ptszName = name;
- mi.flags = CMIM_FLAGS | CMIF_TCHAR;
- if ( checked )
+ mi.ptszName = name;
+ mi.flags = CMIM_FLAGS | CMIF_TCHAR;
+ if (checked)
mi.flags |= CMIF_CHECKED;
- if ( hidden )
+ if (hidden)
mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hItem, (LPARAM)&mi);
+ Menu_ModifyItem(hItem, &mi);
}
// called when the contact-menu is built
int BuildMenu(WPARAM wparam,LPARAM lparam)
{
- CLISTMENUITEM miAV = {0}, miNV, miHFL, miIGN, miPROTO, miADD, miREQ, miCID, miRECV, miSTAT, miCIP, miCMV;
DWORD flags = db_get_dw(NULL, MODULENAME, "flags", vf_default);
- int i = 0, j = 0, check = 0, all = 0, hide = 0;
+ int j = 0, all = 0, hide = 0;
BOOL bIsOnline = FALSE, bShowAll = CTRL_IS_PRESSED;
- char* pszProto = GetContactProto((HANDLE)wparam);
+ HANDLE hContact = (HANDLE)wparam;
+ char* pszProto = GetContactProto(hContact);
PROTOACCOUNT *pa = ProtoGetAccount(pszProto);
bIsOnline = isProtoOnline(pszProto);
- miAV.cbSize = sizeof(CLISTMENUITEM);
- miAV.flags = CMIM_FLAGS | CMIF_TCHAR;
- miAV.hIcon = NULL;
- miAV.pszContactOwner = NULL;
- miNV = miHFL = miIGN = miPROTO = miADD = miREQ = miCID = miRECV = miSTAT = miCIP = miCMV = miAV;
-
- if(bShowAll || flags&VF_VS) {
- ShowItem(&miAV,hmenuVis);
- ShowItem(&miNV,hmenuOff);
- }
- else {
- HideItem(&miAV,hmenuVis);
- HideItem(&miNV,hmenuOff);
- }
-
- if(bShowAll || flags&VF_HFL){
- ShowItem(&miHFL,hmenuHide);
- ModifyHidden(&miHFL,DBGetContactSettingByte((HANDLE)wparam,"CList","Hidden",0));
+ bool bEnabled = bShowAll || (flags & VF_VS);
+ Menu_ShowItem(hmenuVis, bEnabled);
+ Menu_ShowItem(hmenuOff, bEnabled);
+
+ bEnabled = bShowAll || (flags & VF_HFL);
+ Menu_ShowItem(hmenuHide, bEnabled);
+ if (bEnabled) {
+ BYTE bHidden = db_get_b((HANDLE)wparam,"CList","Hidden",0);
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags |= CMIM_ICON | CMIM_NAME;
+ mi.hIcon = Skin_GetIcon(bHidden ? "miex_showil" : "miex_hidefl");
+ mi.ptszName = bHidden ? LPGENT("Show in list") : LPGENT("Hide from list");
+ Menu_ModifyItem(hmenuHide, &mi);
}
- else HideItem(&miHFL,hmenuHide);
- if(bShowAll || flags&VF_IGN)
- {
- ShowItem(&miIGN,hmenuIgnore);
- for (i = 1; i < SIZEOF(ii); i++)
- {
- check = isIgnored((HANDLE)wparam, ii[i].type);
+ bEnabled = bShowAll || (flags & VF_IGN);
+ Menu_ShowItem(hmenuIgnore, bEnabled);
+ if (bEnabled) {
+ for (int i=1; i < SIZEOF(ii); i++) {
+ int check = isIgnored(hContact, ii[i].type);
if (check)
all++;
+
ModifySubmenuItem(hIgnoreItem[i], ii[i].name, check, 0);
if (all == SIZEOF(ii) - 1) // ignor all
@@ -923,78 +860,58 @@ int BuildMenu(WPARAM wparam,LPARAM lparam) }
}
- else HideItem(&miIGN,hmenuIgnore);
-
- if(pa && (bShowAll || flags&VF_PROTO))
- {
- for (i = 0; i < protoCount; i++)
- {
+ if (pa && (bShowAll || (flags & VF_PROTO))) {
+ for (int i=0; i < protoCount; i++) {
if ((!accs[i]->bIsEnabled) || (strcmp(pa->szProtoName, accs[i]->szProtoName)))
hide = 1;
- else
- {
+ else {
hide = 0;
j++;
}
- if (CallService(MS_PROTO_ISPROTOONCONTACT, wparam, (LPARAM)accs[i]->szModuleName))
- check = 1;
- else
- check = 0;
-
+ int check = 0 != CallService(MS_PROTO_ISPROTOONCONTACT, wparam, (LPARAM)accs[i]->szModuleName);
ModifySubmenuItem(hProtoItem[i], accs[i]->tszAccountName, check, hide);
}
- if (j > 1)
- ShowItem(&miPROTO,hmenuProto);
- else
- HideItem(&miPROTO,hmenuProto);
+ Menu_ShowItem(hmenuProto, j > 1);
}
- else HideItem(&miPROTO,hmenuProto);
-
- if ((bShowAll || flags & VF_ADD) && bIsOnline && IsAccountEnabled(pa))
- ShowItem(&miADD,hmenuAdded);
- else
- HideItem(&miADD,hmenuAdded);
+ else Menu_ShowItem(hmenuProto, false);
- if ((bShowAll || flags & VF_REQ) && bIsOnline && IsAccountEnabled(pa))
- ShowItem(&miREQ,hmenuAuthReq);
- else
- HideItem(&miREQ,hmenuAuthReq);
+ Menu_ShowItem(hmenuAdded, (bShowAll || (flags & VF_ADD)) && bIsOnline && IsAccountEnabled(pa));
+ Menu_ShowItem(hmenuAuthReq, (bShowAll || (flags & VF_REQ)) && bIsOnline && IsAccountEnabled(pa));
- if(bShowAll || flags&VF_CID){
- ShowItem(&miCID,hmenuCopyID);
- ModifyCopyID(&miCID,(HANDLE)wparam, flags&VF_SHOWID, flags&VF_TRIMID);
- }
- else HideItem(&miCID,hmenuCopyID);
+ bEnabled = bShowAll || (flags & VF_CID);
+ Menu_ShowItem(hmenuCopyID, bEnabled);
+ if (bEnabled)
+ ModifyCopyID(hContact, flags & VF_SHOWID, flags & VF_TRIMID);
- if ((bShowAll || flags&VF_RECV) && DirectoryExists((HANDLE)wparam)) ShowItem(&miRECV,hmenuRecvFiles);
- else HideItem(&miRECV,hmenuRecvFiles);
+ Menu_ShowItem(hmenuRecvFiles, (bShowAll || (flags & VF_RECV)) && DirectoryExists(hContact));
- if ((bShowAll || flags&VF_STAT) && StatusMsgExists((HANDLE)wparam)) {
- ShowItem(&miSTAT,hmenuStatusMsg);
- ModifyStatusMsg(&miSTAT,(HANDLE)wparam);
- }
- else HideItem(&miSTAT,hmenuStatusMsg);
+ bEnabled = (bShowAll || (flags & VF_STAT)) && StatusMsgExists(hContact);
+ Menu_ShowItem(hmenuStatusMsg, bEnabled);
+ if (bEnabled)
+ ModifyStatusMsg(hContact);
- if ((bShowAll || flags&VF_CIP) && IPExists((HANDLE)wparam)) {
- ShowItem(&miCIP,hmenuCopyIP);
- ModifyCopyIP(&miCIP,(HANDLE)wparam);
- }
- else HideItem(&miCIP,hmenuCopyIP);
+ bEnabled = (bShowAll || (flags & VF_CIP)) && IPExists(hContact);
+ Menu_ShowItem(hmenuCopyIP, bEnabled);
+ if (bEnabled)
+ ModifyCopyIP(hContact);
- if ((bShowAll || flags&VF_CMV) && MirVerExists((HANDLE)wparam)) {
- ShowItem(&miCMV,hmenuCopyMirVer);
- ModifyCopyMirVer(&miCMV,(HANDLE)wparam);
- }
- else HideItem(&miCMV,hmenuCopyMirVer);
+ bEnabled = (bShowAll || (flags & VF_CMV)) && MirVerExists(hContact);
+ Menu_ShowItem(hmenuCopyMirVer, bEnabled);
+ if (bEnabled)
+ ModifyCopyMirVer(hContact);
- if(bShowAll || (flags&VF_VS))
- {
- int apparent = DBGetContactSettingWord((HANDLE)wparam, GetContactProto((HANDLE)wparam),"ApparentMode",0);
- if(isVisSupport((HANDLE)wparam)) ModifyVisibleSet(&miAV,apparent == ID_STATUS_ONLINE,flags&VF_SAI);
- else HideItem(&miAV,hmenuVis);
- if(isInvSupport((HANDLE)wparam)) ModifyInvisSet(&miNV,apparent == ID_STATUS_OFFLINE,flags&VF_SAI);
- else HideItem(&miAV,hmenuOff);
+ if ((bShowAll || (flags & VF_VS)) && pszProto) {
+ INT_PTR caps = CallProtoService(pszProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ int apparent = db_get_w(hContact, GetContactProto(hContact),"ApparentMode", 0);
+
+ Menu_ShowItem(hmenuVis, caps & PF1_VISLIST);
+ if (caps & PF1_VISLIST)
+ ModifyVisibleSet(apparent == ID_STATUS_ONLINE, flags & VF_SAI);
+
+ Menu_ShowItem(hmenuOff, caps & PF1_INVISLIST);
+ if (caps & PF1_INVISLIST)
+ ModifyInvisSet(apparent == ID_STATUS_OFFLINE, flags & VF_SAI);
}
return 0;
}
@@ -1070,7 +987,7 @@ static int ContactWindowOpen(WPARAM wparam,LPARAM lParam) {
MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam;
- if(MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact)
+ if (MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact)
{
TabsrmmButtonsModify(MWeventdata->hContact);
}
@@ -1105,29 +1022,29 @@ static int ContactSettingChanged( WPARAM wParam, LPARAM lParam ) char *lpzProto = GetContactProto(hContact);
// ignore chat rooms
- if (DBGetContactSettingByte(hContact, lpzProto, "ChatRoom", 0))
+ if (db_get_b(hContact, lpzProto, "ChatRoom", 0))
return 0;
if (oldStatus == ID_STATUS_OFFLINE) {
// set logon timestamp for this contact, only when not set already
- if (!DBGetContactSettingDword(hContact, lpzProto, "LogonTS", FALSE))
- DBWriteContactSettingDword(hContact, lpzProto, "LogonTS", ( DWORD )time(NULL));
+ if (!db_get_dw(hContact, lpzProto, "LogonTS", FALSE))
+ db_set_dw(hContact, lpzProto, "LogonTS", ( DWORD )time(NULL));
// reset logoff timestamp
- DBDeleteContactSetting(hContact, lpzProto, "LogoffTS");
+ db_unset(hContact, lpzProto, "LogoffTS");
// TESTING: updating user's details
if (db_get_dw(NULL, MODULENAME, "flags", vf_default) & VF_REFRESH) {
// don't refresh Hidden or NotOnList contact's details
- if (!DBGetContactSettingByte(hContact, "CList", "Hidden", 0) && !DBGetContactSettingByte((HANDLE)wParam, "CList", "NotOnList", 0))
+ if (!db_get_b(hContact, "CList", "Hidden", 0) && !db_get_b((HANDLE)wParam, "CList", "NotOnList", 0))
CallContactService(hContact, PSS_GETINFO, 0, 0 );
}
}
if (newStatus == ID_STATUS_OFFLINE) {
// set logoff timestamp for this contact
- DBWriteContactSettingDword(hContact, lpzProto, "LogoffTS", ( DWORD )time(NULL));
+ db_set_dw(hContact, lpzProto, "LogoffTS", ( DWORD )time(NULL));
// reset logon timestamp
- DBDeleteContactSetting(hContact, lpzProto, "LogonTS");
+ db_unset(hContact, lpzProto, "LogonTS");
}
if (p != NULL)
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp index 106c77453a..2622d13692 100644 --- a/plugins/MenuItemEx/src/options.cpp +++ b/plugins/MenuItemEx/src/options.cpp @@ -87,7 +87,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) mod_flags |= IsDlgButtonChecked(hdlg, checkboxes[i].idc) ? checkboxes[i].flag : 0;
}
- //DBDeleteContactSetting(NULL,VISPLG,"flags");
+ //db_unset(NULL,VISPLG,"flags");
db_set_dw(NULL, MODULENAME, "flags", mod_flags);
return 1;
@@ -96,7 +96,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) break;
case WM_COMMAND:
- if(HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam) {
+ if (HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam) {
SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
if (LOWORD(wparam) == IDC_VIS ||
LOWORD(wparam) == IDC_IGNORE ||
diff --git a/plugins/MetaContacts/src/meta_menu.cpp b/plugins/MetaContacts/src/meta_menu.cpp index e4eaf8257d..7ba3115d16 100644 --- a/plugins/MetaContacts/src/meta_menu.cpp +++ b/plugins/MetaContacts/src/meta_menu.cpp @@ -325,7 +325,7 @@ INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam) return 0;
}
-HANDLE hMenuContact[MAX_CONTACTS];
+HGENMENU hMenuContact[MAX_CONTACTS];
/** Called when the context-menu of a contact is about to be displayed
*
@@ -341,79 +341,75 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
char buf[512], idStr[512];
WORD status;
-
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
if (db_get_dw((HANDLE)wParam, META_PROTO, META_ID,-1) != (DWORD)-1) {
// save the mouse pos in case they open a subcontact menu
GetCursorPos(&menuMousePoint);
// This is a MetaContact, show the edit, force default, and the delete menu, and hide the others
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi);
+ Menu_ShowItem(hMenuEdit, true);
+ Menu_ShowItem(hMenuAdd, false);
+ Menu_ShowItem(hMenuConvert, false);
+ Menu_ShowItem(hMenuDefault, false);
+ Menu_ShowItem(hMenuDelete, false);
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_HIDDEN; // we don't need delete - already in contact menu
- mi.pszName = Translate("Delete MetaContact");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDelete, (LPARAM)&mi);
+ mi.flags = CMIM_NAME | CMIF_TCHAR;
+ mi.ptszName = (TCHAR*)TranslateT("Remove from MetaContact");
+ Menu_ModifyItem(hMenuDelete, &mi);
//show subcontact menu items
int num_contacts = db_get_dw((HANDLE)wParam, META_PROTO, "NumContacts", 0);
for (int i = 0; i < MAX_CONTACTS; i++) {
- if (i < num_contacts) {
- HANDLE hContact = Meta_GetContactHandle((HANDLE)wParam, i);
- char *szProto = GetContactProto(hContact);
- if ( !szProto)
- status = ID_STATUS_OFFLINE;
- else
- status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
-
- if (options.menu_contact_label == DNT_UID) {
- strcpy(buf, "Login");
- strcat(buf, _itoa(i, idStr, 10));
-
- db_get((HANDLE)wParam, META_PROTO, buf, &dbv);
- switch(dbv.type) {
- case DBVT_ASCIIZ:
- mir_snprintf(buf,512,"%s",dbv.pszVal);
- break;
- case DBVT_BYTE:
- mir_snprintf(buf,512,"%d",dbv.bVal);
- break;
- case DBVT_WORD:
- mir_snprintf(buf,512,"%d",dbv.wVal);
- break;
- case DBVT_DWORD:
- mir_snprintf(buf,512,"%d",dbv.dVal);
- break;
- default:
- buf[0] = 0;
- }
- db_free(&dbv);
- mi.pszName = buf;
- mi.flags = 0;
- }
- else {
- mi.ptszName = pcli->pfnGetContactDisplayName(hContact, GCDNF_TCHAR);
- mi.flags = CMIF_TCHAR;
+ if (i >= num_contacts) {
+ Menu_ShowItem(hMenuContact[i], false);
+ continue;
+ }
+
+ HANDLE hContact = Meta_GetContactHandle((HANDLE)wParam, i);
+ char *szProto = GetContactProto(hContact);
+ if ( !szProto)
+ status = ID_STATUS_OFFLINE;
+ else
+ status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+
+ if (options.menu_contact_label == DNT_UID) {
+ strcpy(buf, "Login");
+ strcat(buf, _itoa(i, idStr, 10));
+
+ db_get((HANDLE)wParam, META_PROTO, buf, &dbv);
+ switch(dbv.type) {
+ case DBVT_ASCIIZ:
+ mir_snprintf(buf,512,"%s",dbv.pszVal);
+ break;
+ case DBVT_BYTE:
+ mir_snprintf(buf,512,"%d",dbv.bVal);
+ break;
+ case DBVT_WORD:
+ mir_snprintf(buf,512,"%d",dbv.wVal);
+ break;
+ case DBVT_DWORD:
+ mir_snprintf(buf,512,"%d",dbv.dVal);
+ break;
+ default:
+ buf[0] = 0;
}
-
- mi.flags |= CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
-
- int iconIndex = CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0);
- mi.hIcon = ImageList_GetIcon((HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0), iconIndex, 0);
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
- DestroyIcon(mi.hIcon);
+ db_free(&dbv);
+ mi.pszName = buf;
+ mi.flags = 0;
}
else {
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
+ mi.ptszName = pcli->pfnGetContactDisplayName(hContact, GCDNF_TCHAR);
+ mi.flags = CMIF_TCHAR;
}
+
+ mi.flags |= CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
+
+ int iconIndex = CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0);
+ mi.hIcon = ImageList_GetIcon((HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0), iconIndex, 0);
+
+ Menu_ModifyItem(hMenuContact[i], &mi);
+ DestroyIcon(mi.hIcon);
}
// show hide nudge menu item
@@ -427,37 +423,36 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) else { // This is a simple contact
if ( !Meta_IsEnabled()) {
// groups disabled - all meta menu options hidden
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDelete, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
+ Menu_ShowItem(hMenuDefault, false);
+ Menu_ShowItem(hMenuDelete, false);
+ Menu_ShowItem(hMenuAdd, false);
+ Menu_ShowItem(hMenuConvert, false);
+ Menu_ShowItem(hMenuEdit, false);
}
else if (db_get_dw((HANDLE)wParam, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1) {
// The contact is affected to a metacontact.
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi);
- mi.flags |= CMIM_NAME | CMIF_TCHAR;
+ Menu_ShowItem(hMenuDefault, true);
+
+ mi.flags = CMIM_NAME | CMIF_TCHAR;
mi.ptszName = (TCHAR*)TranslateT("Remove from MetaContact");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDelete, (LPARAM)&mi);
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
+ Menu_ModifyItem(hMenuDelete, &mi);
+
+ Menu_ShowItem(hMenuAdd, false);
+ Menu_ShowItem(hMenuConvert, false);
+ Menu_ShowItem(hMenuEdit, false);
}
else {
// The contact is neutral
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi);
- mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDelete, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi);
+ Menu_ShowItem(hMenuAdd, true);
+ Menu_ShowItem(hMenuConvert, true);
+ Menu_ShowItem(hMenuEdit, false);
+ Menu_ShowItem(hMenuDelete, false);
+ Menu_ShowItem(hMenuDefault, false);
}
for (int i = 0; i < MAX_CONTACTS; i++) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
+ Menu_ShowItem(hMenuContact[i], (LPARAM)&mi);
}
}
return 0;
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index 610a08af73..4ef0be7e69 100755 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -229,31 +229,9 @@ INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam) // if subcontact sending, add db event to keep metacontact history correct
if (options.metahistory && !(ccs->wParam & PREF_METANODB)) {
-
- // reject "file As Message" messages
- if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "<%fAM", 5) == 0)
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
-
- // reject "data As Message" messages
- if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "<%dAM", 5) == 0)
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
-
- // reject "OTR" messages
- if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "?OTR", 4) == 0)
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
-
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.szModule = META_PROTO;
- dbei.flags = DBEF_SENT;
- dbei.timestamp = time(NULL);
- dbei.eventType = EVENTTYPE_MESSAGE;
- if (ccs->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
- if (ccs->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
- dbei.cbBlob = (DWORD)strlen((char *)ccs->lParam) + 1;
- if ( ccs->wParam & PREF_UNICODE )
- dbei.cbBlob *= ( sizeof( wchar_t )+1 );
- dbei.pBlob = (PBYTE)ccs->lParam;
- db_event_add(hMeta, &dbei);
+ HANDLE hContact = ccs->hContact; ccs->hContact = hMeta;
+ CallService(MS_PROTO_CHAINSEND, 0, lParam);
+ ccs->hContact = hContact;
}
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
@@ -672,7 +650,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) db_set_utf(hMeta, META_PROTO, "ListeningTo", dcws->value.pszVal);
break;
case DBVT_WCHAR:
- DBWriteContactSettingWString(hMeta, META_PROTO, "ListeningTo", dcws->value.pwszVal);
+ db_set_ws(hMeta, META_PROTO, "ListeningTo", dcws->value.pwszVal);
break;
case DBVT_DELETED:
db_unset(hMeta, META_PROTO, "ListeningTo");
diff --git a/plugins/MetaContacts/src/metacontacts.h b/plugins/MetaContacts/src/metacontacts.h index 8dcca13ceb..e5139a5e0b 100644 --- a/plugins/MetaContacts/src/metacontacts.h +++ b/plugins/MetaContacts/src/metacontacts.h @@ -63,7 +63,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // I can't think of a way around this - mental block
INT_PTR TranslateMenuFunc(HANDLE hContact, int i);
-extern HANDLE hMenuContact[MAX_CONTACTS];
+extern HGENMENU hMenuContact[MAX_CONTACTS];
extern HINSTANCE hInstance;
extern PLUGININFOEX pluginInfo;
diff --git a/plugins/MirOTR/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/MirOTR/src/dbfilter.cpp index 9c0739fad3..790de635c6 100644 --- a/plugins/MirOTR/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/MirOTR/src/dbfilter.cpp @@ -54,7 +54,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { const char *proto = contact_get_proto(hContact);
if (!proto ) return 0;
- if (DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 1)
+ if (db_get_b(hContact, proto, "ChatRoom", 0) == 1)
return 0;
if(g_metaproto && strcmp(proto, g_metaproto) == 0) {
diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp index ee1198e2bf..9d788fac89 100644 --- a/plugins/MirOTR/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp @@ -101,13 +101,13 @@ extern "C" __declspec(dllexport) int Load(void) CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
// remove us as a filter to all contacts - fix filter type problem
- if(DBGetContactSettingByte(0, MODULENAME, "FilterOrderFix", 0) != 2) {
+ if(db_get_b(0, MODULENAME, "FilterOrderFix", 0) != 2) {
HANDLE hContact = db_find_first();
while ( hContact != NULL ) {
CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME);
hContact = db_find_next(hContact);
}
- DBWriteContactSettingByte(0, MODULENAME, "FilterOrderFix", 2);
+ db_set_b(0, MODULENAME, "FilterOrderFix", 2);
}
// create our services
@@ -131,7 +131,6 @@ extern "C" __declspec(dllexport) int Unload(void) DEBUGOUT_T("UNLOAD MIROTR")
DeinitSRMM();
DeinitOptions();
- DeinitMenu();
DeinitDBFilter();
lib_cs_lock();
diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp index 5def9d9470..1007d0e848 100644 --- a/plugins/MirOTR/MirOTR/src/options.cpp +++ b/plugins/MirOTR/MirOTR/src/options.cpp @@ -53,7 +53,7 @@ void LoadFilenames() }
void LoadOptions() {
- options.default_policy = DBGetContactSettingWord(0, MODULENAME, "DefaultPolicy", OTRL_POLICY_OPPORTUNISTIC);
+ options.default_policy = db_get_w(0, MODULENAME, "DefaultPolicy", OTRL_POLICY_OPPORTUNISTIC);
// deal with changed flags in proto.h and new interpretation of 'manual' mode (see common.h)
switch(options.default_policy) {
case OTRL_POLICY_MANUAL:
@@ -68,26 +68,26 @@ void LoadOptions() { options.default_policy = OTRL_POLICY_OPPORTUNISTIC;
break;
}
- options.err_method = (ErrorDisplay)DBGetContactSettingWord(0, MODULENAME, "ErrorDisplay", ED_POP);
- options.prefix_messages = (DBGetContactSettingByte(0, MODULENAME, "PrefixMessages", 0) == 1);
- options.msg_inline = (DBGetContactSettingByte(0, MODULENAME, "MsgInline", 0) == 1);
- options.msg_popup = (DBGetContactSettingByte(0, MODULENAME, "MsgPopup", 1) == 1);
- options.delete_history = (DBGetContactSettingByte(0, MODULENAME, "NoHistory", 0) == 1);
- options.delete_systeminfo = (DBGetContactSettingByte(0, MODULENAME, "NoSystemHistory", 0) == 1);
- options.autoshow_verify = (DBGetContactSettingByte(0, MODULENAME, "AutoShowVerify", 1) == 1);
+ options.err_method = (ErrorDisplay)db_get_w(0, MODULENAME, "ErrorDisplay", ED_POP);
+ options.prefix_messages = (db_get_b(0, MODULENAME, "PrefixMessages", 0) == 1);
+ options.msg_inline = (db_get_b(0, MODULENAME, "MsgInline", 0) == 1);
+ options.msg_popup = (db_get_b(0, MODULENAME, "MsgPopup", 1) == 1);
+ options.delete_history = (db_get_b(0, MODULENAME, "NoHistory", 0) == 1);
+ options.delete_systeminfo = (db_get_b(0, MODULENAME, "NoSystemHistory", 0) == 1);
+ options.autoshow_verify = (db_get_b(0, MODULENAME, "AutoShowVerify", 1) == 1);
DBVARIANT dbv;
if (!DBGetContactSettingUTF8String(0, MODULENAME, "Prefix", &dbv)) {
strncpy(options.prefix, dbv.pszVal, OPTIONS_PREFIXLEN);
options.prefix[OPTIONS_PREFIXLEN-1] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
strcpy(options.prefix, ("OTR: "));
- options.timeout_finished = (DBGetContactSettingByte(0, MODULENAME, "TimeoutFinished", 0) == 1);
+ options.timeout_finished = (db_get_b(0, MODULENAME, "TimeoutFinished", 0) == 1);
- options.end_offline = (DBGetContactSettingByte(0, MODULENAME, "EndOffline", 1) == 1);
- options.end_window_close = (DBGetContactSettingByte(0, MODULENAME, "EndWindowClose", 0) == 1);
+ options.end_offline = (db_get_b(0, MODULENAME, "EndOffline", 1) == 1);
+ options.end_window_close = (db_get_b(0, MODULENAME, "EndWindowClose", 0) == 1);
options.bHaveMetaContacts = 0!=ServiceExists(MS_MC_GETMETACONTACT);
options.bHavePopups = 0!=ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_SHOWMESSAGE);
@@ -142,30 +142,22 @@ void DeinitOptions() { }
void SaveOptions() {
- DBWriteContactSettingWord(0, MODULENAME, "DefaultPolicy", options.default_policy);
- DBWriteContactSettingWord(0, MODULENAME, "ErrorDisplay", (int)options.err_method);
- DBWriteContactSettingByte(0, MODULENAME, "PrefixMessages", options.prefix_messages ? 1 : 0);
- DBWriteContactSettingByte(0, MODULENAME, "MsgInline", options.msg_inline ? 1 : 0);
- DBWriteContactSettingByte(0, MODULENAME, "MsgPopup", options.msg_popup ? 1 : 0);
-
- DBWriteContactSettingByte(0, MODULENAME, "NoHistory", options.delete_history ? 1 : 0);
- DBWriteContactSettingByte(0, MODULENAME, "NoSystemHistory", options.delete_systeminfo ? 1 : 0);
- DBWriteContactSettingByte(0, MODULENAME, "AutoShowVerify", options.autoshow_verify ? 1 : 0);
-
- /*
- if (contact_policies) {
- for(ContactPolicyMap::iterator i = contact_policies->begin(); i != contact_policies->end(); i++) {
- DBWriteContactSettingWord(i->first, MODULENAME, "Policy", i->second);
- }
- }
- */
+ db_set_w(0, MODULENAME, "DefaultPolicy", options.default_policy);
+ db_set_w(0, MODULENAME, "ErrorDisplay", (int)options.err_method);
+ db_set_b(0, MODULENAME, "PrefixMessages", options.prefix_messages ? 1 : 0);
+ db_set_b(0, MODULENAME, "MsgInline", options.msg_inline ? 1 : 0);
+ db_set_b(0, MODULENAME, "MsgPopup", options.msg_popup ? 1 : 0);
+
+ db_set_b(0, MODULENAME, "NoHistory", options.delete_history ? 1 : 0);
+ db_set_b(0, MODULENAME, "NoSystemHistory", options.delete_systeminfo ? 1 : 0);
+ db_set_b(0, MODULENAME, "AutoShowVerify", options.autoshow_verify ? 1 : 0);
- DBWriteContactSettingStringUtf(0, MODULENAME, "Prefix", options.prefix);
+ db_set_utf(0, MODULENAME, "Prefix", options.prefix);
- DBWriteContactSettingByte(0, MODULENAME, "TimeoutFinished", options.timeout_finished ? 1 : 0);
+ db_set_b(0, MODULENAME, "TimeoutFinished", options.timeout_finished ? 1 : 0);
- DBWriteContactSettingByte(0, MODULENAME, "EndOffline", options.end_offline ? 1 : 0);
- DBWriteContactSettingByte(0, MODULENAME, "EndWindowClose", options.end_window_close ? 1 : 0);
+ db_set_b(0, MODULENAME, "EndOffline", options.end_offline ? 1 : 0);
+ db_set_b(0, MODULENAME, "EndWindowClose", options.end_window_close ? 1 : 0);
}
extern "C" void set_context_contact(void *data, ConnContext *context) {
@@ -640,7 +632,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM for(ContactPolicyMap::const_iterator it = cpm->begin(); it != cpm->end(); ++it)
{
if (!it->first) continue;
- if (it->second.policy) DBWriteContactSettingDword(it->first, MODULENAME, "Policy", (DWORD)it->second.policy);
+ if (it->second.policy) db_set_dw(it->first, MODULENAME, "Policy", (DWORD)it->second.policy);
if (it->second.htmlconv) db_set_b(it->first, MODULENAME, "HTMLConv", it->second.htmlconv-1);
}
return TRUE;
diff --git a/plugins/MirOTR/MirOTR/src/otr.cpp b/plugins/MirOTR/MirOTR/src/otr.cpp index 1590d9244b..c7f37b9ac6 100644 --- a/plugins/MirOTR/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/MirOTR/src/otr.cpp @@ -79,7 +79,7 @@ extern "C" { HANDLE hContact = (HANDLE)opdata;
DWORD pol;
if(hContact) {
- pol = DBGetContactSettingDword(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
+ pol = db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
if (options.bHaveSecureIM && pol != OTRL_POLICY_MANUAL_MOD && pol != OTRL_POLICY_NEVER && db_get_b(hContact, "SecureIM" , "StatusID", 0)) {
// if SecureIM is not disabled for this contact, MirOTR will be set to manual
db_set_dw(hContact, MODULENAME, "Policy", OTRL_POLICY_MANUAL_MOD);
@@ -126,7 +126,7 @@ extern "C" { DEBUGOUT_T("OTR_GUI_IS_LOGGED_IN")
HANDLE hContact = (HANDLE)opdata;
if(hContact) {
- WORD status = DBGetContactSettingWord(hContact, contact_get_proto(hContact), "Status", ID_STATUS_OFFLINE);
+ WORD status = db_get_w(hContact, contact_get_proto(hContact), "Status", ID_STATUS_OFFLINE);
if(status == ID_STATUS_OFFLINE) return 0;
else return 1;
}
@@ -141,7 +141,7 @@ extern "C" { //MessageBox(0, message, "OTR Inject", MB_OK);
HANDLE hContact = (HANDLE)opdata;
- if(protocol && DBGetContactSettingWord(hContact, protocol, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ if(protocol && db_get_w(hContact, protocol, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
/* this would be with translation
TCHAR *decode = mir_utf8decodeT(message);
TCHAR *encode = mir_utf8encodeT(TranslateT(decide));
diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp index d09fe916b5..f1885a31a3 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-HANDLE hMenuBuildEvent, hStopItem, hStartItem;
+static HGENMENU hStopItem, hStartItem;
////////////////////////////////
///////// Menu Services ////////
@@ -11,7 +11,7 @@ int StartOTR(HANDLE hContact) { if (!proto) return 1; // error
char *uname = contact_get_id(hContact);
if (!uname) return 1; // error
- DWORD pol = DBGetContactSettingDword(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
+ DWORD pol = db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
if(pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy;
lib_cs_lock();
@@ -22,6 +22,7 @@ int StartOTR(HANDLE hContact) { mir_free(uname);
return 0;
}
+
INT_PTR SVC_StartOTR(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam, hSub;
if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
@@ -44,6 +45,7 @@ INT_PTR SVC_StartOTR(WPARAM wParam, LPARAM lParam) { return 0;
}
+
INT_PTR SVC_RefreshOTR(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam, hSub;
if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
@@ -145,12 +147,7 @@ void InitMenu() hStartItem = Menu_AddContactMenuItem(&mi);
- hMenuBuildEvent = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SVC_PrebuildContactMenu);
-
-}
-
-void DeinitMenu() {
- UnhookEvent(hMenuBuildEvent);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SVC_PrebuildContactMenu);
}
int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
@@ -163,8 +160,11 @@ int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) const char *proto = contact_get_proto(hContact);
DWORD pol = CONTACT_DEFAULT_POLICY;
- if (!proto || DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 1) {
- goto hide_all;
+ if (!proto || db_get_b(hContact, proto, "ChatRoom", 0) == 1) {
+hide_all:
+ Menu_ShowItem(hStartItem, false);
+ Menu_ShowItem(hStopItem, false);
+ return 0;
}
if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) {
@@ -175,36 +175,15 @@ int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) proto = contact_get_proto(hContact);
}
- pol = DBGetContactSettingDword(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
+ pol = db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
if(pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy;
- if(pol == OTRL_POLICY_NEVER || pol == OTRL_POLICY_ALWAYS) {
+ if(pol == OTRL_POLICY_NEVER || pol == OTRL_POLICY_ALWAYS)
goto hide_all;
- }
- {
- ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
- TrustLevel encrypted = otr_context_get_trust(context);
- if(encrypted != TRUST_NOT_PRIVATE) {
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hStopItem, (LPARAM)&mi);
- mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hStartItem, (LPARAM)&mi);
- } else {
- //if(pol == OTRL_POLICY_MANUAL_MOD) {
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hStartItem, (LPARAM)&mi);
- mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hStopItem, (LPARAM)&mi);
- //} else { // should only be 'opportunistic'
- // goto hide_all;
- //}
- }
- }
-
- return 0;
-
-hide_all:
- mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hStopItem, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hStartItem, (LPARAM)&mi);
+ ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
+ TrustLevel encrypted = otr_context_get_trust(context);
+ Menu_ShowItem(hStartItem, encrypted == TRUST_NOT_PRIVATE);
+ Menu_ShowItem(hStopItem, encrypted != TRUST_NOT_PRIVATE);
return 0;
}
\ No newline at end of file diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.h b/plugins/MirOTR/MirOTR/src/svcs_menu.h index 7dfc11a9ea..145a080be9 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_menu.h +++ b/plugins/MirOTR/MirOTR/src/svcs_menu.h @@ -5,7 +5,6 @@ INT_PTR SVC_StopOTR(WPARAM wParam, LPARAM lParam); INT_PTR SVC_VerifyOTR(WPARAM wParam, LPARAM lParam);
int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
void InitMenu();
-void DeinitMenu();
#define MS_OTR_MENUSTART MODULENAME"/Start"
#define MS_OTR_MENUSTOP MODULENAME"/Stop"
diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp index ed17aa29ab..030a534b28 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp @@ -40,7 +40,7 @@ int SVC_IconPressed(WPARAM wParam, LPARAM lParam) { if(strcmp(sicd->szModule, MODULENAME) == 0) {
char *proto = GetContactProto(hContact);
- if(proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0))
+ if(proto && db_get_b(hContact, proto, "ChatRoom", 0))
return 0;
ShowOTRMenu(hContact, sicd->clickLocation);
/*
@@ -146,9 +146,9 @@ void SetEncryptionStatus(HANDLE hContact, TrustLevel level) { //strcat(dbg_msg, (encrypted ? "true" : "false"));
char *proto = GetContactProto(hContact);
- bool chat_room = (proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0));
+ bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0));
- // if (!chat_room) DBWriteContactSettingByte(hContact, MODULENAME, "Encrypted", (encrypted ? 1 : 0));
+ // if (!chat_room) db_set_b(hContact, MODULENAME, "Encrypted", (encrypted ? 1 : 0));
if(options.bHaveSRMMIcons || options.bHaveButtonsBar) {
//strcat(dbg_msg, "\nchanging icon");
@@ -226,7 +226,7 @@ int SVC_ButtonsBarPressed(WPARAM w, LPARAM l) { HANDLE hContact = (HANDLE)w;
char *proto = GetContactProto(hContact);
- if(proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0))
+ if(proto && db_get_b(hContact, proto, "ChatRoom", 0))
return 0;
ShowOTRMenu(hContact, cbcd->pt);
diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp index 7877065ccc..148934b9cc 100644 --- a/plugins/MirOTR/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/MirOTR/src/utils.cpp @@ -349,7 +349,7 @@ void ShowMessage(const HANDLE hContact, const TCHAR *msg) { /*
bool GetEncryptionStatus(HANDLE hContact) {
char *proto = GetContactProto(hContact);
- bool chat_room = (proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0));
+ bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0));
if (!chat_room) {
if (options.bHaveMetaContacts) {
@@ -358,7 +358,7 @@ bool GetEncryptionStatus(HANDLE hContact) { //strcat(dbg_msg, "\nrecursing for meta");
return GetEncryptionStatus(hMeta);
}
- return 0!=DBGetContactSettingByte(hContact, MODULENAME, "Encrypted", 0 );
+ return 0!=db_get_b(hContact, MODULENAME, "Encrypted", 0 );
}
}
return 0;
diff --git a/plugins/ModernOpt/src/modernopt.cpp b/plugins/ModernOpt/src/modernopt.cpp index 3f5a260687..47709d9ca3 100644 --- a/plugins/ModernOpt/src/modernopt.cpp +++ b/plugins/ModernOpt/src/modernopt.cpp @@ -687,7 +687,7 @@ void LoadModernOptsModule() // Unload module
void UnloadModernOptsModule()
{
- if(hwndModernOpt)
+ if (hwndModernOpt)
{
DestroyWindow(hwndModernOpt);
hwndModernOpt = 0;
diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp index bdc1a5ab5e..1319bd5c85 100644 --- a/plugins/MsgPopup/src/main.cpp +++ b/plugins/MsgPopup/src/main.cpp @@ -225,11 +225,11 @@ void LoadConfig() mir_snprintf(szNameFG, SIZEOF(szNameFG), "FG%d", indx);
mir_snprintf(szNameBG, SIZEOF(szNameBG), "BG%d", indx);
mir_snprintf(szNameTO, SIZEOF(szNameTO), "TO%d", indx);
- options.FG[indx] = DBGetContactSettingDword(NULL, SERVICENAME, szNameFG, optionsDefault.FG[indx]);
- options.BG[indx] = DBGetContactSettingDword(NULL, SERVICENAME, szNameBG, optionsDefault.BG[indx]);
- options.Timeout[indx] = DBGetContactSettingDword(NULL, SERVICENAME, szNameTO, (DWORD)optionsDefault.Timeout[indx]);
+ options.FG[indx] = db_get_dw(NULL, SERVICENAME, szNameFG, optionsDefault.FG[indx]);
+ options.BG[indx] = db_get_dw(NULL, SERVICENAME, szNameBG, optionsDefault.BG[indx]);
+ options.Timeout[indx] = db_get_dw(NULL, SERVICENAME, szNameTO, (DWORD)optionsDefault.Timeout[indx]);
}
- options.Sound = DBGetContactSettingByte(NULL, SERVICENAME, "Sound", (DWORD)optionsDefault.Sound);
+ options.Sound = db_get_b(NULL, SERVICENAME, "Sound", (DWORD)optionsDefault.Sound);
}
extern "C" __declspec(dllexport) int Load(void)
diff --git a/plugins/MsgPopup/src/options.cpp b/plugins/MsgPopup/src/options.cpp index 2b251b57ae..e9b5eca13d 100644 --- a/plugins/MsgPopup/src/options.cpp +++ b/plugins/MsgPopup/src/options.cpp @@ -30,10 +30,10 @@ int idOptionControls[4][3] = { static int __inline DBWriteContactSettingDwordDef(HANDLE hContact,const char *szModule,const char *szSetting,DWORD val, DWORD defValue)
{
- if(val == DBGetContactSettingDword(hContact, szModule, szSetting, defValue))
+ if(val == db_get_dw(hContact, szModule, szSetting, defValue))
return 0;
else
- return DBWriteContactSettingDword(hContact, szModule, szSetting, val);
+ return db_set_dw(hContact, szModule, szSetting, val);
}
INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index a691f2da31..ca57895617 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -418,10 +418,10 @@ BOOL bApplyChanges( HWND hwndDlg ) if (_tcslen( szTemp) > 0 )
db_set_ts( hUser, MODULE, "FileName", szTemp );
else
- DBDeleteContactSetting( hUser, MODULE, "FileName" );
+ db_unset( hUser, MODULE, "FileName" );
if (sItem.iImage )
- DBDeleteContactSetting( hUser, MODULE, "EnableLog" ); // default is Enabled !!
+ db_unset( hUser, MODULE, "EnableLog" ); // default is Enabled !!
else
db_set_b( hUser, MODULE, "EnableLog",0);
}
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index f614520b28..b525503d2a 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -283,7 +283,7 @@ tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting {
tstring ret;
DBVARIANT dbv = {0};
- //DBGetContactSetting
+ //db_get
if ( !db_get_ws( hContact, szModule, szSetting, &dbv))
{
if (dbv.type != DBVT_WCHAR)
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index e38c23ce7e..f88fb35acf 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -411,7 +411,7 @@ TCHAR * Protocol::GetListeningTo() }
DBVARIANT dbv = {0};
- if ( DBGetContactSettingTString(NULL, name, "ListeningTo", &dbv))
+ if ( db_get_ts(NULL, name, "ListeningTo", &dbv))
{
lcopystr(listening_to, _T(""), SIZEOF(listening_to));
return listening_to;
@@ -536,7 +536,7 @@ void ProtocolArray::SetNicks(const TCHAR *nick) lstrcpyn(default_nick, nick, SIZEOF(default_nick));
- DBWriteContactSettingTString(0, MODULE_NAME, SETTING_DEFAULT_NICK, nick);
+ db_set_ts(0, MODULE_NAME, SETTING_DEFAULT_NICK, nick);
for ( int i = 0 ; i < buffer_len ; i++ )
buffer[i]->SetNick(default_nick);
@@ -556,11 +556,11 @@ void ProtocolArray::SetStatusMsgs(const TCHAR *message) void ProtocolArray::SetStatusMsgs(int status, const TCHAR *message)
{
- DBWriteContactSettingTString(NULL,"SRAway",StatusModeToDbSetting(status,"Msg"),message);
+ db_set_ts(NULL,"SRAway",StatusModeToDbSetting(status,"Msg"),message);
// Save default also
if ( !db_get_b(NULL,"SRAway",StatusModeToDbSetting(status,"UsePrev"),0))
- DBWriteContactSettingTString(NULL,"SRAway",StatusModeToDbSetting(status,"Default"),message);
+ db_set_ts(NULL,"SRAway",StatusModeToDbSetting(status,"Default"),message);
for ( int i = 0 ; i < buffer_len ; i++ )
if (buffer[i]->status == status)
@@ -570,7 +570,7 @@ void ProtocolArray::SetStatusMsgs(int status, const TCHAR *message) void ProtocolArray::GetDefaultNick()
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(0, MODULE_NAME, SETTING_DEFAULT_NICK, &dbv)) {
+ if ( !db_get_ts(0, MODULE_NAME, SETTING_DEFAULT_NICK, &dbv)) {
lstrcpyn(default_nick, dbv.ptszVal, SIZEOF(default_nick));
db_free(&dbv);
}
@@ -580,7 +580,7 @@ void ProtocolArray::GetDefaultNick() void ProtocolArray::GetDefaultAvatar()
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(0, "ContactPhoto", "File", &dbv)) {
+ if ( !db_get_ts(0, "ContactPhoto", "File", &dbv)) {
lstrcpyn(default_avatar_file, dbv.ptszVal, SIZEOF(default_avatar_file));
db_free(&dbv);
}
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index d71b93e4df..61b65eeb68 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -1559,7 +1559,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar data->get_status_messages = false;
data->showing_menu = false;
- data->protocol_number = DBGetContactSettingWord(NULL,"MyDetails","ProtocolNumber",0);
+ data->protocol_number = db_get_w(NULL,"MyDetails","ProtocolNumber",0);
if (data->protocol_number >= protocols->GetSize())
data->protocol_number = 0;
@@ -2341,7 +2341,7 @@ void SetStatusMessageRefreshTime(HWND hwnd) {
KillTimer(hwnd, ID_STATUSMESSAGE_TIMER);
- opts.refresh_status_message_timer = DBGetContactSettingWord(NULL,"MyDetails","RefreshStatusMessageTimer",12);
+ opts.refresh_status_message_timer = db_get_w(NULL,"MyDetails","RefreshStatusMessageTimer",12);
if (opts.refresh_status_message_timer > 0)
SetTimer(hwnd, ID_STATUSMESSAGE_TIMER, opts.refresh_status_message_timer * 1000, NULL);
}
@@ -2357,7 +2357,7 @@ INT_PTR PluginCommand_ShowNextProtocol(WPARAM wParam,LPARAM lParam) if (data->protocol_number >= protocols->GetSize())
data->protocol_number = 0;
- DBWriteContactSettingWord(NULL,"MyDetails","ProtocolNumber",data->protocol_number);
+ db_set_w(NULL,"MyDetails","ProtocolNumber",data->protocol_number);
data->recalc_rectangles = true;
@@ -2379,7 +2379,7 @@ INT_PTR PluginCommand_ShowPreviousProtocol(WPARAM wParam,LPARAM lParam) if (data->protocol_number < 0)
data->protocol_number = protocols->GetSize() - 1;
- DBWriteContactSettingWord(NULL,"MyDetails","ProtocolNumber",data->protocol_number);
+ db_set_w(NULL,"MyDetails","ProtocolNumber",data->protocol_number);
data->recalc_rectangles = true;
@@ -2413,7 +2413,7 @@ INT_PTR PluginCommand_ShowProtocol(WPARAM wParam,LPARAM lParam) MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLong(hwnd_frame, GWLP_USERDATA);
data->protocol_number = proto_num;
- DBWriteContactSettingWord(NULL,"MyDetails","ProtocolNumber",data->protocol_number);
+ db_set_w(NULL,"MyDetails","ProtocolNumber",data->protocol_number);
data->recalc_rectangles = true;
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index 8d7c95c0e3..b690c55478 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -229,7 +229,7 @@ int CheckMsgWnd(HANDLE hContact) szProto = GetContactProto(hContact);
contactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
- szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto?DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE):ID_STATUS_OFFLINE, GSMDF_TCHAR);
+ szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto?db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE):ID_STATUS_OFFLINE, GSMDF_TCHAR);
// vj: This code was added by preeze and it does not work:
// vlko: it maybe work with other plugins
diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 8df56a94e3..2bbe91f843 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -29,80 +29,80 @@ BOOL bWmNotify; int OptionsRead(void)
{
- options->bDisable = DBGetContactSettingByte(NULL, MODULE, OPT_DISABLE, FALSE);
- options->bPreview = DBGetContactSettingByte(NULL, MODULE, OPT_PREVIEW, TRUE);
- options->bMenuitem = DBGetContactSettingByte(NULL, MODULE, OPT_MENUITEM, FALSE);
- options->bDefaultColorMsg = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, FALSE);
- options->bDefaultColorUrl = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_URL, FALSE);
- options->bDefaultColorFile = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_FILE, FALSE);
- options->bDefaultColorOthers = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_OTHERS, FALSE);
- options->colBackMsg = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
- options->colTextMsg = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
- options->colBackUrl = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_URL, DEFAULT_COLBACK);
- options->colTextUrl = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLTEXT_URL, DEFAULT_COLTEXT);
- options->colBackFile = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_FILE, DEFAULT_COLBACK);
- options->colTextFile = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLTEXT_FILE, DEFAULT_COLTEXT);
- options->colBackOthers = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
- options->colTextOthers = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
- options->maskNotify = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKNOTIFY, DEFAULT_MASKNOTIFY);
- options->maskActL = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKACTL, DEFAULT_MASKACTL);
- options->maskActR = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKACTR, DEFAULT_MASKACTR);
- options->maskActTE = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKACTTE, DEFAULT_MASKACTE);
- options->bMsgWindowCheck = DBGetContactSettingByte(NULL, MODULE, OPT_MSGWINDOWCHECK, TRUE);
- options->bMsgReplyWindow = DBGetContactSettingByte(NULL, MODULE, OPT_MSGREPLYWINDOW, FALSE);
- options->bMergePopup = DBGetContactSettingByte(NULL, MODULE, OPT_MERGEPOPUP, TRUE);
- options->iDelayMsg = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
- options->iDelayUrl = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_URL, DEFAULT_DELAY);
- options->iDelayFile = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_FILE, DEFAULT_DELAY);
- options->iDelayOthers = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY);
+ options->bDisable = db_get_b(NULL, MODULE, OPT_DISABLE, FALSE);
+ options->bPreview = db_get_b(NULL, MODULE, OPT_PREVIEW, TRUE);
+ options->bMenuitem = db_get_b(NULL, MODULE, OPT_MENUITEM, FALSE);
+ options->bDefaultColorMsg = db_get_b(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, FALSE);
+ options->bDefaultColorUrl = db_get_b(NULL, MODULE, OPT_COLDEFAULT_URL, FALSE);
+ options->bDefaultColorFile = db_get_b(NULL, MODULE, OPT_COLDEFAULT_FILE, FALSE);
+ options->bDefaultColorOthers = db_get_b(NULL, MODULE, OPT_COLDEFAULT_OTHERS, FALSE);
+ options->colBackMsg = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
+ options->colTextMsg = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
+ options->colBackUrl = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_URL, DEFAULT_COLBACK);
+ options->colTextUrl = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_URL, DEFAULT_COLTEXT);
+ options->colBackFile = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_FILE, DEFAULT_COLBACK);
+ options->colTextFile = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_FILE, DEFAULT_COLTEXT);
+ options->colBackOthers = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
+ options->colTextOthers = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
+ options->maskNotify = (UINT)db_get_b(NULL, MODULE, OPT_MASKNOTIFY, DEFAULT_MASKNOTIFY);
+ options->maskActL = (UINT)db_get_b(NULL, MODULE, OPT_MASKACTL, DEFAULT_MASKACTL);
+ options->maskActR = (UINT)db_get_b(NULL, MODULE, OPT_MASKACTR, DEFAULT_MASKACTR);
+ options->maskActTE = (UINT)db_get_b(NULL, MODULE, OPT_MASKACTTE, DEFAULT_MASKACTE);
+ options->bMsgWindowCheck = db_get_b(NULL, MODULE, OPT_MSGWINDOWCHECK, TRUE);
+ options->bMsgReplyWindow = db_get_b(NULL, MODULE, OPT_MSGREPLYWINDOW, FALSE);
+ options->bMergePopup = db_get_b(NULL, MODULE, OPT_MERGEPOPUP, TRUE);
+ options->iDelayMsg = (int)db_get_dw(NULL, MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
+ options->iDelayUrl = (int)db_get_dw(NULL, MODULE, OPT_DELAY_URL, DEFAULT_DELAY);
+ options->iDelayFile = (int)db_get_dw(NULL, MODULE, OPT_DELAY_FILE, DEFAULT_DELAY);
+ options->iDelayOthers = (int)db_get_dw(NULL, MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY);
options->iDelayDefault = (int)DBGetContactSettingRangedWord(NULL, "PopUp", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
- options->bShowDate = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_DATE, TRUE);
- options->bShowTime = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_TIME, TRUE);
- options->bShowHeaders = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_HEADERS, TRUE);
- options->iNumberMsg = (BYTE)DBGetContactSettingByte(NULL, MODULE, OPT_NUMBER_MSG, TRUE);
- options->bShowON = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_ON, TRUE);
- options->bHideSend = DBGetContactSettingByte(NULL, MODULE, OPT_HIDESEND, TRUE);
- options->bNoRSS = DBGetContactSettingByte(NULL, MODULE, OPT_NORSS, FALSE);
- options->bReadCheck = DBGetContactSettingByte(NULL, MODULE, OPT_READCHECK, FALSE);
+ options->bShowDate = db_get_b(NULL, MODULE, OPT_SHOW_DATE, TRUE);
+ options->bShowTime = db_get_b(NULL, MODULE, OPT_SHOW_TIME, TRUE);
+ options->bShowHeaders = db_get_b(NULL, MODULE, OPT_SHOW_HEADERS, TRUE);
+ options->iNumberMsg = (BYTE)db_get_b(NULL, MODULE, OPT_NUMBER_MSG, TRUE);
+ options->bShowON = db_get_b(NULL, MODULE, OPT_SHOW_ON, TRUE);
+ options->bHideSend = db_get_b(NULL, MODULE, OPT_HIDESEND, TRUE);
+ options->bNoRSS = db_get_b(NULL, MODULE, OPT_NORSS, FALSE);
+ options->bReadCheck = db_get_b(NULL, MODULE, OPT_READCHECK, FALSE);
return 0;
}
int OptionsWrite(void)
{
- DBWriteContactSettingByte(NULL, MODULE, OPT_DISABLE, options->bDisable);
- DBWriteContactSettingByte(NULL, MODULE, OPT_PREVIEW, options->bPreview);
- DBWriteContactSettingByte(NULL, MODULE, OPT_MENUITEM, options->bMenuitem);
- DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, options->bDefaultColorMsg);
- DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_URL, options->bDefaultColorUrl);
- DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_FILE, options->bDefaultColorFile);
- DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_OTHERS, options->bDefaultColorOthers);
- DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_MESSAGE, (DWORD)options->colBackMsg);
- DBWriteContactSettingDword(NULL, MODULE, OPT_COLTEXT_MESSAGE, (DWORD)options->colTextMsg);
- DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_URL, (DWORD)options->colBackUrl);
- DBWriteContactSettingDword(NULL, MODULE, OPT_COLTEXT_URL, (DWORD)options->colTextUrl);
- DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_FILE, (DWORD)options->colBackFile);
- DBWriteContactSettingDword(NULL, MODULE, OPT_COLTEXT_FILE, (DWORD)options->colTextFile);
- DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_OTHERS, (DWORD)options->colBackOthers);
- DBWriteContactSettingDword(NULL, MODULE, OPT_COLTEXT_OTHERS, (DWORD)options->colTextOthers);
- DBWriteContactSettingByte(NULL, MODULE, OPT_MASKNOTIFY, (BYTE)options->maskNotify);
- DBWriteContactSettingByte(NULL, MODULE, OPT_MASKACTL, (BYTE)options->maskActL);
- DBWriteContactSettingByte(NULL, MODULE, OPT_MASKACTR, (BYTE)options->maskActR);
- DBWriteContactSettingByte(NULL, MODULE, OPT_MASKACTTE, (BYTE)options->maskActTE);
- DBWriteContactSettingByte(NULL, MODULE, OPT_MSGWINDOWCHECK, options->bMsgWindowCheck);
- DBWriteContactSettingByte(NULL, MODULE, OPT_MSGREPLYWINDOW, options->bMsgReplyWindow);
- DBWriteContactSettingByte(NULL, MODULE, OPT_MERGEPOPUP, options->bMergePopup);
- DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_MESSAGE, (DWORD)options->iDelayMsg);
- DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_URL, (DWORD)options->iDelayUrl);
- DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_FILE, (DWORD)options->iDelayFile);
- DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_OTHERS, (DWORD)options->iDelayOthers);
- DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_DATE, options->bShowDate);
- DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_TIME, options->bShowTime);
- DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_HEADERS, options->bShowHeaders);
- DBWriteContactSettingByte(NULL, MODULE, OPT_NUMBER_MSG, (BYTE)options->iNumberMsg);
- DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_ON, options->bShowON);
- DBWriteContactSettingByte(NULL, MODULE, OPT_HIDESEND, options->bHideSend);
- DBWriteContactSettingByte(NULL, MODULE, OPT_NORSS, options->bNoRSS);
- DBWriteContactSettingByte(NULL, MODULE, OPT_READCHECK, options->bReadCheck);
+ db_set_b(NULL, MODULE, OPT_DISABLE, options->bDisable);
+ db_set_b(NULL, MODULE, OPT_PREVIEW, options->bPreview);
+ db_set_b(NULL, MODULE, OPT_MENUITEM, options->bMenuitem);
+ db_set_b(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, options->bDefaultColorMsg);
+ db_set_b(NULL, MODULE, OPT_COLDEFAULT_URL, options->bDefaultColorUrl);
+ db_set_b(NULL, MODULE, OPT_COLDEFAULT_FILE, options->bDefaultColorFile);
+ db_set_b(NULL, MODULE, OPT_COLDEFAULT_OTHERS, options->bDefaultColorOthers);
+ db_set_dw(NULL, MODULE, OPT_COLBACK_MESSAGE, (DWORD)options->colBackMsg);
+ db_set_dw(NULL, MODULE, OPT_COLTEXT_MESSAGE, (DWORD)options->colTextMsg);
+ db_set_dw(NULL, MODULE, OPT_COLBACK_URL, (DWORD)options->colBackUrl);
+ db_set_dw(NULL, MODULE, OPT_COLTEXT_URL, (DWORD)options->colTextUrl);
+ db_set_dw(NULL, MODULE, OPT_COLBACK_FILE, (DWORD)options->colBackFile);
+ db_set_dw(NULL, MODULE, OPT_COLTEXT_FILE, (DWORD)options->colTextFile);
+ db_set_dw(NULL, MODULE, OPT_COLBACK_OTHERS, (DWORD)options->colBackOthers);
+ db_set_dw(NULL, MODULE, OPT_COLTEXT_OTHERS, (DWORD)options->colTextOthers);
+ db_set_b(NULL, MODULE, OPT_MASKNOTIFY, (BYTE)options->maskNotify);
+ db_set_b(NULL, MODULE, OPT_MASKACTL, (BYTE)options->maskActL);
+ db_set_b(NULL, MODULE, OPT_MASKACTR, (BYTE)options->maskActR);
+ db_set_b(NULL, MODULE, OPT_MASKACTTE, (BYTE)options->maskActTE);
+ db_set_b(NULL, MODULE, OPT_MSGWINDOWCHECK, options->bMsgWindowCheck);
+ db_set_b(NULL, MODULE, OPT_MSGREPLYWINDOW, options->bMsgReplyWindow);
+ db_set_b(NULL, MODULE, OPT_MERGEPOPUP, options->bMergePopup);
+ db_set_dw(NULL, MODULE, OPT_DELAY_MESSAGE, (DWORD)options->iDelayMsg);
+ db_set_dw(NULL, MODULE, OPT_DELAY_URL, (DWORD)options->iDelayUrl);
+ db_set_dw(NULL, MODULE, OPT_DELAY_FILE, (DWORD)options->iDelayFile);
+ db_set_dw(NULL, MODULE, OPT_DELAY_OTHERS, (DWORD)options->iDelayOthers);
+ db_set_b(NULL, MODULE, OPT_SHOW_DATE, options->bShowDate);
+ db_set_b(NULL, MODULE, OPT_SHOW_TIME, options->bShowTime);
+ db_set_b(NULL, MODULE, OPT_SHOW_HEADERS, options->bShowHeaders);
+ db_set_b(NULL, MODULE, OPT_NUMBER_MSG, (BYTE)options->iNumberMsg);
+ db_set_b(NULL, MODULE, OPT_SHOW_ON, options->bShowON);
+ db_set_b(NULL, MODULE, OPT_HIDESEND, options->bHideSend);
+ db_set_b(NULL, MODULE, OPT_NORSS, options->bNoRSS);
+ db_set_b(NULL, MODULE, OPT_READCHECK, options->bReadCheck);
return 0;
}
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 4a7dd0e047..29f6cc5c5a 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -741,7 +741,7 @@ void PlayChangeSound(HANDLE hContact, WORD oldStatus, WORD newStatus) db_free(&dbv);
}
else if (!db_get_b(0, "SkinSoundsOff", StatusList[Index(newStatus)].lpzSkinSoundName, 0) &&
- !DBGetContactSetting(0, "SkinSounds", StatusList[Index(newStatus)].lpzSkinSoundName, &dbv))
+ !db_get(0, "SkinSounds", StatusList[Index(newStatus)].lpzSkinSoundName, &dbv))
{
strcpy(szSoundFile, StatusList[Index(newStatus)].lpzSkinSoundName);
db_free(&dbv);
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index f40fcec786..af83770a2d 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -67,35 +67,35 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l); void init_vars()
{
- bAppendTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bAppendTags", 0);
- bStripTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bStripTags", 0);
+ bAppendTags = db_get_b(NULL, szGPGModuleName, "bAppendTags", 0);
+ bStripTags = db_get_b(NULL, szGPGModuleName, "bStripTags", 0);
inopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("<GPGdec>"));
inclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("</GPGdec>"));
outopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("<GPGenc>"));
outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>"));
- bDebugLog = DBGetContactSettingByte(NULL, szGPGModuleName, "bDebugLog", 0);
- bAutoExchange = DBGetContactSettingByte(NULL, szGPGModuleName, "bAutoExchange", 0);
- bSameAction = DBGetContactSettingByte(NULL, szGPGModuleName, "bSameAction", 0);
+ bDebugLog = db_get_b(NULL, szGPGModuleName, "bDebugLog", 0);
+ bAutoExchange = db_get_b(NULL, szGPGModuleName, "bAutoExchange", 0);
+ bSameAction = db_get_b(NULL, szGPGModuleName, "bSameAction", 0);
password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
debuglog.init();
bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090001?true:false;
- bJabberAPI = DBGetContactSettingByte(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0);
- bPresenceSigning = DBGetContactSettingByte(NULL, szGPGModuleName, "bPresenceSigning", 0);
- bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 0);
- firstrun_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowX", 0);
- firstrun_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowY", 0);
- key_password_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "PasswordWindowX", 0);
- key_password_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "PasswordWindowY", 0);
- key_gen_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "KeyGenWindowX", 0);
- key_gen_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "KeyGenWindowY", 0);
- load_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowX", 0);
- load_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", 0);
- import_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "ImportKeyWindowX", 0);
- import_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "ImportKeyWindowY", 0);
- new_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowX", 0);
- new_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowY", 0);
- load_existing_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowX", 0);
- load_existing_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowY", 0);
+ bJabberAPI = db_get_b(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0);
+ bPresenceSigning = db_get_b(NULL, szGPGModuleName, "bPresenceSigning", 0);
+ bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0);
+ firstrun_rect.left = db_get_dw(NULL, szGPGModuleName, "FirstrunWindowX", 0);
+ firstrun_rect.top = db_get_dw(NULL, szGPGModuleName, "FirstrunWindowY", 0);
+ key_password_rect.left = db_get_dw(NULL, szGPGModuleName, "PasswordWindowX", 0);
+ key_password_rect.top = db_get_dw(NULL, szGPGModuleName, "PasswordWindowY", 0);
+ key_gen_rect.left = db_get_dw(NULL, szGPGModuleName, "KeyGenWindowX", 0);
+ key_gen_rect.top = db_get_dw(NULL, szGPGModuleName, "KeyGenWindowY", 0);
+ load_key_rect.left = db_get_dw(NULL, szGPGModuleName, "LoadKeyWindowX", 0);
+ load_key_rect.top = db_get_dw(NULL, szGPGModuleName, "LoadKeyWindowY", 0);
+ import_key_rect.left = db_get_dw(NULL, szGPGModuleName, "ImportKeyWindowX", 0);
+ import_key_rect.top = db_get_dw(NULL, szGPGModuleName, "ImportKeyWindowY", 0);
+ new_key_rect.left = db_get_dw(NULL, szGPGModuleName, "NewKeyWindowX", 0);
+ new_key_rect.top = db_get_dw(NULL, szGPGModuleName, "NewKeyWindowY", 0);
+ load_existing_key_rect.left = db_get_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowX", 0);
+ load_existing_key_rect.top = db_get_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowY", 0);
tabsrmm_used = isTabsrmmUsed();
bold_font = CreateFont(14, 0, 0, 0, 600, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, _T("Arial"));
}
@@ -120,7 +120,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) void InitCheck();
void FirstRun();
FirstRun();
- if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1))
+ if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1))
InitCheck();
InitIconLib();
if(ServiceExists(MS_MSG_ADDICON))
@@ -244,7 +244,7 @@ extern list<wstring> transfers; extern "C" int __declspec(dllexport) Unload(void)
{
// for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
-// DBDeleteContactSetting(hContact, szGPGModuleName, "KeyID_Prescense");
+// db_unset(hContact, szGPGModuleName, "KeyID_Prescense");
if(!transfers.empty())
{
for(list<wstring>::iterator p = transfers.begin(); p != transfers.end(); p++)
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 80a2b2837d..072b64a26e 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -323,21 +323,21 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); if(!strcmp(buf, Translate("Default"))) { - DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyMainName", name); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp); + db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); + db_set_ts(NULL, szGPGModuleName, "KeyMainName", name); + db_set_ts(NULL, szGPGModuleName, "KeyID", fp); } else { std::string acc_str = buf; acc_str += "_GPGPubKey"; - DBWriteContactSettingString(NULL, szGPGModuleName, acc_str.c_str(), out.c_str()); + db_set_s(NULL, szGPGModuleName, acc_str.c_str(), out.c_str()); acc_str = buf; acc_str += "_KeyMainName"; - DBWriteContactSettingTString(NULL, szGPGModuleName, acc_str.c_str(), name); + db_set_ts(NULL, szGPGModuleName, acc_str.c_str(), name); acc_str = buf; acc_str += "_KeyID"; - DBWriteContactSettingTString(NULL, szGPGModuleName, acc_str.c_str(), fp); + db_set_ts(NULL, szGPGModuleName, acc_str.c_str(), fp); } if(!strcmp(buf, Translate("Default"))) { @@ -357,7 +357,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR dbsetting += keyid; mir_free(keyid); dbsetting += "_Password"; - DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), passwd); + db_set_ts(NULL, szGPGModuleName, dbsetting.c_str(), passwd); } delete [] name; } @@ -500,33 +500,33 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); if(!strcmp(buf, Translate("Default"))) { - DBDeleteContactSetting(NULL, szGPGModuleName, "GPGPubKey"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyID"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyComment"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainName"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainEmail"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyType"); + db_unset(NULL, szGPGModuleName, "GPGPubKey"); + db_unset(NULL, szGPGModuleName, "KeyID"); + db_unset(NULL, szGPGModuleName, "KeyComment"); + db_unset(NULL, szGPGModuleName, "KeyMainName"); + db_unset(NULL, szGPGModuleName, "KeyMainEmail"); + db_unset(NULL, szGPGModuleName, "KeyType"); } else { std::string acc_str = buf; acc_str += "_GPGPubKey"; - DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str()); + db_unset(NULL, szGPGModuleName, acc_str.c_str()); acc_str = buf; acc_str += "_KeyMainName"; - DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str()); + db_unset(NULL, szGPGModuleName, acc_str.c_str()); acc_str = buf; acc_str += "_KeyID"; - DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str()); + db_unset(NULL, szGPGModuleName, acc_str.c_str()); acc_str = buf; acc_str += "_KeyComment"; - DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str()); + db_unset(NULL, szGPGModuleName, acc_str.c_str()); acc_str = buf; acc_str += "_KeyMainEmail"; - DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str()); + db_unset(NULL, szGPGModuleName, acc_str.c_str()); acc_str = buf; acc_str += "_KeyType"; - DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str()); + db_unset(NULL, szGPGModuleName, acc_str.c_str()); } } ListView_DeleteItem(hwndList, itemnum); @@ -628,17 +628,17 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); if(!strcmp(buf, Translate("Default"))) { - DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp); + db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); + db_set_ts(NULL, szGPGModuleName, "KeyID", fp); } else { std::string acc_str = buf; acc_str += "_GPGPubKey"; - DBWriteContactSettingString(NULL, szGPGModuleName, acc_str.c_str(), out.c_str()); + db_set_s(NULL, szGPGModuleName, acc_str.c_str(), out.c_str()); acc_str = buf; acc_str += "_KeyID"; - DBWriteContactSettingTString(NULL, szGPGModuleName, acc_str.c_str(), fp); + db_set_ts(NULL, szGPGModuleName, acc_str.c_str(), fp); } } extern HWND hwndCurKey_p; @@ -835,8 +835,8 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR case WM_DESTROY: { GetWindowRect(hwndDlg, &firstrun_rect); - DBWriteContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowX", firstrun_rect.left); - DBWriteContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowY", firstrun_rect.top); + db_set_dw(NULL, szGPGModuleName, "FirstrunWindowX", firstrun_rect.left); + db_set_dw(NULL, szGPGModuleName, "FirstrunWindowY", firstrun_rect.top); } hwndFirstRun = NULL; break; @@ -898,7 +898,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, bool bad_version = false; if(gpg_exists/* && lang_exists*/) { - DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); string out; DWORD code; std::vector<wstring> cmd; @@ -911,7 +911,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, gpg_valid = true; gpg_launcher(params); gpg_valid = false; - DBDeleteContactSetting(NULL, szGPGModuleName, "szGpgBinPath"); + db_unset(NULL, szGPGModuleName, "szGpgBinPath"); string::size_type p1 = out.find("(GnuPG) "); if(p1 != string::npos) { @@ -1023,7 +1023,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } { bool bad_version = false; - DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); string out; DWORD code; std::vector<wstring> cmd; @@ -1036,7 +1036,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, gpg_valid = true; gpg_launcher(params); gpg_valid = false; - DBDeleteContactSetting(NULL, szGPGModuleName, "szGpgBinPath"); + db_unset(NULL, szGPGModuleName, "szGpgBinPath"); string::size_type p1 = out.find("(GnuPG) "); if(p1 != string::npos) { @@ -1052,7 +1052,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if(bad_version) MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } - DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); while(tmp[_tcslen(tmp)-1] == '\\') tmp[_tcslen(tmp)-1] = '\0'; @@ -1061,7 +1061,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, MessageBox(0, TranslateT("please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; } - DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); + db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp); { TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); DWORD dwFileAttr = GetFileAttributes(path); @@ -1073,7 +1073,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, mir_free(path); } gpg_valid = true; - DBWriteContactSettingByte(NULL, szGPGModuleName, "FirstRun", 0); + db_set_b(NULL, szGPGModuleName, "FirstRun", 0); DestroyWindow(hwndDlg); ShowFirstRunDialog(); } @@ -1101,7 +1101,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } { bool bad_version = false; - DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); string out; DWORD code; std::vector<wstring> cmd; @@ -1114,7 +1114,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, gpg_valid = true; gpg_launcher(params); gpg_valid = false; - DBDeleteContactSetting(NULL, szGPGModuleName, "szGpgBinPath"); + db_unset(NULL, szGPGModuleName, "szGpgBinPath"); string::size_type p1 = out.find("(GnuPG) "); if(p1 != string::npos) { @@ -1130,7 +1130,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if(bad_version) MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } - DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); while(tmp[_tcslen(tmp)-1] == '\\') tmp[_tcslen(tmp)-1] = '\0'; @@ -1139,7 +1139,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, MessageBox(0, TranslateT("please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; } - DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); + db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp); { TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); DWORD dwFileAttr = GetFileAttributes(path); @@ -1239,15 +1239,15 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { out.erase(s, 1); } - DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", path.c_str()); + db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); + db_set_ts(NULL, szGPGModuleName, "KeyID", path.c_str()); extern HWND hwndCurKey_p; SetWindowText(hwndCurKey_p, path.c_str()); } } bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange"); gpg_valid = true; - DBWriteContactSettingByte(NULL, szGPGModuleName, "FirstRun", 0); + db_set_b(NULL, szGPGModuleName, "FirstRun", 0); DestroyWindow(hwndDlg); break; default: @@ -1296,7 +1296,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara TranslateDialogDefault(hwndDlg); TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); SetDlgItemText(hwndDlg, IDC_MESSAGE, tmp[0]?TranslateT("There is existing key for contact, would you like to replace with new key ?"):TranslateT("New public key was received, do you want to import it?")); - EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1); + EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1); SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0]?TranslateT("Replace"):TranslateT("Accept")); mir_free(tmp); tmp = new TCHAR [256]; @@ -1318,7 +1318,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara break; case IDC_IMPORT_AND_USE: ImportKey(); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1); void setSrmmIcon(HANDLE hContact); void setClistIcon(HANDLE hContact); setSrmmIcon(hContact); @@ -1350,8 +1350,8 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara case WM_DESTROY: { GetWindowRect(hwndDlg, &new_key_rect); - DBWriteContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowX", new_key_rect.left); - DBWriteContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowY", new_key_rect.top); + db_set_dw(NULL, szGPGModuleName, "NewKeyWindowX", new_key_rect.left); + db_set_dw(NULL, szGPGModuleName, "NewKeyWindowY", new_key_rect.top); } hwndNewKey = NULL; break; @@ -1653,8 +1653,8 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara case WM_DESTROY: { GetWindowRect(hwndDlg, &key_gen_rect); - DBWriteContactSettingDword(NULL, szGPGModuleName, "KeyGenWindowX", key_gen_rect.left); - DBWriteContactSettingDword(NULL, szGPGModuleName, "KeyGenWindowY", key_gen_rect.top); + db_set_dw(NULL, szGPGModuleName, "KeyGenWindowX", key_gen_rect.left); + db_set_dw(NULL, szGPGModuleName, "KeyGenWindowY", key_gen_rect.top); } hwndKeyGen = NULL; break; @@ -1902,8 +1902,8 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar case WM_DESTROY: { GetWindowRect(hwndDlg, &load_existing_key_rect); - DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowX", load_existing_key_rect.left); - DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowY", load_existing_key_rect.top); + db_set_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowX", load_existing_key_rect.left); + db_set_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowY", load_existing_key_rect.top); } hwndSelectExistingKey = NULL; break; @@ -1981,8 +1981,8 @@ static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wP case WM_DESTROY: { GetWindowRect(hwndDlg, &import_key_rect); - DBWriteContactSettingDword(NULL, szGPGModuleName, "ImportKeyWindowX", import_key_rect.left); - DBWriteContactSettingDword(NULL, szGPGModuleName, "ImportKeyWindowY", import_key_rect.top); + db_set_dw(NULL, szGPGModuleName, "ImportKeyWindowX", import_key_rect.left); + db_set_dw(NULL, szGPGModuleName, "ImportKeyWindowY", import_key_rect.top); } break; @@ -2048,7 +2048,7 @@ void ShowImportKeyDialog() void FirstRun() { DWORD pid = 0; - if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1)) + if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1)) return; ShowSetDirsDialog(); } @@ -2204,7 +2204,7 @@ void InitCheck() keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); void ShowFirstRunDialog(); - if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1) && (!keyid[0] || !key[0])) + if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1) && (!keyid[0] || !key[0])) { question = Translate("You didn't set a private key.\nWould you like to set it now?"); if(MessageBoxA(0, question.c_str(), Translate("Own private key warning"), MB_YESNO) == IDYES) @@ -2337,14 +2337,14 @@ void ImportKey() { hcnt = metaGetSubcontact(hContact, i); if(hcnt) - DBWriteContactSettingTString(hcnt, szGPGModuleName, "GPGPubKey", new_key.c_str()); + db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", new_key.c_str()); } } else - DBWriteContactSettingTString(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", new_key.c_str()); + db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", new_key.c_str()); } else - DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", new_key.c_str()); + db_set_ts(hContact, szGPGModuleName, "GPGPubKey", new_key.c_str()); new_key.clear(); { //gpg execute block std::vector<wstring> cmd; @@ -2396,7 +2396,7 @@ void ImportKey() char *tmp = NULL; string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); string::size_type s2 = output.find(":", s); - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); + db_set_s(hcnt, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); s = output.find("“", s2); if(s == string::npos) { @@ -2421,7 +2421,7 @@ void ImportKey() tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1)); strcpy(tmp, output.substr(s,s2-s-(uncommon?1:0)).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainName", tmp); + db_set_s(hcnt, szGPGModuleName, "KeyMainName", tmp); mir_free(tmp); } @@ -2437,7 +2437,7 @@ void ImportKey() tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1)); strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyComment", tmp); + db_set_s(hcnt, szGPGModuleName, "KeyComment", tmp); mir_free(tmp); s+=3; s2 = output.find(">", s); @@ -2446,7 +2446,7 @@ void ImportKey() tmp = (char*) mir_alloc(sizeof(char)*(output.substr(s,s2-s).length()+1)); strcpy(tmp, output.substr(s,s2-s).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", tmp); + db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", tmp); mir_free(tmp); } } @@ -2455,11 +2455,11 @@ void ImportKey() tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1)); strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); mir_free(tmp); } } - DBDeleteContactSetting(hcnt, szGPGModuleName, "bAlwatsTrust"); + db_unset(hcnt, szGPGModuleName, "bAlwatsTrust"); } } } @@ -2468,7 +2468,7 @@ void ImportKey() char *tmp = NULL; string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); string::size_type s2 = output.find(":", s); - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); s = output.find("“", s2); if(s == string::npos) { @@ -2493,7 +2493,7 @@ void ImportKey() tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1)); strcpy(tmp, output.substr(s,s2-s-(uncommon?1:0)).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", tmp); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", tmp); mir_free(tmp); } if((s = output.find(")", s2)) == string::npos) @@ -2508,7 +2508,7 @@ void ImportKey() tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1)); strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", tmp); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", tmp); mir_free(tmp); s+=3; s2 = output.find(">", s); @@ -2517,7 +2517,7 @@ void ImportKey() tmp = (char*) mir_alloc(sizeof(char)*(output.substr(s,s2-s).length()+1)); strcpy(tmp, output.substr(s,s2-s).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", tmp); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", tmp); mir_free(tmp); } } @@ -2526,11 +2526,11 @@ void ImportKey() tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1)); strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); mir_free(tmp); } } - DBDeleteContactSetting(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); + db_unset(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); } } else @@ -2538,7 +2538,7 @@ void ImportKey() char *tmp = NULL; string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); string::size_type s2 = output.find(":", s); - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); + db_set_s(hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); s = output.find("“", s2); if(s == string::npos) { @@ -2563,7 +2563,7 @@ void ImportKey() tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1)); strcpy(tmp, output.substr(s,s2-s-(uncommon?1:0)).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", tmp); + db_set_s(hContact, szGPGModuleName, "KeyMainName", tmp); mir_free(tmp); } if((s = output.find(")", s2)) == string::npos) @@ -2578,7 +2578,7 @@ void ImportKey() tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1)); strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", tmp); + db_set_s(hContact, szGPGModuleName, "KeyComment", tmp); mir_free(tmp); s+=3; s2 = output.find(">", s); @@ -2587,7 +2587,7 @@ void ImportKey() tmp = (char*) mir_alloc(sizeof(char)*(output.substr(s,s2-s).length()+1)); strcpy(tmp, output.substr(s,s2-s).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", tmp); + db_set_s(hContact, szGPGModuleName, "KeyMainEmail", tmp); mir_free(tmp); } } @@ -2596,11 +2596,11 @@ void ImportKey() tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1)); strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); mir_free(tmp); } } - DBDeleteContactSetting(hContact, szGPGModuleName, "bAlwatsTrust"); + db_unset(hContact, szGPGModuleName, "bAlwatsTrust"); } } ptmp = mir_wstrdup(toUTF16(output).c_str()); diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index b9c87a5595..7ad33d4cc6 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -55,13 +55,13 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, } else { - DBWriteContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); + db_set_b(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); setSrmmIcon(hContact); setClistIcon(hContact); } if(isContactHaveKey(hContact)) { - DBWriteContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); + db_set_b(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); setSrmmIcon(hContact); setClistIcon(hContact); } @@ -154,11 +154,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, { boost::filesystem::remove(path); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); - BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); return; } if(result == pxNotFound) @@ -183,11 +183,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, debuglog<<std::string(time_str()+": info: failed to decrypt messaage from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR))+" password needed, trying to get one"); if(_terminate) { - BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); break; } { //save inkey id @@ -195,7 +195,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, s = out.find(" ID ", s); s += strlen(" ID "); string::size_type s2 = out.find(",",s); - DBWriteContactSettingString(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); + db_set_s(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); } void ShowLoadKeyPasswordWindow(); new_key_hcnt_mutex.lock(); @@ -221,11 +221,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, { boost::filesystem::remove(path); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); - BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); return; } if(result == pxNotFound) @@ -240,11 +240,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, { boost::filesystem::remove(path); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); - BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); return; } if(result == pxNotFound) @@ -271,11 +271,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, char *tmp = (char*)mir_alloc(sizeof(char)*(str.length()+1)); strcpy(tmp, str.c_str()); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); - BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); mir_free(tmp); return; } @@ -308,11 +308,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, debuglog<<std::string(time_str()+": info: Failed to decrypt GPG encrypted message."); char *tmp = mir_strdup(str.c_str()); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); - BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); mir_free(tmp); return; } @@ -341,7 +341,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, } } } - if(DBGetContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 0)) + if(db_get_b(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 0)) { if(metaIsSubcontact(hContact)) { @@ -392,7 +392,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) if(bDebugLog) debuglog<<std::string(time_str()+": info(autoexchange): found pubkey block:"+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR))); s2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")); - DBWriteContactSettingTString(ccs->hContact, szGPGModuleName, "GPGPubKey", str.substr(s1,s2-s1).c_str()); + db_set_ts(ccs->hContact, szGPGModuleName, "GPGPubKey", str.substr(s1,s2-s1).c_str()); { //gpg execute block std::vector<wstring> cmd; TCHAR tmp2[MAX_PATH] = {0}; @@ -441,7 +441,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) char *tmp = NULL; string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); string::size_type s2 = output.find(":", s); - DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); + db_set_s(ccs->hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); s2+=2; s = output.find("“", s2); if(s == string::npos) @@ -458,7 +458,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) tmp = (char*)mir_alloc(output.substr(s,s2-s-1).length()+1); strcpy(tmp, output.substr(s,s2-s-1).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyMainName", tmp); + db_set_s(ccs->hContact, szGPGModuleName, "KeyMainName", tmp); mir_free(tmp); if((s = output.find(")", s2)) == string::npos) s = output.find(">", s2); @@ -470,14 +470,14 @@ int RecvMsgSvc(WPARAM w, LPARAM l) tmp = (char*)mir_alloc(output.substr(s2,s-s2).length()+1); strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyComment", tmp); + db_set_s(ccs->hContact, szGPGModuleName, "KeyComment", tmp); mir_free(tmp); s+=3; s2 = output.find(">", s); tmp = (char*)mir_alloc(output.substr(s,s2-s).length()+1); strcpy(tmp, output.substr(s,s2-s).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyMainEmail", tmp); + db_set_s(ccs->hContact, szGPGModuleName, "KeyMainEmail", tmp); mir_free(tmp); } else @@ -485,11 +485,11 @@ int RecvMsgSvc(WPARAM w, LPARAM l) tmp = (char*)mir_alloc(output.substr(s2,s-s2).length()+1); strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + db_set_s(ccs->hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); mir_free(tmp); } - DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 1); - DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "bAlwatsTrust", 1); + db_set_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 1); + db_set_b(ccs->hContact, szGPGModuleName, "bAlwatsTrust", 1); void setSrmmIcon(HANDLE); void setClistIcon(HANDLE); setSrmmIcon(ccs->hContact); @@ -541,14 +541,14 @@ int RecvMsgSvc(WPARAM w, LPARAM l) char *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); if(tmp[0]) { - int enc_state = DBGetContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 0); + int enc_state = db_get_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 0); if(enc_state) - DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 0); + db_set_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 0); string str = "-----PGP KEY RESPONSE-----"; str.append(tmp); CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)str.c_str()); if(enc_state) - DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 1); + db_set_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 1); } mir_free(tmp); return 0; @@ -556,7 +556,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) else if(!isContactHaveKey(ccs->hContact) && bAutoExchange && gpg_valid && gpg_keyexist) { char *proto = GetContactProto(ccs->hContact); - DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0); + DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0); if(uin) { char svc[64]; strcpy(svc, proto); @@ -645,7 +645,7 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) cmd.push_back(L"\"\""); cmd.push_back(L"--no-version"); } - if(DBGetContactSettingByte(hContact, szGPGModuleName, "bAlwaysTrust", 0)) + if(db_get_b(hContact, szGPGModuleName, "bAlwaysTrust", 0)) { cmd.push_back(L"--trust-model"); cmd.push_back(L"always"); @@ -696,7 +696,7 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) out.clear(); if(MessageBox(0, TranslateT("We trying to encrypt with untrusted key, do you want to trust this key permanently ?"), TranslateT("Warning"), MB_YESNO) == IDYES) { - DBWriteContactSettingByte(hContact, szGPGModuleName, "bAlwaysTrust", 1); + db_set_b(hContact, szGPGModuleName, "bAlwaysTrust", 1); std::vector<std::wstring> tmp; tmp.push_back(L"--trust-model"); tmp.push_back(L"always"); @@ -833,7 +833,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) debuglog<<std::string(time_str()+": info: checking for autoexchange possibility, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR))); void send_encrypted_msgs_thread(HANDLE hContact); LPSTR proto = GetContactProto(ccs->hContact); - DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0); + DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0); if(uin) { if(bDebugLog) @@ -959,7 +959,7 @@ int HookSendMsg(WPARAM w, LPARAM l) debuglog<<std::string(time_str()+": info: checking for autoexchange possibility, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR))); void send_encrypted_msgs_thread(HANDLE hContact); LPSTR proto = GetContactProto(hContact); - DWORD uin = DBGetContactSettingDword(hContact, proto, "UIN", 0); + DWORD uin = db_get_dw(hContact, proto, "UIN", 0); if(uin) { if(bDebugLog) @@ -1138,10 +1138,10 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam string dbsetting = "szKey_"; dbsetting += inkeyid; dbsetting += "_Password"; - DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp); + db_set_ts(NULL, szGPGModuleName, dbsetting.c_str(), tmp); } else - DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp); + db_set_ts(NULL, szGPGModuleName, "szKeyPassword", tmp); } if(password) mir_free(password); @@ -1182,8 +1182,8 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam case WM_DESTROY: { GetWindowRect(hwndDlg, &key_password_rect); - DBWriteContactSettingDword(NULL, szGPGModuleName, "PasswordWindowX", key_password_rect.left); - DBWriteContactSettingDword(NULL, szGPGModuleName, "PasswordWindowY", key_password_rect.top); + db_set_dw(NULL, szGPGModuleName, "PasswordWindowX", key_password_rect.left); + db_set_dw(NULL, szGPGModuleName, "PasswordWindowY", key_password_rect.top); } break; diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 3f378fa70f..26c7fd010e 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -25,7 +25,7 @@ static INT_PTR CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, BOOL CheckStateLoadDB(HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef) { - BOOL state = DBGetContactSettingByte(NULL, szGPGModuleName, szSetting, bDef); + BOOL state = db_get_b(NULL, szGPGModuleName, szSetting, bDef); CheckDlgButton(hwndDlg, idCtrl, state); return state; } @@ -33,7 +33,7 @@ BOOL CheckStateLoadDB(HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef BOOL CheckStateStoreDB(HWND hwndDlg, int idCtrl, const char* szSetting) { BOOL state = IsDlgButtonChecked(hwndDlg, idCtrl); - DBWriteContactSettingByte(NULL, szGPGModuleName, szSetting, (BYTE)state); + db_set_b(NULL, szGPGModuleName, szSetting, (BYTE)state); return state; } @@ -180,7 +180,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP mir_free(tmp2); ListView_SetItemText(hwndList, iRow, 3, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); - if(DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)) + if(db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)) ListView_SetCheckState(hwndList, iRow, 1); user_data[i] = hContact; ZeroMemory(&item,sizeof(item)); @@ -299,12 +299,12 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP hcnt = metaGetSubcontact(meta, i); if(hcnt) { - DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyID"); - DBDeleteContactSetting(hcnt, szGPGModuleName, "GPGPubKey"); - DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyMainName"); - DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyType"); - DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyMainEmail"); - DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyComment"); + db_unset(hcnt, szGPGModuleName, "KeyID"); + db_unset(hcnt, szGPGModuleName, "GPGPubKey"); + db_unset(hcnt, szGPGModuleName, "KeyMainName"); + db_unset(hcnt, szGPGModuleName, "KeyType"); + db_unset(hcnt, szGPGModuleName, "KeyMainEmail"); + db_unset(hcnt, szGPGModuleName, "KeyComment"); setClistIcon(hcnt); setSrmmIcon(hcnt); } @@ -312,24 +312,24 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP } else { - DBDeleteContactSetting(hContact, szGPGModuleName, "KeyID"); - DBDeleteContactSetting(hContact, szGPGModuleName, "GPGPubKey"); - DBDeleteContactSetting(hContact, szGPGModuleName, "KeyMainName"); - DBDeleteContactSetting(hContact, szGPGModuleName, "KeyType"); - DBDeleteContactSetting(hContact, szGPGModuleName, "KeyMainEmail"); - DBDeleteContactSetting(hContact, szGPGModuleName, "KeyComment"); + db_unset(hContact, szGPGModuleName, "KeyID"); + db_unset(hContact, szGPGModuleName, "GPGPubKey"); + db_unset(hContact, szGPGModuleName, "KeyMainName"); + db_unset(hContact, szGPGModuleName, "KeyType"); + db_unset(hContact, szGPGModuleName, "KeyMainEmail"); + db_unset(hContact, szGPGModuleName, "KeyComment"); setClistIcon(hContact); setSrmmIcon(hContact); } } else { - DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyID"); - DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "GPGPubKey"); - DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyMainName"); - DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyType"); - DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyMainEmail"); - DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyComment"); + db_unset(user_data[item_num+1], szGPGModuleName, "KeyID"); + db_unset(user_data[item_num+1], szGPGModuleName, "GPGPubKey"); + db_unset(user_data[item_num+1], szGPGModuleName, "KeyMainName"); + db_unset(user_data[item_num+1], szGPGModuleName, "KeyType"); + db_unset(user_data[item_num+1], szGPGModuleName, "KeyMainEmail"); + db_unset(user_data[item_num+1], szGPGModuleName, "KeyComment"); setClistIcon(user_data[item_num+1]); setSrmmIcon(user_data[item_num+1]); } @@ -440,9 +440,9 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP void setClistIcon(HANDLE hContact); void setSrmmIcon(HANDLE hContact); if(ListView_GetCheckState(hwndList, item_num)) - DBWriteContactSettingByte(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 1); + db_set_b(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 1); else - DBWriteContactSettingByte(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 0); + db_set_b(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 0); setClistIcon(user_data[item_num+1]); setSrmmIcon(user_data[item_num+1]); } @@ -457,18 +457,18 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(bDebugLog) debuglog.init(); bJabberAPI = CheckStateStoreDB(hwndDlg, IDC_JABBER_API, "bJabberAPI"); - bool old_bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 0); + bool old_bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0); bFileTransfers = CheckStateStoreDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers"); if(bFileTransfers != old_bFileTransfers) { - DBWriteContactSettingByte(NULL, szGPGModuleName, "bSameAction", 0); + db_set_b(NULL, szGPGModuleName, "bSameAction", 0); bSameAction = false; } bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange"); { TCHAR tmp[512]; GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, 512); - DBWriteContactSettingTString(NULL, szGPGModuleName, "szLogFilePath", tmp); + db_set_ts(NULL, szGPGModuleName, "szLogFilePath", tmp); } return TRUE; } @@ -516,7 +516,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { bool bad_version = false; TCHAR *tmp_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("")); - DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); string out; DWORD code; std::vector<wstring> cmd; @@ -527,7 +527,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, params.code = &code; params.result = &result; gpg_launcher(params); - DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp_path); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp_path); mir_free(tmp_path); string::size_type p1 = out.find("(GnuPG) "); if(p1 != string::npos) @@ -593,11 +593,11 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { TCHAR tmp[512]; GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512); - DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); while(tmp[_tcslen(tmp)-1] == '\\') tmp[_tcslen(tmp)-1] = '\0'; - DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); + db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp); return TRUE; } } @@ -660,22 +660,22 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { TCHAR tmp[128]; GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, 128); - DBWriteContactSettingTString(NULL, szGPGModuleName, "szInOpenTag", tmp); + db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp); mir_free(inopentag); inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); _tcscpy(inopentag, tmp); GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, 128); - DBWriteContactSettingTString(NULL, szGPGModuleName, "szInCloseTag", tmp); + db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp); mir_free(inclosetag); inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); _tcscpy(inclosetag, tmp); GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, 128); - DBWriteContactSettingTString(NULL, szGPGModuleName, "szOutOpenTag", tmp); + db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp); mir_free(outopentag); outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); _tcscpy(outopentag, tmp); GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, 128); - DBWriteContactSettingTString(NULL, szGPGModuleName, "szOutCloseTag", tmp); + db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp); mir_free(outclosetag); outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1)); _tcscpy(outclosetag, tmp); @@ -927,14 +927,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { hcnt = metaGetSubcontact(hContact, i); if(hcnt) - DBWriteContactSettingTString(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); + db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); } } else - DBWriteContactSettingTString(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); + db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); } else - DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); + db_set_ts(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); } tmp = (TCHAR*)mir_alloc(sizeof( TCHAR) * (key_buf.length()+1)); _tcscpy(tmp, key_buf.substr(ws1,ws2-ws1).c_str()); @@ -992,14 +992,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { hcnt = metaGetSubcontact(hContact, i); if(hcnt) - DBDeleteContactSetting(hcnt, szGPGModuleName, "bAlwatsTrust"); + db_unset(hcnt, szGPGModuleName, "bAlwatsTrust"); } } else - DBDeleteContactSetting(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); + db_unset(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); } else - DBDeleteContactSetting(hContact, szGPGModuleName, "bAlwatsTrust"); + db_unset(hContact, szGPGModuleName, "bAlwatsTrust"); } { TCHAR *tmp; @@ -1026,14 +1026,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { hcnt = metaGetSubcontact(hContact, i); if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyID", tmp2); + db_set_s(hcnt, szGPGModuleName, "KeyID", tmp2); } } else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", tmp2); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", tmp2); } else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID", tmp2); + db_set_s(hContact, szGPGModuleName, "KeyID", tmp2); } mir_free(tmp2); tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); @@ -1076,14 +1076,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { hcnt = metaGetSubcontact(hContact, i); if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + db_set_s(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); } } else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); } else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + db_set_s(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); } mir_free(tmp2); tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s-1)).c_str()); @@ -1114,14 +1114,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { hcnt = metaGetSubcontact(hContact, i); if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + db_set_s(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); } } else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); } else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + db_set_s(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); } mir_free(tmp2); s+=3; @@ -1141,14 +1141,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { hcnt = metaGetSubcontact(hContact, i); if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); } } else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); } else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); } mir_free(tmp2); tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); @@ -1173,14 +1173,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { hcnt = metaGetSubcontact(hContact, i); if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); } } else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); } else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); } mir_free(tmp2); tmp = mir_wstrdup(toUTF16(output.substr(s2,s-s2)).c_str()); @@ -1224,7 +1224,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { out.erase(s, 1); } - DBWriteContactSettingString(hContact, szGPGModuleName, "GPGPubKey", out.c_str()); + db_set_s(hContact, szGPGModuleName, "GPGPubKey", out.c_str()); } } tmp = mir_wstrdup(toUTF16(output).c_str()); @@ -1251,23 +1251,23 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam if(hcnt) { if(!isContactSecured(hcnt)) - DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", 1); + db_set_b(hcnt, szGPGModuleName, "GPGEncryption", 1); else - DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", 0); + db_set_b(hcnt, szGPGModuleName, "GPGEncryption", 0); setSrmmIcon(hContact); setClistIcon(hContact); } } } else if(!isContactSecured(hContact)) - DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); + db_set_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); else - DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); + db_set_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); } else if(!isContactSecured(hContact)) - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1); else - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); } } DestroyWindow(hwndDlg); @@ -1351,8 +1351,8 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam case WM_DESTROY: GetWindowRect(hwndDlg, &load_key_rect); - DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowX", load_key_rect.left); - DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); + db_set_dw(NULL, szGPGModuleName, "LoadKeyWindowX", load_key_rect.left); + db_set_dw(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); break; } diff --git a/plugins/New_GPG/src/srmm.cpp b/plugins/New_GPG/src/srmm.cpp index 6fc204a9a9..85e149214e 100755 --- a/plugins/New_GPG/src/srmm.cpp +++ b/plugins/New_GPG/src/srmm.cpp @@ -49,11 +49,11 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { void setSrmmIcon(HANDLE);
void setClistIcon(HANDLE);
bool isContactHaveKey(HANDLE hContact);
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
if(enc)
{
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- hMeta?DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 0):0;
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ hMeta?db_set_b(hMeta, szGPGModuleName, "GPGEncryption", 0):0;
setSrmmIcon(hContact);
setClistIcon(hContact);
}
@@ -70,16 +70,16 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { }
else
{
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1);
- hMeta?DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
+ hMeta?db_set_b(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
setSrmmIcon(hContact);
setClistIcon(hContact);
return 0;
}
if(isContactHaveKey(hContact))
{
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1);
- hMeta?DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
+ hMeta?db_set_b(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
setSrmmIcon(hContact);
setClistIcon(hContact);
}
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 82976fa50d..4dd31b3a1a 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -22,11 +22,11 @@ TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,c {
DBVARIANT dbv = {DBVT_DELETED};
TCHAR* szRes;
- if (DBGetContactSettingTString(hContact, szModule, szSetting, &dbv))
+ if (db_get_ts(hContact, szModule, szSetting, &dbv))
return mir_tstrdup(szDef);
if(dbv.pszVal)
szRes = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return szRes;
}
@@ -34,11 +34,11 @@ char* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,co {
DBVARIANT dbv = {DBVT_DELETED};
char* szRes;
- if (DBGetContactSettingString(hContact, szModule, szSetting, &dbv))
+ if (db_get_s(hContact, szModule, szSetting, &dbv))
return mir_strdup(szDef);
if(dbv.pszVal)
szRes = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return szRes;
}
@@ -66,7 +66,7 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx ofn.nMaxFileTitle=MAX_PATH;
if(!GetOpenFileName(&ofn))
return;
- DBWriteContactSettingTString(0, szGPGModuleName, szSetting, str);
+ db_set_ts(0, szGPGModuleName, szSetting, str);
}
TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool save_file)
@@ -119,7 +119,7 @@ void GetFolderPath(TCHAR *WindowTittle, char *szSetting) TCHAR path[MAX_PATH];
if (SHGetPathFromIDList(pidl, path))
{
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", path);
+ db_set_ts(NULL, szGPGModuleName, "szHomePath", path);
}
IMalloc * imalloc = 0;
if (SUCCEEDED(SHGetMalloc(&imalloc)))
@@ -169,8 +169,8 @@ INT_PTR SendKey(WPARAM w, LPARAM l) }
if(szMessage[0])
{
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)szMessage);
std::string msg = "Public key ";
char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, key_id_str.c_str(), "");
@@ -185,7 +185,7 @@ INT_PTR SendKey(WPARAM w, LPARAM l) mir_free(szMessage);
szMessage = mir_strdup(msg.c_str());
HistoryLog(hContact, db_event(szMessage, 0, 0, DBEF_SENT));
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc);
}
else
mir_free(szMessage);
@@ -199,9 +199,9 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) HANDLE hContact = (HANDLE)w;
BYTE enc = 0;
if(metaIsProtoMetaContacts(hContact))
- enc = DBGetContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0);
+ enc = db_get_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0);
else
- enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
if(metaIsProtoMetaContacts(hContact))
{
HANDLE hcnt = NULL;
@@ -212,13 +212,13 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) {
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", enc?0:1);
+ db_set_b(hcnt, szGPGModuleName, "GPGEncryption", enc?0:1);
}
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);
}
}
else
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);
void setSrmmIcon(HANDLE hContact);
void setClistIcon(HANDLE hContact);
setSrmmIcon(hContact);
@@ -267,12 +267,12 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM l) TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T(""));
if(_tcslen(tmp) < 1)
{
- DBDeleteContactSetting(hContact, szGPGModuleName, "GPGEncryption");
+ db_unset(hContact, szGPGModuleName, "GPGEncryption");
mi.flags += CMIM_FLAGS | CMIF_GRAYED;
}
else
mi.flags = CMIM_NAME | CMIM_FLAGS;
- mi.pszName = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?"Turn off GPG encryption":"Turn on GPG encryption";
+ mi.pszName = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)?"Turn off GPG encryption":"Turn on GPG encryption";
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggleEncryption, (LPARAM)&mi);
return 0;
}
@@ -401,9 +401,9 @@ int onProtoAck(WPARAM w, LPARAM l) s += strlen(" ID ");
string::size_type s2 = out.find(",",s);
if(metaIsProtoMetaContacts(ack->hContact))
- DBWriteContactSettingString(metaGetMostOnline(ack->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
+ db_set_s(metaGetMostOnline(ack->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
else
- DBWriteContactSettingString(ack->hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
+ db_set_s(ack->hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
}
void ShowLoadKeyPasswordWindow();
new_key_hcnt_mutex.lock();
@@ -490,7 +490,7 @@ std::wstring encrypt_file(HANDLE hContact, TCHAR *filename) TCHAR *file_out = new TCHAR [_tcslen(filename)+4];
mir_sntprintf(file_out, _tcslen(name)+7, _T("%s.gpg"), name);
cmd.push_back(szKeyid);
- if(DBGetContactSettingByte(hcnt, szGPGModuleName, "bAlwaysTrust", 0))
+ if(db_get_b(hcnt, szGPGModuleName, "bAlwaysTrust", 0))
{
cmd.push_back(L"--trust-model");
cmd.push_back(L"always");
@@ -518,7 +518,7 @@ std::wstring encrypt_file(HANDLE hContact, TCHAR *filename) out.clear();
if(MessageBox(0, TranslateT("We trying to encrypt with untrusted key, do you want to trust this key permanently ?"), TranslateT("Warning"), MB_YESNO) == IDYES)
{
- DBWriteContactSettingByte(hcnt, szGPGModuleName, "bAlwaysTrust", 1);
+ db_set_b(hcnt, szGPGModuleName, "bAlwaysTrust", 1);
std::vector<std::wstring> tmp;
tmp.push_back(L"--trust-model");
tmp.push_back(L"always");
@@ -541,7 +541,7 @@ int onSendFile(WPARAM w, LPARAM l) if(isContactSecured(ccs->hContact))
{
char *proto = GetContactProto(ccs->hContact);
- DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0);
+ DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0);
bool cap_found = false, supported_proto = false;
if(uin)
{
@@ -1072,7 +1072,7 @@ void AddHandlers() bool isContactSecured(HANDLE hContact)
{
- BYTE gpg_enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE gpg_enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
if(!gpg_enc)
{
if(bDebugLog)
@@ -1155,7 +1155,7 @@ bool isGPGValid() DWORD len = MAX_PATH;
if(gpg_exists)
{
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
string out;
DWORD code;
std::vector<wstring> cmd;
@@ -1206,7 +1206,7 @@ const bool StriStr(const char *str, const char *substr) bool IsOnline(HANDLE hContact)
{
- if(DBGetContactSettingByte(hContact, szGPGModuleName, "Status", 0) == ID_STATUS_OFFLINE)
+ if(db_get_b(hContact, szGPGModuleName, "Status", 0) == ID_STATUS_OFFLINE)
return false;
return true;
}
@@ -1354,7 +1354,7 @@ int handleEnum(const char *szSetting, LPARAM lParam) if(!*(bool*)lParam && szSetting[0] && StriStr(szSetting, "tabsrmm"))
{
bool f = false, *found = (bool*)lParam;
- f = !DBGetContactSettingByte(NULL, "PluginDisable", szSetting, 0);
+ f = !db_get_b(NULL, "PluginDisable", szSetting, 0);
if(f)
*found = f;
}
@@ -1810,7 +1810,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) tmp2 = (char*)mir_alloc((output.substr(s,s2-s).length()+1) * sizeof(char));
strcpy(tmp2, output.substr(s,s2-s).c_str());
mir_utf8decode(tmp2, 0);
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID", tmp2);
+ db_set_s(hContact, szGPGModuleName, "KeyID", tmp2);
mir_free(tmp2);
s = output.find("“", s2);
if(s == string::npos)
@@ -1831,7 +1831,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) mir_utf8decode(tmp2, 0);
if(hContact)
{
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
}
mir_free(tmp2);
if((s = output.find(")", s2)) == string::npos)
@@ -1845,7 +1845,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) strcpy(tmp2, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp2, 0);
if(hContact)
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
mir_free(tmp2);
s+=3;
s2 = output.find(">", s);
@@ -1853,7 +1853,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) strcpy(tmp2, output.substr(s,s2-s).c_str());
mir_utf8decode(tmp2, 0);
if(hContact)
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
mir_free(tmp2);
}
else
@@ -1862,12 +1862,12 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) strcpy(tmp2, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp2, 0);
if(hContact)
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
mir_free(tmp2);
}
}
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1);
- DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str());
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
+ db_set_ts(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str());
}
boost::filesystem::remove(path);
break;
@@ -1983,7 +1983,7 @@ static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARA case IDC_IGNORE:
if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
{
- DBWriteContactSettingByte(NULL, szGPGModuleName, "bSameAction", 1);
+ db_set_b(NULL, szGPGModuleName, "bSameAction", 1);
bSameAction = true;
}
DestroyWindow(hwndDlg);
@@ -1993,9 +1993,9 @@ static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARA file_msg_state = 1;
if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
{
- DBWriteContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 1);
+ db_set_b(NULL, szGPGModuleName, "bFileTransfers", 1);
bFileTransfers = true;
- DBWriteContactSettingByte(NULL, szGPGModuleName, "bSameAction", 0);
+ db_set_b(NULL, szGPGModuleName, "bSameAction", 0);
bSameAction = false;
}
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index 67555f686f..eb894a776b 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -63,13 +63,13 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HWND hwndList = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str));
db_set_ts(hContact, MODULE, "URL", str);
- DBWriteContactSettingByte(hContact, MODULE, "CheckState", 1);
- DBWriteContactSettingDword(hContact, MODULE, "UpdateTime", GetDlgItemInt(hwndDlg, IDC_CHECKTIME, false, false));
+ db_set_b(hContact, MODULE, "CheckState", 1);
+ db_set_dw(hContact, MODULE, "UpdateTime", GetDlgItemInt(hwndDlg, IDC_CHECKTIME, false, false));
GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str));
db_set_ts(hContact, MODULE, "MsgFormat", str);
db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0));
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
- DBWriteContactSettingByte(hContact, MODULE, "UseAuth", 1);
+ db_set_b(hContact, MODULE, "UseAuth", 1);
GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
db_set_ts(hContact, MODULE, "Login", str);
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
@@ -231,11 +231,11 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_ts(SelItem->hContact, MODULE, "URL", str);
GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str));
db_set_ts(SelItem->hContact, MODULE, "Nick", str);
- DBWriteContactSettingDword(SelItem->hContact, MODULE, "UpdateTime", GetDlgItemInt(hwndDlg, IDC_CHECKTIME, false, false));
+ db_set_dw(SelItem->hContact, MODULE, "UpdateTime", GetDlgItemInt(hwndDlg, IDC_CHECKTIME, false, false));
GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str));
db_set_ts(SelItem->hContact, MODULE, "MsgFormat", str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
- DBWriteContactSettingByte(SelItem->hContact, MODULE, "UseAuth", 1);
+ db_set_b(SelItem->hContact, MODULE, "UseAuth", 1);
GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
db_set_ts(SelItem->hContact, MODULE, "Login", str);
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
@@ -381,11 +381,11 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_ts(hContact, MODULE, "URL", str);
GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str));
db_set_ts(hContact, MODULE, "Nick", str);
- DBWriteContactSettingDword(hContact, MODULE, "UpdateTime", GetDlgItemInt(hwndDlg, IDC_CHECKTIME, false, false));
+ db_set_dw(hContact, MODULE, "UpdateTime", GetDlgItemInt(hwndDlg, IDC_CHECKTIME, false, false));
GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str));
db_set_ts(hContact, MODULE, "MsgFormat", str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
- DBWriteContactSettingByte(hContact, MODULE, "UseAuth", 1);
+ db_set_b(hContact, MODULE, "UseAuth", 1);
GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
db_set_ts(hContact, MODULE, "Login", str);
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
@@ -795,11 +795,11 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA {
if(IsMyContact(hContact))
{
- DBWriteContactSettingByte(hContact, MODULE, "CheckState", ListView_GetCheckState(hwndList, i));
+ db_set_b(hContact, MODULE, "CheckState", ListView_GetCheckState(hwndList, i));
if (!ListView_GetCheckState(hwndList, i))
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
else
- DBDeleteContactSetting(hContact,"CList","Hidden");
+ db_unset(hContact,"CList","Hidden");
i += 1;
}
hContact = db_find_next(hContact);
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index 9d72fe9077..d7efc461b6 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -819,7 +819,7 @@ VOID CheckCurrentFeed(HANDLE hContact) double deltaupd = difftime(time(NULL), stamp);
double deltacheck = difftime(time(NULL), db_get_dw(hContact, MODULE, "LastCheck", 0));
if (deltaupd - deltacheck >= 0) {
- DBWriteContactSettingDword(hContact, MODULE, "LastCheck", time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", time(NULL));
xi.destroyNode(hXml);
return;
}
@@ -1058,7 +1058,7 @@ VOID CheckCurrentFeed(HANDLE hContact) double deltaupd = difftime(time(NULL), stamp);
double deltacheck = difftime(time(NULL), db_get_dw(hContact, MODULE, "LastCheck", 0));
if (deltaupd - deltacheck >= 0) {
- DBWriteContactSettingDword(hContact, MODULE, "LastCheck", time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", time(NULL));
xi.destroyNode(hXml);
return;
}
@@ -1220,7 +1220,7 @@ VOID CheckCurrentFeed(HANDLE hContact) xi.destroyNode(hXml);
}
}
- DBWriteContactSettingDword(hContact, MODULE, "LastCheck", time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", time(NULL));
}
}
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index c2f571526e..babf696ccf 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -8,7 +8,8 @@ static void SrmmMenu_UpdateIcon(HANDLE hContact); static int SrmmMenu_ProcessEvent(WPARAM wParam, LPARAM lParam);
static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam);
-HANDLE hMenuToggle, hMenuClear, hServiceToggle, hServiceClear;
+HGENMENU hMenuToggle, hMenuClear;
+HANDLE hServiceToggle, hServiceClear;
CRITICAL_SECTION list_cs;
@@ -154,7 +155,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0);
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS|CMIF_TCHAR;
+ mi.flags = CMIM_FLAGS | CMIF_TCHAR;
if (chat_room) mi.flags |= CMIF_HIDDEN;
else {
mi.flags |= (CMIM_NAME | CMIM_ICON);
@@ -163,11 +164,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) }
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuToggle, (LPARAM)&mi);
- mi.flags = CMIM_FLAGS;
- if (chat_room || db_event_count(hContact) <= 0)
- mi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuClear, (LPARAM)&mi);
+ Menu_ShowItem(hMenuClear, !chat_room && db_event_count(hContact) > 0);
return 0;
}
@@ -283,9 +280,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.hIcon = hIconClear;
hMenuClear = Menu_AddMainMenuItem(&mi);
- // kill read events once in a minute
- // SetTimer(NULL, 0, 60000, TimerProc);
-
// add icon to srmm status icons
SrmmMenu_Load();
return 0;
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 002f7fe1ad..76a774f567 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -165,7 +165,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP }
else i = -1;
}
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv))
+ if (!db_get(hContact, "CList", "Group", &dbv))
SetDlgItemTextA(hwnd, IDC_GROUP, dbv.pszVal);
/* icons */
diff --git a/plugins/Non-IM Contact/src/services.cpp b/plugins/Non-IM Contact/src/services.cpp index d3aff868ba..b81372adb9 100644 --- a/plugins/Non-IM Contact/src/services.cpp +++ b/plugins/Non-IM Contact/src/services.cpp @@ -6,7 +6,7 @@ int db_get_static(HANDLE hContact, const char *szModule, const char *szSetting, char *value)
{
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, szModule, szSetting, &dbv))
+ if (!db_get(hContact, szModule, szSetting, &dbv))
{
strcpy(value, dbv.pszVal);
db_free(&dbv);
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index efd0dc77df..58e809738e 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -695,7 +695,7 @@ void PurgeNotes(void) for(I = 0; I < NotesCount; I++)
{
sprintf(ValueName, "NotesData%d", I);
- DBDeleteContactSetting(0,MODULENAME,ValueName);
+ db_unset(0,MODULENAME,ValueName);
}
}
@@ -957,7 +957,7 @@ static void JustSaveNotesEx(STICKYNOTE *pModified) for(; I < OldNotesCount; I++)
{
sprintf(ValueName, "NotesData%d", I);
- DBDeleteContactSetting(0,MODULENAME,ValueName);
+ db_unset(0,MODULENAME,ValueName);
}
NOTIFY_LIST();
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 3f3b889409..9ade55870f 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -216,7 +216,7 @@ static int FS_ColorChanged(WPARAM wParam, LPARAM lParam) LoadNRFont(NR_FONTID_CAPTION, &lfCaption, (COLORREF*)&CaptionFontColor);
LoadNRFont(NR_FONTID_BODY, &lfBody, (COLORREF*)&BodyFontColor);
- BodyColor = DBGetContactSettingDword(NULL, MODULENAME, colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
+ BodyColor = db_get_dw(NULL, MODULENAME, colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
SaveNotes();
LoadNotes(FALSE);
@@ -440,9 +440,9 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPar }
SetDlgItemText(hdlg,IDC_EDIT_ALTBROWSER,g_lpszAltBrowser ? g_lpszAltBrowser : _T(""));
if (g_lpszAltBrowser)
- DBWriteContactSettingString(0,MODULENAME,"AltBrowser",g_lpszAltBrowser);
+ db_set_s(0,MODULENAME,"AltBrowser",g_lpszAltBrowser);
else
- DBDeleteContactSetting(0,MODULENAME,"AltBrowser");
+ db_unset(0,MODULENAME,"AltBrowser");
WriteSettingInt(0,MODULENAME,"ShowNotesAtStart",g_ShowNotesAtStart);
WriteSettingInt(0,MODULENAME,"ShowNoteButtons",g_ShowNoteButtons);
@@ -593,7 +593,7 @@ void InitSettings(void) ReadSettingIntArray(0,MODULENAME,"NotesListGeom",g_notesListGeom,SIZEOF(g_notesListGeom));
ReadSettingIntArray(0,MODULENAME,"NotesListColGeom",g_notesListColGeom,SIZEOF(g_notesListColGeom));
- BodyColor = DBGetContactSettingDword(NULL, MODULENAME, colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
+ BodyColor = db_get_dw(NULL, MODULENAME, colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
InitFonts();
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 82f4d1aece..234aea3e6e 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -459,7 +459,7 @@ void JustSaveReminders(void) for(; I < OldReminderCount; I++)
{
sprintf(ValueName, "RemindersData%d", I);
- DBDeleteContactSetting(0,MODULENAME,ValueName);
+ db_unset(0,MODULENAME,ValueName);
}
}
@@ -852,10 +852,10 @@ static void SkinPlaySoundPoly(LPCSTR pszSoundName) return;
}
- if (DBGetContactSettingByte(NULL, "SkinSoundsOff", pszSoundName, 0)==0) {
+ if (db_get_b(NULL, "SkinSoundsOff", pszSoundName, 0)==0) {
DBVARIANT dbv;
- if (DBGetContactSettingString(NULL, "SkinSounds", pszSoundName, &dbv)==0) {
+ if (db_get_s(NULL, "SkinSounds", pszSoundName, &dbv)==0) {
char szFull[MAX_PATH];
PathToAbsolute(dbv.pszVal, szFull);
@@ -871,7 +871,7 @@ static void SkinPlaySoundPoly(LPCSTR pszSoundName) mciSendStringA(s, NULL, 0, NULL);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
diff --git a/plugins/NotifyAnything/src/options.cpp b/plugins/NotifyAnything/src/options.cpp index 5b02963ec7..69468f95e5 100644 --- a/plugins/NotifyAnything/src/options.cpp +++ b/plugins/NotifyAnything/src/options.cpp @@ -176,14 +176,14 @@ void load_settings() g_settings.port = db_get_dw(NULL, PlugName, "port", 12001);
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL, PlugName, "password", &dbv)) {
+ if(!db_get(NULL, PlugName, "password", &dbv)) {
g_settings.password = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(NULL, PlugName, "log_filename", &dbv)) {
+ if(!db_get(NULL, PlugName, "log_filename", &dbv)) {
g_settings.log_filename = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
g_settings.log_filename = g_mirandaDir + "\\"+LOG_ID+".log";
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index d94994b68a..73caaf1db3 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -31,8 +31,10 @@ PLUGININFOEX pluginInfo={ INT_PTR NudgeShowMenu(WPARAM wParam,LPARAM lParam)
{
for(NudgeElementList *n = NudgeList;n != NULL; n = n->next)
- if (!strcmp((char *) wParam,n->item.ProtocolName))
- return n->item.ShowContactMenu(lParam != 0);
+ if (!strcmp((char *) wParam,n->item.ProtocolName)) {
+ Menu_ShowItem(n->item.hContactMenu, lParam != 0);
+ break;
+ }
return 0;
}
@@ -40,7 +42,7 @@ INT_PTR NudgeShowMenu(WPARAM wParam,LPARAM lParam) INT_PTR NudgeSend(WPARAM wParam,LPARAM lParam)
{
char *protoName = GetContactProto((HANDLE)wParam);
- int diff = time(NULL) - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastSent", time(NULL)-30);
+ int diff = time(NULL) - db_get_dw((HANDLE) wParam, "Nudge", "LastSent", time(NULL)-30);
if(diff < GlobalNudge.sendTimeSec)
{
@@ -85,8 +87,8 @@ int NudgeReceived(WPARAM wParam,LPARAM lParam) DWORD currentTimestamp = time(NULL);
DWORD nudgeSentTimestamp = lParam ? (DWORD)lParam : currentTimestamp;
- int diff = currentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp-30);
- int diff2 = nudgeSentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived2", nudgeSentTimestamp-30);
+ int diff = currentTimestamp - db_get_dw((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp-30);
+ int diff2 = nudgeSentTimestamp - db_get_dw((HANDLE) wParam, "Nudge", "LastReceived2", nudgeSentTimestamp-30);
if(diff >= GlobalNudge.recvTimeSec)
db_set_dw((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp);
diff --git a/plugins/Nudge/src/nudge.cpp b/plugins/Nudge/src/nudge.cpp index 51b6af9824..5c83b6cfe9 100644 --- a/plugins/Nudge/src/nudge.cpp +++ b/plugins/Nudge/src/nudge.cpp @@ -4,7 +4,7 @@ void CNudge::Save(void) {
char SectionName[512];
mir_snprintf(SectionName,512,"useByProtocol");
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->useByProtocol);
+ db_set_b(NULL, "Nudge", SectionName, this->useByProtocol);
mir_snprintf(SectionName,512,"RecvTimeSec");
db_set_dw(NULL, "Nudge", SectionName, this->recvTimeSec);
mir_snprintf(SectionName,512,"SendTimeSec");
@@ -18,51 +18,42 @@ void CNudge::Load(void) {
char SectionName[512];
mir_snprintf(SectionName,512,"useByProtocol");
- this->useByProtocol = DBGetContactSettingByte(NULL, "Nudge", SectionName, FALSE) != 0;
+ this->useByProtocol = db_get_b(NULL, "Nudge", SectionName, FALSE) != 0;
mir_snprintf(SectionName,512,"RecvTimeSec");
- this->recvTimeSec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 30);
+ this->recvTimeSec = db_get_dw(NULL, "Nudge", SectionName, 30);
mir_snprintf(SectionName,512,"SendTimeSec");
- this->sendTimeSec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 30);
+ this->sendTimeSec = db_get_dw(NULL, "Nudge", SectionName, 30);
mir_snprintf(SectionName,512,"ResendDelaySec");
- this->resendDelaySec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 3);
-}
-
-int CNudgeElement::ShowContactMenu(bool show)
-{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = show? CMIM_FLAGS : CMIM_FLAGS | CMIF_HIDDEN ;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi);
-
- return 0;
+ this->resendDelaySec = db_get_dw(NULL, "Nudge", SectionName, 3);
}
void CNudgeElement::Save(void)
{
char SectionName[512];
mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->openMessageWindow);
+ db_set_b(NULL, "Nudge", SectionName, this->openMessageWindow);
mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->openContactList);
+ db_set_b(NULL, "Nudge", SectionName, this->openContactList);
mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->useIgnoreSettings);
+ db_set_b(NULL, "Nudge", SectionName, this->useIgnoreSettings);
mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->showStatus);
+ db_set_b(NULL, "Nudge", SectionName, this->showStatus);
mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->showPopup);
+ db_set_b(NULL, "Nudge", SectionName, this->showPopup);
mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->shakeClist);
+ db_set_b(NULL, "Nudge", SectionName, this->shakeClist);
mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->shakeChat);
+ db_set_b(NULL, "Nudge", SectionName, this->shakeChat);
mir_snprintf(SectionName,512,"%s-enabled", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->enabled);
+ db_set_b(NULL, "Nudge", SectionName, this->enabled);
mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->autoResend);
+ db_set_b(NULL, "Nudge", SectionName, this->autoResend);
mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName);
db_set_dw(NULL, "Nudge", SectionName, this->statusFlags);
mir_snprintf(SectionName,512,"%s-recText", ProtocolName);
- DBWriteContactSettingTString(NULL, "Nudge", SectionName, this->recText);
+ db_set_ts(NULL, "Nudge", SectionName, this->recText);
mir_snprintf(SectionName,512,"%s-senText", ProtocolName);
- DBWriteContactSettingTString(NULL, "Nudge", SectionName, this->senText);
+ db_set_ts(NULL, "Nudge", SectionName, this->senText);
}
@@ -71,42 +62,42 @@ void CNudgeElement::Load(void) DBVARIANT dbv;
char SectionName[512];
mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName);
- this->openMessageWindow = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->openMessageWindow = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName);
- this->openContactList = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->openContactList = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName);
- this->useIgnoreSettings = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->useIgnoreSettings = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName);
- this->showStatus = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->showStatus = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName);
- this->showPopup = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->showPopup = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName);
- this->shakeClist = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->shakeClist = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName);
- this->shakeChat = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->shakeChat = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-enabled", ProtocolName);
- this->enabled = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->enabled = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName);
- this->autoResend = DBGetContactSettingByte(NULL, "Nudge", SectionName, FALSE) != 0;
+ this->autoResend = db_get_b(NULL, "Nudge", SectionName, FALSE) != 0;
mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName);
- this->statusFlags = DBGetContactSettingDword(NULL, "Nudge", SectionName, 967);
+ this->statusFlags = db_get_dw(NULL, "Nudge", SectionName, 967);
mir_snprintf(SectionName,512,"%s-recText", ProtocolName);
- if (!DBGetContactSettingTString(NULL,"Nudge",SectionName,&dbv))
+ if (!db_get_ts(NULL,"Nudge",SectionName,&dbv))
{
_tcsncpy(this->recText,dbv.ptszVal,TEXT_LEN);
if(_tcsclen(this->recText) < 1)
_tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN);
mir_snprintf(SectionName,512,"%s-senText", ProtocolName);
- if (!DBGetContactSettingTString(NULL,"Nudge",SectionName,&dbv))
+ if (!db_get_ts(NULL,"Nudge",SectionName,&dbv))
{
_tcsncpy(this->senText,dbv.ptszVal,TEXT_LEN);
if(_tcsclen(this->senText) < 1)
_tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN);
diff --git a/plugins/Nudge/src/nudge.h b/plugins/Nudge/src/nudge.h index 8a531639ca..8a6c39e5d5 100644 --- a/plugins/Nudge/src/nudge.h +++ b/plugins/Nudge/src/nudge.h @@ -51,11 +51,10 @@ public: int iProtoNumber;
HANDLE hIcoLibItem;
HANDLE hEvent;
- HANDLE hContactMenu;
+ HGENMENU hContactMenu;
void Load(void);
void Save(void);
- int ShowContactMenu(bool show);
};
typedef struct NudgeElementList
diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp index 7976d8fe88..f1a4c4a46e 100644 --- a/plugins/Nudge/src/shake.cpp +++ b/plugins/Nudge/src/shake.cpp @@ -5,10 +5,10 @@ void CShake::Load(void) Shaking = false;
ShakingChat = false;
- nScaleClist = DBGetContactSettingDword(NULL, "Nudge", "ScaleClist", 5);
- nScaleChat = DBGetContactSettingDword(NULL, "Nudge", "ScaleChat", 2);
- nMoveClist = DBGetContactSettingDword(NULL, "Nudge", "MoveClist", 15);
- nMoveChat = DBGetContactSettingDword(NULL, "Nudge", "MoveChat", 15);
+ nScaleClist = db_get_dw(NULL, "Nudge", "ScaleClist", 5);
+ nScaleChat = db_get_dw(NULL, "Nudge", "ScaleChat", 2);
+ nMoveClist = db_get_dw(NULL, "Nudge", "MoveClist", 15);
+ nMoveChat = db_get_dw(NULL, "Nudge", "MoveChat", 15);
}
void CShake::Save(void)
{
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index 20ba80c0d7..facaec4b49 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -176,9 +176,9 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar static void __stdcall CreateDownloadDialog(void*)
{
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL,MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgDownloadPop);
- else if (DBGetContactSettingByte(NULL,MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
+ else if (db_get_b(NULL,MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
lstrcpyn(tszDialogMsg, Text, SIZEOF(tszDialogMsg));
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), NULL, DlgDownload);
}
@@ -195,11 +195,11 @@ void DlgDownloadProc() if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) {
Title = TranslateT("Pack Updater");
Text = TranslateT("An error occured while downloading the update.");
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(0, Title, Text, Number, 0);
}
- else if (DBGetContactSettingByte(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(NULL, Text, Title, MB_ICONSTOP);
}
CallFunctionAsync(DestroyDownloadDialog, 0);
@@ -402,7 +402,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam }
lstrcpyn(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer));
mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", todo[i].FileNum);
- DBWriteContactSettingTString(NULL, MODNAME, szKey, todo[i].tszCurVer);
+ db_set_ts(NULL, MODNAME, szKey, todo[i].tszCurVer);
arFileType.push_back(todo[i].FileType);
arFilePath.push_back(todo[i].File.tszDiskPath);
arFileName.push_back(tszFileName);
@@ -421,7 +421,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam INT rc = -1;
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && ServiceExists(MS_POPUP_REGISTERACTIONS) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL,MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "PopUp", "Actions", 0) & 1))
rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgMsgPop);
else
rc = MessageBox(NULL, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
@@ -436,7 +436,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam break;
case 1:
if (Reminder == 2)
- DBWriteContactSettingByte(NULL, MODNAME, "Reminder", 1);
+ db_set_b(NULL, MODNAME, "Reminder", 1);
memset(&si, 0, sizeof(STARTUPINFO));
memset(&pi, 0, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
@@ -499,16 +499,16 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam }
else { //reminder for not installed pack update
if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
- DBWriteContactSettingByte(NULL, MODNAME, "Reminder", 2);
+ db_set_b(NULL, MODNAME, "Reminder", 2);
mir_sntprintf(tszBuff, SIZEOF(tszBuff), TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
{
Number = 2;
show_popup(0, Title, Text, Number, 0);
}
- else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
}
}
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index 3460ef1dcb..3b16bb0565 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -65,7 +65,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA else {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
- CheckDlgButton(hwndDlg, (i+1029), (DBGetContactSettingByte(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, (i+1029), (db_get_b(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
}
}
return TRUE;
@@ -139,17 +139,17 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA InitTimer();
- DBWriteContactSettingByte(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup);
- DBWriteContactSettingByte(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay);
- DBWriteContactSettingByte(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod);
- DBWriteContactSettingDword(NULL, MODNAME, "Period", Period);
- DBWriteContactSettingByte(NULL, MODNAME, "PeriodMeasure", PeriodMeasure);
+ db_set_b(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup);
+ db_set_b(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay);
+ db_set_b(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod);
+ db_set_dw(NULL, MODNAME, "Period", Period);
+ db_set_b(NULL, MODNAME, "PeriodMeasure", PeriodMeasure);
Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
- DBWriteContactSettingByte(NULL, MODNAME, "Reminder", Reminder);
+ db_set_b(NULL, MODNAME, "Reminder", Reminder);
if ( !ServiceExists(MS_POPUP_ADDPOPUP)) {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
- DBWriteContactSettingByte(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029))));
+ db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029))));
}
}
}
@@ -212,14 +212,14 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
- CheckDlgButton(hdlg, (i+40071), (DBGetContactSettingByte(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
- CheckDlgButton(hdlg, (i+1024), (DBGetContactSettingByte(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i+40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i+1024), (db_get_b(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
if (IsDlgButtonChecked(hdlg, (i+40071)))
EnableWindow(GetDlgItem(hdlg, (i+1024)), FALSE);
else if (i > 0)
EnableWindow(GetDlgItem(hdlg, (i+1024)), TRUE);
}
- if (!(DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(NULL, "PopUp", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -227,7 +227,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) return TRUE;
}
case WM_SHOWWINDOW:
- if (!(DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(NULL, "PopUp", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -387,28 +387,28 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) ctlColor = SendDlgItemMessage(hdlg, (i+42071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorBack = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iBg", i);
- DBWriteContactSettingDword(NULL, MODNAME, szSetting, ctlColor);
+ db_set_dw(NULL, MODNAME, szSetting, ctlColor);
ctlColor = SendDlgItemMessage(hdlg, (i+41071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorText = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iTx", i);
- DBWriteContactSettingDword(NULL, MODNAME, szSetting, ctlColor);
+ db_set_dw(NULL, MODNAME, szSetting, ctlColor);
}
//Colors
- DBWriteContactSettingByte(NULL, MODNAME, "DefColors", MyOptions.DefColors);
+ db_set_b(NULL, MODNAME, "DefColors", MyOptions.DefColors);
//Timeout
MyOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, 0, TRUE);
- DBWriteContactSettingDword(NULL, MODNAME, "Timeout", MyOptions.Timeout);
+ db_set_dw(NULL, MODNAME, "Timeout", MyOptions.Timeout);
//Left mouse click
- DBWriteContactSettingByte(NULL, MODNAME, "LeftClickAction", MyOptions.LeftClickAction);
+ db_set_b(NULL, MODNAME, "LeftClickAction", MyOptions.LeftClickAction);
//Right mouse click
- DBWriteContactSettingByte(NULL, MODNAME, "RightClickAction", MyOptions.RightClickAction);
+ db_set_b(NULL, MODNAME, "RightClickAction", MyOptions.RightClickAction);
//Notified popups
for (i = 0; i < POPUPS; i++)
{
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
- DBWriteContactSettingByte(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
+ db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
- DBWriteContactSettingByte(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i+1024))));
+ db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i+1024))));
}
return TRUE;
} //case PSN_APPLY
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 3b322ab4be..5717178a6c 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -69,41 +69,41 @@ VOID InitPopupList() int index = 0;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups0Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups0Tx", COLOR_TX_DEFAULT);
index = 1;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups1Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups1Tx", COLOR_TX_DEFAULT);
index = 2;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups2Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups2Tx", COLOR_TX_DEFAULT);
index = 3;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups3Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups3Tx", COLOR_TX_DEFAULT);
}
VOID LoadOptions()
{
- MyOptions.DefColors = DBGetContactSettingByte(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
- MyOptions.LeftClickAction= DBGetContactSettingByte(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- MyOptions.RightClickAction = DBGetContactSettingByte(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- MyOptions.Timeout = DBGetContactSettingDword(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
- UpdateOnStartup = DBGetContactSettingByte(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- OnlyOnceADay = DBGetContactSettingByte(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- UpdateOnPeriod = DBGetContactSettingByte(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- Period = DBGetContactSettingDword(NULL, MODNAME, "Period", DEFAULT_PERIOD);
- PeriodMeasure = DBGetContactSettingByte(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- Reminder = DBGetContactSettingByte(NULL, MODNAME, "Reminder", DEFAULT_REMINDER);
- FileCount = DBGetContactSettingDword(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT);
+ MyOptions.DefColors = db_get_b(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
+ MyOptions.LeftClickAction= db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
+ MyOptions.RightClickAction = db_get_b(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
+ MyOptions.Timeout = db_get_dw(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
+ UpdateOnStartup = db_get_b(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
+ OnlyOnceADay = db_get_b(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
+ UpdateOnPeriod = db_get_b(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
+ Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD);
+ PeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
+ Reminder = db_get_b(NULL, MODNAME, "Reminder", DEFAULT_REMINDER);
+ FileCount = db_get_dw(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT);
}
BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
@@ -170,7 +170,7 @@ BOOL Exists(LPCTSTR strName) BOOL IsPluginDisabled(TCHAR* filename)
{
char* fname = mir_t2a(filename);
- int res = DBGetContactSettingByte(NULL, "PluginDisable", fname, 0);
+ int res = db_get_b(NULL, "PluginDisable", fname, 0);
mir_free(fname);
return res;
}
@@ -193,23 +193,23 @@ static void CheckUpdates(void *) if (!Exists(tszRoot))
CreateDirectory(tszRoot, NULL);
Files.clear();
- Reminder = DBGetContactSettingByte(NULL, MODNAME, "Reminder", DEFAULT_REMINDER);
- FileCount = DBGetContactSettingDword(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT);
+ Reminder = db_get_b(NULL, MODNAME, "Reminder", DEFAULT_REMINDER);
+ FileCount = db_get_dw(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT);
// Load files info
- DBGetContactSettingTString(NULL, MODNAME, "File_VersionURL", &dbVar);
+ db_get_ts(NULL, MODNAME, "File_VersionURL", &dbVar);
if (lstrcmp(dbVar.ptszVal, NULL) == 0)// URL is not set
{
Title=TranslateT("Pack Updater");
Text = TranslateT("URL for checking updates not found.");
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
{
Number = 1;
show_popup(0, Title, Text, Number, 0);
}
- else if (DBGetContactSettingByte(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(NULL, Text, Title, MB_ICONSTOP);
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
hCheckThread = NULL;
return;
}
@@ -235,20 +235,20 @@ static void CheckUpdates(void *) dbVar.ptszVal = NULL;
mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", CurrentFile + 1);
- DBGetContactSettingTString(NULL, MODNAME, szKey, &dbVar);
+ db_get_ts(NULL, MODNAME, szKey, &dbVar);
if (lstrcmp(dbVar.ptszVal, NULL) == 0)
{
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
lstrcpyn(FileInfo.tszCurVer, _T(""), SIZEOF(FileInfo.tszCurVer));
}
else
lstrcpyn(FileInfo.tszCurVer, dbVar.ptszVal, SIZEOF(FileInfo.tszCurVer));
dbVar.ptszVal = NULL;
mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1);
- DBGetContactSettingTString(NULL, MODNAME, szKey, &dbVar);
+ db_get_ts(NULL, MODNAME, szKey, &dbVar);
if (lstrcmp(dbVar.ptszVal, NULL) == 0)
{
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
lstrcpyn(FileInfo.tszLastVer, _T(""), SIZEOF(FileInfo.tszLastVer));
}
else
@@ -268,12 +268,12 @@ static void CheckUpdates(void *) {
Title = TranslateT("Pack Updater");
Text = TranslateT("Name of Update's file is not supported.");
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
{
Number = 1;
show_popup(0, Title, Text, Number, 0);
}
- else if (DBGetContactSettingByte(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
continue;
} // end check update name
@@ -352,7 +352,7 @@ static void CheckUpdates(void *) // Save last version
lstrcpyn(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, SIZEOF(Files[CurrentFile].tszLastVer));
mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1);
- DBWriteContactSettingTString(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer);
+ db_set_ts(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer);
} // user have admin's rights
mir_free(tszSysRoot);
mir_free(tszProgFiles);
@@ -372,24 +372,24 @@ static void CheckUpdates(void *) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No updates found.");
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
{
Number = 2;
show_popup(0, Title, Text, Number, 0);
}
- else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
}
if (!FileCount)
{
Title = TranslateT("Pack Updater");
Text = TranslateT("No files for update.");
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
{
Number = 2;
show_popup(0, Title, Text, Number, 0);
}
- else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
}
hCheckThread = NULL;
@@ -401,18 +401,18 @@ void DoCheck(int iFlag) {
Title = TranslateT("Pack Updater");
Text = TranslateT("Update checking already started!");
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
{
Number = 2;
show_popup(0, Title, Text, Number, 0);
}
- else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
}
else if (iFlag)
{
hCheckThread = mir_forkthread(CheckUpdates, 0);
- DBWriteContactSettingDword(NULL, MODNAME, "LastUpdate", time(NULL));
+ db_set_dw(NULL, MODNAME, "LastUpdate", time(NULL));
}
}
@@ -421,7 +421,7 @@ BOOL AllowUpdateOnStartup() if(OnlyOnceADay)
{
time_t now = time(NULL);
- time_t was = DBGetContactSettingDword(NULL, MODNAME, "LastUpdate", 0);
+ time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
if((now - was) < 86400)
return FALSE;
diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp index 6fc6439e40..a5c4fb5359 100644 --- a/plugins/PasteIt/src/Options.cpp +++ b/plugins/PasteIt/src/Options.cpp @@ -708,7 +708,7 @@ unsigned int Options::GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int void Options::SetDefWeb(int web)
{
defWeb = web;
- DBWriteContactSettingWString(0, MODULE, "defWeb", pasteToWebs[web]->GetName());
+ db_set_ws(0, MODULE, "defWeb", pasteToWebs[web]->GetName());
DefWebPageChanged();
}
@@ -785,11 +785,11 @@ int Options::InitOptions(WPARAM wParam, LPARAM lParam) void Options::Save()
{
- DBWriteContactSettingWString(0, MODULE, "defWeb", pasteToWebs[defWeb]->GetName());
- DBWriteContactSettingDword(0, MODULE, "codepage", codepage);
- DBWriteContactSettingByte(0, MODULE, "autoUTF", autoUTF ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "confDlg", confDlg ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "autoSend", autoSend ? 1 : 0);
+ db_set_ws(0, MODULE, "defWeb", pasteToWebs[defWeb]->GetName());
+ db_set_dw(0, MODULE, "codepage", codepage);
+ db_set_b(0, MODULE, "autoUTF", autoUTF ? 1 : 0);
+ db_set_b(0, MODULE, "confDlg", confDlg ? 1 : 0);
+ db_set_b(0, MODULE, "autoSend", autoSend ? 1 : 0);
for(int i = 0 ; i < PasteToWeb::pages; ++i)
{
char buf[256];
@@ -809,33 +809,33 @@ void Options::Save() forms += it->id + L'=' + it->name + L';';
}
- DBWriteContactSettingWString(0, MODULE, buf, forms.c_str());
+ db_set_ws(0, MODULE, buf, forms.c_str());
strcpy_s(buf + j, 256 - j, "defFormatId");
- DBWriteContactSettingWString(0, MODULE, buf, webOptions[i]->defFormatId.c_str());
+ db_set_ws(0, MODULE, buf, webOptions[i]->defFormatId.c_str());
if(webOptions[i]->isSendFileName)
{
strcpy_s(buf + j, 256 - j, "sendFileName");
- DBWriteContactSettingByte(0, MODULE, buf, webOptions[i]->sendFileName ? 1 : 0);
+ db_set_b(0, MODULE, buf, webOptions[i]->sendFileName ? 1 : 0);
}
if(webOptions[i]->isPublicPaste)
{
strcpy_s(buf + j, 256 - j, "publicPaste");
- DBWriteContactSettingByte(0, MODULE, buf, webOptions[i]->publicPaste ? 1 : 0);
+ db_set_b(0, MODULE, buf, webOptions[i]->publicPaste ? 1 : 0);
}
if(webOptions[i]->isCombo1)
{
strcpy_s(buf + j, 256 - j, "combo1");
- DBWriteContactSettingWString(0, MODULE, buf, webOptions[i]->combo1.c_str());
+ db_set_ws(0, MODULE, buf, webOptions[i]->combo1.c_str());
}
if(webOptions[i]->isPastebin)
{
strcpy_s(buf + j, 256 - j, "pastebinUserKey");
- DBWriteContactSettingWString(0, MODULE, buf, webOptions[i]->pastebinUserKey.c_str());
+ db_set_ws(0, MODULE, buf, webOptions[i]->pastebinUserKey.c_str());
}
}
}
@@ -843,7 +843,7 @@ void Options::Save() void Options::Load()
{
DBVARIANT defWebV;
- if(!DBGetContactSettingWString(0, MODULE, "defWeb", &defWebV))
+ if(!db_get_ws(0, MODULE, "defWeb", &defWebV))
{
for(int i = 0; i < PasteToWeb::pages; ++i)
{
@@ -853,12 +853,12 @@ void Options::Load() break;
}
}
- DBFreeVariant(&defWebV);
+ db_free(&defWebV);
}
- codepage = DBGetContactSettingDword(0, MODULE, "codepage", CP_ACP);
- autoUTF = DBGetContactSettingByte(0, MODULE, "autoUTF", 1) ? true : false;
- confDlg = DBGetContactSettingByte(0, MODULE, "confDlg", 1) ? true : false;
- autoSend = DBGetContactSettingByte(0, MODULE, "autoSend", 0) ? true : false;
+ codepage = db_get_dw(0, MODULE, "codepage", CP_ACP);
+ autoUTF = db_get_b(0, MODULE, "autoUTF", 1) ? true : false;
+ confDlg = db_get_b(0, MODULE, "confDlg", 1) ? true : false;
+ autoSend = db_get_b(0, MODULE, "autoSend", 0) ? true : false;
for(int i = 0 ; i < PasteToWeb::pages; ++i)
{
char buf[256];
@@ -873,7 +873,7 @@ void Options::Load() strcpy_s(buf + j, 256 - j, "formats");
DBVARIANT forms;
- if(!DBGetContactSettingWString(0, MODULE, buf, &forms))
+ if(!db_get_ws(0, MODULE, buf, &forms))
{
webOptions[i]->formats.clear();
int k = 0;
@@ -899,37 +899,37 @@ void Options::Load() ++k;
}
- DBFreeVariant(&forms);
+ db_free(&forms);
}
strcpy_s(buf + j, 256 - j, "defFormatId");
DBVARIANT defForm;
- if(!DBGetContactSettingWString(0, MODULE, buf, &defForm))
+ if(!db_get_ws(0, MODULE, buf, &defForm))
{
webOptions[i]->defFormatId = defForm.pwszVal;
- DBFreeVariant(&defForm);
+ db_free(&defForm);
}
if(webOptions[i]->isSendFileName)
{
strcpy_s(buf + j, 256 - j, "sendFileName");
- webOptions[i]->sendFileName = DBGetContactSettingByte(0, MODULE, buf, 1) ? true : false;
+ webOptions[i]->sendFileName = db_get_b(0, MODULE, buf, 1) ? true : false;
}
if(webOptions[i]->isPublicPaste)
{
strcpy_s(buf + j, 256 - j, "publicPaste");
- webOptions[i]->publicPaste = DBGetContactSettingByte(0, MODULE, buf, 0) ? true : false;
+ webOptions[i]->publicPaste = db_get_b(0, MODULE, buf, 0) ? true : false;
}
if(webOptions[i]->isCombo1)
{
strcpy_s(buf + j, 256 - j, "combo1");
DBVARIANT combo1;
- if(!DBGetContactSettingWString(0, MODULE, buf, &combo1))
+ if(!db_get_ws(0, MODULE, buf, &combo1))
{
webOptions[i]->combo1 = combo1.pwszVal;
- DBFreeVariant(&combo1);
+ db_free(&combo1);
}
}
@@ -937,10 +937,10 @@ void Options::Load() {
strcpy_s(buf + j, 256 - j, "pastebinUserKey");
DBVARIANT pastebinUserKey;
- if(!DBGetContactSettingWString(0, MODULE, buf, &pastebinUserKey))
+ if(!db_get_ws(0, MODULE, buf, &pastebinUserKey))
{
webOptions[i]->pastebinUserKey = pastebinUserKey.pwszVal;
- DBFreeVariant(&pastebinUserKey);
+ db_free(&pastebinUserKey);
}
}
}
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 7600d2a4bb..b2a5196a94 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -124,7 +124,7 @@ void PasteIt(HANDLE hContact, int mode) char *szProto = GetContactProto(hContact);
if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND)
{
- BOOL isChat = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
+ BOOL isChat = db_get_b(hContact, szProto, "ChatRoom", 0);
if(Options::instance->autoSend)
{
if(!isChat)
@@ -328,26 +328,17 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) char *szProto = GetContactProto((HANDLE)wParam);
if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND)
- bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) ? true : false;
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
-
- if (!bIsContact) mi.flags |= CMIF_HIDDEN;
- else mi.flags &= ~CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi);
+ bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) != 0;
+ Menu_ShowItem(hContactMenu, bIsContact);
return 0;
}
INT_PTR ContactMenuService(WPARAM wParam, LPARAM lParam)
{
if(lParam >= DEF_PAGES_START)
- {
Options::instance->SetDefWeb(lParam - DEF_PAGES_START);
- }
- else
- {
+ else {
HANDLE hContact = (HANDLE)wParam;
PasteIt(hContact, lParam);
}
@@ -437,7 +428,7 @@ int WindowEvent(WPARAM wParam, MessageWindowEventData* lParam) char *szProto = GetContactProto(lParam->hContact);
if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND)
{
- if(DBGetContactSettingByte(lParam->hContact, szProto, "ChatRoom", 0))
+ if(db_get_b(lParam->hContact, szProto, "ChatRoom", 0))
{
(*contactWindows)[lParam->hContact] = lParam->hwndInput;
}
diff --git a/plugins/Ping/src/icmp.cpp b/plugins/Ping/src/icmp.cpp index bdf8776d22..eeab3cf567 100644 --- a/plugins/Ping/src/icmp.cpp +++ b/plugins/Ping/src/icmp.cpp @@ -25,9 +25,9 @@ ICMP::ICMP(): if (hDLL == 0 || pIcmpCreateFile == 0 || pIcmpCloseHandle == 0 || pIcmpSendEcho2 == 0)
return;
else
- DBWriteContactSettingString(0, PLUG, "PingLib", "ICMP.DLL"); // for debugging
+ db_set_s(0, PLUG, "PingLib", "ICMP.DLL"); // for debugging
} else
- DBWriteContactSettingString(0, PLUG, "PingLib", "IPHLPAPI.DLL"); // for debugging
+ db_set_s(0, PLUG, "PingLib", "IPHLPAPI.DLL"); // for debugging
WSAData wsaData;
if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp index c95c49a910..ce4d90d752 100644 --- a/plugins/Ping/src/log.cpp +++ b/plugins/Ping/src/log.cpp @@ -31,13 +31,13 @@ INT_PTR Log(WPARAM wParam, LPARAM lParam) { INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) {
DBVARIANT dbv;
char *filename = (char *)lParam;
- if(DBGetContactSetting(0, PLUG, "LogFilename", &dbv)) {
+ if(db_get(0, PLUG, "LogFilename", &dbv)) {
CallService(MS_DB_GETPROFILEPATH, (WPARAM)wParam, (LPARAM)filename);
strcat(filename, "\\");
strcat(filename, "ping_log.txt");
} else {
strncpy(filename, dbv.pszVal, wParam);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
((char *)lParam)[wParam - 1] = 0;
@@ -46,7 +46,7 @@ INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) { }
INT_PTR SetLogFilename(WPARAM wParam, LPARAM lParam) {
- DBWriteContactSettingString(0, PLUG, "LogFilename", (char *)lParam);
+ db_set_s(0, PLUG, "LogFilename", (char *)lParam);
return 0;
}
diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index c4433e7a9d..34e93a4c0e 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -580,50 +580,50 @@ int PingOptInit(WPARAM wParam,LPARAM lParam) }
void LoadOptions() {
- options.ping_period = DBGetContactSettingDword(NULL, PLUG, "PingPeriod", DEFAULT_PING_PERIOD);
+ options.ping_period = db_get_dw(NULL, PLUG, "PingPeriod", DEFAULT_PING_PERIOD);
- options.ping_timeout = DBGetContactSettingDword(NULL, PLUG, "PingTimeout", DEFAULT_PING_TIMEOUT);
+ options.ping_timeout = db_get_dw(NULL, PLUG, "PingTimeout", DEFAULT_PING_TIMEOUT);
CallService(PLUG "/SetPingTimeout", (WPARAM)options.ping_timeout, 0);
- options.show_popup = (DBGetContactSettingByte(NULL, PLUG, "ShowPopup", DEFAULT_SHOW_POPUP ? 1 : 0) == 1);
- options.show_popup2 = (DBGetContactSettingByte(NULL, PLUG, "ShowPopup2", DEFAULT_SHOW_POPUP2 ? 1 : 0) == 1);
- options.block_reps = (DBGetContactSettingByte(NULL, PLUG, "BlockReps", DEFAULT_BLOCK_REPS ? 1 : 0) == 1);
- options.logging = (DBGetContactSettingByte(NULL, PLUG, "LoggingEnabled", DEFAULT_LOGGING_ENABLED ? 1 : 0) == 1);
+ options.show_popup = (db_get_b(NULL, PLUG, "ShowPopup", DEFAULT_SHOW_POPUP ? 1 : 0) == 1);
+ options.show_popup2 = (db_get_b(NULL, PLUG, "ShowPopup2", DEFAULT_SHOW_POPUP2 ? 1 : 0) == 1);
+ options.block_reps = (db_get_b(NULL, PLUG, "BlockReps", DEFAULT_BLOCK_REPS ? 1 : 0) == 1);
+ options.logging = (db_get_b(NULL, PLUG, "LoggingEnabled", DEFAULT_LOGGING_ENABLED ? 1 : 0) == 1);
- options.no_test_icon = (DBGetContactSettingByte(NULL, PLUG, "NoTestStatus", DEFAULT_NO_TEST_ICON ? 1 : 0) == 1);
+ options.no_test_icon = (db_get_b(NULL, PLUG, "NoTestStatus", DEFAULT_NO_TEST_ICON ? 1 : 0) == 1);
- options.indent = DBGetContactSettingWord(NULL, PLUG, "Indent", 0);
- options.row_height = DBGetContactSettingWord(NULL, PLUG, "RowHeight", GetSystemMetrics(SM_CYSMICON));
+ options.indent = db_get_w(NULL, PLUG, "Indent", 0);
+ options.row_height = db_get_w(NULL, PLUG, "RowHeight", GetSystemMetrics(SM_CYSMICON));
- options.retries = DBGetContactSettingDword(NULL, PLUG, "Retries", 0);
+ options.retries = db_get_dw(NULL, PLUG, "Retries", 0);
CallService(PLUG "/GetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename);
ICMP::get_instance()->set_timeout(options.ping_timeout * 1000);
- options.attach_to_clist = (DBGetContactSettingByte(NULL, PLUG, "AttachToClist", DEFAULT_ATTACH_TO_CLIST ? 1 : 0) == 1);
- options.log_csv = (DBGetContactSettingByte(NULL, PLUG, "LogCSV", 0) == 1);
+ options.attach_to_clist = (db_get_b(NULL, PLUG, "AttachToClist", DEFAULT_ATTACH_TO_CLIST ? 1 : 0) == 1);
+ options.log_csv = (db_get_b(NULL, PLUG, "LogCSV", 0) == 1);
}
void SaveOptions() {
- DBWriteContactSettingDword(NULL, PLUG, "PingPeriod", options.ping_period);
- DBWriteContactSettingDword(NULL, PLUG, "PingTimeout", options.ping_timeout);
+ db_set_dw(NULL, PLUG, "PingPeriod", options.ping_period);
+ db_set_dw(NULL, PLUG, "PingTimeout", options.ping_timeout);
CallService(PLUG "/SetPingTimeout", (WPARAM)options.ping_timeout, 0);
- DBWriteContactSettingByte(NULL, PLUG, "ShowPopup", options.show_popup ? 1 : 0);
- DBWriteContactSettingByte(NULL, PLUG, "ShowPopup2", options.show_popup2 ? 1 : 0);
- DBWriteContactSettingByte(NULL, PLUG, "BlockReps", options.block_reps ? 1 : 0);
- DBWriteContactSettingByte(NULL, PLUG, "LoggingEnabled", options.logging ? 1 : 0);
+ db_set_b(NULL, PLUG, "ShowPopup", options.show_popup ? 1 : 0);
+ db_set_b(NULL, PLUG, "ShowPopup2", options.show_popup2 ? 1 : 0);
+ db_set_b(NULL, PLUG, "BlockReps", options.block_reps ? 1 : 0);
+ db_set_b(NULL, PLUG, "LoggingEnabled", options.logging ? 1 : 0);
- DBWriteContactSettingByte(NULL, PLUG, "NoTestStatus", options.no_test_icon ? 1 : 0);
+ db_set_b(NULL, PLUG, "NoTestStatus", options.no_test_icon ? 1 : 0);
- DBWriteContactSettingWord(NULL, PLUG, "Indent", options.indent);
- DBWriteContactSettingWord(NULL, PLUG, "RowHeight", options.row_height);
+ db_set_w(NULL, PLUG, "Indent", options.indent);
+ db_set_w(NULL, PLUG, "RowHeight", options.row_height);
- DBWriteContactSettingDword(NULL, PLUG, "Retries", (DWORD)options.retries);
+ db_set_dw(NULL, PLUG, "Retries", (DWORD)options.retries);
CallService(PLUG "/SetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename);
ICMP::get_instance()->set_timeout(options.ping_timeout * 1000);
- DBWriteContactSettingByte(NULL, PLUG, "AttachToClist", options.attach_to_clist ? 1 : 0);
- DBWriteContactSettingByte(NULL, PLUG, "LogCSV", options.log_csv ? 1 : 0);
+ db_set_b(NULL, PLUG, "AttachToClist", options.attach_to_clist ? 1 : 0);
+ db_set_b(NULL, PLUG, "LogCSV", options.log_csv ? 1 : 0);
}
diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 7a2ba0a188..f107f5a9d3 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -101,10 +101,10 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { hFillListEvent = HookEvent(PLUG "/ListReload", FillList);
- if(!DBGetContactSettingByte(0, PLUG, "PingPlugImport", 0)) {
- if(DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0)) {
+ if(!db_get_b(0, PLUG, "PingPlugImport", 0)) {
+ if(db_get_dw(0, "PingPlug", "NumEntries", 0)) {
import_ping_addresses();
- DBWriteContactSettingByte(0, PLUG, "PingPlugImport", 1);
+ db_set_b(0, PLUG, "PingPlugImport", 1);
}
}
@@ -126,7 +126,7 @@ extern "C" __declspec(dllexport) int Load(void) //return 1;
use_raw_ping = false;
//}
- DBWriteContactSettingByte(0, PLUG, "UsingRawSockets", (BYTE)use_raw_ping);
+ db_set_b(0, PLUG, "UsingRawSockets", (BYTE)use_raw_ping);
DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 );
hWakeEvent = CreateEvent(NULL, FALSE, FALSE, _T("Local\\ThreadWaitEvent"));
diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp index c7edf260ef..b655cdc24f 100644 --- a/plugins/Ping/src/pinggraph.cpp +++ b/plugins/Ping/src/pinggraph.cpp @@ -243,7 +243,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar {
char buff[30];
sprintf(buff, "WindowHandle%d", wd->item_id);
- DBWriteContactSettingDword(0, PLUG, buff, 0);
+ db_set_dw(0, PLUG, buff, 0);
}
delete wd;
}
@@ -256,7 +256,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) {
char buff[30];
sprintf(buff, "WindowHandle%d", (DWORD)wParam);
- HWND hGraphWnd = (HWND)DBGetContactSettingDword(0, PLUG, buff, 0);
+ HWND hGraphWnd = (HWND)db_get_dw(0, PLUG, buff, 0);
if(hGraphWnd) {
ShowWindow(hGraphWnd, SW_SHOW);
SetWindowPos(hGraphWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -292,10 +292,10 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { wd->item_id = (DWORD)wParam; // wParam is destination id
wd->hwnd_chk_grid = 0;
wd->hwnd_chk_stat = 0;
- wd->show_grid = DBGetContactSettingByte(0, PLUG, "ShowGridLines", 0) ? true : false;
- wd->show_stat = DBGetContactSettingByte(0, PLUG, "ShowStats", 1) ? true : false;
+ wd->show_grid = db_get_b(0, PLUG, "ShowGridLines", 0) ? true : false;
+ wd->show_stat = db_get_b(0, PLUG, "ShowStats", 1) ? true : false;
- DBWriteContactSettingDword(0, PLUG, buff, (DWORD)hGraphWnd);
+ db_set_dw(0, PLUG, buff, (DWORD)hGraphWnd);
SetWindowLongPtr(hGraphWnd, GWLP_USERDATA, (LONG_PTR)wd);
@@ -316,11 +316,11 @@ void graphs_cleanup() { for(int i = 0; i < list_size; i++) {
sprintf(buff, "WindowHandle%d", i);
- if(hwnd = (HWND)DBGetContactSettingDword(0, PLUG, buff, 0)) {
+ if(hwnd = (HWND)db_get_dw(0, PLUG, buff, 0)) {
DestroyWindow(hwnd);
- DBWriteContactSettingDword(0, PLUG, buff, 0);
+ db_set_dw(0, PLUG, buff, 0);
sprintf(buff, "WindowWasOpen%d", i);
- DBWriteContactSettingByte(0, PLUG, buff, 1);
+ db_set_b(0, PLUG, buff, 1);
}
}
}
@@ -332,10 +332,10 @@ void graphs_init() { CallService(PLUG "/GetPingList", 0, (LPARAM)&pl);
for(pinglist_it i = pl.begin(); i != pl.end(); ++i) {
sprintf(buff, "WindowHandle%d", i->item_id); // clean up from possible crash
- DBWriteContactSettingDword(0, PLUG, buff, 0);
+ db_set_dw(0, PLUG, buff, 0);
sprintf(buff, "WindowWasOpen%d", i->item_id); // restore windows that were open on shutdown
- if(DBGetContactSettingByte(0, PLUG, buff, 0)) {
- DBWriteContactSettingByte(0, PLUG, buff, 0);
+ if(db_get_b(0, PLUG, buff, 0)) {
+ db_set_b(0, PLUG, buff, 0);
ShowGraph((WPARAM)i->item_id, (LPARAM)i->pszLabel);
}
}
diff --git a/plugins/Ping/src/pinglist.cpp b/plugins/Ping/src/pinglist.cpp index 45873da685..517e984490 100644 --- a/plugins/Ping/src/pinglist.cpp +++ b/plugins/Ping/src/pinglist.cpp @@ -61,26 +61,26 @@ void write_ping_address(PINGADDRESS &i) if(i.item_id == 0) {
i.item_id = NextID++;
- DBWriteContactSettingDword(0, PLUG, "NextID", NextID);
+ db_set_dw(0, PLUG, "NextID", NextID);
}
- DBWriteContactSettingDword(0, buff, "Id", i.item_id);
- DBWriteContactSettingString(0, buff, "Address", i.pszName);
- DBWriteContactSettingString(0, buff, "Label", i.pszLabel);
- DBWriteContactSettingWord(0, buff, "Status", i.status);
- DBWriteContactSettingDword(0, buff, "Port", i.port);
- DBWriteContactSettingString(0, buff, "Proto", i.pszProto);
+ db_set_dw(0, buff, "Id", i.item_id);
+ db_set_s(0, buff, "Address", i.pszName);
+ db_set_s(0, buff, "Label", i.pszLabel);
+ db_set_w(0, buff, "Status", i.status);
+ db_set_dw(0, buff, "Port", i.port);
+ db_set_s(0, buff, "Proto", i.pszProto);
if(strlen(i.pszCommand))
- DBWriteContactSettingString(0, buff, "Command", i.pszCommand);
+ db_set_s(0, buff, "Command", i.pszCommand);
else
- DBDeleteContactSetting(0, buff, "Command");
+ db_unset(0, buff, "Command");
if(strlen(i.pszParams))
- DBWriteContactSettingString(0, buff, "CommandParams", i.pszParams);
+ db_set_s(0, buff, "CommandParams", i.pszParams);
else
- DBDeleteContactSetting(0, buff, "CommandParams");
- DBWriteContactSettingWord(0, buff, "SetStatus", i.set_status);
- DBWriteContactSettingWord(0, buff, "GetStatus", i.get_status);
- DBWriteContactSettingWord(0, buff, "Index", i.index);
+ db_unset(0, buff, "CommandParams");
+ db_set_w(0, buff, "SetStatus", i.set_status);
+ db_set_w(0, buff, "GetStatus", i.get_status);
+ db_set_w(0, buff, "Index", i.index);
}
// call with list_cs locked
@@ -100,9 +100,9 @@ void write_ping_addresses() do {
found = false;
sprintf(buff, "PING_DEST_%d", index++);
- if(DBGetContactSettingDword(0, buff, "Id", 0) != 0) {
+ if(db_get_dw(0, buff, "Id", 0) != 0) {
found = true;
- DBWriteContactSettingDword(0, buff, "Id", 0);
+ db_set_dw(0, buff, "Id", 0);
}
} while(found);
}
@@ -114,52 +114,52 @@ bool read_ping_address(PINGADDRESS &pa) { sprintf(buff, "PING_DEST_%d", index);
// return if not more contacts, or only deleted contacts remaining
- if((pa.item_id = DBGetContactSettingDword(0, buff, "Id", 0)) == 0) return false;
+ if((pa.item_id = db_get_dw(0, buff, "Id", 0)) == 0) return false;
DBVARIANT dbv;
- if(!DBGetContactSetting(0, buff, "Address", &dbv)) {
+ if(!db_get(0, buff, "Address", &dbv)) {
strncpy(pa.pszName, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else return false;
- if(!DBGetContactSetting(0, buff, "Label", &dbv)) {
+ if(!db_get(0, buff, "Label", &dbv)) {
strncpy(pa.pszLabel, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else return false;
- pa.status = DBGetContactSettingWord(0, buff, "Status", PS_NOTRESPONDING);
+ pa.status = db_get_w(0, buff, "Status", PS_NOTRESPONDING);
if(pa.status != PS_DISABLED) pa.status = PS_NOTRESPONDING;
- pa.port = (int)DBGetContactSettingDword(0, buff, "Port", -1);
+ pa.port = (int)db_get_dw(0, buff, "Port", -1);
- if(!DBGetContactSetting(0, buff, "Proto", &dbv)) {
+ if(!db_get(0, buff, "Proto", &dbv)) {
strncpy(pa.pszProto, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else pa.pszProto[0] = '\0';
- if(!DBGetContactSetting(0, buff, "Command", &dbv)) {
+ if(!db_get(0, buff, "Command", &dbv)) {
strncpy(pa.pszCommand, dbv.pszVal, MAX_PATH);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
pa.pszCommand[0] = '\0';
- if(!DBGetContactSetting(0, buff, "CommandParams", &dbv)) {
+ if(!db_get(0, buff, "CommandParams", &dbv)) {
strncpy(pa.pszParams, dbv.pszVal, MAX_PATH);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
pa.pszParams[0] = '\0';
- pa.set_status = DBGetContactSettingWord(0, buff, "SetStatus", ID_STATUS_ONLINE);
- pa.get_status = DBGetContactSettingWord(0, buff, "GetStatus", ID_STATUS_OFFLINE);
+ pa.set_status = db_get_w(0, buff, "SetStatus", ID_STATUS_ONLINE);
+ pa.get_status = db_get_w(0, buff, "GetStatus", ID_STATUS_OFFLINE);
pa.responding = false;
pa.round_trip_time = 0;
pa.miss_count = 0;
- pa.index = DBGetContactSettingWord(0, buff, "Index", 0);
+ pa.index = db_get_w(0, buff, "Index", 0);
pa.index = index;
if(pa.item_id >= NextID) {
NextID = pa.item_id + 1;
- DBWriteContactSettingDword(0, PLUG, "NextID", NextID);
+ db_set_dw(0, PLUG, "NextID", NextID);
}
return true;
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index bf2e0053c8..41ed11239a 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -399,18 +399,18 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if((dis->itemState & ODS_SELECTED && dis->itemState & ODS_FOCUS)
|| (context_point_valid && (x >= dis->rcItem.left && x <= dis->rcItem.right) && (y >= dis->rcItem.top && y <= dis->rcItem.bottom)))
{
- tcol = DBGetContactSettingDword(NULL,"CLC","SelBkColour", GetSysColor(COLOR_HIGHLIGHT));
+ tcol = db_get_dw(NULL,"CLC","SelBkColour", GetSysColor(COLOR_HIGHLIGHT));
SetBkColor(dis->hDC, tcol);
FillRect(dis->hDC, &dis->rcItem, (ttbrush = CreateSolidBrush(tcol)));
- tcol = DBGetContactSettingDword(NULL,"CLC","SelTextColour", GetSysColor(COLOR_HIGHLIGHTTEXT));
+ tcol = db_get_dw(NULL,"CLC","SelTextColour", GetSysColor(COLOR_HIGHLIGHTTEXT));
SetTextColor(dis->hDC, tcol);
} else {
tcol = bk_col;
SetBkColor(dis->hDC, tcol);
FillRect(dis->hDC, &dis->rcItem, (ttbrush = CreateSolidBrush(tcol)));
- tcol = DBGetContactSettingDword(NULL, PLUG, "FontCol", GetSysColor(COLOR_WINDOWTEXT));
+ tcol = db_get_dw(NULL, PLUG, "FontCol", GetSysColor(COLOR_WINDOWTEXT));
SetTextColor(dis->hDC, tcol);
}
@@ -527,7 +527,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar (WS_VISIBLE | WS_CHILD | LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_NOTIFY)
& ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst,0);
- if (DBGetContactSettingByte(NULL,"CList","Transparent",0))
+ if (db_get_b(NULL,"CList","Transparent",0))
{
if(ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
@@ -536,7 +536,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
#endif
#ifdef LWA_ALPHA
- if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
#endif
}
}
@@ -551,15 +551,15 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_ACTIVATE:
if(wParam==WA_INACTIVE) {
if((HWND)wParam!=hwnd)
- if(DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT))
+ if(db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT))
if(transparentFocus)
SetTimer(hwnd, TM_AUTOALPHA,250,NULL);
}
else {
- if(DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) {
+ if(db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) {
KillTimer(hwnd,TM_AUTOALPHA);
#ifdef LWA_ALPHA
- if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
#endif
transparentFocus=1;
}
@@ -567,10 +567,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar return DefWindowProc(hwnd,msg,wParam,lParam);
case WM_SETCURSOR:
- if(DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) {
+ if(db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) {
if (!transparentFocus && GetForegroundWindow()!=hwnd && MySetLayeredWindowAttributes) {
#ifdef LWA_ALPHA
- MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
#endif
transparentFocus=1;
SetTimer(hwnd, TM_AUTOALPHA,250,NULL);
@@ -598,8 +598,8 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { //change
transparentFocus=inwnd;
#ifdef LWA_ALPHA
- if(transparentFocus) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
- else MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
+ if(transparentFocus) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ else MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
#endif
}
if(!transparentFocus) KillTimer(hwnd,TM_AUTOALPHA);
@@ -612,14 +612,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar static int noRecurse=0;
if(lParam) break;
if(noRecurse) break;
- if(!DBGetContactSettingByte(NULL,"CLUI","FadeInOut",0) || !IsWinVer2000Plus()) break;
+ if(!db_get_b(NULL,"CLUI","FadeInOut",0) || !IsWinVer2000Plus()) break;
#ifdef WS_EX_LAYERED
if(GetWindowLong(hwnd,GWL_EXSTYLE)&WS_EX_LAYERED) {
DWORD thisTick,startTick;
int sourceAlpha,destAlpha;
if(wParam) {
sourceAlpha=0;
- destAlpha=(BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_AUTOALPHA_DEFAULT);
+ destAlpha=(BYTE)db_get_b(NULL,"CList","Alpha",SETTING_AUTOALPHA_DEFAULT);
#ifdef LWA_ALPHA
MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), 0, LWA_ALPHA);
#endif
@@ -628,7 +628,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar noRecurse=0;
}
else {
- sourceAlpha=(BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_AUTOALPHA_DEFAULT);
+ sourceAlpha=(BYTE)db_get_b(NULL,"CList","Alpha",SETTING_AUTOALPHA_DEFAULT);
destAlpha=0;
}
for(startTick=GetTickCount();;) {
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index c87793fee8..9372f22eb0 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -240,30 +240,30 @@ void import_ping_address(int index, PINGADDRESS &pa) { DBVARIANT dbv;
char buf[256];
mir_snprintf(buf, 256, "Address%d", index);
- if(!DBGetContactSetting(0, "PingPlug", buf, &dbv)) {
+ if(!db_get(0, "PingPlug", buf, &dbv)) {
strncpy(pa.pszName, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
strcpy(pa.pszName, Translate("Unknown Address"));
mir_snprintf(buf, 256, "Label%d", index);
- if(!DBGetContactSetting(0, "PingPlug", buf, &dbv)) {
+ if(!db_get(0, "PingPlug", buf, &dbv)) {
strncpy(pa.pszLabel, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
strcpy(pa.pszLabel, Translate("Unknown"));
mir_snprintf(buf, 256, "Port%d", index);
- pa.port = (int)DBGetContactSettingDword(0, "PingPlug", buf, -1);
+ pa.port = (int)db_get_dw(0, "PingPlug", buf, -1);
mir_snprintf(buf, 256, "Proto%d", index);
- if(!DBGetContactSetting(0, "PingPlug", buf, &dbv)) {
+ if(!db_get(0, "PingPlug", buf, &dbv)) {
strncpy(pa.pszProto, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(buf, 256, "Status%d", index);
- pa.set_status = DBGetContactSettingWord(0, "PingPlug", buf, ID_STATUS_ONLINE);
+ pa.set_status = db_get_w(0, "PingPlug", buf, ID_STATUS_ONLINE);
mir_snprintf(buf, 256, "Status2%d", index);
- pa.get_status = DBGetContactSettingWord(0, "PingPlug", buf, ID_STATUS_OFFLINE);
+ pa.get_status = db_get_w(0, "PingPlug", buf, ID_STATUS_OFFLINE);
} else
pa.pszProto[0] = '\0';
@@ -277,7 +277,7 @@ void import_ping_address(int index, PINGADDRESS &pa) { pa.item_id = 0;
mir_snprintf(buf, 256, "Enabled%d", index);
- if(DBGetContactSettingByte(0, "PingPlug", buf, 1) == 1)
+ if(db_get_b(0, "PingPlug", buf, 1) == 1)
pa.status = PS_NOTRESPONDING;
else
pa.status = PS_DISABLED;
@@ -286,7 +286,7 @@ void import_ping_address(int index, PINGADDRESS &pa) { // read in addresses from old pingplug
void import_ping_addresses()
{
- int count = DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0);
+ int count = db_get_dw(0, "PingPlug", "NumEntries", 0);
PINGADDRESS pa;
EnterCriticalSection(&list_cs);
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index f0ffa25310..0ec714323c 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -163,9 +163,9 @@ int SafeCreateFilePath(TCHAR *pFolder); #if MIRANDA_VER < 0x0A00
-#define db_free(A) DBFreeVariant(A)
-#define db_get_b(A,B,C,D) DBGetContactSettingByte(A,B,C,D)
-#define db_set_s(A,B,C,D) DBWriteContactSettingString(A,B,C,D)
+#define db_free(A) db_free(A)
+#define db_get_b(A,B,C,D) db_get_b(A,B,C,D)
+#define db_set_s(A,B,C,D) db_set_s(A,B,C,D)
template<class T> class mir_ptr
{
diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp index 4e2eb89ca1..a82e0261b8 100644 --- a/plugins/PluginUpdater/src/Events.cpp +++ b/plugins/PluginUpdater/src/Events.cpp @@ -36,9 +36,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) opts.bSilent = true;
- int iRestartCount = DBGetContactSettingByte(NULL, MODNAME, "RestartCount", 2);
+ int iRestartCount = db_get_b(NULL, MODNAME, "RestartCount", 2);
if (iRestartCount > 0)
- DBWriteContactSettingByte(NULL, MODNAME, "RestartCount", iRestartCount-1);
+ db_set_b(NULL, MODNAME, "RestartCount", iRestartCount-1);
else
EmptyFolder(0, TRUE); // silently
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp index 1170b44f1e..0816172bf8 100644 --- a/plugins/PluginUpdater/src/Notifications.cpp +++ b/plugins/PluginUpdater/src/Notifications.cpp @@ -116,10 +116,10 @@ static void MakePopupAction(POPUPACTION &pa, int id) void ShowPopup(HWND hDlg, LPCTSTR ptszTitle, LPCTSTR ptszText, int Number, int ActType)
{
- if ( !ServiceExists(MS_POPUP_ADDPOPUP) || !DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) ) {
+ if ( !ServiceExists(MS_POPUP_ADDPOPUP) || !db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) ) {
char setting[100];
mir_snprintf(setting, SIZEOF(setting), "Popups%dM", Number);
- if (DBGetContactSettingByte(NULL, MODNAME, setting, DEFAULT_MESSAGE_ENABLED)) {
+ if (db_get_b(NULL, MODNAME, setting, DEFAULT_MESSAGE_ENABLED)) {
int iMsgType;
switch( Number ) {
case 1: iMsgType = MB_ICONSTOP; break;
@@ -372,7 +372,7 @@ LBL_Exit: SafeDeleteFile(p.File.tszDiskPath); // remove .zip after successful update
}
- DBWriteContactSettingByte(NULL, MODNAME, "RestartCount", 2);
+ db_set_b(NULL, MODNAME, "RestartCount", 2);
CallFunctionAsync(RestartMe, 0);
goto LBL_Exit;
}
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 32ef2068ab..35970f383c 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -60,7 +60,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA CheckDlgButton(hwndDlg, IDC_UPDATEICONS, opts.bUpdateIcons);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- if ( DBGetContactSettingString(NULL, MODNAME, "UpdateURL", &dbv)) {
+ if ( db_get_s(NULL, MODNAME, "UpdateURL", &dbv)) {
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
CheckDlgButton(hwndDlg, IDC_STABLE, TRUE);
}
@@ -147,13 +147,13 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA InitTimer();
- DBWriteContactSettingByte(NULL, MODNAME, "UpdateOnStartup", opts.bUpdateOnStartup);
- DBWriteContactSettingByte(NULL, MODNAME, "OnlyOnceADay", opts.bOnlyOnceADay);
- DBWriteContactSettingByte(NULL, MODNAME, "UpdateOnPeriod", opts.bUpdateOnPeriod);
- DBWriteContactSettingByte(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure);
- DBWriteContactSettingDword(NULL, MODNAME, "Period", opts.Period);
+ db_set_b(NULL, MODNAME, "UpdateOnStartup", opts.bUpdateOnStartup);
+ db_set_b(NULL, MODNAME, "OnlyOnceADay", opts.bOnlyOnceADay);
+ db_set_b(NULL, MODNAME, "UpdateOnPeriod", opts.bUpdateOnPeriod);
+ db_set_b(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure);
+ db_set_dw(NULL, MODNAME, "Period", opts.Period);
opts.bUpdateIcons = IsDlgButtonChecked(hwndDlg, IDC_UPDATEICONS);
- DBWriteContactSettingByte(NULL, MODNAME, "UpdateIcons", opts.bUpdateIcons);
+ db_set_b(NULL, MODNAME, "UpdateIcons", opts.bUpdateIcons);
if ( IsDlgButtonChecked(hwndDlg, IDC_STABLE))
db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL);
@@ -218,8 +218,8 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
- CheckDlgButton(hdlg, (i+40071), (DBGetContactSettingByte(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
- CheckDlgButton(hdlg, (i+1024), (DBGetContactSettingByte(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i+40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i+1024), (db_get_b(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
if (IsDlgButtonChecked(hdlg, (i+40071)))
EnableWindow(GetDlgItem(hdlg, (i+1024)), FALSE);
else if (i > 0)
@@ -359,27 +359,27 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) ctlColor = SendDlgItemMessage(hdlg, (i+42071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorBack = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iBg", i);
- DBWriteContactSettingDword(NULL, MODNAME, szSetting, ctlColor);
+ db_set_dw(NULL, MODNAME, szSetting, ctlColor);
ctlColor = SendDlgItemMessage(hdlg, (i+41071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorText = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iTx", i);
- DBWriteContactSettingDword(NULL, MODNAME, szSetting, ctlColor);
+ db_set_dw(NULL, MODNAME, szSetting, ctlColor);
}
//Colors
- DBWriteContactSettingByte(NULL, MODNAME, "DefColors", PopupOptions.DefColors);
+ db_set_b(NULL, MODNAME, "DefColors", PopupOptions.DefColors);
//Timeout
PopupOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, 0, TRUE);
- DBWriteContactSettingDword(NULL, MODNAME, "Timeout", PopupOptions.Timeout);
+ db_set_dw(NULL, MODNAME, "Timeout", PopupOptions.Timeout);
//Left mouse click
- DBWriteContactSettingByte(NULL, MODNAME, "LeftClickAction", PopupOptions.LeftClickAction);
+ db_set_b(NULL, MODNAME, "LeftClickAction", PopupOptions.LeftClickAction);
//Right mouse click
- DBWriteContactSettingByte(NULL, MODNAME, "RightClickAction", PopupOptions.RightClickAction);
+ db_set_b(NULL, MODNAME, "RightClickAction", PopupOptions.RightClickAction);
//Notified popups
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
- DBWriteContactSettingByte(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
+ db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
- DBWriteContactSettingByte(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i+1024))));
+ db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i+1024))));
}
return TRUE;
} //case PSN_APPLY
diff --git a/plugins/PluginUpdater/src/Scanner.cpp b/plugins/PluginUpdater/src/Scanner.cpp index bb9f7e339b..7855a12b7a 100644 --- a/plugins/PluginUpdater/src/Scanner.cpp +++ b/plugins/PluginUpdater/src/Scanner.cpp @@ -23,7 +23,7 @@ int CalculateModuleHash(const TCHAR *tszFileName, char *dest); static BYTE IsPluginDisabled(const char *filename)
{
- return DBGetContactSettingByte(NULL, "PluginDisable", filename, 0);
+ return db_get_b(NULL, "PluginDisable", filename, 0);
}
static bool Exists(LPCTSTR strName)
@@ -269,9 +269,9 @@ static void CheckUpdates(void *) tszTempPath[dwLen-1] = 0;
// Load files info
- if (DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar)) { // URL is not set
- DBWriteContactSettingTString(NULL, MODNAME, "UpdateURL", _T(DEFAULT_UPDATE_URL));
- DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar);
+ if (db_get_ts(NULL, MODNAME, "UpdateURL", &dbVar)) { // URL is not set
+ db_set_ts(NULL, MODNAME, "UpdateURL", _T(DEFAULT_UPDATE_URL));
+ db_get_ts(NULL, MODNAME, "UpdateURL", &dbVar);
}
REPLACEVARSARRAY vars[2];
@@ -287,7 +287,7 @@ static void CheckUpdates(void *) dat.dwFlags = RVF_TCHAR;
dat.variables = vars;
mir_ptr<TCHAR> tszBaseUrl((TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)dbVar.ptszVal, (LPARAM)&dat));
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
// Download version info
ShowPopup(NULL, TranslateT("Plugin Updater"), TranslateT("Downloading version info..."), 4, 0);
@@ -365,6 +365,6 @@ void DoCheck(int iFlag) }
else if (iFlag) {
hCheckThread = mir_forkthread(CheckUpdates, 0);
- DBWriteContactSettingDword(NULL, MODNAME, "LastUpdate", time(NULL));
+ db_set_dw(NULL, MODNAME, "LastUpdate", time(NULL));
}
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index bb2ee1380a..87f7cbedb7 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -85,41 +85,41 @@ void InitPopupList() int index = 0;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups0Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups0Tx", COLOR_TX_DEFAULT);
index = 1;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups1Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups1Tx", COLOR_TX_DEFAULT);
index = 2;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups2Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups2Tx", COLOR_TX_DEFAULT);
index = 3;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups3Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups3Tx", COLOR_TX_DEFAULT);
}
void LoadOptions()
{
- PopupOptions.DefColors = DBGetContactSettingByte(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
- PopupOptions.LeftClickAction= DBGetContactSettingByte(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- PopupOptions.RightClickAction = DBGetContactSettingByte(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- PopupOptions.Timeout = DBGetContactSettingDword(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
+ PopupOptions.DefColors = db_get_b(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
+ PopupOptions.LeftClickAction= db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
+ PopupOptions.RightClickAction = db_get_b(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
+ PopupOptions.Timeout = db_get_dw(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
- opts.bUpdateOnStartup = DBGetContactSettingByte(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- opts.bOnlyOnceADay = DBGetContactSettingByte(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- opts.bUpdateOnPeriod = DBGetContactSettingByte(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- opts.Period = DBGetContactSettingDword(NULL, MODNAME, "Period", DEFAULT_PERIOD);
- opts.bPeriodMeasure = DBGetContactSettingByte(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- opts.bUpdateIcons = DBGetContactSettingByte(NULL, MODNAME, "UpdateIcons", DEFAULT_UPDATEICONS);
+ opts.bUpdateOnStartup = db_get_b(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
+ opts.bOnlyOnceADay = db_get_b(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
+ opts.bUpdateOnPeriod = db_get_b(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
+ opts.Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD);
+ opts.bPeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
+ opts.bUpdateIcons = db_get_b(NULL, MODNAME, "UpdateIcons", DEFAULT_UPDATEICONS);
}
ULONG crc32_table[256];
@@ -252,7 +252,7 @@ BOOL AllowUpdateOnStartup() {
if (opts.bOnlyOnceADay) {
time_t now = time(NULL);
- time_t was = DBGetContactSettingDword(NULL, MODNAME, "LastUpdate", 0);
+ time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
if ((now - was) < 86400)
return FALSE;
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 1affca7df3..09f8b3d6fd 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -148,13 +148,13 @@ DWORD MouseOverride(HWND hCombo, int number) void LoadOption_Actions() {
- PopUpOptions.actions = DBGetContactSettingDword(NULL, MODULNAME, "Actions",
+ PopUpOptions.actions = db_get_dw(NULL, MODULNAME, "Actions",
ACT_ENABLE|ACT_RIGHTICONS|ACT_DEF_KEEPWND|ACT_DEF_IMONLY|
ACT_DEF_NOGLOBAL|ACT_DEF_MESSAGE|ACT_DEF_DETAILS|ACT_DEF_MENU|
ACT_DEF_ADD|ACT_DEF_DISMISS|ACT_DEF_PIN);
- PopUpOptions.overrideLeft = DBGetContactSettingDword(NULL,MODULNAME, "OverrideLeft", 0);
- PopUpOptions.overrideMiddle = DBGetContactSettingDword(NULL,MODULNAME, "OverrideMiddle", 0);
- PopUpOptions.overrideRight = DBGetContactSettingDword(NULL,MODULNAME, "OverrideRight", 0);
+ PopUpOptions.overrideLeft = db_get_dw(NULL,MODULNAME, "OverrideLeft", 0);
+ PopUpOptions.overrideMiddle = db_get_dw(NULL,MODULNAME, "OverrideMiddle", 0);
+ PopUpOptions.overrideRight = db_get_dw(NULL,MODULNAME, "OverrideRight", 0);
}
static UINT controls[] =
diff --git a/plugins/Popup/src/common.h b/plugins/Popup/src/common.h index 3bce58077f..6ad87ea594 100644 --- a/plugins/Popup/src/common.h +++ b/plugins/Popup/src/common.h @@ -51,7 +51,7 @@ inline int Byte2Percentile(int vByte) { return (vByte*100)/255; } inline int Percentile2Byte(int vPerc) { return (vPerc*255)/100; }
//===== Strings & MirandaDB ==================
-inline char *DBGetContactSettingString(HANDLE hContact, const char *ModuleName, const char *SettingName, const char *Default)
+inline char *db_get_s(HANDLE hContact, const char *ModuleName, const char *SettingName, const char *Default)
{
DBVARIANT dbv;
DBCONTACTGETSETTING dbcgs;
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index d4c88ff200..811bead19a 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -108,7 +108,7 @@ void PopUpPreview() for (HANDLE hContact = db_find_first(); hContact;
hContact = db_find_next(hContact))
{
- if (DBGetContactSettingDword(hContact, "ICQ", "UIN", 0) == 256771455)
+ if (db_get_dw(hContact, "ICQ", "UIN", 0) == 256771455)
{
ppd.lchContact = hContact;
break;
diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 723c3f29bd..fca4c1cf12 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -136,10 +136,10 @@ void ReloadFonts() if (gTreeData[i]->typ == 2) {
mir_snprintf(setting, 256, "%s/TextCol", gTreeData[i]->pupClass.pszName);
gTreeData[i]->colorText = gTreeData[i]->pupClass.colorText =
- (COLORREF)DBGetContactSettingDword(0, PU_MODULCLASS, setting, (DWORD)fonts.clText);
+ (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clText);
mir_snprintf(setting, 256, "%s/BgCol", gTreeData[i]->pupClass.pszName);
gTreeData[i]->colorBack = gTreeData[i]->pupClass.colorBack =
- (COLORREF)DBGetContactSettingDword(0, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
+ (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
}
}
}
diff --git a/plugins/Popup/src/headers.h b/plugins/Popup/src/headers.h index 593389b765..d10e2cd9ca 100644 --- a/plugins/Popup/src/headers.h +++ b/plugins/Popup/src/headers.h @@ -69,7 +69,7 @@ http://miranda-ng.org/distr/ #include <m_skin.h>
#include <m_langpack.h>
#include <m_database.h>
-#undef DBGetContactSettingString
+#undef db_get_s
#include <m_protosvc.h>
#include <m_button.h>
#include <m_message.h>
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index b5620c99d3..a44af22401 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -57,7 +57,7 @@ void PopupHistoryResize() void PopupHistoryLoad()
{
InitializeCriticalSection(&csPopupHistory);
- popupHistoryBuffer = DBGetContactSettingWord(NULL, MODULNAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT);
+ popupHistoryBuffer = db_get_w(NULL, MODULNAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT);
}
void PopupHistoryUnload()
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 2c5e60743b..5ccb4ac13d 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -370,9 +370,9 @@ MIRAPI int Load(void) // Register in DBEditor++
DBVARIANT dbv;
- if (DBGetContactSetting(NULL, "KnownModules", MODULNAME, &dbv))
- DBWriteContactSettingString(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME);
- DBFreeVariant(&dbv);
+ if (db_get(NULL, "KnownModules", MODULNAME, &dbv))
+ db_set_s(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME);
+ db_free(&dbv);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 40b971e160..e9c70d8c79 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -97,7 +97,7 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}Timeout",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- DBWriteContactSettingWord(NULL, szModul, setting, ptd->notification.iSeconds);
+ db_set_w(NULL, szModul, setting, ptd->notification.iSeconds);
mir_snprintf(setting, sizeof(setting), "{%s/%s}enabled",
ptd->notification.lpzGroup,
@@ -107,7 +107,7 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}TimeoutVal",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- DBWriteContactSettingWord(NULL, szModul, setting, ptd->timeoutValue);
+ db_set_w(NULL, szModul, setting, ptd->timeoutValue);
mir_snprintf(setting, sizeof(setting), "{%s/%s}disableWhen",
ptd->notification.lpzGroup,
@@ -117,12 +117,12 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}leftAction",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- DBWriteContactSettingString(NULL, szModul, setting, ptd->leftAction);
+ db_set_s(NULL, szModul, setting, ptd->leftAction);
mir_snprintf(setting, sizeof(setting), "{%s/%s}rightAction",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- DBWriteContactSettingString(NULL, szModul, setting, ptd->rightAction);
+ db_set_s(NULL, szModul, setting, ptd->rightAction);
for (int i=0; i < ptd->notification.actionCount; ++i)
{
@@ -158,11 +158,11 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}Timeout", ptd->notification.lpzGroup, ptd->notification.lpzName);
ptd->notification.iSeconds =
- (signed char)DBGetContactSettingWord(NULL, szModul, setting, ptd->notification.iSeconds);
+ (signed char)db_get_w(NULL, szModul, setting, ptd->notification.iSeconds);
mir_snprintf(setting, sizeof(setting), "{%s/%s}TimeoutVal", ptd->notification.lpzGroup, ptd->notification.lpzName);
ptd->timeoutValue =
- (signed char)DBGetContactSettingWord(NULL, szModul, setting,
+ (signed char)db_get_w(NULL, szModul, setting,
ptd->notification.iSeconds ? ptd->notification.iSeconds : 0);
mir_snprintf(setting, sizeof(setting), "{%s/%s}disableWhen", ptd->notification.lpzGroup, ptd->notification.lpzName);
@@ -170,12 +170,12 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) db_get_b(NULL, szModul, setting, 0);
mir_snprintf(setting, sizeof(setting), "{%s/%s}leftAction", ptd->notification.lpzGroup, ptd->notification.lpzName);
- szTmp = DBGetContactSettingString(NULL, szModul, setting, ptd->notification.lpzLAction);
+ szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzLAction);
lstrcpynA(ptd->leftAction, szTmp, sizeof(ptd->leftAction));
mir_free(szTmp); szTmp = NULL;
mir_snprintf(setting, sizeof(setting), "{%s/%s}rightAction", ptd->notification.lpzGroup, ptd->notification.lpzName);
- szTmp = DBGetContactSettingString(NULL, szModul, setting, ptd->notification.lpzRAction);
+ szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzRAction);
lstrcpynA(ptd->rightAction, szTmp, sizeof(ptd->rightAction));
mir_free(szTmp); szTmp = NULL;
}
diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index bc2c5db587..3c7e4ce579 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -44,13 +44,13 @@ void OptAdv_UnregisterVfx() { void LoadOption_AdvOpts() {
//History
PopUpOptions.EnableHistory = db_get_b (NULL,MODULNAME, "EnableHistory", TRUE);
- PopUpOptions.HistorySize = DBGetContactSettingWord (NULL,MODULNAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT);
+ PopUpOptions.HistorySize = db_get_w (NULL,MODULNAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT);
PopUpOptions.UseHppHistoryLog = db_get_b (NULL,MODULNAME, "UseHppHistoryLog", TRUE);
//Avatars
PopUpOptions.avatarBorders = db_get_b (NULL,MODULNAME, "AvatarBorders", TRUE);
PopUpOptions.avatarPNGBorders = db_get_b (NULL,MODULNAME, "AvatarPNGBorders", FALSE);
PopUpOptions.avatarRadius = db_get_b (NULL,MODULNAME, "AvatarRadius", 2);
- PopUpOptions.avatarSize = DBGetContactSettingWord (NULL,MODULNAME, "AvatarSize", SETTING_AVTSIZE_DEFAULT);
+ PopUpOptions.avatarSize = db_get_w (NULL,MODULNAME, "AvatarSize", SETTING_AVTSIZE_DEFAULT);
PopUpOptions.EnableAvatarUpdates = db_get_b (NULL,MODULNAME, "EnableAvatarUpdates", FALSE);
//Monitor
PopUpOptions.Monitor = db_get_b (NULL,MODULNAME, "Monitor", SETTING_MONITOR_DEFAULT);
@@ -63,10 +63,10 @@ void LoadOption_AdvOpts() { PopUpOptions.UseAnimations = db_get_b (NULL,MODULNAME, "UseAnimations", TRUE);
PopUpOptions.UseEffect = db_get_b (NULL,MODULNAME, "Fade", TRUE);
PopUpOptions.Effect = (LPTSTR)DBGetContactSettingStringX(NULL,MODULNAME, "Effect", "", DBVT_TCHAR);
- PopUpOptions.FadeIn = DBGetContactSettingDword(NULL,MODULNAME, "FadeInTime", SETTING_FADEINTIME_DEFAULT);
- PopUpOptions.FadeOut = DBGetContactSettingDword(NULL,MODULNAME, "FadeOutTime",SETTING_FADEOUTTIME_DEFAULT);
+ PopUpOptions.FadeIn = db_get_dw(NULL,MODULNAME, "FadeInTime", SETTING_FADEINTIME_DEFAULT);
+ PopUpOptions.FadeOut = db_get_dw(NULL,MODULNAME, "FadeOutTime",SETTING_FADEOUTTIME_DEFAULT);
//other old stuff
- PopUpOptions.MaxPopups = DBGetContactSettingWord (NULL,MODULNAME, "MaxPopups", 20);
+ PopUpOptions.MaxPopups = db_get_w (NULL,MODULNAME, "MaxPopups", 20);
}
INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
@@ -527,31 +527,31 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
//History
db_set_b (NULL,MODULNAME, "EnableHistory", (BYTE)PopUpOptions.EnableHistory);
- DBWriteContactSettingWord (NULL,MODULNAME, "HistorySize", PopUpOptions.HistorySize);
+ db_set_w(NULL,MODULNAME, "HistorySize", PopUpOptions.HistorySize);
PopupHistoryResize();
- db_set_b (NULL,MODULNAME, "UseHppHistoryLog", PopUpOptions.UseHppHistoryLog);
+ db_set_b(NULL,MODULNAME, "UseHppHistoryLog", PopUpOptions.UseHppHistoryLog);
//Avatars
- db_set_b (NULL,MODULNAME, "AvatarBorders", PopUpOptions.avatarBorders);
- db_set_b (NULL,MODULNAME, "AvatarPNGBorders", PopUpOptions.avatarPNGBorders);
- db_set_b (NULL,MODULNAME, "AvatarRadius", PopUpOptions.avatarRadius);
- DBWriteContactSettingWord (NULL,MODULNAME, "AvatarSize", PopUpOptions.avatarSize);
- db_set_b (NULL,MODULNAME, "EnableAvatarUpdates", PopUpOptions.EnableAvatarUpdates);
+ db_set_b(NULL,MODULNAME, "AvatarBorders", PopUpOptions.avatarBorders);
+ db_set_b(NULL,MODULNAME, "AvatarPNGBorders", PopUpOptions.avatarPNGBorders);
+ db_set_b(NULL,MODULNAME, "AvatarRadius", PopUpOptions.avatarRadius);
+ db_set_w(NULL,MODULNAME, "AvatarSize", PopUpOptions.avatarSize);
+ db_set_b(NULL,MODULNAME, "EnableAvatarUpdates", PopUpOptions.EnableAvatarUpdates);
//Monitor
- db_set_b (NULL,MODULNAME, "Monitor", PopUpOptions.Monitor);
+ db_set_b(NULL,MODULNAME, "Monitor", PopUpOptions.Monitor);
//Transparency
- db_set_b (NULL,MODULNAME, "EnableRegionTransparency", PopUpOptions.Enable9xTransparency);
- db_set_b (NULL,MODULNAME, "UseTransparency", PopUpOptions.UseTransparency);
- db_set_b (NULL,MODULNAME, "Alpha", PopUpOptions.Alpha);
- db_set_b (NULL,MODULNAME, "OpaqueOnHover", PopUpOptions.OpaqueOnHover);
+ db_set_b(NULL,MODULNAME, "EnableRegionTransparency", PopUpOptions.Enable9xTransparency);
+ db_set_b(NULL,MODULNAME, "UseTransparency", PopUpOptions.UseTransparency);
+ db_set_b(NULL,MODULNAME, "Alpha", PopUpOptions.Alpha);
+ db_set_b(NULL,MODULNAME, "OpaqueOnHover", PopUpOptions.OpaqueOnHover);
//Effects
db_set_b (NULL,MODULNAME, "UseAnimations", PopUpOptions.UseAnimations);
db_set_b (NULL,MODULNAME, "Fade", PopUpOptions.UseEffect);
- DBWriteContactSettingTString(NULL, MODULNAME, "Effect", PopUpOptions.Effect);
+ db_set_ts(NULL, MODULNAME, "Effect", PopUpOptions.Effect);
db_set_dw(NULL,MODULNAME, "FadeInTime", PopUpOptions.FadeIn);
db_set_dw(NULL,MODULNAME, "FadeOutTime", PopUpOptions.FadeOut);
//other old stuff
- DBWriteContactSettingWord (NULL,MODULNAME, "MaxPopups", (BYTE)PopUpOptions.MaxPopups);
+ db_set_w(NULL,MODULNAME, "MaxPopups", (BYTE)PopUpOptions.MaxPopups);
}
return TRUE;
default:
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index eb4978b1d6..d39877f8b8 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -504,20 +504,20 @@ void LoadClassSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "%s/Timeout", ptd->pupClass.pszName);
ptd->pupClass.iSeconds =
- (signed char)DBGetContactSettingWord(NULL, szModul, setting, 0);
+ (signed char)db_get_w(NULL, szModul, setting, 0);
mir_snprintf(setting, sizeof(setting), "%s/TimeoutVal", ptd->pupClass.pszName);
ptd->timeoutValue =
- (signed char)DBGetContactSettingWord(NULL, szModul, setting,
+ (signed char)db_get_w(NULL, szModul, setting,
ptd->pupClass.iSeconds ? ptd->pupClass.iSeconds : PopUpOptions.Seconds);
mir_snprintf(setting, sizeof(setting), "%s/leftAction", ptd->pupClass.pszName);
- szTmp = DBGetContactSettingString(NULL, szModul, setting, POPUP_ACTION_NOTHING); //standart ??
+ szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_NOTHING); //standart ??
lstrcpynA(ptd->leftAction, szTmp, sizeof(ptd->leftAction));
mir_free(szTmp); szTmp = NULL;
mir_snprintf(setting, sizeof(setting), "%s/rightAction", ptd->pupClass.pszName);
- szTmp = DBGetContactSettingString(NULL, szModul, setting, POPUP_ACTION_DISMISS); //standart ??
+ szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_DISMISS); //standart ??
lstrcpynA(ptd->rightAction, szTmp, sizeof(ptd->rightAction));
mir_free(szTmp); szTmp = NULL;
@@ -530,14 +530,14 @@ void SaveClassSettings(POPUPTREEDATA *ptd, char* szModul) db_set_b(NULL, szModul, setting, ptd->enabled);
mir_snprintf(setting, sizeof(setting), "%s/Timeout", ptd->pupClass.pszName);
- DBWriteContactSettingWord(NULL, szModul, setting, ptd->pupClass.iSeconds);
+ db_set_w(NULL, szModul, setting, ptd->pupClass.iSeconds);
mir_snprintf(setting, sizeof(setting), "%s/TimeoutVal",ptd->pupClass.pszName);
- DBWriteContactSettingWord(NULL, szModul, setting, ptd->timeoutValue);
+ db_set_w(NULL, szModul, setting, ptd->timeoutValue);
mir_snprintf(setting, sizeof(setting), "%s/leftAction",ptd->pupClass.pszName);
- DBWriteContactSettingString(NULL, szModul, setting, ptd->leftAction);
+ db_set_s(NULL, szModul, setting, ptd->leftAction);
mir_snprintf(setting, sizeof(setting), "%s/rightAction",ptd->pupClass.pszName);
- DBWriteContactSettingString(NULL, szModul, setting, ptd->rightAction);
+ db_set_s(NULL, szModul, setting, ptd->rightAction);
}
diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 9fc6001e8e..21716c3d33 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -94,18 +94,18 @@ void LoadOption_General() { //Dynamic Resize
PopUpOptions.DynamicResize = db_get_b(NULL, MODULNAME, "DynamicResize", FALSE);
PopUpOptions.UseMinimumWidth = db_get_b(NULL, MODULNAME, "UseMinimumWidth", TRUE);
- PopUpOptions.MinimumWidth = DBGetContactSettingWord(NULL, MODULNAME, "MinimumWidth", 160);
+ PopUpOptions.MinimumWidth = db_get_w(NULL, MODULNAME, "MinimumWidth", 160);
PopUpOptions.UseMaximumWidth = db_get_b(NULL, MODULNAME, "UseMaximumWidth", TRUE);
- PopUpOptions.MaximumWidth = DBGetContactSettingWord(NULL, MODULNAME, "MaximumWidth", 300);
+ PopUpOptions.MaximumWidth = db_get_w(NULL, MODULNAME, "MaximumWidth", 300);
//Position
PopUpOptions.Position = DBGetContactSettingRangedByte(NULL, MODULNAME, "Position",
POS_LOWERRIGHT, POS_MINVALUE, POS_MAXVALUE);
//Configure popup area
- PopUpOptions.gapTop = DBGetContactSettingWord(NULL, MODULNAME, "gapTop", 5);
- PopUpOptions.gapBottom = DBGetContactSettingWord(NULL, MODULNAME, "gapBottom", 5);
- PopUpOptions.gapLeft = DBGetContactSettingWord(NULL, MODULNAME, "gapLeft", 5);
- PopUpOptions.gapRight = DBGetContactSettingWord(NULL, MODULNAME, "gapRight", 5);
- PopUpOptions.spacing = DBGetContactSettingWord(NULL, MODULNAME, "spacing", 5);
+ PopUpOptions.gapTop = db_get_w(NULL, MODULNAME, "gapTop", 5);
+ PopUpOptions.gapBottom = db_get_w(NULL, MODULNAME, "gapBottom", 5);
+ PopUpOptions.gapLeft = db_get_w(NULL, MODULNAME, "gapLeft", 5);
+ PopUpOptions.gapRight = db_get_w(NULL, MODULNAME, "gapRight", 5);
+ PopUpOptions.spacing = db_get_w(NULL, MODULNAME, "spacing", 5);
//Spreading
PopUpOptions.Spreading = DBGetContactSettingRangedByte(NULL, MODULNAME, "Spreading",
SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE);
@@ -514,22 +514,22 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY: {
//Seconds
db_set_b(NULL, MODULNAME, "InfiniteDelay", PopUpOptions.InfiniteDelay);
- DBWriteContactSettingWord(NULL, MODULNAME, "Seconds", (WORD)PopUpOptions.Seconds);
+ db_set_w(NULL, MODULNAME, "Seconds", (WORD)PopUpOptions.Seconds);
db_set_b(NULL, MODULNAME, "LeaveHovered", PopUpOptions.LeaveHovered);
//Dynamic Resize
db_set_b(NULL, MODULNAME, "DynamicResize", PopUpOptions.DynamicResize);
db_set_b(NULL, MODULNAME, "UseMinimumWidth", PopUpOptions.UseMinimumWidth);
- DBWriteContactSettingWord(NULL, MODULNAME, "MinimumWidth", PopUpOptions.MinimumWidth);
+ db_set_w(NULL, MODULNAME, "MinimumWidth", PopUpOptions.MinimumWidth);
db_set_b(NULL, MODULNAME, "UseMaximumWidth", PopUpOptions.UseMaximumWidth);
- DBWriteContactSettingWord(NULL, MODULNAME, "MaximumWidth", PopUpOptions.MaximumWidth);
+ db_set_w(NULL, MODULNAME, "MaximumWidth", PopUpOptions.MaximumWidth);
//Position
db_set_b(NULL, MODULNAME, "Position", (BYTE)PopUpOptions.Position);
//Configure popup area
- DBWriteContactSettingWord(NULL, MODULNAME, "gapTop", (WORD)PopUpOptions.gapTop);
- DBWriteContactSettingWord(NULL, MODULNAME, "gapBottom", (WORD)PopUpOptions.gapBottom);
- DBWriteContactSettingWord(NULL, MODULNAME, "gapLeft", (WORD)PopUpOptions.gapLeft);
- DBWriteContactSettingWord(NULL, MODULNAME, "gapRight", (WORD)PopUpOptions.gapRight);
- DBWriteContactSettingWord(NULL, MODULNAME, "spacing", (WORD)PopUpOptions.spacing);
+ db_set_w(NULL, MODULNAME, "gapTop", (WORD)PopUpOptions.gapTop);
+ db_set_w(NULL, MODULNAME, "gapBottom", (WORD)PopUpOptions.gapBottom);
+ db_set_w(NULL, MODULNAME, "gapLeft", (WORD)PopUpOptions.gapLeft);
+ db_set_w(NULL, MODULNAME, "gapRight", (WORD)PopUpOptions.gapRight);
+ db_set_w(NULL, MODULNAME, "spacing", (WORD)PopUpOptions.spacing);
//Spreading
db_set_b(NULL, MODULNAME, "Spreading", (BYTE)PopUpOptions.Spreading);
//miscellaneous
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index ab8e518835..faca667577 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -286,7 +286,7 @@ bool SkinOptionList_Update (OPTTREE_OPTION* &options, int *OptionsCount, HWND hw char prefix[128];
mir_snprintf(prefix, sizeof(prefix),"skin.%S", PopUpOptions.SkinPack);
OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount,
- DBGetContactSettingDword(NULL, MODULNAME, prefix, dwSkinOptions), _T("Skin options"));
+ db_get_dw(NULL, MODULNAME, prefix, dwSkinOptions), _T("Skin options"));
//check "Global Settings"
OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount,
@@ -492,7 +492,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case PSN_APPLY:
{
//skin pack
- DBWriteContactSettingTString(NULL, MODULNAME, "SkinPack", PopUpOptions.SkinPack);
+ db_set_ts(NULL, MODULNAME, "SkinPack", PopUpOptions.SkinPack);
//skin options
const PopupSkin *skin = 0;
if (skin = skins.getSkin(PopUpOptions.SkinPack))
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index befd0638a1..b1f2dde562 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -203,7 +203,7 @@ INT_PTR PopUp_AddPopUp2(WPARAM wParam, LPARAM lParam) if (PopUpOptions.DisableWhenFullscreen && (bShowMode != PU_SHOWMODE_FULLSCREEN) && isFullScreen())
return -1;
- if (DBGetContactSettingDword(NULL, MODULNAME, LPGEN("Global Status"), 0) &
+ if (db_get_dw(NULL, MODULNAME, LPGEN("Global Status"), 0) &
Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0)))
return -1;
@@ -214,7 +214,7 @@ INT_PTR PopUp_AddPopUp2(WPARAM wParam, LPARAM lParam) {
char prefix[128];
mir_snprintf(prefix, sizeof(prefix), LPGEN("Protocol Status") "/%s", GetContactProto(ppd->lchContact));
- if (DBGetContactSettingDword(NULL, MODULNAME, prefix, 0) &
+ if (db_get_dw(NULL, MODULNAME, prefix, 0) &
Proto_Status2Flag_My(CallProtoService(proto, PS_GETSTATUS, 0, 0)))
return -1;
if (((disableWhen >> 16) & 0xFFFF0000) & Proto_Status2Flag_My(CallProtoService(proto, PS_GETSTATUS, 0, 0)))
@@ -480,7 +480,7 @@ INT_PTR PopUp_RegisterPopupClass(WPARAM wParam, LPARAM lParam) //we ignore pc->colorText and use fonts.text as default (if no setting found in DB)
mir_snprintf(setting, 256, "%s/TextCol", ptd->pupClass.pszName);
- ptd->pupClass.colorText = (COLORREF)DBGetContactSettingDword(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/);
+ ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/);
FontID fid = {0};
fid.cbSize = sizeof(FontID);
mir_snprintf(fid.group, sizeof(fid.group), "%s/%s", PU_FNT_AND_COLOR, ptd->pupClass.pszName);
@@ -498,7 +498,7 @@ INT_PTR PopUp_RegisterPopupClass(WPARAM wParam, LPARAM lParam) //we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB)
mir_snprintf(setting, 256, "%s/BgCol", ptd->pupClass.pszName);
- ptd->pupClass.colorBack = (COLORREF)DBGetContactSettingDword(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
+ ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
ColourID cid = {0};
cid.cbSize = sizeof(ColourID);
mir_snprintf(cid.group, sizeof(cid.group), "%s/%s", PU_FNT_AND_COLOR, ptd->pupClass.pszName);
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index cee1bfe592..864d6c4c59 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -1278,7 +1278,7 @@ void PopupSkin::loadOpts() const mir_snprintf(buf, sizeof(buf), "skin.%.120S", m_name);
- m_flags = DBGetContactSettingDword(NULL, MODULNAME, buf, m_flags);
+ m_flags = db_get_dw(NULL, MODULNAME, buf, m_flags);
}
// Skins
diff --git a/plugins/QuickContacts/src/options.cpp b/plugins/QuickContacts/src/options.cpp index 8e9edec9af..69e6b0968e 100644 --- a/plugins/QuickContacts/src/options.cpp +++ b/plugins/QuickContacts/src/options.cpp @@ -37,14 +37,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // Initializations needed by options
void LoadOptions()
{
- opts.last_sent_enable = DBGetContactSettingByte(NULL, MODULE_NAME, "EnableLastSentTo", TRUE);
- opts.last_sent_msg_type = DBGetContactSettingWord(NULL, MODULE_NAME, "MsgTypeRec", TYPE_GLOBAL);
- opts.hide_from_offline_proto = DBGetContactSettingByte(NULL, MODULE_NAME, "HideOfflineFromOfflineProto", TRUE);
- opts.group_append = DBGetContactSettingByte(NULL, MODULE_NAME, "AppendGroupName", FALSE);
- opts.group_column = DBGetContactSettingByte(NULL, MODULE_NAME, "GroupColumn", FALSE);
- opts.group_column_left = DBGetContactSettingByte(NULL, MODULE_NAME, "GroupColumnLeft", FALSE);
- opts.hide_subcontacts = DBGetContactSettingByte(NULL, MODULE_NAME, "HideSubcontacts", TRUE);
- opts.keep_subcontacts_from_offline = DBGetContactSettingByte(NULL, MODULE_NAME, "KeepSubcontactsFromOffline", TRUE);
+ opts.last_sent_enable = db_get_b(NULL, MODULE_NAME, "EnableLastSentTo", TRUE);
+ opts.last_sent_msg_type = db_get_w(NULL, MODULE_NAME, "MsgTypeRec", TYPE_GLOBAL);
+ opts.hide_from_offline_proto = db_get_b(NULL, MODULE_NAME, "HideOfflineFromOfflineProto", TRUE);
+ opts.group_append = db_get_b(NULL, MODULE_NAME, "AppendGroupName", FALSE);
+ opts.group_column = db_get_b(NULL, MODULE_NAME, "GroupColumn", FALSE);
+ opts.group_column_left = db_get_b(NULL, MODULE_NAME, "GroupColumnLeft", FALSE);
+ opts.hide_subcontacts = db_get_b(NULL, MODULE_NAME, "HideSubcontacts", TRUE);
+ opts.keep_subcontacts_from_offline = db_get_b(NULL, MODULE_NAME, "KeepSubcontactsFromOffline", TRUE);
}
int InitOptionsCallback(WPARAM wParam,LPARAM lParam)
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 2a653dbd21..100cfe9b69 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -220,11 +220,11 @@ int EventAdded(WPARAM wparam, LPARAM lparam) DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get((HANDLE)lparam, &dbei);
if ( !(dbei.flags & DBEF_SENT) || (dbei.flags & DBEF_READ)
- || !DBGetContactSettingByte(NULL, MODULE_NAME, "EnableLastSentTo", 0)
- || DBGetContactSettingWord(NULL, MODULE_NAME, "MsgTypeRec", TYPE_GLOBAL) != TYPE_GLOBAL)
+ || !db_get_b(NULL, MODULE_NAME, "EnableLastSentTo", 0)
+ || db_get_w(NULL, MODULE_NAME, "MsgTypeRec", TYPE_GLOBAL) != TYPE_GLOBAL)
return 0;
- DBWriteContactSettingDword(NULL, MODULE_NAME, "LastSentTo", (DWORD)(HANDLE)wparam);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD)(HANDLE)wparam);
return 0;
}
@@ -332,7 +332,7 @@ int GetStatus(HANDLE hContact, char *proto = NULL) if (proto == NULL)
return ID_STATUS_OFFLINE;
- return DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
+ return db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
}
@@ -349,10 +349,10 @@ void FreeContacts() void LoadContacts(HWND hwndDlg, BOOL show_all)
{
BOOL metacontactsEnabled = (metacontacts_proto != NULL
- && DBGetContactSettingByte(0, metacontacts_proto, "Enabled", 1));
+ && db_get_b(0, metacontacts_proto, "Enabled", 1));
// Read last-sent-to contact from db and set handle as window-userdata
- HANDLE hlastsent = (HANDLE)DBGetContactSettingDword(NULL, MODULE_NAME, "LastSentTo", -1);
+ HANDLE hlastsent = (HANDLE)db_get_dw(NULL, MODULE_NAME, "LastSentTo", -1);
SetWindowLongPtr(hwndMain, GWLP_USERDATA, (LONG)hlastsent);
// enumerate all contacts and write them to the array
@@ -388,7 +388,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) char setting[128];
mir_snprintf(setting, sizeof(setting), "ShowOffline%s", pszProto);
- if (!DBGetContactSettingByte(NULL, MODULE_NAME, setting, FALSE))
+ if (!db_get_b(NULL, MODULE_NAME, setting, FALSE))
continue;
// Check if proto offline
@@ -412,7 +412,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) {
char setting[128];
mir_snprintf(setting, sizeof(setting), "ShowOffline%s", metacontacts_proto);
- if (DBGetContactSettingByte(NULL, MODULE_NAME, setting, FALSE))
+ if (db_get_b(NULL, MODULE_NAME, setting, FALSE))
continue;
}
}
@@ -426,12 +426,12 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) if (opts.group_append)
{
DBVARIANT dbv;
- if (DBGetContactSettingTString(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0)
+ if (db_get_ts(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0)
{
if (dbv.ptszVal != NULL)
lstrcpyn(contact->szgroup, dbv.ptszVal, SIZEOF(contact->szgroup));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -831,9 +831,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA LoadContacts(hwndDlg, FALSE);
EnableButtons(hwndDlg, NULL);
- if (DBGetContactSettingByte(NULL, MODULE_NAME, "EnableLastSentTo", 0))
+ if (db_get_b(NULL, MODULE_NAME, "EnableLastSentTo", 0))
{
- int pos = GetItemPos((HANDLE) DBGetContactSettingDword(NULL, MODULE_NAME, "LastSentTo", -1));
+ int pos = GetItemPos((HANDLE) db_get_dw(NULL, MODULE_NAME, "LastSentTo", -1));
if (pos != -1)
{
@@ -868,7 +868,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM) hContact, 0);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
}
@@ -888,7 +888,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_MSG_SENDMESSAGET, (WPARAM) hContact, 0);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
}
@@ -912,7 +912,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_VOICESERVICE_CALL, (WPARAM) hContact, 0);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
}
@@ -933,7 +933,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_FILE_SENDFILE, (WPARAM) hContact, 0);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
}
@@ -954,7 +954,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_URL_SENDURL, (WPARAM) hContact, 0);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
}
@@ -975,7 +975,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_USERINFO_SHOWDIALOG, (WPARAM) hContact, 0);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
}
@@ -996,7 +996,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM) hContact, 0);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
}
@@ -1027,7 +1027,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(ret),MPCF_CONTACTMENU),(LPARAM) hContact);
}
- DBWriteContactSettingDword(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
break;
}
case HOTKEY_ALL_CONTACTS:
diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index 85a77e9de2..b0c40e1f7b 100644 --- a/plugins/QuickMessages/src/Utils.cpp +++ b/plugins/QuickMessages/src/Utils.cpp @@ -171,22 +171,22 @@ void SaveModuleSettings(int buttonnum,ButtonData* bd) char szMEntry[256]={'\0'};
mir_snprintf(szMEntry,255,"EntryName_%u_%u",buttonnum,bd->dwPos);
- DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,bd->pszName );
+ db_set_ts(NULL, PLGNAME,szMEntry,bd->pszName );
mir_snprintf(szMEntry,255,"EntryValue_%u_%u",buttonnum,bd->dwPos);
if(bd->pszValue)
- DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,bd->pszValue );
+ db_set_ts(NULL, PLGNAME,szMEntry,bd->pszValue );
else
- DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
+ db_unset(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"EntryRel_%u_%u",buttonnum,bd->dwPos);
- DBWriteContactSettingByte(NULL, PLGNAME,szMEntry,bd->fEntryType );
+ db_set_b(NULL, PLGNAME,szMEntry,bd->fEntryType );
mir_snprintf(szMEntry,255,"EntryToQMenu_%u_%u",buttonnum,bd->dwPos);
- DBWriteContactSettingByte(NULL, PLGNAME,szMEntry,bd->bInQMenu);
+ db_set_b(NULL, PLGNAME,szMEntry,bd->bInQMenu);
mir_snprintf(szMEntry,255,"EntryIsServiceName_%u_%u",buttonnum,bd->dwPos);
- DBWriteContactSettingByte(NULL, PLGNAME,szMEntry,bd->bIsServName);
+ db_set_b(NULL, PLGNAME,szMEntry,bd->bIsServName);
}
void CleanSettings(int buttonnum,int from)
@@ -195,28 +195,28 @@ void CleanSettings(int buttonnum,int from) DBVARIANT dbv = {0};
if(from==-1){
mir_snprintf(szMEntry,255,"ButtonName_%u",buttonnum);
- DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
+ db_unset(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"ButtonValue_%u",buttonnum);
- DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
+ db_unset(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",buttonnum);
- DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
+ db_unset(NULL, PLGNAME,szMEntry);
}
mir_snprintf(szMEntry,255,"EntryName_%u_%u",buttonnum,from);
- while(!DBGetContactSettingTString(NULL, PLGNAME,szMEntry,&dbv)) {
- DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
+ while(!db_get_ts(NULL, PLGNAME,szMEntry,&dbv)) {
+ db_unset(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"EntryValue_%u_%u",buttonnum,from);
- DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
+ db_unset(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"EntryRel_%u_%u",buttonnum,from);
- DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
+ db_unset(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"EntryToQMenu_%u_%u",buttonnum,from);
- DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
+ db_unset(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"EntryIsServiceName_%u_%u",buttonnum,from);
- DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
+ db_unset(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"EntryName_%u_%u",buttonnum,++from);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
BYTE getEntryByte(int buttonnum,int entrynum,BOOL mode)
@@ -230,7 +230,7 @@ BYTE getEntryByte(int buttonnum,int entrynum,BOOL mode) mir_snprintf(szMEntry,255,"EntryIsServiceName_%u_%u",buttonnum,entrynum);
else if (mode==3)
mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",buttonnum);
- return DBGetContactSettingByte(NULL, PLGNAME,szMEntry, 0);
+ return db_get_b(NULL, PLGNAME,szMEntry, 0);
}
static HANDLE AddIcon(char* szIcoName)
@@ -286,7 +286,7 @@ void InitButtonsList() ListData* ld=NULL;
if (!(pszBName=getMenuEntry(i,0,3))) {
g_iButtonsCount=i;
- DBWriteContactSettingByte(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
+ db_set_b(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
break;}
ld = (ListData *)mir_alloc(sizeof(ListData));
@@ -362,12 +362,12 @@ TCHAR* getMenuEntry(int buttonnum,int entrynum,BYTE mode) mir_snprintf(szMEntry,255,"ButtonName_%u",buttonnum);
- DBGetContactSettingTString(NULL, PLGNAME,szMEntry, &dbv);
+ db_get_ts(NULL, PLGNAME,szMEntry, &dbv);
if(dbv.ptszVal&&_tcslen(dbv.ptszVal))
{
buffer=mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return buffer;
diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index 45777de3f7..c8aded16da 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -294,10 +294,10 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) HookEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton);
HookEvent(ME_MSG_WINDOWPOPUP, InputMenuPopup);
- g_bRClickAuto = DBGetContactSettingByte(NULL,PLGNAME,"RClickAuto",0);
- g_bLClickAuto = DBGetContactSettingByte(NULL,PLGNAME,"LClickAuto",0);
- g_iButtonsCount = DBGetContactSettingByte(NULL, PLGNAME,"ButtonsCount", 0);
- g_bQuickMenu = DBGetContactSettingByte(NULL, PLGNAME,"QuickMenu", 1);
+ g_bRClickAuto = db_get_b(NULL,PLGNAME,"RClickAuto",0);
+ g_bLClickAuto = db_get_b(NULL,PLGNAME,"LClickAuto",0);
+ g_iButtonsCount = db_get_b(NULL, PLGNAME,"ButtonsCount", 0);
+ g_bQuickMenu = db_get_b(NULL, PLGNAME,"QuickMenu", 1);
InitButtonsList();
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp index 7b53dfc933..8d0ea49efb 100644 --- a/plugins/QuickMessages/src/options.cpp +++ b/plugins/QuickMessages/src/options.cpp @@ -261,7 +261,7 @@ void SaveMenuTree(HWND hdlg) if(ld->ptszQValue)
{
mir_snprintf(szMEntry,255,"ButtonValue_%u",iBl);
- DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszQValue);
+ db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszQValue);
}
@@ -277,13 +277,13 @@ void SaveMenuTree(HWND hdlg) mir_snprintf(szMEntry,255,"ButtonName_%u",iBl);
- DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszButtonName);
+ db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszButtonName);
ld->dwOPFlags=0;
ld->dwPos=iBl;
ld->bIsServName=ld->bIsOpServName;
mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",iBl);
- DBWriteContactSettingByte(NULL, PLGNAME,szMEntry,ld->bIsServName);
+ db_set_b(NULL, PLGNAME,szMEntry,ld->bIsServName);
bDeleted=FALSE;
@@ -333,7 +333,7 @@ void SaveMenuTree(HWND hdlg) iBl++;
}
- DBWriteContactSettingByte(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
+ db_set_b(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
}
void RestoreModuleData(HWND hdlg)
@@ -533,7 +533,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) g_opHdlg=hdlg;
bOptionsInit=TRUE;
TranslateDialogDefault(hdlg);
- if(g_iButtonsCount!=DBGetContactSettingByte(NULL, PLGNAME,"ButtonsCount", 0))
+ if(g_iButtonsCount!=db_get_b(NULL, PLGNAME,"ButtonsCount", 0))
{
LOGFONT logFont;
HFONT hFont;
@@ -583,9 +583,9 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"RClickAuto",0)));
- CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"LClickAuto",0)));
- CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=DBGetContactSettingByte(NULL, PLGNAME,"QuickMenu", 1)));
+ CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=db_get_b(NULL,PLGNAME,"RClickAuto",0)));
+ CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=db_get_b(NULL,PLGNAME,"LClickAuto",0)));
+ CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=db_get_b(NULL, PLGNAME,"QuickMenu", 1)));
bOptionsInit=FALSE;
}break;
@@ -731,9 +731,9 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) SetMenuEntryProperties(hdlg);
SaveMenuTree(hdlg);
}
- DBWriteContactSettingByte(NULL,PLGNAME,"RClickAuto",(BYTE)(g_bRClickAuto=IsDlgButtonChecked(hdlg,IDC_RAUTOSEND)));
- DBWriteContactSettingByte(NULL,PLGNAME,"LClickAuto",(BYTE)(g_bLClickAuto=IsDlgButtonChecked(hdlg,IDC_LAUTOSEND)));
- DBWriteContactSettingByte(NULL,PLGNAME,"QuickMenu",(BYTE)(g_bQuickMenu=IsDlgButtonChecked(hdlg,IDC_ENABLEQUICKMENU)));
+ db_set_b(NULL,PLGNAME,"RClickAuto",(BYTE)(g_bRClickAuto=IsDlgButtonChecked(hdlg,IDC_RAUTOSEND)));
+ db_set_b(NULL,PLGNAME,"LClickAuto",(BYTE)(g_bLClickAuto=IsDlgButtonChecked(hdlg,IDC_LAUTOSEND)));
+ db_set_b(NULL,PLGNAME,"QuickMenu",(BYTE)(g_bQuickMenu=IsDlgButtonChecked(hdlg,IDC_ENABLEQUICKMENU)));
return 1;
}
else if (((LPNMHDR)lparam)->code == PSN_RESET ) {
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 009403872d..8162c110d5 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -42,8 +42,8 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) iNumber = 0;
hQuickRepliesService = CreateServiceFunction(MS_QUICKREPLIES_SERVICE, QuickRepliesService);
}
- else iNumber = DBGetContactSettingByte(NULL, MODULE_NAME, "InstancesCount", 0);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "InstancesCount", iNumber + 1);
+ else iNumber = db_get_b(NULL, MODULE_NAME, "InstancesCount", 0);
+ db_set_b(NULL, MODULE_NAME, "InstancesCount", iNumber + 1);
hOnOptInitialized = HookEvent(ME_OPT_INITIALISE, OnOptInitialized);
hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
@@ -89,7 +89,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) return 1;
mir_snprintf(key, 64, "RepliesCount_%x", iNumber);
- count = DBGetContactSettingWord(NULL, MODULE_NAME, key, 0);
+ count = db_get_w(NULL, MODULE_NAME, key, 0);
{
if (count == 0 || cbcd->flags & BBCF_RIGHTBUTTON)
@@ -112,7 +112,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) for (int i = 0; i < count; i++)
{
mir_snprintf(key, 64, "Reply_%x_%x", iNumber, i);
- DBGetContactSettingTString(NULL, MODULE_NAME, key, &dbv);
+ db_get_ts(NULL, MODULE_NAME, key, &dbv);
if (dbv.ptszVal == NULL)
replyList.push_back(_T(""));
@@ -125,7 +125,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) AppendMenu((HMENU)hMenu, MF_SEPARATOR, i + 1, NULL);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
{
@@ -140,7 +140,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) SendMessage(hEdit, EM_REPLACESEL, TRUE, (LPARAM)replyList.at(index - 1).c_str());
mir_snprintf(key, 64, "ImmediatelySend_%x", iNumber);
- if ((BYTE)DBGetContactSettingByte(NULL, MODULE_NAME, key, 1) || cbcd->flags & BBCF_CONTROLPRESSED)
+ if ((BYTE)db_get_b(NULL, MODULE_NAME, key, 1) || cbcd->flags & BBCF_CONTROLPRESSED)
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
}
}
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp index 57b8535cc6..6cb7798b74 100644 --- a/plugins/QuickReplies/src/options.cpp +++ b/plugins/QuickReplies/src/options.cpp @@ -74,15 +74,15 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR mir_subclassWindow( GetDlgItem(hwndDlg, IDC_REPLIES), MessageEditSubclassProc);
mir_snprintf(key, 64, "ImmediatelySend_%x", iNumber);
- CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, (BYTE)DBGetContactSettingWord(NULL, MODULE_NAME, key, 1));
+ CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, (BYTE)db_get_w(NULL, MODULE_NAME, key, 1));
mir_snprintf(key, 64, "RepliesCount_%x", iNumber);
- count = DBGetContactSettingWord(NULL, MODULE_NAME, key, 0);
+ count = db_get_w(NULL, MODULE_NAME, key, 0);
for (int i = 0; i < count; i++)
{
mir_snprintf(key, 64, "Reply_%x_%x", iNumber, i);
- if (!DBGetContactSettingTString(NULL, MODULE_NAME, key, &dbv))
+ if (!db_get_ts(NULL, MODULE_NAME, key, &dbv))
if(dbv.ptszVal != NULL)
replies.append(dbv.ptszVal);
if (i < count - 1)
@@ -90,7 +90,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR }
SetDlgItemText(hwndDlg, IDC_REPLIES, replies.c_str());
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
@@ -120,12 +120,12 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR TCHAR tszReplies[TEXT_LIMIT];
mir_snprintf(key, 64, "RepliesCount_%x", iNumber);
- count = DBGetContactSettingByte(NULL, MODULE_NAME, key, 0);
+ count = db_get_b(NULL, MODULE_NAME, key, 0);
for (int i = 0; i < count; i++)
{
mir_snprintf(key, 64, "Reply_%x_%x", iNumber, i);
- DBDeleteContactSetting(NULL, MODULE_NAME, key);
+ db_unset(NULL, MODULE_NAME, key);
}
GetDlgItemText(hwndDlg, IDC_REPLIES, tszReplies, TEXT_LIMIT);
@@ -140,16 +140,16 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR while ((pos = replies.find(_T("\r\n"))) != tString::npos)
{
mir_snprintf(key, 64, "Reply_%x_%x", iNumber, count++);
- DBWriteContactSettingTString(NULL, MODULE_NAME, key, replies.substr(0, pos).c_str());
+ db_set_ts(NULL, MODULE_NAME, key, replies.substr(0, pos).c_str());
replies = replies.substr(pos + 2);
}
}
mir_snprintf(key, 64, "RepliesCount_%x", iNumber);
- DBWriteContactSettingWord(NULL, MODULE_NAME, key, count);
+ db_set_w(NULL, MODULE_NAME, key, count);
mir_snprintf(key, 64, "ImmediatelySend_%x", iNumber);
- DBWriteContactSettingByte(NULL, MODULE_NAME, key, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
+ db_set_b(NULL, MODULE_NAME, key, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
mir_free(key);
diff --git a/plugins/Quotes/src/CommonOptionDlg.cpp b/plugins/Quotes/src/CommonOptionDlg.cpp index 55315c3947..54606b7613 100644 --- a/plugins/Quotes/src/CommonOptionDlg.cpp +++ b/plugins/Quotes/src/CommonOptionDlg.cpp @@ -72,13 +72,13 @@ void CommonOptionDlgProc(HWND hWnd,UINT msg,WPARAM wp,LPARAM lp,CCommonDlgProcDa ::SendMessage(hwndCombo,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(pszRefreshRateTypes[i]));
}
- int nRefreshRateType = DBGetContactSettingWord(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateType,RRT_MINUTES);
+ int nRefreshRateType = db_get_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateType,RRT_MINUTES);
if(nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS)
{
nRefreshRateType = RRT_MINUTES;
}
- UINT nRate = DBGetContactSettingWord(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateValue,1);
+ UINT nRate = db_get_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateValue,1);
switch(nRefreshRateType)
{
default:
@@ -235,17 +235,17 @@ void CommonOptionDlgProc(HWND hWnd,UINT msg,WPARAM wp,LPARAM lp,CCommonDlgProcDa assert(visitor.m_pszDbStatusMsgFormat);
rData.m_bFireSetingsChangedEvent = true;
- DBWriteContactSettingWord(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateType,nType);
- DBWriteContactSettingWord(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateValue,nRefreshRate);
+ db_set_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateType,nType);
+ db_set_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateValue,nRefreshRate);
tstring s = get_window_text(::GetDlgItem(hWnd,IDC_EDIT_CONTACT_LIST_FORMAT));
- DBWriteContactSettingTString(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbDisplayNameFormat,s.c_str());
+ db_set_ts(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbDisplayNameFormat,s.c_str());
s = get_window_text(::GetDlgItem(hWnd,IDC_EDIT_STATUS_MESSAGE_FORMAT));
- DBWriteContactSettingTString(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbStatusMsgFormat,s.c_str());
+ db_set_ts(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbStatusMsgFormat,s.c_str());
s = get_window_text(::GetDlgItem(hWnd,IDC_EDIT_TENDENCY_FORMAT));
- DBWriteContactSettingTString(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbTendencyFormat,s.c_str());
+ db_set_ts(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbTendencyFormat,s.c_str());
CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pQuotesProvider,false);
if(pAdvSet)
diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp index a586bb3e77..f1253bf01f 100644 --- a/plugins/Quotes/src/CurrencyConverter.cpp +++ b/plugins/Quotes/src/CurrencyConverter.cpp @@ -217,8 +217,8 @@ namespace CQuotesProviderGoogle::CQuote from = rSection.GetQuote(nFrom);
CQuotesProviderGoogle::CQuote to = rSection.GetQuote(nTo);
- DBWriteContactSettingTString(NULL,QUOTES_MODULE_NAME,DB_STR_CC_QUOTE_FROM_ID,from.GetID().c_str());
- DBWriteContactSettingTString(NULL,QUOTES_MODULE_NAME,DB_STR_CC_QUOTE_TO_ID,to.GetID().c_str());
+ db_set_ts(NULL,QUOTES_MODULE_NAME,DB_STR_CC_QUOTE_FROM_ID,from.GetID().c_str());
+ db_set_ts(NULL,QUOTES_MODULE_NAME,DB_STR_CC_QUOTE_TO_ID,to.GetID().c_str());
const CQuotesProviderGoogle* pProvider = get_google_provider();
assert(pProvider);
diff --git a/plugins/Quotes/src/DBUtils.cpp b/plugins/Quotes/src/DBUtils.cpp index 462abb38a5..65ac8b180c 100644 --- a/plugins/Quotes/src/DBUtils.cpp +++ b/plugins/Quotes/src/DBUtils.cpp @@ -63,7 +63,7 @@ bool Quotes_DBReadDouble(HANDLE hContact,const char* szModule,const char* szSett rdValue = *reinterpret_cast<double*>(dbv.pbVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return bResult;
}
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index c50e2f3cbf..edcd5806ab 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -28,7 +28,7 @@ namespace struct mir_safety_dbvar
{
mir_safety_dbvar(DBVARIANT* p) : m_p(p){}
- ~mir_safety_dbvar(){DBFreeVariant(m_p);}
+ ~mir_safety_dbvar(){db_free(m_p);}
DBVARIANT* m_p;
};
diff --git a/plugins/Quotes/src/Log.cpp b/plugins/Quotes/src/Log.cpp index 46fb0cc325..250ca58497 100644 --- a/plugins/Quotes/src/Log.cpp +++ b/plugins/Quotes/src/Log.cpp @@ -14,7 +14,7 @@ namespace #ifdef _DEBUG
return true;
#else
- return (1 == DBGetContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,DB_STR_ENABLE_LOG,false));
+ return (1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,DB_STR_ENABLE_LOG,false));
#endif
}
diff --git a/plugins/Quotes/src/ModuleInfo.cpp b/plugins/Quotes/src/ModuleInfo.cpp index e166adc6ea..1d453d2b5c 100644 --- a/plugins/Quotes/src/ModuleInfo.cpp +++ b/plugins/Quotes/src/ModuleInfo.cpp @@ -8,7 +8,7 @@ namespace }
CModuleInfo::CModuleInfo()
- : m_bExtendedStatusInfo(1 == DBGetContactSettingByte(NULL,QUOTES_MODULE_NAME,"ExtendedStatus",false))
+ : m_bExtendedStatusInfo(1 == db_get_b(NULL,QUOTES_MODULE_NAME,"ExtendedStatus",false))
{
}
diff --git a/plugins/Quotes/src/QuoteChart.cpp b/plugins/Quotes/src/QuoteChart.cpp index 4f717f1275..123c8c1a4f 100644 --- a/plugins/Quotes/src/QuoteChart.cpp +++ b/plugins/Quotes/src/QuoteChart.cpp @@ -226,7 +226,7 @@ namespace ::SendDlgItemMessage(hDlg,IDC_COMBO_DATA_SOURCE,CB_INSERTSTRING,-1,reinterpret_cast<LPARAM>(p));
}
- int nSel = DBGetContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,"Chart_Source",srcLogFile);
+ int nSel = db_get_b(hContact,QUOTES_PROTOCOL_NAME,"Chart_Source",srcLogFile);
::SendDlgItemMessage(hDlg,IDC_COMBO_DATA_SOURCE,CB_SETCURSEL,nSel,0);
for(int i = 0;i < sizeof(szFilters)/sizeof(szFilters[0]);++i)
@@ -235,7 +235,7 @@ namespace ::SendDlgItemMessage(hDlg,IDC_COMBO_FILTER,CB_INSERTSTRING,-1,reinterpret_cast<LPARAM>(szFilters[i]));
}
- nSel = DBGetContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,"Chart_Filter",filterAll);
+ nSel = db_get_b(hContact,QUOTES_PROTOCOL_NAME,"Chart_Filter",filterAll);
::SendDlgItemMessage(hDlg,IDC_COMBO_FILTER,CB_SETCURSEL,nSel,0);
update_filter_controls(hDlg);
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp Binary files differindex 92f9203e39..84698140b1 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp Binary files differindex 3d8ac08a7b..a89a1482ed 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index 0dcfe6db54..e7c9a16d06 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -49,10 +49,10 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote,bool bWatch) HANDLE hContact = CreateNewContact(rQuote.GetSymbol());
if(hContact)
{
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_ID,sQuoteID.c_str());
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_ID,sQuoteID.c_str());
if(false == rQuote.GetName().empty())
{
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_DESCRIPTION,rQuote.GetName().c_str());
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_DESCRIPTION,rQuote.GetName().c_str());
}
return true;
diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index a873a58b23..bc07ec0f80 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -39,15 +39,15 @@ bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri, HANDLE hContact = CreateNewContact(sName);
if(hContact)
{
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID,ri.m_from.GetID().c_str());
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID,ri.m_to.GetID().c_str());
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID,ri.m_from.GetID().c_str());
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID,ri.m_to.GetID().c_str());
if(false == ri.m_from.GetName().empty())
{
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_DESCRIPTION,ri.m_from.GetName().c_str());
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_DESCRIPTION,ri.m_from.GetName().c_str());
}
if(false == ri.m_to.GetName().empty())
{
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_DESCRIPTION,ri.m_to.GetName().c_str());
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_DESCRIPTION,ri.m_to.GetName().c_str());
}
return true;
diff --git a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp index 729cc57b94..5150610ed5 100644 --- a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp @@ -328,7 +328,7 @@ void CQuotesProviderGoogleFinance::RefreshQuotes(TContracts& anContacts) }
if(false == Info.m_sCmpName.empty())
{
- DBWriteContactSettingTString(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION,Info.m_sCmpName.c_str());
+ db_set_ts(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION,Info.m_sCmpName.c_str());
}
WriteContactRate(hContact,Info.m_dRate);
diff --git a/plugins/Quotes/src/QuotesProviderYahoo.cpp b/plugins/Quotes/src/QuotesProviderYahoo.cpp index 567cb6423d..f34a21523b 100644 --- a/plugins/Quotes/src/QuotesProviderYahoo.cpp +++ b/plugins/Quotes/src/QuotesProviderYahoo.cpp @@ -61,7 +61,7 @@ namespace }
}
- DBWriteContactSettingTString(hContact,QUOTES_MODULE_NAME,pszDbName,_T(""));
+ db_set_ts(hContact,QUOTES_MODULE_NAME,pszDbName,_T(""));
return false;
}
}
@@ -155,7 +155,7 @@ void CQuotesProviderYahoo::RefreshQuotes(TContracts& anContacts) double dRate = 0.0;
if(true == t2d(asStrings[indexLastTrade],dRate))
{
- DBWriteContactSettingTString(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION,asStrings[indexName].c_str());
+ db_set_ts(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION,asStrings[indexName].c_str());
get_double_from_parsed_line(hContact,asStrings,indexOpen,DB_STR_YAHOO_OPEN_VALUE);
get_double_from_parsed_line(hContact,asStrings,indexDayHigh,DB_STR_YAHOO_DAY_HIGH);
diff --git a/plugins/Quotes/src/QuotesProviders.cpp b/plugins/Quotes/src/QuotesProviders.cpp index 5867b12a87..8047977983 100644 --- a/plugins/Quotes/src/QuotesProviders.cpp +++ b/plugins/Quotes/src/QuotesProviders.cpp @@ -46,10 +46,10 @@ namespace {
void convert_contact_settings(HANDLE hContact)
{
- WORD dwLogMode = DBGetContactSettingWord(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,static_cast<WORD>(lmDisabled));
+ WORD dwLogMode = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,static_cast<WORD>(lmDisabled));
if ((dwLogMode&lmInternalHistory) || (dwLogMode&lmExternalFile))
{
- DBWriteContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,1);
+ db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,1);
}
}
}
@@ -58,7 +58,7 @@ void CQuotesProviders::InitProviders() CreateProviders();
const WORD nCurrentVersion = 17;
- WORD nVersion = DBGetContactSettingWord(NULL,QUOTES_MODULE_NAME,LAST_RUN_VERSION,1);
+ WORD nVersion = db_get_w(NULL,QUOTES_MODULE_NAME,LAST_RUN_VERSION,1);
for(HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
{
@@ -73,7 +73,7 @@ void CQuotesProviders::InitProviders() }
}
- DBWriteContactSettingWord(NULL,QUOTES_MODULE_NAME,LAST_RUN_VERSION,nCurrentVersion);
+ db_set_w(NULL,QUOTES_MODULE_NAME,LAST_RUN_VERSION,nCurrentVersion);
}
CQuotesProviders::TQuotesProviderPtr CQuotesProviders::GetContactProviderPtr(HANDLE hContact)const
diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index 108a77554c..e03ec3c83e 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -294,19 +294,19 @@ namespace CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact);
- BYTE bUseContactSpecific = DBGetContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,0);
+ BYTE bUseContactSpecific = db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,0);
::CheckDlgButton(hWnd,IDC_CHECK_CONTACT_SPECIFIC,bUseContactSpecific);
CAdvProviderSettings setGlobal(pProvider.get());
// log to history
- WORD dwLogMode = DBGetContactSettingWord(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,setGlobal.GetLogMode());
+ WORD dwLogMode = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,setGlobal.GetLogMode());
UINT nCheck = (dwLogMode&lmInternalHistory) ? 1 : 0;
::CheckDlgButton(hWnd,IDC_CHECK_INTERNAL_HISTORY,nCheck);
tstring sHistoryFrmt = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_HISTORY,setGlobal.GetHistoryFormat().c_str());
::SetDlgItemText(hWnd,IDC_EDIT_HISTORY_FORMAT,sHistoryFrmt.c_str());
- WORD wOnlyIfChanged = DBGetContactSettingWord(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_HISTORY_CONDITION,setGlobal.GetHistoryOnlyChangedFlag());
+ WORD wOnlyIfChanged = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_HISTORY_CONDITION,setGlobal.GetHistoryOnlyChangedFlag());
::CheckDlgButton(hWnd,IDC_CHECK_HISTORY_CONDITION,(1 == wOnlyIfChanged) ? 1 : 0);
// log to file
@@ -323,7 +323,7 @@ namespace tstring sLogFileFrmt = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_LOG_FILE,setGlobal.GetLogFormat().c_str());
::SetDlgItemText(hWnd,IDC_EDIT_LOG_FILE_FORMAT,sLogFileFrmt.c_str());
- wOnlyIfChanged = DBGetContactSettingWord(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE_CONDITION,setGlobal.GetLogOnlyChangedFlag());
+ wOnlyIfChanged = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE_CONDITION,setGlobal.GetLogOnlyChangedFlag());
::CheckDlgButton(hWnd,IDC_CHECK_LOG_FILE_CONDITION,(1 == wOnlyIfChanged) ? 1 : 0);
// popup
@@ -331,7 +331,7 @@ namespace ::CheckDlgButton(hWnd,IDC_CHECK_SHOW_POPUP,nCheck);
tstring sPopupFrmt = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_POPUP,setGlobal.GetPopupFormat().c_str());
::SetDlgItemText(hWnd,IDC_EDIT_POPUP_FORMAT,sPopupFrmt.c_str());
- bool bOnlyIfChanged = 1 == DBGetContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_CONDITION,setGlobal.GetShowPopupIfValueChangedFlag());
+ bool bOnlyIfChanged = 1 == db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_CONDITION,setGlobal.GetShowPopupIfValueChangedFlag());
::CheckDlgButton(hWnd,IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED,(true == bOnlyIfChanged) ? 1 : 0);
update_all_controls(hWnd);
@@ -475,15 +475,15 @@ namespace UINT nIfChangedFile = IsDlgButtonChecked(hWnd,IDC_CHECK_LOG_FILE_CONDITION);
bool bIfChangedPopup = (1 == IsDlgButtonChecked(hWnd,IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED));
- DBWriteContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,bUseContactSpec);
- DBWriteContactSettingWord(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,nLogMode);
- DBWriteContactSettingWord(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE_CONDITION,nIfChangedFile);
- DBWriteContactSettingWord(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_HISTORY_CONDITION,nIfChangedHistory);
- DBWriteContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_CONDITION,bIfChangedPopup);
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE,sLogFile.c_str());
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_LOG_FILE,sLogFileFormat.c_str());
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_HISTORY,sHistoryFormat.c_str());
- DBWriteContactSettingTString(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_POPUP,sPopupFormat.c_str());
+ db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,bUseContactSpec);
+ db_set_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,nLogMode);
+ db_set_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE_CONDITION,nIfChangedFile);
+ db_set_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_HISTORY_CONDITION,nIfChangedHistory);
+ db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_CONDITION,bIfChangedPopup);
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE,sLogFile.c_str());
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_LOG_FILE,sLogFileFormat.c_str());
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_HISTORY,sHistoryFormat.c_str());
+ db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_POPUP,sPopupFormat.c_str());
if(pParam->m_pPopupSettings)
{
@@ -740,9 +740,9 @@ CAdvProviderSettings::CAdvProviderSettings(const IQuotesProvider* pQuotesProvide assert(visitor.m_pszDbLogFormat);
assert(visitor.m_pszDbLogCondition);
- m_wLogMode = DBGetContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogMode,static_cast<WORD>(lmDisabled));
+ m_wLogMode = db_get_w(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogMode,static_cast<WORD>(lmDisabled));
m_sFormatHistory = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryFormat,visitor.m_pszDefHistoryFormat);
- m_bIsOnlyChangedHistory = 1 == DBGetContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryCondition,0);
+ m_bIsOnlyChangedHistory = 1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryCondition,0);
m_sLogFileName = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFile);
if(true == m_sLogFileName.empty())
@@ -754,10 +754,10 @@ CAdvProviderSettings::CAdvProviderSettings(const IQuotesProvider* pQuotesProvide }
m_sFormatLogFile = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFormat,visitor.m_pszDefLogFileFormat);
- m_bIsOnlyChangedLogFile = (1 == DBGetContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogCondition,0));
+ m_bIsOnlyChangedLogFile = (1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogCondition,0));
m_sPopupFormat = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupFormat,visitor.m_pszDefPopupFormat);
- m_bShowPopupIfValueChanged = (1 == DBGetContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupCondition,0));
+ m_bShowPopupIfValueChanged = (1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupCondition,0));
}
CAdvProviderSettings::~CAdvProviderSettings()
@@ -788,23 +788,23 @@ void CAdvProviderSettings::SaveToDb()const assert(visitor.m_pszDbPopupDelayTimeout);
assert(visitor.m_pszDbPopupHistoryFlag);
- DBWriteContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogMode,m_wLogMode);
- DBWriteContactSettingTString(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryFormat,m_sFormatHistory.c_str());
- DBWriteContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryCondition,m_bIsOnlyChangedHistory);
- DBWriteContactSettingTString(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFile,m_sLogFileName.c_str());
- DBWriteContactSettingTString(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFormat,m_sFormatLogFile.c_str());
- DBWriteContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogCondition,m_bIsOnlyChangedLogFile);
- DBWriteContactSettingTString(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupFormat,m_sPopupFormat.c_str());
- DBWriteContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupCondition,m_bShowPopupIfValueChanged);
+ db_set_w(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogMode,m_wLogMode);
+ db_set_ts(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryFormat,m_sFormatHistory.c_str());
+ db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryCondition,m_bIsOnlyChangedHistory);
+ db_set_ts(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFile,m_sLogFileName.c_str());
+ db_set_ts(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFormat,m_sFormatLogFile.c_str());
+ db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogCondition,m_bIsOnlyChangedLogFile);
+ db_set_ts(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupFormat,m_sPopupFormat.c_str());
+ db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupCondition,m_bShowPopupIfValueChanged);
if(nullptr != m_pPopupSettings)
{
- DBWriteContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupColourMode,static_cast<BYTE>(m_pPopupSettings->GetColourMode()));
- DBWriteContactSettingDword(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupBkColour,m_pPopupSettings->GetColourBk());
- DBWriteContactSettingDword(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupTextColour,m_pPopupSettings->GetColourText());
- DBWriteContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayMode,static_cast<BYTE>(m_pPopupSettings->GetDelayMode()));
- DBWriteContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayTimeout,m_pPopupSettings->GetDelayTimeout());
- DBWriteContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupHistoryFlag,m_pPopupSettings->GetHistoryFlag());
+ db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupColourMode,static_cast<BYTE>(m_pPopupSettings->GetColourMode()));
+ db_set_dw(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupBkColour,m_pPopupSettings->GetColourBk());
+ db_set_dw(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupTextColour,m_pPopupSettings->GetColourText());
+ db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayMode,static_cast<BYTE>(m_pPopupSettings->GetDelayMode()));
+ db_set_w(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayTimeout,m_pPopupSettings->GetDelayTimeout());
+ db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupHistoryFlag,m_pPopupSettings->GetHistoryFlag());
}
}
@@ -917,22 +917,22 @@ CPopupSettings::CPopupSettings(const IQuotesProvider* pQuotesProvider) assert(visitor.m_pszDbPopupDelayTimeout);
assert(visitor.m_pszDbPopupHistoryFlag);
- BYTE m = DBGetContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupColourMode,static_cast<BYTE>(m_modeColour));
+ BYTE m = db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupColourMode,static_cast<BYTE>(m_modeColour));
if(m >= colourDefault && m <= colourUserDefined)
{
m_modeColour = static_cast<EColourMode>(m);
}
- m_rgbBkg = DBGetContactSettingDword(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupBkColour,m_rgbBkg);
- m_rgbText = DBGetContactSettingDword(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupTextColour,m_rgbText);
+ m_rgbBkg = db_get_dw(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupBkColour,m_rgbBkg);
+ m_rgbText = db_get_dw(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupTextColour,m_rgbText);
- m = DBGetContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayMode,static_cast<BYTE>(m_modeDelay));
+ m = db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayMode,static_cast<BYTE>(m_modeDelay));
if(m >= delayFromPopup && m <= delayPermanent)
{
m_modeDelay = static_cast<EDelayMode>(m);
}
- m_wDelay = DBGetContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayTimeout,m_wDelay);
- m_bUseHistory = (1 == DBGetContactSettingByte(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupHistoryFlag,m_bUseHistory));
+ m_wDelay = db_get_w(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayTimeout,m_wDelay);
+ m_bUseHistory = (1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupHistoryFlag,m_bUseHistory));
}
/*static */
@@ -949,32 +949,32 @@ COLORREF CPopupSettings::GetDefColourText() void CPopupSettings::InitForContact(HANDLE hContact)
{
- BYTE m = DBGetContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_MODE,static_cast<BYTE>(m_modeColour));
+ BYTE m = db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_MODE,static_cast<BYTE>(m_modeColour));
if(m >= CPopupSettings::colourDefault && m <= CPopupSettings::colourUserDefined)
{
m_modeColour = static_cast<CPopupSettings::EColourMode>(m);
}
- m_rgbBkg = DBGetContactSettingDword(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_BK,m_rgbBkg);
- m_rgbText = DBGetContactSettingDword(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_TEXT,m_rgbText);
+ m_rgbBkg = db_get_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_BK,m_rgbBkg);
+ m_rgbText = db_get_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_TEXT,m_rgbText);
- m = DBGetContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_MODE,static_cast<BYTE>(m_modeDelay));
+ m = db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_MODE,static_cast<BYTE>(m_modeDelay));
if(m >= CPopupSettings::delayFromPopup && m <= CPopupSettings::delayPermanent)
{
m_modeDelay = static_cast<CPopupSettings::EDelayMode>(m);
}
- m_wDelay = DBGetContactSettingWord(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_TIMEOUT,m_wDelay);
- m_bUseHistory = 1 == DBGetContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_HISTORY_FLAG,m_bUseHistory);
+ m_wDelay = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_TIMEOUT,m_wDelay);
+ m_bUseHistory = 1 == db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_HISTORY_FLAG,m_bUseHistory);
}
void CPopupSettings::SaveForContact(HANDLE hContact)const
{
- DBWriteContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_MODE,static_cast<BYTE>(m_modeColour));
- DBWriteContactSettingDword(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_BK,m_rgbBkg);
- DBWriteContactSettingDword(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_TEXT,m_rgbText);
- DBWriteContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_MODE,static_cast<BYTE>(m_modeDelay));
- DBWriteContactSettingWord(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_TIMEOUT,m_wDelay);
- DBWriteContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_HISTORY_FLAG,m_bUseHistory);
+ db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_MODE,static_cast<BYTE>(m_modeColour));
+ db_set_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_BK,m_rgbBkg);
+ db_set_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_TEXT,m_rgbText);
+ db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_MODE,static_cast<BYTE>(m_modeDelay));
+ db_set_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_TIMEOUT,m_wDelay);
+ db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_HISTORY_FLAG,m_bUseHistory);
}
CPopupSettings::EColourMode CPopupSettings::GetColourMode()const
@@ -1110,7 +1110,7 @@ tstring GetContactLogFileName(HANDLE hContact) if(pProvider)
{
tstring sPattern;
- bool bUseContactSpecific = (DBGetContactSettingByte(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,0) > 0);
+ bool bUseContactSpecific = (db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,0) > 0);
if(bUseContactSpecific)
{
sPattern = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE);
diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp index ea9fc78763..f3d0c8c21d 100644 --- a/plugins/Rate/src/main.cpp +++ b/plugins/Rate/src/main.cpp @@ -75,7 +75,7 @@ static void setExtraIcon(HANDLE hContact, int bRate = -1, BOOL clear = TRUE) return;
if (bRate < 0)
- bRate = DBGetContactSettingByte(hContact, "CList", "Rate", 0);
+ bRate = db_get_b(hContact, "CList", "Rate", 0);
const char *icon = NULL;
switch(bRate) {
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 8099152f09..1952c4557a 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -59,15 +59,15 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda void LoadDBSettings()
{
ZeroMemory(&LastUCOpt, sizeof(LastUCOpt));
- LastUCOpt.MaxShownContacts = (INT)DBGetContactSettingByte( NULL, dbLastUC_ModuleName, dbLastUC_MaxShownContacts, 0 );
- LastUCOpt.HideOffline = DBGetContactSettingByte( NULL, dbLastUC_ModuleName, dbLastUC_HideOfflineContacts, 0 );
+ LastUCOpt.MaxShownContacts = (INT)db_get_b( NULL, dbLastUC_ModuleName, dbLastUC_MaxShownContacts, 0 );
+ LastUCOpt.HideOffline = db_get_b( NULL, dbLastUC_ModuleName, dbLastUC_HideOfflineContacts, 0 );
DBVARIANT dbv;
dbv.type = DBVT_ASCIIZ;
dbv.pszVal = NULL;
if ( db_get(NULL, dbLastUC_ModuleName, dbLastUC_DateTimeFormat, &dbv) == 0 && dbv.pszVal[0]!=0 ) {
LastUCOpt.DateTimeFormat = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else LastUCOpt.DateTimeFormat = "(%Y-%m-%d %H:%M) ";
}
@@ -230,7 +230,7 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM dbv.pszVal = NULL;
if (db_get(NULL, dbLastUC_ModuleName, dbLastUC_DateTimeFormat, &dbv) == 0) {
strtimformat = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else strtimformat = dbLastUC_DateTimeFormatDefault;
@@ -242,7 +242,7 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM if (LastUCOpt.HideOffline == 1) {
szProto = GetContactProto(curContact->second);
- if (szProto != NULL && DBGetContactSettingWord((HANDLE)curContact->second, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
+ if (szProto != NULL && db_get_w((HANDLE)curContact->second, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
continue;
}
@@ -486,7 +486,7 @@ static int OnPrebuildContactMenu (WPARAM wParam, LPARAM lParam) CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_NAME | CMIF_TCHAR;
- if ( DBGetContactSettingByte((HANDLE)wParam, dbLastUC_ModuleName, dbLastUC_IgnoreContact, 0) == 0)
+ if ( db_get_b((HANDLE)wParam, dbLastUC_ModuleName, dbLastUC_IgnoreContact, 0) == 0)
clmi.ptszName = TranslateT("Ignore Contact");
else
clmi.ptszName = TranslateT("Show Contact");
@@ -518,8 +518,8 @@ INT_PTR ToggleIgnore (WPARAM wParam, LPARAM lParam) {
if (wParam != NULL) {
HANDLE hContact = ( HANDLE )wParam;
- int state = DBGetContactSettingByte(hContact, dbLastUC_ModuleName, dbLastUC_IgnoreContact, 0) == 0 ? 1 : 0 ;
- DBWriteContactSettingByte(hContact, dbLastUC_ModuleName, dbLastUC_IgnoreContact, state);
+ int state = db_get_b(hContact, dbLastUC_ModuleName, dbLastUC_IgnoreContact, 0) == 0 ? 1 : 0 ;
+ db_set_b(hContact, dbLastUC_ModuleName, dbLastUC_IgnoreContact, state);
return state;
}
diff --git a/plugins/RecentContacts/src/options.cpp b/plugins/RecentContacts/src/options.cpp index e8dd226a37..4e082f85f0 100644 --- a/plugins/RecentContacts/src/options.cpp +++ b/plugins/RecentContacts/src/options.cpp @@ -39,14 +39,14 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP BOOL bSuccess = FALSE;
LastUCOpt.HideOffline = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE);
- DBWriteContactSettingByte(NULL, dbLastUC_ModuleName, dbLastUC_HideOfflineContacts, (BYTE)LastUCOpt.HideOffline);
+ db_set_b(NULL, dbLastUC_ModuleName, dbLastUC_HideOfflineContacts, (BYTE)LastUCOpt.HideOffline);
GetDlgItemTextA(hwndDlg, IDC_SHOWNCONTACTS, str, SIZEOF(str));
LastUCOpt.MaxShownContacts= atoi(str);
- DBWriteContactSettingByte(0,dbLastUC_ModuleName, dbLastUC_MaxShownContacts, LastUCOpt.MaxShownContacts);
+ db_set_b(0,dbLastUC_ModuleName, dbLastUC_MaxShownContacts, LastUCOpt.MaxShownContacts);
GetDlgItemTextA(hwndDlg, IDC_DATETIME, str, SIZEOF(str));
- DBWriteContactSettingString(0,dbLastUC_ModuleName, dbLastUC_DateTimeFormat, str );
+ db_set_s(0,dbLastUC_ModuleName, dbLastUC_DateTimeFormat, str );
LoadDBSettings();
return TRUE;
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 4a60c271fd..cff9a72946 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -98,7 +98,7 @@ void UnloadServices() int SmsRebuildContactMenu(WPARAM wParam,LPARAM lParam)
{
- CListShowMenuItem(ssSMSSettings.hContactMenuItems[0],(BOOL)GetContactPhonesCount((HANDLE)wParam));
+ Menu_ShowItem(ssSMSSettings.hContactMenuItems[0], GetContactPhonesCount((HANDLE)wParam));
return 0;
}
diff --git a/plugins/SMS/src/common.h b/plugins/SMS/src/common.h index 14e04c614d..b0c3366480 100644 --- a/plugins/SMS/src/common.h +++ b/plugins/SMS/src/common.h @@ -40,10 +40,10 @@ extern HINSTANCE hInst; // ñòðóêòóðà ñîäåðæàùàÿ èíôîðìàöèþ ïî ïîñòðîåíèþ ìåíþ èëè ðàñøèðåíûõ èêîíîê
struct GUI_DISPLAY_ITEM
{
- LPSTR lpszName; // èìÿ ñåðâèñà, îíî æå èìÿ â èêîëèáå
- LPWSTR lpwszDescr; // òåêñòîâîå îïèñàíèå îòîáðàæàåìîå þçåðó
- LONG defIcon; // èêîíêà èç ðåñóðñîâ
- LPVOID lpFunc; // ôóíêöèÿ âûçûâàåìàÿ ìåíþ
+ LPSTR lpszName; // èìÿ ñåðâèñà, îíî æå èìÿ â èêîëèáå
+ LPWSTR lpwszDescr; // òåêñòîâîå îïèñàíèå îòîáðàæàåìîå þçåðó
+ LONG defIcon; // èêîíêà èç ðåñóðñîâ
+ LPVOID lpFunc; // ôóíêöèÿ âûçûâàåìàÿ ìåíþ
};
@@ -53,28 +53,25 @@ struct GUI_DISPLAY_ITEM typedef struct
{
- HANDLE hHeap;
- HINSTANCE hInstance;
+ HANDLE hHeap;
+ HINSTANCE hInstance;
- //HANDLE hMainMenuIcons[MAIN_MENU_ITEMS_COUNT+1];
- HANDLE hMainMenuItems[MAIN_MENU_ITEMS_COUNT+1];
+ HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT+1];
+ HGENMENU hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+1];
- //HANDLE hContactMenuIcons[CONTACT_MENU_ITEMS_COUNT+1];
- HANDLE hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+1];
+ HANDLE hHookModulesLoaded;
+ HANDLE hHookPreShutdown;
+ HANDLE hHookOptInitialize;
+ HANDLE hHookRebuildCMenu;
+ HANDLE hHookDbAdd;
+ HANDLE hHookProtoAck;
+ HANDLE hHookAccListChanged;
- HANDLE hHookModulesLoaded;
- HANDLE hHookPreShutdown;
- HANDLE hHookOptInitialize;
- HANDLE hHookRebuildCMenu;
- HANDLE hHookDbAdd;
- HANDLE hHookProtoAck;
- HANDLE hHookAccListChanged;
+ LIST_MT lmtSendSMSWindowsListMT;
+ LIST_MT lmtRecvSMSWindowsListMT;
- LIST_MT lmtSendSMSWindowsListMT;
- LIST_MT lmtRecvSMSWindowsListMT;
-
- PROTOACCOUNT **ppaSMSAccounts;
- SIZE_T dwSMSAccountsCount;
+ PROTOACCOUNT **ppaSMSAccounts;
+ SIZE_T dwSMSAccountsCount;
} SMS_SETTINGS;
@@ -115,25 +112,24 @@ extern SMS_SETTINGS ssSMSSettings; #define GetContactNameA(Contact) (LPSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)Contact,0)
#define GetContactNameW(Contact) (LPWSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)Contact,GCDNF_UNICODE)
-#define DB_SMS_DeleteValue(Contact,valueName) DBDeleteContactSetting(Contact,PROTOCOL_NAMEA,valueName)
-#define DB_SMS_GetDword(Contact,valueName,parDefltValue) DBGetContactSettingDword(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
-#define DB_SMS_SetDword(Contact,valueName,parValue) DBWriteContactSettingDword(Contact,PROTOCOL_NAMEA,valueName,parValue)
-#define DB_SMS_GetWord(Contact,valueName,parDefltValue) DBGetContactSettingWord(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
-#define DB_SMS_SetWord(Contact,valueName,parValue) DBWriteContactSettingWord(Contact,PROTOCOL_NAMEA,valueName,parValue)
-#define DB_SMS_GetByte(Contact,valueName,parDefltValue) DBGetContactSettingByte(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
-#define DB_SMS_SetByte(Contact,valueName,parValue) DBWriteContactSettingByte(Contact,PROTOCOL_NAMEA,valueName,parValue)
+#define DB_SMS_DeleteValue(Contact,valueName) db_unset(Contact,PROTOCOL_NAMEA,valueName)
+#define DB_SMS_GetDword(Contact,valueName,parDefltValue) db_get_dw(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
+#define DB_SMS_SetDword(Contact,valueName,parValue) db_set_dw(Contact,PROTOCOL_NAMEA,valueName,parValue)
+#define DB_SMS_GetWord(Contact,valueName,parDefltValue) db_get_w(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
+#define DB_SMS_SetWord(Contact,valueName,parValue) db_set_w(Contact,PROTOCOL_NAMEA,valueName,parValue)
+#define DB_SMS_GetByte(Contact,valueName,parDefltValue) db_get_b(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
+#define DB_SMS_SetByte(Contact,valueName,parValue) db_set_b(Contact,PROTOCOL_NAMEA,valueName,parValue)
BOOL DB_GetStaticStringW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpszRetBuff,SIZE_T dwRetBuffSize,SIZE_T *pdwRetBuffSize);
#define DB_SMS_GetStaticStringW(Contact,ValueName,Ret,RetBuffSize,pRetBuffSize) DB_GetStaticStringW(Contact,PROTOCOL_NAMEA,ValueName,Ret,RetBuffSize,pRetBuffSize)
BOOL DB_SetStringExW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszValue,SIZE_T dwValueSize);
-#define DB_SetStringW(Contact,Module,valueName,parValue) DBWriteContactSettingWString(Contact,Module,valueName,parValue)
-#define DB_SMS_SetStringW(Contact,valueName,parValue) DBWriteContactSettingWString(Contact,PROTOCOL_NAMEA,valueName,parValue)
+#define DB_SetStringW(Contact,Module,valueName,parValue) db_set_ws(Contact,Module,valueName,parValue)
+#define DB_SMS_SetStringW(Contact,valueName,parValue) db_set_ws(Contact,PROTOCOL_NAMEA,valueName,parValue)
#define DB_SMS_SetStringExW(Contact,valueName,parValue,parValueSize) DB_SetStringExW(Contact,PROTOCOL_NAMEA,valueName,parValue,parValueSize)
LRESULT CALLBACK MessageSubclassProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
LPSTR GetModuleName(HANDLE hContact);
void EnableControlsArray(HWND hWndDlg,WORD *pwControlsList,SIZE_T dwControlsListCount,BOOL bEnabled);
-void CListShowMenuItem(HANDLE hMenuItem,BOOL bShow);
// Declaration of function that returns received string with only numbers
SIZE_T CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,SIZE_T dwLen);
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index 0bdb9ce46e..5110270f3c 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -24,7 +24,7 @@ BOOL DB_GetStaticStringW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LP }
if (pdwRetBuffSize) (*pdwRetBuffSize)=dwReadedStringLen;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}else{
if (lpwszRetBuff && dwRetBuffSize>=sizeof(WCHAR)) (*((WCHAR*)lpwszRetBuff))=0;
if (pdwRetBuffSize) (*pdwRetBuffSize)=0;
@@ -56,7 +56,7 @@ BOOL DB_SetStringExW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR }
}else{
bRet=TRUE;
- DBDeleteContactSetting(hContact,lpszModule,lpszValueName);
+ db_unset(hContact,lpszModule,lpszValueName);
}
return(bRet);
}
@@ -81,19 +81,6 @@ void EnableControlsArray(HWND hWndDlg,WORD *pwControlsList,SIZE_T dwControlsList for(SIZE_T i=0;i<dwControlsListCount;i++) EnableWindow(GetDlgItem(hWndDlg,pwControlsList[i]),bEnabled);
}
-
-void CListShowMenuItem(HANDLE hMenuItem,BOOL bShow)
-{
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.flags=CMIM_FLAGS;
- if (bShow==FALSE) mi.flags|=CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuItem,(LPARAM)&mi);
-}
-
-
//This function gets a Cellular string szPhone and clean it from symbools.
SIZE_T CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,SIZE_T dwLen)
{
@@ -570,32 +557,32 @@ void LoadMsgDlgFont(int i,LOGFONT *lf,COLORREF *colour) if (colour)
{
mir_snprintf(str,sizeof(str),"Font%dCol",i);
- (*colour)=DBGetContactSettingDword(NULL,SRMMMOD,str,fontOptionsList[0].defColour);
+ (*colour)=db_get_dw(NULL,SRMMMOD,str,fontOptionsList[0].defColour);
}
if (lf)
{
- if (DBGetContactSetting(NULL,SRMMMOD,str,&dbv))
+ if (db_get(NULL,SRMMMOD,str,&dbv))
{
lstrcpyn(lf->lfFaceName,fontOptionsList[0].szDefFace,SIZEOF(lf->lfFaceName));
}else{
lstrcpyn(lf->lfFaceName,dbv.ptszVal,SIZEOF(lf->lfFaceName));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
mir_snprintf(str,sizeof(str),"Font%dSize",i);
- lf->lfHeight=(char)DBGetContactSettingByte(NULL,SRMMMOD,str,fontOptionsList[0].defSize);
+ lf->lfHeight=(char)db_get_b(NULL,SRMMMOD,str,fontOptionsList[0].defSize);
lf->lfWidth=0;
lf->lfEscapement=0;
lf->lfOrientation=0;
mir_snprintf(str,sizeof(str),"Font%dSty",i);
- style=DBGetContactSettingByte(NULL,SRMMMOD,str,fontOptionsList[0].defStyle);
+ style=db_get_b(NULL,SRMMMOD,str,fontOptionsList[0].defStyle);
lf->lfWeight=style&FONTF_BOLD?FW_BOLD:FW_NORMAL;
lf->lfItalic=style&FONTF_ITALIC?1:0;
lf->lfUnderline=0;
lf->lfStrikeOut=0;
mir_snprintf(str,sizeof(str),"Font%dSet",i);
- lf->lfCharSet=DBGetContactSettingByte(NULL,SRMMMOD,str,MsgDlgGetFontDefaultCharset(lf->lfFaceName));
+ lf->lfCharSet=db_get_b(NULL,SRMMMOD,str,MsgDlgGetFontDefaultCharset(lf->lfFaceName));
lf->lfOutPrecision=OUT_DEFAULT_PRECIS;
lf->lfClipPrecision=CLIP_DEFAULT_PRECIS;
lf->lfQuality=DEFAULT_QUALITY;
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index 24464c29bd..40d52cde6f 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -83,7 +83,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l hFont=CreateFontIndirect(&lf);
SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
- COLORREF colour=DBGetContactSettingDword(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR);
+ COLORREF colour=db_get_dw(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR);
prswdWindowData->hBkgBrush=CreateSolidBrush(colour);
}
@@ -100,7 +100,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l LoadMsgDlgFont(MSGFONTID_YOURMSG,NULL,&colour);
SetTextColor((HDC)wParam,colour);
- SetBkColor((HDC)wParam,DBGetContactSettingDword(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR));
+ SetBkColor((HDC)wParam,db_get_dw(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR));
return((BOOL)prswdWindowData->hBkgBrush);
}
break;
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 965e7fcb6e..ce85e08ecc 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -105,7 +105,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l hFont=CreateFontIndirect(&lf);
SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
- COLORREF colour=DBGetContactSettingDword(NULL,SRMMMOD,SRMSGSET_INPBKGCOLOUR,SRMSGDEFSET_BKGCOLOUR);
+ COLORREF colour=db_get_dw(NULL,SRMMMOD,SRMSGSET_INPBKGCOLOUR,SRMSGDEFSET_BKGCOLOUR);
psswdWindowData->hBkgBrush=CreateSolidBrush(colour);
}
{
@@ -235,7 +235,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l LoadMsgDlgFont(MSGFONTID_MESSAGEAREA,NULL,&colour);
SetTextColor((HDC)wParam,colour);
- SetBkColor((HDC)wParam,DBGetContactSettingDword(NULL,SRMMMOD,SRMSGSET_INPBKGCOLOUR,SRMSGDEFSET_BKGCOLOUR));
+ SetBkColor((HDC)wParam,db_get_dw(NULL,SRMMMOD,SRMSGSET_INPBKGCOLOUR,SRMSGDEFSET_BKGCOLOUR));
return((BOOL)psswdWindowData->hBkgBrush);
}
break;
@@ -410,8 +410,8 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l for(DWORD i=0;bCont;i++)
{
mir_snprintf(szBuff,SIZEOF(szBuff),"MyPhone%d",i);
- if (DBGetContactSetting(psswdWindowData->hMyContact,"UserInfo",szBuff,&dbv)) bCont=FALSE;
- DBFreeVariant(&dbv);
+ if (db_get(psswdWindowData->hMyContact,"UserInfo",szBuff,&dbv)) bCont=FALSE;
+ db_free(&dbv);
}
DB_SetStringW(psswdWindowData->hMyContact,"UserInfo",szBuff,wszPhone);
}
diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp index 697d46c94d..9cb2f09b09 100644 --- a/plugins/Scriver/src/chat/clist.cpp +++ b/plugins/Scriver/src/chat/clist.cpp @@ -30,7 +30,7 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p TCHAR pszGroup[50];
*pszGroup = '\0';
- if ( !DBGetContactSettingTString(NULL, "Chat", "AddToGroup", &dbv)) {
+ if ( !db_get_ts(NULL, "Chat", "AddToGroup", &dbv)) {
if ( lstrlen(dbv.ptszVal) > 0 )
lstrcpyn( pszGroup, dbv.ptszVal, 50);
db_free(&dbv);
@@ -47,12 +47,12 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p _itoa(i, str, 10);
DBVARIANT dbv, dbv2;
- if (DBGetContactSettingTString( NULL, "CListGroups", str, &dbv)) {
+ if (db_get_ts( NULL, "CListGroups", str, &dbv)) {
db_set_ts(hContact, "CList", "Group", pszGroup);
goto END_GROUPLOOP;
}
- if ( !DBGetContactSettingTString( hContact, "CList", "Group", &dbv2 )) {
+ if ( !db_get_ts( hContact, "CList", "Group", &dbv2 )) {
if ( dbv.ptszVal[0] != '\0' && dbv2.ptszVal[0] != '\0' && !lstrcmpi( dbv.ptszVal + 1, dbv2.ptszVal )) {
db_free(&dbv);
db_free(&dbv2);
@@ -129,7 +129,7 @@ int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) if (db_get_b(hContact, szProto, "ChatRoom", 0) == 0)
return 0;
- if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) {
+ if ( !db_get_ts( hContact, szProto, "ChatRoomID", &dbv )) {
SESSION_INFO* si = SM_FindSession( dbv.ptszVal, szProto );
if ( si ) {
// is the "toggle visibility option set, so we need to close the window?
@@ -233,7 +233,7 @@ void CList_CreateGroup(TCHAR* group) for (i = 0;; i++) {
_itoa(i, str, 10);
- if ( DBGetContactSettingTString( NULL, "CListGroups", str, &dbv ))
+ if ( db_get_ts( NULL, "CListGroups", str, &dbv ))
break;
if ( dbv.pszVal[0] != '\0' && !lstrcmpi(dbv.ptszVal + 1, group)) {
@@ -289,7 +289,7 @@ HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom) if (szProto && !lstrcmpiA(szProto, pszModule)) {
if ( db_get_b( hContact, szProto, "ChatRoom", 0) != 0) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv)) {
+ if ( !db_get_ts( hContact, szProto, "ChatRoomID", &dbv)) {
if ( !lstrcmpi(dbv.ptszVal, pszRoom)) {
db_free(&dbv);
return hContact;
diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index ac05d01576..07ad481eea 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -928,7 +928,7 @@ void LoadMsgLogBitmaps(void) int rtfHeaderSize;
PBYTE pBmpBits;
- hBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW)));
+ hBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW)));
bih.biSize = sizeof(bih);
bih.biBitCount = 24;
bih.biCompression = BI_RGB;
diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp index 5d1ef90de1..50bb2287fe 100644 --- a/plugins/Scriver/src/chat/manager.cpp +++ b/plugins/Scriver/src/chat/manager.cpp @@ -119,8 +119,8 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeConta /* if (pTemp->iType != GCW_SERVER)
db_set_b(pTemp->windowData.hContact, "CList", "Hidden", 1);*/
}
- DBWriteContactSettingString(pTemp->windowData.hContact, pTemp->pszModule , "Topic", "");
- DBWriteContactSettingString(pTemp->windowData.hContact, pTemp->pszModule, "StatusBar", "");
+ db_set_s(pTemp->windowData.hContact, pTemp->pszModule , "Topic", "");
+ db_set_s(pTemp->windowData.hContact, pTemp->pszModule, "StatusBar", "");
db_unset(pTemp->windowData.hContact, "CList", "StatusMsg");
if (removeContact)
@@ -681,9 +681,9 @@ BOOL SM_RemoveAll (void) DoEventHook(m_WndList->ptszID, m_WndList->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)m_WndList->dwItemData);
if (m_WndList->windowData.hContact)
CList_SetOffline(m_WndList->windowData.hContact, m_WndList->iType == GCW_CHATROOM?TRUE:FALSE);
- DBWriteContactSettingString(m_WndList->windowData.hContact, m_WndList->pszModule , "Topic", "");
+ db_set_s(m_WndList->windowData.hContact, m_WndList->pszModule , "Topic", "");
db_unset(m_WndList->windowData.hContact, "CList", "StatusMsg");
- DBWriteContactSettingString(m_WndList->windowData.hContact, m_WndList->pszModule, "StatusBar", "");
+ db_set_s(m_WndList->windowData.hContact, m_WndList->pszModule, "StatusBar", "");
UM_RemoveAll(&m_WndList->pUsers);
TM_RemoveAll(&m_WndList->pStatuses);
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index e2826f56f1..f465caeea7 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -131,7 +131,7 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, struct branch_t *branch tvis.item.pszText = TranslateTS(branch[i].szDescr);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
if (branch[i].iMode)
- iState = ((DBGetContactSettingDword(NULL, "Chat", branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode)!=0?2:1;
+ iState = ((db_get_dw(NULL, "Chat", branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode)!=0?2:1;
else
iState = db_get_b(NULL, "Chat", branch[i].szDBName, branch[i].bDefault)!=0?2:1;
tvis.item.state=INDEXTOSTATEIMAGEMASK(iState);
@@ -156,7 +156,7 @@ static void SaveBranch(HWND hwndTree, struct branch_t *branch, int nValues) iState |= branch[i].iMode;
if (iState&GC_EVENT_ADDSTATUS)
iState |= GC_EVENT_REMOVESTATUS;
- DBWriteContactSettingDword(NULL, "Chat", branch[i].szDBName, (DWORD)iState);
+ db_set_dw(NULL, "Chat", branch[i].szDBName, (DWORD)iState);
}
else db_set_b(NULL, "Chat", branch[i].szDBName, bChecked);
} }
@@ -234,7 +234,7 @@ void LoadLogFonts(void) static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "Chat", pszSetting, &dbv )) {
+ if ( !db_get_ts(NULL, "Chat", pszSetting, &dbv )) {
replaceStr( ppPointer, dbv.ptszVal );
db_free(&dbv);
}
@@ -329,9 +329,9 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa {
pszText = (char *)mir_realloc(pszText, iLen+1);
GetDlgItemTextA(hwndDlg, IDC_CHAT_GROUP, pszText,iLen+1);
- DBWriteContactSettingString(NULL, "Chat", "AddToGroup", pszText);
+ db_set_s(NULL, "Chat", "AddToGroup", pszText);
}
- else DBWriteContactSettingString(NULL, "Chat", "AddToGroup", "");
+ else db_set_s(NULL, "Chat", "AddToGroup", "");
mir_free(pszText);
iLen = SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_GETPOS,0,0);
@@ -569,7 +569,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa if ( iLen > 0 ) {
pszText = (char *)mir_realloc(pszText, iLen+1);
GetDlgItemTextA(hwndDlg, IDC_CHAT_LOGTIMESTAMP, pszText,iLen+1);
- DBWriteContactSettingString(NULL, "Chat", "LogTimestamp", pszText);
+ db_set_s(NULL, "Chat", "LogTimestamp", pszText);
}
else db_unset(NULL, "Chat", "LogTimestamp");
@@ -577,7 +577,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa if ( iLen > 0 ) {
pszText = (char *)mir_realloc(pszText, iLen+1);
GetDlgItemTextA(hwndDlg, IDC_CHAT_TIMESTAMP, pszText,iLen+1);
- DBWriteContactSettingString(NULL, "Chat", "HeaderTime", pszText);
+ db_set_s(NULL, "Chat", "HeaderTime", pszText);
}
else db_unset(NULL, "Chat", "HeaderTime");
@@ -585,7 +585,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa if ( iLen > 0 ) {
pszText = (char *)mir_realloc(pszText, iLen+1);
GetDlgItemTextA(hwndDlg, IDC_CHAT_INSTAMP, pszText,iLen+1);
- DBWriteContactSettingString(NULL, "Chat", "HeaderIncoming", pszText);
+ db_set_s(NULL, "Chat", "HeaderIncoming", pszText);
}
else db_unset(NULL, "Chat", "HeaderIncoming");
@@ -593,7 +593,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa if ( iLen > 0 ) {
pszText = (char *)mir_realloc(pszText, iLen+1);
GetDlgItemTextA(hwndDlg, IDC_CHAT_OUTSTAMP, pszText,iLen+1);
- DBWriteContactSettingString(NULL, "Chat", "HeaderOutgoing", pszText);
+ db_set_s(NULL, "Chat", "HeaderOutgoing", pszText);
}
else db_unset(NULL, "Chat", "HeaderOutgoing");
@@ -613,9 +613,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa mir_free(pszText);
- g_Settings.dwIconFlags = DBGetContactSettingDword(NULL, "Chat", "IconFlags", 0x0000);
- g_Settings.dwTrayIconFlags = DBGetContactSettingDword(NULL, "Chat", "TrayIconFlags", 0x1000);
- g_Settings.dwPopupFlags = DBGetContactSettingDword(NULL, "Chat", "PopupFlags", 0x0000);
+ g_Settings.dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000);
+ g_Settings.dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000);
+ g_Settings.dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000);
g_Settings.StripFormat = (BOOL)db_get_b(NULL, "Chat", "TrimFormatting", 0);
g_Settings.TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
g_Settings.PopUpInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1);
@@ -732,9 +732,9 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam db_set_w(NULL, "Chat", "PopupTimeout", (WORD)iLen);
g_Settings.crPUBkgColour = SendDlgItemMessage(hwndDlg,IDC_CHAT_BKG,CPM_GETCOLOUR,0,0);
- DBWriteContactSettingDword(NULL, "Chat", "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg,IDC_CHAT_BKG,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, "Chat", "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg,IDC_CHAT_BKG,CPM_GETCOLOUR,0,0));
g_Settings.crPUTextColour = SendDlgItemMessage(hwndDlg,IDC_CHAT_TEXT,CPM_GETCOLOUR,0,0);
- DBWriteContactSettingDword(NULL, "Chat", "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg,IDC_CHAT_TEXT,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, "Chat", "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg,IDC_CHAT_TEXT,CPM_GETCOLOUR,0,0));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch6, SIZEOF(branch6));
}
return TRUE;
@@ -779,26 +779,26 @@ void LoadGlobalSettings(void) g_Settings.ShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0);
g_Settings.TimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0);
g_Settings.iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100);
- g_Settings.dwIconFlags = DBGetContactSettingDword(NULL, "Chat", "IconFlags", 0x0000);
- g_Settings.dwTrayIconFlags = DBGetContactSettingDword(NULL, "Chat", "TrayIconFlags", 0x1000);
- g_Settings.dwPopupFlags = DBGetContactSettingDword(NULL, "Chat", "PopupFlags", 0x0000);
+ g_Settings.dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000);
+ g_Settings.dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000);
+ g_Settings.dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000);
g_Settings.LoggingLimit = db_get_w(NULL, "Chat", "LoggingLimit", 100);
g_Settings.LoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0);
g_Settings.FlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0);
g_Settings.HighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1);
- g_Settings.crUserListColor = DBGetContactSettingDword(NULL, "ChatFonts", "Font18Col", RGB(0,0,0));
- g_Settings.crUserListBGColor = DBGetContactSettingDword(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
- g_Settings.crUserListSelectedBGColor = DBGetContactSettingDword(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
- g_Settings.crUserListHeadingsColor = DBGetContactSettingDword(NULL, "ChatFonts", "Font19Col", RGB(170,170,170));
- g_Settings.crLogBackground = DBGetContactSettingDword(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW));
+ g_Settings.crUserListColor = db_get_dw(NULL, "ChatFonts", "Font18Col", RGB(0,0,0));
+ g_Settings.crUserListBGColor = db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
+ g_Settings.crUserListSelectedBGColor = db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
+ g_Settings.crUserListHeadingsColor = db_get_dw(NULL, "ChatFonts", "Font19Col", RGB(170,170,170));
+ g_Settings.crLogBackground = db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW));
g_Settings.StripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0);
g_Settings.TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
g_Settings.PopUpInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1);
g_Settings.AddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1);
g_Settings.iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1);
g_Settings.iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3);
- g_Settings.crPUBkgColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
- g_Settings.crPUTextColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorText", 0);
+ g_Settings.crPUBkgColour = db_get_dw(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
+ g_Settings.crPUTextColour = db_get_dw(NULL, "Chat", "PopupColorText", 0);
g_Settings.ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0);
g_Settings.ContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0);
@@ -810,7 +810,7 @@ void LoadGlobalSettings(void) DBVARIANT dbv;
g_Settings.pszLogDir = (TCHAR *)mir_realloc(g_Settings.pszLogDir, MAX_PATH*sizeof(TCHAR));
- if ( !DBGetContactSettingTString(NULL, "Chat", "LogDirectory", &dbv)) {
+ if ( !db_get_ts(NULL, "Chat", "LogDirectory", &dbv)) {
lstrcpyn(g_Settings.pszLogDir, dbv.ptszVal, MAX_PATH);
db_free(&dbv);
}
@@ -835,11 +835,11 @@ void LoadGlobalSettings(void) if (hListBkgBrush != NULL)
DeleteObject(hListBkgBrush);
- hListBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)));
+ hListBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)));
if (hListSelectedBkgBrush != NULL)
DeleteObject(hListSelectedBkgBrush);
- hListSelectedBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)));
+ hListSelectedBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)));
}
static void FreeGlobalSettings(void)
diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp index c9a578e76d..9c2bbbe244 100644 --- a/plugins/Scriver/src/chat/services.cpp +++ b/plugins/Scriver/src/chat/services.cpp @@ -221,7 +221,7 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->ptszStatusbarText = a2tf( gcw->ptszStatusbarText, gcw->dwFlags );
si->iSplitterX = g_Settings.iSplitterX;
si->iSplitterY = g_Settings.iSplitterY;
- si->iLogFilterFlags = (int)DBGetContactSettingDword(NULL, "Chat", "FilterFlags", 0x03E0);
+ si->iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0);
si->bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0);
si->bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1);
@@ -246,12 +246,12 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->windowData.hContact = CList_AddRoom( gcw->pszModule, ptszID, szTemp, si->iType);
si->windowData.codePage = db_get_w(si->windowData.hContact, si->pszModule, "CodePage", (WORD) CP_ACP);
si->pszHeader = Log_CreateRtfHeader(mi, si);
- DBWriteContactSettingString(si->windowData.hContact, si->pszModule , "Topic", "");
+ db_set_s(si->windowData.hContact, si->pszModule , "Topic", "");
db_unset(si->windowData.hContact, "CList", "StatusMsg");
if (si->ptszStatusbarText)
db_set_ts(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
- DBWriteContactSettingString(si->windowData.hContact, si->pszModule, "StatusBar", "");
+ db_set_s(si->windowData.hContact, si->pszModule, "StatusBar", "");
}
else {
SESSION_INFO* si2 = SM_FindSession( ptszID, gcw->pszModule );
@@ -370,7 +370,7 @@ static INT_PTR DoControl(GCEVENT * gce, WPARAM wp) if ( si->ptszStatusbarText )
db_set_ts(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
- DBWriteContactSettingString(si->windowData.hContact, si->pszModule, "StatusBar", "");
+ db_set_s(si->windowData.hContact, si->pszModule, "StatusBar", "");
if (si->hWnd)
{
SendMessage(si->hWnd, DM_UPDATESTATUSBAR, 0, 0);
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index f30fefb135..a09a1d290a 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -385,7 +385,7 @@ void CheckColorsInModule(const char* pszModule) MODULEINFO * pMod = MM_FindModule( pszModule );
int i = 0;
COLORREF crFG;
- COLORREF crBG = (COLORREF)DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ COLORREF crBG = (COLORREF)db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFG, FALSE);
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index fa803330ce..a384eeb7e4 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -494,7 +494,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bBkgColor) {
int index = GetColorIndex(Parentsi->pszModule, cf.crBackColor);
- COLORREF crB = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ COLORREF crB = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BKGCOLOR);
if (index >= 0) {
@@ -1178,8 +1178,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) cf.dwMask = CFM_COLOR|CFM_BOLD|CFM_UNDERLINE|CFM_BACKCOLOR;
cf.dwEffects = 0;
cf.crTextColor = crFore;
- cf.crBackColor = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_SETBKGNDCOLOR , 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
+ cf.crBackColor = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_SETBKGNDCOLOR , 0, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETFONT, (WPARAM) g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL , (LPARAM)&cf);
}
@@ -1933,7 +1933,7 @@ LABEL_SHOWWINDOW: } }
else {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ cf.crBackColor = (COLORREF)db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
if (pInfo->bSingleFormat) {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
} else {
@@ -2066,7 +2066,7 @@ LABEL_SHOWWINDOW: i = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (i > 0) {
g_dat.chatBbuttonVisibility ^= (1 << (i - 1));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, g_dat.chatBbuttonVisibility);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, g_dat.chatBbuttonVisibility);
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
}
DestroyMenu(hToolbarMenu);
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index e01fb19a9e..0f8d96f139 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -238,11 +238,11 @@ void LoadInfobarFonts() {
LOGFONT lf;
LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL, FALSE);
- g_dat.minInputAreaHeight = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES) * abs(lf.lfHeight) * g_dat.logPixelSY / 72;
+ g_dat.minInputAreaHeight = db_get_dw(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES) * abs(lf.lfHeight) * g_dat.logPixelSY / 72;
if (g_dat.hInfobarBrush != NULL)
DeleteObject(g_dat.hInfobarBrush);
- g_dat.hInfobarBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR));
+ g_dat.hInfobarBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR));
}
void InitGlobals()
@@ -343,9 +343,9 @@ void ReloadGlobals() if (db_get_b(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT))
g_dat.flags |= SMF_INDENTTEXT;
- g_dat.openFlags = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
+ g_dat.openFlags = db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
g_dat.indentSize = db_get_w(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE);
- g_dat.logLineColour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR);
+ g_dat.logLineColour = db_get_dw(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR);
if (db_get_b(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS))
g_dat.flags2 |= SMF2_USETABS;
@@ -391,18 +391,18 @@ void ReloadGlobals() if (LOBYTE(LOWORD(GetVersion())) >= 5 && pSetLayeredWindowAttributes != NULL) {
if (db_get_b(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY))
g_dat.flags2 |= SMF2_USETRANSPARENCY;
- g_dat.activeAlpha = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA);
- g_dat.inactiveAlpha = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA);
+ g_dat.activeAlpha = db_get_dw(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA);
+ g_dat.inactiveAlpha = db_get_dw(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA);
}
if (db_get_b(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW))
g_dat.flags |= SMF_USEIEVIEW;
- g_dat.buttonVisibility = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, SRMSGDEFSET_BUTTONVISIBILITY);
- g_dat.chatBbuttonVisibility = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, SRMSGDEFSET_CHATBUTTONVISIBILITY);
+ g_dat.buttonVisibility = db_get_dw(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, SRMSGDEFSET_BUTTONVISIBILITY);
+ g_dat.chatBbuttonVisibility = db_get_dw(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, SRMSGDEFSET_CHATBUTTONVISIBILITY);
- g_dat.limitNamesLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
- g_dat.limitTabsNum = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
- g_dat.limitChatsTabsNum = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
+ g_dat.limitNamesLength = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
+ g_dat.limitTabsNum = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
+ g_dat.limitChatsTabsNum = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
}
static int ackevent(WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 0c59d7fc0f..9ffe857006 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -28,7 +28,7 @@ void SetupInfobar(InfobarWindowData* idat) { CHARFORMAT2 cf2;
memset(&cf2, 0, sizeof(cf2));
LOGFONT lf;
- DWORD colour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR);
+ DWORD colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR);
SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETBKGNDCOLOR, 0, colour);
SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETBKGNDCOLOR, 0, colour);
LoadMsgDlgFont(MSGFONTID_INFOBAR_NAME, &lf, &colour, FALSE);
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index b1419dff25..75d5fb77f2 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1014,7 +1014,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP i = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (i > 0) {
g_dat.buttonVisibility ^= (1 << (i - 1));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, g_dat.buttonVisibility);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, g_dat.buttonVisibility);
WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
}
DestroyMenu(hToolbarMenu);
@@ -1191,9 +1191,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(hwndDlg, DM_GETAVATAR, 0, 0);
SetDialogToType(hwndDlg);
- colour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETBKGNDCOLOR, 0, colour);
- colour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETBKGNDCOLOR, 0, colour);
InvalidateRect(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, FALSE);
LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour, FALSE);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 83f142d87b..6d6be46791 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -394,11 +394,11 @@ static char *CreateRTFHeader(struct SrmmWindowData *dat, struct GlobalMessageDat else
colour = GetSysColor(COLOR_HOTLIGHT);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
- colour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
- colour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INCOMINGBKGCOLOUR, SRMSGDEFSET_INCOMINGBKGCOLOUR);
+ colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INCOMINGBKGCOLOUR, SRMSGDEFSET_INCOMINGBKGCOLOUR);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
- colour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_OUTGOINGBKGCOLOUR, SRMSGDEFSET_OUTGOINGBKGCOLOUR);
+ colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_OUTGOINGBKGCOLOUR, SRMSGDEFSET_OUTGOINGBKGCOLOUR);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
colour = gdat->logLineColour;
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
@@ -992,9 +992,9 @@ void LoadMsgLogIcons(void) PBYTE pBmpBits;
g_hImageList = ImageList_Create(10, 10, IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, sizeof(pLogIconBmpBits) / sizeof(pLogIconBmpBits[0]), 0);
- hBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
- hInBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INCOMINGBKGCOLOUR, SRMSGDEFSET_INCOMINGBKGCOLOUR));
- hOutBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_OUTGOINGBKGCOLOUR, SRMSGDEFSET_OUTGOINGBKGCOLOUR));
+ hBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
+ hInBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_INCOMINGBKGCOLOUR, SRMSGDEFSET_INCOMINGBKGCOLOUR));
+ hOutBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_OUTGOINGBKGCOLOUR, SRMSGDEFSET_OUTGOINGBKGCOLOUR));
bih.biSize = sizeof(bih);
bih.biBitCount = 24;
bih.biCompression = BI_RGB;
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index da590c3acf..4997af2a44 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -258,7 +258,7 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode) if (colour) {
wsprintfA(str, "%s%dCol", prefix, i);
- *colour = DBGetContactSettingDword(NULL, module, str, fontList[i].defColour);
+ *colour = db_get_dw(NULL, module, str, fontList[i].defColour);
}
if (lf) {
wsprintfA(str, "%s%dSize", prefix, i);
@@ -277,7 +277,7 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode) lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
wsprintfA(str, "%s%d", prefix, i);
- if (DBGetContactSettingTString(NULL, module, str, &dbv))
+ if (db_get_ts(NULL, module, str, &dbv))
lstrcpy(lf->lfFaceName, fontList[i].szDefFace);
else {
_tcsncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
@@ -372,15 +372,15 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam CheckDlgButton(hwndDlg, IDC_SWITCHTOACTIVE, db_get_b(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE));
CheckDlgButton(hwndDlg, IDC_TABCLOSEBUTTON, db_get_b(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON));
CheckDlgButton(hwndDlg, IDC_LIMITNAMES, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES));
- limitLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
+ limitLength = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
(int)SetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, limitLength >= SRMSGSET_LIMITNAMESLEN_MIN ? limitLength : SRMSGDEFSET_LIMITNAMESLEN, FALSE);
CheckDlgButton(hwndDlg, IDC_LIMITTABS, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS));
- limitLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
+ limitLength = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
SetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, limitLength >= 1 ? limitLength : 1, FALSE);
CheckDlgButton(hwndDlg, IDC_LIMITCHATSTABS, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS));
- limitLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
+ limitLength = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
SetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, limitLength >= 1 ? limitLength : 1, FALSE);
CheckDlgButton(hwndDlg, IDC_SEPARATECHATSCONTAINERS, db_get_b(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS));
@@ -460,14 +460,14 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam db_set_b(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM));
db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES));
(limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE)) >= SRMSGSET_LIMITNAMESLEN_MIN ? GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE) : SRMSGSET_LIMITNAMESLEN_MIN;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, limitLength);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, limitLength);
db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) : 1;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, limitLength);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, limitLength);
db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS));
limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) : 1;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, limitLength);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, limitLength);
db_set_b(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, (BYTE) !IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSHOWTABS));
db_set_b(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE));
@@ -499,16 +499,16 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar CheckDlgButton(hwndDlg, IDC_SHOWINFOBAR, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR));
CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, db_get_b(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY));
SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_SETRANGE, FALSE, MAKELONG(0,255));
- SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_SETPOS, TRUE, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA));
+ SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_SETPOS, TRUE, db_get_dw(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA));
SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_SETRANGE, FALSE, MAKELONG(0,255));
- SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_SETPOS, TRUE, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA));
+ SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_SETPOS, TRUE, db_get_dw(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA));
sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0)/255));
SetDlgItemTextA(hwndDlg, IDC_ATRANSPARENCYPERC, str);
sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0)/255));
SetDlgItemTextA(hwndDlg, IDC_ITRANSPARENCYPERC, str);
- SetDlgItemInt(hwndDlg, IDC_INPUTLINES, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_INPUTLINES, db_get_dw(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES), FALSE);
SendDlgItemMessage(hwndDlg, IDC_INPUTLINESSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1));
- SendDlgItemMessage(hwndDlg, IDC_INPUTLINESSPIN, UDM_SETPOS, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES));
+ SendDlgItemMessage(hwndDlg, IDC_INPUTLINESSPIN, UDM_SETPOS, 0, db_get_dw(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES));
if (pSetLayeredWindowAttributes == NULL) {
EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCY), FALSE);
@@ -581,8 +581,8 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOBAR));
db_set_b(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0));
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0));
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0));
db_set_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN));
db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWPROGRESS));
@@ -590,7 +590,7 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar db_set_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
lines = GetDlgItemInt(hwndDlg, IDC_INPUTLINES, NULL, FALSE);
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, lines ? lines : SRMSGDEFSET_AUTORESIZELINES);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, lines ? lines : SRMSGDEFSET_AUTORESIZELINES);
LoadInfobarFonts();
ApplyChanges(16);
@@ -613,14 +613,14 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE, (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE) & ~WS_BORDER) | TVS_NOHSCROLL | TVS_CHECKBOXES);
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, sizeof(statusValues) / sizeof(statusValues[0]),
- DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
+ db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
CheckDlgButton(hwndDlg, IDC_AUTOPOPUP, db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP));
CheckDlgButton(hwndDlg, IDC_STAYMINIMIZED, db_get_b(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED));
CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN));
CheckDlgButton(hwndDlg, IDC_SAVEDRAFTS, db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS));
CheckDlgButton(hwndDlg, IDC_DELTEMP, db_get_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP));
- msgTimeout = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
+ msgTimeout = db_get_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
SetDlgItemInt(hwndDlg, IDC_SECONDS, msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout / 1000 : SRMSGDEFSET_MSGTIMEOUT / 1000, FALSE);
CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT));
@@ -692,7 +692,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case PSN_APPLY:
{
DWORD msgTimeout;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
db_set_b(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STAYMINIMIZED));
db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
@@ -700,7 +700,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) >= SRMSGSET_MSGTIMEOUT_MIN / 1000 ? GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) * 1000 : SRMSGDEFSET_MSGTIMEOUT;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
@@ -807,7 +807,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, CheckDlgButton(hwndDlg, IDC_SHOWSTATUSCHANGES, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH));
- SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR));
+ SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_SETCOLOUR, 0, db_get_dw(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR));
{
PARAFORMAT2 pf2;
ZeroMemory((void *)&pf2, sizeof(pf2));
@@ -912,7 +912,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_b(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MARKFOLLOWUPS));
db_set_b(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MESSAGEONNEWLINE));
db_set_b(NULL, SRMMMOD, SRMSGSET_DRAWLINES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_GETCOLOUR, 0, 0));
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_GETCOLOUR, 0, 0));
db_set_b(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USEIEVIEW));
db_set_b(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
db_set_w(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, (WORD) SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_GETPOS, 0, 0));
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 186a832f3a..f8108668b6 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -868,14 +868,14 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR char *szNamePrefix = (!savePerContact && dat->isChat) ? "chat" : "";
if (!dat->windowWasCascaded) {
wsprintfA(szSettingName,"%sx",szNamePrefix);
- DBWriteContactSettingDword(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.left);
+ db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.left);
wsprintfA(szSettingName,"%sy",szNamePrefix);
- DBWriteContactSettingDword(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.top);
+ db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.top);
}
wsprintfA(szSettingName,"%swidth",szNamePrefix);
- DBWriteContactSettingDword(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
+ db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
wsprintfA(szSettingName,"%sheight",szNamePrefix);
- DBWriteContactSettingDword(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
+ db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
db_set_b(hContact, SRMMMOD, SRMSGSET_TOPMOST, (BYTE)dat->bTopmost);
if (g_dat.lastParent == dat)
g_dat.lastParent = dat->prev;
@@ -1550,9 +1550,9 @@ int ScriverRestoreWindowPosition(HWND hwnd,HANDLE hContact,const char *szModule, wp.length=sizeof(wp);
GetWindowPlacement(hwnd,&wp);
wsprintfA(szSettingName,"%sx",szNamePrefix);
- x=DBGetContactSettingDword(hContact,szModule,szSettingName,-1);
+ x=db_get_dw(hContact,szModule,szSettingName,-1);
wsprintfA(szSettingName,"%sy",szNamePrefix);
- y=(int)DBGetContactSettingDword(hContact,szModule,szSettingName,-1);
+ y=(int)db_get_dw(hContact,szModule,szSettingName,-1);
if (x==-1) return 1;
if (flags&RWPF_NOSIZE) {
OffsetRect(&wp.rcNormalPosition,x-wp.rcNormalPosition.left,y-wp.rcNormalPosition.top);
@@ -1560,9 +1560,9 @@ int ScriverRestoreWindowPosition(HWND hwnd,HANDLE hContact,const char *szModule, wp.rcNormalPosition.left=x;
wp.rcNormalPosition.top=y;
wsprintfA(szSettingName,"%swidth",szNamePrefix);
- wp.rcNormalPosition.right=wp.rcNormalPosition.left+DBGetContactSettingDword(hContact,szModule,szSettingName,-1);
+ wp.rcNormalPosition.right=wp.rcNormalPosition.left+db_get_dw(hContact,szModule,szSettingName,-1);
wsprintfA(szSettingName,"%sheight",szNamePrefix);
- wp.rcNormalPosition.bottom=wp.rcNormalPosition.top+DBGetContactSettingDword(hContact,szModule,szSettingName,-1);
+ wp.rcNormalPosition.bottom=wp.rcNormalPosition.top+db_get_dw(hContact,szModule,szSettingName,-1);
}
wp.flags=0;
wp.showCmd = showCmd;
diff --git a/plugins/Scriver/src/sendqueue.cpp b/plugins/Scriver/src/sendqueue.cpp index 6367999a44..fda0384591 100644 --- a/plugins/Scriver/src/sendqueue.cpp +++ b/plugins/Scriver/src/sendqueue.cpp @@ -131,7 +131,7 @@ BOOL RemoveSendQueueItem(MessageSendQueueItem* item) { void ReportSendQueueTimeouts(HWND hwndSender) {
MessageSendQueueItem *item, *item2;
- int timeout = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
+ int timeout = db_get_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
EnterCriticalSection(&queueMutex);
for (item = global_sendQueue; item != NULL; item = item2) {
item2 = item->next;
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index f23ef86633..4f92e5a34c 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -6,7 +6,8 @@ LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")"; char TEMP[MAX_PATH];
int TEMP_SIZE = 0;
-HANDLE g_hEvent[2], g_hMenu[15], g_hCLIcon=0, g_hFolders=0;
+HANDLE g_hEvent[2], g_hCLIcon=0, g_hFolders=0;
+HGENMENU g_hMenu[15];
int iService=0;
int iHook=0;
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index 9a5091183b..5b0b0173d7 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -83,7 +83,8 @@ extern PLUGININFOEX pluginInfoEx; #define PREF_METANODB 0x2000 //!< Flag to indicate message should not be added to db by filter when sending
#define PREF_SIMNOMETA 0x4000 //!< Flag to indicate message should not be inspected by filter on metacontact
-extern HANDLE g_hEvent[2], g_hMenu[15], g_hCLIcon, g_hFolders;
+extern HANDLE g_hEvent[2], g_hCLIcon, g_hFolders;
+extern HGENMENU g_hMenu[15];
extern int iService, iHook;
extern HICON g_hICO[ICO_CNT], g_hIEC[1+IEC_CNT*MODE_CNT], g_hPOP[POP_CNT];
extern HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index 023de0ba68..c98d6e8489 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -204,7 +204,7 @@ BOOL LoadKeyPGP(pUinKey ptr) int mode = db_get_b(ptr->hContact,MODULENAME,"pgp_mode",255);
if (mode == 0) {
DBVARIANT dbv;
- DBGetContactSetting(ptr->hContact,MODULENAME,"pgp",&dbv);
+ db_get(ptr->hContact,MODULENAME,"pgp",&dbv);
BOOL r=(dbv.type == DBVT_BLOB);
if (r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal);
db_free(&dbv);
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 5c89f4d2e9..784cb2378d 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -221,7 +221,7 @@ void getContactUinA(HANDLE hContact, LPSTR szUIN) DBVARIANT dbv_uniqueid;
LPSTR uID = (LPSTR) CallProtoService(ptr->name, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if (uID == (LPSTR)CALLSERVICE_NOTFOUND ) uID = 0; // Billy_Bons
- if (uID && DBGetContactSetting(hContact, ptr->name, uID, &dbv_uniqueid) == 0) {
+ if (uID && db_get(hContact, ptr->name, uID, &dbv_uniqueid) == 0) {
if (dbv_uniqueid.type == DBVT_WORD)
sprintf(szUIN, "%u [%s]", dbv_uniqueid.wVal, ptr->name);
else if (dbv_uniqueid.type == DBVT_DWORD)
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 504e2e1e5e..531ea39a96 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -17,7 +17,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfoEx;
}
-HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WPARAM wParam=0)
+HGENMENU AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WPARAM wParam=0)
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = flags | CMIF_HIDDEN;
@@ -29,13 +29,12 @@ HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WP return Menu_AddContactMenuItem(&mi);
}
-HANDLE AddSubItem(HANDLE rootid,LPCSTR name,int pos,int poppos,LPCSTR service,WPARAM wParam=0)
+HGENMENU AddSubItem(HANDLE rootid,LPCSTR name,int pos,int poppos,LPCSTR service,WPARAM wParam=0)
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_CHILDPOPUP | CMIF_HIDDEN;
mi.position = pos;
mi.popupPosition = poppos;
- mi.hIcon = NULL;
mi.pszName = (char*)name;
mi.pszPopupName = (char*)rootid;
mi.pszService = (char*)service;
@@ -150,12 +149,12 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(0,MODULENAME,"rsa_priv",&dbv) == 0) {
+ if (db_get(0,MODULENAME,"rsa_priv",&dbv) == 0) {
exp->rsa_set_keypair(CPP_MODE_RSA_4096,dbv.pbVal,dbv.cpbVal);
db_free(&dbv);
rsa_4096=1;
}
- else if (DBGetContactSetting(0,MODULENAME,"rsa_priv_4096",&dbv) == 0) {
+ else if (db_get(0,MODULENAME,"rsa_priv_4096",&dbv) == 0) {
exp->rsa_set_keypair(CPP_MODE_RSA_4096|CPP_MODE_RSA_BER,dbv.pbVal,dbv.cpbVal);
db_free(&dbv);
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 3cbbe13449..386fc023bf 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -15,7 +15,7 @@ BOOL hasKey(pUinKey ptr) else if (ptr->mode == MODE_RSAAES) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
+ if (db_get(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
ret = 1;
db_free(&dbv);
}
@@ -1233,7 +1233,7 @@ void ApplyGeneralSettings(HWND hDlg) // Key Exchange Timeout
GetDlgItemText(hDlg,IDC_KET,timeout,5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- DBWriteContactSettingWord(0,MODULENAME,"ket",tmp);
+ db_set_w(0,MODULENAME,"ket",tmp);
exp->rsa_set_timeout( db_get_w(0,MODULENAME,"ket",10));
mir_itoa(tmp,timeout,10);
SetDlgItemText(hDlg,IDC_KET,timeout);
@@ -1241,7 +1241,7 @@ void ApplyGeneralSettings(HWND hDlg) // Offline Key Timeout
GetDlgItemText(hDlg,IDC_OKT,timeout,5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- DBWriteContactSettingWord(0,MODULENAME,"okt",tmp);
+ db_set_w(0,MODULENAME,"okt",tmp);
mir_itoa(tmp,timeout,10);
SetDlgItemText(hDlg,IDC_OKT,timeout);
@@ -1461,7 +1461,7 @@ void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus) DBVARIANT dbv;
dbv.type = DBVT_BLOB;
pUinKey ptr = (pUinKey) getListViewParam(hLV, iItem);
- if (DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
+ if (db_get(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
int len;
exp->rsa_get_hash((PBYTE)dbv.pbVal,dbv.cpbVal,(PBYTE)str,&len);
sha = mir_strdup(to_hex((PBYTE)str,len));
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp index 7098db2b0e..e25403582c 100644 --- a/plugins/SecureIM/src/popupOptions.cpp +++ b/plugins/SecureIM/src/popupOptions.cpp @@ -20,19 +20,19 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l char *timeout;
//set timeout value for Key
- if (DBGetContactSetting(0, MODULENAME, "timeoutKey", &dbv) == 0) timeout=dbv.pszVal;
+ if (db_get(0, MODULENAME, "timeoutKey", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMEKEY, timeout);
db_free(&dbv);
//set timeout value for SEC
- if (DBGetContactSetting(0, MODULENAME, "timeoutSec", &dbv) == 0) timeout=dbv.pszVal;
+ if (db_get(0, MODULENAME, "timeoutSec", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMESEC, timeout);
db_free(&dbv);
//set timeout value for SR
- if (DBGetContactSetting(0, MODULENAME, "timeoutSR", &dbv) == 0) timeout=dbv.pszVal;
+ if (db_get(0, MODULENAME, "timeoutSR", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMESR, timeout);
db_free(&dbv);
@@ -57,22 +57,22 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l switch(LOWORD(wParam)) {
case IDC_BACKKEY:
- DBWriteContactSettingDword(0, MODULENAME, "colorKeyb", color);
+ db_set_dw(0, MODULENAME, "colorKeyb", color);
break;
case IDC_TEXTKEY:
- DBWriteContactSettingDword(0, MODULENAME, "colorKeyt", color);
+ db_set_dw(0, MODULENAME, "colorKeyt", color);
break;
case IDC_BACKSEC:
- DBWriteContactSettingDword(0, MODULENAME, "colorSecb", color);
+ db_set_dw(0, MODULENAME, "colorSecb", color);
break;
case IDC_TEXTSEC:
- DBWriteContactSettingDword(0, MODULENAME, "colorSect", color);
+ db_set_dw(0, MODULENAME, "colorSect", color);
break;
case IDC_BACKSR:
- DBWriteContactSettingDword(0, MODULENAME, "colorSRb", color);
+ db_set_dw(0, MODULENAME, "colorSRb", color);
break;
case IDC_TEXTSR:
- DBWriteContactSettingDword(0, MODULENAME, "colorSRt", color);
+ db_set_dw(0, MODULENAME, "colorSRt", color);
break;
}
return TRUE;
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index a21cb8ef44..c9098e1999 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -11,7 +11,7 @@ LPSTR splitMsg(LPSTR szMsg, int iLen) LPSTR buf = out;
WORD msg_id = db_get_w(0, MODULENAME, "msgid", 0) + 1;
- DBWriteContactSettingWord(0, MODULENAME, "msgid", msg_id);
+ db_set_w(0, MODULENAME, "msgid", msg_id);
int part_all = (len+iLen-1)/iLen;
for (int part_num=0; part_num<part_all; part_num++) {
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index 2b02df1092..3524f78775 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -71,25 +71,18 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) if (bMC ) hContact = getMostOnline(hContact); // âîçüìåì òîò, ÷åðåç êîòîðûé ïîéäåò ñîîáùåíèå
pUinKey ptr = getUinKey(hContact);
int i;
+ CLISTMENUITEM mi = { sizeof(mi) };
ShowStatusIconNotify(hContact);
// check offline/online
- CLISTMENUITEM mi = { sizeof(mi) };
if (!ptr) {
// hide menu bars
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN;
- for (i=0;i<SIZEOF(g_hMenu);i++) {
- if (g_hMenu[i] )
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[i],(LPARAM)&mi);
- }
+ for (i=0; i < SIZEOF(g_hMenu); i++)
+ Menu_ShowItem(g_hMenu[i], false);
return 0;
}
-// char *szProto = GetContactProto(hContact,0);
-// if (szProto == NULL) // || db_get_dw(hContact, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
-// return 0;
-
bool isSecureProto = isSecureProtocol(hContact);
bool isPGP = isContactPGP(hContact);
bool isGPG = isContactGPG(hContact);
@@ -98,11 +91,8 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) bool isMiranda = isClientMiranda(hContact);
// hide all menu bars
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN;
- for (i=0;i<SIZEOF(g_hMenu);i++) {
- if (g_hMenu[i] )
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[i],(LPARAM)&mi);
- }
+ for (i=0; i < SIZEOF(g_hMenu); i++)
+ Menu_ShowItem(g_hMenu[i], false);
if (isSecureProto && !isChat && isMiranda &&
(ptr->mode == MODE_NATIVE || ptr->mode == MODE_RSAAES)) {
@@ -111,61 +101,52 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) if (!isSecured) {
// create secureim connection
mi.hIcon = mode2icon(ptr->mode|SECURED,2);
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[0],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[0], &mi);
}
else {
// disable secureim connection
mi.hIcon = mode2icon(ptr->mode,2);
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[1],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[1], &mi);
}
// set status menu
- if (bSCM && !bMC &&
- ( !isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG )) {
+ if (bSCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
mi.hIcon = g_hICO[ICO_ST_DIS+ptr->status];
mi.pszName = (LPSTR)sim312[ptr->status];
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[2],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[2], &mi);
mi.flags = CMIM_FLAGS | CMIM_ICON;
for (i=0;i<=(ptr->mode == MODE_RSAAES?1:2);i++) {
mi.hIcon = (i == ptr->status) ? g_hICO[ICO_ST_DIS+ptr->status] : NULL;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[3+i],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[3+i], &mi);
}
}
}
- else
- if (isSecureProto && !isChat && (ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
+ else if (isSecureProto && !isChat && (ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
// PGP, GPG
- if (ptr->mode == MODE_PGP && bPGPloaded) {
- if ((bPGPkeyrings || bPGPprivkey) && !isGPG) {
- mi.flags = CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[isPGP+6],(LPARAM)&mi);
- }
- }
- if (ptr->mode == MODE_GPG && bGPGloaded) {
- if (bGPGkeyrings && !isPGP) {
- mi.flags = CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[isGPG+8],(LPARAM)&mi);
- }
- }
+ if (ptr->mode == MODE_PGP && bPGPloaded)
+ if ((bPGPkeyrings || bPGPprivkey) && !isGPG)
+ Menu_ShowItem(g_hMenu[isPGP+6], true);
+
+ if (ptr->mode == MODE_GPG && bGPGloaded)
+ if (bGPGkeyrings && !isPGP)
+ Menu_ShowItem(g_hMenu[isGPG+8], true);
}
if (isSecureProto && !isChat && isMiranda) {
// set mode menu
- if (bMCM && !bMC &&
- ( !isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG )) {
-
+ if (bMCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
mi.hIcon = g_hICO[ICO_OV_NAT+ptr->mode];
mi.pszName = (LPSTR)sim311[ptr->mode];
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[10],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[10], &mi);
mi.flags = CMIM_FLAGS | CMIM_ICON;
for (i=0;i<MODE_CNT;i++) {
if (i == MODE_PGP && ptr->mode != MODE_PGP && !bPGP ) continue;
if (i == MODE_GPG && ptr->mode != MODE_GPG && !bGPG ) continue;
mi.hIcon = (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : NULL;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[11+i],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[11+i], &mi);
}
}
}
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index 3e4f708792..9031b88231 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -283,7 +283,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) // decrypting message with last offline key
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(ptr->hContact, MODULENAME, "offlineKey", &dbv))
+ if (db_get(ptr->hContact, MODULENAME, "offlineKey", &dbv))
return CallService(MS_PROTO_CHAINRECV, wParam, lParam); // exit and show messsage
// if valid key is succefully retrieved
@@ -683,7 +683,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) // set key for offline user
DBVARIANT dbv; dbv.type = DBVT_BLOB;
if (db_get_dw(ptr->hContact, MODULENAME, "offlineKeyTimeout", 0) > gettime() &&
- DBGetContactSetting(ptr->hContact, MODULENAME, "offlineKey", &dbv) == 0) {
+ db_get(ptr->hContact, MODULENAME, "offlineKey", &dbv) == 0) {
// if valid key is succefully retrieved
ptr->offlineKey = true;
InitKeyX(ptr,dbv.pbVal);
diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index 38adfa7cd8..d065d0b397 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -42,7 +42,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
+ if (db_get(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
k = 1;
PBYTE buf = (PBYTE) alloca(sigLen); int len;
exp->rsa_get_hash((PBYTE)dbv.pbVal,dbv.cpbVal,(PBYTE)buf,&len);
@@ -181,7 +181,7 @@ BYTE loadRSAkey(pUinKey ptr) if (!ptr->keyLoaded) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
+ if ( db_get(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
ptr->keyLoaded = exp->rsa_set_pubkey(ptr->cntx,dbv.pbVal,dbv.cpbVal);
Sent_NetLog("loadRSAkey %d", ptr->keyLoaded);
db_free(&dbv);
diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp index 0c9fbf5372..2e78e8f5c6 100644 --- a/plugins/SeenPlugin/src/file.cpp +++ b/plugins/SeenPlugin/src/file.cpp @@ -31,7 +31,7 @@ int InitFileOutput(void) GetModuleFileName(NULL, szmpath, MAX_PATH);
DBVARIANT dbv;
- _tcscpy(szfpath, !DBGetContactSettingTString(NULL, S_MOD, "FileName", &dbv) ? dbv.ptszVal : _T(DEFAULT_FILENAME));
+ _tcscpy(szfpath, !db_get_ts(NULL, S_MOD, "FileName", &dbv) ? dbv.ptszVal : _T(DEFAULT_FILENAME));
db_free(&dbv);
if (szfpath[0] == '\\')
@@ -60,7 +60,7 @@ void FileWrite(HANDLE hcontact) TCHAR szout[1024];
DBVARIANT dbv;
- DBGetContactSettingTString(NULL, S_MOD, "PathToFile", &dbv);
+ db_get_ts(NULL, S_MOD, "PathToFile", &dbv);
_tcscpy(szout, ParseString(dbv.ptszVal, hcontact, 1));
HANDLE fhout = CreateFile(szout, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, 0, NULL);
@@ -78,7 +78,7 @@ void FileWrite(HANDLE hcontact) db_free(&dbv);
SetFilePointer(fhout,0,0,FILE_END);
- if ( !DBGetContactSettingTString(NULL, S_MOD,"FileStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD,"FileStamp", &dbv)) {
_tcscpy(szout, ParseString(dbv.ptszVal, hcontact, 1));
db_free(&dbv);
}
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index 60d08bc89e..13d5b88277 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -51,7 +51,7 @@ void HistoryWrite(HANDLE hContact) TCHAR *ptszString;
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, S_MOD, "HistoryStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "HistoryStamp", &dbv)) {
ptszString = ParseString(dbv.ptszVal, hContact, 0);
db_free(&dbv);
}
@@ -87,7 +87,7 @@ void LoadHistoryList(HANDLE hContact, HWND hwnd, int nList) i = (i-1+historyMax) % historyMax;
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(hContact, S_MOD, BuildSetting(i), &dbv)) {
+ if ( !db_get_ts(hContact, S_MOD, BuildSetting(i), &dbv)) {
SendDlgItemMessage(hwnd, nList, LB_ADDSTRING, 0, (LPARAM)dbv.ptszVal);
db_free(&dbv);
}
diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp index 9dd4e7ea1c..98391ee155 100644 --- a/plugins/SeenPlugin/src/main.cpp +++ b/plugins/SeenPlugin/src/main.cpp @@ -115,7 +115,6 @@ extern "C" __declspec(dllexport) int Unload(void) arContacts.destroy();
CloseHandle(g_hShutdownEvent);
- UninitMenuitem();
return 0;
}
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index 00afddde37..7c0e2222db 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -20,7 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "seen.h"
-HANDLE hmenuitem=NULL, hLSUserDet = NULL, hBuildMenu = NULL;
+HANDLE hLSUserDet = NULL;
+HGENMENU hmenuitem = NULL;
void InitHistoryDialog(void);
@@ -47,7 +48,7 @@ int BuildContactMenu(WPARAM wparam,LPARAM lparam) cmi.hIcon = NULL;
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, S_MOD, "MenuStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "MenuStamp", &dbv)) {
cmi.ptszName = ParseString(dbv.ptszVal, (HANDLE)wparam, 0);
db_free(&dbv);
}
@@ -65,13 +66,13 @@ int BuildContactMenu(WPARAM wparam,LPARAM lparam) }
}
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmenuitem, (LPARAM)&cmi);
+ Menu_ModifyItem(hmenuitem, &cmi);
return 0;
}
void InitMenuitem()
{
- hLSUserDet = CreateServiceFunction("LastSeenUserDetails", MenuitemClicked);
+ CreateServiceFunction("LastSeenUserDetails", MenuitemClicked);
CLISTMENUITEM cmi = { sizeof(cmi) };
cmi.position = -0x7FFFFFFF;
@@ -80,13 +81,7 @@ void InitMenuitem() cmi.pszService = "LastSeenUserDetails";
hmenuitem = Menu_AddContactMenuItem(&cmi);
- hBuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU,BuildContactMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU,BuildContactMenu);
InitHistoryDialog();
}
-
-void UninitMenuitem()
-{
- DestroyServiceFunction(hLSUserDet);
- UnhookEvent(hBuildMenu);
-}
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index 18d5bd478f..6fa34e2a1b 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -65,13 +65,13 @@ INT_PTR CALLBACK OptsPopUpsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara EnableWindow( GetDlgItem(hdlg, i+20), hasPopups);
}
- if ( !DBGetContactSettingTString(NULL, S_MOD, "PopupStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "PopupStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_POPUPSTAMP, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_POPUPSTAMP, DEFAULT_POPUPSTAMP);
- if ( !DBGetContactSettingTString(NULL, S_MOD, "PopupStampText", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "PopupStampText", &dbv)) {
SetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, dbv.ptszVal);
db_free(&dbv);
}
@@ -199,31 +199,31 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa EnableWindow(GetDlgItem(hdlg, IDC_HISTORYSTAMP),IsDlgButtonChecked(hdlg, IDC_HISTORY));
EnableWindow(GetDlgItem(hdlg, IDC_COUNT),IsDlgButtonChecked(hdlg, IDC_MISSEDONES));
- if ( !DBGetContactSettingTString(NULL, S_MOD, "MenuStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "MenuStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_MENUSTAMP, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_MENUSTAMP, _T(DEFAULT_MENUSTAMP));
- if ( !DBGetContactSettingTString(NULL, S_MOD, "UserStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "UserStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_USERSTAMP, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_USERSTAMP, DEFAULT_USERSTAMP);
- if ( !DBGetContactSettingTString(NULL, S_MOD, "FileStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "FileStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_FILESTAMP, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_FILESTAMP, _T(DEFAULT_FILESTAMP));
- if ( !DBGetContactSettingTString(NULL, S_MOD, "FileName", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "FileName", &dbv)) {
SetDlgItemText(hdlg, IDC_FILENAME, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_FILENAME, _T(DEFAULT_FILENAME));
- if ( !DBGetContactSettingTString(NULL, S_MOD, "HistoryStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "HistoryStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_HISTORYSTAMP, dbv.ptszVal);
db_free(&dbv);
}
diff --git a/plugins/SeenPlugin/src/seen.h b/plugins/SeenPlugin/src/seen.h index 1a07999868..0fb4921070 100644 --- a/plugins/SeenPlugin/src/seen.h +++ b/plugins/SeenPlugin/src/seen.h @@ -106,7 +106,6 @@ int ModeChange(WPARAM,LPARAM); void SetOffline(void);
int ModeChange_mo(WPARAM,LPARAM);
int CheckIfOnline(void);
-void UninitMenuitem();
void ShowHistory(HANDLE hContact, BYTE isAlert);
struct logthread_info
@@ -120,7 +119,8 @@ extern HINSTANCE hInstance; extern DWORD StatusColors15bits[];
extern BOOL includeIdle;
extern HANDLE ehmissed;
-extern HANDLE ehuserinfo, hmenuitem, ehmissed_proto;
+extern HANDLE ehuserinfo, ehmissed_proto;
+extern HGENMENU hmenuitem;
extern DWORD dwmirver;
extern LIST<logthread_info> arContacts;
\ No newline at end of file diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index 1bc7f1c805..6205dcaa1e 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -39,7 +39,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) mir_subclassWindow( GetDlgItem(hdlg, IDC_INFOTEXT), EditProc);
{
TCHAR *szout;
- if ( !DBGetContactSettingTString(NULL, S_MOD, "UserStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "UserStamp", &dbv)) {
szout = ParseString(dbv.ptszVal, (HANDLE)lparam, 0);
db_free(&dbv);
}
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index e22fff1911..a7948c6baa 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -41,7 +41,7 @@ int IsWatchedProtocol(const char* szProto) int iProtoLen = (int)strlen(szProto);
char *szWatched;
DBVARIANT dbv;
- if ( DBGetContactSettingString(NULL, S_MOD, "WatchedProtocols", &dbv))
+ if ( db_get_s(NULL, S_MOD, "WatchedProtocols", &dbv))
szWatched = DEFAULT_WATCHEDPROTOCOLS;
else {
szWatched = NEWSTR_ALLOCA(dbv.pszVal);
@@ -261,7 +261,7 @@ LBL_charPtr: goto LBL_noData;
case 'G':
- if ( !DBGetContactSettingTString(hcontact, "CList", "Group", &dbv)) {
+ if ( !db_get_ts(hcontact, "CList", "Group", &dbv)) {
_tcscpy(szdbsetting, dbv.ptszVal);
db_free(&dbv);
charPtr = szdbsetting;
@@ -289,18 +289,18 @@ LBL_charPtr: }
else if (ci.szProto != NULL) {
if ( isYahoo(ci.szProto)) { // YAHOO support
- DBGetContactSettingTString(hcontact, ci.szProto, "id", &dbv);
+ db_get_ts(hcontact, ci.szProto, "id", &dbv);
_tcscpy(szdbsetting, dbv.ptszVal);
db_free(&dbv);
}
else if ( isJabber(ci.szProto)) { // JABBER support
- if ( DBGetContactSettingTString(hcontact, ci.szProto, "LoginName", &dbv))
+ if ( db_get_ts(hcontact, ci.szProto, "LoginName", &dbv))
goto LBL_noData;
_tcscpy(szdbsetting, dbv.ptszVal);
db_free(&dbv);
- DBGetContactSettingTString(hcontact, ci.szProto, "LoginServer", &dbv);
+ db_get_ts(hcontact, ci.szProto, "LoginServer", &dbv);
_tcscat(szdbsetting, _T("@"));
_tcscat(szdbsetting, dbv.ptszVal);
db_free(&dbv);
@@ -324,7 +324,7 @@ LBL_charPtr: goto LBL_noData;
case 'T':
- if ( DBGetContactSettingTString(hcontact, "CList", "StatusMsg", &dbv))
+ if ( db_get_ts(hcontact, "CList", "StatusMsg", &dbv))
goto LBL_noData;
d += mir_sntprintf(d, MAXSIZE-(d-sztemp), _T("%s"), dbv.ptszVal);
@@ -346,7 +346,7 @@ LBL_charPtr: case 'i':
case 'r':
if ( isJabber(ci.szProto)) {
- if ( DBGetContactSettingTString(hcontact, ci.szProto, *p == 'i' ? "Resource" : "System", &dbv))
+ if ( db_get_ts(hcontact, ci.szProto, *p == 'i' ? "Resource" : "System", &dbv))
goto LBL_noData;
_tcscpy(szdbsetting, dbv.ptszVal);
@@ -374,7 +374,7 @@ LBL_charPtr: goto LBL_charPtr;
case 'C': // Get Client Info
- if ( !DBGetContactSettingTString(hcontact, ci.szProto, "MirVer", &dbv)) {
+ if ( !db_get_ts(hcontact, ci.szProto, "MirVer", &dbv)) {
_tcscpy(szdbsetting, dbv.ptszVal);
db_free(&dbv);
}
@@ -497,13 +497,13 @@ void ShowPopup(HANDLE hcontact, const char * lpzProto, int newStatus) ppd.lchContact = hcontact;
ppd.lchIcon = LoadSkinnedProtoIcon(lpzProto, newStatus);
- if ( !DBGetContactSettingTString(NULL, S_MOD, "PopupStamp", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "PopupStamp", &dbv)) {
_tcsncpy(ppd.lptzContactName, ParseString(dbv.ptszVal, hcontact, 0), MAX_CONTACTNAME);
db_free(&dbv);
}
else _tcsncpy(ppd.lptzContactName, ParseString(DEFAULT_POPUPSTAMP, hcontact, 0), MAX_CONTACTNAME);
- if ( !DBGetContactSettingTString(NULL, S_MOD, "PopupStampText", &dbv)) {
+ if ( !db_get_ts(NULL, S_MOD, "PopupStampText", &dbv)) {
_tcsncpy(ppd.lptzText, ParseString(dbv.ptszVal, hcontact, 0), MAX_SECONDLINE);
db_free(&dbv);
}
@@ -735,7 +735,7 @@ int ModeChange(WPARAM wparam,LPARAM lparam) short int isDbZero(HANDLE hContact, const char *module_name, const char *setting_name)
{
DBVARIANT dbv;
- if ( !DBGetContactSetting(hContact, module_name, setting_name, &dbv)) {
+ if ( !db_get(hContact, module_name, setting_name, &dbv)) {
short int res = 0;
switch (dbv.type) {
case DBVT_BYTE: res=dbv.bVal==0; break;
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index d7498d21b6..097b9ff18f 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -60,7 +60,7 @@ CSend::~CSend(){ void CSend::SetContact(HANDLE hContact) {
m_hContact = hContact;
m_pszProto = GetContactProto(hContact);
- m_ChatRoom = DBGetContactSettingByte(hContact, m_pszProto, "ChatRoom", 0);
+ m_ChatRoom = db_get_b(hContact, m_pszProto, "ChatRoom", 0);
m_PFflag = hasCap(PF1_URLSEND);
m_PFflag = hasCap(PF1_CHAT);
m_PFflag = hasCap(PF1_IMSEND);
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 229f19ac37..95311e984d 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -716,51 +716,51 @@ TfrmMain::~TfrmMain() { //---------------------------------------------------------------------------
// Load / Saving options from miranda's database
void TfrmMain::LoadOptions(void) {
- DWORD rgb = DBGetContactSettingDword(NULL, SZ_SENDSS, "AlphaColor", 16777215);
+ DWORD rgb = db_get_dw(NULL, SZ_SENDSS, "AlphaColor", 16777215);
m_AlphaColor.rgbRed = GetRValue(rgb);
m_AlphaColor.rgbGreen = GetGValue(rgb);
m_AlphaColor.rgbBlue = GetBValue(rgb);
m_AlphaColor.rgbReserved = 0;
-// m_opt_chkEmulateClick = DBGetContactSettingByte(NULL, SZ_SENDSS, "AutoSend", 1);
- m_opt_edtQuality = DBGetContactSettingByte(NULL, SZ_SENDSS, "JpegQuality", 75);
+// m_opt_chkEmulateClick = db_get_b(NULL, SZ_SENDSS, "AutoSend", 1);
+ m_opt_edtQuality = db_get_b(NULL, SZ_SENDSS, "JpegQuality", 75);
- m_opt_tabCapture = DBGetContactSettingByte(NULL, SZ_SENDSS, "Capture", 0);
- m_opt_chkClientArea = DBGetContactSettingByte(NULL, SZ_SENDSS, "ClientArea", 0);
- m_opt_cboxDesktop = DBGetContactSettingByte(NULL, SZ_SENDSS, "Desktop", 0);
+ m_opt_tabCapture = db_get_b(NULL, SZ_SENDSS, "Capture", 0);
+ m_opt_chkClientArea = db_get_b(NULL, SZ_SENDSS, "ClientArea", 0);
+ m_opt_cboxDesktop = db_get_b(NULL, SZ_SENDSS, "Desktop", 0);
- m_opt_chkTimed = DBGetContactSettingByte(NULL, SZ_SENDSS, "TimedCap", 0);
- m_opt_edtTimed = DBGetContactSettingByte(NULL, SZ_SENDSS, "CapTime", 3);
- m_opt_cboxFormat = DBGetContactSettingByte(NULL, SZ_SENDSS, "OutputFormat", 3);
- m_opt_cboxSendBy = DBGetContactSettingByte(NULL, SZ_SENDSS, "SendBy", 0);
+ m_opt_chkTimed = db_get_b(NULL, SZ_SENDSS, "TimedCap", 0);
+ m_opt_edtTimed = db_get_b(NULL, SZ_SENDSS, "CapTime", 3);
+ m_opt_cboxFormat = db_get_b(NULL, SZ_SENDSS, "OutputFormat", 3);
+ m_opt_cboxSendBy = db_get_b(NULL, SZ_SENDSS, "SendBy", 0);
- m_opt_chkEditor = DBGetContactSettingByte(NULL, SZ_SENDSS, "Preview", 0);
- m_opt_btnDesc = DBGetContactSettingByte(NULL, SZ_SENDSS, "AutoDescription", 1);
- m_opt_btnDeleteAfterSend = DBGetContactSettingByte(NULL, SZ_SENDSS, "DelAfterSend", 1);
- m_opt_chkOpenAgain = DBGetContactSettingByte(NULL, SZ_SENDSS, "OpenAgain", 0);
+ m_opt_chkEditor = db_get_b(NULL, SZ_SENDSS, "Preview", 0);
+ m_opt_btnDesc = db_get_b(NULL, SZ_SENDSS, "AutoDescription", 1);
+ m_opt_btnDeleteAfterSend = db_get_b(NULL, SZ_SENDSS, "DelAfterSend", 1);
+ m_opt_chkOpenAgain = db_get_b(NULL, SZ_SENDSS, "OpenAgain", 0);
}
void TfrmMain::SaveOptions(void) {
if(m_bOnExitSave) {
- DBWriteContactSettingDword(NULL, SZ_SENDSS, "AlphaColor",
+ db_set_dw(NULL, SZ_SENDSS, "AlphaColor",
(DWORD)RGB(m_AlphaColor.rgbRed, m_AlphaColor.rgbGreen, m_AlphaColor.rgbBlue));
-// DBWriteContactSettingByte(NULL, SZ_SENDSS, "AutoSend", m_opt_chkEmulateClick);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "JpegQuality", m_opt_edtQuality);
+// db_set_b(NULL, SZ_SENDSS, "AutoSend", m_opt_chkEmulateClick);
+ db_set_b(NULL, SZ_SENDSS, "JpegQuality", m_opt_edtQuality);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "Capture", m_opt_tabCapture);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "ClientArea", m_opt_chkClientArea);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "Desktop", m_opt_cboxDesktop);
+ db_set_b(NULL, SZ_SENDSS, "Capture", m_opt_tabCapture);
+ db_set_b(NULL, SZ_SENDSS, "ClientArea", m_opt_chkClientArea);
+ db_set_b(NULL, SZ_SENDSS, "Desktop", m_opt_cboxDesktop);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "TimedCap", m_opt_chkTimed);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "CapTime", m_opt_edtTimed);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "OutputFormat", m_opt_cboxFormat);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "SendBy", m_opt_cboxSendBy);
+ db_set_b(NULL, SZ_SENDSS, "TimedCap", m_opt_chkTimed);
+ db_set_b(NULL, SZ_SENDSS, "CapTime", m_opt_edtTimed);
+ db_set_b(NULL, SZ_SENDSS, "OutputFormat", m_opt_cboxFormat);
+ db_set_b(NULL, SZ_SENDSS, "SendBy", m_opt_cboxSendBy);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "AutoDescription", m_opt_btnDesc);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "DelAfterSend", m_opt_btnDeleteAfterSend);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "OpenAgain", m_opt_chkOpenAgain);
- DBWriteContactSettingByte(NULL, SZ_SENDSS, "Preview", m_opt_chkEditor);
+ db_set_b(NULL, SZ_SENDSS, "AutoDescription", m_opt_btnDesc);
+ db_set_b(NULL, SZ_SENDSS, "DelAfterSend", m_opt_btnDeleteAfterSend);
+ db_set_b(NULL, SZ_SENDSS, "OpenAgain", m_opt_chkOpenAgain);
+ db_set_b(NULL, SZ_SENDSS, "Preview", m_opt_chkEditor);
}
}
@@ -957,7 +957,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { mir_tcsadd(path, m_FDestFolder);
if (path[_tcslen(path)-1] != _T('\\')) mir_tcsadd(path, _T("\\"));
mir_tcsadd(path, _T("shot%.5ld"));
- int FileNumber=DBGetContactSettingDword(NULL, SZ_SENDSS, "FileNumber", 0) + 1;
+ int FileNumber=db_get_dw(NULL, SZ_SENDSS, "FileNumber", 0) + 1;
// '00000'-'%.5ld'=0 (add more or less len if differ from 5
size_t len = (_tcslen(path)+0+1);
pszFilename = (LPTSTR)mir_alloc(sizeof(TCHAR)*(len));
@@ -1103,7 +1103,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { mir_freeAndNil(pszFilename);
if (ret) {
- DBWriteContactSettingDword(NULL, SZ_SENDSS, "FileNumber", (DWORD)FileNumber);
+ db_set_dw(NULL, SZ_SENDSS, "FileNumber", (DWORD)FileNumber);
mir_freeAndNil(m_pszFile);
mir_freeAndNil(m_pszFileDesc);
m_pszFile = ret;
diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index 9d49a9b63f..7f618368c8 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -729,8 +729,8 @@ INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam) if (!(pMsgBox->uType & (MB_INFOBAR|MB_NOPOPUP)) && // message box can be a popup?
ServiceExists(MS_POPUP_ADDPOPUPT) && // popups exist?
myGlobals.PopUpActionsExist == 1 && // popup support ext stuct?
- (DBGetContactSettingDword(NULL, "PopUp","Actions", 0) & 1) && // popup++ actions on?
- DBGetContactSettingByte(NULL, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX) // user likes popups?
+ (db_get_dw(NULL, "PopUp","Actions", 0) & 1) && // popup++ actions on?
+ db_get_b(NULL, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX) // user likes popups?
)
{
rc = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, (DLGPROC)MsgBoxPop, lParam);
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 89ef6e1266..b5c7fd658a 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -100,14 +100,14 @@ INT_PTR CALLBACK ExitDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) SavePosition(hdlg, "ExitDlg");
SaveSessionDate();
SaveSessionHandles(0,0);
- DBWriteContactSettingByte(NULL, MODNAME, "lastempty", 0);
+ db_set_b(NULL, MODNAME, "lastempty", 0);
DestroyWindow(hdlg);
}break;
case IDCANCEL:
{
SavePosition(hdlg, "ExitDlg");
- DBWriteContactSettingByte(NULL, MODNAME, "lastempty", 1);
+ db_set_b(NULL, MODNAME, "lastempty", 1);
DestroyWindow(hdlg);
}break;
}
@@ -287,7 +287,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar {
case WM_INITDIALOG:
{
- int iDelay=DBGetContactSettingWord(NULL, MODNAME, "StartupModeDelay", 1500);
+ int iDelay=db_get_w(NULL, MODNAME, "StartupModeDelay", 1500);
if(g_hghostw==TRUE)
SetTimer(hdlg, TIMERID_LOAD, iDelay, NULL);
else
@@ -359,7 +359,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar int i=0;
while(session_list_recovered[i])
{
- DBWriteContactSettingByte((HANDLE)session_list_recovered[i], MODNAME, "wasInLastSession", 0);
+ db_set_b((HANDLE)session_list_recovered[i], MODNAME, "wasInLastSession", 0);
i++;
}
ZeroMemory(session_list_recovered,SIZEOF(session_list_recovered));
@@ -494,7 +494,7 @@ int SaveSessionHandles(WPARAM wparam,LPARAM lparam) if(lparam==1)
{
g_ses_count++;
- DBWriteContactSettingByte(0, MODNAME, "UserSessionsCount", (BYTE)g_ses_count);
+ db_set_b(0, MODNAME, "UserSessionsCount", (BYTE)g_ses_count);
}
return 0;
}
@@ -552,11 +552,11 @@ int SaveSessionDate() char szSessionDate[256];
DBVARIANT dbv = {0};
mir_snprintf(szSessionDate, SIZEOF(szSessionDate), "%s_%d", "SessionDate", 0);
- DBGetContactSettingTString(NULL, MODNAME, szSessionDate, &dbv);
+ db_get_ts(NULL, MODNAME, szSessionDate, &dbv);
TCHAR *szSessionDateBuf_1 = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
- DBWriteContactSettingTString(NULL, MODNAME, szSessionDate, szSessionTime);
+ db_set_ts(NULL, MODNAME, szSessionDate, szSessionTime);
mir_free(szSessionTime);
ResaveSettings("SessionDate", 1, ses_limit, szSessionDateBuf_1);
@@ -566,7 +566,7 @@ int SaveSessionDate() mir_free(szDateBuf);
}
if(g_bCrashRecovery)
- DBWriteContactSettingByte(NULL, MODNAME, "lastSaveCompleted", 1);
+ db_set_b(NULL, MODNAME, "lastSaveCompleted", 1);
return 0;
}
@@ -583,14 +583,14 @@ int SaveUserSessionName(TCHAR *szUSessionName) {
szUserSessionName = mir_tstrdup(szUSessionName);
mir_snprintf(szUserSessionNameBuf, SIZEOF(szUserSessionNameBuf), "%s_%u", "UserSessionDsc", 0);
- if (!DBGetContactSettingTString(NULL, MODNAME, szUserSessionNameBuf, &dbv))
+ if (!db_get_ts(NULL, MODNAME, szUserSessionNameBuf, &dbv))
{
szUserSessionNameBuf_1 = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
ResaveSettings("UserSessionDsc",1,255,szUserSessionNameBuf_1);
}
- DBWriteContactSettingTString(NULL, MODNAME, szUserSessionNameBuf, szUserSessionName);
+ db_set_ts(NULL, MODNAME, szUserSessionNameBuf, szUserSessionName);
//free(szUserSessionNameBuf_1);
mir_free(szUserSessionName);
@@ -704,10 +704,10 @@ int DelUserDefSession(int ses_count) }
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", ses_count);
- DBDeleteContactSetting(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODNAME, szSessionName);
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", ses_count);
- DBDeleteContactSetting(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODNAME, szSessionName);
for (i=(ses_count+1);;i++)
{
@@ -717,20 +717,20 @@ int DelUserDefSession(int ses_count) {
MarkUserDefSession(i-1,IsMarkedUserDefSession(i));
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i-1);
- DBWriteContactSettingTString(NULL, MODNAME, szSessionName, szSessionNameBuf);
+ db_set_ts(NULL, MODNAME, szSessionName, szSessionNameBuf);
}
else
{
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i-1);
- DBDeleteContactSetting(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODNAME, szSessionName);
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", i-1);
- DBDeleteContactSetting(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODNAME, szSessionName);
break;
}
}
g_ses_count--;
- DBWriteContactSettingByte(0, MODNAME, "UserSessionsCount", (BYTE)g_ses_count);
+ db_set_b(0, MODNAME, "UserSessionsCount", (BYTE)g_ses_count);
mir_free(szSessionNameBuf);
return 0;
}
@@ -751,7 +751,7 @@ int DeleteAutoSession(int ses_count) }
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", ses_count);
- DBDeleteContactSetting(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODNAME, szSessionName);
for (i=(ses_count+1);;i++)
{
@@ -760,13 +760,13 @@ int DeleteAutoSession(int ses_count) if ((szSessionNameBuf=DBGetStringT(NULL, MODNAME, szSessionName))/*&&(szSessionHandlesBuf=DBGetStringT(NULL,PLGNAME,szSessionHandles))*/)
{
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i-1);
- DBWriteContactSettingTString(NULL, MODNAME, szSessionName, szSessionNameBuf);
+ db_set_ts(NULL, MODNAME, szSessionName, szSessionNameBuf);
}
else
{
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i-1);
- DBDeleteContactSetting(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODNAME, szSessionName);
break;
}
}
@@ -789,30 +789,30 @@ int SessionPreShutdown(WPARAM wparam,LPARAM lparam) if(g_bIncompletedSave) {
int i=0;
while(session_list_recovered[i]) {
- DBWriteContactSettingByte((HANDLE)session_list_recovered[i], MODNAME, "wasInLastSession", 0);
+ db_set_b((HANDLE)session_list_recovered[i], MODNAME, "wasInLastSession", 0);
i++;
}
}
- DBWriteContactSettingByte(NULL, MODNAME, "lastSaveCompleted", 1);
+ db_set_b(NULL, MODNAME, "lastSaveCompleted", 1);
return 0;
}
int OkToExit(WPARAM wparam,LPARAM lparam)
{
- int exitmode=DBGetContactSettingByte(NULL, MODNAME, "ShutdownMode", 2);
+ int exitmode=db_get_b(NULL, MODNAME, "ShutdownMode", 2);
DONT=1;
if(exitmode==2&&session_list[0]!=0)
{
SaveSessionDate();
SaveSessionHandles(0,0);
- DBWriteContactSettingByte(NULL, MODNAME, "lastempty", 0);
+ db_set_b(NULL, MODNAME, "lastempty", 0);
}
else if(exitmode==1&&session_list[0]!=0)
{
DialogBox(hinstance,MAKEINTRESOURCE(IDD_EXDIALOG), 0, ExitDlgProc);
}
- else DBWriteContactSettingByte(NULL, MODNAME, "lastempty", 1);
+ else db_set_b(NULL, MODNAME, "lastempty", 1);
return 0;
}
@@ -824,12 +824,12 @@ static int GetContactHandle(WPARAM wparam,LPARAM lParam) {
if (strstr(MWeventdata->szModule,"tabSRMsg")) g_mode=1;
AddToCurSession((DWORD)MWeventdata->hContact,0);
- if(g_bCrashRecovery) DBWriteContactSettingByte(MWeventdata->hContact, MODNAME, "wasInLastSession", 1);
+ if(g_bCrashRecovery) db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 1);
}
else if(MWeventdata->uType == MSG_WINDOW_EVT_CLOSE)
{
if (!DONT) DelFromCurSession((DWORD)MWeventdata->hContact,0);
- if(g_bCrashRecovery) DBWriteContactSettingByte(MWeventdata->hContact, MODNAME, "wasInLastSession", 0);
+ if(g_bCrashRecovery) db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 0);
}
return 0;
@@ -890,17 +890,17 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hServiceSaveUserSession = CreateServiceFunction(MS_SESSIONS_SAVEUSERSESSION, SaveUserSessionHandles);
hServiceCloseCurrentSession = CreateServiceFunction(MS_SESSIONS_CLOSESESSION, CloseCurrentSession);
- g_ses_count = DBGetContactSettingByte(0, MODNAME, "UserSessionsCount", 0);
+ g_ses_count = db_get_b(0, MODNAME, "UserSessionsCount", 0);
if (!g_ses_count)
- g_ses_count = DBGetContactSettingByte(0, "Sessions (Unicode)", "UserSessionsCount", 0);
- ses_limit = DBGetContactSettingByte(0, MODNAME, "TrackCount", 10);
- g_bExclHidden = DBGetContactSettingByte(NULL, MODNAME, "ExclHidden", 0);
- g_bWarnOnHidden = DBGetContactSettingByte(NULL, MODNAME, "WarnOnHidden", 0);
- g_bOtherWarnings = DBGetContactSettingByte(NULL, MODNAME, "OtherWarnings", 1);
- g_bCrashRecovery = DBGetContactSettingByte(NULL, MODNAME, "CrashRecovery", 0);
+ g_ses_count = db_get_b(0, "Sessions (Unicode)", "UserSessionsCount", 0);
+ ses_limit = db_get_b(0, MODNAME, "TrackCount", 10);
+ g_bExclHidden = db_get_b(NULL, MODNAME, "ExclHidden", 0);
+ g_bWarnOnHidden = db_get_b(NULL, MODNAME, "WarnOnHidden", 0);
+ g_bOtherWarnings = db_get_b(NULL, MODNAME, "OtherWarnings", 1);
+ g_bCrashRecovery = db_get_b(NULL, MODNAME, "CrashRecovery", 0);
if(g_bCrashRecovery)
- g_bIncompletedSave=!DBGetContactSettingByte(NULL, MODNAME, "lastSaveCompleted", 0);
+ g_bIncompletedSave=!db_get_b(NULL, MODNAME, "lastSaveCompleted", 0);
if(g_bIncompletedSave)
{
@@ -911,16 +911,16 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) for (hContact = db_find_first(); hContact;
hContact = db_find_next(hContact))
{
- if(DBGetContactSettingByte(hContact, MODNAME, "wasInLastSession", 0))
+ if(db_get_b(hContact, MODNAME, "wasInLastSession", 0))
session_list_recovered[i++]=(DWORD)hContact;
}
}
if (!session_list_recovered[0]) g_bIncompletedSave=FALSE;
- DBWriteContactSettingByte(NULL, MODNAME, "lastSaveCompleted", 0);
+ db_set_b(NULL, MODNAME, "lastSaveCompleted", 0);
- if (!DBGetContactSettingByte(NULL, MODNAME, "lastempty", 1)||g_bIncompletedSave) isLastTRUE=TRUE;
+ if (!db_get_b(NULL, MODNAME, "lastempty", 1)||g_bIncompletedSave) isLastTRUE=TRUE;
- startup=DBGetContactSettingByte(NULL, MODNAME, "StartupMode", 3);
+ startup=db_get_b(NULL, MODNAME, "StartupMode", 3);
if (startup==1||(startup==3&&isLastTRUE==TRUE))
{
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index 24834c7047..b22d14b6f7 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -178,19 +178,19 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) hIcon=(bChecked=IsMarkedUserDefSession(opses_count))?hMarked:hNotMarked;
- SetDlgItemInt(hdlg, IDC_TRACK,ses_limit=DBGetContactSettingByte(0, MODNAME, "TrackCount", 10), FALSE);
+ SetDlgItemInt(hdlg, IDC_TRACK,ses_limit=db_get_b(0, MODNAME, "TrackCount", 10), FALSE);
SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hdlg, IDC_TRACK, NULL, FALSE));
SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
- SetDlgItemInt(hdlg, IDC_STARTDELAY, DBGetContactSettingWord(NULL, MODNAME, "StartupModeDelay", 1500), FALSE);
- startupmode = DBGetContactSettingByte(NULL, MODNAME, "StartupMode", 3);
- exitmode = DBGetContactSettingByte(NULL, MODNAME, "ShutdownMode", 2);
+ SetDlgItemInt(hdlg, IDC_STARTDELAY, db_get_w(NULL, MODNAME, "StartupModeDelay", 1500), FALSE);
+ startupmode = db_get_b(NULL, MODNAME, "StartupMode", 3);
+ exitmode = db_get_b(NULL, MODNAME, "ShutdownMode", 2);
- g_bExclHidden = DBGetContactSettingByte(NULL, MODNAME, "ExclHidden", 0);
- g_bWarnOnHidden = DBGetContactSettingByte(NULL, MODNAME, "WarnOnHidden", 0);
- g_bOtherWarnings = DBGetContactSettingByte(NULL, MODNAME, "OtherWarnings", 1);
- g_bCrashRecovery = DBGetContactSettingByte(NULL, MODNAME, "CrashRecovery", 0);
+ g_bExclHidden = db_get_b(NULL, MODNAME, "ExclHidden", 0);
+ g_bWarnOnHidden = db_get_b(NULL, MODNAME, "WarnOnHidden", 0);
+ g_bOtherWarnings = db_get_b(NULL, MODNAME, "OtherWarnings", 1);
+ g_bCrashRecovery = db_get_b(NULL, MODNAME, "CrashRecovery", 0);
CheckDlgButton(hdlg,IDC_EXCLHIDDEN,g_bExclHidden?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hdlg,IDC_LASTHIDDENWARN,g_bWarnOnHidden?BST_CHECKED:BST_UNCHECKED);
@@ -262,26 +262,26 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) case PSN_APPLY:
{
int iDelay=GetDlgItemInt(hdlg, IDC_STARTDELAY,NULL, FALSE);
- DBWriteContactSettingWord(0, MODNAME, "StartupModeDelay", (WORD)iDelay);
+ db_set_w(0, MODNAME, "StartupModeDelay", (WORD)iDelay);
- DBWriteContactSettingByte(0, MODNAME, "TrackCount", (BYTE)(ses_limit=GetDlgItemInt(hdlg, IDC_TRACK,NULL, FALSE)));
- if(IsDlgButtonChecked(hdlg, IDC_REXSAVE)) DBWriteContactSettingByte(NULL, MODNAME, "ShutdownMode", 2);
- else if(IsDlgButtonChecked(hdlg, IDC_REXDSAVE)) DBWriteContactSettingByte(NULL, MODNAME, "ShutdownMode", 0);
- else if(IsDlgButtonChecked(hdlg, IDC_REXASK)) DBWriteContactSettingByte(NULL, MODNAME, "ShutdownMode", 1);
+ db_set_b(0, MODNAME, "TrackCount", (BYTE)(ses_limit=GetDlgItemInt(hdlg, IDC_TRACK,NULL, FALSE)));
+ if(IsDlgButtonChecked(hdlg, IDC_REXSAVE)) db_set_b(NULL, MODNAME, "ShutdownMode", 2);
+ else if(IsDlgButtonChecked(hdlg, IDC_REXDSAVE)) db_set_b(NULL, MODNAME, "ShutdownMode", 0);
+ else if(IsDlgButtonChecked(hdlg, IDC_REXASK)) db_set_b(NULL, MODNAME, "ShutdownMode", 1);
if(IsDlgButtonChecked(hdlg, IDC_STARTDIALOG))
{
if (!IsDlgButtonChecked(hdlg, IDC_CHECKLAST))
- DBWriteContactSettingByte(NULL, MODNAME, "StartupMode", 1);
- else DBWriteContactSettingByte(NULL, MODNAME, "StartupMode", 3);
+ db_set_b(NULL, MODNAME, "StartupMode", 1);
+ else db_set_b(NULL, MODNAME, "StartupMode", 3);
}
- else if(IsDlgButtonChecked(hdlg, IDC_RLOADLAST)) DBWriteContactSettingByte(NULL, MODNAME, "StartupMode", 2);
- else if(IsDlgButtonChecked(hdlg, IDC_RNOTHING)) DBWriteContactSettingByte(NULL, MODNAME, "StartupMode", 0);
+ else if(IsDlgButtonChecked(hdlg, IDC_RLOADLAST)) db_set_b(NULL, MODNAME, "StartupMode", 2);
+ else if(IsDlgButtonChecked(hdlg, IDC_RNOTHING)) db_set_b(NULL, MODNAME, "StartupMode", 0);
- DBWriteContactSettingByte(NULL, MODNAME, "ExclHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_EXCLHIDDEN) ? (g_bExclHidden = 1) : (g_bExclHidden = 0)));
- DBWriteContactSettingByte(NULL, MODNAME, "WarnOnHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_LASTHIDDENWARN) ? (g_bWarnOnHidden = 1) : (g_bWarnOnHidden = 0)));
- DBWriteContactSettingByte(NULL, MODNAME, "OtherWarnings", (BYTE)(IsDlgButtonChecked(hdlg, IDC_WARNINGS) ? (g_bOtherWarnings = 1) : (g_bOtherWarnings = 0)));
- DBWriteContactSettingByte(NULL, MODNAME, "CrashRecovery", (BYTE)(IsDlgButtonChecked(hdlg, IDC_CRASHRECOVERY) ? (g_bCrashRecovery = 1) : (g_bCrashRecovery = 0)));
+ db_set_b(NULL, MODNAME, "ExclHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_EXCLHIDDEN) ? (g_bExclHidden = 1) : (g_bExclHidden = 0)));
+ db_set_b(NULL, MODNAME, "WarnOnHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_LASTHIDDENWARN) ? (g_bWarnOnHidden = 1) : (g_bWarnOnHidden = 0)));
+ db_set_b(NULL, MODNAME, "OtherWarnings", (BYTE)(IsDlgButtonChecked(hdlg, IDC_WARNINGS) ? (g_bOtherWarnings = 1) : (g_bOtherWarnings = 0)));
+ db_set_b(NULL, MODNAME, "CrashRecovery", (BYTE)(IsDlgButtonChecked(hdlg, IDC_CRASHRECOVERY) ? (g_bCrashRecovery = 1) : (g_bCrashRecovery = 0)));
return 1;
}
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index fcd2898b77..bab43d06d3 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -29,7 +29,7 @@ void AddSessionMark(HANDLE hContact,int mode,char bit) if(mode==0)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal)
{
temp_1[0]=dbv.pszVal[0];
for (i=0;i<ses_limit;i++)
@@ -41,16 +41,16 @@ void AddSessionMark(HANDLE hContact,int mode,char bit) for (i=ses_limit;i<10;i++)
dbv.pszVal[i]='0';
dbv.pszVal[0]=bit;
- DBWriteContactSettingString(hContact, MODNAME, "LastSessionsMarks", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, MODNAME, "LastSessionsMarks", dbv.pszVal);
+ db_free(&dbv);
}
- else if(bit=='1') DBWriteContactSettingString(hContact, MODNAME, "LastSessionsMarks", "10000000000");
+ else if(bit=='1') db_set_s(hContact, MODNAME, "LastSessionsMarks", "10000000000");
}
if (mode==1)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "UserSessionsMarks", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "UserSessionsMarks", &dbv) && dbv.pszVal)
{
if(strlen(dbv.pszVal)<g_ses_count)
{
@@ -61,7 +61,7 @@ void AddSessionMark(HANDLE hContact,int mode,char bit) else
pszBuffer = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
temp_1[0]=pszBuffer[0];
for (i=0;i<g_ses_count;i++)
@@ -71,12 +71,12 @@ void AddSessionMark(HANDLE hContact,int mode,char bit) temp_1[0]=temp_2[0];
}
pszBuffer[0]=bit;
- DBWriteContactSettingString(hContact, MODNAME, "UserSessionsMarks", pszBuffer);
+ db_set_s(hContact, MODNAME, "UserSessionsMarks", pszBuffer);
mir_free(pszBuffer);
}
- else if(bit=='1')DBWriteContactSettingString(hContact, MODNAME, "UserSessionsMarks", "10000000000");
- else DBWriteContactSettingString(hContact, MODNAME, "UserSessionsMarks", "00000000000");
+ else if(bit=='1')db_set_s(hContact, MODNAME, "UserSessionsMarks", "10000000000");
+ else db_set_s(hContact, MODNAME, "UserSessionsMarks", "00000000000");
}
}
@@ -88,7 +88,7 @@ void RemoveSessionMark(HANDLE hContact,int mode,int marknum) if(mode==0)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal)
{
for (i=marknum;i<ses_limit;i++)
dbv.pszVal[i]=dbv.pszVal[i+1];
@@ -96,20 +96,20 @@ void RemoveSessionMark(HANDLE hContact,int mode,int marknum) for (i=ses_limit;i<10;i++)
dbv.pszVal[i]='0';
- DBWriteContactSettingString(hContact, MODNAME, "LastSessionsMarks", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, MODNAME, "LastSessionsMarks", dbv.pszVal);
+ db_free(&dbv);
}
}
if (mode==1)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "UserSessionsMarks", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "UserSessionsMarks", &dbv) && dbv.pszVal)
{
for (i=marknum;i<ses_limit;i++)
dbv.pszVal[i]=dbv.pszVal[i+1];
- DBWriteContactSettingString(hContact, MODNAME, "UserSessionsMarks", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, MODNAME, "UserSessionsMarks", dbv.pszVal);
+ db_free(&dbv);
}
}
}
@@ -121,25 +121,25 @@ void SetSessionMark(HANDLE hContact,int mode,char bit,unsigned int marknum) if(mode==0)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal)
{
dbv.pszVal[marknum]=bit;
- DBWriteContactSettingString(hContact, MODNAME, "LastSessionsMarks", dbv.pszVal);
+ db_set_s(hContact, MODNAME, "LastSessionsMarks", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
if (mode==1)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "UserSessionsMarks", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "UserSessionsMarks", &dbv) && dbv.pszVal)
{
pszBuffer = mir_strdup(dbv.pszVal);
pszBuffer[marknum]=bit;
- DBWriteContactSettingString(hContact, MODNAME, "UserSessionsMarks", pszBuffer);
+ db_set_s(hContact, MODNAME, "UserSessionsMarks", pszBuffer);
mir_free(pszBuffer);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -148,21 +148,21 @@ BOOL LoadContactsFromMask(HANDLE hContact,int mode,int count) {
if (mode == 0) {
DBVARIANT dbv;
- if ( DBGetContactSettingString(hContact, MODNAME, "LastSessionsMarks", &dbv))
+ if ( db_get_s(hContact, MODNAME, "LastSessionsMarks", &dbv))
return 0;
BOOL res = dbv.pszVal[count] == '1';
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return res;
}
if (mode == 1) {
DBVARIANT dbv;
- if ( DBGetContactSettingString(hContact, MODNAME, "UserSessionsMarks", &dbv))
+ if ( db_get_s(hContact, MODNAME, "UserSessionsMarks", &dbv))
return 0;
BOOL res = dbv.pszVal[count] == '1';
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return res;
}
return 0;
@@ -184,7 +184,7 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) if(mode==0)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "LastSessionsOrder", &dbv))
+ if (!db_get_s(hContact, MODNAME, "LastSessionsOrder", &dbv))
{
char* temp=NULL;
char* temp2=NULL;
@@ -208,10 +208,10 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) for (i=(ses_limit*2);i<20;i++)
temp[i]='0';
- DBWriteContactSettingString(hContact, MODNAME, "LastSessionsOrder", temp);
+ db_set_s(hContact, MODNAME, "LastSessionsOrder", temp);
mir_free(temp);
mir_free(temp2);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else if(writemode==1)
{
@@ -221,7 +221,7 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) else
mir_snprintf(szFormNumBuf, SIZEOF(szFormNumBuf), "%u%s", ordernum, "000000000000000000");
- DBWriteContactSettingString(hContact, MODNAME, "LastSessionsOrder", szFormNumBuf);
+ db_set_s(hContact, MODNAME, "LastSessionsOrder", szFormNumBuf);
}
}
@@ -229,7 +229,7 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) {
DBVARIANT dbv;
int advlen=0;
- if (!DBGetContactSettingString(hContact, MODNAME, "UserSessionsOrder", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "UserSessionsOrder", &dbv) && dbv.pszVal)
{
char* temp=NULL;
char* temp2=NULL;
@@ -257,16 +257,16 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) else
mir_snprintf(temp, advlen+1, "%u%s", ordernum, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
- DBWriteContactSettingString(hContact, MODNAME, "UserSessionsOrder", temp);
+ db_set_s(hContact, MODNAME, "UserSessionsOrder", temp);
mir_free(temp);
mir_free(pszBuffer);
}
else if(writemode==1)
- DBWriteContactSettingString(hContact, MODNAME, "UserSessionsOrder", szFormNumBuf);
+ db_set_s(hContact, MODNAME, "UserSessionsOrder", szFormNumBuf);
else
- DBWriteContactSettingString(hContact, MODNAME, "UserSessionsOrder", "00");
+ db_set_s(hContact, MODNAME, "UserSessionsOrder", "00");
}
}
@@ -277,23 +277,23 @@ int GetInSessionOrder(HANDLE hContact,int mode,int count) if(mode==0)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "LastSessionsOrder", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "LastSessionsOrder", &dbv) && dbv.pszVal)
{
szTemp[0]=dbv.pszVal[count*2];
szTemp[1]=dbv.pszVal[count*2+1];
iOrder=atoi(szTemp);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
if (mode==1)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "UserSessionsOrder", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "UserSessionsOrder", &dbv) && dbv.pszVal)
{
szTemp[0]=dbv.pszVal[count*2];
szTemp[1]=dbv.pszVal[count*2+1];
iOrder=atoi(szTemp);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return iOrder;
@@ -312,24 +312,24 @@ void SetInSessionOrder(HANDLE hContact,int mode,int count,unsigned int ordernum) if(mode==0)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "LastSessionsOrder", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "LastSessionsOrder", &dbv) && dbv.pszVal)
{
dbv.pszVal[count*2]=szTemp[0];
dbv.pszVal[count*2+1]=szTemp[1];
- DBWriteContactSettingString(hContact, MODNAME, "LastSessionsOrder", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, MODNAME, "LastSessionsOrder", dbv.pszVal);
+ db_free(&dbv);
}
}
if (mode==1)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, MODNAME, "UserSessionsOrder", &dbv) && dbv.pszVal)
+ if (!db_get_s(hContact, MODNAME, "UserSessionsOrder", &dbv) && dbv.pszVal)
{
dbv.pszVal[count*2]=szTemp[0];
dbv.pszVal[count*2+1]=szTemp[1];
- DBWriteContactSettingString(hContact, MODNAME, "UserSessionsOrder", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, MODNAME, "UserSessionsOrder", dbv.pszVal);
+ db_free(&dbv);
}
}
}
@@ -347,8 +347,8 @@ BOOL ResaveSettings(char* szName,int iFirst,int iLimit,TCHAR* szBuffer) mir_snprintf(szNameBuf, SIZEOF(szNameBuf), "%s_%u", szName, i);
DBVARIANT dbv_temp;
- int res = DBGetContactSettingTString(NULL, MODNAME, szNameBuf, &dbv_temp);
- DBWriteContactSettingTString(NULL, MODNAME, szNameBuf, szBuffer);
+ int res = db_get_ts(NULL, MODNAME, szNameBuf, &dbv_temp);
+ db_set_ts(NULL, MODNAME, szNameBuf, szBuffer);
mir_free(szBuffer);
marked = IsMarkedUserDefSession(i);
@@ -359,7 +359,7 @@ BOOL ResaveSettings(char* szName,int iFirst,int iLimit,TCHAR* szBuffer) return 0;
szBuffer = mir_tstrdup(dbv_temp.ptszVal);
- DBFreeVariant(&dbv_temp);
+ db_free(&dbv_temp);
}
mir_free(szBuffer);
@@ -499,7 +499,7 @@ void OffsetWindow(HWND parent, HWND hwnd, int dx, int dy) int CheckContactVisibility(HANDLE hContact)
{
- if (DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
+ if (db_get_b(hContact, "CList", "Hidden", 0))
return 0;
return 1;
}
@@ -508,14 +508,14 @@ void RenameUserDefSession(int ses_count,TCHAR* ptszNewName) {
char szSession[256]={0};
mir_snprintf(szSession, SIZEOF(szSession), "%s_%u", "UserSessionDsc", ses_count);
- DBWriteContactSettingTString(NULL, MODNAME, szSession, ptszNewName);
+ db_set_ts(NULL, MODNAME, szSession, ptszNewName);
}
int MarkUserDefSession(int ses_count,BYTE bCheck)
{
char szSessionName[256]={0};
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", ses_count);
- DBWriteContactSettingByte(NULL, MODNAME, szSessionName, bCheck);
+ db_set_b(NULL, MODNAME, szSessionName, bCheck);
return 0;
}
@@ -523,7 +523,7 @@ BYTE IsMarkedUserDefSession(int ses_count) {
char szSessionName[256]={0};
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u","FavUserSession", ses_count);
- return DBGetContactSettingByte(NULL, MODNAME, szSessionName, 0);
+ return db_get_b(NULL, MODNAME, szSessionName, 0);
}
void SavePosition(HWND hwnd, char *wndName)
@@ -532,9 +532,9 @@ void SavePosition(HWND hwnd, char *wndName) char buffer[512];
GetWindowRect(hwnd, &rc);
mir_snprintf(buffer, SIZEOF(buffer), "%sPosX", wndName);
- DBWriteContactSettingDword(0, MODNAME, buffer, rc.left);
+ db_set_dw(0, MODNAME, buffer, rc.left);
mir_snprintf(buffer, SIZEOF(buffer), "%sPosY", wndName);
- DBWriteContactSettingDword(0, MODNAME, buffer, rc.top);
+ db_set_dw(0, MODNAME, buffer, rc.top);
}
void LoadPosition(HWND hWnd, char *wndName)
@@ -542,8 +542,8 @@ void LoadPosition(HWND hWnd, char *wndName) char buffer[512];
int x,y ;
mir_snprintf(buffer, SIZEOF(buffer), "%sPosX", wndName);
- x = DBGetContactSettingDword(0, MODNAME, buffer, ((GetSystemMetrics(SM_CXSCREEN)) / 2)-130);
+ x = db_get_dw(0, MODNAME, buffer, ((GetSystemMetrics(SM_CXSCREEN)) / 2)-130);
mir_snprintf(buffer, SIZEOF(buffer), "%sPosY", wndName);
- y = DBGetContactSettingDword(0, MODNAME, buffer, ((GetSystemMetrics(SM_CYSCREEN))/ 2)-80);
+ y = db_get_dw(0, MODNAME, buffer, ((GetSystemMetrics(SM_CYSCREEN))/ 2)-80);
SetWindowPos(hWnd, NULL, x, y, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOSIZE);
}
\ No newline at end of file diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index 5888a54353..c3f4337efb 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -79,8 +79,8 @@ INT_PTR Toggle(WPARAM w, LPARAM l) {
HANDLE hContact = (HANDLE)w;
BOOL on = 0;
- on = !DBGetContactSettingByte(hContact, protocolname, "TurnedOn", 0);
- DBWriteContactSettingByte(hContact, protocolname, "TurnedOn", on ? 1 : 0);
+ on = !db_get_b(hContact, protocolname, "TurnedOn", 0);
+ db_set_b(hContact, protocolname, "TurnedOn", on ? 1 : 0);
on = on?0:1;
CLISTMENUITEM mi = { sizeof(mi) };
@@ -97,7 +97,7 @@ INT OnPreBuildContactMenu(WPARAM w, LPARAM l) CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- BOOL on = !DBGetContactSettingByte(hContact, protocolname, "TurnedOn", 0);
+ BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0);
mi.ptszName = on ? LPGENT("Turn off Autoanswer") : LPGENT("Turn on Autoanswer");
mi.hIcon = on?LoadIcon(hinstance, MAKEINTRESOURCE(IDI_OFF)):LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ON));
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggle, (LPARAM)&mi);
@@ -112,14 +112,14 @@ INT CheckDefaults(WPARAM, LPARAM) UnhookEvent(hCheckDefHook);
- fEnabled=!DBGetContactSettingByte(NULL,protocolname,KEY_ENABLED,1)==1;
- interval=DBGetContactSettingWord(NULL,protocolname,KEY_REPEATINTERVAL,300);
+ fEnabled=!db_get_b(NULL,protocolname,KEY_ENABLED,1)==1;
+ interval=db_get_w(NULL,protocolname,KEY_REPEATINTERVAL,300);
- if (DBGetContactSettingTString(NULL,protocolname,KEY_HEADING,&dbv))
+ if (db_get_ts(NULL,protocolname,KEY_HEADING,&dbv))
// Heading not set
- DBWriteContactSettingTString(NULL,protocolname,KEY_HEADING,TranslateT("Dear %user%, the owner left the following message:"));
+ db_set_ts(NULL,protocolname,KEY_HEADING,TranslateT("Dear %user%, the owner left the following message:"));
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
for (int c=ID_STATUS_ONLINE; c<ID_STATUS_IDLE; c++)
{
@@ -128,7 +128,7 @@ INT CheckDefaults(WPARAM, LPARAM) continue;
else
{
- if (DBGetContactSettingTString(NULL,protocolname,szStatus,&dbv))
+ if (db_get_ts(NULL,protocolname,szStatus,&dbv))
{
if (c < 40077)
// This mode does not have a preset message
@@ -136,10 +136,10 @@ INT CheckDefaults(WPARAM, LPARAM) else if(c > 40078)
ptszDefault=ptszDefaultMsg[c-ID_STATUS_ONLINE-3];
if (ptszDefault)
- DBWriteContactSettingTString(NULL,protocolname,szStatus,ptszDefault);
+ db_set_ts(NULL,protocolname,szStatus,ptszDefault);
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hPreBuildHook = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu);
@@ -209,46 +209,46 @@ INT addEvent(WPARAM wParam, LPARAM lParam) if (!dbei.cbBlob) /// invalid size
return FALSE;
- if (DBGetContactSettingTString(hContact,"Protocol","p",&dbv))
+ if (db_get_ts(hContact,"Protocol","p",&dbv))
// Contact with no protocol ?!!
return FALSE;
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
- if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if(db_get_b(hContact, "CList", "NotOnList", 0))
return FALSE;
- if(DBGetContactSettingByte(hContact, protocolname, "TurnedOn", 0))
+ if(db_get_b(hContact, protocolname, "TurnedOn", 0))
return FALSE;
if (!( dbei.flags & DBEF_SENT))
{
- int timeBetween=time(NULL)-DBGetContactSettingDword(hContact,protocolname,"LastReplyTS",0);
- if (timeBetween>interval || DBGetContactSettingWord(hContact,protocolname,"LastStatus",0)!=status)
+ int timeBetween=time(NULL)-db_get_dw(hContact,protocolname,"LastReplyTS",0);
+ if (timeBetween>interval || db_get_w(hContact,protocolname,"LastStatus",0)!=status)
{
char szStatus[6]={0};
int msgLen=1;
- int isQun=DBGetContactSettingByte(hContact,pszProto,"IsQun",0);
+ int isQun=db_get_b(hContact,pszProto,"IsQun",0);
if (isQun)
return FALSE;
mir_snprintf(szStatus,SIZEOF(szStatus),"%d",status);
- if (!DBGetContactSettingTString(NULL,protocolname,szStatus,&dbv))
+ if (!db_get_ts(NULL,protocolname,szStatus,&dbv))
{
if (*dbv.ptszVal)
{
DBVARIANT dbvHead={0}, dbvNick={0};
TCHAR *ptszTemp, *ptszTemp2;
- DBGetContactSettingTString(hContact,pszProto,"Nick",&dbvNick);
+ db_get_ts(hContact,pszProto,"Nick",&dbvNick);
if (lstrcmp(dbvNick.ptszVal, NULL) == 0)
{
- DBFreeVariant(&dbvNick);
+ db_free(&dbvNick);
return FALSE;
}
msgLen += (int)_tcslen(dbv.ptszVal);
- if (!DBGetContactSettingTString(NULL,protocolname,KEY_HEADING,&dbvHead))
+ if (!db_get_ts(NULL,protocolname,KEY_HEADING,&dbvHead))
{
ptszTemp = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(dbvHead.ptszVal)+1));
_tcscpy(ptszTemp, dbvHead.ptszVal);
@@ -284,17 +284,17 @@ INT addEvent(WPARAM wParam, LPARAM lParam) mir_free(ptszTemp2);
mir_free(pszUtf);
if (dbvNick.ptszVal)
- DBFreeVariant(&dbvNick);
+ db_free(&dbvNick);
if (dbvHead.ptszVal)
- DBFreeVariant(&dbvHead);
+ db_free(&dbvHead);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
- DBWriteContactSettingDword(hContact,protocolname,"LastReplyTS",time(NULL));
- DBWriteContactSettingWord(hContact,protocolname,"LastStatus",status);
+ db_set_dw(hContact,protocolname,"LastReplyTS",time(NULL));
+ db_set_w(hContact,protocolname,"LastStatus",status);
}
return 0;
}
diff --git a/plugins/SimpleAR/src/Options.cpp b/plugins/SimpleAR/src/Options.cpp index e53236d22c..41a0a5f1f0 100644 --- a/plugins/SimpleAR/src/Options.cpp +++ b/plugins/SimpleAR/src/Options.cpp @@ -14,13 +14,13 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara TCHAR* pszStatus;
char tszStatus[6]={0};
- CheckDlgButton(hwndDlg,IDC_ENABLEREPLIER,DBGetContactSettingByte(NULL,protocolname,KEY_ENABLED,1)==1);
- SetDlgItemInt(hwndDlg,IDC_INTERVAL,DBGetContactSettingWord(NULL,protocolname,KEY_REPEATINTERVAL,300)/60,FALSE);
+ CheckDlgButton(hwndDlg,IDC_ENABLEREPLIER,db_get_b(NULL,protocolname,KEY_ENABLED,1)==1);
+ SetDlgItemInt(hwndDlg,IDC_INTERVAL,db_get_w(NULL,protocolname,KEY_REPEATINTERVAL,300)/60,FALSE);
- if (!DBGetContactSettingTString(NULL,protocolname,KEY_HEADING,&dbv))
+ if (!db_get_ts(NULL,protocolname,KEY_HEADING,&dbv))
{
SetDlgItemText(hwndDlg,IDC_HEADING,dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
for (INT c = ID_STATUS_ONLINE; c < ID_STATUS_IDLE; c++)
@@ -33,13 +33,13 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara {
SendDlgItemMessage(hwndDlg,IDC_STATUSMODE,CB_ADDSTRING,0,(LPARAM)pszStatus);
- if (!DBGetContactSettingTString(NULL, protocolname, tszStatus, &dbv))
+ if (!db_get_ts(NULL, protocolname, tszStatus, &dbv))
{
if (c < 40077)
ptszMessage[c-ID_STATUS_ONLINE-1] = _tcsdup(dbv.ptszVal);
else if (c > 40078)
ptszMessage[c-ID_STATUS_ONLINE-3] = _tcsdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -93,15 +93,15 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara BOOL translated;
fEnabled=IsDlgButtonChecked(hwndDlg,IDC_ENABLEREPLIER)==1;
- DBWriteContactSettingByte(NULL,protocolname,KEY_ENABLED,(BYTE)fEnabled);
+ db_set_b(NULL,protocolname,KEY_ENABLED,(BYTE)fEnabled);
GetDlgItemText(hwndDlg,IDC_HEADING,ptszText,SIZEOF(ptszText));
- DBWriteContactSettingTString(NULL,protocolname,KEY_HEADING,ptszText);
+ db_set_ts(NULL,protocolname,KEY_HEADING,ptszText);
size=GetDlgItemInt(hwndDlg,IDC_INTERVAL,&translated,FALSE);
if (translated)
interval=size*60;
- DBWriteContactSettingWord(NULL,protocolname,KEY_REPEATINTERVAL,interval);
+ db_set_w(NULL,protocolname,KEY_REPEATINTERVAL,interval);
size=SendDlgItemMessage(hwndDlg,IDC_MESSAGE,WM_GETTEXTLENGTH,0,0)+1;
GetDlgItemText(hwndDlg,IDC_MESSAGE,ptszMessage[lastIndex],size);
@@ -115,11 +115,11 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara mir_snprintf(szStatus,SIZEOF(szStatus),"%d",c);
if (c<40077 && ptszMessage[c-ID_STATUS_ONLINE-1])
- DBWriteContactSettingTString(NULL,protocolname,szStatus,ptszMessage[c-ID_STATUS_ONLINE-1]);
+ db_set_ts(NULL,protocolname,szStatus,ptszMessage[c-ID_STATUS_ONLINE-1]);
else if (c>40078 && ptszMessage[c-ID_STATUS_ONLINE-3])
- DBWriteContactSettingTString(NULL,protocolname,szStatus,ptszMessage[c-ID_STATUS_ONLINE-3]);
+ db_set_ts(NULL,protocolname,szStatus,ptszMessage[c-ID_STATUS_ONLINE-3]);
else
- DBDeleteContactSetting(NULL,protocolname,szStatus);
+ db_unset(NULL,protocolname,szStatus);
}
}
return TRUE;
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index 60d26d3b56..e286a13dbd 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -26,9 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "commonheaders.h"
-static HANDLE hAwayMsgMenuItem;
-static HANDLE hCopyMsgMenuItem;
-static HANDLE hGoToURLMenuItem;
+static HGENMENU hAwayMsgMenuItem, hCopyMsgMenuItem, hGoToURLMenuItem;
static HANDLE hWindowList;
static HANDLE hWindowList2;
@@ -106,7 +104,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP TCHAR str[256], format[128];
TCHAR *contactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)dat->hContact, GCDNF_TCHAR);
char *szProto = GetContactProto(dat->hContact);
- WORD dwStatus = DBGetContactSettingWord(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE);
TCHAR *status = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dwStatus, GSMDF_TCHAR);
GetWindowText(hwndDlg, format, SIZEOF(format));
@@ -335,20 +333,20 @@ static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM lParam) char *szMsg;
- int unicode = !DBGetContactSetting((HANDLE)wParam, "CList", "StatusMsg", &dbv) && (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
- DBFreeVariant(&dbv);
+ int unicode = !db_get((HANDLE)wParam, "CList", "StatusMsg", &dbv) && (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
+ db_free(&dbv);
if (unicode)
{
- DBGetContactSettingWString((HANDLE)wParam, "CList", "StatusMsg", &dbv);
+ db_get_ws((HANDLE)wParam, "CList", "StatusMsg", &dbv);
szMsg = mir_u2a(dbv.pwszVal);
}
else
{
- DBGetContactSettingString((HANDLE)wParam, "CList", "StatusMsg", &dbv);
+ db_get_s((HANDLE)wParam, "CList", "StatusMsg", &dbv);
szMsg = mir_strdup(dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
char *szURL = StrFindURL(szMsg);
if (szURL != NULL)
@@ -374,7 +372,7 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) {
TCHAR str[128];
char *szProto = GetContactProto((HANDLE)wParam);
- int iHidden = szProto ? DBGetContactSettingByte((HANDLE)wParam, szProto, "ChatRoom", 0) : 0;
+ int iHidden = szProto ? db_get_b((HANDLE)wParam, szProto, "ChatRoom", 0) : 0;
char *szMsg;
int iStatus;
@@ -382,14 +380,11 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) clmi.cbSize = sizeof(clmi);
clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
- if (!iHidden)
- {
+ if (!iHidden) {
iHidden = 1;
- iStatus = DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE);
- if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1,0) & PF1_MODEMSGRECV)
- {
- if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3,0) & Proto_Status2Flag(iStatus == ID_STATUS_OFFLINE ? ID_STATUS_INVISIBLE : iStatus))
- {
+ iStatus = db_get_w((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE);
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1,0) & PF1_MODEMSGRECV) {
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3,0) & Proto_Status2Flag(iStatus == ID_STATUS_OFFLINE ? ID_STATUS_INVISIBLE : iStatus)) {
iHidden = 0;
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
clmi.hIcon = LoadSkinnedProtoIcon(szProto, iStatus);
@@ -398,51 +393,43 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) }
}
}
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hAwayMsgMenuItem, (LPARAM)&clmi);
+ Menu_ModifyItem(hAwayMsgMenuItem, &clmi);
Skin_ReleaseIcon(clmi.hIcon);
- clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
- if (!iHidden)
- {
+ clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
+ if (!iHidden) {
DBVARIANT dbv;
- int unicode = !DBGetContactSetting((HANDLE)wParam, "CList", "StatusMsg", &dbv) && (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
- DBFreeVariant(&dbv);
- if (unicode)
- {
- DBGetContactSettingWString((HANDLE)wParam, "CList", "StatusMsg", &dbv);
+ int unicode = !db_get((HANDLE)wParam, "CList", "StatusMsg", &dbv) && (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
+ db_free(&dbv);
+ if (unicode) {
+ db_get_ws((HANDLE)wParam, "CList", "StatusMsg", &dbv);
szMsg = mir_u2a(dbv.pwszVal);
}
- else
-
- {
- DBGetContactSettingString((HANDLE)wParam, "CList", "StatusMsg", &dbv);
+ else {
+ db_get_s((HANDLE)wParam, "CList", "StatusMsg", &dbv);
szMsg = mir_strdup(dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ShowCopy", 1) && szMsg && *szMsg != '\0')
- {
+ if (db_get_b(NULL, "SimpleStatusMsg", "ShowCopy", 1) && szMsg && *szMsg != '\0') {
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR;
mir_sntprintf(str, SIZEOF(str), TranslateT("Copy %s Message"), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iStatus, GSMDF_TCHAR));
clmi.ptszName = str;
}
}
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hCopyMsgMenuItem, (LPARAM)&clmi);
- clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
+ Menu_ModifyItem(hCopyMsgMenuItem, &clmi);
- if (!iHidden)
- {
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ShowGoToURL", 1) && StrFindURL(szMsg) != NULL)
- {
+ clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
+ if (!iHidden) {
+ if (db_get_b(NULL, "SimpleStatusMsg", "ShowGoToURL", 1) && StrFindURL(szMsg) != NULL) {
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR;
mir_sntprintf(str, SIZEOF(str), TranslateT("&Go to URL in %s Message"), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iStatus, GSMDF_TCHAR));
clmi.ptszName = str;
}
mir_free(szMsg);
}
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hGoToURLMenuItem, (LPARAM)&clmi);
-
+ Menu_ModifyItem(hGoToURLMenuItem, &clmi);
return 0;
}
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index b534c8d0b3..92676a3b32 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -152,7 +152,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) for (i = 0; msg[i]; i++)
{
- if (msg[i] == 0x0D && DBGetContactSettingByte(NULL, "SimpleStatusMsg", "RemoveCR", 0))
+ if (msg[i] == 0x0D && db_get_b(NULL, "SimpleStatusMsg", "RemoveCR", 0))
{
TCHAR *p = msg + i;
if (i + 1 <= 1024 && msg[i + 1])
@@ -186,7 +186,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) g_ptszWinampSong = mir_tstrdup(ptszWinampTitle);
}
else if (g_ptszWinampSong && lstrcmp(g_ptszWinampSong, _T("SimpleStatusMsg"))
- && DBGetContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1))
+ && db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1))
{
ptszWinampTitle = mir_tstrdup(g_ptszWinampSong);
}
@@ -353,7 +353,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) BOOL rmark[25];
for (k = 0; k < SIZEOF(rmark); k++) rmark[k] = FALSE;
- maxk = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", 10);
+ maxk = db_get_b(NULL, "SimpleStatusMsg", "MaxHist", 10);
if (maxk == 0) rmark[0] = TRUE;
while (!rmark[0])
@@ -365,15 +365,15 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) if (k2 == maxk || k2 > maxk) rmark[0] = TRUE;
mir_snprintf(buff, SIZEOF(buff), "SMsg%d", k);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", buff, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv))
{
if (dbv.ptszVal == NULL)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
continue;
}
lstrcpy(substituteStr, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else continue;
@@ -401,7 +401,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) BOOL rmark[25];
for (k = 0; k < SIZEOF(rmark); k++) rmark[k] = FALSE;
- maxk = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
+ maxk = db_get_w(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
if (maxk == 0) rmark[0] = TRUE;
while (!rmark[0])
@@ -413,15 +413,15 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) if (k2 == maxk || k2 > maxk) rmark[0] = TRUE;
mir_snprintf(buff, SIZEOF(buff), "DefMsg%d", k);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", buff, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv))
{
if (dbv.ptszVal == NULL)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
continue;
}
lstrcpy(substituteStr, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else continue;
@@ -449,7 +449,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) {
char szSetting[80];
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", szProto);
- len = DBGetContactSettingWord(NULL, "SimpleStatusMsg", szSetting, 1024);
+ len = db_get_w(NULL, "SimpleStatusMsg", szSetting, 1024);
if (len < lstrlen(msg))
{
msg = (TCHAR *)mir_realloc(msg, len * sizeof(TCHAR));
@@ -462,7 +462,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) TCHAR *InsertVarsIntoMsg(TCHAR *tszMsg, const char *szProto, int iStatus, HANDLE hContact)
{
- if (ServiceExists(MS_VARS_FORMATSTRING) && DBGetContactSettingByte(NULL, "SimpleStatusMsg", "EnableVariables", 1))
+ if (ServiceExists(MS_VARS_FORMATSTRING) && db_get_b(NULL, "SimpleStatusMsg", "EnableVariables", 1))
{
FORMATINFO fInfo = {0};
fInfo.cbSize = sizeof(fInfo);
@@ -489,7 +489,7 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) TCHAR *format;
mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", szProto ? szProto : "");
- flags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
+ flags = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
if (flags & STATUS_EMPTY_MSG)
return mir_tstrdup(_T(""));
@@ -501,11 +501,11 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) else
mir_snprintf(szSetting, SIZEOF(szSetting), "Msg");
- if (DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), &dbv))
+ if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), &dbv))
return NULL; //mir_tstrdup(_T(""));
format = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else if (flags & STATUS_LAST_MSG)
{
@@ -514,18 +514,18 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) else
mir_snprintf(szSetting, SIZEOF(szSetting), "LastMsg");
- if (DBGetContactSetting(NULL, "SimpleStatusMsg", szSetting, &dbv2))
+ if (db_get(NULL, "SimpleStatusMsg", szSetting, &dbv2))
return NULL; //mir_tstrdup(_T(""));
- if (DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv2.pszVal, &dbv))
+ if (db_get_ts(NULL, "SimpleStatusMsg", dbv2.pszVal, &dbv))
{
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
return NULL; //mir_tstrdup(_T(""));
}
format = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
- DBFreeVariant(&dbv2);
+ db_free(&dbv);
+ db_free(&dbv2);
}
else if (flags & STATUS_THIS_MSG)
{
@@ -534,11 +534,11 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) else
mir_snprintf(szSetting, SIZEOF(szSetting), "Default");
- if (DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), &dbv))
+ if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), &dbv))
return mir_tstrdup(_T(""));
format = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
format = mir_tstrdup(GetDefaultMessage(iStatus));
@@ -549,9 +549,9 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) void DBWriteMessage(char *szSetting, TCHAR *tszMsg)
{
if (tszMsg && lstrlen(tszMsg))
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", szSetting, tszMsg);
+ db_set_ts(NULL, "SimpleStatusMsg", szSetting, tszMsg);
else
- DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
+ db_unset(NULL, "SimpleStatusMsg", szSetting);
}
void SaveMessageToDB(const char *szProto, TCHAR *tszMsg, BOOL bIsFormat)
@@ -601,7 +601,7 @@ void SaveStatusAsCurrent(const char *szProto, int iStatus) {
char szSetting[80];
mir_snprintf(szSetting, SIZEOF(szSetting), "Cur%sStatus", szProto);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)iStatus);
+ db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)iStatus);
}
static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, HANDLE hContact)
@@ -613,10 +613,10 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, {
DBVARIANT dbv;
mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", szProto);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", szSetting, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
format = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
//else
// format = mir_tstrdup(_T(""));
@@ -632,7 +632,7 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, return NULL;
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", szProto ? szProto : "");
- flags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
+ flags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
//if (flags & PROTO_NO_MSG)
//{
@@ -643,10 +643,10 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, {
DBVARIANT dbv;
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", szProto);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", szSetting, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
format = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
format = mir_tstrdup(_T(""));
@@ -655,10 +655,10 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, {
DBVARIANT dbv;
mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", szProto);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", szSetting, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
format = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
//else
// format = mir_tstrdup(_T(""));
@@ -682,10 +682,10 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, int CheckProtoSettings(const char *szProto, int iInitialStatus)
{
- int iSetting = DBGetContactSettingWord(NULL, szProto, "LeaveStatus", -1); //GG settings
+ int iSetting = db_get_w(NULL, szProto, "LeaveStatus", -1); //GG settings
if (iSetting != -1)
return iSetting ? iSetting : iInitialStatus;
- iSetting = DBGetContactSettingWord(NULL, szProto, "OfflineMessageOption", -1); //TLEN settings
+ iSetting = db_get_w(NULL, szProto, "OfflineMessageOption", -1); //TLEN settings
if (iSetting != -1)
{
switch (iSetting)
@@ -752,7 +752,7 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus int flags;
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", szProto);
- flags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
+ flags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
if (flags & PROTO_NO_MSG)
{
@@ -767,11 +767,11 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus TCHAR *msg;
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", szProto);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", szSetting, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
SaveMessageToDB(szProto, dbv.ptszVal, TRUE);
msg = InsertVarsIntoMsg(dbv.ptszVal, szProto, iStatus, NULL);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
Proto_SetStatus(szProto, iInitialStatus, iStatus, msg);
SaveMessageToDB(szProto, msg, FALSE);
mir_free(msg);
@@ -802,7 +802,7 @@ INT_PTR SetStatusModeFromExtern(WPARAM wParam, LPARAM lParam) if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~ CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (DBGetContactSettingByte(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
continue;
if (wParam == ID_STATUS_CURRENT || wParam == 0)
@@ -896,7 +896,7 @@ void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, TCHA if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (!bOnStartup && DBGetContactSettingByte(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
+ if (!bOnStartup && db_get_b(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
continue;
if (iProfileStatus)
@@ -904,11 +904,11 @@ void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, TCHA int iProfileNumber = iStatus - 40083;
char szSetting[128];
mir_snprintf(szSetting, SIZEOF(szSetting), "%d_%s", iProfileNumber, accounts->pa[i]->szModuleName);
- iStatus = DBGetContactSettingWord(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
+ iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
if (iStatus == ID_STATUS_IDLE) // the same as ID_STATUS_LAST in StartupStatus
{
mir_snprintf(szSetting, SIZEOF(szSetting), "last_%s", accounts->pa[i]->szModuleName);
- iStatus = DBGetContactSettingWord(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
+ iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
}
else if (iStatus == ID_STATUS_CURRENT)
iStatus = GetCurrentStatus(accounts->pa[i]->szModuleName);
@@ -1124,7 +1124,7 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) }
mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", szProto ? szProto : "");
- iDlgFlags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
+ iDlgFlags = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
bShowDlg = iDlgFlags & STATUS_SHOW_DLG || bOnStartup;
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &bScreenSaverRunning, 0);
@@ -1151,7 +1151,7 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) }
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", szProto);
- iProtoFlags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
+ iProtoFlags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG)
{
if (HasProtoStaticStatusMsg(szProto, iStatus, iStatus))
@@ -1163,10 +1163,10 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) TCHAR *msg = NULL;
mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", szProto);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", szSetting, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
msg = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
//else
// msg = mir_tstrdup(_T(""));
@@ -1218,7 +1218,7 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (iStatus == ID_STATUS_OFFLINE || (!(accounts->statusMsgFlags & Proto_Status2Flag(iStatus)) && iStatus != ID_STATUS_CURRENT))
return 0;
- iProtoFlags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ProtoFlags", PROTO_DEFAULT);
+ iProtoFlags = db_get_b(NULL, "SimpleStatusMsg", "ProtoFlags", PROTO_DEFAULT);
if (!bShowDlg || bScreenSaverRunning || (iProtoFlags & PROTO_NOCHANGE && !bOnStartup))
{
TCHAR *msg = NULL;
@@ -1230,7 +1230,7 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (DBGetContactSettingByte(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
continue;
if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus)) ||
@@ -1241,10 +1241,10 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) {
DBVARIANT dbv;
mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", accounts->pa[i]->szModuleName);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", szSetting, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
msg = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
//else
// msg = mir_tstrdup(_T(""));
@@ -1397,7 +1397,7 @@ int SetStartupStatus(int i) }
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", accounts->pa[i]->szModuleName);
- flags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
+ flags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
if (flags & PROTO_NO_MSG || flags & PROTO_THIS_MSG)
{
if (HasProtoStaticStatusMsg(accounts->pa[i]->szModuleName, ID_STATUS_OFFLINE, iStatus))
@@ -1407,10 +1407,10 @@ int SetStartupStatus(int i) {
DBVARIANT dbv;
mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", accounts->pa[i]->szModuleName);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", szSetting, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
fmsg = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
//else
// fmsg = mir_tstrdup(_T(""));
@@ -1468,7 +1468,7 @@ VOID CALLBACK SetStartupStatusGlobal(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWO }
// popup status msg dialog at startup?
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "StartupPopupDlg", 1) && accounts->statusMsgFlags)
+ if (db_get_b(NULL, "SimpleStatusMsg", "StartupPopupDlg", 1) && accounts->statusMsgFlags)
{
if (globalstatus)
{
@@ -1477,7 +1477,7 @@ VOID CALLBACK SetStartupStatusGlobal(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWO else
{
// pseudo-currentDesiredStatusMode ;-)
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "StartupStatus", (WORD)temp_status_mode);
+ db_set_w(NULL, "SimpleStatusMsg", "StartupStatus", (WORD)temp_status_mode);
ChangeStatusMessage((WPARAM)ID_STATUS_CURRENT, (LPARAM)"SimpleStatusMsgGlobalStartupStatus");
}
return;
@@ -1491,7 +1491,7 @@ VOID CALLBACK SetStartupStatusGlobal(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWO if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
-// if (DBGetContactSettingByte(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
+// if (db_get_b(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
// continue;
SetStartupStatus(i);
@@ -1533,7 +1533,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD d MIRANDA_IDLE_INFO mii = {0};
mii.cbSize = sizeof(mii);
CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii);
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", 1) && mii.idleType)
+ if (db_get_b(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", 1) && mii.idleType)
return;
if (!hwndSAMsgDialog)
@@ -1559,22 +1559,22 @@ VOID CALLBACK UpdateMsgTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD d continue;
mir_snprintf(szBuffer, SIZEOF(szBuffer), "FCur%sMsg", accounts->pa[i]->szModuleName);
- if (DBGetContactSettingTString(NULL, "SimpleStatusMsg", szBuffer, &dbv))
+ if (db_get_ts(NULL, "SimpleStatusMsg", szBuffer, &dbv))
continue;
tszMsg = InsertVarsIntoMsg(dbv.ptszVal, accounts->pa[i]->szModuleName, iCurrentStatus, NULL);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szBuffer, SIZEOF(szBuffer), "Cur%sMsg", accounts->pa[i]->szModuleName);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", szBuffer, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", szBuffer, &dbv))
{
if (tszMsg && dbv.ptszVal && !lstrcmp(tszMsg, dbv.ptszVal) || !tszMsg && !dbv.ptszVal)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_free(tszMsg);
continue;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (tszMsg && lstrlen(tszMsg))
@@ -1647,7 +1647,7 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- if (!DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", 1))
+ if (!db_get_b(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", 1))
mi.flags |= CMIF_HIDDEN;
mi.icolibItem = GetIconHandle(IDI_CSMSG);
mi.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT;
@@ -1676,7 +1676,7 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) continue;
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", pa[i]->szModuleName);
- iProtoFlags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
+ iProtoFlags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG)
continue;
@@ -1717,7 +1717,7 @@ static int OnIdleChanged(WPARAM, LPARAM lParam) if (!IsAccountEnabled(accounts->pa[i]))
continue;
- if (DBGetContactSettingByte(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
continue;
int iStatusBits = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
@@ -1734,7 +1734,7 @@ static int OnIdleChanged(WPARAM, LPARAM lParam) if (iCurrentStatus < ID_STATUS_ONLINE || iCurrentStatus == ID_STATUS_INVISIBLE)
continue;
- if ((lParam & IDF_ISIDLE && (DBGetContactSettingByte(NULL, "AutoAway", accounts->pa[i]->szModuleName, 0) ||
+ if ((lParam & IDF_ISIDLE && (db_get_b(NULL, "AutoAway", accounts->pa[i]->szModuleName, 0) ||
iCurrentStatus == ID_STATUS_ONLINE || iCurrentStatus == ID_STATUS_FREECHAT)) ||
(!(lParam & IDF_ISIDLE) && !mii.aaLock))
{
@@ -1791,11 +1791,11 @@ static int CSStatusChange(WPARAM wParam, LPARAM lParam) #ifdef _DEBUG
log2file("CSStatusChange(): Set \"%s\" status message for %s.", ps[i]->szMsg, ps[i]->szName);
#endif
- max_hist_msgs = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", 10);
+ max_hist_msgs = db_get_b(NULL, "SimpleStatusMsg", "MaxHist", 10);
for (j = 1; j <= max_hist_msgs; j++)
{
mir_snprintf(buff, SIZEOF(buff), "SMsg%d", j);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", buff, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv))
{
if (!lstrcmp(dbv.ptszVal, szMsgW))
@@ -1803,8 +1803,8 @@ static int CSStatusChange(WPARAM wParam, LPARAM lParam) {
found = TRUE;
mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", ps[i]->szName);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", szSetting, buff);
- DBFreeVariant(&dbv);
+ db_set_s(NULL, "SimpleStatusMsg", szSetting, buff);
+ db_free(&dbv);
break;
}
}
@@ -1814,12 +1814,12 @@ static int CSStatusChange(WPARAM wParam, LPARAM lParam) {
mir_snprintf(buff, SIZEOF(buff), "FCur%sMsg", ps[i]->szName);
mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", ps[i]->szName);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", szSetting, buff);
+ db_set_s(NULL, "SimpleStatusMsg", szSetting, buff);
}
mir_snprintf(szSetting, SIZEOF(szSetting), "%sMsg", ps[i]->szName);
- DBWriteContactSettingWString(NULL, "SRAway", StatusModeToDbSetting(status_mode, szSetting), szMsgW);
+ db_set_ws(NULL, "SRAway", StatusModeToDbSetting(status_mode, szSetting), szMsgW);
msg = InsertVarsIntoMsg(szMsgW, ps[i]->szName, status_mode, NULL);
SaveMessageToDB(ps[i]->szName, szMsgW, TRUE);
mir_free(szMsgW);
@@ -1847,7 +1847,7 @@ static TCHAR *ParseWinampSong(ARGUMENTSINFO *ai) mir_free(g_ptszWinampSong);
g_ptszWinampSong = mir_tstrdup(ptszWinampTitle);
}
- else if (g_ptszWinampSong && lstrcmp(g_ptszWinampSong, _T("SimpleStatusMsg")) && DBGetContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1))
+ else if (g_ptszWinampSong && lstrcmp(g_ptszWinampSong, _T("SimpleStatusMsg")) && db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1))
ptszWinampTitle = mir_tstrdup(g_ptszWinampSong);
return ptszWinampTitle;
@@ -1886,7 +1886,7 @@ static int OnICQStatusMsgRequest(WPARAM wParam, LPARAM lParam, LPARAM lMirParam) log2file("OnICQStatusMsgRequest(): UIN: %d on %s", (int)lParam, (char *)lMirParam);
#endif
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", 1))
+ if (db_get_b(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", 1))
return 0;
HANDLE hContact;
@@ -1897,7 +1897,7 @@ static int OnICQStatusMsgRequest(WPARAM wParam, LPARAM lParam, LPARAM lMirParam) while (hContact)
{
szProto = GetContactProto(hContact);
- if (szProto != NULL && !strcmp(szProto, (char *)lMirParam) && DBGetContactSettingDword(hContact, szProto, "UIN", 0) == (DWORD)lParam)
+ if (szProto != NULL && !strcmp(szProto, (char *)lMirParam) && db_get_dw(hContact, szProto, "UIN", 0) == (DWORD)lParam)
{
bContactFound = TRUE;
break;
@@ -1991,7 +1991,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) tr.szHelpText = LPGEN("External Applications\tretrieves song name of the song currently playing in Winamp (Simple Status Message compatible)");
CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ExclDateToken", 0) != 0)
+ if (db_get_b(NULL, "SimpleStatusMsg", "ExclDateToken", 0) != 0)
{
tr.tszTokenString = _T("date");
tr.parseFunctionT = ParseDate;
@@ -2000,13 +2000,13 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) }
}
-/* if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1))*/ {
+/* if (db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1))*/ {
DBVARIANT dbv;
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", "AmpLastTitle", &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", "AmpLastTitle", &dbv))
{
g_ptszWinampSong = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
g_ptszWinampSong = mir_tstrdup(_T("SimpleStatusMsg"));
@@ -2014,8 +2014,8 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) /* else
g_ptszWinampSong = mir_tstrdup(_T("SimpleStatusMsg"));*/
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", 1))
- g_uUpdateMsgTimer = SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10) * 1000, (TIMERPROC)UpdateMsgTimerProc);
+ if (db_get_b(NULL, "SimpleStatusMsg", "UpdateMsgOn", 1))
+ g_uUpdateMsgTimer = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10) * 1000, (TIMERPROC)UpdateMsgTimerProc);
if (ServiceExists(MS_CS_SETSTATUSEX))
HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChange);
@@ -2025,9 +2025,9 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) if (!ServiceExists(MS_SS_GETPROFILECOUNT))
{
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "GlobalStatusDelay", 1))
+ if (db_get_b(NULL, "SimpleStatusMsg", "GlobalStatusDelay", 1))
{
- SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "SimpleStatusMsg", "SetStatusDelay", 300), (TIMERPROC)SetStartupStatusGlobal);
+ SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", "SetStatusDelay", 300), (TIMERPROC)SetStartupStatusGlobal);
}
else
{
@@ -2043,7 +2043,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) continue;
mir_snprintf(szSetting, SIZEOF(szSetting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
- g_uSetStatusTimer[i] = SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "SimpleStatusMsg", szSetting, 300), (TIMERPROC)SetStartupStatusProc);
+ g_uSetStatusTimer[i] = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", szSetting, 300), (TIMERPROC)SetStartupStatusProc);
}
}
}
@@ -2066,10 +2066,10 @@ static int OnOkToExit(WPARAM wParam, LPARAM lParam) continue;
mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sStatus", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)CallProtoService(accounts->pa[i]->szModuleName, PS_GETSTATUS, 0, 0));
+ db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)CallProtoService(accounts->pa[i]->szModuleName, PS_GETSTATUS, 0, 0));
}
- if (g_ptszWinampSong && lstrcmp(g_ptszWinampSong, _T("SimpleStatusMsg")) /*&& DBGetContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1)*/)
+ if (g_ptszWinampSong && lstrcmp(g_ptszWinampSong, _T("SimpleStatusMsg")) /*&& db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1)*/)
DBWriteMessage("AmpLastTitle", g_ptszWinampSong);
}
@@ -2119,7 +2119,7 @@ extern "C" int __declspec(dllexport) Load(void) hwndSAMsgDialog = NULL;
accounts = (PROTOACCOUNTS *)mir_alloc(sizeof(PROTOACCOUNTS));
- DBWriteContactSettingWord(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
+ db_set_w(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index e7b4a7c436..b98b9d5c40 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -242,7 +242,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) else
cbei.mask = CBEIF_LPARAM | CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE;
- j = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", 1);
+ j = db_get_w(NULL, "SimpleStatusMsg", "LMMsg", 1);
for (i = 1; i <= data->max_hist_msgs; ++i)
{
@@ -250,7 +250,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) if (j < 1) j = data->max_hist_msgs;
mir_snprintf(buff, SIZEOF(buff), "SMsg%d", j);
j--;
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", buff, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv))
{
if (dbv.ptszVal != NULL && dbv.ptszVal != '\0')
{
@@ -269,11 +269,11 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) if (SendMessage(handle, CBEM_INSERTITEM, 0, (LPARAM)&cbei) == -1)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -361,13 +361,13 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) {
// predefined messages
mir_snprintf(buff, SIZEOF(buff), "DefMsg%d", i);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", buff, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv))
{
if (dbv.ptszVal)
{
if (!lstrlen(dbv.ptszVal))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
continue;
}
@@ -386,11 +386,11 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) if (SendMessage(handle,CBEM_INSERTITEM,0,(LPARAM)&cbei) == -1)
break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "PutDefInList", 0))
+ if (db_get_b(NULL, "SimpleStatusMsg", "PutDefInList", 0))
{
cbei.iItem = -1;
cbei.pszText = (LPTSTR)GetDefaultMessage(data->m_iStatus);
@@ -704,9 +704,9 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel) for (i = 1; i <= data->max_hist_msgs; i++)
{
mir_snprintf(text, SIZEOF(text), "SMsg%d", i);
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", text, _T(""));
+ db_set_ts(NULL, "SimpleStatusMsg", text, _T(""));
}
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", "LastMsg", "");
+ db_set_s(NULL, "SimpleStatusMsg", "LastMsg", "");
for (i = 0; i < accounts->count; i++)
{
if (!IsAccountEnabled(accounts->pa[i]))
@@ -719,9 +719,9 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel) continue;
mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", accounts->pa[i]->szModuleName);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", buff2, "");
+ db_set_s(NULL, "SimpleStatusMsg", buff2, "");
}
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", (WORD)data->max_hist_msgs);
+ db_set_w(NULL, "SimpleStatusMsg", "LMMsg", (WORD)data->max_hist_msgs);
SendMessage(data->recent_cbex, CB_SETCURSEL, -1, 0);
num_items = SendMessage(data->recent_cbex, CB_GETCOUNT, 0, 0);
if (num_items == CB_ERR)
@@ -750,7 +750,7 @@ void DisplayCharsCount(struct MsgBoxData *dlg_data, HWND hwndDlg) return;
len = GetDlgItemText(hwndDlg, IDC_EDIT1, msg, SIZEOF(msg));
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "RemoveCR", 0))
+ if (db_get_b(NULL, "SimpleStatusMsg", "RemoveCR", 0))
{
int index, num_lines = SendMessage(GetDlgItem(hwndDlg, IDC_EDIT1), EM_GETLINECOUNT, 0, 0);
for (int i = 1; i < num_lines; ++i)
@@ -773,7 +773,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) num_start -= data->num_def_msgs + 1;
mir_snprintf(setting, SIZEOF(setting), "%sFlags", data->m_szProto ? data->m_szProto : "");
- flags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(iStatus, setting), STATUS_DEFAULT);
+ flags = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(iStatus, setting), STATUS_DEFAULT);
if (flags & STATUS_LAST_MSG)
{
@@ -782,11 +782,11 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) else
mir_snprintf(setting, SIZEOF(setting), "LastMsg");
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv))
{
if (dbv.pszVal)
{
- if (strlen(dbv.pszVal) && !DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2))
+ if (strlen(dbv.pszVal) && !db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2))
{
if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
{
@@ -795,17 +795,17 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) if (fcursel != CB_ERR)
SendMessage(data->recent_cbex, CB_SETCURSEL, (WPARAM)fcursel, 0);
}
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else if (flags & STATUS_DEFAULT_MSG)
{
SetDlgItemText(hwndDlg, IDC_EDIT1, GetDefaultMessage(iStatus));
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "PutDefInList", 0))
+ if (db_get_b(NULL, "SimpleStatusMsg", "PutDefInList", 0))
{
fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)GetDefaultMessage(iStatus));
if (fcursel != CB_ERR)
@@ -819,13 +819,13 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) else
mir_snprintf(setting, SIZEOF(setting), "Default");
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting), &dbv))
+ if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting), &dbv))
{
SetDlgItemText(hwndDlg, IDC_EDIT1, dbv.ptszVal);
fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)dbv.ptszVal);
if (fcursel != CB_ERR)
SendMessage(data->recent_cbex, CB_SETCURSEL, (WPARAM)fcursel, 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else if (flags & STATUS_LAST_STATUS_MSG)
@@ -835,13 +835,13 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) else
mir_snprintf(setting, SIZEOF(setting), "Msg");
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting), &dbv))
+ if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting), &dbv))
{
SetDlgItemText(hwndDlg, IDC_EDIT1, dbv.ptszVal);
fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)dbv.ptszVal);
if (fcursel != CB_ERR)
SendMessage(data->recent_cbex, CB_SETCURSEL, (WPARAM)fcursel, 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -1021,9 +1021,9 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, DM_SIMPAWAY_SHUTDOWN);
HookEventMessage(ME_SKIN2_ICONSCHANGED, hwndDlg, DM_SIMPAWAY_CHANGEICONS);
- copy_init_data->num_def_msgs = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
- copy_init_data->max_hist_msgs = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", 10);
- copy_init_data->m_iDlgFlags = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "DlgFlags", DLG_SHOW_DEFAULT);
+ copy_init_data->num_def_msgs = db_get_w(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
+ copy_init_data->max_hist_msgs = db_get_b(NULL, "SimpleStatusMsg", "MaxHist", 10);
+ copy_init_data->m_iDlgFlags = db_get_b(NULL, "SimpleStatusMsg", "DlgFlags", DLG_SHOW_DEFAULT);
copy_init_data->m_szProto = init_data->m_szProto;
copy_init_data->m_iStatus = init_data->m_iStatus;
copy_init_data->m_iStatusModes = init_data->m_iStatusModes;
@@ -1144,9 +1144,9 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA }
}
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "AutoClose", 1) && init_data->m_bOnEvent)
+ if (db_get_b(NULL, "SimpleStatusMsg", "AutoClose", 1) && init_data->m_bOnEvent)
{
- copy_init_data->m_iCountdown = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "DlgTime", 5);
+ copy_init_data->m_iCountdown = db_get_b(NULL, "SimpleStatusMsg", "DlgTime", 5);
SendMessage(hwndDlg, WM_TIMER, 0, 0);
SetTimer(hwndDlg, 1, 1000, 0);
}
@@ -1170,7 +1170,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA else
SetFocus(GetDlgItem(hwndDlg, IDC_OK));
- if (!DBGetContactSettingByte(NULL, "SimpleStatusMsg", "WinCentered", 1))
+ if (!db_get_b(NULL, "SimpleStatusMsg", "WinCentered", 1))
{
WINDOWPLACEMENT wp;
int x, y;
@@ -1178,8 +1178,8 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA wp.length = sizeof(wp);
GetWindowPlacement(hwndDlg, &wp);
- x = (int)DBGetContactSettingDword(NULL, "SimpleStatusMsg", "Winx", -1);
- y = (int)DBGetContactSettingDword(NULL, "SimpleStatusMsg", "Winy", -1);
+ x = (int)db_get_dw(NULL, "SimpleStatusMsg", "Winx", -1);
+ y = (int)db_get_dw(NULL, "SimpleStatusMsg", "Winy", -1);
if (x !=- 1)
{
@@ -1238,14 +1238,14 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (msgbox_data->m_szProto)
{
mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", msgbox_data->m_szProto);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", szSetting, "");
+ db_set_s(NULL, "SimpleStatusMsg", szSetting, "");
mir_snprintf(szSetting, SIZEOF(szSetting), "%sMsg", msgbox_data->m_szProto);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, szSetting), _T(""));
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, szSetting), _T(""));
}
else
{
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", "LastMsg", "");
+ db_set_s(NULL, "SimpleStatusMsg", "LastMsg", "");
for (int j = 0; j < accounts->count; j++)
{
if (!IsAccountEnabled(accounts->pa[j]))
@@ -1254,21 +1254,21 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (DBGetContactSettingByte(NULL, accounts->pa[j]->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(NULL, accounts->pa[j]->szModuleName, "LockMainStatus", 0))
continue;
if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", accounts->pa[j]->szModuleName);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", szSetting, "");
+ db_set_s(NULL, "SimpleStatusMsg", szSetting, "");
mir_snprintf(szSetting, SIZEOF(szSetting), "%sMsg", accounts->pa[j]->szModuleName);
iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(accounts->pa[j]->szModuleName) : GetCurrentStatus(accounts->pa[j]->szModuleName);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), _T(""));
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), _T(""));
}
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), _T("")); // for compatibility with some plugins
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), _T("")); // for compatibility with some plugins
}
if (bCurrentStatus)
@@ -1287,7 +1287,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA for (int i = 1; i <= msgbox_data->max_hist_msgs; i++)
{
mir_snprintf(buff, SIZEOF(buff), "SMsg%d", i);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", buff, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv))
{
if (!lstrcmp(dbv.ptszVal, tszMsg))
{
@@ -1295,14 +1295,14 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (msgbox_data->m_szProto)
{
mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", msgbox_data->m_szProto);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", buff2, buff);
+ db_set_s(NULL, "SimpleStatusMsg", buff2, buff);
mir_snprintf(buff2, SIZEOF(buff2), "%sMsg", msgbox_data->m_szProto);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg);
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg);
}
else
{
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", "LastMsg", buff);
+ db_set_s(NULL, "SimpleStatusMsg", "LastMsg", buff);
for (int j = 0; j < accounts->count; j++)
{
if (!IsAccountEnabled(accounts->pa[j]))
@@ -1311,21 +1311,21 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (DBGetContactSettingByte(NULL, accounts->pa[j]->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(NULL, accounts->pa[j]->szModuleName, "LockMainStatus", 0))
continue;
if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", accounts->pa[j]->szModuleName);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", buff2, buff);
+ db_set_s(NULL, "SimpleStatusMsg", buff2, buff);
mir_snprintf(buff2, SIZEOF(buff2), "%sMsg", accounts->pa[j]->szModuleName);
iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(accounts->pa[j]->szModuleName) : GetCurrentStatus(accounts->pa[j]->szModuleName);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg);
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
}
}
@@ -1333,7 +1333,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!found)
{
- int last_modified_msg = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", msgbox_data->max_hist_msgs);
+ int last_modified_msg = db_get_w(NULL, "SimpleStatusMsg", "LMMsg", msgbox_data->max_hist_msgs);
if (last_modified_msg == msgbox_data->max_hist_msgs)
last_modified_msg = 1;
@@ -1341,19 +1341,19 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA last_modified_msg++;
mir_snprintf(buff, SIZEOF(buff), "SMsg%d", last_modified_msg);
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", buff, tszMsg);
+ db_set_ts(NULL, "SimpleStatusMsg", buff, tszMsg);
if (msgbox_data->m_szProto)
{
mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", msgbox_data->m_szProto);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", buff2, buff);
+ db_set_s(NULL, "SimpleStatusMsg", buff2, buff);
mir_snprintf(buff2, SIZEOF(buff2), "%sMsg", msgbox_data->m_szProto);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg);
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg);
}
else
{
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", "LastMsg", buff);
+ db_set_s(NULL, "SimpleStatusMsg", "LastMsg", buff);
for (int j = 0; j < accounts->count; j++)
{
if (!IsAccountEnabled(accounts->pa[j]))
@@ -1362,25 +1362,25 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (DBGetContactSettingByte(NULL, accounts->pa[j]->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(NULL, accounts->pa[j]->szModuleName, "LockMainStatus", 0))
continue;
if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", accounts->pa[j]->szModuleName);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", buff2, buff);
+ db_set_s(NULL, "SimpleStatusMsg", buff2, buff);
mir_snprintf(buff2, SIZEOF(buff2), "%sMsg", accounts->pa[j]->szModuleName);
iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(accounts->pa[j]->szModuleName) : GetCurrentStatus(accounts->pa[j]->szModuleName);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg);
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg);
}
}
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", (WORD)last_modified_msg);
+ db_set_w(NULL, "SimpleStatusMsg", "LMMsg", (WORD)last_modified_msg);
}
if (!msgbox_data->m_szProto)
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), tszMsg); // for compatibility with some plugins
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), tszMsg); // for compatibility with some plugins
if (bCurrentStatus)
SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, ID_STATUS_CURRENT, tszMsg, msgbox_data->m_bOnStartup);
@@ -1526,7 +1526,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA {
char szSetting[16];
mir_snprintf(szSetting, SIZEOF(szSetting), "SMsg%d", (int)HIWORD(histitem.lParam));
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", szSetting, _T(""));
+ db_set_ts(NULL, "SimpleStatusMsg", szSetting, _T(""));
SendMessage(msgbox_data->recent_cbex, CBEM_DELETEITEM, (WPARAM)msgbox_data->curr_sel_msg, 0);
}
if (LOWORD(histitem.lParam) == PREDEFINED_MSG)
@@ -1660,7 +1660,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (LOWORD(histitem.lParam) == HISTORY_MSG)
{
mir_snprintf(buff, SIZEOF(buff), "SMsg%d", (int)HIWORD(histitem.lParam));
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", buff, _T(""));
+ db_set_ts(NULL, "SimpleStatusMsg", buff, _T(""));
}
else if (LOWORD(histitem.lParam) == PREDEFINED_MSG)
{
@@ -1737,8 +1737,8 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA WINDOWPLACEMENT wp;
wp.length = sizeof(wp);
GetWindowPlacement(hwndDlg, &wp);
- DBWriteContactSettingDword(NULL, "SimpleStatusMsg", "Winx", wp.rcNormalPosition.left);
- DBWriteContactSettingDword(NULL, "SimpleStatusMsg", "Winy", wp.rcNormalPosition.top);
+ db_set_dw(NULL, "SimpleStatusMsg", "Winx", wp.rcNormalPosition.left);
+ db_set_dw(NULL, "SimpleStatusMsg", "Winy", wp.rcNormalPosition.top);
if (msgbox_data->m_bPredefChanged)
{
@@ -1761,13 +1761,13 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (LOWORD(cbitem.lParam) == PREDEFINED_MSG)
{
new_num_def_msgs++;
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", buff, text);
+ db_set_ts(NULL, "SimpleStatusMsg", buff, text);
}
else
- DBDeleteContactSetting(NULL, "SimpleStatusMsg", buff);
+ db_unset(NULL, "SimpleStatusMsg", buff);
num_items--;
}
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", (WORD)new_num_def_msgs);
+ db_set_w(NULL, "SimpleStatusMsg", "DefMsgCount", (WORD)new_num_def_msgs);
}
ImageList_Destroy(msgbox_data->status_icons);
diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 4aef49ef2d..e803be5784 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -138,13 +138,13 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETITEMDATA, (WPARAM)index, (LPARAM)i - ID_STATUS_ONLINE);
- val = DBGetContactSettingByte(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
+ val = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
data->status_msg[0].flags[i - ID_STATUS_ONLINE] = val;
- if (DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), &dbv))
+ if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), &dbv))
dbv.ptszVal = mir_tstrdup(GetDefaultMessage(i));
lstrcpy(data->status_msg[0].msg[i - ID_STATUS_ONLINE], dbv.ptszVal);
mir_free(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
for (j = 0; j < accounts->count; j++)
{
@@ -152,14 +152,14 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L continue;
mir_snprintf(setting, SIZEOF(setting), "%sFlags", accounts->pa[j]->szModuleName);
- val = DBGetContactSettingByte(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, setting), STATUS_DEFAULT);
+ val = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, setting), STATUS_DEFAULT);
data->status_msg[j+1].flags[i-ID_STATUS_ONLINE] = val;
mir_snprintf(setting, SIZEOF(setting), "%sDefault", accounts->pa[j]->szModuleName);
- if (DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, setting), &dbv))
+ if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(i, setting), &dbv))
dbv.ptszVal = mir_tstrdup(GetDefaultMessage(i));
lstrcpy(data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE], dbv.ptszVal);
mir_free(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -190,7 +190,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
data->proto_msg[0].msg = NULL;
- val = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ProtoFlags", PROTO_DEFAULT);
+ val = db_get_b(NULL, "SimpleStatusMsg", "ProtoFlags", PROTO_DEFAULT);
data->proto_msg[0].flags = val;
data->proto_msg[0].max_length = 0;
SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, (WPARAM)index, 0);
@@ -211,19 +211,19 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if (index != CB_ERR && index != CB_ERRSPACE)
{
mir_snprintf(setting, SIZEOF(setting), "Proto%sDefault", accounts->pa[i]->szModuleName);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", setting, &dbv))
{
data->proto_msg[i+1].msg = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
data->proto_msg[i+1].msg = NULL;
mir_snprintf(setting, SIZEOF(setting), "Proto%sFlags", accounts->pa[i]->szModuleName);
- val = DBGetContactSettingByte(NULL, "SimpleStatusMsg", setting, PROTO_DEFAULT);
+ val = db_get_b(NULL, "SimpleStatusMsg", setting, PROTO_DEFAULT);
data->proto_msg[i+1].flags = val;
mir_snprintf(setting, SIZEOF(setting), "Proto%sMaxLen", accounts->pa[i]->szModuleName);
- val = DBGetContactSettingWord(NULL, "SimpleStatusMsg", setting, 1024);
+ val = db_get_w(NULL, "SimpleStatusMsg", setting, 1024);
data->proto_msg[i+1].max_length = val;
SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, (WPARAM)index, (LPARAM)i + 1);
}
@@ -242,7 +242,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CBOPTPROTO, CBN_SELCHANGE), (LPARAM)GetDlgItem(hwndDlg, IDC_CBOPTPROTO));
}
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "PutDefInList", 0))
+ if (db_get_b(NULL, "SimpleStatusMsg", "PutDefInList", 0))
CheckDlgButton(hwndDlg, IDC_COPTMSG2, BST_CHECKED);
if (ServiceExists(MS_VARS_FORMATSTRING))
@@ -464,19 +464,19 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L mir_snprintf(setting, SIZEOF(setting), "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv))
{
if (dbv.pszVal)
{
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
if ((dbv2.ptszVal) && (lstrlen(dbv2.ptszVal)))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
@@ -507,10 +507,10 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L else
mir_snprintf(setting, SIZEOF(setting), "Msg");
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
+ if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
@@ -619,18 +619,18 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L mir_snprintf(setting, SIZEOF(setting), "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv))
{
if (dbv.pszVal)
{
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
@@ -661,10 +661,10 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L else
mir_snprintf(setting, SIZEOF(setting), "Msg");
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
+ if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
@@ -719,18 +719,18 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L mir_snprintf(setting, SIZEOF(setting), "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv))
{
if (dbv.pszVal)
{
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
@@ -753,10 +753,10 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L else
mir_snprintf(setting, SIZEOF(setting), "Msg");
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting), &dbv))
+ if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting), &dbv))
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
@@ -833,18 +833,18 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L mir_snprintf(setting, SIZEOF(setting), "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv))
{
if (dbv.pszVal)
{
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
@@ -867,10 +867,10 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L else
mir_snprintf(setting, SIZEOF(setting), "Msg");
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i+ID_STATUS_ONLINE, setting), &dbv))
+ if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(i+ID_STATUS_ONLINE, setting), &dbv))
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
@@ -1032,8 +1032,8 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (accounts->statusMsgFlags & Proto_Status2Flag(i))
{
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
+ db_set_b(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
for (int j = 0; j < accounts->count; j++)
{
@@ -1046,20 +1046,20 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if (CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
{
mir_snprintf(szSetting, SIZEOF(szSetting), "%sDefault", accounts->pa[j]->szModuleName);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", accounts->pa[j]->szModuleName);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
+ db_set_b(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
}
}
}
}
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
if (data->proto_ok)
{
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ProtoFlags", (BYTE)data->proto_msg[0].flags);
+ db_set_b(NULL, "SimpleStatusMsg", "ProtoFlags", (BYTE)data->proto_msg[0].flags);
for (i = 0; i < accounts->count; i++)
{
@@ -1074,15 +1074,15 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", accounts->pa[i]->szModuleName);
if (data->proto_msg[i+1].msg && (data->proto_msg[i+1].flags & PROTO_THIS_MSG))
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", szSetting, data->proto_msg[i+1].msg);
+ db_set_ts(NULL, "SimpleStatusMsg", szSetting, data->proto_msg[i+1].msg);
// else
- // DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
+ // db_unset(NULL, "SimpleStatusMsg", szSetting);
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->proto_msg[i+1].max_length);
+ db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)data->proto_msg[i+1].max_length);
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", accounts->pa[i]->szModuleName);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", szSetting, (BYTE)data->proto_msg[i+1].flags);
+ db_set_b(NULL, "SimpleStatusMsg", szSetting, (BYTE)data->proto_msg[i+1].flags);
}
}
RebuildStatusMenu();
@@ -1116,17 +1116,17 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ESECUPDTMSG), 0);
SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETRANGE32, 1, 999);
- SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)DBGetContactSettingWord(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10), 0));
+ SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)db_get_w(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10), 0));
SendDlgItemMessage(hwndDlg, IDC_ESECUPDTMSG, EM_LIMITTEXT, 3, 0);
- CheckDlgButton(hwndDlg, IDC_CUPDATEMSG, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CNOIDLE, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CNOICQREQ, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLEAVEWINAMP, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CUPDATEMSG, db_get_b(NULL, "SimpleStatusMsg", "UpdateMsgOn", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CNOIDLE, db_get_b(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CNOICQREQ, db_get_b(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLEAVEWINAMP, db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1) ? BST_CHECKED : BST_UNCHECKED);
if (ServiceExists(MS_VARS_FORMATSTRING))
{
- CheckDlgButton(hwndDlg, IDC_CVARIABLES, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "EnableVariables", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CDATEPARSING, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ExclDateToken", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CVARIABLES, db_get_b(NULL, "SimpleStatusMsg", "EnableVariables", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CDATEPARSING, db_get_b(NULL, "SimpleStatusMsg", "ExclDateToken", 0) ? BST_CHECKED : BST_UNCHECKED);
}
else
{
@@ -1179,25 +1179,25 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM KillTimer(NULL, g_uUpdateMsgTimer);
int val = SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_GETPOS, 0, 0);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "UpdateMsgInt", (WORD)val);
+ db_set_w(NULL, "SimpleStatusMsg", "UpdateMsgInt", (WORD)val);
if (IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED && val)
{
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)1);
+ db_set_b(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)1);
g_uUpdateMsgTimer = SetTimer(NULL, 0, val * 1000, (TIMERPROC)UpdateMsgTimerProc);
}
else
{
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)0);
+ db_set_b(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)0);
}
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
if (ServiceExists(MS_VARS_FORMATSTRING))
{
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
}
return TRUE;
}
@@ -1210,19 +1210,19 @@ static BOOL IsHistoryMsgsFound(HWND hwndDlg, int histMax) {
char szSetting[16];
DBVARIANT dbv;
- int j = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", 1);
+ int j = db_get_w(NULL, "SimpleStatusMsg", "LMMsg", 1);
for (int i = 1; i <= histMax; ++i, --j)
{
if (j < 1) j = histMax;
mir_snprintf(szSetting, SIZEOF(szSetting), "SMsg%d", j);
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", szSetting, &dbv))
+ if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
if (dbv.ptszVal != NULL && *dbv.ptszVal != '\0')
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return TRUE;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return FALSE;
@@ -1248,7 +1248,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_SETITEMDATA, (WPARAM)i_btndownflat, DLG_SHOW_BUTTONS_FLAT);
SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_SETITEMDATA, (WPARAM)i_btnlist, DLG_SHOW_BUTTONS_INLIST);
- settingValue = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "DlgFlags", DLG_SHOW_DEFAULT);
+ settingValue = db_get_b(NULL, "SimpleStatusMsg", "DlgFlags", DLG_SHOW_DEFAULT);
CheckDlgButton(hwndDlg, IDC_CSTATUSLIST, settingValue & DLG_SHOW_STATUS ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CPROFILES, settingValue & DLG_SHOW_STATUS_PROFILES ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CICONS1, settingValue & DLG_SHOW_STATUS_ICONS ? BST_CHECKED : BST_UNCHECKED);
@@ -1279,7 +1279,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w }
// Misc.
- settingValue = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", 10);
+ settingValue = db_get_b(NULL, "SimpleStatusMsg", "MaxHist", 10);
SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_EMAXHIST), 0);
SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETRANGE32, 0, 25);
@@ -1290,19 +1290,19 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS2), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), IsHistoryMsgsFound(hwndDlg, settingValue));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), DBGetContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0) != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), db_get_w(NULL, "SimpleStatusMsg", "DefMsgCount", 0) != 0);
SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ETIMEOUT), 0);
SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETRANGE32, 1, 60);
- SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)DBGetContactSettingByte(NULL, "SimpleStatusMsg", "DlgTime", 5), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)db_get_b(NULL, "SimpleStatusMsg", "DlgTime", 5), 0));
SendDlgItemMessage(hwndDlg, IDC_ETIMEOUT, EM_LIMITTEXT, 2, 0);
- CheckDlgButton(hwndDlg, IDC_CCLOSEWND, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "AutoClose", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CRPOSWND, !DBGetContactSettingByte(NULL, "SimpleStatusMsg", "WinCentered", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CREMOVECR, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "RemoveCR", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CSHOWCOPY, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ShowCopy", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CSHOWGURL, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ShowGoToURL", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CSHOWSMSG, DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CCLOSEWND, db_get_b(NULL, "SimpleStatusMsg", "AutoClose", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CRPOSWND, !db_get_b(NULL, "SimpleStatusMsg", "WinCentered", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CREMOVECR, db_get_b(NULL, "SimpleStatusMsg", "RemoveCR", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CSHOWCOPY, db_get_b(NULL, "SimpleStatusMsg", "ShowCopy", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CSHOWGURL, db_get_b(NULL, "SimpleStatusMsg", "ShowGoToURL", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CSHOWSMSG, db_get_b(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", 1) ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, WM_USER + 2, 0, 0);
return TRUE;
@@ -1364,13 +1364,13 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
- max_hist_msgs = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", 10);
+ max_hist_msgs = db_get_b(NULL, "SimpleStatusMsg", "MaxHist", 10);
for (i = 1; i <= max_hist_msgs; i++)
{
mir_snprintf(text, SIZEOF(text), "SMsg%d", i);
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", text, _T(""));
+ db_set_ts(NULL, "SimpleStatusMsg", text, _T(""));
}
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", "LastMsg", "");
+ db_set_s(NULL, "SimpleStatusMsg", "LastMsg", "");
for (i = 0; i < accounts->count; i++)
{
if (!IsAccountEnabled(accounts->pa[i]))
@@ -1383,9 +1383,9 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w continue;
mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i]->szModuleName);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", setting, "");
+ db_set_s(NULL, "SimpleStatusMsg", setting, "");
}
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", (WORD)max_hist_msgs);
+ db_set_w(NULL, "SimpleStatusMsg", "LMMsg", (WORD)max_hist_msgs);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), FALSE);
}
return 0;
@@ -1398,13 +1398,13 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
- nDefMSgCount = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
+ nDefMSgCount = db_get_w(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
for (int i = 1; i <= nDefMSgCount; i++)
{
mir_snprintf(szSetting, SIZEOF(szSetting), "DefMsg%d", i);
- DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
+ db_unset(NULL, "SimpleStatusMsg", szSetting);
}
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
+ db_set_w(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), FALSE);
}
return 0;
@@ -1427,17 +1427,17 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (curSel != CB_ERR)
flags |= SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETITEMDATA, (WPARAM)curSel, 0);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgFlags", (BYTE)flags);
+ db_set_b(NULL, "SimpleStatusMsg", "DlgFlags", (BYTE)flags);
// Misc.
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowCopy", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWCOPY) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowGoToURL", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWGURL) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE));
+ db_set_b(NULL, "SimpleStatusMsg", "AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE));
+ db_set_b(NULL, "SimpleStatusMsg", "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "ShowCopy", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWCOPY) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "ShowGoToURL", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWGURL) == BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
RebuildStatusMenu();
return TRUE;
@@ -1480,22 +1480,22 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa {
char setting[80];
mir_snprintf(setting, SIZEOF(setting), "Startup%sStatus", accounts->pa[i]->szModuleName);
- data->status[i] = DBGetContactSettingWord(NULL, "SimpleStatusMsg", setting, ID_STATUS_OFFLINE);
+ data->status[i] = db_get_w(NULL, "SimpleStatusMsg", setting, ID_STATUS_OFFLINE);
mir_snprintf(setting, SIZEOF(setting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
- data->setdelay[i] = DBGetContactSettingWord(NULL, "SimpleStatusMsg", setting, 300);
+ data->setdelay[i] = db_get_w(NULL, "SimpleStatusMsg", setting, 300);
SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
}
}
SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_SETCURSEL, 0, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LISTPROTO, LBN_SELCHANGE), (LPARAM)GetDlgItem(hwndDlg, IDC_LISTPROTO));
- data->setglobaldelay = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "SetStatusDelay", 300);
+ data->setglobaldelay = db_get_w(NULL, "SimpleStatusMsg", "SetStatusDelay", 300);
SendMessage(GetDlgItem(hwndDlg, IDC_SSETSTATUS), UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ESETSTATUS), 0);
SendMessage(GetDlgItem(hwndDlg, IDC_SSETSTATUS), UDM_SETRANGE32, 0, 9000);
SendMessage(GetDlgItem(hwndDlg, IDC_ESETSTATUS), EM_LIMITTEXT, 4, 0);
- if (!DBGetContactSettingByte(NULL, "SimpleStatusMsg", "GlobalStatusDelay", 1))
+ if (!db_get_b(NULL, "SimpleStatusMsg", "GlobalStatusDelay", 1))
{
CheckDlgButton(hwndDlg, IDC_SPECSET, BST_CHECKED);
i = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
@@ -1507,7 +1507,7 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
}
- if (DBGetContactSettingByte(NULL, "SimpleStatusMsg", "StartupPopupDlg", 1))
+ if (db_get_b(NULL, "SimpleStatusMsg", "StartupPopupDlg", 1))
{
CheckDlgButton(hwndDlg, IDC_POPUPDLG, BST_CHECKED);
if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED)
@@ -1662,14 +1662,14 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa continue;
mir_snprintf(szSetting, SIZEOF(szSetting), "Startup%sStatus", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->status[i]);
+ db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)data->status[i]);
mir_snprintf(szSetting, SIZEOF(szSetting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->setdelay[i]);
+ db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)data->setdelay[i]);
}
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "SetStatusDelay", (WORD)data->setglobaldelay);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
+ db_set_w(NULL, "SimpleStatusMsg", "SetStatusDelay", (WORD)data->setglobaldelay);
+ db_set_b(NULL, "SimpleStatusMsg", "GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
+ db_set_b(NULL, "SimpleStatusMsg", "StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
return TRUE;
}
break;
diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp index d730f03caa..eef790fc8a 100644 --- a/plugins/SimpleStatusMsg/src/utils.cpp +++ b/plugins/SimpleStatusMsg/src/utils.cpp @@ -137,7 +137,7 @@ int GetCurrentStatus(const char *szProto) {
char szSetting[80];
mir_snprintf(szSetting, SIZEOF(szSetting), "Cur%sStatus", szProto);
- return (int)DBGetContactSettingWord(NULL, "SimpleStatusMsg", szSetting, ID_STATUS_OFFLINE);
+ return (int)db_get_w(NULL, "SimpleStatusMsg", szSetting, ID_STATUS_OFFLINE);
}
return CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
@@ -151,14 +151,14 @@ int GetStartupStatus(const char *szProto) char szSetting[80];
mir_snprintf(szSetting, SIZEOF(szSetting), "Startup%sStatus", szProto);
- status_mode = DBGetContactSettingWord(NULL, "SimpleStatusMsg", szSetting, ID_STATUS_OFFLINE);
+ status_mode = db_get_w(NULL, "SimpleStatusMsg", szSetting, ID_STATUS_OFFLINE);
if (status_mode == ID_STATUS_CURRENT)
{
// load status used for this proto last time
mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sStatus", szProto);
- status_mode = DBGetContactSettingWord(NULL, "SimpleStatusMsg", szSetting, ID_STATUS_OFFLINE);
+ status_mode = db_get_w(NULL, "SimpleStatusMsg", szSetting, ID_STATUS_OFFLINE);
}
return status_mode;
}
- return (int)DBGetContactSettingWord(NULL, "SimpleStatusMsg", "StartupStatus", ID_STATUS_OFFLINE);
+ return (int)db_get_w(NULL, "SimpleStatusMsg", "StartupStatus", ID_STATUS_OFFLINE);
}
diff --git a/plugins/SmileyAdd/src/general.h b/plugins/SmileyAdd/src/general.h index 182d2007c3..cb268cdfc7 100644 --- a/plugins/SmileyAdd/src/general.h +++ b/plugins/SmileyAdd/src/general.h @@ -90,7 +90,8 @@ typedef WCMatcher _TMatcher; extern HINSTANCE g_hInst;
extern char* metaProtoName;
extern HANDLE hNetlibUser;
-extern HANDLE hEvent1, hContactMenuItem;
+extern HANDLE hEvent1;
+extern HGENMENU hContactMenuItem;
extern SmileyCategoryListType g_SmileyCategories;
extern SmileyPackListType g_SmileyPacks;
extern LIST<void> menuHandleArray;
diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index b578227c0d..795760164f 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -21,7 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //globals
HINSTANCE g_hInst;
-HANDLE hEvent1, hContactMenuItem;
+HANDLE hEvent1;
+HGENMENU hContactMenuItem;
char* metaProtoName;
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index e6915189e6..191bb92c58 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -644,7 +644,7 @@ void OptionsType::ReadPackFileName(bkstring& filename, const bkstring& name, con void OptionsType::WritePackFileName(const bkstring& filename, const bkstring& name)
{
bkstring settingKey = name + _T("-filename");
- DBWriteContactSettingTString(NULL, "SmileyAdd", T2A_SM(settingKey.c_str()),
+ db_set_ts(NULL, "SmileyAdd", T2A_SM(settingKey.c_str()),
filename.c_str());
}
@@ -665,9 +665,9 @@ void OptionsType::ReadCustomCategories(bkstring& cats) void OptionsType::WriteCustomCategories(const bkstring& cats)
{
if (cats.empty())
- DBDeleteContactSetting(NULL, "SmileyAdd", "CustomCategories");
+ db_unset(NULL, "SmileyAdd", "CustomCategories");
else
- DBWriteContactSettingTString(NULL, "SmileyAdd", "CustomCategories", cats.c_str());
+ db_set_ts(NULL, "SmileyAdd", "CustomCategories", cats.c_str());
}
@@ -687,7 +687,7 @@ void OptionsType::ReadContactCategory(HANDLE hContact, bkstring& cats) void OptionsType::WriteContactCategory(HANDLE hContact, const bkstring& cats)
{
if (cats.empty())
- DBDeleteContactSetting(hContact, "SmileyAdd", "CustomCategory");
+ db_unset(hContact, "SmileyAdd", "CustomCategory");
else
- DBWriteContactSettingTString(hContact, "SmileyAdd", "CustomCategory", cats.c_str());
+ db_set_ts(hContact, "SmileyAdd", "CustomCategory", cats.c_str());
}
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 64b8c71d06..30717b81c1 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -392,9 +392,6 @@ INT_PTR CustomCatMenu(WPARAM wParam, LPARAM lParam) int RebuildContactMenu(WPARAM wParam, LPARAM)
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB;
-
SmileyCategoryListType::SmileyCategoryVectorType& smc = *g_SmileyCategories.GetSmileyCategoryList();
char* protnam = GetContactProto((HANDLE)wParam);
@@ -406,9 +403,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) haveMenu = cnt != 0;
}
- if (!haveMenu) mi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hContactMenuItem, haveMenu);
for (int i=0; i < menuHandleArray.getCount(); i++)
CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)menuHandleArray[i], 0);
@@ -418,9 +413,10 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) bkstring cat;
opt.ReadContactCategory((HANDLE)wParam, cat);
- mi.pszPopupName = (char*)hContactMenuItem;
- mi.flags = CMIF_CHILDPOPUP | CMIM_FLAGS | CMIF_TCHAR;
- mi.pszService = MS_SMILEYADD_CUSTOMCATMENU;
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.hParentMenu = hContactMenuItem;
+ mi.flags = CMIF_CHILDPOPUP | CMIM_FLAGS | CMIF_TCHAR;
+ mi.pszService = MS_SMILEYADD_CUSTOMCATMENU;
bool nonecheck = true;
HGENMENU hMenu;
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp index aeb03b4b86..374892b060 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -804,7 +804,7 @@ void GetDictsInfo(LIST<Dictionary> &dicts) {
lstrcpyn(dict->localized_name, dbv.ptszVal, SIZEOF(dict->localized_name));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (dict->localized_name[0] == _T('\0'))
diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 844ec42390..dd574537da 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -98,7 +98,7 @@ void LoadOptions() DBVARIANT dbv;
if (!db_get_ts(NULL, MODULE_NAME, "DefaultLanguage", &dbv)) {
lstrcpyn(opts.default_language, dbv.ptszVal, SIZEOF(opts.default_language));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
int i;
@@ -215,7 +215,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP int sel = SendDlgItemMessage(hwndDlg, IDC_DEF_LANG, CB_GETCURSEL, 0, 0);
if (sel >= languages.getCount())
sel = 0;
- DBWriteContactSettingTString(NULL, MODULE_NAME, "DefaultLanguage",
+ db_set_ts(NULL, MODULE_NAME, "DefaultLanguage",
(TCHAR *) languages[sel]->language);
lstrcpy(opts.default_language, languages[sel]->language);
}
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 55abea5848..06a82da925 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -529,7 +529,7 @@ LRESULT CALLBACK OwnerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) void ToggleEnabled(Dialog *dlg) { dlg->enabled = !dlg->enabled; - DBWriteContactSettingByte(dlg->hContact, MODULE_NAME, dlg->name, dlg->enabled); + db_set_b(dlg->hContact, MODULE_NAME, dlg->name, dlg->enabled); if (!dlg->enabled) SetNoUnderline(dlg); @@ -750,7 +750,7 @@ void GetUserProtoLanguageSetting(Dialog *dlg, HANDLE hContact, char *group, char } if (!rc) - DBFreeVariant(&dbv); + db_free(&dbv); } void GetUserLanguageSetting(Dialog *dlg, char *setting) @@ -796,18 +796,18 @@ void GetContactLanguage(Dialog *dlg) if (dlg->hContact == NULL) { if ( !db_get_ts(NULL, MODULE_NAME, dlg->name, &dbv)) { lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); - DBFreeVariant(&dbv); + db_free(&dbv); } } else { if (!db_get_ts(dlg->hContact, MODULE_NAME, "TalkLanguage", &dbv)) { lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); - DBFreeVariant(&dbv); + db_free(&dbv); } if (dlg->lang_name[0] == _T('\0') && !db_get_ts(dlg->hContact, "eSpeak", "TalkLanguage", &dbv)) { lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); - DBFreeVariant(&dbv); + db_free(&dbv); } // Try from metacontact @@ -818,12 +818,12 @@ void GetContactLanguage(Dialog *dlg) if (hMetaContact != NULL) { if (!db_get_ts(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) { lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); - DBFreeVariant(&dbv); + db_free(&dbv); } if (dlg->lang_name[0] == _T('\0') && !db_get_ts(hMetaContact, "eSpeak", "TalkLanguage", &dbv)) { lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); - DBFreeVariant(&dbv); + db_free(&dbv); } } } @@ -924,7 +924,7 @@ int AddContactTextBox(HANDLE hContact, HWND hwnd, char *name, BOOL srmm, HWND hw dlg->hContact = hContact; dlg->hwnd = hwnd; strncpy(dlg->name, name, sizeof(dlg->name)); - dlg->enabled = DBGetContactSettingByte(dlg->hContact, MODULE_NAME, dlg->name, 1); + dlg->enabled = db_get_b(dlg->hContact, MODULE_NAME, dlg->name, 1); dlg->srmm = srmm; GetContactLanguage(dlg); @@ -1250,10 +1250,10 @@ BOOL HandleMenuSelection(Dialog *dlg, POINT pt, unsigned selection) SetNoUnderline(dlg); if (dlg->hContact == NULL) - DBWriteContactSettingTString(NULL, MODULE_NAME, dlg->name, + db_set_ts(NULL, MODULE_NAME, dlg->name, languages[selection - LANGUAGE_MENU_ID_BASE]->language); else - DBWriteContactSettingTString(dlg->hContact, MODULE_NAME, "TalkLanguage", + db_set_ts(dlg->hContact, MODULE_NAME, "TalkLanguage", languages[selection - LANGUAGE_MENU_ID_BASE]->language); GetContactLanguage(dlg); diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 96054f39f6..4ae218f6b4 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -94,8 +94,8 @@ void SplashMain() {
if (options.runonce)
{
- DBWriteContactSettingByte(NULL, MODNAME, "Active", 0);
- DBWriteContactSettingByte(NULL, MODNAME, "DisableAfterStartup", 0);
+ db_set_b(NULL, MODNAME, "Active", 0);
+ db_set_b(NULL, MODNAME, "DisableAfterStartup", 0);
}
if (hUserDll == NULL)
@@ -133,21 +133,21 @@ void SplashMain() //for 9x "alfa" testing
DBVARIANT dbv = {0};
- DBGetContactSettingTString(NULL, MODNAME, "VersionPrefix", &dbv);
+ db_get_ts(NULL, MODNAME, "VersionPrefix", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
_tcscpy_s(szPrefix, _T(""));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcscpy_s(szPrefix, dbv.ptszVal);
dbv.ptszVal = NULL;
- DBGetContactSettingTString(NULL, MODNAME, "Path", &dbv);
+ db_get_ts(NULL, MODNAME, "Path", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
_tcscpy_s(inBuf, _T("splash\\splash.png"));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcscpy_s(inBuf, dbv.ptszVal);
@@ -164,11 +164,11 @@ void SplashMain() else
_tcscpy_s(szSplashFile, inBuf);
- DBGetContactSettingTString(NULL, MODNAME, "Sound", &dbv);
+ db_get_ts(NULL, MODNAME, "Sound", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
_tcscpy_s(inBuf, _T("sounds\\startup.wav"));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcscpy_s(inBuf, dbv.ptszVal);
@@ -282,7 +282,7 @@ int PlugDisableHook(WPARAM wParam, LPARAM lParam) {
if (!lstrcmp(tszModule, _T("Skin")) & !lstrcmp(tszSetting, _T("UseSound")))
{
- DBWriteContactSettingByte(NULL, MODNAME, "PlaySound", cws->value.bVal);
+ db_set_b(NULL, MODNAME, "PlaySound", cws->value.bVal);
#ifdef _DEBUG
cws->value.bVal ? _DebugPopup(NULL, _T("Sounds enabled."), _T("")) : _DebugPopup(NULL, _T("Sounds disabled."), _T(""));
logMessage(_T("Module"), tszModule);
@@ -292,7 +292,7 @@ int PlugDisableHook(WPARAM wParam, LPARAM lParam) }
if (!lstrcmp(tszModule, _T("PluginDisable")) & (!lstrcmp(tszSetting, szDllName)))
{
- DBWriteContactSettingByte(NULL, MODNAME, "Active", cws->value.bVal);
+ db_set_b(NULL, MODNAME, "Active", cws->value.bVal);
#ifdef _DEBUG
cws->value.bVal ? _DebugPopup(NULL, _T("Disabled."), "") : _DebugPopup(NULL, _T("Enabled."), _T(""));
logMessage(_T("PlugDisableHook"), _T("Triggered"));
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index 8c0248985b..128b0d4856 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -24,17 +24,17 @@ TCHAR szPath2Spash [MAX_PATH], szSoundFilePath[MAX_PATH]; // Reads values from db
void ReadIniConfig()
{
- options.active = DBGetContactSettingByte(NULL, MODNAME, "Active", 1);
- options.playsnd = DBGetContactSettingByte(NULL, MODNAME, "PlaySound", 0);
- options.fadein = DBGetContactSettingByte(NULL, MODNAME, "FadeIn", 1);
- options.fadeout = DBGetContactSettingByte(NULL, MODNAME, "FadeOut", 1);
- options.showtime = DBGetContactSettingDword(NULL, MODNAME, "TimeToShow", 2000);
- options.fisteps = DBGetContactSettingDword(NULL, MODNAME, "FadeinSpeed", 5);
- options.fosteps = DBGetContactSettingDword(NULL, MODNAME, "FadeoutSpeed", 5);
- options.inheritGS = DBGetContactSettingByte(NULL, MODNAME, "InheritGlobalSound", 1);
- options.showversion = DBGetContactSettingByte(NULL, MODNAME, "ShowVersion", 0);
- options.random = DBGetContactSettingByte(NULL, MODNAME, "Random", 0);
- options.runonce = DBGetContactSettingByte(NULL, MODNAME, "DisableAfterStartup", 0);
+ options.active = db_get_b(NULL, MODNAME, "Active", 1);
+ options.playsnd = db_get_b(NULL, MODNAME, "PlaySound", 0);
+ options.fadein = db_get_b(NULL, MODNAME, "FadeIn", 1);
+ options.fadeout = db_get_b(NULL, MODNAME, "FadeOut", 1);
+ options.showtime = db_get_dw(NULL, MODNAME, "TimeToShow", 2000);
+ options.fisteps = db_get_dw(NULL, MODNAME, "FadeinSpeed", 5);
+ options.fosteps = db_get_dw(NULL, MODNAME, "FadeoutSpeed", 5);
+ options.inheritGS = db_get_b(NULL, MODNAME, "InheritGlobalSound", 1);
+ options.showversion = db_get_b(NULL, MODNAME, "ShowVersion", 0);
+ options.random = db_get_b(NULL, MODNAME, "Random", 0);
+ options.runonce = db_get_b(NULL, MODNAME, "DisableAfterStartup", 0);
}
BOOL Exists(LPCTSTR strName)
@@ -60,31 +60,31 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ReadIniConfig();
TCHAR inBuf[80];
DBVARIANT dbv = {0};
- DBGetContactSettingTString(NULL, MODNAME, "Path", &dbv);
+ db_get_ts(NULL, MODNAME, "Path", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
_tcscpy_s(inBuf, _T("splash\\splash.png"));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcscpy_s(inBuf, dbv.ptszVal);
dbv.ptszVal = NULL;
SetWindowText(GetDlgItem(hwndDlg, IDC_SPLASHPATH),inBuf);
- DBGetContactSettingTString(NULL, MODNAME, "Sound", &dbv);
+ db_get_ts(NULL, MODNAME, "Sound", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
_tcscpy_s(inBuf, _T("sounds\\startup.wav"));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcscpy_s(inBuf, dbv.ptszVal);
dbv.ptszVal = NULL;
SetWindowText(GetDlgItem(hwndDlg, IDC_SNDPATH),inBuf);
- DBGetContactSettingTString(NULL, MODNAME, "VersionPrefix", &dbv);
+ db_get_ts(NULL, MODNAME, "VersionPrefix", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
_tcscpy_s(inBuf, _T(""));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcscpy_s(inBuf, dbv.ptszVal);
@@ -301,58 +301,58 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR tmp[MAX_PATH];
GetWindowText(GetDlgItem(hwndDlg, IDC_SPLASHPATH), tmp, MAX_PATH);
- DBWriteContactSettingTString(NULL, MODNAME, "Path", tmp);
+ db_set_ts(NULL, MODNAME, "Path", tmp);
GetWindowText(GetDlgItem(hwndDlg, IDC_SNDPATH), tmp, MAX_PATH);
- DBWriteContactSettingTString(NULL, MODNAME, "Sound", tmp);
+ db_set_ts(NULL, MODNAME, "Sound", tmp);
GetWindowText(GetDlgItem(hwndDlg, IDC_VERSIONPREFIX), tmp, MAX_PATH);
- DBWriteContactSettingTString(NULL, MODNAME, "VersionPrefix", tmp);
+ db_set_ts(NULL, MODNAME, "VersionPrefix", tmp);
_tcscpy_s(szPrefix, tmp);
GetWindowText(GetDlgItem(hwndDlg, IDC_SHOWTIME), tmp, MAX_PATH);
- DBWriteContactSettingDword(NULL, MODNAME, "TimeToShow", _ttoi(tmp));
+ db_set_dw(NULL, MODNAME, "TimeToShow", _ttoi(tmp));
options.showtime = _ttoi(tmp);
GetWindowText(GetDlgItem(hwndDlg, IDC_FISTEP), tmp, MAX_PATH);
- DBWriteContactSettingDword(NULL, MODNAME, "FadeinSpeed", _ttoi(tmp));
+ db_set_dw(NULL, MODNAME, "FadeinSpeed", _ttoi(tmp));
options.fisteps = _ttoi(tmp);
GetWindowText(GetDlgItem(hwndDlg, IDC_FOSTEP), tmp, MAX_PATH);
- DBWriteContactSettingDword(NULL, MODNAME, "FadeoutSpeed", _ttoi(tmp));
+ db_set_dw(NULL, MODNAME, "FadeoutSpeed", _ttoi(tmp));
options.fosteps = _ttoi(tmp);
if (IsDlgButtonChecked(hwndDlg, IDC_ACTIVE))
{
- DBWriteContactSettingByte(NULL, MODNAME, "Active", 1);
+ db_set_b(NULL, MODNAME, "Active", 1);
options.active = 1;
}
else
{
- DBWriteContactSettingByte(NULL, MODNAME, "Active", 0);
+ db_set_b(NULL, MODNAME, "Active", 0);
options.active = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND))
{
- DBWriteContactSettingByte(NULL, MODNAME, "PlaySound", 1);
+ db_set_b(NULL, MODNAME, "PlaySound", 1);
options.playsnd = 1;
- DBWriteContactSettingByte(NULL, MODNAME, "InheritGlobalSound", 1);
+ db_set_b(NULL, MODNAME, "InheritGlobalSound", 1);
options.inheritGS = 1;
}
else
{
- DBWriteContactSettingByte(NULL, MODNAME, "PlaySound", 0);
+ db_set_b(NULL, MODNAME, "PlaySound", 0);
options.playsnd = 0;
- DBWriteContactSettingByte(NULL, MODNAME, "InheritGlobalSound", 0);
+ db_set_b(NULL, MODNAME, "InheritGlobalSound", 0);
options.inheritGS = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND) == BST_INDETERMINATE)
{
- DBWriteContactSettingByte(NULL, MODNAME, "PlaySound", 1);
+ db_set_b(NULL, MODNAME, "PlaySound", 1);
options.playsnd = 1;
- DBWriteContactSettingByte(NULL, MODNAME, "InheritGlobalSound", 0);
+ db_set_b(NULL, MODNAME, "InheritGlobalSound", 0);
options.inheritGS = 0;
}
@@ -371,42 +371,42 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (IsDlgButtonChecked(hwndDlg, IDC_FADEIN))
{
- DBWriteContactSettingByte(NULL, MODNAME, "FadeIn", 1);
+ db_set_b(NULL, MODNAME, "FadeIn", 1);
options.fadein = 1;
}
else
{
- DBWriteContactSettingByte(NULL, MODNAME, "FadeIn", 0);
+ db_set_b(NULL, MODNAME, "FadeIn", 0);
options.fadein = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_FADEOUT))
{
- DBWriteContactSettingByte(NULL, MODNAME, "FadeOut", 1);
+ db_set_b(NULL, MODNAME, "FadeOut", 1);
options.fadeout = 1;
}
else
{
- DBWriteContactSettingByte(NULL, MODNAME, "FadeOut", 0);
+ db_set_b(NULL, MODNAME, "FadeOut", 0);
options.fadeout = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_RANDOM))
{
- DBWriteContactSettingByte(NULL, MODNAME, "Random", 1);
+ db_set_b(NULL, MODNAME, "Random", 1);
options.random = 1;
}
else
{
- DBWriteContactSettingByte(NULL, MODNAME, "Random", 0);
+ db_set_b(NULL, MODNAME, "Random", 0);
options.random = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWVERSION))
{
- DBWriteContactSettingByte(NULL, MODNAME, "ShowVersion", 1);
+ db_set_b(NULL, MODNAME, "ShowVersion", 1);
options.showversion = 1;
}
else
{
- DBWriteContactSettingByte(NULL, MODNAME, "ShowVersion", 0);
+ db_set_b(NULL, MODNAME, "ShowVersion", 0);
options.showversion = 0;
}
return TRUE;
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index b40e45960f..6e53e477f3 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -129,16 +129,16 @@ void LoadOptions( OBJLIST<TAAAProtoSetting>& loadSettings, BOOL override) if (hAutoAwayTimer != 0)
KillTimer(NULL, hAutoAwayTimer);
- ignoreLockKeys = DBGetContactSettingByte(NULL, MODULENAME, SETTING_IGNLOCK, FALSE);
- ignoreSysKeys = DBGetContactSettingByte(NULL, MODULENAME, SETTING_IGNSYSKEYS, FALSE);
- ignoreAltCombo = DBGetContactSettingByte(NULL, MODULENAME, SETTING_IGNALTCOMBO, FALSE);
- monitorMouse = DBGetContactSettingByte(NULL, MODULENAME, SETTING_MONITORMOUSE, TRUE);
- monitorKeyboard = DBGetContactSettingByte(NULL, MODULENAME, SETTING_MONITORKEYBOARD, TRUE);
+ ignoreLockKeys = db_get_b(NULL, MODULENAME, SETTING_IGNLOCK, FALSE);
+ ignoreSysKeys = db_get_b(NULL, MODULENAME, SETTING_IGNSYSKEYS, FALSE);
+ ignoreAltCombo = db_get_b(NULL, MODULENAME, SETTING_IGNALTCOMBO, FALSE);
+ monitorMouse = db_get_b(NULL, MODULENAME, SETTING_MONITORMOUSE, TRUE);
+ monitorKeyboard = db_get_b(NULL, MODULENAME, SETTING_MONITORKEYBOARD, TRUE);
lastInput = lastMirandaInput = GetTickCount();
for ( int i=0; i < loadSettings.getCount(); i++ ) {
char* protoName;
- if ((DBGetContactSettingByte(NULL, MODULENAME, SETTING_SAMESETTINGS, 0)) && !override)
+ if ((db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, 0)) && !override)
protoName = SETTING_ALL;
else
protoName = loadSettings[i].szName;
@@ -150,34 +150,34 @@ void LoadOptions( OBJLIST<TAAAProtoSetting>& loadSettings, BOOL override) monitorAll = TRUE;
} }
- if (DBGetContactSettingByte(NULL, "Idle", "AAEnable", 0))
+ if (db_get_b(NULL, "Idle", "AAEnable", 0))
return;
HookWindowsHooks(monitorMiranda, monitorAll);
- hAutoAwayTimer = SetTimer(NULL,0, DBGetContactSettingWord(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5)*1000,AutoAwayTimer);
+ hAutoAwayTimer = SetTimer(NULL,0, db_get_w(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5)*1000,AutoAwayTimer);
}
int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName)
{
char setting[128];
_snprintf(setting, sizeof(setting), "%s_OptionFlags", protoName);
- autoAwaySetting.optionFlags = DBGetContactSettingByte(NULL,MODULENAME,setting,FLAG_LV2ONINACTIVE|FLAG_RESET);
+ autoAwaySetting.optionFlags = db_get_b(NULL,MODULENAME,setting,FLAG_LV2ONINACTIVE|FLAG_RESET);
_snprintf(setting, sizeof(setting), "%s_AwayTime", protoName);
- autoAwaySetting.awayTime = DBGetContactSettingWord(NULL,MODULENAME,setting,SETTING_AWAYTIME_DEFAULT);
+ autoAwaySetting.awayTime = db_get_w(NULL,MODULENAME,setting,SETTING_AWAYTIME_DEFAULT);
_snprintf(setting, sizeof(setting), "%s_NATime", protoName);
- autoAwaySetting.naTime = DBGetContactSettingWord(NULL,MODULENAME,setting,SETTING_NATIME_DEFAULT);
+ autoAwaySetting.naTime = db_get_w(NULL,MODULENAME,setting,SETTING_NATIME_DEFAULT);
_snprintf(setting, sizeof(setting), "%s_StatusFlags", protoName);
- autoAwaySetting.statusFlags = DBGetContactSettingWord(NULL,MODULENAME,setting, StatusModeToProtoFlag(ID_STATUS_ONLINE)|StatusModeToProtoFlag(ID_STATUS_FREECHAT));
+ autoAwaySetting.statusFlags = db_get_w(NULL,MODULENAME,setting, StatusModeToProtoFlag(ID_STATUS_ONLINE)|StatusModeToProtoFlag(ID_STATUS_FREECHAT));
int flags;
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SAMESETTINGS, 0))
+ if (db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, 0))
flags = 0xFFFFFF;
else
flags = CallProtoService(protoName, PS_GETCAPS,PFLAGNUM_2,0)&~CallProtoService(protoName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
_snprintf(setting, sizeof(setting), "%s_Lv1Status", protoName);
- autoAwaySetting.lv1Status = DBGetContactSettingWord(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_AWAY))?ID_STATUS_AWAY:ID_STATUS_OFFLINE);
+ autoAwaySetting.lv1Status = db_get_w(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_AWAY))?ID_STATUS_AWAY:ID_STATUS_OFFLINE);
_snprintf(setting, sizeof(setting), "%s_Lv2Status", protoName);
- autoAwaySetting.lv2Status = DBGetContactSettingWord(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_NA))?ID_STATUS_NA:ID_STATUS_OFFLINE);
+ autoAwaySetting.lv2Status = db_get_w(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_NA))?ID_STATUS_NA:ID_STATUS_OFFLINE);
return 0;
}
@@ -273,11 +273,11 @@ static int changeState(TAAAProtoSetting& setting, STATES newState) setting.szMsg = NULL;
}
- if (DBGetContactSettingByte(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_MSGCUSTOM), FALSE)) {
+ if (db_get_b(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_MSGCUSTOM), FALSE)) {
DBVARIANT dbv;
- if (!DBGetContactSettingTString(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_STATUSMSG), &dbv)) {
+ if (!db_get_ts(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_STATUSMSG), &dbv)) {
setting.szMsg = _tcsdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
}
else if (setting.szMsg != NULL) {
@@ -416,7 +416,7 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD }
if (confirm)
- confirmDialog = (HWND)CallService(MS_CS_SHOWCONFIRMDLGEX, (WPARAM)&ps, DBGetContactSettingWord(NULL, MODULENAME, SETTING_CONFIRMDELAY, 5));
+ confirmDialog = (HWND)CallService(MS_CS_SHOWCONFIRMDLGEX, (WPARAM)&ps, db_get_w(NULL, MODULENAME, SETTING_CONFIRMDELAY, 5));
else if (statusChanged)
CallService(MS_CS_SETSTATUSEX, (WPARAM)&ps, 0);
} }
@@ -602,7 +602,7 @@ int CSModuleLoaded(WPARAM wParam, LPARAM lParam) openInputDesktop = ( pfnOpenInputDesktop )GetProcAddress (hUser32, "OpenInputDesktop");
closeDesktop = ( pfnCloseDesktop )GetProcAddress (hUser32, "CloseDesktop");
- if ( IsWinVer2000Plus() && !DBGetContactSettingByte(NULL, MODULENAME, SETTING_IGNLOCK, FALSE))
+ if ( IsWinVer2000Plus() && !db_get_b(NULL, MODULENAME, SETTING_IGNLOCK, FALSE))
MyGetLastInputInfo = (BOOL (WINAPI *)(PLASTINPUTINFO))GetProcAddress(GetModuleHandleA("user32"),"GetLastInputInfo");
else
MyGetLastInputInfo = NULL;
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp index 4075dde869..1e154d7bca 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp @@ -60,14 +60,14 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L settings[count]->status = statusModeList[i];
DBVARIANT dbv;
- if ( !DBGetContactSetting(NULL, MODULENAME, StatusModeToDbSetting(statusModeList[i],SETTING_STATUSMSG), &dbv)) {
+ if ( !db_get(NULL, MODULENAME, StatusModeToDbSetting(statusModeList[i],SETTING_STATUSMSG), &dbv)) {
settings[count]->msg = ( char* )malloc(strlen(dbv.pszVal) + 1);
strcpy(settings[count]->msg, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else settings[count]->msg = NULL;
- settings[count]->useCustom = DBGetContactSettingByte(NULL, MODULENAME, StatusModeToDbSetting(statusModeList[i], SETTING_MSGCUSTOM), FALSE);
+ settings[count]->useCustom = db_get_b(NULL, MODULENAME, StatusModeToDbSetting(statusModeList[i], SETTING_MSGCUSTOM), FALSE);
count += 1;
}
SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL,0,0);
@@ -142,9 +142,9 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case PSN_APPLY:
SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_STATUS,CBN_SELCHANGE),0);
for ( i=0; i < count; i++ ) {
- DBWriteContactSettingByte(NULL, MODULENAME, StatusModeToDbSetting(settings[i]->status,SETTING_MSGCUSTOM), (BYTE)settings[i]->useCustom);
+ db_set_b(NULL, MODULENAME, StatusModeToDbSetting(settings[i]->status,SETTING_MSGCUSTOM), (BYTE)settings[i]->useCustom);
if ( (settings[i]->useCustom) && (settings[i]->msg != NULL) && (strlen(settings[i]->msg) > 0))
- DBWriteContactSettingString(NULL, MODULENAME, StatusModeToDbSetting(settings[i]->status,SETTING_STATUSMSG), settings[i]->msg);
+ db_set_s(NULL, MODULENAME, StatusModeToDbSetting(settings[i]->status,SETTING_STATUSMSG), settings[i]->msg);
}
break;
}
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp index edfeb0aaa8..f1286139ec 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp @@ -44,17 +44,17 @@ static int WriteAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoNa {
char setting[128];
mir_snprintf(setting, sizeof(setting), "%s_OptionFlags", protoName);
- DBWriteContactSettingByte(NULL,MODULENAME,setting,(BYTE)autoAwaySetting.optionFlags);
+ db_set_b(NULL,MODULENAME,setting,(BYTE)autoAwaySetting.optionFlags);
mir_snprintf(setting, sizeof(setting), "%s_AwayTime", protoName);
- DBWriteContactSettingWord(NULL,MODULENAME,setting,(WORD)autoAwaySetting.awayTime);
+ db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.awayTime);
mir_snprintf(setting, sizeof(setting), "%s_NATime", protoName);
- DBWriteContactSettingWord(NULL,MODULENAME,setting,(WORD)autoAwaySetting.naTime);
+ db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.naTime);
mir_snprintf(setting, sizeof(setting), "%s_StatusFlags", protoName);
- DBWriteContactSettingWord(NULL,MODULENAME,setting,(WORD)autoAwaySetting.statusFlags);
+ db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.statusFlags);
mir_snprintf(setting, sizeof(setting), "%s_Lv1Status", protoName);
- DBWriteContactSettingWord(NULL,MODULENAME,setting,(WORD)autoAwaySetting.lv1Status);
+ db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.lv1Status);
mir_snprintf(setting, sizeof(setting), "%s_Lv2Status", protoName);
- DBWriteContactSettingWord(NULL,MODULENAME,setting,(WORD)autoAwaySetting.lv2Status);
+ db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.lv2Status);
return 0;
}
@@ -84,7 +84,7 @@ static void SetDialogItems(HWND hwndDlg, TAAAProtoSetting* setting) EnableWindow(GetDlgItem(hwndDlg,IDC_SETNASTR),IsDlgButtonChecked(hwndDlg,IDC_SETNA)&&IsDlgButtonChecked(hwndDlg,IDC_TIMED));
EnableWindow(GetDlgItem(hwndDlg,IDC_SETNASTR),IsDlgButtonChecked(hwndDlg,IDC_SETNA)&&IsDlgButtonChecked(hwndDlg,IDC_TIMED));
EnableWindow(GetDlgItem(hwndDlg,IDC_LV2STATUS),IsDlgButtonChecked(hwndDlg,IDC_SETNA)&&IsDlgButtonChecked(hwndDlg,IDC_TIMED));
- EnableWindow(GetDlgItem(hwndDlg,IDC_PROTOCOL), !bSettingSame);//DBGetContactSettingByte(NULL, MODULENAME, SETTING_SAMESETTINGS, FALSE));
+ EnableWindow(GetDlgItem(hwndDlg,IDC_PROTOCOL), !bSettingSame);//db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, FALSE));
}
static TAAAProtoSetting* GetSetting(HWND hwndDlg, TAAAProtoSetting* sameSetting)
@@ -375,19 +375,19 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_IGNLOCK, DBGetContactSettingByte(NULL, MODULENAME, SETTING_IGNLOCK, FALSE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IGNSYSKEYS, DBGetContactSettingByte(NULL, MODULENAME, SETTING_IGNSYSKEYS, FALSE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IGNALTCOMBO, DBGetContactSettingByte(NULL, MODULENAME, SETTING_IGNALTCOMBO, FALSE)?BST_CHECKED:BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, DBGetContactSettingWord(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5), FALSE);
- SetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, DBGetContactSettingWord(NULL, MODULENAME, SETTING_CONFIRMDELAY, 5), FALSE);
+ CheckDlgButton(hwndDlg, IDC_IGNLOCK, db_get_b(NULL, MODULENAME, SETTING_IGNLOCK, FALSE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IGNSYSKEYS, db_get_b(NULL, MODULENAME, SETTING_IGNSYSKEYS, FALSE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IGNALTCOMBO, db_get_b(NULL, MODULENAME, SETTING_IGNALTCOMBO, FALSE)?BST_CHECKED:BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, db_get_w(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, db_get_w(NULL, MODULENAME, SETTING_CONFIRMDELAY, 5), FALSE);
CheckDlgButton(hwndDlg, bSettingSame?IDC_SAMESETTINGS:IDC_PERPROTOCOLSETTINGS, BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_MONITORMOUSE, DBGetContactSettingByte(NULL, MODULENAME, SETTING_MONITORMOUSE, TRUE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MONITORKEYBOARD, DBGetContactSettingByte(NULL, MODULENAME, SETTING_MONITORKEYBOARD, TRUE)?BST_CHECKED:BST_UNCHECKED);
- ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), (DBGetContactSettingByte(NULL, "Idle", "AAEnable", 0)));
+ CheckDlgButton(hwndDlg, IDC_MONITORMOUSE, db_get_b(NULL, MODULENAME, SETTING_MONITORMOUSE, TRUE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MONITORKEYBOARD, db_get_b(NULL, MODULENAME, SETTING_MONITORKEYBOARD, TRUE)?BST_CHECKED:BST_UNCHECKED);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), (db_get_b(NULL, "Idle", "AAEnable", 0)));
break;
case WM_SHOWWINDOW:
- ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), (DBGetContactSettingByte(NULL, "Idle", "AAEnable", 0)));
+ ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), (db_get_b(NULL, "Idle", "AAEnable", 0)));
break;
case WM_COMMAND:
@@ -412,14 +412,14 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_IGNLOCK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNLOCK));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_IGNSYSKEYS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNSYSKEYS));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_IGNALTCOMBO, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNALTCOMBO));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_SAMESETTINGS, (BYTE)bSettingSame);
- DBWriteContactSettingWord(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, (WORD)GetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, NULL, FALSE));
- DBWriteContactSettingWord(NULL, MODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, NULL, FALSE));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_MONITORKEYBOARD, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORKEYBOARD));
+ db_set_b(NULL, MODULENAME, SETTING_IGNLOCK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNLOCK));
+ db_set_b(NULL, MODULENAME, SETTING_IGNSYSKEYS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNSYSKEYS));
+ db_set_b(NULL, MODULENAME, SETTING_IGNALTCOMBO, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNALTCOMBO));
+ db_set_b(NULL, MODULENAME, SETTING_SAMESETTINGS, (BYTE)bSettingSame);
+ db_set_w(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, (WORD)GetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, NULL, FALSE));
+ db_set_w(NULL, MODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, NULL, FALSE));
+ db_set_b(NULL, MODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE));
+ db_set_b(NULL, MODULENAME, SETTING_MONITORKEYBOARD, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORKEYBOARD));
LoadOptions(*autoAwaySettings, FALSE);
}
break;
@@ -441,7 +441,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayTabs(HWND hwndDlg, UINT msg, WPARAM wPara RECT rcTabs, rcOptions, rcPage;
TranslateDialogDefault(hwndDlg);
- bSettingSame = DBGetContactSettingByte(NULL, MODULENAME, SETTING_SAMESETTINGS, FALSE);
+ bSettingSame = db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, FALSE);
// set tabs
tabCount = 0;
hTab = GetDlgItem(hwndDlg, IDC_TABS);
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.cpp b/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.cpp index edecc8f947..47740ac56a 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.cpp @@ -52,14 +52,14 @@ static int AAAStateChanged(WPARAM wParam, LPARAM lParam) { char setting[128];
char *szProto;
- szProto = DBGetContactSettingByte(NULL, MODULENAME, SETTING_SAMESETTINGS, 0)?SETTING_ALL:aas->protocolSetting->szName;
+ szProto = db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, 0)?SETTING_ALL:aas->protocolSetting->szName;
_snprintf(setting, sizeof(setting), "%s_Lv1Status", szProto);
- if ( (aas->protocolSetting->lastStatus == DBGetContactSettingWord(NULL, MODULENAME, setting, ID_STATUS_AWAY)) && DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVEFIRST, 0)) {
+ if ( (aas->protocolSetting->lastStatus == db_get_w(NULL, MODULENAME, setting, ID_STATUS_AWAY)) && DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVEFIRST, 0)) {
bReport = TRUE;
}
_snprintf(setting, sizeof(setting), "%s_Lv2Status", szProto);
- if ( (aas->protocolSetting->lastStatus == DBGetContactSettingWord(NULL, MODULENAME, setting, ID_STATUS_NA)) && DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVESECOND, 0)) {
+ if ( (aas->protocolSetting->lastStatus == db_get_w(NULL, MODULENAME, setting, ID_STATUS_NA)) && DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVESECOND, 0)) {
bReport = TRUE;
}
}
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 40a9400030..c8ad88b213 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -155,8 +155,8 @@ int LoadMainOptions() StartTimer(IDT_CHECKCONTIN, 0, 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);
+ currentDelay = initDelay = 1000*db_get_dw(NULL, MODULENAME, SETTING_INITDELAY, DEFAULT_INITDELAY);
+ maxDelay = 1000*db_get_dw(NULL, MODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY);
maxRetries = db_get_b(NULL, MODULENAME, SETTING_MAXRETRIES,0);
if (maxRetries == 0)
maxRetries = -1;
@@ -416,7 +416,7 @@ static int StartTimerFunction(int timer, int timeout, BOOL restart) if (restart)
KillTimer(NULL, checkContinTimerId);
if (timeout == 0) {
- checkContinTimerId = SetTimer(NULL, 0, 1000*DBGetContactSettingDword(NULL, MODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), CheckContinueslyTimer);
+ checkContinTimerId = SetTimer(NULL, 0, 1000*db_get_dw(NULL, MODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), CheckContinueslyTimer);
}
else
checkContinTimerId = SetTimer(NULL, 0, timeout, CheckContinueslyTimer);
@@ -592,7 +592,7 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam) case LOGINERR_SETDELAY:
{
- int newDelay = newDelay = 1000*DBGetContactSettingDword(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY);
+ int newDelay = newDelay = 1000*db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY);
log_infoA("KeepStatus: set delay to %d on login error (%s)", newDelay/1000, ack->szModule);
StartTimer(IDT_CHECKCONN, newDelay, TRUE);
}
@@ -620,7 +620,7 @@ static VOID CALLBACK CheckConnectingTimer(HWND hwnd,UINT message,UINT_PTR idEven int curStatus = GetStatus(cs);
int newStatus = CallProtoService(cs.szName,PS_GETSTATUS, 0, 0);
if (curStatus < MAX_CONNECT_RETRIES) { // connecting
- maxConnectingTime = DBGetContactSettingDword(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, 0);
+ maxConnectingTime = db_get_dw(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, 0);
if (maxConnectingTime > 0) {
if ( (unsigned int)maxConnectingTime <= ((GetTickCount() - cs.lastStatusAckTime)/1000)) {
// set offline
@@ -645,7 +645,7 @@ static VOID CALLBACK CheckAckStatusTimer(HWND hwnd,UINT message,UINT_PTR idEvent continue;
if (newStatus < MAX_CONNECT_RETRIES) { // connecting
- maxConnectingTime = DBGetContactSettingDword(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, 0);
+ maxConnectingTime = db_get_dw(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, 0);
if (maxConnectingTime > 0)
StartTimer(IDT_CHECKCONNECTING, (maxConnectingTime*1000 - (GetTickCount() - cs.lastStatusAckTime)), FALSE);
}
@@ -799,7 +799,7 @@ static void CheckContinueslyFunction(void *arg) BOOL ping = db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE);
if (ping) {
DBVARIANT dbv;
- if (DBGetContactSetting(NULL, MODULENAME, SETTING_PINGHOST, &dbv))
+ if (db_get(NULL, MODULENAME, SETTING_PINGHOST, &dbv))
ping = FALSE;
else {
char *start, *end;
@@ -854,7 +854,7 @@ static void CheckContinueslyFunction(void *arg) }
lpfnIcmpCloseHandle(hICMPFile);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (StartTimer(IDT_CHECKCONN, -1, FALSE)) {
@@ -862,7 +862,7 @@ static void CheckContinueslyFunction(void *arg) return; // already connecting, leave
}
- if ( ((!ping) && (!InternetGetConnectedState(NULL, 0))) || ( (ping) && (!bLastPingResult) && (pingFailures >= DBGetContactSettingWord(NULL, MODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT)))) {
+ if ( ((!ping) && (!InternetGetConnectedState(NULL, 0))) || ( (ping) && (!bLastPingResult) && (pingFailures >= db_get_w(NULL, MODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT)))) {
pingFailures = 0;
int count;
@@ -945,7 +945,7 @@ static int ProcessPopup(int reason, LPARAM lParam) _snprintf(text, sizeof(text), Translate("%s Login error, cancel reconnecting"), protoName);
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));
+ _snprintf(text, sizeof(text), Translate("%s Login error (next retry (%d) in %ds)"), protoName, retryCount+1, db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY));
else
return -1;
@@ -1056,14 +1056,14 @@ static INT_PTR ShowPopup(char* msg, HICON hIcon) }
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.colorBack = db_get_dw(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA);
+ ppd.colorText = db_get_dw(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC);
}
ppd.PluginWindowProc = PopupDlgProc;
switch ( db_get_b(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
case POPUP_DELAYCUSTOM:
- ppd.iSeconds = (int)DBGetContactSettingDword(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, 0);
+ ppd.iSeconds = (int)db_get_dw(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, 0);
if (ppd.iSeconds == 0) {
ppd.iSeconds = currentDelay/1000-1;
}
diff --git a/plugins/StatusPlugins/KeepStatus/options.cpp b/plugins/StatusPlugins/KeepStatus/options.cpp index 15b1996748..11bec59372 100644 --- a/plugins/StatusPlugins/KeepStatus/options.cpp +++ b/plugins/StatusPlugins/KeepStatus/options.cpp @@ -46,13 +46,13 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L DBVARIANT dbv;
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);
+ SetDlgItemInt(hwndDlg, IDC_INITDELAY, db_get_dw(NULL,MODULENAME,SETTING_INITDELAY,DEFAULT_INITDELAY),FALSE);
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))
+ if (!db_get(NULL, MODULENAME, SETTING_PINGHOST, &dbv))
SetDlgItemTextA(hwndDlg, IDC_PINGHOST, dbv.pszVal);
// proto list
HWND hList = GetDlgItem(hwndDlg,IDC_PROTOCOLLIST);
@@ -132,13 +132,13 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L int i;
LVITEM lvItem;
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_MAXRETRIES, (BYTE)GetDlgItemInt(hwndDlg,IDC_MAXRETRIES, NULL, FALSE));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_CHECKCONNECTION, (BYTE)SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCONNECTIONPOPUPS));
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_INITDELAY, (DWORD)GetDlgItemInt(hwndDlg,IDC_INITDELAY, NULL, FALSE));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_CHKINET, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHKINET));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_CONTCHECK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_BYPING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BYPING));
+ db_set_b(NULL, MODULENAME, SETTING_MAXRETRIES, (BYTE)GetDlgItemInt(hwndDlg,IDC_MAXRETRIES, NULL, FALSE));
+ db_set_b(NULL, MODULENAME, SETTING_CHECKCONNECTION, (BYTE)SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
+ db_set_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCONNECTIONPOPUPS));
+ db_set_dw(NULL, MODULENAME, SETTING_INITDELAY, (DWORD)GetDlgItemInt(hwndDlg,IDC_INITDELAY, NULL, FALSE));
+ db_set_b(NULL, MODULENAME, SETTING_CHKINET, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHKINET));
+ db_set_b(NULL, MODULENAME, SETTING_CONTCHECK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK));
+ db_set_b(NULL, MODULENAME, SETTING_BYPING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BYPING));
if (IsDlgButtonChecked(hwndDlg, IDC_BYPING)) {
char *host;
@@ -148,7 +148,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L if (host != NULL) {
memset(host, '\0', len+1);
GetDlgItemTextA(hwndDlg, IDC_PINGHOST, host, len+1);
- DBWriteContactSettingString(NULL, MODULENAME, SETTING_PINGHOST, host);
+ db_set_s(NULL, MODULENAME, SETTING_PINGHOST, host);
}
}
}
@@ -162,7 +162,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L char dbSetting[128];
mir_snprintf(dbSetting, sizeof(dbSetting), "%s_enabled", (char *)lvItem.lParam);
- DBWriteContactSettingByte(NULL, MODULENAME, dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem));
+ db_set_b(NULL, MODULENAME, dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem));
}
}
break;
@@ -176,17 +176,17 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg,UINT msg,WPARAM wParam,LPA switch(msg) {
case WM_INITDIALOG: {
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);
+ SetDlgItemInt(hwndDlg, IDC_MAXDELAY, db_get_dw(NULL,MODULENAME,SETTING_MAXDELAY,DEFAULT_MAXDELAY),FALSE);
+ SetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, db_get_dw(NULL,MODULENAME,SETTING_MAXCONNECTINGTIME,0),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);
+ SetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_PINGCOUNT, db_get_w(NULL, MODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_CNTDELAY, db_get_dw(NULL, MODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), FALSE);
switch ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL)) {
case LOGINERR_SETDELAY:
CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_SETDELAY);
@@ -219,25 +219,25 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg,UINT msg,WPARAM wParam,LPA case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL));
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_MAXDELAY, (DWORD)GetDlgItemInt(hwndDlg,IDC_MAXDELAY, NULL, FALSE));
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, (DWORD)GetDlgItemInt(hwndDlg,IDC_MAXCONNECTINGTIME, NULL, FALSE));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_FIRSTOFFLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FIRSTOFFLINE));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_NOLOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOLOCKED));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_CNCOTHERLOC, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CNCOTHERLOC));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_LOGINERR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LOGINERR));
+ db_set_b(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL));
+ db_set_dw(NULL, MODULENAME, SETTING_MAXDELAY, (DWORD)GetDlgItemInt(hwndDlg,IDC_MAXDELAY, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, (DWORD)GetDlgItemInt(hwndDlg,IDC_MAXCONNECTINGTIME, NULL, FALSE));
+ db_set_b(NULL, MODULENAME, SETTING_FIRSTOFFLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FIRSTOFFLINE));
+ db_set_b(NULL, MODULENAME, SETTING_NOLOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOLOCKED));
+ db_set_b(NULL, MODULENAME, SETTING_CNCOTHERLOC, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CNCOTHERLOC));
+ db_set_b(NULL, MODULENAME, SETTING_LOGINERR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LOGINERR));
if (IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)) {
if (IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY)) {
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_SETDELAY);
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_LOGINERR_DELAY, GetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, NULL, FALSE));
+ db_set_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_SETDELAY);
+ db_set_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, GetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, NULL, FALSE));
}
- else DBWriteContactSettingByte(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL);
+ else db_set_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL);
}
- else DBWriteContactSettingByte(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING);
+ else db_set_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING);
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_CHECKAPMRESUME, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHECKAPMRESUME));
- DBWriteContactSettingWord(NULL, MODULENAME, SETTING_PINGCOUNT, (WORD)GetDlgItemInt(hwndDlg,IDC_PINGCOUNT, NULL, FALSE));
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_CNTDELAY, (DWORD)GetDlgItemInt(hwndDlg,IDC_CNTDELAY, NULL, FALSE)==0?CHECKCONTIN_DELAY:GetDlgItemInt(hwndDlg,IDC_CNTDELAY, NULL, FALSE));
+ db_set_b(NULL, MODULENAME, SETTING_CHECKAPMRESUME, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHECKAPMRESUME));
+ db_set_w(NULL, MODULENAME, SETTING_PINGCOUNT, (WORD)GetDlgItemInt(hwndDlg,IDC_PINGCOUNT, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_CNTDELAY, (DWORD)GetDlgItemInt(hwndDlg,IDC_CNTDELAY, NULL, FALSE)==0?CHECKCONTIN_DELAY:GetDlgItemInt(hwndDlg,IDC_CNTDELAY, NULL, FALSE));
}
break;
@@ -423,11 +423,11 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar break;
}
// delay
- SetDlgItemInt(hwndDlg,IDC_DELAY, DBGetContactSettingDword(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, 0), FALSE);
+ SetDlgItemInt(hwndDlg,IDC_DELAY, db_get_dw(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, 0), FALSE);
// back color
- SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA));
+ SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_SETCOLOUR,0,db_get_dw(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA));
// text
- SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC));
+ SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_SETCOLOUR,0,db_get_dw(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC));
// wincolors
CheckDlgButton(hwndDlg, IDC_WINCOLORS, db_get_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0));
// defaultcolors
@@ -532,41 +532,41 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar if (((LPNMHDR)lParam)->code == PSN_APPLY) {
// left action
if (IsDlgButtonChecked(hwndDlg, IDC_LNOTHING))
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_NOTHING);
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_NOTHING);
else if (IsDlgButtonChecked(hwndDlg, IDC_LCLOSE))
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CLOSEPOPUP);
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CLOSEPOPUP);
else if (IsDlgButtonChecked(hwndDlg, IDC_LCANCEL))
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL);
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL);
// right action
if (IsDlgButtonChecked(hwndDlg, IDC_RNOTHING))
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_NOTHING);
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_NOTHING);
else if (IsDlgButtonChecked(hwndDlg, IDC_RCLOSE))
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CLOSEPOPUP);
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CLOSEPOPUP);
else if (IsDlgButtonChecked(hwndDlg, IDC_RCANCEL))
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL);
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL);
// delay
if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU))
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU);
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU);
else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM))
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYCUSTOM);
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYCUSTOM);
else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT))
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYPERMANENT);
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYPERMANENT);
// delay
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
// back color
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_GETCOLOUR,0,0));
// text color
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_GETCOLOUR,0,0));
// use win
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS));
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS));
// use def
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_POPUP_USEDEFCOLORS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
+ db_set_b(NULL, MODULENAME, SETTING_POPUP_USEDEFCOLORS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
// store types
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_PUCONNLOST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNLOST));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_PUOTHER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUOTHER));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_PUCONNRETRY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNRETRY));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_PURESULT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PURESULT));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_PUSHOWEXTRA, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUSHOWEXTRA));
+ db_set_b(NULL, MODULENAME, SETTING_PUCONNLOST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNLOST));
+ db_set_b(NULL, MODULENAME, SETTING_PUOTHER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUOTHER));
+ db_set_b(NULL, MODULENAME, SETTING_PUCONNRETRY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNRETRY));
+ db_set_b(NULL, MODULENAME, SETTING_PURESULT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PURESULT));
+ db_set_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUSHOWEXTRA));
}
break;
}
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 70527d62bb..3e78a0230c 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -966,12 +966,12 @@ static int ClearDatabase(char* filter) CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces);
for (i=0; i < settingCount; i++) {
if ((filter == NULL) || (!strncmp(filter, settings[i], strlen(filter))))
- DBDeleteContactSetting(NULL, MODULENAME, settings[i]);
+ db_unset(NULL, MODULENAME, settings[i]);
free(settings[i]);
}
free(settings);
// < v0.0.0.9
- if (filter == NULL) DBDeleteContactSetting(NULL, "AutoAway", "Confirm");
+ if (filter == NULL) db_unset(NULL, "AutoAway", "Confirm");
return 0;
}
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index 9fc08cea82..bdd7e78114 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -162,7 +162,7 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
char setting[80];
_snprintf(setting, sizeof(setting), "%d_%s", profile, SETTING_PROFILENAME);
- if ( DBGetContactSettingTString(NULL, MODULENAME, setting, &dbv))
+ if ( db_get_ts(NULL, MODULENAME, setting, &dbv))
return -1;
_tcsncpy(buf, dbv.ptszVal, 128-1); buf[127] = 0;
@@ -191,7 +191,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto) for ( int i=0; i < pceCount; i++ ) {
if ( (pce[i].profile == profile) && (!strcmp(pce[i].szProto, szProto))) {
_snprintf(dbSetting, sizeof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
- if (!DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db
+ if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db
pce[i].msg = ( TCHAR* )realloc(pce[i].msg, sizeof(TCHAR)*(_tcslen(dbv.ptszVal)+1));
if (pce[i].msg != NULL) {
_tcscpy(pce[i].msg, dbv.ptszVal);
@@ -215,7 +215,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto) pce[pceCount].szProto = _strdup(szProto);
pce[pceCount].msg = NULL;
_snprintf(dbSetting, sizeof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
- if (!DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) {
+ if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) {
pce[pceCount].msg = _tcsdup(dbv.ptszVal);
db_free(&dbv);
}
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index 5df0dff3b4..f95ec4ce8e 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -176,7 +176,7 @@ static void SetLastStatusMessages(TSettingsList& ps) _snprintf(dbSetting, sizeof(dbSetting), "%s%s", PREFIX_LASTMSG, ps[i].szName);
DBVARIANT dbv;
- if ( ps[i].szMsg == NULL && !DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) {
+ if ( ps[i].szMsg == NULL && !db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) {
ps[i].szMsg = _tcsdup(dbv.ptszVal); // remember this won't be freed
db_free(&dbv);
} } }
@@ -303,7 +303,7 @@ static int Exit(WPARAM wParam, LPARAM lParam) if (CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)protos[i]->szModuleName)) {
db_set_w(NULL, MODULENAME, lastName, (WORD)CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0));
mir_snprintf(lastMsg, sizeof(lastMsg), "%s%s", PREFIX_LASTMSG, protos[i]->szModuleName);
- DBDeleteContactSetting(NULL, MODULENAME, lastMsg);
+ db_unset(NULL, MODULENAME, lastMsg);
int status = CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0);
if ( !CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)protos[i]->szModuleName))
diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp index 1109eb24f3..a2e53fc395 100644 --- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp +++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp @@ -61,7 +61,7 @@ int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
_snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_PROFILENAME);
- if (DBGetContactSetting(NULL, MODULENAME, setting, &dbv))
+ if (db_get(NULL, MODULENAME, setting, &dbv))
continue;
ttb.hIconHandleDn = iconList[0].hIcolib;
diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp index 7de3bc5c96..cd8fd9b75e 100755 --- a/plugins/StopSpamMod/src/stopspam.cpp +++ b/plugins/StopSpamMod/src/stopspam.cpp @@ -155,7 +155,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) if(boost::algorithm::all(message, boost::is_digit())) { int msg = _ttoi(message.c_str()); - int math_answer = DBGetContactSettingDword(hContact, pluginName, "MathAnswer", 0); + int math_answer = db_get_dw(hContact, pluginName, "MathAnswer", 0); if(msg && math_answer) answered = (msg == math_answer); } diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 0ce304e59f..efef2f9e02 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -21,24 +21,24 @@ tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, char const * szSetting, tstring errorValue) { DBVARIANT dbv; - //if(DBGetContactSetting(hContact, szModule, szSetting, &dbv)) + //if(db_get(hContact, szModule, szSetting, &dbv)) if(db_get_ts(hContact, szModule, szSetting, &dbv)) return errorValue; // if(DBVT_TCHAR == dbv.type ) errorValue = dbv.ptszVal; - DBFreeVariant(&dbv); + db_free(&dbv); return errorValue; } std::string DBGetContactSettingStringPAN_A(HANDLE hContact, char const * szModule, char const * szSetting, std::string errorValue) { DBVARIANT dbv; - //if(DBGetContactSetting(hContact, szModule, szSetting, &dbv)) + //if(db_get(hContact, szModule, szSetting, &dbv)) if(db_get_s(hContact, szModule, szSetting, &dbv)) return errorValue; // if(DBVT_ASCIIZ == dbv.type ) errorValue = dbv.pszVal; - DBFreeVariant(&dbv); + db_free(&dbv); return errorValue; } @@ -119,7 +119,7 @@ void RemoveExcludedUsers() if(hContact) { do{ - if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && DBGetContactSettingByte(hContact, pluginName, "Excluded", 0)) + if(db_get_b(hContact, "CList", "NotOnList", 0) && db_get_b(hContact, pluginName, "Excluded", 0)) { plist->hContact = hContact; plist->next = new hContact_entry; @@ -136,7 +136,7 @@ void RemoveExcludedUsers() if(status>= ID_STATUS_CONNECTING && status <= ID_STATUS_OFFLINE){ LogSpamToFile(plist->hContact, _T("Mark for delete")); - DBWriteContactSettingByte(plist->hContact,"CList","Delete", 1); + db_set_b(plist->hContact,"CList","Delete", 1); }else{ LogSpamToFile(plist->hContact, _T("Deleted")); CallService(MS_DB_CONTACT_DELETE, (WPARAM)plist->hContact, 0); @@ -160,7 +160,7 @@ void RemoveTemporaryUsers() if(hContact) { do{ - if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)|| + if(db_get_b(hContact, "CList", "NotOnList", 0)|| (_T("Not In List")== DBGetContactSettingStringPAN(hContact,"CList","Group",_T(""))) ) { @@ -179,7 +179,7 @@ void RemoveTemporaryUsers() if(status>= ID_STATUS_CONNECTING && status <= ID_STATUS_OFFLINE){ LogSpamToFile(plist->hContact, _T("Mark for delete")); - DBWriteContactSettingByte(plist->hContact,"CList","Delete", 1); + db_set_b(plist->hContact,"CList","Delete", 1); }else{ LogSpamToFile(plist->hContact, _T("Deleted")); CallService(MS_DB_CONTACT_DELETE, (WPARAM)plist->hContact, 0); diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index 48aa3269e4..75694b5090 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -27,8 +27,8 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) // if request is from unknown or not marked Answered contact
//and if I don't sent message to this contact
- if(DBGetContactSettingByte(hcntct, "CList", "NotOnList", 0) &&
- !DBGetContactSettingByte(hcntct, pluginName, answeredSetting, 0) &&
+ if(db_get_b(hcntct, "CList", "NotOnList", 0) &&
+ !db_get_b(hcntct, pluginName, answeredSetting, 0) &&
!IsExistMyMessage(hcntct))
{
if (!plSets->HandleAuthReq.Get())
@@ -50,8 +50,8 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) mir_free(AuthRepl);
- DBWriteContactSettingByte(hcntct, "CList", "NotOnList", 1);
- DBWriteContactSettingByte(hcntct, "CList", "Hidden", 1);
+ db_set_b(hcntct, "CList", "NotOnList", 1);
+ db_set_b(hcntct, "CList", "Hidden", 1);
if (!plSets->HistLog.Get())
db_event_delete(0, hDbEvent);
delete [] dbei.pBlob;
@@ -81,13 +81,13 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) return 0;
// if message is from known or marked Answered contact
- if(DBGetContactSettingByte(hContact, pluginName, answeredSetting, 0))
+ if(db_get_b(hContact, pluginName, answeredSetting, 0))
// ...let the event go its way
return 0;
// checking if message from self-added contact
//Contact in Not in list icq group
- if (!DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && DBGetContactSettingWord(hContact, dbei->szModule, "SrvGroupId", -1) != 1)
+ if (!db_get_b(hContact, "CList", "NotOnList", 0) && db_get_w(hContact, dbei->szModule, "SrvGroupId", -1) != 1)
return 0;
//if I sent message to this contact
@@ -135,14 +135,14 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) )
{
// unhide contact
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
// mark contact as Answered
- DBWriteContactSettingByte(hContact, pluginName, answeredSetting, 1);
+ db_set_b(hContact, pluginName, answeredSetting, 1);
//add contact permanently
if(plSets->AddPermanent.Get())
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
// send congratulation
@@ -160,7 +160,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // if message message does not contain infintite talk protection prefix
// and question count for this contact is less then maximum
if ( (!plSets->InfTalkProtection.Get() || tstring::npos==message.find(infTalkProtPrefix))
- && (!plSets->MaxQuestCount.Get() || DBGetContactSettingDword(hContact, pluginName, questCountSetting, 0) < plSets->MaxQuestCount.Get()))
+ && (!plSets->MaxQuestCount.Get() || db_get_dw(hContact, pluginName, questCountSetting, 0) < plSets->MaxQuestCount.Get()))
{
// send question
tstring q = infTalkProtPrefix + variables_parse((tstring)(plSets->Question), hContact);
@@ -172,13 +172,13 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // increment question count
- DWORD questCount = DBGetContactSettingDword(hContact, pluginName, questCountSetting, 0);
- DBWriteContactSettingDword(hContact, pluginName, questCountSetting, questCount + 1);
+ DWORD questCount = db_get_dw(hContact, pluginName, questCountSetting, 0);
+ db_set_dw(hContact, pluginName, questCountSetting, questCount + 1);
// hide contact from contact list
}
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
// save message from contact
dbei->flags |= DBEF_READ;
@@ -227,8 +227,8 @@ MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, w, l) return 0;
if (!cws->value.type)
{
- DBDeleteContactSetting(hContact, pluginName, answeredSetting);
- DBDeleteContactSetting(hContact, pluginName, questCountSetting);
+ db_unset(hContact, pluginName, answeredSetting);
+ db_unset(hContact, pluginName, questCountSetting);
}
return 0;
diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 905a87ee89..21b77e14f4 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -8,10 +8,10 @@ INT_PTR IsContactPassed(WPARAM wParam, LPARAM /*lParam*/) if ( !plSets->ProtoDisabled( proto.c_str()))
return CS_PASSED;
- if ( DBGetContactSettingByte(hContact, pluginName, answeredSetting, 0))
+ if ( db_get_b(hContact, pluginName, answeredSetting, 0))
return CS_PASSED;
- if ( !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && DBGetContactSettingWord( hContact, proto.c_str(), "SrvGroupId", -1 ) != 1)
+ if ( !db_get_b(hContact, "CList", "NotOnList", 0) && db_get_w( hContact, proto.c_str(), "SrvGroupId", -1 ) != 1)
return CS_PASSED;
if ( IsExistMyMessage(hContact))
@@ -27,10 +27,10 @@ INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam) HANDLE hNext = db_find_next(hContact);
DBVARIANT dbv = { 0 };
- if ( DBGetContactSettingTString( hContact, "CList", "Group", &dbv ))
+ if ( db_get_ts( hContact, "CList", "Group", &dbv ))
dbv.ptszVal = NULL;
- if ( DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) || DBGetContactSettingByte(hContact, "CList", "Hidden", 0 ) || (dbv.ptszVal != NULL && (_tcsstr(dbv.ptszVal, _T("Not In List")) || _tcsstr(dbv.ptszVal, TranslateT("Not In List"))))) {
+ if ( db_get_b(hContact, "CList", "NotOnList", 0) || db_get_b(hContact, "CList", "Hidden", 0 ) || (dbv.ptszVal != NULL && (_tcsstr(dbv.ptszVal, _T("Not In List")) || _tcsstr(dbv.ptszVal, TranslateT("Not In List"))))) {
char *szProto = GetContactProto(hContact);
if ( szProto != NULL ) {
// Check if protocol uses server side lists
@@ -40,14 +40,14 @@ INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam) status = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES))
// Set a flag so we remember to delete the contact when the protocol goes online the next time
- DBWriteContactSettingByte( hContact, "CList", "Delete", 1 );
+ db_set_b( hContact, "CList", "Delete", 1 );
else
CallService( MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0 );
}
}
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
hContact = hNext;
}
@@ -56,13 +56,13 @@ INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam) do {
group_name = (char *)CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, 0);
if (group_name != NULL && strstr(group_name, "Not In List")) {
- BYTE ConfirmDelete = DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
+ BYTE ConfirmDelete = db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
if ( ConfirmDelete )
- DBWriteContactSettingByte( NULL, "CList", "ConfirmDelete", 0 );
+ db_set_b( NULL, "CList", "ConfirmDelete", 0 );
CallService( MS_CLIST_GROUPDELETE, (WPARAM)hGroup, 0 );
if ( ConfirmDelete )
- DBWriteContactSettingByte( NULL, "CList", "ConfirmDelete", ConfirmDelete );
+ db_set_b( NULL, "CList", "ConfirmDelete", ConfirmDelete );
break;
}
hGroup++;
diff --git a/plugins/StopSpamPlus/src/settings.cpp b/plugins/StopSpamPlus/src/settings.cpp index 05a9007d0c..52dcc274a2 100644 --- a/plugins/StopSpamPlus/src/settings.cpp +++ b/plugins/StopSpamPlus/src/settings.cpp @@ -4,10 +4,10 @@ tstring db_usage::DBGetPluginSetting(std::string const &name, tstring const &defValue)
{
DBVARIANT dbv;
- if(DBGetContactSettingTString(NULL, pluginName, name.c_str(), &dbv))
+ if(db_get_ts(NULL, pluginName, name.c_str(), &dbv))
return defValue;
tstring value = dbv.ptszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return value;
}
@@ -15,45 +15,45 @@ tstring db_usage::DBGetPluginSetting(std::string const &name, tstring const &def std::string db_usage::DBGetPluginSetting(std::string const &name, std::string const &defValue)
{
DBVARIANT dbv;
- if(DBGetContactSettingString(NULL, pluginName, name.c_str(), &dbv))
+ if(db_get_s(NULL, pluginName, name.c_str(), &dbv))
return defValue;
std::string value = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return value;
}
bool db_usage::DBGetPluginSetting(std::string const &name, bool const &defValue)
{
- return(0 != DBGetContactSettingByte(NULL, pluginName, name.c_str(), defValue?1:0));
+ return(0 != db_get_b(NULL, pluginName, name.c_str(), defValue?1:0));
}
DWORD db_usage::DBGetPluginSetting(std::string const &name, DWORD const &defValue)
{
- return DBGetContactSettingDword(NULL, pluginName, name.c_str(), defValue);
+ return db_get_dw(NULL, pluginName, name.c_str(), defValue);
}
//writting to database--------------
void db_usage::DBSetPluginSetting(std::string const &name, tstring const &value)
{
- DBWriteContactSettingTString(NULL, pluginName, name.c_str(), value.c_str());
+ db_set_ts(NULL, pluginName, name.c_str(), value.c_str());
}
void db_usage::DBSetPluginSetting(std::string const &name, std::string const &value)
{
- DBWriteContactSettingString(NULL, pluginName, name.c_str(), value.c_str());
+ db_set_s(NULL, pluginName, name.c_str(), value.c_str());
}
void db_usage::DBSetPluginSetting(std::string const &name, bool const &value)
{
- DBWriteContactSettingByte(NULL, pluginName, name.c_str(), value?1:0);
+ db_set_b(NULL, pluginName, name.c_str(), value?1:0);
}
void db_usage::DBSetPluginSetting(std::string const &name, DWORD const &value)
{
- DBWriteContactSettingDword(NULL, pluginName, name.c_str(),value);
+ db_set_dw(NULL, pluginName, name.c_str(),value);
}
Settings *plSets;
diff --git a/plugins/StopSpamPlus/src/utils.cpp b/plugins/StopSpamPlus/src/utils.cpp index b1329ccd0c..ca4c46c292 100644 --- a/plugins/StopSpamPlus/src/utils.cpp +++ b/plugins/StopSpamPlus/src/utils.cpp @@ -22,7 +22,7 @@ bool IsExistMyMessage(HANDLE hContact) if(dbei.flags & DBEF_SENT){
// mark contact as Answered
- DBWriteContactSettingByte(hContact, pluginName, answeredSetting, 1);
+ db_set_b(hContact, pluginName, answeredSetting, 1);
// ...let the event go its way
return true;
}
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 8205a902dc..a7fcff7b36 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -141,7 +141,7 @@ void CB_InitCustomButtons() InitializeCriticalSection(&ToolBarCS);
dwSepCount = M->GetDword("TabSRMM_Toolbar", "SeparatorsCount", 0);
- //dwSepCount = DBGetContactSettingDword(NULL, "TabSRMM_Toolbar", "SeparatorsCount", 0);
+ //dwSepCount = db_get_dw(NULL, "TabSRMM_Toolbar", "SeparatorsCount", 0);
hButtonsBarAddButton = CreateServiceFunction(MS_BB_ADDBUTTON, CB_AddButton);
hButtonsBarRemoveButton = CreateServiceFunction(MS_BB_REMOVEBUTTON, CB_RemoveButton);
@@ -865,7 +865,7 @@ void CB_GetButtonSettings(HANDLE hContact, CustomButtonData *cbd) mir_snprintf(SettingName, sizeof(SettingName), "%s_%d", cbd->pszModuleName, cbd->dwButtonOrigID);
- if (!DBGetContactSettingString(hContact, "TabSRMM_Toolbar", SettingName, &dbv)) {
+ if (!db_get_s(hContact, "TabSRMM_Toolbar", SettingName, &dbv)) {
token = strtok(dbv.pszVal, "_");
cbd->dwPosition = (DWORD)atoi(token);
token = strtok(NULL, "_");
@@ -879,7 +879,7 @@ void CB_GetButtonSettings(HANDLE hContact, CustomButtonData *cbd) token = strtok(NULL, "_");
cbd->bCanBeHidden = (BOOL)atoi(token);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -893,7 +893,7 @@ void CB_WriteButtonSettings(HANDLE hContact, CustomButtonData *cbd) mir_snprintf(SettingName, sizeof(SettingName), "%s_%d", cbd->pszModuleName, cbd->dwButtonOrigID);
mir_snprintf(SettingParameter, sizeof(SettingParameter), "%d_%u_%u_%u_%u_%u", cbd->dwPosition, cbd->bIMButton, cbd->bChatButton, cbd->bLSided, cbd->bRSided, cbd->bCanBeHidden);
if (!(cbd->opFlags&BBSF_NTBDESTRUCT))
- DBWriteContactSettingString(hContact, "TabSRMM_Toolbar", SettingName, SettingParameter);
+ db_set_s(hContact, "TabSRMM_Toolbar", SettingName, SettingParameter);
else
db_unset(hContact, "TabSRMM_Toolbar", SettingName);
}
diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp index 18172a2e01..fd0f232573 100644 --- a/plugins/TabSRMM/src/chat/clist.cpp +++ b/plugins/TabSRMM/src/chat/clist.cpp @@ -50,7 +50,7 @@ static HANDLE Clist_GroupExists(TCHAR *tszGroup) result = M->GetTString(0, "CListGroups", str, &dbv);
if (!result) {
match = (!_tcscmp(tszGroup, &dbv.ptszVal[1]) && (lstrlen(tszGroup) == lstrlen(&dbv.ptszVal[1])));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (match)
return((HANDLE)(i + 1));
}
@@ -70,7 +70,7 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p if (!M->GetTString(NULL, "Chat", "AddToGroup", &dbv)) {
if (lstrlen(dbv.ptszVal) > 0)
lstrcpyn(pszGroup, dbv.ptszVal, 50);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
lstrcpyn(pszGroup, _T("Chat rooms"), 50);
@@ -94,7 +94,7 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p M->WriteTString(hContact, pszModule, "Nick", pszDisplayName);
M->WriteTString(hContact, pszModule, "ChatRoomID", pszRoom);
M->WriteByte(hContact, pszModule, "ChatRoom", (BYTE)iType);
- DBWriteContactSettingWord(hContact, pszModule, "Status", ID_STATUS_OFFLINE);
+ db_set_w(hContact, pszModule, "Status", ID_STATUS_OFFLINE);
return hContact;
}
@@ -106,8 +106,8 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) return FALSE;
int i = M->GetByte(hContact, szProto, "ChatRoom", 0);
- DBWriteContactSettingWord(hContact, szProto, "ApparentMode", (LPARAM)0);
- DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ db_set_w(hContact, szProto, "ApparentMode", (LPARAM)0);
+ db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
return TRUE;
}
return FALSE;
@@ -125,8 +125,8 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) if (!pszModule || (pszModule && !strcmp(pszModule, szProto))) {
int i = M->GetByte(hContact, szProto, "ChatRoom", 0);
if (i != 0) {
- DBWriteContactSettingWord(hContact, szProto, "ApparentMode", (LPARAM)(WORD) 0);
- DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ db_set_w(hContact, szProto, "ApparentMode", (LPARAM)(WORD) 0);
+ db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
}
}
}
@@ -162,7 +162,7 @@ int CList_RoomDoubleclicked(WPARAM wParam, LPARAM lParam) && IsWindowVisible(si->hWnd)
&& !IsIconic(si->pContainer->hwnd)) {
PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
else
@@ -175,7 +175,7 @@ int CList_RoomDoubleclicked(WPARAM wParam, LPARAM lParam) SetForegroundWindow(si->dat->pContainer->hwnd);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
}
@@ -305,10 +305,10 @@ HANDLE CList_FindRoom(const char* pszModule, const TCHAR* pszRoom) DBVARIANT dbv;
if (!M->GetTString(hContact, szProto, "ChatRoomID", &dbv)) {
if (!lstrcmpi(dbv.ptszVal, pszRoom)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return hContact;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index 1e8919e8c0..c3ffc5e0e9 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -76,8 +76,8 @@ int Chat_Unload(void) if (!PluginConfig.m_chat_enabled)
return 0;
- DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
- DBWriteContactSettingWord(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY);
+ db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
+ db_set_w(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY);
CList_SetAllOffline(TRUE, NULL);
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp index 2649cb2a24..4b706059d9 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat/manager.cpp @@ -121,10 +121,10 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, bool removeConta if (pTemp->hContact) {
CList_SetOffline(pTemp->hContact, pTemp->iType == GCW_CHATROOM ? TRUE : FALSE);
//if (pTemp->iType != GCW_SERVER)
- //DBWriteContactSettingByte(pTemp->hContact, "CList", "Hidden", 1);
+ //db_set_b(pTemp->hContact, "CList", "Hidden", 1);
}
- DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule , "Topic", "");
- DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule, "StatusBar", "");
+ db_set_s(pTemp->hContact, pTemp->pszModule , "Topic", "");
+ db_set_s(pTemp->hContact, pTemp->pszModule, "StatusBar", "");
db_unset(pTemp->hContact, "CList", "StatusMsg");
if (removeContact)
@@ -610,7 +610,7 @@ BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus) if (pTemp->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE)
db_unset(pTemp->hContact, "CList", "Hidden");
- DBWriteContactSettingWord(pTemp->hContact, pTemp->pszModule, "Status", (WORD)wStatus);
+ db_set_w(pTemp->hContact, pTemp->pszModule, "Status", (WORD)wStatus);
}
if (pszID)
@@ -702,9 +702,9 @@ BOOL SM_RemoveAll(void) DoEventHook(m_WndList->ptszID, m_WndList->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)m_WndList->dwItemData);
if (m_WndList->hContact)
CList_SetOffline(m_WndList->hContact, m_WndList->iType == GCW_CHATROOM ? TRUE : FALSE);
- DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule , "Topic", "");
+ db_set_s(m_WndList->hContact, m_WndList->pszModule , "Topic", "");
db_unset(m_WndList->hContact, "CList", "StatusMsg");
- DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule, "StatusBar", "");
+ db_set_s(m_WndList->hContact, m_WndList->pszModule, "StatusBar", "");
UM_RemoveAll(&m_WndList->pUsers);
TM_RemoveAll(&m_WndList->pStatuses);
diff --git a/plugins/TabSRMM/src/chat/muchighlight.cpp b/plugins/TabSRMM/src/chat/muchighlight.cpp index 935d2e38d4..79752fa472 100644 --- a/plugins/TabSRMM/src/chat/muchighlight.cpp +++ b/plugins/TabSRMM/src/chat/muchighlight.cpp @@ -269,12 +269,12 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L DBVARIANT dbv = {0};
if ( !M->GetTString(0, "Chat", "HighlightWords", &dbv)) {
::SetDlgItemText(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, dbv.ptszVal);
- ::DBFreeVariant(&dbv);
+ ::db_free(&dbv);
}
if ( !M->GetTString(0, "Chat", "HighlightNames", &dbv)) {
::SetDlgItemText(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, dbv.ptszVal);
- ::DBFreeVariant(&dbv);
+ ::db_free(&dbv);
}
DWORD dwFlags = M->GetByte("Chat", "HighlightEnabled", MATCH_TEXT);
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 0590070abf..6011d8a194 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -1050,7 +1050,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM SM_InvalidateLogDirectories();
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0);
- DBWriteContactSettingWord(NULL, "Chat", "LoggingLimit", (WORD)iLen);
+ db_set_w(NULL, "Chat", "LoggingLimit", (WORD)iLen);
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0);
if (iLen > 0)
@@ -1062,32 +1062,32 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
- DBWriteContactSettingString(NULL, "Chat", "LogTimestamp", pszText);
+ db_set_s(NULL, "Chat", "LogTimestamp", pszText);
} else db_unset(NULL, "Chat", "LogTimestamp");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
- DBWriteContactSettingString(NULL, "Chat", "HeaderTime", pszText);
+ db_set_s(NULL, "Chat", "HeaderTime", pszText);
} else db_unset(NULL, "Chat", "HeaderTime");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
- DBWriteContactSettingString(NULL, "Chat", "HeaderIncoming", pszText);
+ db_set_s(NULL, "Chat", "HeaderIncoming", pszText);
} else db_unset(NULL, "Chat", "HeaderIncoming");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
- DBWriteContactSettingString(NULL, "Chat", "HeaderOutgoing", pszText);
+ db_set_s(NULL, "Chat", "HeaderOutgoing", pszText);
} else db_unset(NULL, "Chat", "HeaderOutgoing");
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
- DBWriteContactSettingWord(NULL, "Chat", "LogLimit", (WORD)iLen);
+ db_set_w(NULL, "Chat", "LogLimit", (WORD)iLen);
}
if (pszText != NULL)
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index bcd2cc9452..59d4cd646f 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -246,12 +246,12 @@ INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) else
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName);
si->hContact = CList_AddRoom(gcw->pszModule, ptszID, szTemp, si->iType);
- DBWriteContactSettingString(si->hContact, si->pszModule , "Topic", "");
+ db_set_s(si->hContact, si->pszModule , "Topic", "");
db_unset(si->hContact, "CList", "StatusMsg");
if (si->ptszStatusbarText)
M->WriteTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
- DBWriteContactSettingString(si->hContact, si->pszModule, "StatusBar", "");
+ db_set_s(si->hContact, si->pszModule, "StatusBar", "");
if (si->hContact)
Chat_SetFilters(si);
}
@@ -371,7 +371,7 @@ static int DoControl(GCEVENT * gce, WPARAM wp) if (si->ptszStatusbarText)
M->WriteTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
- DBWriteContactSettingString(si->hContact, si->pszModule, "StatusBar", "");
+ db_set_s(si->hContact, si->pszModule, "StatusBar", "");
if (si->hWnd)
SendMessage(si->hWnd, GC_UPDATESTATUSBAR, 0, 0);
}
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index 5e0b679f07..85167448e8 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -607,7 +607,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh params->sound = "ChatMessage";
if (params->bInactive && !(si->wState&STATE_TALK)) {
si->wState |= STATE_TALK;
- DBWriteContactSettingWord(si->hContact, si->pszModule, "ApparentMode", (LPARAM)(WORD) 40071);
+ db_set_w(si->hContact, si->pszModule, "ApparentMode", (LPARAM)(WORD) 40071);
}
break;
case GC_EVENT_ACTION:
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index d424e03f78..46e761e8cf 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -288,7 +288,7 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) if (dat->iTabID >= 0) {
if (db_get_w(si->hContact, si->pszModule , "ApparentMode", 0) != 0)
- DBWriteContactSettingWord(si->hContact, si->pszModule , "ApparentMode", (LPARAM)0);
+ db_set_w(si->hContact, si->pszModule , "ApparentMode", (LPARAM)0);
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString);
@@ -2484,7 +2484,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar si->wState &= ~STATE_TALK;
dat->bWasDeleted = 1;
- DBWriteContactSettingWord(si->hContact, si->pszModule , "ApparentMode", (LPARAM)0);
+ db_set_w(si->hContact, si->pszModule , "ApparentMode", (LPARAM)0);
SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, lParam == 2 ? lParam : 1);
return TRUE;
@@ -3453,7 +3453,7 @@ LABEL_SHOWWINDOW: if (iSelection - IDM_CONTAINERMENU >= 0) {
if (!M->GetTString(NULL, szKey, szIndex, &dbv)) {
SendMessage(hwndDlg, DM_CONTAINERSELECTED, 0, (LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -3735,10 +3735,10 @@ LABEL_SHOWWINDOW: TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
if (!dat->fIsAutosizingInput)
- DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
+ db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
if (dat->pContainer->settings->fPrivate && !IsAutoSplitEnabled(dat))
- DBWriteContactSettingWord(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY);
+ db_set_w(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY);
DM_FreeTheme(dat);
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 74238bb783..d93afc5fbd 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -483,7 +483,7 @@ void CContactCache::updateStatusMsg(const char *szKey) res = M->GetTString(m_hContact, "CList", "StatusMsg", &dbv);
if (res == 0) {
m_szStatusMsg = (lstrlen(dbv.ptszVal) > 0 ? getNormalizedStatusMsg(dbv.ptszVal) : 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
if (szKey == 0 || (szKey && !strcmp("ListeningTo", szKey))) {
@@ -493,7 +493,7 @@ void CContactCache::updateStatusMsg(const char *szKey) res = M->GetTString(m_hContact, m_szProto, "ListeningTo", &dbv);
if (res == 0) {
m_ListeningInfo = (lstrlen(dbv.ptszVal) > 0 ? mir_tstrdup(dbv.ptszVal) : 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
if (szKey == 0 || (szKey && !strcmp("XStatusMsg", szKey))) {
@@ -503,7 +503,7 @@ void CContactCache::updateStatusMsg(const char *szKey) res = M->GetTString(m_hContact, m_szProto, "XStatusMsg", &dbv);
if (res == 0) {
m_xStatusMsg = (lstrlen(dbv.ptszVal) > 0 ? mir_tstrdup(dbv.ptszVal) : 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
m_xStatus = M->GetByte(m_hContact, m_szProto, "XStatusId", 0);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 5e96b41fa4..e5e98c9a44 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -178,7 +178,7 @@ struct TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDL else if (!_tcsncmp(dbv.ptszVal, _T("**free**"), CONTAINER_NAMELEN))
iFirstFree = i;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
while (++i && iFound == FALSE);
@@ -995,7 +995,7 @@ panel_found: if (iSelection - IDM_CONTAINERMENU >= 0) {
if (!M->GetTString(NULL, szKey, szIndex, &dbv)) {
SendMessage((HWND)item.lParam, DM_CONTAINERSELECTED, 0, (LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 1;
@@ -1602,7 +1602,7 @@ panel_found: if (szThemeName != NULL) {
M->pathToAbsolute(szThemeName, pContainer->szAbsThemeFile);
mir_sntprintf(pContainer->szRelThemeFile, MAX_PATH, _T("%s"), szThemeName);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
pContainer->szAbsThemeFile[0] = pContainer->szRelThemeFile[0] = 0;
@@ -2364,7 +2364,7 @@ int TSAPI GetContainerNameForContact(HANDLE hContact, TCHAR *szName, int iNameLe dbv.ptszVal[CONTAINER_NAMELEN] = '\0';
_tcsncpy(szName, dbv.ptszVal, iNameLen);
szName[iNameLen] = '\0';
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return dbv.cchVal;
}
}
@@ -2375,10 +2375,10 @@ int TSAPI GetContainerNameForContact(HANDLE hContact, TCHAR *szName, int iNameLe if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
_tcsncpy(szName, dbv.ptszVal, iNameLen);
szName[iNameLen] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return dbv.cpbVal;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -2405,7 +2405,7 @@ void TSAPI DeleteContainer(int iIndex) TCHAR *wszString = dbv_c.ptszVal;
if (_tcscmp(wszString, wszContainerName) && lstrlen(wszString) == lstrlen(wszContainerName))
db_unset(hhContact, SRMSGMOD_T, "containerW");
- DBFreeVariant(&dbv_c);
+ db_free(&dbv_c);
}
hhContact = db_find_next(hhContact);
}
@@ -2422,7 +2422,7 @@ void TSAPI DeleteContainer(int iIndex) _snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dy", szSettingP, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -2451,11 +2451,11 @@ void TSAPI RenameContainer(int iIndex, const TCHAR *szNew) M->WriteTString(hhContact, SRMSGMOD_T, szSubKey, szNew);
}
}
- DBFreeVariant(&dbv_c);
+ db_free(&dbv_c);
}
hhContact = db_find_next(hhContact);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -2490,7 +2490,7 @@ HMENU TSAPI BuildContainerMenu() AppendMenu(hMenu, MF_STRING, IDM_CONTAINERMENU + i, !_tcscmp(dbv.ptszVal, _T("default")) ?
TranslateT("Default container") : dbv.ptszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
i++;
}
while (TRUE);
@@ -2535,7 +2535,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) for (i=0; i < iNumProtos; i++) {
mir_snprintf(szTemp, sizeof(szTemp), "Protocol%d", i);
- if (DBGetContactSettingString(dat->hContact, PluginConfig.szMetaName, szTemp, &dbv))
+ if (db_get_s(dat->hContact, PluginConfig.szMetaName, szTemp, &dbv))
continue;
tzProtoName = dbv.pszVal;
@@ -2557,7 +2557,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) AppendMenu(hMCSubForce, MF_STRING | iChecked, 100 + i, szMenuLine);
AppendMenu(hMCSubDefault, MF_STRING | (i == iDefaultProtoByNum ? MF_CHECKED : MF_UNCHECKED), 1000 + i, szMenuLine);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
AppendMenu(hMCSubForce, MF_SEPARATOR, 900, _T(""));
AppendMenu(hMCSubForce, MF_STRING | ((isForced == -1) ? MF_CHECKED : MF_UNCHECKED), 999, TranslateT("Autoselect"));
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index d4be6530a2..eff180cab9 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -1138,7 +1138,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR tooltip_active = TRUE;
CallService(szTTService, (WPARAM)dbv.ptszVal, (LPARAM)&ti);
if (dbv.pszVal)
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index ee0bd16407..7173c598a9 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -393,7 +393,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa }
M->WriteByte("Chat", "PopupStyle", (BYTE)g_Settings.iPopupStyle);
- DBWriteContactSettingWord(NULL, "Chat", "PopupTimeout", g_Settings.iPopupTimeout);
+ db_set_w(NULL, "Chat", "PopupTimeout", g_Settings.iPopupTimeout);
g_Settings.crPUBkgColour = SendDlgItemMessage(hWnd, IDC_COLBACK_MUC, CPM_GETCOLOUR, 0, 0);
M->WriteDword("Chat", "PopupColorBG", (DWORD)g_Settings.crPUBkgColour);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 5cad2d5e0b..402301a9ff 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -434,11 +434,11 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, switch(iSelection) {
case ID_FAVORITES_ADDCONTACTTOFAVORITES:
- DBWriteContactSettingByte(dat->hContact, SRMSGMOD_T, "isFavorite", 1);
+ db_set_b(dat->hContact, SRMSGMOD_T, "isFavorite", 1);
AddContactToFavorites(dat->hContact, dat->cache->getNick(), dat->cache->getActiveProto(), dat->szStatus, dat->wStatus, LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 1, PluginConfig.g_hMenuFavorites);
break;
case ID_FAVORITES_REMOVECONTACTFROMFAVORITES:
- DBWriteContactSettingByte(dat->hContact, SRMSGMOD_T, "isFavorite", 0);
+ db_set_b(dat->hContact, SRMSGMOD_T, "isFavorite", 0);
DeleteMenu(PluginConfig.g_hMenuFavorites, (UINT_PTR)dat->hContact, MF_BYCOMMAND);
break;
}
@@ -1021,9 +1021,9 @@ void TSAPI DM_SetDBButtonStates(HWND hwndChild, struct TWindowData *dat) if (buttonItem->type == DBVT_ASCIIZ) {
DBVARIANT dbv = {0};
- if (!DBGetContactSettingString(hFinalContact, szModule, szSetting, &dbv)) {
+ if (!db_get_s(hFinalContact, szModule, szSetting, &dbv)) {
result = !strcmp((char *)buttonItem->bValuePush, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else {
switch (buttonItem->type) {
@@ -1098,7 +1098,7 @@ static void LoadKLThread(LPVOID vParam) if (res == 0) {
HKL hkl = LoadKeyboardLayout(dbv.ptszVal, 0);
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_SETLOCALE, (WPARAM)hContact, (LPARAM)hkl);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -1111,8 +1111,8 @@ void TSAPI DM_LoadLocale(TWindowData *dat) return;
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(dat->hContact, SRMSGMOD_T, "locale", &dbv))
- DBFreeVariant(&dbv);
+ if ( !db_get_ts(dat->hContact, SRMSGMOD_T, "locale", &dbv))
+ db_free(&dbv);
else {
TCHAR szKLName[KL_NAMELENGTH+1];
if (!PluginConfig.m_dontUseDefaultKbd) {
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 2c13a771a2..7a3a1b0bde 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -471,7 +471,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP DBVARIANT dbv;
if (0 == M->GetTString(hContact, SRMSGMOD_T, "locale", &dbv)) {
GetLocaleID(dat, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
UpdateReadChars(dat);
}
}
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 771a8a3e53..5ec1268110 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -511,12 +511,12 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem) }
else _tcscpy_s (szBuf, 256, tszUin);
- if(M->GetByte("ShowClientDescription",1)) {
+ if (M->GetByte("ShowClientDescription",1)) {
TCHAR temp[256];
DBVARIANT dbv = {0};
if ( !M->GetTString(m_dat->cache->getActiveContact(), m_dat->cache->getActiveProto(), "MirVer", &dbv)) {
mir_sntprintf(temp, SIZEOF(temp), TranslateT(" Client: %s"), dbv.ptszVal);
- ::DBFreeVariant(&dbv);
+ ::db_free(&dbv);
}
else mir_sntprintf(temp, SIZEOF(temp), TranslateT(" Client not cached yet"));
_tcscat_s(szBuf, 256, temp);
@@ -957,7 +957,7 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam) if (0 == M->GetTString(m_dat->cache->getActiveContact(), m_dat->cache->getActiveProto(), "MirVer", &dbv)) {
mir_sntprintf(temp, 1024, TranslateT("\\par\\par\\ul\\b Client:\\ul0\\b0 %s"), dbv.ptszVal);
- ::DBFreeVariant(&dbv);
+ ::db_free(&dbv);
str->append(temp);
}
str->append(_T("}"));
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index cc067fd278..cc3ee55392 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -82,7 +82,7 @@ void CMimAPI::timerMsg(const char *szMsg) DWORD CMimAPI::GetDword(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD uDefault = 0) const
{
- return((DWORD)DBGetContactSettingDword(hContact, szModule, szSetting, uDefault));
+ return((DWORD)db_get_dw(hContact, szModule, szSetting, uDefault));
}
/*
@@ -91,7 +91,7 @@ DWORD CMimAPI::GetDword(const HANDLE hContact = 0, const char *szModule = 0, con DWORD CMimAPI::GetDword(const char *szSetting = 0, DWORD uDefault = 0) const
{
- return((DWORD)DBGetContactSettingDword(0, SRMSGMOD_T, szSetting, uDefault));
+ return((DWORD)db_get_dw(0, SRMSGMOD_T, szSetting, uDefault));
}
/*
@@ -100,7 +100,7 @@ DWORD CMimAPI::GetDword(const char *szSetting = 0, DWORD uDefault = 0) const DWORD CMimAPI::GetDword(const HANDLE hContact = 0, const char *szSetting = 0, DWORD uDefault = 0) const
{
- return((DWORD)DBGetContactSettingDword(hContact, SRMSGMOD_T, szSetting, uDefault));
+ return((DWORD)db_get_dw(hContact, SRMSGMOD_T, szSetting, uDefault));
}
/*
@@ -109,7 +109,7 @@ DWORD CMimAPI::GetDword(const HANDLE hContact = 0, const char *szSetting = 0, DW DWORD CMimAPI::GetDword(const char *szModule, const char *szSetting, DWORD uDefault) const
{
- return((DWORD)DBGetContactSettingDword(0, szModule, szSetting, uDefault));
+ return((DWORD)db_get_dw(0, szModule, szSetting, uDefault));
}
/*
@@ -117,32 +117,32 @@ DWORD CMimAPI::GetDword(const char *szModule, const char *szSetting, DWORD uDefa */
int CMimAPI::GetByte(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, int uDefault = 0) const
{
- return(DBGetContactSettingByte(hContact, szModule, szSetting, uDefault));
+ return(db_get_b(hContact, szModule, szSetting, uDefault));
}
int CMimAPI::GetByte(const char *szSetting = 0, int uDefault = 0) const
{
- return(DBGetContactSettingByte(0, SRMSGMOD_T, szSetting, uDefault));
+ return(db_get_b(0, SRMSGMOD_T, szSetting, uDefault));
}
int CMimAPI::GetByte(const HANDLE hContact = 0, const char *szSetting = 0, int uDefault = 0) const
{
- return(DBGetContactSettingByte(hContact, SRMSGMOD_T, szSetting, uDefault));
+ return(db_get_b(hContact, SRMSGMOD_T, szSetting, uDefault));
}
int CMimAPI::GetByte(const char *szModule, const char *szSetting, int uDefault) const
{
- return(DBGetContactSettingByte(0, szModule, szSetting, uDefault));
+ return(db_get_b(0, szModule, szSetting, uDefault));
}
INT_PTR CMimAPI::GetTString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) const
{
- return(DBGetContactSettingTString(hContact, szModule, szSetting, dbv));
+ return(db_get_ts(hContact, szModule, szSetting, dbv));
}
INT_PTR CMimAPI::GetString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) const
{
- return(DBGetContactSettingString(hContact, szModule, szSetting, dbv));
+ return(db_get_s(hContact, szModule, szSetting, dbv));
}
/*
@@ -151,7 +151,7 @@ INT_PTR CMimAPI::GetString(const HANDLE hContact, const char *szModule, const ch INT_PTR CMimAPI::WriteDword(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD value = 0) const
{
- return(DBWriteContactSettingDword(hContact, szModule, szSetting, value));
+ return(db_set_dw(hContact, szModule, szSetting, value));
}
/*
@@ -160,22 +160,22 @@ INT_PTR CMimAPI::WriteDword(const HANDLE hContact = 0, const char *szModule = 0, INT_PTR CMimAPI::WriteDword(const char *szModule = 0, const char *szSetting = 0, DWORD value = 0) const
{
- return(DBWriteContactSettingDword(0, szModule, szSetting, value));
+ return(db_set_dw(0, szModule, szSetting, value));
}
INT_PTR CMimAPI::WriteByte(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, BYTE value = 0) const
{
- return(DBWriteContactSettingByte(hContact, szModule, szSetting, value));
+ return(db_set_b(hContact, szModule, szSetting, value));
}
INT_PTR CMimAPI::WriteByte(const char *szModule = 0, const char *szSetting = 0, BYTE value = 0) const
{
- return(DBWriteContactSettingByte(0, szModule, szSetting, value));
+ return(db_set_b(0, szModule, szSetting, value));
}
INT_PTR CMimAPI::WriteTString(const HANDLE hContact, const char *szModule = 0, const char *szSetting = 0, const TCHAR *str = 0) const
{
- return(DBWriteContactSettingTString(hContact, szModule, szSetting, str));
+ return(db_set_ts(hContact, szModule, szSetting, str));
}
/**
diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index f3430b4f28..aade81051f 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -59,9 +59,9 @@ static char* getMirVer(HANDLE hContact) if ( !szProto )
return (NULL);
- if ( !DBGetContactSettingString(hContact, szProto, "MirVer", &dbv)) {
+ if ( !db_get_s(hContact, szProto, "MirVer", &dbv)) {
msg=mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return (msg);
}
@@ -74,7 +74,7 @@ static TCHAR* getMenuEntry(int i) { mir_snprintf(MEntry, 255, "MenuEntry_%u", i);
if ( !M->GetTString(NULL, "tabmodplus",MEntry, &dbv)) {
msg = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return (msg);
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 10c5b6fbbb..eafbe66f2c 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1504,12 +1504,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP */
if (dat->hContact) {
DBVARIANT dbv;
- if (!DBGetContactSettingString(dat->hContact, SRMSGMOD, "SavedMsg", &dbv)) {
+ if (!db_get_s(dat->hContact, SRMSGMOD, "SavedMsg", &dbv)) {
SETTEXTEX stx = {ST_DEFAULT, CP_UTF8};
if (dbv.type == DBVT_ASCIIZ && lstrlenA(dbv.pszVal) > 0)
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SendQueue::UpdateSaveAndSendButton(dat);
if (m_pContainer->hwndActive == hwndDlg)
UpdateReadChars(dat);
@@ -2891,7 +2891,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (iSelection - IDM_CONTAINERMENU >= 0) {
if (!M->GetTString(NULL, szKey, szIndex, &dbv)) {
SendMessage(hwndDlg, DM_CONTAINERSELECTED, 0, (LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -3655,10 +3655,10 @@ quote_from_last: if (!dat->fEditNotesActive) {
char *msg = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat, (CP_UTF8 << 16) | (SF_TEXT | SF_USECODEPAGE));
if (msg) {
- DBWriteContactSettingString(dat->hContact, SRMSGMOD, "SavedMsg", msg);
+ db_set_s(dat->hContact, SRMSGMOD, "SavedMsg", msg);
free(msg);
} else
- DBWriteContactSettingString(dat->hContact, SRMSGMOD, "SavedMsg", "");
+ db_set_s(dat->hContact, SRMSGMOD, "SavedMsg", "");
}
else
SendMessage(hwndDlg, WM_COMMAND, IDC_PIC, 0);
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index c6ba4665cf..3193b37a21 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -864,7 +864,7 @@ void TSAPI ShowPicture(TWindowData *dat, BOOL showNewPic) AdjustBottomAvatarDisplay(dat);
} else {
dat->showPic = dat->showPic ? 0 : 1;
- DBWriteContactSettingByte(dat->hContact, SRMSGMOD_T, "MOD_ShowPic", (BYTE)dat->showPic);
+ db_set_b(dat->hContact, SRMSGMOD_T, "MOD_ShowPic", (BYTE)dat->showPic);
}
GetWindowRect(GetDlgItem(hwndDlg, IDC_CONTACTPIC), &rc);
if (dat->minEditBoxSize.cy + DPISCALEY_S(3)> dat->splitterY)
@@ -2191,9 +2191,9 @@ void TSAPI GetClientIcon(TWindowData *dat) dat->hClientIcon = 0;
if (ServiceExists(MS_FP_GETCLIENTICON)) {
- if (!DBGetContactSettingString(dat->cache->getActiveContact(), dat->cache->getActiveProto(), "MirVer", &dbv)) {
+ if (!db_get_s(dat->cache->getActiveContact(), dat->cache->getActiveProto(), "MirVer", &dbv)) {
dat->hClientIcon = (HICON)CallService(MS_FP_GETCLIENTICON, (WPARAM)dbv.pszVal, 1);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 4392e11dc6..419863cb75 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -200,7 +200,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox) }
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -421,7 +421,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP TVINSERTSTRUCT tvi = {0};
int i;
- DWORD dwFlags = DBGetContactSettingDword(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
+ DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_WINDOWOPTIONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_WINDOWOPTIONS), GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES));
@@ -779,8 +779,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
else
M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
M->WriteDword(SRMSGMOD_T, "IndentAmount", (DWORD) GetDlgItemInt(hwndDlg, IDC_INDENTAMOUNT, &translated, FALSE));
M->WriteDword(SRMSGMOD_T, "RightIndent", (DWORD) GetDlgItemInt(hwndDlg, IDC_RIGHTINDENT, &translated, FALSE));
@@ -885,7 +885,7 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem) {
- DBWriteContactSettingByte(hContact, SRMSGMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0) ? 1 : 0));
+ db_set_b(hContact, SRMSGMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0) ? 1 : 0));
}
} while (hContact = db_find_next(hContact));
}
@@ -1120,7 +1120,7 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar case PSN_APPLY: {
TVITEM item = {0};
M->WriteByte(SRMSGMOD_T, "cuttitle", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE));
- DBWriteContactSettingWord(NULL, SRMSGMOD_T, "cut_at", (WORD)SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMSGMOD_T, "cut_at", (WORD)SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_GETPOS, 0, 0));
/*
* scan the tree view and obtain the options...
@@ -1441,7 +1441,7 @@ void OptCheckBox_Save(HWND hwnd, struct OptCheckBox *cb) M->WriteByte(cb->dbModule, cb->dbSetting, (BYTE)value);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(NULL, cb->dbModule, cb->dbSetting, (WORD)value);
+ db_set_w(NULL, cb->dbModule, cb->dbSetting, (WORD)value);
break;
case DBVT_DWORD:
M->WriteDword(cb->dbModule, cb->dbSetting, (DWORD)value);
@@ -1590,8 +1590,8 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
else
M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM))
M->WriteDword(SRMSGMOD_T, "maxhist", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_GETPOS, 0, 0));
diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index eb6c66f1ad..6936dc4d1b 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -198,7 +198,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (iItemNew != LB_ERR)
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_SETITEMDATA, (WPARAM)iItemNew, (LPARAM)iCounter);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} while (++iCounter);
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 5b740bb503..596ce729d3 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -328,7 +328,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) }
if (szSetting[0] == 'S') {
- if (0 == DBGetContactSettingString(hContact, "SendLater", szSetting, &dbv))
+ if (0 == db_get_s(hContact, "SendLater", szSetting, &dbv))
szOrig_Utf = dbv.pszVal;
else
return 0;
@@ -378,7 +378,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) wcsncpy((wchar_t *)&job->pBuf[iLen + 1], szWchar, lstrlenW(szWchar));
if (szSetting[0] == 'S')
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_free(szWchar);
job->readFlags();
@@ -711,7 +711,7 @@ void CSendLater::qMgrSetupColumns() if (0 == M->GetString(0, SRMSGMOD_T, "qmgrListColumns", &dbv)) {
sscanf(dbv.pszVal, szColFormat, &nWidths[0], &nWidths[1], &nWidths[2], &nWidths[3], &nWidths[4]);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
sscanf(szColDefault, szColFormat, &nWidths[0], &nWidths[1], &nWidths[2], &nWidths[3], &nWidths[4]);
@@ -755,7 +755,7 @@ void CSendLater::qMgrSaveColumns() nWidths[i] = max(col.cx, 10);
}
mir_snprintf(szColFormatNew, 100, "%d;%d;%d;%d;%d", nWidths[0], nWidths[1], nWidths[2], nWidths[3], nWidths[4]);
- ::DBWriteContactSettingString(0, SRMSGMOD_T, "qmgrListColumns", szColFormatNew);
+ ::db_set_s(0, SRMSGMOD_T, "qmgrListColumns", szColFormatNew);
}
INT_PTR CALLBACK CSendLater::DlgProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 530a53dc0b..fdfda626b7 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -174,7 +174,7 @@ static int SendChunkW(WCHAR *chunk, HANDLE hContact, char *szSvc, DWORD dwFlags) BYTE *pBuf = NULL;
int wLen = lstrlenW(chunk), id;
DWORD memRequired = (wLen + 1) * sizeof(WCHAR);
- DWORD codePage = DBGetContactSettingDword(hContact, SRMSGMOD_T, "ANSIcodepage", CP_ACP);
+ DWORD codePage = db_get_dw(hContact, SRMSGMOD_T, "ANSIcodepage", CP_ACP);
int mbcsSize = WideCharToMultiByte(codePage, 0, chunk, -1, (char *)pBuf, 0, 0, 0);
memRequired += mbcsSize;
@@ -942,7 +942,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, HANDLE hContact, boo if (fIsSendLater) {
mir_snprintf(tszMsg, required, "%s%s", job->sendBuffer, utf_header);
- DBWriteContactSettingString(hContact ? hContact : job->hOwner, "SendLater", szKeyName, tszMsg);
+ db_set_s(hContact ? hContact : job->hOwner, "SendLater", szKeyName, tszMsg);
}
else {
mir_snprintf(tszMsg, required, "%s%s", utf_header, job->sendBuffer);
@@ -964,7 +964,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, HANDLE hContact, boo mir_sntprintf(tszMsg, required, _T("%s%s"), tszHeader, wszMsg);
char *utf = mir_utf8encodeT(tszMsg);
if (fIsSendLater)
- DBWriteContactSettingString(hContact ? hContact : job->hOwner, "SendLater", szKeyName, utf);
+ db_set_s(hContact ? hContact : job->hOwner, "SendLater", szKeyName, utf);
else
sendLater->addJob(utf, (LPARAM)hContact);
mir_free(utf);
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 1cb01dccb5..215be250c6 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -91,7 +91,7 @@ static void LoadTemplatesFrom(TTemplateSet *tSet, HANDLE hContact, int rtl) continue;
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR)
mir_sntprintf(tSet->szTemplates[i], TEMPLATE_LENGTH, _T("%s"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index 0a0d32197a..8165b5432d 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -194,9 +194,9 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, struct TWindowData *dat) for (i=0; i < fontBlocks[n].iCount; i++) {
sprintf(szTemp, "Font%d", firstIndex + i);
sprintf(szAppname, fontBlocks[n].szIniTemp, firstIndex + i);
- if (!DBGetContactSettingString(NULL, szModule, szTemp, &dbv)) {
+ if (!db_get_s(NULL, szModule, szTemp, &dbv)) {
WritePrivateProfileStringA(szAppname, "Face", dbv.pszVal, szIniFilename);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
sprintf(szTemp, "Font%dCol", firstIndex + i);
WritePrivateProfileStringA(szAppname, "Color", _itoa(M->GetDword(szModule, szTemp, 0), szBuf, 10), szIniFilename);
@@ -288,7 +288,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in if (GetPrivateProfileStringA(szAppname, "Face", "Verdana", szBuf, sizeof(szBuf), szIniFilename) != 0) {
if (i == MSGFONTID_SYMBOLS_IN || i == MSGFONTID_SYMBOLS_OUT)
lstrcpynA(szBuf, "Arial", sizeof(szBuf));
- DBWriteContactSettingString(NULL, szModule, szTemp, szBuf);
+ db_set_s(NULL, szModule, szTemp, szBuf);
}
sprintf(szTemp, "Font%dCol", firstIndex + i);
@@ -398,7 +398,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in if (strcmp(szTemplateBuffer, "[undef]")) {
if (dat == 0)
- DBWriteContactSettingStringUtf(NULL, TEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer);
+ db_set_utf(NULL, TEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer);
decoded = mir_utf8decodeW(szTemplateBuffer);
if (dat == 0)
mir_sntprintf(LTR_Active.szTemplates[i], TEMPLATE_LENGTH, L"%s", decoded);
@@ -411,7 +411,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in if (strcmp(szTemplateBuffer, "[undef]")) {
if (dat == 0)
- DBWriteContactSettingStringUtf(NULL, RTLTEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer);
+ db_set_utf(NULL, RTLTEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer);
decoded = mir_utf8decodeW(szTemplateBuffer);
if (dat == 0)
mir_sntprintf(RTL_Active.szTemplates[i], TEMPLATE_LENGTH, L"%s", decoded);
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 8d828a3910..09ed80222b 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1050,7 +1050,7 @@ void CSkin::setFileName() if (0 == M->GetTString(0, SRMSGMOD_T, "ContainerSkin", &dbv)) {
M->pathToAbsolute(dbv.ptszVal, m_tszFileName, M->getSkinPath());
m_tszFileName[MAX_PATH - 1] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
m_tszFileName[0] = 0;
@@ -1430,7 +1430,7 @@ void CSkin::Load(void) M->WriteDword(SRMSGMOD_T, _tagSettings[i].szSetting, data);
break;
case 2:
- DBWriteContactSettingWord(NULL, SRMSGMOD_T, _tagSettings[i].szSetting, (WORD)data);
+ db_set_w(NULL, SRMSGMOD_T, _tagSettings[i].szSetting, (WORD)data);
break;
case 5:
GetPrivateProfileString(_tagSettings[i].szIniKey, _tagSettings[i].szIniName, _T("000000"),
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 7248588213..d572cafc2a 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -409,7 +409,7 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat if (!M->GetTString(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
_tcsncpy(szTemp, dbv.ptszVal, 500);
szTemp[500] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
title.insert(tempmark + 2, szTemp);
curpos = tempmark + lstrlen(szTemp);
}
@@ -431,7 +431,7 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat if (!M->GetTString(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
_tcsncpy(szTemp, dbv.ptszVal, 500);
szTemp[500] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
title.insert(tempmark + 2, szTemp);
} else
szFinalStatus = xStatusDescr[xStatus - 1];
@@ -721,16 +721,16 @@ int Utils::ReadContainerSettingsFromDB(const HANDLE hContact, TContainerSettings CopyMemory(cs, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings));
- if (0 == DBGetContactSetting(hContact, SRMSGMOD_T, szKey ? szKey : CNT_KEYNAME, &dbv)) {
+ if (0 == db_get(hContact, SRMSGMOD_T, szKey ? szKey : CNT_KEYNAME, &dbv)) {
if (dbv.type == DBVT_BLOB && dbv.cpbVal > 0 && dbv.cpbVal <= sizeof(TContainerSettings)) {
::CopyMemory((void*)cs, (void*)dbv.pbVal, dbv.cpbVal);
- ::DBFreeVariant(&dbv);
+ ::db_free(&dbv);
if (hContact == 0 && szKey == 0)
cs->fPrivate = false;
return 0;
}
cs->fPrivate = false;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
else {
diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index f0a52cdc9a..8029b04782 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -58,7 +58,7 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) if (opt.bWaitForStatusMsg && !bStatusMsgReady)
{
- DBDeleteContactSetting(clcitex->hItem, MODULE, "TempStatusMsg");
+ db_unset(clcitex->hItem, MODULE, "TempStatusMsg");
if (CanRetrieveStatusMsg(clcitex->hItem, szProto) &&
CallContactService(clcitex->hItem, PSS_GETAWAYMSG, 0, 0))
{
@@ -74,7 +74,7 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) CallProtoService(szProto, PS_GETAVATARCAPS, AF_ENABLED, 0))
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(clcitex->hItem, "ContactPhoto", "File", &dbv))
+ if (!db_get_s(clcitex->hItem, "ContactPhoto", "File", &dbv))
{
if (!strstr(dbv.pszVal, ".xml"))
{
@@ -93,7 +93,7 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) else
bAvatarReady = true;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
bAvatarReady = true;
@@ -176,7 +176,7 @@ unsigned int CALLBACK MessagePumpThread(void *param) if (swzMsg)
{
- DBWriteContactSettingTString(clcitex->hItem, MODULE, "TempStatusMsg", swzMsg);
+ db_set_ts(clcitex->hItem, MODULE, "TempStatusMsg", swzMsg);
mir_free(swzMsg);
}
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index ed38a434ca..383770067c 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -36,10 +36,10 @@ extern int IsTrayProto(const TCHAR *swzProto, BOOL bExtendedTip) DBVARIANT dbv;
int result = 1;
- if (!DBGetContactSettingTString(NULL, MODULE, szSetting, &dbv))
+ if (!db_get_ts(NULL, MODULE, szSetting, &dbv))
{
result = _tcsstr(dbv.ptszVal, swzProto) ? 1 : 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return result;
@@ -106,43 +106,43 @@ bool LoadDS(DISPLAYSUBST *ds, int index) mir_snprintf(setting, SIZEOF(setting), "Name%d", index);
ds->swzName[0] = 0;
- if (!DBGetContactSettingTString(0, MODULE_ITEMS, setting, &dbv))
+ if (!db_get_ts(0, MODULE_ITEMS, setting, &dbv))
{
_tcsncpy(ds->swzName, dbv.ptszVal, SIZEOF(ds->swzName));
ds->swzName[SIZEOF(ds->swzName) - 1] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
return false;
mir_snprintf(setting, SIZEOF(setting), "Type%d", index);
- ds->type = (DisplaySubstType)DBGetContactSettingByte(0, MODULE_ITEMS, setting, DVT_PROTODB);
+ ds->type = (DisplaySubstType)db_get_b(0, MODULE_ITEMS, setting, DVT_PROTODB);
mir_snprintf(setting, SIZEOF(setting), "Module%d", index);
ds->szModuleName[0] = 0;
- if (!DBGetContactSetting(0, MODULE_ITEMS, setting, &dbv))
+ if (!db_get(0, MODULE_ITEMS, setting, &dbv))
{
strncpy(ds->szModuleName, dbv.pszVal, MODULE_NAME_LEN);
ds->szModuleName[MODULE_NAME_LEN - 1] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
mir_snprintf(setting, SIZEOF(setting), "Setting%d", index);
ds->szSettingName[0] = 0;
- if (!DBGetContactSetting(0, MODULE_ITEMS, setting, &dbv))
+ if (!db_get(0, MODULE_ITEMS, setting, &dbv))
{
strncpy(ds->szSettingName, dbv.pszVal, SETTING_NAME_LEN);
ds->szSettingName[SETTING_NAME_LEN - 1] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
mir_snprintf(setting, SIZEOF(setting), "TransFuncId%d", index);
- ds->iTranslateFuncId = DBGetContactSettingDword(0, MODULE_ITEMS, setting, (DWORD)-1);
+ ds->iTranslateFuncId = db_get_dw(0, MODULE_ITEMS, setting, (DWORD)-1);
// a little backward compatibility
if ((DWORD)ds->iTranslateFuncId == (DWORD)-1)
{
mir_snprintf(setting, SIZEOF(setting), "TransFunc%d", index);
- ds->iTranslateFuncId = (DWORD)DBGetContactSettingWord(0, MODULE_ITEMS, setting, 0);
+ ds->iTranslateFuncId = (DWORD)db_get_w(0, MODULE_ITEMS, setting, 0);
}
return true;
@@ -154,15 +154,15 @@ void SaveDS(DISPLAYSUBST *ds, int index) char setting[512];
mir_snprintf(setting, SIZEOF(setting), "Name%d", index);
- DBWriteContactSettingTString(0, MODULE_ITEMS, setting, ds->swzName);
+ db_set_ts(0, MODULE_ITEMS, setting, ds->swzName);
mir_snprintf(setting, SIZEOF(setting), "Type%d", index);
- DBWriteContactSettingByte(0, MODULE_ITEMS, setting, (BYTE)ds->type);
+ db_set_b(0, MODULE_ITEMS, setting, (BYTE)ds->type);
mir_snprintf(setting, SIZEOF(setting), "Module%d", index);
- DBWriteContactSettingString(0, MODULE_ITEMS, setting, ds->szModuleName);
+ db_set_s(0, MODULE_ITEMS, setting, ds->szModuleName);
mir_snprintf(setting, SIZEOF(setting), "Setting%d", index);
- DBWriteContactSettingString(0, MODULE_ITEMS, setting, ds->szSettingName);
+ db_set_s(0, MODULE_ITEMS, setting, ds->szSettingName);
mir_snprintf(setting, SIZEOF(setting), "TransFuncId%d", index);
- DBWriteContactSettingDword(0, MODULE_ITEMS, setting, (WORD)ds->iTranslateFuncId);
+ db_set_dw(0, MODULE_ITEMS, setting, (WORD)ds->iTranslateFuncId);
}
@@ -173,31 +173,31 @@ bool LoadDI(DISPLAYITEM *di, int index) mir_snprintf(setting, SIZEOF(setting), "DILabel%d", index);
di->swzLabel[0] = 0;
- if (!DBGetContactSettingTString(0, MODULE_ITEMS, setting, &dbv))
+ if (!db_get_ts(0, MODULE_ITEMS, setting, &dbv))
{
_tcsncpy( di->swzLabel, dbv.ptszVal, SIZEOF(di->swzLabel));
di->swzLabel[SIZEOF(di->swzLabel) - 1] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
return false;
mir_snprintf(setting, SIZEOF(setting), "DIValue%d", index);
di->swzValue[0] = 0;
- if (!DBGetContactSettingTString(0, MODULE_ITEMS, setting, &dbv))
+ if (!db_get_ts(0, MODULE_ITEMS, setting, &dbv))
{
_tcsncpy(di->swzValue, dbv.ptszVal, SIZEOF(di->swzValue));
di->swzValue[SIZEOF(di->swzValue) - 1] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
mir_snprintf(setting, SIZEOF(setting), "DILineAbove%d", index);
- di->bLineAbove = (DBGetContactSettingByte(0, MODULE_ITEMS, setting, 0) == 1);
+ di->bLineAbove = (db_get_b(0, MODULE_ITEMS, setting, 0) == 1);
mir_snprintf(setting, SIZEOF(setting), "DIValNewline%d", index);
- di->bValueNewline = (DBGetContactSettingByte(0, MODULE_ITEMS, setting, 0) == 1);
+ di->bValueNewline = (db_get_b(0, MODULE_ITEMS, setting, 0) == 1);
mir_snprintf(setting, SIZEOF(setting), "DIVisible%d", index);
- di->bIsVisible = (DBGetContactSettingByte(0, MODULE_ITEMS, setting, 1) == 1);
+ di->bIsVisible = (db_get_b(0, MODULE_ITEMS, setting, 1) == 1);
mir_snprintf(setting, SIZEOF(setting), "DITipperVarsFirst%d", index);
- di->bParseTipperVarsFirst = (DBGetContactSettingByte(0, MODULE_ITEMS, setting, 0) == 1);
+ di->bParseTipperVarsFirst = (db_get_b(0, MODULE_ITEMS, setting, 0) == 1);
return true;
}
@@ -208,70 +208,70 @@ void SaveDI(DISPLAYITEM *di, int index) char setting[512];
mir_snprintf(setting, SIZEOF(setting), "DILabel%d", index);
- if (DBWriteContactSettingTString(0, MODULE_ITEMS, setting, di->swzLabel))
+ if (db_set_ts(0, MODULE_ITEMS, setting, di->swzLabel))
{
char buff[LABEL_LEN];
t2a(di->swzLabel, buff, LABEL_LEN);
- DBWriteContactSettingString(0, MODULE_ITEMS, setting, buff);
+ db_set_s(0, MODULE_ITEMS, setting, buff);
}
mir_snprintf(setting, SIZEOF(setting), "DIValue%d", index);
- if (DBWriteContactSettingTString(0, MODULE_ITEMS, setting, di->swzValue))
+ if (db_set_ts(0, MODULE_ITEMS, setting, di->swzValue))
{
char buff[VALUE_LEN];
t2a(di->swzValue, buff, VALUE_LEN);
- DBWriteContactSettingString(0, MODULE_ITEMS, setting, buff);
+ db_set_s(0, MODULE_ITEMS, setting, buff);
}
mir_snprintf(setting, SIZEOF(setting), "DILineAbove%d", index);
- DBWriteContactSettingByte(0, MODULE_ITEMS, setting, di->bLineAbove ? 1 : 0);
+ db_set_b(0, MODULE_ITEMS, setting, di->bLineAbove ? 1 : 0);
mir_snprintf(setting, SIZEOF(setting), "DIValNewline%d", index);
- DBWriteContactSettingByte(0, MODULE_ITEMS, setting, di->bValueNewline ? 1 : 0);
+ db_set_b(0, MODULE_ITEMS, setting, di->bValueNewline ? 1 : 0);
mir_snprintf(setting, SIZEOF(setting), "DIVisible%d", index);
- DBWriteContactSettingByte(0, MODULE_ITEMS, setting, di->bIsVisible ? 1 : 0);
+ db_set_b(0, MODULE_ITEMS, setting, di->bIsVisible ? 1 : 0);
mir_snprintf(setting, SIZEOF(setting), "DITipperVarsFirst%d", index);
- DBWriteContactSettingByte(0, MODULE_ITEMS, setting, di->bParseTipperVarsFirst ? 1 : 0);
+ db_set_b(0, MODULE_ITEMS, setting, di->bParseTipperVarsFirst ? 1 : 0);
}
void SaveOptions()
{
- DBWriteContactSettingDword(0, MODULE, "MaxWidth", opt.iWinWidth);
- DBWriteContactSettingDword(0, MODULE, "MaxHeight", opt.iWinMaxHeight);
- DBWriteContactSettingByte(0, MODULE, "AvatarOpacity", (BYTE)opt.iAvatarOpacity);
- DBWriteContactSettingByte(0, MODULE, "AvatarRoundCorners", (opt.bAvatarRound ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "TitleLayout", (BYTE)opt.titleLayout);
+ db_set_dw(0, MODULE, "MaxWidth", opt.iWinWidth);
+ db_set_dw(0, MODULE, "MaxHeight", opt.iWinMaxHeight);
+ db_set_b(0, MODULE, "AvatarOpacity", (BYTE)opt.iAvatarOpacity);
+ db_set_b(0, MODULE, "AvatarRoundCorners", (opt.bAvatarRound ? 1 : 0));
+ db_set_b(0, MODULE, "TitleLayout", (BYTE)opt.titleLayout);
if (ServiceExists(MS_AV_DRAWAVATAR))
- DBWriteContactSettingByte(0, MODULE, "AVLayout", (BYTE)opt.avatarLayout);
+ db_set_b(0, MODULE, "AVLayout", (BYTE)opt.avatarLayout);
opt.bWaitForAvatar = (opt.avatarLayout == PAV_NONE) ? false : true;
- DBWriteContactSettingDword(0, MODULE, "AVSize", opt.iAvatarSize);
- DBWriteContactSettingDword(0, MODULE, "TextIndent", opt.iTextIndent);
- DBWriteContactSettingDword(0, MODULE, "TitleIndent", opt.iTitleIndent);
- DBWriteContactSettingDword(0, MODULE, "ValueIndent", opt.iValueIndent);
- DBWriteContactSettingByte(0, MODULE, "ShowNoFocus", (opt.bShowNoFocus ? 1 : 0));
+ db_set_dw(0, MODULE, "AVSize", opt.iAvatarSize);
+ db_set_dw(0, MODULE, "TextIndent", opt.iTextIndent);
+ db_set_dw(0, MODULE, "TitleIndent", opt.iTitleIndent);
+ db_set_dw(0, MODULE, "ValueIndent", opt.iValueIndent);
+ db_set_b(0, MODULE, "ShowNoFocus", (opt.bShowNoFocus ? 1 : 0));
- DBWriteContactSettingWord(0, MODULE, "TimeIn", opt.iTimeIn);
+ db_set_w(0, MODULE, "TimeIn", opt.iTimeIn);
CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);
- DBWriteContactSettingWord(0, MODULE, "Padding", opt.iPadding);
- DBWriteContactSettingWord(0, MODULE, "OuterAvatarPadding", opt.iOuterAvatarPadding);
- DBWriteContactSettingWord(0, MODULE, "InnerAvatarPadding", opt.iInnerAvatarPadding);
- DBWriteContactSettingWord(0, MODULE, "TextPadding", opt.iTextPadding);
- DBWriteContactSettingByte(0, MODULE, "Position", (BYTE)opt.pos);
- DBWriteContactSettingDword(0, MODULE, "MinWidth", (DWORD)opt.iMinWidth);
- DBWriteContactSettingDword(0, MODULE, "MinHeight", (DWORD)opt.iMinHeight);
- DBWriteContactSettingDword(0, MODULE, "SidebarWidth", (DWORD)opt.iSidebarWidth);
- DBWriteContactSettingByte(0, MODULE, "MouseTollerance", (BYTE)opt.iMouseTollerance);
- DBWriteContactSettingByte(0, MODULE, "SBarTips", (opt.bStatusBarTips ? 1 : 0));
-
- DBWriteContactSettingWord(0, MODULE, "LabelVAlign", opt.iLabelValign);
- DBWriteContactSettingWord(0, MODULE, "LabelHAlign", opt.iLabelHalign);
- DBWriteContactSettingWord(0, MODULE, "ValueVAlign", opt.iValueValign);
- DBWriteContactSettingWord(0, MODULE, "ValueHAlign", opt.iValueHalign);
-
- DBWriteContactSettingByte(0, MODULE, "OriginalAvSize", (opt.bOriginalAvatarSize ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "AvatarBorder", (opt.bAvatarBorder ? 1 : 0));
+ db_set_w(0, MODULE, "Padding", opt.iPadding);
+ db_set_w(0, MODULE, "OuterAvatarPadding", opt.iOuterAvatarPadding);
+ db_set_w(0, MODULE, "InnerAvatarPadding", opt.iInnerAvatarPadding);
+ db_set_w(0, MODULE, "TextPadding", opt.iTextPadding);
+ db_set_b(0, MODULE, "Position", (BYTE)opt.pos);
+ db_set_dw(0, MODULE, "MinWidth", (DWORD)opt.iMinWidth);
+ db_set_dw(0, MODULE, "MinHeight", (DWORD)opt.iMinHeight);
+ db_set_dw(0, MODULE, "SidebarWidth", (DWORD)opt.iSidebarWidth);
+ db_set_b(0, MODULE, "MouseTollerance", (BYTE)opt.iMouseTollerance);
+ db_set_b(0, MODULE, "SBarTips", (opt.bStatusBarTips ? 1 : 0));
+
+ db_set_w(0, MODULE, "LabelVAlign", opt.iLabelValign);
+ db_set_w(0, MODULE, "LabelHAlign", opt.iLabelHalign);
+ db_set_w(0, MODULE, "ValueVAlign", opt.iValueValign);
+ db_set_w(0, MODULE, "ValueHAlign", opt.iValueHalign);
+
+ db_set_b(0, MODULE, "OriginalAvSize", (opt.bOriginalAvatarSize ? 1 : 0));
+ db_set_b(0, MODULE, "AvatarBorder", (opt.bAvatarBorder ? 1 : 0));
}
void SaveItems()
@@ -285,7 +285,7 @@ void SaveItems() index++;
}
- DBWriteContactSettingWord(0, MODULE_ITEMS, "DSNumValues", index);
+ db_set_w(0, MODULE_ITEMS, "DSNumValues", index);
index = 0;
DIListNode *di_node = opt.diList;
@@ -299,21 +299,21 @@ void SaveItems() index++;
}
- DBWriteContactSettingWord(0, MODULE_ITEMS, "DINumValues", index);
+ db_set_w(0, MODULE_ITEMS, "DINumValues", index);
}
void SaveSkinOptions()
{
- DBWriteContactSettingByte(0, MODULE, "Border", (opt.bBorder ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "DropShadow", (opt.bDropShadow ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "RoundCorners", (opt.bRound ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "AeroGlass", (opt.bAeroGlass ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "Opacity", (BYTE)opt.iOpacity);
- DBWriteContactSettingByte(0, MODULE, "ShowEffect", (BYTE)opt.showEffect);
- DBWriteContactSettingByte(0, MODULE, "ShowEffectSpeed", (BYTE)opt.iAnimateSpeed);
- DBWriteContactSettingByte(0, MODULE, "LoadFonts", (opt.bLoadFonts ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "LoadProportions", (opt.bLoadProportions ? 1 : 0));
- DBWriteContactSettingDword(0, MODULE, "EnableColoring", opt.iEnableColoring);
+ db_set_b(0, MODULE, "Border", (opt.bBorder ? 1 : 0));
+ db_set_b(0, MODULE, "DropShadow", (opt.bDropShadow ? 1 : 0));
+ db_set_b(0, MODULE, "RoundCorners", (opt.bRound ? 1 : 0));
+ db_set_b(0, MODULE, "AeroGlass", (opt.bAeroGlass ? 1 : 0));
+ db_set_b(0, MODULE, "Opacity", (BYTE)opt.iOpacity);
+ db_set_b(0, MODULE, "ShowEffect", (BYTE)opt.showEffect);
+ db_set_b(0, MODULE, "ShowEffectSpeed", (BYTE)opt.iAnimateSpeed);
+ db_set_b(0, MODULE, "LoadFonts", (opt.bLoadFonts ? 1 : 0));
+ db_set_b(0, MODULE, "LoadProportions", (opt.bLoadProportions ? 1 : 0));
+ db_set_dw(0, MODULE, "EnableColoring", opt.iEnableColoring);
}
void LoadObsoleteSkinSetting()
@@ -324,16 +324,16 @@ void LoadObsoleteSkinSetting() for (int i = 0; i < SKIN_ITEMS_COUNT; i++)
{
mir_snprintf(setting, 128, "SPaintMode%d", i);
- opt.transfMode[i] = (TransformationMode)DBGetContactSettingByte(0, MODULE, setting, 0);
+ opt.transfMode[i] = (TransformationMode)db_get_b(0, MODULE, setting, 0);
mir_snprintf(setting, 128, "SImgFile%d", i);
- if (!DBGetContactSettingTString(NULL, MODULE, setting, &dbv))
+ if (!db_get_ts(NULL, MODULE, setting, &dbv))
{
opt.szImgFile[i] = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
mir_snprintf(setting, 128, "SGlyphMargins%d", i);
- DWORD margins = DBGetContactSettingDword(NULL, MODULE, setting, 0);
+ DWORD margins = db_get_dw(NULL, MODULE, setting, 0);
opt.margins[i].top = LOBYTE(LOWORD(margins));
opt.margins[i].right = HIBYTE(LOWORD(margins));
opt.margins[i].bottom = LOBYTE(HIWORD(margins));
@@ -343,30 +343,30 @@ void LoadObsoleteSkinSetting() void LoadOptions()
{
- opt.iWinWidth = DBGetContactSettingDword(0, MODULE, "MaxWidth", 420);
- opt.iWinMaxHeight = DBGetContactSettingDword(0, MODULE, "MaxHeight", 400);
- opt.iAvatarOpacity = DBGetContactSettingByte(0, MODULE, "AvatarOpacity", 100);
+ opt.iWinWidth = db_get_dw(0, MODULE, "MaxWidth", 420);
+ opt.iWinMaxHeight = db_get_dw(0, MODULE, "MaxHeight", 400);
+ opt.iAvatarOpacity = db_get_b(0, MODULE, "AvatarOpacity", 100);
if (opt.iAvatarOpacity > 100) opt.iAvatarOpacity = 100;
- opt.bAvatarRound = (DBGetContactSettingByte(0, MODULE, "AvatarRoundCorners", opt.bRound ? 1 : 0) == 1);
- opt.titleLayout = (PopupTitleLayout)DBGetContactSettingByte(0, MODULE, "TitleLayout", (BYTE)PTL_LEFTICON);
+ opt.bAvatarRound = (db_get_b(0, MODULE, "AvatarRoundCorners", opt.bRound ? 1 : 0) == 1);
+ opt.titleLayout = (PopupTitleLayout)db_get_b(0, MODULE, "TitleLayout", (BYTE)PTL_LEFTICON);
if (ServiceExists(MS_AV_DRAWAVATAR))
- opt.avatarLayout = (PopupAvLayout)DBGetContactSettingByte(0, MODULE, "AVLayout", PAV_RIGHT);
+ opt.avatarLayout = (PopupAvLayout)db_get_b(0, MODULE, "AVLayout", PAV_RIGHT);
else
opt.avatarLayout = PAV_NONE;
opt.bWaitForAvatar = (opt.avatarLayout == PAV_NONE) ? false : true;
- opt.iAvatarSize = DBGetContactSettingDword(0, MODULE, "AVSize", 60); //tweety
- opt.iTextIndent = DBGetContactSettingDword(0, MODULE, "TextIndent", 22);
- opt.iTitleIndent = DBGetContactSettingDword(0, MODULE, "TitleIndent", 22);
- opt.iValueIndent = DBGetContactSettingDword(0, MODULE, "ValueIndent", 10);
- opt.iSidebarWidth = DBGetContactSettingDword(0, MODULE, "SidebarWidth", 22);
- opt.bShowNoFocus = (DBGetContactSettingByte(0, MODULE, "ShowNoFocus", 1) == 1);
+ opt.iAvatarSize = db_get_dw(0, MODULE, "AVSize", 60); //tweety
+ opt.iTextIndent = db_get_dw(0, MODULE, "TextIndent", 22);
+ opt.iTitleIndent = db_get_dw(0, MODULE, "TitleIndent", 22);
+ opt.iValueIndent = db_get_dw(0, MODULE, "ValueIndent", 10);
+ opt.iSidebarWidth = db_get_dw(0, MODULE, "SidebarWidth", 22);
+ opt.bShowNoFocus = (db_get_b(0, MODULE, "ShowNoFocus", 1) == 1);
int i, real_count = 0;
opt.dsList = 0;
DSListNode *ds_node;
- opt.iDsCount = DBGetContactSettingWord(0, MODULE_ITEMS, "DSNumValues", 0);
+ opt.iDsCount = db_get_w(0, MODULE_ITEMS, "DSNumValues", 0);
for (i = opt.iDsCount - 1; i >= 0; i--)
{
ds_node = (DSListNode *)mir_alloc(sizeof(DSListNode));
@@ -388,7 +388,7 @@ void LoadOptions() DIListNode *di_node;
opt.bWaitForStatusMsg = false;
- opt.iDiCount = DBGetContactSettingWord(0, MODULE_ITEMS, "DINumValues", 0);
+ opt.iDiCount = db_get_w(0, MODULE_ITEMS, "DINumValues", 0);
for (i = opt.iDiCount - 1; i >= 0; i--)
{
di_node = (DIListNode *)mir_alloc(sizeof(DIListNode));
@@ -407,22 +407,22 @@ void LoadOptions() }
opt.iDiCount = real_count;
- opt.iTimeIn = DBGetContactSettingWord(0, MODULE, "TimeIn", 750);
- opt.iPadding = DBGetContactSettingWord(0, MODULE, "Padding", 4);
- opt.iOuterAvatarPadding = DBGetContactSettingWord(0, MODULE, "OuterAvatarPadding", 6);
- opt.iInnerAvatarPadding = DBGetContactSettingWord(0, MODULE, "InnerAvatarPadding", 10);
- opt.iTextPadding = DBGetContactSettingWord(0, MODULE, "TextPadding", 4);
- opt.pos = (PopupPosition)DBGetContactSettingByte(0, MODULE, "Position", (BYTE)PP_BOTTOMRIGHT);
- opt.iMinWidth = DBGetContactSettingDword(0, MODULE, "MinWidth", 0);
- opt.iMinHeight = DBGetContactSettingDword(0, MODULE, "MinHeight", 0);
+ opt.iTimeIn = db_get_w(0, MODULE, "TimeIn", 750);
+ opt.iPadding = db_get_w(0, MODULE, "Padding", 4);
+ opt.iOuterAvatarPadding = db_get_w(0, MODULE, "OuterAvatarPadding", 6);
+ opt.iInnerAvatarPadding = db_get_w(0, MODULE, "InnerAvatarPadding", 10);
+ opt.iTextPadding = db_get_w(0, MODULE, "TextPadding", 4);
+ opt.pos = (PopupPosition)db_get_b(0, MODULE, "Position", (BYTE)PP_BOTTOMRIGHT);
+ opt.iMinWidth = db_get_dw(0, MODULE, "MinWidth", 0);
+ opt.iMinHeight = db_get_dw(0, MODULE, "MinHeight", 0);
- opt.iMouseTollerance = DBGetContactSettingByte(0, MODULE, "MouseTollerance", (BYTE)GetSystemMetrics(SM_CXSMICON));
- opt.bStatusBarTips = (DBGetContactSettingByte(0, MODULE, "SBarTips", 1) == 1);
+ opt.iMouseTollerance = db_get_b(0, MODULE, "MouseTollerance", (BYTE)GetSystemMetrics(SM_CXSMICON));
+ opt.bStatusBarTips = (db_get_b(0, MODULE, "SBarTips", 1) == 1);
// convert defunct last message and status message options to new 'sys' items, and remove the old settings
- if (DBGetContactSettingByte(0, MODULE, "ShowLastMessage", 0))
+ if (db_get_b(0, MODULE, "ShowLastMessage", 0))
{
- DBDeleteContactSetting(0, MODULE, "ShowLastMessage");
+ db_unset(0, MODULE, "ShowLastMessage");
// find end of list
di_node = opt.diList;
@@ -448,9 +448,9 @@ void LoadOptions() opt.iDiCount++;
}
- if (DBGetContactSettingByte(0, MODULE, "ShowStatusMessage", 0))
+ if (db_get_b(0, MODULE, "ShowStatusMessage", 0))
{
- DBDeleteContactSetting(0, MODULE, "ShowStatusMessage");
+ db_unset(0, MODULE, "ShowStatusMessage");
// find end of list
di_node = opt.diList;
@@ -476,31 +476,31 @@ void LoadOptions() opt.iDiCount++;
}
- opt.iLabelValign = DBGetContactSettingWord(0, MODULE, "LabelVAlign", DT_TOP /*DT_VCENTER*/);
- opt.iLabelHalign = DBGetContactSettingWord(0, MODULE, "LabelHAlign", DT_LEFT);
- opt.iValueValign = DBGetContactSettingWord(0, MODULE, "ValueVAlign", DT_TOP /*DT_VCENTER*/);
- opt.iValueHalign = DBGetContactSettingWord(0, MODULE, "ValueHAlign", DT_LEFT);
+ opt.iLabelValign = db_get_w(0, MODULE, "LabelVAlign", DT_TOP /*DT_VCENTER*/);
+ opt.iLabelHalign = db_get_w(0, MODULE, "LabelHAlign", DT_LEFT);
+ opt.iValueValign = db_get_w(0, MODULE, "ValueVAlign", DT_TOP /*DT_VCENTER*/);
+ opt.iValueHalign = db_get_w(0, MODULE, "ValueHAlign", DT_LEFT);
// tray tooltip
- opt.bTraytip = DBGetContactSettingByte(0, MODULE, "TrayTip", 1) ? true : false;
- opt.bHandleByTipper = DBGetContactSettingByte(0, MODULE, "ExtendedTrayTip", 1) ? true : false;
- opt.bExpandTraytip = DBGetContactSettingByte(0, MODULE, "ExpandTrayTip", 1) ? true : false;
- opt.bHideOffline = DBGetContactSettingByte(0, MODULE, "HideOffline", 0) ? true : false;
- opt.iExpandTime = DBGetContactSettingDword(0, MODULE, "ExpandTime", 1000);
- opt.iFirstItems = DBGetContactSettingDword(0, MODULE, "TrayTipItems", TRAYTIP_NUMCONTACTS | TRAYTIP_LOGON | TRAYTIP_STATUS | TRAYTIP_CLIST_EVENT);
- opt.iSecondItems = DBGetContactSettingDword(0, MODULE, "TrayTipItemsEx", TRAYTIP_NUMCONTACTS | TRAYTIP_LOGON | TRAYTIP_STATUS | TRAYTIP_STATUS_MSG | TRAYTIP_EXTRA_STATUS | TRAYTIP_MIRANDA_UPTIME | TRAYTIP_CLIST_EVENT);
- opt.iFavoriteContFlags = DBGetContactSettingDword(0, MODULE, "FavContFlags", FAVCONT_APPEND_PROTO);
+ opt.bTraytip = db_get_b(0, MODULE, "TrayTip", 1) ? true : false;
+ opt.bHandleByTipper = db_get_b(0, MODULE, "ExtendedTrayTip", 1) ? true : false;
+ opt.bExpandTraytip = db_get_b(0, MODULE, "ExpandTrayTip", 1) ? true : false;
+ opt.bHideOffline = db_get_b(0, MODULE, "HideOffline", 0) ? true : false;
+ opt.iExpandTime = db_get_dw(0, MODULE, "ExpandTime", 1000);
+ opt.iFirstItems = db_get_dw(0, MODULE, "TrayTipItems", TRAYTIP_NUMCONTACTS | TRAYTIP_LOGON | TRAYTIP_STATUS | TRAYTIP_CLIST_EVENT);
+ opt.iSecondItems = db_get_dw(0, MODULE, "TrayTipItemsEx", TRAYTIP_NUMCONTACTS | TRAYTIP_LOGON | TRAYTIP_STATUS | TRAYTIP_STATUS_MSG | TRAYTIP_EXTRA_STATUS | TRAYTIP_MIRANDA_UPTIME | TRAYTIP_CLIST_EVENT);
+ opt.iFavoriteContFlags = db_get_dw(0, MODULE, "FavContFlags", FAVCONT_APPEND_PROTO);
// extra setting
- opt.bWaitForContent= DBGetContactSettingByte(0, MODULE, "WaitForContent", 0) ? true : false;
- opt.bGetNewStatusMsg = DBGetContactSettingByte(0, MODULE, "GetNewStatusMsg", 0) ? true : false;
- opt.bDisableIfInvisible = DBGetContactSettingByte(0, MODULE, "DisableInvisible", 1) ? true : false;
- opt.bRetrieveXstatus = DBGetContactSettingByte(0, MODULE, "RetrieveXStatus", 0) ? true : false;
- opt.bOriginalAvatarSize = DBGetContactSettingByte(0, MODULE, "OriginalAvSize", 0) ? true : false;
- opt.bAvatarBorder = DBGetContactSettingByte(0, MODULE, "AvatarBorder", 0) ? true : false;
- opt.bLimitMsg = DBGetContactSettingByte(0, MODULE, "LimitMsg", 0) ? true : false;
- opt.iLimitCharCount = DBGetContactSettingByte(0, MODULE, "LimitCharCount", 64);
- opt.iSmileyAddFlags = DBGetContactSettingDword(0, MODULE, "SmileyAddFlags", SMILEYADD_ENABLE);
+ opt.bWaitForContent= db_get_b(0, MODULE, "WaitForContent", 0) ? true : false;
+ opt.bGetNewStatusMsg = db_get_b(0, MODULE, "GetNewStatusMsg", 0) ? true : false;
+ opt.bDisableIfInvisible = db_get_b(0, MODULE, "DisableInvisible", 1) ? true : false;
+ opt.bRetrieveXstatus = db_get_b(0, MODULE, "RetrieveXStatus", 0) ? true : false;
+ opt.bOriginalAvatarSize = db_get_b(0, MODULE, "OriginalAvSize", 0) ? true : false;
+ opt.bAvatarBorder = db_get_b(0, MODULE, "AvatarBorder", 0) ? true : false;
+ opt.bLimitMsg = db_get_b(0, MODULE, "LimitMsg", 0) ? true : false;
+ opt.iLimitCharCount = db_get_b(0, MODULE, "LimitCharCount", 64);
+ opt.iSmileyAddFlags = db_get_dw(0, MODULE, "SmileyAddFlags", SMILEYADD_ENABLE);
DBVARIANT dbv;
// Load the icons order
@@ -510,16 +510,16 @@ void LoadOptions() opt.exIconsVis[i]=1;
}
- if (!DBGetContactSetting(NULL, MODULE, "IconOrder", &dbv))
+ if (!db_get(NULL, MODULE, "IconOrder", &dbv))
{
CopyMemory(opt.exIconsOrder,dbv.pbVal,dbv.cpbVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, MODULE, "icons_vis", &dbv))
+ if (!db_get(NULL, MODULE, "icons_vis", &dbv))
{
CopyMemory(opt.exIconsVis,dbv.pbVal,dbv.cpbVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
for(i = 0; i < EXICONS_COUNT; i++)
@@ -528,24 +528,24 @@ void LoadOptions() exIcons[i].vis = opt.exIconsVis[i];
}
- opt.iOpacity = DBGetContactSettingByte(0, MODULE, "Opacity", 75);
- opt.bBorder = DBGetContactSettingByte(0, MODULE, "Border", 1) ? true : false;
- opt.bDropShadow = DBGetContactSettingByte(0, MODULE, "DropShadow", 1) ? true : false;
- opt.bRound = DBGetContactSettingByte(0, MODULE, "RoundCorners", 1) ? true : false;
- opt.bAeroGlass = DBGetContactSettingByte(0, MODULE, "AeroGlass", 0) ? true : false;
- opt.showEffect = (PopupShowEffect)DBGetContactSettingByte(0, MODULE, "ShowEffect", (BYTE)PSE_FADE);
- opt.iAnimateSpeed = DBGetContactSettingByte(0, MODULE, "ShowEffectSpeed", 12);
+ opt.iOpacity = db_get_b(0, MODULE, "Opacity", 75);
+ opt.bBorder = db_get_b(0, MODULE, "Border", 1) ? true : false;
+ opt.bDropShadow = db_get_b(0, MODULE, "DropShadow", 1) ? true : false;
+ opt.bRound = db_get_b(0, MODULE, "RoundCorners", 1) ? true : false;
+ opt.bAeroGlass = db_get_b(0, MODULE, "AeroGlass", 0) ? true : false;
+ opt.showEffect = (PopupShowEffect)db_get_b(0, MODULE, "ShowEffect", (BYTE)PSE_FADE);
+ opt.iAnimateSpeed = db_get_b(0, MODULE, "ShowEffectSpeed", 12);
if (opt.iAnimateSpeed < 1)
opt.iAnimateSpeed = 1;
else if (opt.iAnimateSpeed > 20)
opt.iAnimateSpeed = 20;
- int iBgImg = DBGetContactSettingByte(0, MODULE, "SBgImage", 0);
- opt.skinMode = (SkinMode)DBGetContactSettingByte(0, MODULE, "SkinEngine", iBgImg ? SM_OBSOLOTE : SM_COLORFILL);
- opt.bLoadFonts = DBGetContactSettingByte(0, MODULE, "LoadFonts", 1) ? true : false;
- opt.bLoadProportions= DBGetContactSettingByte(0, MODULE, "LoadProportions", 1) ? true : false;
- opt.iEnableColoring = DBGetContactSettingDword(0, MODULE, "EnableColoring", 0);
+ int iBgImg = db_get_b(0, MODULE, "SBgImage", 0);
+ opt.skinMode = (SkinMode)db_get_b(0, MODULE, "SkinEngine", iBgImg ? SM_OBSOLOTE : SM_COLORFILL);
+ opt.bLoadFonts = db_get_b(0, MODULE, "LoadFonts", 1) ? true : false;
+ opt.bLoadProportions= db_get_b(0, MODULE, "LoadProportions", 1) ? true : false;
+ opt.iEnableColoring = db_get_dw(0, MODULE, "EnableColoring", 0);
opt.szSkinName[0] = 0;
if (opt.skinMode == SM_OBSOLOTE)
@@ -554,10 +554,10 @@ void LoadOptions() }
else if (opt.skinMode == SM_IMAGE)
{
- if (!DBGetContactSettingTString(NULL, MODULE, "SkinName", &dbv))
+ if (!db_get_ts(NULL, MODULE, "SkinName", &dbv))
{
_tcscpy(opt.szSkinName, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -1710,13 +1710,13 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM opt.bLimitMsg = IsDlgButtonChecked(hwndDlg, IDC_CHK_LIMITMSG) ? true : false;
opt.iLimitCharCount = GetDlgItemInt(hwndDlg, IDC_ED_CHARCOUNT, 0, FALSE);
- DBWriteContactSettingDword(0, MODULE, "SmileyAddFlags", opt.iSmileyAddFlags);
- DBWriteContactSettingByte(0, MODULE, "WaitForContent", opt.bWaitForContent ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "GetNewStatusMsg", opt.bGetNewStatusMsg ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "DisableInvisible", opt.bDisableIfInvisible ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "RetrieveXStatus", opt.bRetrieveXstatus ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "LimitMsg", opt.bLimitMsg ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "LimitCharCount", opt.iLimitCharCount);
+ db_set_dw(0, MODULE, "SmileyAddFlags", opt.iSmileyAddFlags);
+ db_set_b(0, MODULE, "WaitForContent", opt.bWaitForContent ? 1 : 0);
+ db_set_b(0, MODULE, "GetNewStatusMsg", opt.bGetNewStatusMsg ? 1 : 0);
+ db_set_b(0, MODULE, "DisableInvisible", opt.bDisableIfInvisible ? 1 : 0);
+ db_set_b(0, MODULE, "RetrieveXStatus", opt.bRetrieveXstatus ? 1 : 0);
+ db_set_b(0, MODULE, "LimitMsg", opt.bLimitMsg ? 1 : 0);
+ db_set_b(0, MODULE, "LimitCharCount", opt.iLimitCharCount);
return TRUE;
}
@@ -2026,8 +2026,8 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l }
}
- DBWriteContactSettingByte(0, MODULE, "SkinEngine", opt.skinMode);
- DBWriteContactSettingTString(0, MODULE, "SkinName", opt.szSkinName);
+ db_set_b(0, MODULE, "SkinEngine", opt.skinMode);
+ db_set_ts(0, MODULE, "SkinName", opt.szSkinName);
DestroySkinBitmap();
SetDlgItemInt(hwndDlg, IDC_ED_TRANS, opt.iOpacity, FALSE);
@@ -2084,7 +2084,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, {
TranslateDialogDefault(hwndDlg);
- if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
+ if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) FALSE, 0);
else
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) TRUE, 0);
@@ -2098,7 +2098,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, while (hContact)
{
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if (hItem && DBGetContactSettingByte(hContact, MODULE, "FavouriteContact", 0))
+ if (hItem && db_get_b(hContact, MODULE, "FavouriteContact", 0))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
hContact = db_find_next(hContact);
@@ -2126,19 +2126,19 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, if (hItem)
{
isChecked = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0);
- DBWriteContactSettingByte(hContact, MODULE, "FavouriteContact", isChecked);
+ db_set_b(hContact, MODULE, "FavouriteContact", isChecked);
if (isChecked) count++;
}
hContact = db_find_next(hContact);
}
- DBWriteContactSettingDword(0, MODULE, "FavouriteContactsCount", count);
+ db_set_dw(0, MODULE, "FavouriteContactsCount", count);
opt.iFavoriteContFlags = 0;
opt.iFavoriteContFlags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEOFFLINE) ? FAVCONT_HIDE_OFFLINE : 0 |
IsDlgButtonChecked(hwndDlg, IDC_CHK_APPENDPROTO) ? FAVCONT_APPEND_PROTO : 0;
- DBWriteContactSettingDword(0, MODULE, "FavContFlags", opt.iFavoriteContFlags);
+ db_set_dw(0, MODULE, "FavContFlags", opt.iFavoriteContFlags);
} // fall through
case IDC_BTN_CANCEL:
{
@@ -2295,7 +2295,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), item.hItem);
}
- DBWriteContactSettingTString(0, MODULE, "TrayProtocols", swzProtos);
+ db_set_ts(0, MODULE, "TrayProtocols", swzProtos);
swzProtos[0] = 0;
item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg,IDC_TREE_SECOND_PROTOS));
@@ -2312,7 +2312,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), item.hItem);
}
- DBWriteContactSettingTString(0, MODULE, "TrayProtocolsEx", swzProtos);
+ db_set_ts(0, MODULE, "TrayProtocolsEx", swzProtos);
int count = 0;
opt.iFirstItems = 0;
@@ -2348,13 +2348,13 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA opt.bHideOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEOFFLINE) ? true : false;
opt.iExpandTime = max(min(GetDlgItemInt(hwndDlg, IDC_ED_EXPANDTIME, 0, FALSE), 5000), 10);
- DBWriteContactSettingByte(0, MODULE, "TrayTip", (opt.bTraytip ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "ExtendedTrayTip", (opt.bHandleByTipper ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "ExpandTrayTip", (opt.bExpandTraytip ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "HideOffline", (opt.bHideOffline ? 1 : 0));
- DBWriteContactSettingDword(0, MODULE, "ExpandTime", opt.iExpandTime);
- DBWriteContactSettingDword(0, MODULE, "TrayTipItems", opt.iFirstItems);
- DBWriteContactSettingDword(0, MODULE, "TrayTipItemsEx", opt.iSecondItems);
+ db_set_b(0, MODULE, "TrayTip", (opt.bTraytip ? 1 : 0));
+ db_set_b(0, MODULE, "ExtendedTrayTip", (opt.bHandleByTipper ? 1 : 0));
+ db_set_b(0, MODULE, "ExpandTrayTip", (opt.bExpandTraytip ? 1 : 0));
+ db_set_b(0, MODULE, "HideOffline", (opt.bHideOffline ? 1 : 0));
+ db_set_dw(0, MODULE, "ExpandTime", opt.iExpandTime);
+ db_set_dw(0, MODULE, "TrayTipItems", opt.iFirstItems);
+ db_set_dw(0, MODULE, "TrayTipItemsEx", opt.iSecondItems);
return TRUE;
}
break;
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index c3ed182e2b..155990697d 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -153,7 +153,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa }
}
else {
- if (DBGetContactSettingByte(0, pwd->clcit.szProto, "XStatusId", 0)) {
+ if (db_get_b(0, pwd->clcit.szProto, "XStatusId", 0)) {
// xstatus title
swzAdvTitle = GetProtoExtraStatusTitle(pwd->clcit.szProto);
if (swzAdvTitle) {
@@ -316,7 +316,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // don't use stored status message
if (!opt.bWaitForContent)
- DBDeleteContactSetting(pwd->hContact, MODULE, "TempStatusMsg");
+ db_unset(pwd->hContact, MODULE, "TempStatusMsg");
TCHAR *swzNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pwd->hContact, GCDNF_TCHAR);
_tcsncpy(pwd->swzTitle, swzNick, TITLE_TEXT_LEN);
@@ -339,14 +339,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // xstatus icon
if (pwd->bIsIconVisible[1]) {
for (i = 0; opt.exIconsOrder[i] != 1; i++);
- int iXstatus = DBGetContactSettingByte(pwd->hContact, szProto, "XStatusId", 0);
+ int iXstatus = db_get_b(pwd->hContact, szProto, "XStatusId", 0);
if (iXstatus) {
char szIconProto[64];
if (strcmp(szProto, szMetaModuleName) != 0)
strcpy(szIconProto, szProto);
- else if (!DBGetContactSettingString(pwd->hContact, szProto, "XStatusProto", &dbv)) {
+ else if (!db_get_s(pwd->hContact, szProto, "XStatusProto", &dbv)) {
strcpy(szIconProto, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
pwd->extraIcons[i].hIcon = (HICON)CallProtoService(szIconProto, PS_GETCUSTOMSTATUSICON, (WPARAM)iXstatus, LR_SHARED);
@@ -367,9 +367,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (ServiceExists(MS_GENDER_GETICON))
pwd->extraIcons[i].hIcon = (HICON)CallService(MS_GENDER_GETICON, (WPARAM)pwd->hContact, 0);
else {
- int iGender = DBGetContactSettingByte(pwd->hContact, "UserInfo", "Gender", 0);
+ int iGender = db_get_b(pwd->hContact, "UserInfo", "Gender", 0);
if (iGender == 0)
- iGender = DBGetContactSettingByte(pwd->hContact, szProto, "Gender", 0);
+ iGender = db_get_b(pwd->hContact, szProto, "Gender", 0);
if (iGender == GEN_FEMALE)
pwd->extraIcons[i].hIcon = Skin_GetIcon("UserInfoEx_common_female");
@@ -399,24 +399,24 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->bIsIconVisible[5]) {
for (i = 0; opt.exIconsOrder[i] != 5; i++);
if ( ServiceExists(MS_FP_GETCLIENTICONT)) {
- if (!DBGetContactSettingTString(pwd->hContact, szProto, "MirVer", &dbv)) {
+ if (!db_get_ts(pwd->hContact, szProto, "MirVer", &dbv)) {
pwd->extraIcons[i].hIcon = (HICON)CallService(MS_FP_GETCLIENTICONT, (WPARAM)dbv.ptszVal, 0);
pwd->extraIcons[i].bDestroy = true;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else if (ServiceExists(MS_FP_GETCLIENTICON)) {
- if (!DBGetContactSettingString(pwd->hContact, szProto, "MirVer", &dbv)) {
+ if (!db_get_s(pwd->hContact, szProto, "MirVer", &dbv)) {
pwd->extraIcons[i].hIcon = (HICON)CallService(MS_FP_GETCLIENTICON, (WPARAM)dbv.pszVal, 0);
pwd->extraIcons[i].bDestroy = true;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
//request xstatus details
if (opt.bRetrieveXstatus)
- if (!DBGetContactSettingByte(0, szProto, "XStatusAuto", 1) && ProtoServiceExists(szProto, PS_ICQ_REQUESTCUSTOMSTATUS))
+ if (!db_get_b(0, szProto, "XStatusAuto", 1) && ProtoServiceExists(szProto, PS_ICQ_REQUESTCUSTOMSTATUS))
CallProtoService(szProto, PS_ICQ_REQUESTCUSTOMSTATUS, (WPARAM)pwd->hContact, 0);
}
@@ -996,7 +996,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa case PUM_SETSTATUSTEXT:
if (pwd && (HANDLE)wParam == pwd->hContact) {
- DBWriteContactSettingTString(pwd->hContact, MODULE, "TempStatusMsg", (TCHAR *)lParam);
+ db_set_ts(pwd->hContact, MODULE, "TempStatusMsg", (TCHAR *)lParam);
pwd->bIsPainted = false;
pwd->bNeedRefresh = true;
SendMessage(hwnd, PUM_REFRESH_VALUES, TRUE, 0);
@@ -1555,7 +1555,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa while (hContact) {
char *proto = GetContactProto(hContact);
if (proto && !strcmp(proto, pa->szModuleName)) {
- if (DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ if (db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
iCountOnline++;
iCount++;
}
@@ -1626,7 +1626,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa }
}
else {
- if (DBGetContactSettingByte(0, pa->szModuleName, "XStatusId", 0)) {
+ if (db_get_b(0, pa->szModuleName, "XStatusId", 0)) {
// xstatus title
swzAdvTitle = GetProtoExtraStatusTitle(pa->szModuleName);
if (swzAdvTitle) {
@@ -1672,7 +1672,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa }
if (dwItems & TRAYTIP_FAVCONTACTS) {
- if (DBGetContactSettingDword(0, MODULE, "FavouriteContactsCount", 0)) {
+ if (db_get_dw(0, MODULE, "FavouriteContactsCount", 0)) {
TCHAR swzName[256];
TCHAR swzStatus[256];
bool bTitlePainted = false;
@@ -1680,10 +1680,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa HANDLE hContact = db_find_first();
while (hContact) {
- if (DBGetContactSettingByte(hContact, MODULE, "FavouriteContact", 0)) {
+ if (db_get_b(hContact, MODULE, "FavouriteContact", 0)) {
char *proto = GetContactProto(hContact);
if (proto) {
- WORD wStatus = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
+ WORD wStatus = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
WordToStatusDesc(hContact, proto, "Status", swzStatus, 256);
if (wStatus != ID_STATUS_OFFLINE)
diff --git a/plugins/TipperYM/src/skin_parser.cpp b/plugins/TipperYM/src/skin_parser.cpp index 439b1a2b44..3a00979545 100644 --- a/plugins/TipperYM/src/skin_parser.cpp +++ b/plugins/TipperYM/src/skin_parser.cpp @@ -210,7 +210,7 @@ void ParseFontPart(FILE *fp, TCHAR *buff) if (_tcslen(pch) > 32)
pch[32] = 0;
- DBWriteContactSettingTString(0, MODULE, szSetting, pch);
+ db_set_ts(0, MODULE, szSetting, pch);
}
}
else if (_tcsstr(buff, _T("color")))
@@ -227,7 +227,7 @@ void ParseFontPart(FILE *fp, TCHAR *buff) {
BYTE b = _ttoi(pch);
COLORREF color = RGB(r, g ,b);
- DBWriteContactSettingDword(0, MODULE, szSetting, color);
+ db_set_dw(0, MODULE, szSetting, color);
}
}
}
@@ -238,7 +238,7 @@ void ParseFontPart(FILE *fp, TCHAR *buff) {
HDC hdc = GetDC(0);
int size = -MulDiv(_ttoi(pch), GetDeviceCaps(hdc, LOGPIXELSY), 72);
- DBWriteContactSettingByte(0, MODULE, szSetting, (BYTE)size);
+ db_set_b(0, MODULE, szSetting, (BYTE)size);
ReleaseDC(0, hdc);
}
}
@@ -254,7 +254,7 @@ void ParseFontPart(FILE *fp, TCHAR *buff) if (_tcsstr(pch, _T("font_underline")))
effect |= DBFONTF_UNDERLINE;
- DBWriteContactSettingByte(0, MODULE, szSetting, effect);
+ db_set_b(0, MODULE, szSetting, effect);
}
}
}
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 41fb8eda43..779fe76bf8 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -36,7 +36,7 @@ bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, cons if (!szModuleName || !szSettingName)
return false;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
switch(dbv.type)
{
@@ -65,7 +65,7 @@ bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, cons }
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return buff[0] ? true : false;
@@ -73,7 +73,7 @@ bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, cons void StripBBCodesInPlace(TCHAR *swzText)
{
- if (!DBGetContactSettingByte(0, MODULE, "StripBBCodes", 1))
+ if (!db_get_b(0, MODULE, "StripBBCodes", 1))
return;
if (swzText == 0)
@@ -207,13 +207,13 @@ bool CanRetrieveStatusMsg(HANDLE hContact, char *szProto) if (opt.bGetNewStatusMsg)
{
int iFlags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0);
- WORD wStatus = DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ WORD wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
if ((CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) && (iFlags & Proto_Status2Flag(wStatus)))
{
iFlags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & (PF1_VISLIST | PF1_INVISLIST);
if (opt.bDisableIfInvisible && iFlags)
{
- int iVisMode = DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0);
+ int iVisMode = db_get_w(hContact, szProto, "ApparentMode", 0);
int wProtoStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if ((iVisMode == ID_STATUS_OFFLINE) || (wProtoStatus == ID_STATUS_INVISIBLE && iVisMode != ID_STATUS_ONLINE))
return false;
@@ -252,11 +252,11 @@ TCHAR *GetStatusMessageText(HANDLE hContact) if (wStatus == ID_STATUS_OFFLINE)
return NULL;
- if (!DBGetContactSettingTString(hContact, MODULE, "TempStatusMsg", &dbv))
+ if (!db_get_ts(hContact, MODULE, "TempStatusMsg", &dbv))
{
if (_tcslen(dbv.ptszVal) != 0)
swzMsg = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -268,11 +268,11 @@ TCHAR *GetStatusMessageText(HANDLE hContact) return NULL;
}
- if (!DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv))
+ if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv))
{
if (dbv.ptszVal && _tcslen(dbv.ptszVal) != 0)
swzMsg = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -417,17 +417,17 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle for (int i = 0; i < iNumber; i++) {
if (i > 0)
hTmpContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, i);
- dwRecountTs = DBGetContactSettingDword(hTmpContact, MODULE, "LastCountTS", 0);
+ dwRecountTs = db_get_dw(hTmpContact, MODULE, "LastCountTS", 0);
dwTime = (DWORD)time(0);
dwDiff = (dwTime - dwRecountTs);
if (dwDiff > (60 * 60 * 24 * 3)) {
- DBWriteContactSettingDword(hTmpContact, MODULE, "LastCountTS", dwTime);
+ db_set_dw(hTmpContact, MODULE, "LastCountTS", dwTime);
dwCountOut = dwCountIn = dwLastTs = 0;
}
else {
- dwCountOut = DBGetContactSettingDword(hTmpContact, MODULE, "MsgCountOut", 0);
- dwCountIn = DBGetContactSettingDword(hTmpContact, MODULE, "MsgCountIn", 0);
- dwLastTs = DBGetContactSettingDword(hTmpContact, MODULE, "LastMsgTS", 0);
+ dwCountOut = db_get_dw(hTmpContact, MODULE, "MsgCountOut", 0);
+ dwCountIn = db_get_dw(hTmpContact, MODULE, "MsgCountIn", 0);
+ dwLastTs = db_get_dw(hTmpContact, MODULE, "LastMsgTS", 0);
}
dwNewTs = dwLastTs;
@@ -449,9 +449,9 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle }
if (dwNewTs > dwLastTs) {
- DBWriteContactSettingDword(hTmpContact, MODULE, "MsgCountOut", dwCountOut);
- DBWriteContactSettingDword(hTmpContact, MODULE, "MsgCountIn", dwCountIn);
- DBWriteContactSettingDword(hTmpContact, MODULE, "LastMsgTS", dwNewTs);
+ db_set_dw(hTmpContact, MODULE, "MsgCountOut", dwCountOut);
+ db_set_dw(hTmpContact, MODULE, "MsgCountIn", dwCountIn);
+ db_set_dw(hTmpContact, MODULE, "LastMsgTS", dwNewTs);
}
dwMetaCountOut += dwCountOut;
@@ -851,11 +851,11 @@ TCHAR *GetProtoExtraStatusTitle(char *szProto) if (!szProto)
return NULL;
- if (!DBGetContactSettingTString(0, szProto, "XStatusName", &dbv))
+ if (!db_get_ts(0, szProto, "XStatusName", &dbv))
{
if (_tcslen(dbv.ptszVal) != 0)
swzText = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!swzText)
@@ -879,11 +879,11 @@ TCHAR *GetProtoExtraStatusMessage(char *szProto) if (!szProto)
return NULL;
- if (!DBGetContactSettingTString(0, szProto, "XStatusMsg", &dbv))
+ if (!db_get_ts(0, szProto, "XStatusMsg", &dbv))
{
if (_tcslen(dbv.ptszVal) != 0)
swzText = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (ServiceExists(MS_VARS_FORMATSTRING))
{
@@ -923,11 +923,11 @@ TCHAR *GetListeningTo(char *szProto) if (!szProto)
return NULL;
- if (!DBGetContactSettingTString(0, szProto, "ListeningTo", &dbv))
+ if (!db_get_ts(0, szProto, "ListeningTo", &dbv))
{
if (_tcslen(dbv.ptszVal) != 0)
swzText = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (opt.bLimitMsg)
@@ -946,11 +946,11 @@ TCHAR *GetJabberAdvStatusText(char *szProto, const char *szSlot, const char *szV return NULL;
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", szProto, szSlot, szValue);
- if (!DBGetContactSettingTString(0, "AdvStatus", szSetting, &dbv))
+ if (!db_get_ts(0, "AdvStatus", szSetting, &dbv))
{
if (_tcslen(dbv.ptszVal) != 0)
swzText = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (opt.bLimitMsg)
@@ -969,10 +969,10 @@ HICON GetJabberActivityIcon(HANDLE hContact, char *szProto) return NULL;
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", szProto, "activity", "icon");
- if (!DBGetContactSettingString(hContact, "AdvStatus", szSetting, &dbv))
+ if (!db_get_s(hContact, "AdvStatus", szSetting, &dbv))
{
hIcon = Skin_GetIcon(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return hIcon;
diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index 17e9100251..4129c9a58a 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -113,7 +113,7 @@ int EventDeleted(WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = { sizeof(dbei) };
if ( !db_event_get((HANDLE)lParam, &dbei))
if (dbei.eventType == EVENTTYPE_MESSAGE)
- DBDeleteContactSetting((HANDLE)wParam, MODULE, "LastCountTS");
+ db_unset((HANDLE)wParam, MODULE, "LastCountTS");
return 0;
}
@@ -269,7 +269,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);
// set Miranda start timestamp
- DBWriteContactSettingDword(0, MODULE, "MirandaStartTS", (DWORD)time(0));
+ db_set_dw(0, MODULE, "MirandaStartTS", (DWORD)time(0));
// get MetaContacts module name
if (ServiceExists(MS_MC_GETPROTOCOLNAME))
diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index fcbe097981..39b32434a5 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -43,7 +43,7 @@ void AddTranslation(DBVTranslation *newTrans) }
else
{
- DWORD id = DBGetContactSettingDword(0, MODULE_ITEMS, szSetting, 0);
+ DWORD id = db_get_dw(0, MODULE_ITEMS, szSetting, 0);
if (id != 0)
{
translations[iTransFuncsCount - 1].id = id;
@@ -52,10 +52,10 @@ void AddTranslation(DBVTranslation *newTrans) else
{
translations[iTransFuncsCount - 1].id = dwNextFuncId++;
- DBWriteContactSettingDword(0, MODULE_ITEMS, szSetting, translations[iTransFuncsCount - 1].id);
+ db_set_dw(0, MODULE_ITEMS, szSetting, translations[iTransFuncsCount - 1].id);
}
- DBWriteContactSettingDword(0, MODULE_ITEMS, "NextFuncId", dwNextFuncId);
+ db_set_dw(0, MODULE_ITEMS, "NextFuncId", dwNextFuncId);
}
mir_free(szName);
@@ -70,7 +70,7 @@ TCHAR *NullTranslation(HANDLE hContact, const char *szModuleName, const char *sz TCHAR *TimestampToShortDate(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- DWORD ts = DBGetContactSettingDword(hContact, szModuleName, szSettingName, 0);
+ DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0) return 0;
DBTIMETOSTRINGT dbt = {0};
@@ -83,7 +83,7 @@ TCHAR *TimestampToShortDate(HANDLE hContact, const char *szModuleName, const cha TCHAR *TimestampToLongDate(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- DWORD ts = DBGetContactSettingDword(hContact, szModuleName, szSettingName, 0);
+ DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0) return 0;
DBTIMETOSTRINGT dbt = {0};
@@ -96,7 +96,7 @@ TCHAR *TimestampToLongDate(HANDLE hContact, const char *szModuleName, const char TCHAR *TimestampToTime(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- DWORD ts = DBGetContactSettingDword(hContact, szModuleName, szSettingName, 0);
+ DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0) return 0;
DBTIMETOSTRINGT dbt = {0};
@@ -109,7 +109,7 @@ TCHAR *TimestampToTime(HANDLE hContact, const char *szModuleName, const char *sz TCHAR *TimestampToTimeNoSecs(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- DWORD ts = DBGetContactSettingDword(hContact, szModuleName, szSettingName, 0);
+ DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0) return 0;
DBTIMETOSTRINGT dbt = {0};
@@ -122,7 +122,7 @@ TCHAR *TimestampToTimeNoSecs(HANDLE hContact, const char *szModuleName, const ch TCHAR *TimestampToTimeDifference(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- DWORD ts = DBGetContactSettingDword(hContact, szModuleName, szSettingName, 0);
+ DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
DWORD t = (DWORD)time(0);
if (ts == 0) return 0;
@@ -142,7 +142,7 @@ TCHAR *TimestampToTimeDifference(HANDLE hContact, const char *szModuleName, cons TCHAR *SecondsToTimeDifference(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- DWORD diff = DBGetContactSettingDword(hContact, szModuleName, szSettingName, 0);
+ DWORD diff = db_get_dw(hContact, szModuleName, szSettingName, 0);
int d = (diff / 60 / 60 / 24);
int h = (diff - d * 60 * 60 * 24) / 60 / 60;
int m = (diff - d * 60 * 60 * 24 - h * 60 * 60) / 60;
@@ -158,7 +158,7 @@ TCHAR *SecondsToTimeDifference(HANDLE hContact, const char *szModuleName, const TCHAR *WordToStatusDesc(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- WORD wStatus = DBGetContactSettingWord(hContact, szModuleName, szSettingName, ID_STATUS_OFFLINE);
+ WORD wStatus = db_get_w(hContact, szModuleName, szSettingName, ID_STATUS_OFFLINE);
TCHAR *szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wStatus, GSMDF_TCHAR);
_tcsncpy(buff,szStatus, bufflen);
buff[bufflen - 1] = 0;
@@ -168,7 +168,7 @@ TCHAR *WordToStatusDesc(HANDLE hContact, const char *szModuleName, const char *s TCHAR *ByteToYesNo(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (dbv.type == DBVT_BYTE)
{
@@ -177,17 +177,17 @@ TCHAR *ByteToYesNo(HANDLE hContact, const char *szModuleName, const char *szSett else
_tcsncpy(buff, _T("No"), bufflen);
buff[bufflen - 1] = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return buff;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
TCHAR *ByteToGender(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- BYTE val = (BYTE)DBGetContactSettingByte(hContact, szModuleName, szSettingName, 0);
+ BYTE val = (BYTE)db_get_b(hContact, szModuleName, szSettingName, 0);
if (val == 'F')
_tcsncpy(buff, TranslateT("Female"), bufflen);
else if (val == 'M')
@@ -202,7 +202,7 @@ TCHAR *ByteToGender(HANDLE hContact, const char *szModuleName, const char *szSet TCHAR *WordToCountry(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
char *szCountryName = 0;
- WORD cid = (WORD)DBGetContactSettingWord(hContact, szModuleName, szSettingName, (WORD)-1);
+ WORD cid = (WORD)db_get_w(hContact, szModuleName, szSettingName, (WORD)-1);
if (cid != (WORD)-1 && ServiceExists(MS_UTILS_GETCOUNTRYBYNUMBER) && (szCountryName = (char *)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, cid, 0)) != 0)
{
if (strcmp(szCountryName, "Unknown") == 0)
@@ -216,7 +216,7 @@ TCHAR *WordToCountry(HANDLE hContact, const char *szModuleName, const char *szSe TCHAR *DwordToIp(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- DWORD ip = DBGetContactSettingDword(hContact, szModuleName, szSettingName, 0);
+ DWORD ip = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ip) {
unsigned char *ipc = (unsigned char*)&ip;
mir_sntprintf(buff, bufflen, _T("%u.%u.%u.%u"), ipc[3], ipc[2], ipc[1], ipc[0]);
@@ -249,26 +249,26 @@ TCHAR *DayMonthYearToDate(HANDLE hContact, const char *szModuleName, const char DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, 256, "%sDay", prefix);
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sMonth", prefix);
int month = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sYear", prefix);
int year = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &year))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SYSTEMTIME st = {0};
st.wDay = day;
@@ -279,15 +279,15 @@ TCHAR *DayMonthYearToDate(HANDLE hContact, const char *szModuleName, const char return buff;
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -297,26 +297,26 @@ TCHAR *DayMonthYearToAge(HANDLE hContact, const char *szModuleName, const char * DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, 256, "%sDay", szPrefix);
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sMonth", szPrefix);
int month = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sYear", szPrefix);
int year = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &year))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SYSTEMTIME now;
GetLocalTime(&now);
@@ -328,15 +328,15 @@ TCHAR *DayMonthYearToAge(HANDLE hContact, const char *szModuleName, const char * return buff;
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -346,25 +346,25 @@ TCHAR *HoursMinutesSecondsToTime(HANDLE hContact, const char *szModuleName, cons DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, 256, "%sHours", szPrefix);
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int hours = 0;
if (GetInt(dbv, &hours))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sMinutes", szPrefix);
int minutes = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &minutes))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sSeconds", szPrefix);
int seconds = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
GetInt(dbv, &seconds);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
SYSTEMTIME st = {0};
@@ -376,11 +376,11 @@ TCHAR *HoursMinutesSecondsToTime(HANDLE hContact, const char *szModuleName, cons return buff;
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -390,19 +390,19 @@ TCHAR *HoursMinutesToTime(HANDLE hContact, const char *szModuleName, const char DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, 256, "%sHours", szPrefix);
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int hours = 0;
if (GetInt(dbv, &hours))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sMinutes", szPrefix);
int minutes = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &minutes))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SYSTEMTIME st = {0};
st.wHour = hours;
@@ -412,11 +412,11 @@ TCHAR *HoursMinutesToTime(HANDLE hContact, const char *szModuleName, const char return buff;
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -426,46 +426,46 @@ TCHAR *DmyToTimeDifference(HANDLE hContact, const char *szModuleName, const char DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, 256, "%sDay", szPrefix);
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sMonth", szPrefix);
int month = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sYear", szPrefix);
int year = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &year))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sHours", szPrefix);
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int hours = 0;
if (GetInt(dbv, &hours))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sMinutes", szPrefix);
int minutes = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &minutes))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sSeconds", szPrefix);
int seconds = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
GetInt(dbv, &seconds);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
SYSTEMTIME st = {0}, st_now;
@@ -502,23 +502,23 @@ TCHAR *DmyToTimeDifference(HANDLE hContact, const char *szModuleName, const char return buff;
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -528,19 +528,19 @@ TCHAR *DayMonthToDaysToNextBirthday(HANDLE hContact, const char *szModuleName, c DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, 256, "%sDay", szPrefix);
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_snprintf(szSettingName, 256, "%sMonth", szPrefix);
int month = 0;
- if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
time_t now = time(NULL);
struct tm *ti = localtime(&now);
int yday_now = ti->tm_yday;
@@ -563,13 +563,13 @@ TCHAR *DayMonthToDaysToNextBirthday(HANDLE hContact, const char *szModuleName, c }
else
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
else
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -585,7 +585,7 @@ TCHAR *EmptyXStatusToDefaultName(HANDLE hContact, const char *szModuleName, cons // translate jabber mood
if (ProtoServiceExists(szModuleName, "/SendXML")) // jabber protocol?
{
- if (!DBGetContactSettingTString(hContact, szModuleName, szSettingName, &dbv))
+ if (!db_get_ts(hContact, szModuleName, szSettingName, &dbv))
{
_tcsncpy(buff, TranslateTS(dbv.ptszVal), bufflen);
buff[bufflen - 1] = 0;
@@ -596,7 +596,7 @@ TCHAR *EmptyXStatusToDefaultName(HANDLE hContact, const char *szModuleName, cons if (NullTranslation(hContact, szModuleName, szSettingName, buff, bufflen))
return buff;
- int status = DBGetContactSettingByte(hContact, szModuleName, "XStatusId", 0);
+ int status = db_get_b(hContact, szModuleName, "XStatusId", 0);
if (!status) return 0;
if (ProtoServiceExists(szModuleName, PS_GETCUSTOMSTATUSEX))
@@ -618,7 +618,7 @@ TCHAR *EmptyXStatusToDefaultName(HANDLE hContact, const char *szModuleName, cons TCHAR *TimezoneToTime(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- int timezone = DBGetContactSettingByte(hContact,szModuleName,szSettingName,256);
+ int timezone = db_get_b(hContact,szModuleName,szSettingName,256);
if (timezone==256 || (char)timezone==-100)
return 0;
@@ -643,7 +643,7 @@ TCHAR *TimezoneToTime(HANDLE hContact, const char *szModuleName, const char *szS TCHAR *ByteToDay(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- int iDay = DBGetContactSettingWord(hContact, szModuleName, szSettingName, -1);
+ int iDay = db_get_w(hContact, szModuleName, szSettingName, -1);
if (iDay > -1 && iDay < 7)
{
a2t(Translate(days[iDay]), buff, bufflen);
@@ -656,7 +656,7 @@ TCHAR *ByteToDay(HANDLE hContact, const char *szModuleName, const char *szSettin TCHAR *ByteToMonth(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- int iMonth = DBGetContactSettingWord(hContact, szModuleName, szSettingName, 0);
+ int iMonth = db_get_w(hContact, szModuleName, szSettingName, 0);
if (iMonth > 0 && iMonth < 13)
{
a2t(Translate(months[iMonth - 1]), buff, bufflen);
@@ -669,7 +669,7 @@ TCHAR *ByteToMonth(HANDLE hContact, const char *szModuleName, const char *szSett TCHAR *ByteToLanguage(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
- int iLang = DBGetContactSettingByte(hContact, szModuleName, szSettingName, 0);
+ int iLang = db_get_b(hContact, szModuleName, szSettingName, 0);
if (iLang)
{
for (int i = 0; i < SIZEOF(languages); i++)
@@ -725,7 +725,7 @@ static DBVTranslation internalTranslations[] = void InitTranslations()
{
- dwNextFuncId = DBGetContactSettingDword(0, MODULE_ITEMS, "NextFuncId", 1);
+ dwNextFuncId = db_get_dw(0, MODULE_ITEMS, "NextFuncId", 1);
for (int i = 0; i < SIZEOF(internalTranslations); i++)
AddTranslation( &internalTranslations[i] );
diff --git a/plugins/TopToolBar/src/toolbarwnd.cpp b/plugins/TopToolBar/src/toolbarwnd.cpp index 9801ac5faa..b0778edff9 100644 --- a/plugins/TopToolBar/src/toolbarwnd.cpp +++ b/plugins/TopToolBar/src/toolbarwnd.cpp @@ -305,7 +305,7 @@ INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam) int LoadBackgroundOptions()
{
//load options
- bkColour = DBGetContactSettingDword(NULL, TTB_OPTDIR, "BkColour", TTBDEFAULT_BKCOLOUR);
+ bkColour = db_get_dw(NULL, TTB_OPTDIR, "BkColour", TTBDEFAULT_BKCOLOUR);
if (hBmpBackground) {
DeleteObject(hBmpBackground);
hBmpBackground = NULL;
@@ -313,12 +313,12 @@ int LoadBackgroundOptions() if (db_get_b(NULL, TTB_OPTDIR, "UseBitmap", TTBDEFAULT_USEBITMAP)) {
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, TTB_OPTDIR, "BkBitmap", &dbv)) {
+ if (!db_get(NULL, TTB_OPTDIR, "BkBitmap", &dbv)) {
hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
- backgroundBmpUse = DBGetContactSettingWord(NULL, TTB_OPTDIR, "BkBmpUse", TTBDEFAULT_BKBMPUSE);
+ backgroundBmpUse = db_get_w(NULL, TTB_OPTDIR, "BkBmpUse", TTBDEFAULT_BKBMPUSE);
RECT rc;
GetClientRect(g_ctrl->hWnd, &rc);
diff --git a/plugins/TopToolBar/src/topbutton.cpp b/plugins/TopToolBar/src/topbutton.cpp index 8e2f8a1cfd..d0d423f7e7 100644 --- a/plugins/TopToolBar/src/topbutton.cpp +++ b/plugins/TopToolBar/src/topbutton.cpp @@ -134,8 +134,8 @@ void TopButtonInt::SaveSettings(int *SepCnt, int *LaunchCnt) char buf2[20];
AS(buf2, "Launch", buf1);
- DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, buf2, "_name"), pszName);
- DBWriteContactSettingTString(0, TTB_OPTDIR, AS(buf, buf2, "_lpath"), ptszProgram);
+ db_set_s(0, TTB_OPTDIR, AS(buf, buf2, "_name"), pszName);
+ db_set_ts(0, TTB_OPTDIR, AS(buf, buf2, "_lpath"), ptszProgram);
db_set_b(0, TTB_OPTDIR, AS(buf, buf2, "_Position"), arrangedpos);
db_set_b(0, TTB_OPTDIR, AS(buf, buf2, "_Visible"), isVisible());
}
diff --git a/plugins/TranslitSwitcher/src/Layoutproc.cpp b/plugins/TranslitSwitcher/src/Layoutproc.cpp index 6cd5342ad5..26ab1ebe52 100644 --- a/plugins/TranslitSwitcher/src/Layoutproc.cpp +++ b/plugins/TranslitSwitcher/src/Layoutproc.cpp @@ -806,10 +806,10 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)smileyPrs);
DBVARIANT dbv = {0};
- DBGetContactSettingTString(NULL, "TranslitSwitcher", "ResendSymbol", &dbv);
+ db_get_ts(NULL, "TranslitSwitcher", "ResendSymbol", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SendMessage(hEdit, WM_SETTEXT, 0, (LPARAM)sel);
SendMessage(hEdit, EM_SETSEL, 0, slen);
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
@@ -855,10 +855,10 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) if (slen != 0)
Transliterate(sel);
DBVARIANT dbv = {0};
- DBGetContactSettingTString(NULL, "TranslitSwitcher", "ResendSymbol", &dbv);
+ db_get_ts(NULL, "TranslitSwitcher", "ResendSymbol", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SendMessage(hEdit, WM_SETTEXT, 0, (LPARAM)sel);
SendMessage(hEdit, EM_SETSEL, 0, slen);
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
@@ -903,10 +903,10 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) if (slen != 0)
Invert(sel);
DBVARIANT dbv = {0};
- DBGetContactSettingTString(NULL, "TranslitSwitcher", "ResendSymbol", &dbv);
+ db_get_ts(NULL, "TranslitSwitcher", "ResendSymbol", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SendMessage(hEdit, WM_SETTEXT, 0, (LPARAM)sel);
SendMessage(hEdit, EM_SETSEL, 0, slen);
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
diff --git a/plugins/UserGuide/src/main.cpp b/plugins/UserGuide/src/main.cpp index 5650084b91..a0cb7e9ffa 100644 --- a/plugins/UserGuide/src/main.cpp +++ b/plugins/UserGuide/src/main.cpp @@ -34,7 +34,7 @@ static INT_PTR ShowGuideFile(WPARAM wParam, LPARAM lParam) pszDirName = (LPTSTR)mir_alloc(250*sizeof(TCHAR));
pszFileName = (LPTSTR)mir_alloc(250*sizeof(TCHAR));
- iRes = DBGetContactSettingTString(NULL, "UserGuide", "PathToHelpFile", &dbv);
+ iRes = db_get_ts(NULL, "UserGuide", "PathToHelpFile", &dbv);
if (iRes!=0)
{
@@ -64,7 +64,7 @@ static INT_PTR ShowGuideFile(WPARAM wParam, LPARAM lParam) pszDirName[pszDivider - dbv.ptszVal] = 0;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (ServiceExists(MS_UTILS_REPLACEVARS))
pszDirNameEx = (TCHAR *) CallService(MS_UTILS_REPLACEVARS, (WPARAM)pszDirName, (LPARAM)&dat);
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 7f068b1e00..ced26a1b07 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -207,8 +207,8 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) else if (countryNumber = (int)DB::Setting::GetWord((HANDLE)wParam,pszProto,"CompanyCountry",0))
return (INT_PTR)countryNumber;
/* fallback ip detect
- else if(countryNumber==0xFFFF && DBGetContactSettingByte(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT)) {
- countryNumber=ServiceIpToCountry(DBGetContactSettingDword((HANDLE)wParam,pszProto,"RealIP",0),0);
+ else if(countryNumber==0xFFFF && db_get_b(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT)) {
+ countryNumber=ServiceIpToCountry(db_get_dw((HANDLE)wParam,pszProto,"RealIP",0),0);
}*/
return (INT_PTR)0xFFFF;
diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp index c82965f96c..cdf94288cc 100644 --- a/plugins/UserInfoEx/src/svc_avatar.cpp +++ b/plugins/UserInfoEx/src/svc_avatar.cpp @@ -186,7 +186,7 @@ namespace NServices }
// the absolute file is valid
- if (bInvalidAvatar && !DBGetContactSetting(hContact, "ContactPhoto", "File", &dbv))
+ if (bInvalidAvatar && !db_get(hContact, "ContactPhoto", "File", &dbv))
{
FILE *f = fopen(dbv.pszVal, "rb");
if (f) {
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index b0d5b382ec..105d7f2c68 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
-static HANDLE ghMenuItem = NULL;
+static HGENMENU ghMenuItem = NULL;
static HANDLE ghExtraIconDef = INVALID_HANDLE_VALUE;
static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE;
@@ -172,16 +172,9 @@ static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw **/
static int OnPreBuildMenu(WPARAM wParam, LPARAM lParam)
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
-
LPSTR val = Get((HANDLE)wParam);
- if (val)
- mir_free(val);
- else
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)ghMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(ghMenuItem, val != NULL);
+ mir_free(val);
return 0;
}
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index 5e8aeddc73..9ed2639af1 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
-static HANDLE ghMenuItem = NULL;
+static HGENMENU ghMenuItem = NULL;
static HANDLE ghExtraIconDef = INVALID_HANDLE_VALUE;
static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE;
@@ -134,19 +134,9 @@ static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw **/
static int OnPreBuildMenu(WPARAM wParam, LPARAM lParam)
{
- LPSTR val;
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
-
- val = Get((HANDLE)wParam);
- if (val)
- {
- MIR_FREE(val);
- }
- else mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)ghMenuItem, (LPARAM)&mi);
+ LPSTR val = Get((HANDLE)wParam);
+ Menu_ShowItem(ghMenuItem, val != 0);
+ mir_free(val);
return 0;
}
diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp index a32ea2fe91..1905435b41 100644 --- a/plugins/Utils/mir_options.cpp +++ b/plugins/Utils/mir_options.cpp @@ -115,19 +115,19 @@ static void LoadOpt(OptPageControl *ctrl, char *module) break;
case CONTROL_SPIN:
- *((WORD *) ctrl->var) = DBGetContactSettingWord(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((WORD *) ctrl->var) = db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_COLOR:
- *((COLORREF *) ctrl->var) = (COLORREF) DBGetContactSettingDword(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((COLORREF *) ctrl->var) = (COLORREF) db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_RADIO:
- *((WORD *) ctrl->var) = DBGetContactSettingWord(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((WORD *) ctrl->var) = db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_COMBO:
- *((WORD *) ctrl->var) = DBGetContactSettingWord(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((WORD *) ctrl->var) = db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_PROTOCOL_LIST:
@@ -143,7 +143,7 @@ static void LoadOpt(OptPageControl *ctrl, char *module) tmp[0]=0;
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingString(NULL, module, ctrl->setting, &dbv))
+ if ( !db_get_s(NULL, module, ctrl->setting, &dbv))
{
lstrcpynA(tmp, dbv.pszVal, SIZEOF(tmp));
db_free(&dbv);
@@ -161,7 +161,7 @@ static void LoadOpt(OptPageControl *ctrl, char *module) break;
case CONTROL_INT:
- *((int *) ctrl->var) = (int) DBGetContactSettingDword(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((int *) ctrl->var) = (int) db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_FILE:
@@ -205,19 +205,19 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha case CONTROL_SPIN:
SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, ctrl->nID),0);
SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETRANGE, 0, MAKELONG(ctrl->max, ctrl->min));
- SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETPOS,0, MAKELONG(DBGetContactSettingWord(NULL, module, ctrl->setting, ctrl->dwDefValue), 0));
+ SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETPOS,0, MAKELONG(db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue), 0));
break;
case CONTROL_COLOR:
- SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_SETCOLOUR, 0, (COLORREF) DBGetContactSettingDword(NULL, module, ctrl->setting, ctrl->dwDefValue));
+ SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_SETCOLOUR, 0, (COLORREF) db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue));
break;
case CONTROL_RADIO:
- CheckDlgButton(hwndDlg, ctrl->nID, DBGetContactSettingWord(NULL, module, ctrl->setting, ctrl->dwDefValue) == ctrl->value ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, ctrl->nID, db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue) == ctrl->value ? BST_CHECKED : BST_UNCHECKED);
break;
case CONTROL_COMBO:
- SendDlgItemMessage(hwndDlg, ctrl->nID, CB_SETCURSEL, DBGetContactSettingWord(NULL, module, ctrl->setting, ctrl->dwDefValue), 0);
+ SendDlgItemMessage(hwndDlg, ctrl->nID, CB_SETCURSEL, db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue), 0);
break;
case CONTROL_PROTOCOL_LIST:
@@ -279,7 +279,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha tmp[0]=0;
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingString(NULL, module, ctrl->setting, &dbv)) {
+ if ( !db_get_s(NULL, module, ctrl->setting, &dbv)) {
lstrcpynA(tmp, dbv.pszVal, SIZEOF(tmp));
db_free(&dbv);
}
@@ -295,7 +295,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha break;
case CONTROL_INT:
{
- DWORD var = DBGetContactSettingDword(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ DWORD var = db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue);
SetDlgItemInt(hwndDlg, ctrl->nID, var, ctrl->min <= 0);
SendDlgItemMessage(hwndDlg, ctrl->nID, EM_LIMITTEXT, 9, 0);
}
@@ -381,24 +381,24 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha switch(ctrl->type) {
case CONTROL_CHECKBOX:
- DBWriteContactSettingByte(NULL, module, ctrl->setting, (BYTE) IsDlgButtonChecked(hwndDlg, ctrl->nID));
+ db_set_b(NULL, module, ctrl->setting, (BYTE) IsDlgButtonChecked(hwndDlg, ctrl->nID));
break;
case CONTROL_SPIN:
- DBWriteContactSettingWord(NULL, module, ctrl->setting, (WORD) SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, module, ctrl->setting, (WORD) SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_GETPOS, 0, 0));
break;
case CONTROL_COLOR:
- DBWriteContactSettingDword(NULL, module, ctrl->setting, (DWORD) SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_GETCOLOUR, 0, 0));
+ db_set_dw(NULL, module, ctrl->setting, (DWORD) SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_GETCOLOUR, 0, 0));
break;
case CONTROL_RADIO:
if (IsDlgButtonChecked(hwndDlg, ctrl->nID))
- DBWriteContactSettingWord(NULL, module, ctrl->setting, (BYTE) ctrl->value);
+ db_set_w(NULL, module, ctrl->setting, (BYTE) ctrl->value);
break;
case CONTROL_COMBO:
- DBWriteContactSettingWord(NULL, module, ctrl->setting, (WORD) SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, module, ctrl->setting, (WORD) SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0));
break;
case CONTROL_PROTOCOL_LIST:
@@ -415,7 +415,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha ListView_GetItem(hwndProtocols, &lvi);
char *setting = (char *)lvi.lParam;
- DBWriteContactSettingByte(NULL, module, setting, (BYTE)ListView_GetCheckState(hwndProtocols, i));
+ db_set_b(NULL, module, setting, (BYTE)ListView_GetCheckState(hwndProtocols, i));
}
}
break;
@@ -424,7 +424,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha {
TCHAR tmp[1024];
GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
- DBWriteContactSettingTString(NULL, module, ctrl->setting, tmp);
+ db_set_ts(NULL, module, ctrl->setting, tmp);
}
break;
@@ -445,7 +445,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha }
CallService(MS_DB_CRYPT_ENCODESTRING, SIZEOF(tmp), (LPARAM) tmp);
- DBWriteContactSettingString(NULL, module, ctrl->setting, tmp);
+ db_set_s(NULL, module, ctrl->setting, tmp);
// Don't load from DB
continue;
@@ -460,7 +460,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha val = min(val, ctrl->max);
if (ctrl->min != 0)
val = max(val, ctrl->min);
- DBWriteContactSettingDword(NULL, module, ctrl->setting, val);
+ db_set_dw(NULL, module, ctrl->setting, val);
}
break;
case CONTROL_FILE:
@@ -469,20 +469,20 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha GetDlgItemText(hwndDlg, ctrl->nID, tmp, 1024);
TCHAR rel[1024];
PathToRelative(rel, 1024, tmp);
- DBWriteContactSettingTString(NULL, module, ctrl->setting, rel);
+ db_set_ts(NULL, module, ctrl->setting, rel);
}
break;
case CONTROL_COMBO_TEXT:
{
TCHAR tmp[1024];
GetDlgItemText(hwndDlg, ctrl->nID, tmp, 1024);
- DBWriteContactSettingTString(NULL, module, ctrl->setting, tmp);
+ db_set_ts(NULL, module, ctrl->setting, tmp);
}
break;
case CONTROL_COMBO_ITEMDATA:
{
int sel = SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0);
- DBWriteContactSettingTString(NULL, module, ctrl->setting, (TCHAR *) SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETITEMDATA, (WPARAM) sel, 0));
+ db_set_ts(NULL, module, ctrl->setting, (TCHAR *) SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETITEMDATA, (WPARAM) sel, 0));
}
break;
}
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);
}
diff --git a/plugins/VersionInfo/src/CVersionInfo.cpp b/plugins/VersionInfo/src/CVersionInfo.cpp index c67099874f..a477ae1258 100644 --- a/plugins/VersionInfo/src/CVersionInfo.cpp +++ b/plugins/VersionInfo/src/CVersionInfo.cpp @@ -532,7 +532,7 @@ bool CVersionInfo::GetOSLanguages() lpzOSLanguages += _T("/");
lpzOSLanguages += GetLanguageName(LOCALE_SYSTEM_DEFAULT);
- if (DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", 0)) {
+ if (db_get_b(NULL, ModuleName, "ShowInstalledLanguages", 0)) {
szSystemLocales[0] = '\0';
lpzOSLanguages += _T(" [");
EnumSystemLocales(EnumSystemLocalesProc, LCID_INSTALLED);
@@ -701,7 +701,7 @@ bool CVersionInfo::GetPluginLists() int bUnknownError = 1; //assume plugin didn't load because of unknown error
//Some error messages.
//get the dlls the plugin statically links to
- if (DBGetContactSettingByte(NULL, ModuleName, "CheckForDependencies", TRUE))
+ if (db_get_b(NULL, ModuleName, "CheckForDependencies", TRUE))
{
std::tstring linkedModules;
@@ -890,7 +890,7 @@ std::tstring CVersionInfo::GetListAsString(std::list<CPlugin> &aList, DWORD flag TCHAR szHeader[32] = {0};
TCHAR szFooter[32] = {0};
- if ((((flags & VISF_FORUMSTYLE) == VISF_FORUMSTYLE) || beautify) && (DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE))) {
+ if ((((flags & VISF_FORUMSTYLE) == VISF_FORUMSTYLE) || beautify) && (db_get_b(NULL, ModuleName, "BoldVersionNumber", TRUE))) {
GetStringFromDatabase("BoldBegin", _T("[b]"), szHeader, SIZEOF(szHeader));
GetStringFromDatabase("BoldEnd", _T("[/b]"), szFooter, SIZEOF(szFooter));
}
@@ -1034,10 +1034,10 @@ static void AddSectionAndCount(std::list<CPlugin> list, LPCTSTR listText, std::t std::tstring CVersionInfo::GetInformationsAsString(int bDisableForumStyle) {
//Begin of report
std::tstring out;
- int forumStyle = (bDisableForumStyle) ? 0 : DBGetContactSettingByte(NULL, ModuleName, "ForumStyle", TRUE);
- int showUUID = DBGetContactSettingByte(NULL, ModuleName, "ShowUUIDs", FALSE);
- int beautify = DBGetContactSettingByte(NULL, ModuleName, "Beautify", 0) & (!forumStyle);
- int suppressHeader = DBGetContactSettingByte(NULL, ModuleName, "SuppressHeader", TRUE);
+ int forumStyle = (bDisableForumStyle) ? 0 : db_get_b(NULL, ModuleName, "ForumStyle", TRUE);
+ int showUUID = db_get_b(NULL, ModuleName, "ShowUUIDs", FALSE);
+ int beautify = db_get_b(NULL, ModuleName, "Beautify", 0) & (!forumStyle);
+ int suppressHeader = db_get_b(NULL, ModuleName, "SuppressHeader", TRUE);
DWORD flags = (forumStyle) | (showUUID << 1);
@@ -1073,7 +1073,7 @@ std::tstring CVersionInfo::GetInformationsAsString(int bDisableForumStyle) { GetStringFromDatabase("BeautifyPluginsEnd", _T("</font>"), normalPluginsEnd, SIZEOF(normalPluginsEnd));
BeautifyReport(beautify, normalPluginsEnd, _T(""), out);
//Plugins: list of inactive (disabled) plugins.
- if ((!forumStyle) && ((DBGetContactSettingByte(NULL, ModuleName, "ShowInactive", TRUE)) || (bServiceMode))) {
+ if ((!forumStyle) && ((db_get_b(NULL, ModuleName, "ShowInactive", TRUE)) || (bServiceMode))) {
BeautifyReport(beautify, horizLine, _T("\r\n"), out);
GetStringFromDatabase("BeautifyInactiveHeaderBegin", _T("<b><font size=\"-1\" color=\"DarkRed\">"), buffer, SIZEOF(buffer));
BeautifyReport(beautify, buffer, headerHighlightStart, out);
diff --git a/plugins/VersionInfo/src/dlgHandlers.cpp b/plugins/VersionInfo/src/dlgHandlers.cpp index 3fb436b04e..6ffb2cf332 100644 --- a/plugins/VersionInfo/src/dlgHandlers.cpp +++ b/plugins/VersionInfo/src/dlgHandlers.cpp @@ -65,7 +65,7 @@ INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TranslateDialogDefault(hWnd);
- oldFSFValue = DBGetContactSettingByte(NULL, ModuleName, "ForumStyle", 1);
+ oldFSFValue = db_get_b(NULL, ModuleName, "ForumStyle", 1);
AddInfoToComboboxes(hWnd, IDC_ASK_QUOTECOMBOBOX, IDC_ASK_SIZECOMBOBOX, IDC_ASK_BOLDCOMBOBOX);
@@ -122,17 +122,17 @@ INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) int newFSFValue = IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE);
if (newFSFValue != oldFSFValue)
- DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", newFSFValue); //temporary store the new value
+ db_set_b(NULL, ModuleName, "ForumStyle", newFSFValue); //temporary store the new value
if (newFSFValue) {
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", quoteBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", quoteEnd);
+ db_set_ts(NULL, ModuleName, "QuoteBegin", quoteBegin);
+ db_set_ts(NULL, ModuleName, "QuoteEnd", quoteEnd);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", sizeBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", sizeEnd);
+ db_set_ts(NULL, ModuleName, "SizeBegin", sizeBegin);
+ db_set_ts(NULL, ModuleName, "SizeEnd", sizeEnd);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", boldBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", boldEnd);
+ db_set_ts(NULL, ModuleName, "BoldBegin", boldBegin);
+ db_set_ts(NULL, ModuleName, "BoldEnd", boldEnd);
}
int debugTo = TO_DIALOGBOX; //just to be safe
@@ -152,17 +152,17 @@ INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) DoDebugTo(debugTo);
if (newFSFValue != oldFSFValue)
- DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", oldFSFValue);
+ db_set_b(NULL, ModuleName, "ForumStyle", oldFSFValue);
if (newFSFValue) {
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", oldQuoteBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", oldQuoteEnd);
+ db_set_ts(NULL, ModuleName, "QuoteBegin", oldQuoteBegin);
+ db_set_ts(NULL, ModuleName, "QuoteEnd", oldQuoteEnd);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", oldSizeBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", oldSizeEnd);
+ db_set_ts(NULL, ModuleName, "SizeBegin", oldSizeBegin);
+ db_set_ts(NULL, ModuleName, "SizeEnd", oldSizeEnd);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", oldBoldBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", oldBoldEnd);
+ db_set_ts(NULL, ModuleName, "BoldBegin", oldBoldBegin);
+ db_set_ts(NULL, ModuleName, "BoldEnd", oldBoldEnd);
}
DestroyWindow(hWnd);
@@ -215,7 +215,7 @@ int DoDebugTo(int debugTo) break;
}
- if ((debugTo != TO_CLIPBOARD) && (DBGetContactSettingByte(NULL, ModuleName, "ClipboardAlways", FALSE)))
+ if ((debugTo != TO_CLIPBOARD) && (db_get_b(NULL, ModuleName, "ClipboardAlways", FALSE)))
myInfo.PrintInformationsToClipboard(false);
if ((bServiceMode) && (debugTo != TO_DIALOGBOX) && (debugTo != TO_ASK)) //close miranda if in service mode and no dialog was shown
@@ -241,16 +241,16 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TranslateDialogDefault(hWnd);
AddInfoToComboboxes(hWnd, IDC_QUOTECOMBOBOX, IDC_SIZECOMBOBOX, IDC_BOLDCOMBOBOX);
- CheckDlgButton(hWnd, IDC_FORUMSTYLE, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ForumStyle", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_DISABLEDTOO, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInactive", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SHOWUUIDS, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowUUIDs", FALSE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SHOWINSTALLEDLANGUAGES, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", FALSE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SUPPRESSHEADER, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "SuppressHeader", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_FORUMSTYLE, (BOOL) db_get_b(NULL, ModuleName, "ForumStyle", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_DISABLEDTOO, (BOOL) db_get_b(NULL, ModuleName, "ShowInactive", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOWUUIDS, (BOOL) db_get_b(NULL, ModuleName, "ShowUUIDs", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOWINSTALLEDLANGUAGES, (BOOL) db_get_b(NULL, ModuleName, "ShowInstalledLanguages", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SUPPRESSHEADER, (BOOL) db_get_b(NULL, ModuleName, "SuppressHeader", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SHOWINTASKBAR, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_CLIPBOARDALSO, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ClipboardAlways", FALSE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_BOLDVERSION, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_CHECKUNLOADABLE, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "CheckForDependencies", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOWINTASKBAR, (BOOL) db_get_b(NULL, ModuleName, "ShowInTaskbar", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_CLIPBOARDALSO, (BOOL) db_get_b(NULL, ModuleName, "ClipboardAlways", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_BOLDVERSION, (BOOL) db_get_b(NULL, ModuleName, "BoldVersionNumber", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_CHECKUNLOADABLE, (BOOL) db_get_b(NULL, ModuleName, "CheckForDependencies", TRUE) ? BST_CHECKED : BST_UNCHECKED);
SetFocus(GetDlgItem(hWnd, IDC_FORUMSTYLE));
{
DBVARIANT dbv = { 0 };
@@ -258,7 +258,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TCHAR buffer[1024];
TCHAR notFound[1024];
- if (DBGetContactSettingTString(NULL, ModuleName, "OutputFile", &dbv) == 0)
+ if (db_get_ts(NULL, ModuleName, "OutputFile", &dbv) == 0)
RelativePathToAbsolute(dbv.ptszVal, notFound, SIZEOF(notFound));
else
RelativePathToAbsolute( _T("VersionInfo.txt"), notFound, SIZEOF(notFound));
@@ -291,7 +291,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) GetStringFromDatabase("UploadServer", _T("vi.cass.cz"), buffer, SIZEOF(buffer));
SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_SERVER), buffer);
- int port = DBGetContactSettingWord(NULL, ModuleName, "UploadPort", DEFAULT_UPLOAD_PORT);
+ int port = db_get_w(NULL, ModuleName, "UploadPort", DEFAULT_UPLOAD_PORT);
_itot(port, buffer, 10);
SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PORT), buffer);
@@ -303,7 +303,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PASSWORD), buffer);
}
- switch(DBGetContactSettingByte(NULL, ModuleName, "DebugTo", TO_DIALOGBOX)) {
+ switch(db_get_b(NULL, ModuleName, "DebugTo", TO_DIALOGBOX)) {
case TO_FILE:
CheckDlgButton(hWnd, IDC_TOFILE, BST_CHECKED);
break;
@@ -440,53 +440,53 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TCHAR start[256], end[256];
SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
SplitStringInfo(buffer, start, end);
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", start);
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", end);
+ db_set_ts(NULL, ModuleName, "QuoteBegin", start);
+ db_set_ts(NULL, ModuleName, "QuoteEnd", end);
SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
SplitStringInfo(buffer, start, end);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", start);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", end);
+ db_set_ts(NULL, ModuleName, "SizeBegin", start);
+ db_set_ts(NULL, ModuleName, "SizeEnd", end);
SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
SplitStringInfo(buffer, start, end);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", start);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", end);
+ db_set_ts(NULL, ModuleName, "BoldBegin", start);
+ db_set_ts(NULL, ModuleName, "BoldEnd", end);
}
- DBWriteContactSettingByte(NULL, ModuleName, "CheckForDependencies", IsDlgButtonChecked(hWnd, IDC_CHECKUNLOADABLE) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "BoldVersionNumber", IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "ClipboardAlways", IsDlgButtonChecked(hWnd, IDC_CLIPBOARDALSO) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "SuppressHeader", IsDlgButtonChecked(hWnd, IDC_SUPPRESSHEADER) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "ShowUUIDs", IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", IsDlgButtonChecked(hWnd, IDC_SHOWINSTALLEDLANGUAGES) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "CheckForDependencies", IsDlgButtonChecked(hWnd, IDC_CHECKUNLOADABLE) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "BoldVersionNumber", IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "ForumStyle", IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "ClipboardAlways", IsDlgButtonChecked(hWnd, IDC_CLIPBOARDALSO) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "SuppressHeader", IsDlgButtonChecked(hWnd, IDC_SUPPRESSHEADER) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "ShowUUIDs", IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "ShowInstalledLanguages", IsDlgButtonChecked(hWnd, IDC_SHOWINSTALLEDLANGUAGES) ? TRUE : FALSE);
if (!hOutputLocation) {
TCHAR filePath[MAX_PATH], fileName[MAX_PATH];
GetDlgItemText(hWnd, IDC_FILENAME, fileName, MAX_PATH);
AbsolutePathToRelative(fileName, filePath, SIZEOF(filePath));
- DBWriteContactSettingTString(NULL, ModuleName, "OutputFile", filePath); //store relative path
+ db_set_ts(NULL, ModuleName, "OutputFile", filePath); //store relative path
}
- DBWriteContactSettingByte(NULL, ModuleName, "ShowInTaskbar", IsDlgButtonChecked(hWnd, IDC_SHOWINTASKBAR) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "ShowInTaskbar", IsDlgButtonChecked(hWnd, IDC_SHOWINTASKBAR) ? TRUE : FALSE);
//Debug to:
if (IsDlgButtonChecked(hWnd, IDC_TOFILE))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_FILE);
+ db_set_b(NULL, ModuleName, "DebugTo", TO_FILE);
else if (IsDlgButtonChecked(hWnd, IDC_TOMESSAGEBOX))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_MESSAGEBOX);
+ db_set_b(NULL, ModuleName, "DebugTo", TO_MESSAGEBOX);
else if (IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
+ db_set_b(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
else if (IsDlgButtonChecked(hWnd, IDC_TODEBUGSTRING))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_DEBUGSTRING);
+ db_set_b(NULL, ModuleName, "DebugTo", TO_DEBUGSTRING);
else if (IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_CLIPBOARD);
+ db_set_b(NULL, ModuleName, "DebugTo", TO_CLIPBOARD);
else if (IsDlgButtonChecked(hWnd, IDC_TOUPLOAD))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_UPLOAD);
+ db_set_b(NULL, ModuleName, "DebugTo", TO_UPLOAD);
else if (IsDlgButtonChecked(hWnd, IDC_ASKEVERYTIME))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_ASK);
+ db_set_b(NULL, ModuleName, "DebugTo", TO_ASK);
EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), TRUE);
//Disabled plugins too?
- DBWriteContactSettingByte(NULL, ModuleName, "ShowInactive", IsDlgButtonChecked(hWnd, IDC_DISABLEDTOO)?TRUE:FALSE);
+ db_set_b(NULL, ModuleName, "ShowInactive", IsDlgButtonChecked(hWnd, IDC_DISABLEDTOO)?TRUE:FALSE);
GetStringFromDatabase("UUIDCharMark", _T(DEF_UUID_CHARMARK), PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
} }
@@ -504,7 +504,7 @@ INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
myInfo = (CVersionInfo *) lParam;
- if (DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE)) {
+ if (db_get_b(NULL, ModuleName, "ShowInTaskbar", TRUE)) {
DWORD ws;
ws = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
SetWindowLongPtr(hWnd, GWL_EXSTYLE, ws | WS_EX_APPWINDOW);
@@ -517,7 +517,7 @@ INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam LOGFONT lf = { 0 };
dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(NULL, "OptionFont", "Font", &dbv) == 0)
+ if (db_get(NULL, "OptionFont", "Font", &dbv) == 0)
lf=*(LOGFONT*)dbv.pbVal;
else {
HFONT hFont = (HFONT)SendDlgItemMessage(hWnd,IDC_CLOSE,WM_GETFONT,0,0);
diff --git a/plugins/VersionInfo/src/services.cpp b/plugins/VersionInfo/src/services.cpp index 2f7ad03534..3953af590a 100644 --- a/plugins/VersionInfo/src/services.cpp +++ b/plugins/VersionInfo/src/services.cpp @@ -32,7 +32,7 @@ int InitServices() INT_PTR PluginMenuCommand(WPARAM wParam, LPARAM lParam)
{
- int debugTo = DBGetContactSettingByte(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
+ int debugTo = db_get_b(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
DoDebugTo(debugTo);
if (verbose) PUShowMessage("I have printed the information.", SM_NOTIFY);
/* char *data;
diff --git a/plugins/VersionInfo/src/utils.cpp b/plugins/VersionInfo/src/utils.cpp index 1822880a3f..1573d3260c 100644 --- a/plugins/VersionInfo/src/utils.cpp +++ b/plugins/VersionInfo/src/utils.cpp @@ -63,7 +63,7 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, DBVARIANT dbv = {0};
int res = 1;
size_t len;
- if ( DBGetContactSettingTString(NULL, ModuleName, szSettingName, &dbv) == 0) {
+ if ( db_get_ts(NULL, ModuleName, szSettingName, &dbv) == 0) {
res = 0;
size_t tmp = _tcslen(dbv.ptszVal);
len = (tmp < size - 1) ? tmp : size - 1;
diff --git a/plugins/Watrack_MPD/src/init.cpp b/plugins/Watrack_MPD/src/init.cpp index d83e142bed..9b33425cb7 100755 --- a/plugins/Watrack_MPD/src/init.cpp +++ b/plugins/Watrack_MPD/src/init.cpp @@ -50,7 +50,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda void InitVars()
{
- gbPort = DBGetContactSettingWord(NULL, szModuleName, "Port", 6600);
+ gbPort = db_get_w(NULL, szModuleName, "Port", 6600);
gbPassword = (TCHAR*)malloc(64*sizeof(TCHAR));
gbHost = (TCHAR*)malloc(128*sizeof(TCHAR));
gbHost = UniGetContactSettingUtf(NULL, szModuleName, "Server", _T("127.0.0.1"));
diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp index 770d5988b0..9d9d755f8c 100755 --- a/plugins/Watrack_MPD/src/options.cpp +++ b/plugins/Watrack_MPD/src/options.cpp @@ -23,7 +23,7 @@ static INT_PTR CALLBACK DlgProcWaMpdOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); - SetDlgItemInt(hwndDlg, IDC_PORT, DBGetContactSettingWord(NULL, szModuleName, "Port", 6600), FALSE); + SetDlgItemInt(hwndDlg, IDC_PORT, db_get_w(NULL, szModuleName, "Port", 6600), FALSE); SetDlgItemText(hwndDlg, IDC_SERVER, UniGetContactSettingUtf(NULL, szModuleName, "Server", _T("127.0.0.1"))); SetDlgItemText(hwndDlg, IDC_PASSWORD, UniGetContactSettingUtf(NULL, szModuleName, "Password", _T(""))); return TRUE; @@ -44,13 +44,13 @@ static INT_PTR CALLBACK DlgProcWaMpdOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY: { TCHAR szText[128]; - DBWriteContactSettingWord(NULL, szModuleName, "Port", (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE)); + db_set_w(NULL, szModuleName, "Port", (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE)); gbPort = (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE); GetDlgItemText(hwndDlg, IDC_SERVER, szText, sizeof(szText)); - DBWriteContactSettingTString(NULL, szModuleName, "Server", szText); + db_set_ts(NULL, szModuleName, "Server", szText); _tcscpy(gbHost, szText); GetDlgItemText(hwndDlg, IDC_PASSWORD, szText, sizeof(szText)); - DBWriteContactSettingTString(NULL, szModuleName, "Password", szText); + db_set_ts(NULL, szModuleName, "Password", szText); _tcscpy(gbPassword, szText); return TRUE; } diff --git a/plugins/Watrack_MPD/src/utilities.cpp b/plugins/Watrack_MPD/src/utilities.cpp index 4d63f1f7f4..fc5e621837 100755 --- a/plugins/Watrack_MPD/src/utilities.cpp +++ b/plugins/Watrack_MPD/src/utilities.cpp @@ -21,11 +21,11 @@ TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,c { DBVARIANT dbv = {DBVT_DELETED}; TCHAR* szRes; - if (DBGetContactSettingTString(hContact, szModule, szSetting, &dbv)) + if (db_get_ts(hContact, szModule, szSetting, &dbv)) return _tcsdup(szDef); if(dbv.pszVal) szRes = _tcsdup(dbv.ptszVal); - DBFreeVariant(&dbv); + db_free(&dbv); return szRes; } diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index cd20bd423c..c543dd8576 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -25,7 +25,7 @@ void LoadOptions() DBVARIANT dbv = { 0 };
dbv.type = DBVT_TCHAR;
ZeroMemory(&WumfOptions, sizeof(WumfOptions));
- if (DBGetContactSetting(NULL, ModuleName, OPT_FILE, &dbv) == 0)
+ if (db_get(NULL, ModuleName, OPT_FILE, &dbv) == 0)
_tcsncpy(WumfOptions.LogFile, dbv.ptszVal, 255);
else
WumfOptions.LogFile[0] = '\0';
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index e1f4bb2989..fd59bbbad3 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -474,12 +474,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) if (hContact) {
char* szProto = GetContactProto(hContact);
PROTOACCOUNT *pa = ProtoGetAccount(szProto);
- CLISTMENUITEM mi = { sizeof(mi) };
- if (IsSuitableProto(pa))
- mi.flags = CMIF_TCHAR | CMIM_FLAGS;
- else
- mi.flags = CMIF_TCHAR | CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hChangeSound, (LPARAM)&mi);
+ Menu_ShowItem(hChangeSound, IsSuitableProto(pa));
}
return 0;
}
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index 09afbb815d..45691b407a 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -666,11 +666,11 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR cEvent.flags = 0;
CallServiceSync(MS_CLIST_ADDEVENT, 0,(LPARAM)&cEvent);
}
- DBWriteContactSettingString(ActualAccount->hContact, "CList", "StatusMsg", sMsg);
+ db_set_s(ActualAccount->hContact, "CList", "StatusMsg", sMsg);
if (nflags & YAMN_ACC_CONTNICK)
{
- DBWriteContactSettingString(ActualAccount->hContact, YAMN_DBMODULE, "Nick",sMsg);
+ db_set_s(ActualAccount->hContact, YAMN_DBMODULE, "Nick",sMsg);
}
}
@@ -808,12 +808,12 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR {
char tmp[255];
sprintf(tmp,Translate("%d new mail message(s), %d total"),MN->Real.PopUpNC+MN->Virtual.PopUpNC,MN->Real.PopUpTC+MN->Virtual.PopUpTC);
- DBWriteContactSettingString(ActualAccount->hContact, "CList", "StatusMsg", tmp);
+ db_set_s(ActualAccount->hContact, "CList", "StatusMsg", tmp);
}
- else DBWriteContactSettingString(ActualAccount->hContact, "CList", "StatusMsg", Translate("No new mail message"));
+ else db_set_s(ActualAccount->hContact, "CList", "StatusMsg", Translate("No new mail message"));
if (nflags & YAMN_ACC_CONTNICK)
- DBWriteContactSettingString(ActualAccount->hContact, YAMN_DBMODULE, "Nick", ActualAccount->Name);
+ db_set_s(ActualAccount->hContact, YAMN_DBMODULE, "Nick", ActualAccount->Name);
}
}
return;
@@ -850,10 +850,10 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0);
- if (!DBGetContactSetting((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
+ if (!db_get((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
{
Account=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
Account = (HACCOUNT) hContact; //????
@@ -918,10 +918,10 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0);
- if (!DBGetContactSetting((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
+ if (!db_get((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
ActualAccount = (HACCOUNT) hContact;
@@ -951,10 +951,10 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0);
- if (!DBGetContactSetting((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
+ if (!db_get((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
ActualAccount = (HACCOUNT) hContact;
@@ -1018,10 +1018,10 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0);
- if (!DBGetContactSetting((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
+ if (!db_get((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
ActualAccount = (HACCOUNT) hContact;
@@ -1778,10 +1778,10 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM SizeX=coord.right-coord.left;
PosY=coord.top;
SizeY=coord.bottom-coord.top;
- DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBPOSX,PosX);
- DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBPOSY,PosY);
- DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBSIZEX,SizeX);
- DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBSIZEY,SizeY);
+ db_set_dw(NULL,YAMN_DBMODULE,YAMN_DBPOSX,PosX);
+ db_set_dw(NULL,YAMN_DBMODULE,YAMN_DBPOSY,PosY);
+ db_set_dw(NULL,YAMN_DBMODULE,YAMN_DBSIZEX,SizeX);
+ db_set_dw(NULL,YAMN_DBMODULE,YAMN_DBSIZEY,SizeY);
}
KillTimer(hDlg,TIMER_FLASHING);
@@ -2188,7 +2188,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM }
}
CloseHandle(ThreadRunningEV);
- if (DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0))
+ if (db_get_b(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0))
DestroyWindow(hDlg);
}
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index ea1a33e870..ccb7598853 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -52,9 +52,9 @@ HANDLE hTTButton; UINT SecTimer;
-HANDLE hMenuItemMain = 0;
-HANDLE hMenuItemCont = 0;
-HANDLE hMenuItemContApp = 0;
+HGENMENU hMenuItemMain = 0;
+HGENMENU hMenuItemCont = 0;
+HGENMENU hMenuItemContApp = 0;
HMODULE hUxTheme = 0;
BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
@@ -188,12 +188,7 @@ BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr) void CheckMenuItems()
{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
- if ( !DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1))
- clmi.flags |= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuItemMain, ( LPARAM )&clmi );
+ Menu_ShowItem(hMenuItemMain, db_get_b(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1) != 0);
}
int SystemModulesLoaded(WPARAM, LPARAM)
@@ -363,18 +358,18 @@ extern "C" int __declspec(dllexport) Load(void) if (NULL == (ExitEV = CreateEvent(NULL, TRUE, FALSE, NULL)))
return 1;
- PosX = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBPOSX, 0);
- PosY = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBPOSY, 0);
- SizeX = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBSIZEX, 800);
- SizeY = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBSIZEY, 200);
+ PosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSX, 0);
+ PosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSY, 0);
+ SizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEX, 800);
+ SizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEY, 200);
- HeadPosX = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, 0);
- HeadPosY = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, 0);
- HeadSizeX = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, 690);
- HeadSizeY = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, 300);
- HeadSplitPos = DBGetContactSettingWord(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, 250);
+ HeadPosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, 0);
+ HeadPosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, 0);
+ HeadSizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, 690);
+ HeadSizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, 300);
+ HeadSplitPos = db_get_w(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, 250);
- optDateTime = DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime);
+ optDateTime = db_get_b(NULL, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime);
// Create new window queues for broadcast messages
YAMNVar.MessageWnds = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index 9514293cf3..d973548e74 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -285,18 +285,18 @@ int RegisterPOP3Plugin(WPARAM,LPARAM) szProto = GetContactProto(hContact);
if (szProto != NULL && strcmp(szProto, YAMN_DBMODULE)==0)
{
- if (!DBGetContactSettingString(hContact,YAMN_DBMODULE,"Id",&dbv)) {
+ if (!db_get_s(hContact,YAMN_DBMODULE,"Id",&dbv)) {
if ( strcmp( dbv.pszVal, Finder->Name) == 0) {
Finder->hContact = hContact;
- DBWriteContactSettingWord(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE);
- DBWriteContactSettingString(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
+ db_set_w(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE);
+ db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
- DBDeleteContactSetting(Finder->hContact, "CList", "Hidden");
+ db_unset(Finder->hContact, "CList", "Hidden");
if (!(Finder->Flags & YAMN_ACC_ENA) || !(Finder->NewMailN.Flags & YAMN_ACC_CONT))
- DBWriteContactSettingByte(Finder->hContact, "CList", "Hidden", 1);
+ db_set_b(Finder->hContact, "CList", "Hidden", 1);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hContact = db_find_next(hContact);
@@ -306,10 +306,10 @@ int RegisterPOP3Plugin(WPARAM,LPARAM) //No account contact found, have to create one
Finder->hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)Finder->hContact,(LPARAM)YAMN_DBMODULE);
- DBWriteContactSettingString(Finder->hContact,YAMN_DBMODULE,"Id",Finder->Name);
- DBWriteContactSettingString(Finder->hContact,YAMN_DBMODULE,"Nick",Finder->Name);
- DBWriteContactSettingString(Finder->hContact,"Protocol","p",YAMN_DBMODULE);
- DBWriteContactSettingWord(Finder->hContact, YAMN_DBMODULE, "Status", YAMN_STATUS);
+ db_set_s(Finder->hContact,YAMN_DBMODULE,"Id",Finder->Name);
+ db_set_s(Finder->hContact,YAMN_DBMODULE,"Nick",Finder->Name);
+ db_set_s(Finder->hContact,"Protocol","p",YAMN_DBMODULE);
+ db_set_w(Finder->hContact, YAMN_DBMODULE, "Status", YAMN_STATUS);
}
}
@@ -407,7 +407,7 @@ HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account,DWORD MailDataVersion) static void SetContactStatus(HACCOUNT account, int status) {
if ((account->hContact) && (account->NewMailN.Flags & YAMN_ACC_CONT)) {
- DBWriteContactSettingWord(account->hContact, YAMN_DBMODULE, "Status", status);
+ db_set_w(account->hContact, YAMN_DBMODULE, "Status", status);
}
}
diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 72696430ab..698ce1f9fa 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -20,13 +20,13 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam) switch(msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hDlg);
- CheckDlgButton(hDlg,IDC_CHECKTTB,DBGetContactSettingByte(NULL,YAMN_DBMODULE,YAMN_TTBFCHECK,1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg,IDC_CHECKTTB,db_get_b(NULL,YAMN_DBMODULE,YAMN_TTBFCHECK,1) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg,IDC_LONGDATE,(optDateTime&SHOWDATELONG) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg,IDC_SMARTDATE,(optDateTime&SHOWDATENOTODAY) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg,IDC_NOSECONDS,(optDateTime&SHOWDATENOSECONDS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg,IDC_MAINMENU,DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1));
- CheckDlgButton(hDlg,IDC_YAMNASPROTO,DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1));
- CheckDlgButton(hDlg,IDC_CLOSEONDELETE,DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0));
+ CheckDlgButton(hDlg,IDC_MAINMENU,db_get_b(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1));
+ CheckDlgButton(hDlg,IDC_YAMNASPROTO,db_get_b(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1));
+ CheckDlgButton(hDlg,IDC_CLOSEONDELETE,db_get_b(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0));
break;
case WM_COMMAND:
@@ -48,10 +48,10 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam) case 0:
switch(((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- DBWriteContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, IsDlgButtonChecked(hDlg,IDC_YAMNASPROTO));
- DBWriteContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, IsDlgButtonChecked(hDlg,IDC_MAINMENU));
- DBWriteContactSettingByte(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, IsDlgButtonChecked(hDlg,IDC_CLOSEONDELETE));
- DBWriteContactSettingByte(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, IsDlgButtonChecked(hDlg,IDC_CHECKTTB));
+ db_set_b(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, IsDlgButtonChecked(hDlg,IDC_YAMNASPROTO));
+ db_set_b(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, IsDlgButtonChecked(hDlg,IDC_MAINMENU));
+ db_set_b(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, IsDlgButtonChecked(hDlg,IDC_CLOSEONDELETE));
+ db_set_b(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, IsDlgButtonChecked(hDlg,IDC_CHECKTTB));
AddTopToolbarIcon(0, 0);
CheckMenuItems();
@@ -60,7 +60,7 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam) if (IsDlgButtonChecked(hDlg,IDC_LONGDATE))optDateTime |= SHOWDATELONG;
if (IsDlgButtonChecked(hDlg,IDC_SMARTDATE))optDateTime |= SHOWDATENOTODAY;
if (IsDlgButtonChecked(hDlg,IDC_NOSECONDS))optDateTime |= SHOWDATENOSECONDS;
- DBWriteContactSettingByte(NULL,YAMN_DBMODULE,YAMN_DBTIMEOPTIONS,optDateTime);
+ db_set_b(NULL,YAMN_DBMODULE,YAMN_DBTIMEOPTIONS,optDateTime);
}
}
break;
diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index 759d998285..6147b69979 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -13,7 +13,7 @@ static INT_PTR Service_GetCaps(WPARAM wParam, LPARAM lParam) if (wParam == PFLAGNUM_2)
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
if (wParam == PFLAGNUM_5) {
- if (DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1))
+ if (db_get_b(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1))
return PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
}
@@ -70,7 +70,7 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM lParam) return 0;
DBVARIANT dbv;
- if ( DBGetContactSetting((HANDLE) wParam, YAMN_DBMODULE, "Id", &dbv))
+ if ( db_get((HANDLE) wParam, YAMN_DBMODULE, "Id", &dbv))
return 0;
HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
@@ -115,7 +115,7 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM lParam) DebugLog(SynchroFile, "ContactApplication:ActualAccountSO-read enter failed\n");
#endif
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -173,7 +173,7 @@ static INT_PTR ContactMailCheck(WPARAM wParam, LPARAM lParam) return 0;
DBVARIANT dbv;
- if ( DBGetContactSetting((HANDLE) wParam, YAMN_DBMODULE, "Id", &dbv))
+ if ( db_get((HANDLE) wParam, YAMN_DBMODULE, "Id", &dbv))
return 0;
HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
@@ -217,7 +217,7 @@ static INT_PTR ContactMailCheck(WPARAM wParam, LPARAM lParam) LeaveCriticalSection(&PluginRegCS);
CloseHandle(ThreadRunningEV);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -232,7 +232,7 @@ void MainMenuAccountClicked(WPARAM wParam, LPARAM lParam) return;
DBVARIANT dbv;
- if ( DBGetContactSetting(( HANDLE )wParam, YAMN_DBMODULE, "Id", &dbv))
+ if ( db_get(( HANDLE )wParam, YAMN_DBMODULE, "Id", &dbv))
return;
HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
@@ -265,7 +265,7 @@ void MainMenuAccountClicked(WPARAM wParam, LPARAM lParam) #endif
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -304,7 +304,7 @@ HBITMAP LoadBmpFromIcon(HICON hIcon) int AddTopToolbarIcon(WPARAM,LPARAM)
{
- if ( DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, 1)) {
+ if ( db_get_b(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, 1)) {
if ( ServiceExists(MS_TTB_REMOVEBUTTON) && hTTButton == NULL) {
TTBButton btn = {0};
btn.cbSize = sizeof(btn);
@@ -331,11 +331,11 @@ int Shutdown(WPARAM, LPARAM) {
CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
- DBWriteContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, HeadPosX);
- DBWriteContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, HeadPosY);
- DBWriteContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, HeadSizeX);
- DBWriteContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, HeadSizeY);
- DBWriteContactSettingWord(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, HeadSplitPos);
+ db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, HeadPosX);
+ db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, HeadPosY);
+ db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, HeadSizeX);
+ db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, HeadSizeY);
+ db_set_w(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, HeadSplitPos);
YAMNVar.Shutdown = TRUE;
KillTimer(NULL, SecTimer);
@@ -478,16 +478,16 @@ void RefreshContact(void) for (Finder = POP3Plugin->FirstAccount;Finder != NULL;Finder = Finder->Next) {
if (Finder->hContact != NULL) {
if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
- DBDeleteContactSetting(Finder->hContact, "CList", "Hidden");
+ db_unset(Finder->hContact, "CList", "Hidden");
else
- DBWriteContactSettingByte(Finder->hContact, "CList", "Hidden", 1);
+ db_set_b(Finder->hContact, "CList", "Hidden", 1);
}
else if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
Finder->hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)Finder->hContact, (LPARAM)YAMN_DBMODULE);
- DBWriteContactSettingString(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name);
- DBWriteContactSettingString(Finder->hContact, YAMN_DBMODULE, "Nick", Finder->Name);
- DBWriteContactSettingString(Finder->hContact, "Protocol", "p", YAMN_DBMODULE);
- DBWriteContactSettingWord(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE);
- DBWriteContactSettingString(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
+ db_set_s(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name);
+ db_set_s(Finder->hContact, YAMN_DBMODULE, "Nick", Finder->Name);
+ db_set_s(Finder->hContact, "Protocol", "p", YAMN_DBMODULE);
+ db_set_w(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE);
+ db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
} } }
diff --git a/plugins/YAMN/src/yamn.cpp b/plugins/YAMN/src/yamn.cpp index 98d8feaab8..adc552555e 100644 --- a/plugins/YAMN/src/yamn.cpp +++ b/plugins/YAMN/src/yamn.cpp @@ -235,11 +235,11 @@ ChangeIsCountingStatusLabel: #endif
if (((ActualAccount->isCounting) != 0) != isAccountCounting) {
ActualAccount->isCounting=isAccountCounting;
- WORD cStatus = DBGetContactSettingWord(ActualAccount->hContact, YAMN_DBMODULE, "Status", 0);
+ WORD cStatus = db_get_w(ActualAccount->hContact, YAMN_DBMODULE, "Status", 0);
switch (cStatus) {
case ID_STATUS_ONLINE:
case ID_STATUS_OFFLINE:
- DBWriteContactSettingWord(ActualAccount->hContact, YAMN_DBMODULE, "Status", isAccountCounting?ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
+ db_set_w(ActualAccount->hContact, YAMN_DBMODULE, "Status", isAccountCounting?ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
default: break;
}
}
diff --git a/plugins/YAMN/src/yamn.h b/plugins/YAMN/src/yamn.h index a0b5ab7eee..b7785d1651 100644 --- a/plugins/YAMN/src/yamn.h +++ b/plugins/YAMN/src/yamn.h @@ -265,7 +265,7 @@ extern DWORD WINAPI BadConnection(LPVOID Param); extern PVOID TLSCtx;
extern PVOID SSLCtx;
-extern HANDLE hMenuItemMain, hMenuItemCont, hMenuItemContApp;
+extern HGENMENU hMenuItemMain, hMenuItemCont, hMenuItemContApp;
extern PYAMN_VARIABLES pYAMNVar;
#endif
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp index 182504ac21..c47ea27311 100644 --- a/plugins/YAPP/src/options.cpp +++ b/plugins/YAPP/src/options.cpp @@ -452,7 +452,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam for (int i = 0; i < arClasses.getCount(); i++) {
POPUPCLASS *pc = arClasses[i];
mir_snprintf(setting, 256, "%s/Timeout", pc->pszName);
- DBWriteContactSettingWord(0, MODULE, setting, pc->iSeconds);
+ db_set_w(0, MODULE, setting, pc->iSeconds);
mir_snprintf(setting, 256, "%s/TextCol", pc->pszName);
db_set_dw(0, MODULE, setting, (DWORD)pc->colorText);
mir_snprintf(setting, 256, "%s/BgCol", pc->pszName);
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index 4848788544..232ffb19e8 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -314,7 +314,7 @@ static INT_PTR RegisterPopupClass(WPARAM wParam, LPARAM lParam) char setting[256];
mir_snprintf(setting, 256, "%s/Timeout", pc->pszName);
- pc->iSeconds = DBGetContactSettingWord(0, MODULE, setting, pc->iSeconds);
+ pc->iSeconds = db_get_w(0, MODULE, setting, pc->iSeconds);
if (pc->iSeconds == (WORD)-1) pc->iSeconds = -1;
mir_snprintf(setting, 256, "%s/TextCol", pc->pszName);
pc->colorText = (COLORREF)db_get_dw(0, MODULE, setting, (DWORD)pc->colorText);
diff --git a/plugins/ZeroNotification/src/main.cpp b/plugins/ZeroNotification/src/main.cpp index ce1c802618..16238d43d2 100644 --- a/plugins/ZeroNotification/src/main.cpp +++ b/plugins/ZeroNotification/src/main.cpp @@ -96,7 +96,7 @@ static DWORD MakeCheckBoxTreeFlags(HWND hwndTree) static void UpdateMenuItem()
{
CLISTMENUITEM mi = { sizeof(mi) };
- if (DBGetContactSettingByte(NULL, "Skin", "UseSound", 1))
+ if (db_get_b(NULL, "Skin", "UseSound", 1))
mi.ptszName = DISABLE_SOUND;
else
mi.ptszName = ENABLE_SOUND;
@@ -116,9 +116,9 @@ static int SoundSettingChanged(WPARAM wParam,LPARAM lParam) static int SetNotify(const long status)
{
- DBWriteContactSettingByte(NULL,"Skin","UseSound", (BYTE) !(DBGetContactSettingDword(NULL, MODNAME, "NoSound",DEFAULT_NOSOUND) & status));
- DBWriteContactSettingByte(NULL,"CList","DisableTrayFlash", (BYTE) (DBGetContactSettingDword(NULL, MODNAME, "NoBlink",DEFAULT_NOBLINK) & status));
- DBWriteContactSettingByte(NULL,"CList","NoIconBlink", (BYTE) (DBGetContactSettingDword(NULL, MODNAME, "NoCLCBlink",DEFAULT_NOCLCBLINK) & status));
+ db_set_b(NULL,"Skin","UseSound", (BYTE) !(db_get_dw(NULL, MODNAME, "NoSound",DEFAULT_NOSOUND) & status));
+ db_set_b(NULL,"CList","DisableTrayFlash", (BYTE) (db_get_dw(NULL, MODNAME, "NoBlink",DEFAULT_NOBLINK) & status));
+ db_set_b(NULL,"CList","NoIconBlink", (BYTE) (db_get_dw(NULL, MODNAME, "NoCLCBlink",DEFAULT_NOCLCBLINK) & status));
UpdateMenuItem();
return 0;
@@ -155,11 +155,11 @@ static INT_PTR CALLBACK DlgProcNoSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_NOSOUND),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_NOSOUND),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_NOBLINK),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_NOBLINK),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_NOCLCBLINK),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_NOCLCBLINK),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
- CheckDlgButton(hwndDlg, IDC_HIDEMENU, DBGetContactSettingByte(NULL, MODNAME, "HideMenu",1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HIDEMENU, db_get_b(NULL, MODNAME, "HideMenu",1) ? BST_CHECKED : BST_UNCHECKED);
- FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_NOSOUND),statusValues,sizeof(statusValues)/sizeof(statusValues[0]),DBGetContactSettingDword(NULL, MODNAME, "NoSound",DEFAULT_NOSOUND));
- FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_NOBLINK),statusValues,sizeof(statusValues)/sizeof(statusValues[0]),DBGetContactSettingDword(NULL, MODNAME, "NoBlink",DEFAULT_NOBLINK));
- FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_NOCLCBLINK),statusValues,sizeof(statusValues)/sizeof(statusValues[0]),DBGetContactSettingDword(NULL, MODNAME, "NoCLCBlink",DEFAULT_NOCLCBLINK));
+ FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_NOSOUND),statusValues,sizeof(statusValues)/sizeof(statusValues[0]),db_get_dw(NULL, MODNAME, "NoSound",DEFAULT_NOSOUND));
+ FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_NOBLINK),statusValues,sizeof(statusValues)/sizeof(statusValues[0]),db_get_dw(NULL, MODNAME, "NoBlink",DEFAULT_NOBLINK));
+ FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_NOCLCBLINK),statusValues,sizeof(statusValues)/sizeof(statusValues[0]),db_get_dw(NULL, MODNAME, "NoCLCBlink",DEFAULT_NOCLCBLINK));
return TRUE;
case WM_COMMAND:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -190,14 +190,14 @@ static INT_PTR CALLBACK DlgProcNoSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- DBWriteContactSettingByte(NULL, MODNAME, "HideMenu",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEMENU));
+ db_set_b(NULL, MODNAME, "HideMenu",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEMENU));
- DBWriteContactSettingDword(NULL, MODNAME, "NoSound",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_NOSOUND)));
- DBWriteContactSettingDword(NULL, MODNAME, "NoBlink",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_NOBLINK)));
- DBWriteContactSettingDword(NULL, MODNAME, "NoCLCBlink",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_NOCLCBLINK)));
+ db_set_dw(NULL, MODNAME, "NoSound",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_NOSOUND)));
+ db_set_dw(NULL, MODNAME, "NoBlink",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_NOBLINK)));
+ db_set_dw(NULL, MODNAME, "NoCLCBlink",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_NOCLCBLINK)));
- test = DBGetContactSettingWord(NULL,"CList","Status",0);
- SetNotify(Proto_Status2Flag(DBGetContactSettingWord(NULL,"CList","Status",0)));
+ test = db_get_w(NULL,"CList","Status",0);
+ SetNotify(Proto_Status2Flag(db_get_w(NULL,"CList","Status",0)));
return TRUE;
}
break;
@@ -225,10 +225,10 @@ static int OptionsInitialize(WPARAM wParam,LPARAM lParam) static INT_PTR NoSoundMenuCommand(WPARAM wParam,LPARAM lParam)
{
- if (DBGetContactSettingByte(NULL,"Skin","UseSound",1))
- DBWriteContactSettingByte(NULL,"Skin","UseSound",0);
+ if (db_get_b(NULL,"Skin","UseSound",1))
+ db_set_b(NULL,"Skin","UseSound",0);
// else
-// DBWriteContactSettingByte(NULL,"Skin","UseSound",1);
+// db_set_b(NULL,"Skin","UseSound",1);
return 0;
}
@@ -238,7 +238,7 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfoEx);
//The menu item - begin
- if (!DBGetContactSettingByte(NULL, MODNAME, "HideMenu", 1)) {
+ if (!db_get_b(NULL, MODNAME, "HideMenu", 1)) {
hSoundMenu = CreateServiceFunction(MODNAME "/MenuCommand", NoSoundMenuCommand);
CLISTMENUITEM mi = { sizeof(mi) };
@@ -257,7 +257,7 @@ extern "C" __declspec(dllexport) int Load(void) hEventOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
//Uninstall info
- DBWriteContactSettingString(NULL, "Uninstall", MODNAME, MODNAME);
+ db_set_s(NULL, "Uninstall", MODNAME, MODNAME);
return 0;
}
diff --git a/plugins/mTextControl/src/textusers.cpp b/plugins/mTextControl/src/textusers.cpp index 60b849252a..3f2c2f0f0f 100644 --- a/plugins/mTextControl/src/textusers.cpp +++ b/plugins/mTextControl/src/textusers.cpp @@ -47,8 +47,8 @@ MTI_TextUserAdd(const char *userTitle, DWORD options) textUserNew->name = new char [lstrlenA(userTitle)+1];
lstrcpyA(textUserNew->name, userTitle);
textUserNew->options =
- (DBGetContactSettingDword(0, MODULNAME, userTitle, options)&MTEXT_FANCY_MASK) | (textUserNew->options&MTEXT_SYSTEM_MASK);
- DBWriteContactSettingDword(0, MODULNAME, userTitle, textUserNew->options);
+ (db_get_dw(0, MODULNAME, userTitle, options)&MTEXT_FANCY_MASK) | (textUserNew->options&MTEXT_SYSTEM_MASK);
+ db_set_dw(0, MODULNAME, userTitle, textUserNew->options);
textUserNew->prev = textUserLast;
textUserNew->next = 0;
if (textUserLast)
@@ -77,12 +77,12 @@ void TextUserSetOptions(HANDLE userHandle, DWORD options) void TextUsersSave()
{
for (TextUser *textUser = textUserFirst; textUser; textUser = textUser->next)
- DBWriteContactSettingDword(0, MODULNAME, textUser->name, textUser->options);
+ db_set_dw(0, MODULNAME, textUser->name, textUser->options);
}
void TextUsersReset()
{
for (TextUser *textUser = textUserFirst; textUser; textUser = textUser->next)
textUser->options =
- (DBGetContactSettingDword(0, MODULNAME, textUser->name, 0)&MTEXT_FANCY_MASK) | (textUser->options&MTEXT_SYSTEM_MASK);
+ (db_get_dw(0, MODULNAME, textUser->name, 0)&MTEXT_FANCY_MASK) | (textUser->options&MTEXT_SYSTEM_MASK);
}
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 2e8ab42266..26cabfb9a8 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -199,7 +199,7 @@ int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen DBVARIANT dbv;
if (getTString(hContact, AIM_KEY_AH, &dbv)) return GAIR_NOAVATAR;
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (ext == NULL)
{
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index 3b98a8ae7c..216821a790 100644 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -89,7 +89,7 @@ void CAimProto::aim_connection_authorization(void) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
goto exit;
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 10d9a0a594..629bd50c3a 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -180,10 +180,10 @@ int __cdecl CAimProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage) return 1;
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
+ if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
{
add_contact_to_group(hContact, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
@@ -537,7 +537,7 @@ HANDLE __cdecl CAimProto::SendFile(HANDLE hContact, const PROTOCHAR* szDescripti aim_send_file(hServerConn, seqno, detected_ip, ft->local_port, false, ft);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return ft;
}
@@ -722,9 +722,9 @@ void __cdecl CAimProto::get_online_msg_thread(void* arg) const HANDLE hContact = arg;
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, MOD_KEY_CL, OTH_KEY_SM, &dbv)) {
+ if (!db_get_ts(hContact, MOD_KEY_CL, OTH_KEY_SM, &dbv)) {
sendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else sendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
@@ -827,7 +827,7 @@ int __cdecl CAimProto::UserIsTyping(HANDLE hContact, int type) aim_typing_notification(hServerConn, seqno, dbv.pszVal, 0x0002);
else if (type == PROTOTYPE_SELFTYPING_OFF)
aim_typing_notification(hServerConn, seqno, dbv.pszVal, 0x0000);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index a56fbbaab3..883905bd86 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -545,7 +545,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 msg_exist = true;
char* msg = tlv.part(i + 6, len);
char* msg_s = process_status_msg(msg, sn);
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_SM, msg_s);
+ db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_SM, msg_s);
TCHAR* tszMsg = mir_utf8decodeT(msg_s);
sendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszMsg);
@@ -560,7 +560,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 }
if (!msg_exist)
- DBDeleteContactSetting(hContact, MOD_KEY_CL, OTH_KEY_SM);
+ db_unset(hContact, MOD_KEY_CL, OTH_KEY_SM);
}
}
else if (tlv.cmp(0x0004))//idle tlv
@@ -676,20 +676,20 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) {
bool ok = false;
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
+ if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
{
ok = strcmp(group, dbv.pszVal) == 0;
if (strcmp(dbv.pszVal, "MetaContacts Hidden Group") == 0)
{
- DBFreeVariant(&dbv);
- if (!DBGetContactSettingStringUtf(hContact, "MetaContacts", "OldCListGroup", &dbv))
+ db_free(&dbv);
+ if (!db_get_utf(hContact, "MetaContacts", "OldCListGroup", &dbv))
{
ok = strcmp(group, dbv.pszVal) == 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
@@ -698,9 +698,9 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) if (!ok)
{
if (strcmp(group, AIM_DEFAULT_GROUP))
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, group);
+ db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, group);
else
- DBDeleteContactSetting(hContact, MOD_KEY_CL, OTH_KEY_GP);
+ db_unset(hContact, MOD_KEY_CL, OTH_KEY_GP);
}
}
}
@@ -714,7 +714,7 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) if (tlv.cmp(0x0131) && tlv.len())
{
char* nick = tlv.dup();
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, "MyHandle", nick);
+ db_set_utf(hContact, MOD_KEY_CL, "MyHandle", nick);
mir_free(nick);
nickfound = true;
}
@@ -726,7 +726,7 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) tlv_offset += TLV_HEADER_SIZE + tlv.len();
}
if (!nickfound && getDword(AIM_KEY_LV, 0) >= 0x80500)
- DBDeleteContactSetting(hContact, MOD_KEY_CL, "MyHandle");
+ db_unset(hContact, MOD_KEY_CL, "MyHandle");
}
break;
}
@@ -884,9 +884,9 @@ void CAimProto::modify_ssi_list(SNAC &snac, int &offset) {
char* nick = tlv.dup();
if (nick)
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, "MyHandle", nick);
+ db_set_utf(hContact, MOD_KEY_CL, "MyHandle", nick);
else
- DBDeleteContactSetting(hContact, MOD_KEY_CL, "MyHandle");
+ db_unset(hContact, MOD_KEY_CL, "MyHandle");
mir_free(nick);
}
@@ -1058,10 +1058,10 @@ void CAimProto::snac_contact_list(SNAC &snac,HANDLE hServerConn,unsigned short & aim_request_offline_msgs(hServerConn,seqno);
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(NULL, m_szModuleName, AIM_KEY_PR, &dbv))
+ if (!db_get_utf(NULL, m_szModuleName, AIM_KEY_PR, &dbv))
{
aim_set_profile(hServerConn, seqno, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (getDword(AIM_KEY_LV, 0) < 0x80500)
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index 3ab5b37754..52c9bf37ce 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -79,7 +79,7 @@ int CAimProto::OnWindowEvent(WPARAM wParam, LPARAM lParam) {
if (_stricmp(dbv.pszVal, SYSTEM_BUDDY))
aim_typing_notification(hServerConn, seqno, dbv.pszVal, 0x000f);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -95,7 +95,7 @@ INT_PTR CAimProto::GetProfile(WPARAM wParam, LPARAM lParam) {
request_HTML_profile = 1;
aim_query_profile(hServerConn, seqno, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -126,10 +126,10 @@ int CAimProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam) if (cws->value.type == DBVT_DELETED)
{
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
+ if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
{
add_contact_to_group(hContact, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
@@ -172,7 +172,7 @@ int CAimProto::OnContactDeleted(WPARAM wParam,LPARAM /*lParam*/) const HANDLE hContact = (HANDLE)wParam;
- if (DBGetContactSettingByte(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
+ if (db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
return 0;
DBVARIANT dbv;
@@ -194,7 +194,7 @@ int CAimProto::OnContactDeleted(WPARAM wParam,LPARAM /*lParam*/) aim_ssi_update(hServerConn, seqno, false);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -237,7 +237,7 @@ int CAimProto::OnGroupChange(WPARAM wParam,LPARAM lParam) else
{
if (is_my_contact(hContact) && getBuddyId(hContact, 1) &&
- !DBGetContactSettingByte(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
+ !db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
{
if (grpchg->pszNewName)
{
@@ -258,10 +258,10 @@ INT_PTR CAimProto::AddToServerList(WPARAM wParam, LPARAM /*lParam*/) HANDLE hContact = (HANDLE)wParam;
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
+ if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
{
add_contact_to_group(hContact, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
@@ -315,7 +315,7 @@ INT_PTR CAimProto::BlockBuddy(WPARAM wParam, LPARAM /*lParam*/) }
break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -337,7 +337,7 @@ INT_PTR CAimProto::OnJoinChat(WPARAM wParam, LPARAM /*lParam*/) {
chatnav_param* par = new chatnav_param(dbv.pszVal, getWord(hContact, "Exchange", 4));
ForkThread(&CAimProto::chatnav_request_thread, par);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -352,7 +352,7 @@ INT_PTR CAimProto::OnLeaveChat(WPARAM wParam, LPARAM /*lParam*/) if (!getString(hContact, "ChatRoomID", &dbv))
{
chat_leave(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index f20de16ff5..c32409f5b2 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -255,7 +255,7 @@ int CAimProto::OnPreBuildContactMenu(WPARAM wParam,LPARAM /*lParam*/) }
Menu_ModifyItem(hBlockContextMenuItem, &mi);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 249a0cc573..25e04fd38e 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -205,13 +205,13 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowLongPtr(hwndDlg, GWLP_USERDATA, LPARAM(ppro));
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(NULL, ppro->m_szModuleName, AIM_KEY_PR, &dbv))
+ if (!db_get_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, &dbv))
{
html_decode(dbv.pszVal);
TCHAR *txt = mir_utf8decodeT(dbv.pszVal);
SetDlgItemText(hwndDlg, IDC_PROFILE, txt);
mir_free(txt);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -432,7 +432,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_SETPROFILE:
{
char* buf = rtf_to_html(hwndDlg, IDC_PROFILE);
- DBWriteContactSettingStringUtf(NULL, ppro->m_szModuleName, AIM_KEY_PR, buf);
+ db_set_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, buf);
if (ppro->state==1)
ppro->aim_set_profile(ppro->hServerConn, ppro->seqno, buf);//also see set caps for profile setting
@@ -676,12 +676,12 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (!ppro->getString(AIM_KEY_SN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_FNAME, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_EM, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_CEMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
}
@@ -699,7 +699,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar {
if (strcmp(name, dbv.pszVal))
ppro->aim_admin_format_name(ppro->hAdminConn,ppro->admin_seqno,name);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
char email[254];
@@ -708,7 +708,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar {
if (strcmp(email, dbv.pszVal))
ppro->aim_admin_change_email(ppro->hAdminConn,ppro->admin_seqno,email);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
ShowWindow(GetDlgItem(hwndDlg, IDC_PINFO), SW_HIDE);
@@ -795,28 +795,28 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!ppro->getString(AIM_KEY_SN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_SN, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_NK, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_NK, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else if (!ppro->getString(AIM_KEY_SN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_NK, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_PW, &dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PW, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_HN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_HN, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemTextA(hwndDlg, IDC_HN, ppro->getByte(AIM_KEY_DSSL, 0) ? AIM_DEFAULT_SERVER_NS : AIM_DEFAULT_SERVER);
@@ -1186,14 +1186,14 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!ppro->getString(AIM_KEY_SN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_SN, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_PW, &dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PW, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
}
@@ -1391,7 +1391,7 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, chat_list_item* {
ppro->aim_chat_invite(ppro->hServerConn, ppro->seqno,
item->cookie, item->exchange, item->instance, dbv.pszVal, msg);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 549f2e4235..cabadfffb0 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -94,7 +94,7 @@ void CAimProto::start_connection(void *arg) offline_contacts();
DBVARIANT dbv;
if (!getString(AIM_KEY_SN, &dbv))
- DBFreeVariant(&dbv);
+ db_free(&dbv);
else
{
ShowPopup(LPGEN("Please, enter a username in the options dialog."), 0);
@@ -102,7 +102,7 @@ void CAimProto::start_connection(void *arg) return;
}
if (!getString(AIM_KEY_PW, &dbv))
- DBFreeVariant(&dbv);
+ db_free(&dbv);
else
{
ShowPopup(LPGEN("Please, enter a password in the options dialog."), 0);
@@ -177,7 +177,7 @@ HANDLE CAimProto::find_chat_contact(const char* room) if (!getString(hContact, "ChatRoomID", &dbv))
{
bool found = !strcmp(room, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (found) return hContact;
}
}
@@ -199,7 +199,7 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora if (!getString(hContact, AIM_KEY_SN, &dbv))
{
bool found = !strcmp(norm_sn, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (found)
{
mir_free(norm_sn);
@@ -221,7 +221,7 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora setString(hContact, AIM_KEY_NK, sn);
LOG("Adding contact %s to client side list.",norm_sn);
if (temporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
mir_free(norm_sn);
return hContact;
}
@@ -271,10 +271,10 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group) DBVARIANT dbv;
char *nick = NULL;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, "MyHandle", &dbv))
+ if (!db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv))
{
nick = NEWSTR_ALLOCA(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (getString(hContact, AIM_KEY_SN, &dbv)) return;
@@ -288,9 +288,9 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group) setGroupId(hContact, 1, new_group_id);
if (new_group && strcmp(new_group, AIM_DEFAULT_GROUP))
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, new_group);
+ db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, new_group);
else
- DBDeleteContactSetting(hContact, MOD_KEY_CL, OTH_KEY_GP);
+ db_unset(hContact, MOD_KEY_CL, OTH_KEY_GP);
aim_ssi_update(hServerConn, seqno, true);
@@ -319,7 +319,7 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group) aim_ssi_update(hServerConn, seqno, false);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
void CAimProto::offline_contact(HANDLE hContact, bool remove_settings)
@@ -333,7 +333,7 @@ void CAimProto::offline_contact(HANDLE hContact, bool remove_settings) deleteGroupId(hContact, i);
}
- DBDeleteContactSetting(hContact, MOD_KEY_CL, OTH_KEY_SM);
+ db_unset(hContact, MOD_KEY_CL, OTH_KEY_SM);
}
setWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE);
}
@@ -467,10 +467,10 @@ void CAimProto::upload_nicks(void) while (hContact)
{
DBVARIANT dbv;
- if (is_my_contact(hContact) && !DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, "MyHandle", &dbv))
+ if (is_my_contact(hContact) && !db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv))
{
set_local_nick(hContact, dbv.pszVal, NULL);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
hContact = db_find_next(hContact);
}
@@ -491,7 +491,7 @@ void CAimProto::set_local_nick(HANDLE hContact, char* nick, char* note) aim_mod_buddy(hServerConn, seqno, dbv.pszVal, group_id, buddy_id, nick, note);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -749,105 +749,105 @@ unsigned short get_random(void) // Standard functions
int CAimProto::deleteSetting(HANDLE hContact, const char* setting)
-{ return DBDeleteContactSetting(hContact, m_szModuleName, setting);
+{ return db_unset(hContact, m_szModuleName, setting);
}
bool CAimProto::getBool(HANDLE hContact, const char* name, bool defaultValue)
-{ return DBGetContactSettingByte(hContact, m_szModuleName, name, defaultValue) != 0;
+{ return db_get_b(hContact, m_szModuleName, name, defaultValue) != 0;
}
int CAimProto::getByte(const char* name, BYTE defaultValue)
-{ return DBGetContactSettingByte(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_b(NULL, m_szModuleName, name, defaultValue);
}
int CAimProto::getByte(HANDLE hContact, const char* name, BYTE defaultValue)
-{ return DBGetContactSettingByte(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_b(hContact, m_szModuleName, name, defaultValue);
}
int CAimProto::getDword(const char* name, DWORD defaultValue)
-{ return DBGetContactSettingDword(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_dw(NULL, m_szModuleName, name, defaultValue);
}
int CAimProto::getDword(HANDLE hContact, const char* name, DWORD defaultValue)
-{ return DBGetContactSettingDword(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_dw(hContact, m_szModuleName, name, defaultValue);
}
int CAimProto::getString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(NULL, m_szModuleName, name, result);
+{ return db_get_s(NULL, m_szModuleName, name, result);
}
int CAimProto::getString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(hContact, m_szModuleName, name, result);
+{ return db_get_s(hContact, m_szModuleName, name, result);
}
int CAimProto::getTString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingTString(NULL, m_szModuleName, name, result);
+{ return db_get_ts(NULL, m_szModuleName, name, result);
}
int CAimProto::getTString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingTString(hContact, m_szModuleName, name, result);
+{ return db_get_ts(hContact, m_szModuleName, name, result);
}
WORD CAimProto::getWord(const char* name, WORD defaultValue)
-{ return (WORD)DBGetContactSettingWord(NULL, m_szModuleName, name, defaultValue);
+{ return (WORD)db_get_w(NULL, m_szModuleName, name, defaultValue);
}
WORD CAimProto::getWord(HANDLE hContact, const char* name, WORD defaultValue)
-{ return (WORD)DBGetContactSettingWord(hContact, m_szModuleName, name, defaultValue);
+{ return (WORD)db_get_w(hContact, m_szModuleName, name, defaultValue);
}
char* CAimProto::getSetting(HANDLE hContact, const char* setting)
{
DBVARIANT dbv;
- return DBGetContactSettingString(hContact, m_szModuleName, setting, &dbv) ?
+ return db_get_s(hContact, m_szModuleName, setting, &dbv) ?
NULL : dbv.pszVal;
}
char* CAimProto::getSetting(const char* setting)
{
DBVARIANT dbv;
- return DBGetContactSettingString(NULL, m_szModuleName, setting, &dbv) ?
+ return db_get_s(NULL, m_szModuleName, setting, &dbv) ?
NULL : dbv.pszVal;
}
void CAimProto::setByte(const char* name, BYTE value)
-{ DBWriteContactSettingByte(NULL, m_szModuleName, name, value);
+{ db_set_b(NULL, m_szModuleName, name, value);
}
void CAimProto::setByte(HANDLE hContact, const char* name, BYTE value)
-{ DBWriteContactSettingByte(hContact, m_szModuleName, name, value);
+{ db_set_b(hContact, m_szModuleName, name, value);
}
void CAimProto::setDword(const char* name, DWORD value)
-{ DBWriteContactSettingDword(NULL, m_szModuleName, name, value);
+{ db_set_dw(NULL, m_szModuleName, name, value);
}
void CAimProto::setDword(HANDLE hContact, const char* name, DWORD value)
-{ DBWriteContactSettingDword(hContact, m_szModuleName, name, value);
+{ db_set_dw(hContact, m_szModuleName, name, value);
}
void CAimProto::setString(const char* name, const char* value)
-{ DBWriteContactSettingString(NULL, m_szModuleName, name, value);
+{ db_set_s(NULL, m_szModuleName, name, value);
}
void CAimProto::setString(HANDLE hContact, const char* name, const char* value)
-{ DBWriteContactSettingString(hContact, m_szModuleName, name, value);
+{ db_set_s(hContact, m_szModuleName, name, value);
}
void CAimProto::setTString(const char* name, const TCHAR* value)
-{ DBWriteContactSettingTString(NULL, m_szModuleName, name, value);
+{ db_set_ts(NULL, m_szModuleName, name, value);
}
void CAimProto::setTString(HANDLE hContact, const char* name, const TCHAR* value)
-{ DBWriteContactSettingTString(hContact, m_szModuleName, name, value);
+{ db_set_ts(hContact, m_szModuleName, name, value);
}
void CAimProto::setWord(const char* name, WORD value)
-{ DBWriteContactSettingWord(NULL, m_szModuleName, name, value);
+{ db_set_w(NULL, m_szModuleName, name, value);
}
void CAimProto::setWord(HANDLE hContact, const char* name, WORD value)
-{ DBWriteContactSettingWord(hContact, m_szModuleName, name, value);
+{ db_set_w(hContact, m_szModuleName, name, value);
}
int CAimProto::sendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 09627c327f..165a18afa6 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -131,8 +131,8 @@ void CMLan::SetAllOffline() while (hContact != NULL) {
char *svc = GetContactProto(hContact);
if (svc != NULL && lstrcmp(PROTONAME,svc) == 0) {
- DBWriteContactSettingWord(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE);
- DBDeleteContactSetting(hContact, PROTONAME, "IP");
+ db_set_w(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE);
+ db_unset(hContact, PROTONAME, "IP");
}
hContact = db_find_next(hContact);
}
@@ -212,7 +212,7 @@ void CMLan::Check() HANDLE hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false);
if (hContact)
{
- DBWriteContactSettingWord(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE);
+ db_set_w(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE);
}
}
}
@@ -250,9 +250,9 @@ HANDLE CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, boo u_long caddr = db_get_dw(res, PROTONAME, "ipaddr", -1);
if (caddr==addr.S_un.S_addr) {
if (make_permanent)
- DBDeleteContactSetting(res,"CList","NotOnList");
+ db_unset(res,"CList","NotOnList");
if (make_visible)
- DBDeleteContactSetting(res,"CList","Hidden");
+ db_unset(res,"CList","Hidden");
return res;
}
}
@@ -262,15 +262,15 @@ HANDLE CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, boo if (add_to_list) {
res=(HANDLE)CallService(MS_DB_CONTACT_ADD,0,0);
CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)res,(LPARAM)PROTONAME);
- DBWriteContactSettingDword(res,PROTONAME, "ipaddr", addr.S_un.S_addr);
- DBWriteContactSettingString(res,PROTONAME, "Nick", nick);
+ db_set_dw(res,PROTONAME, "ipaddr", addr.S_un.S_addr);
+ db_set_s(res,PROTONAME, "Nick", nick);
if (!make_permanent)
- DBWriteContactSettingByte(res,"CList","NotOnList",1);
+ db_set_b(res,"CList","NotOnList",1);
if (!make_visible)
- DBWriteContactSettingByte(res,"CList","Hidden",1);
+ db_set_b(res,"CList","Hidden",1);
- DBWriteContactSettingWord(res,PROTONAME, "Status", status);
+ db_set_w(res,PROTONAME, "Status", status);
}
else res = NULL;
@@ -328,17 +328,17 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) HANDLE hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false);
if (hContact)
{
- DBWriteContactSettingWord(hContact,PROTONAME, "Status", cont->m_status);
+ db_set_w(hContact,PROTONAME, "Status", cont->m_status);
if (db_get_dw(hContact,PROTONAME, "RemoteVersion", 0)!=cont->m_ver)
- DBWriteContactSettingDword(hContact,PROTONAME, "RemoteVersion", cont->m_ver);
+ db_set_dw(hContact,PROTONAME, "RemoteVersion", cont->m_ver);
if (old_status = ID_STATUS_OFFLINE)
{
u_int rip = cont->m_addr.S_un.S_addr;
int tip = (rip<<24)|((rip&0xff00)<<8)|((rip&0xff0000)>>8)|(rip>>24);
- DBWriteContactSettingDword(hContact, PROTONAME, "IP", tip);
+ db_set_dw(hContact, PROTONAME, "IP", tip);
// HOSTENT* host = gethostbyaddr((const char*)&rip, sizeof(rip), AF_INET);
// if (host)
-// DBWriteContactSettingString(hContact, PROTONAME, "UID", host->h_name);
+// db_set_s(hContact, PROTONAME, "UID", host->h_name);
}
}
LeaveCriticalSection(&m_csAccessClass);
@@ -401,9 +401,9 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) // case ID_STATUS_FREECHAT: IcqStatus = ICQ_MSGTYPE_GETFFCMSG; break;
// }
// // HACK: this is a real hack
-// DBWriteContactSettingDword(hContact, "ICQ", "UIN", 1/*0xffffffff*/);
+// db_set_dw(hContact, "ICQ", "UIN", 1/*0xffffffff*/);
// NotifyEventHooks(m_hookIcqMsgReq, IcqStatus, 1/*0xffffffff*/);
-// DBDeleteContactSetting(hContact, "ICQ", "UIN");
+// db_unset(hContact, "ICQ", "UIN");
// }
EnterCriticalSection(&m_csAccessAwayMes);
@@ -457,7 +457,7 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs) }
dbei.pBlob = (PBYTE)pre->szMessage;
- DBDeleteContactSetting(ccs->hContact,"CList","Hidden");
+ db_unset(ccs->hContact,"CList","Hidden");
db_event_add(ccs->hContact, &dbei);
}
@@ -475,8 +475,8 @@ int CMLan::AddToContactList(u_int flags, EMPSEARCHRESULT* psr) HANDLE contact = FindContact(addr, psr->hdr.nick, true, !TempAdd, !TempAdd, psr->stat);
if (contact!=NULL)
{
- DBWriteContactSettingWord(contact,PROTONAME,"Status", psr->stat );
- DBWriteContactSettingWord(contact,PROTONAME,"RemoteVersion", psr->ver );
+ db_set_w(contact,PROTONAME,"Status", psr->stat );
+ db_set_w(contact,PROTONAME,"RemoteVersion", psr->ver );
}
return (int)contact;
@@ -597,7 +597,7 @@ void CMLan::SearchExt(TDataHolder* hold) void CMLan::SendMessageExt(TDataHolder* hold)
{
Sleep(0);
- if (DBGetContactSettingWord((HANDLE)hold->hContact, PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE)
+ if (db_get_w((HANDLE)hold->hContact, PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE)
{
Sleep(20);
ProtoBroadcastAck(PROTONAME, hold->hContact, (hold->op==LEXT_SENDURL)?ACKTYPE_URL:ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)hold->id, 0);
@@ -884,11 +884,11 @@ void CMLan::LoadSettings() else {
DBVARIANT dbv;
// Deleting old 'Name' value - using 'Nick' instead of it now
- if ( DBGetContactSettingString(NULL, PROTONAME, "Nick", &dbv)) {
- if (DBGetContactSettingString(NULL, PROTONAME, "Name", &dbv))
+ if ( db_get_s(NULL, PROTONAME, "Nick", &dbv)) {
+ if (db_get_s(NULL, PROTONAME, "Name", &dbv))
dbv.pszVal = "EmLan_User";
else
- DBDeleteContactSetting(NULL, PROTONAME, "Name");
+ db_unset(NULL, PROTONAME, "Name");
}
if (!dbv.pszVal[0])
dbv.pszVal = "EmLan_User";
@@ -913,9 +913,9 @@ void CMLan::LoadSettings() void CMLan::SaveSettings()
{
- DBWriteContactSettingDword(NULL, PROTONAME, "ipaddr", m_RequiredIp);
- DBWriteContactSettingByte(NULL, PROTONAME, "UseHostName", m_UseHostName);
- DBWriteContactSettingString(NULL, PROTONAME, "Nick", m_name);
+ db_set_dw(NULL, PROTONAME, "ipaddr", m_RequiredIp);
+ db_set_b(NULL, PROTONAME, "UseHostName", m_UseHostName);
+ db_set_s(NULL, PROTONAME, "Nick", m_name);
}
//////////////////////////////////////////////////////////////////////////
@@ -1120,7 +1120,7 @@ void CMLan::RecvFile(CCSDATA* ccs) PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
char *szDesc, *szFile;
- DBDeleteContactSetting(ccs->hContact, "CList", "Hidden");
+ db_unset(ccs->hContact, "CList", "Hidden");
szFile = pre->szMessage + sizeof(DWORD);
szDesc = szFile + strlen(szFile) + 1;
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index bb9a883d78..e73c034968 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -25,9 +25,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string *url)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(ai.hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv)) {
+ if (!db_get_s(ai.hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv)) {
std::string new_url = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (new_url.empty())
return false;
@@ -35,10 +35,10 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string * if (url)
*url = new_url;
- if (!DBGetContactSettingTString(ai.hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) {
+ if (!db_get_ts(ai.hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) {
std::string ext = new_url.substr(new_url.rfind('.'));
std::tstring filename = GetAvatarFolder() + L'\\' + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str());
- DBFreeVariant(&dbv);
+ db_free(&dbv);
ai.hContact = ai.hContact;
ai.format = ext_to_format(ext);
@@ -57,7 +57,7 @@ void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url) if (image_url.empty())
return;
- bool big_avatars = (bool)DBGetContactSettingByte(NULL, m_szModuleName, FACEBOOK_KEY_BIG_AVATARS, DEFAULT_BIG_AVATARS);
+ bool big_avatars = (bool)db_get_b(NULL, m_szModuleName, FACEBOOK_KEY_BIG_AVATARS, DEFAULT_BIG_AVATARS);
// We've got url to avatar of default size 32x32px, let's change it to slightly bigger (50x50px) - looks like maximum size for square format
std::tstring::size_type pos = image_url.rfind( "/s32x32/" );
@@ -73,17 +73,17 @@ void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url) DBVARIANT dbv;
bool update_required = true;
- if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv))
+ if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv))
{
update_required = image_url != dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (update_required || !hContact)
{
- DBWriteContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, image_url.c_str());
+ db_set_s(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, image_url.c_str());
if (hContact)
{
- DBWriteContactSettingByte(hContact, "ContactPhoto", "NeedUpdate", 1);
+ db_set_b(hContact, "ContactPhoto", "NeedUpdate", 1);
ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
else
@@ -189,7 +189,7 @@ int FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) bool needLoad;
if (AI->hContact)
- needLoad = (wParam & GAIF_FORCE) && (!fileExist || DBGetContactSettingByte(AI->hContact, "ContactPhoto", "NeedUpdate", 0));
+ needLoad = (wParam & GAIF_FORCE) && (!fileExist || db_get_b(AI->hContact, "ContactPhoto", "NeedUpdate", 0));
else
needLoad = (wParam & GAIF_FORCE) || !fileExist;
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index ace8c0176d..d6dbd885d2 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -108,7 +108,7 @@ http::response facebook_client::flap( const int request_type, std::string* reque // is compaired in all communication requests
}
- if (DBGetContactSettingByte( NULL, parent->m_szModuleName, FACEBOOK_KEY_VALIDATE_RESPONSE, 0 ) == 1)
+ if (db_get_b( NULL, parent->m_szModuleName, FACEBOOK_KEY_VALIDATE_RESPONSE, 0 ) == 1)
validate_response(&resp);
return resp;
@@ -122,7 +122,7 @@ bool facebook_client::validate_response( http::response* resp ) return false;
}
- if (DBGetContactSettingByte( NULL, parent->m_szModuleName, FACEBOOK_KEY_VALIDATE_RESPONSE, 0 ) == 2) {
+ if (db_get_b( NULL, parent->m_szModuleName, FACEBOOK_KEY_VALIDATE_RESPONSE, 0 ) == 2) {
return true;
}
@@ -192,7 +192,7 @@ bool facebook_client::handle_error( std::string method, bool force_disconnect ) if ( force_disconnect )
result = false;
- else if ( error_count_ <= (UINT)DBGetContactSettingByte(NULL,parent->m_szModuleName,FACEBOOK_KEY_TIMEOUTS_LIMIT,FACEBOOK_TIMEOUTS_LIMIT))
+ else if ( error_count_ <= (UINT)db_get_b(NULL,parent->m_szModuleName,FACEBOOK_KEY_TIMEOUTS_LIMIT,FACEBOOK_TIMEOUTS_LIMIT))
result = true;
else
result = false;
@@ -213,7 +213,7 @@ DWORD facebook_client::choose_security_level( int request_type ) if (this->https_)
{
if ( request_type != FACEBOOK_REQUEST_MESSAGES_RECEIVE
- || DBGetContactSettingByte( NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL ))
+ || db_get_b( NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL ))
return NLHRF_SSL;
}
@@ -523,7 +523,7 @@ NETLIBHTTPHEADER* facebook_client::get_request_headers( int request_type, int* h std::string facebook_client::get_newsfeed_type( )
{
- BYTE feed_type = DBGetContactSettingByte(NULL, parent->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, 0);
+ BYTE feed_type = db_get_b(NULL, parent->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, 0);
if (feed_type < 0 || feed_type >= SIZEOF(feed_types))
feed_type = 0;
return feed_types[feed_type].id;
@@ -658,7 +658,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw if ( resp.headers["Location"].find("https://") != std::string::npos )
{
client_notify(TranslateT("Your account requires HTTPS connection. Activating."));
- DBWriteContactSettingByte(NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS, 1);
+ db_set_b(NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS, 1);
this->https_ = true;
}
}
@@ -667,7 +667,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw // Check for Device ID
if ( cookies["datr"].length())
- DBWriteContactSettingString( NULL, parent->m_szModuleName, FACEBOOK_KEY_DEVICE_ID, cookies["datr"].c_str());
+ db_set_s( NULL, parent->m_szModuleName, FACEBOOK_KEY_DEVICE_ID, cookies["datr"].c_str());
switch ( resp.code )
{
@@ -715,7 +715,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw if ( cookies.find("c_user") != cookies.end())
{
this->self_.user_id = cookies.find("c_user")->second;
- DBWriteContactSettingString(NULL,parent->m_szModuleName,FACEBOOK_KEY_ID,this->self_.user_id.c_str());
+ db_set_s(NULL,parent->m_szModuleName,FACEBOOK_KEY_ID,this->self_.user_id.c_str());
parent->Log(" Got self user id: %s", this->self_.user_id.c_str());
return handle_success( "login" );
} else {
@@ -728,7 +728,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw bool facebook_client::logout( )
{
- if ( DBGetContactSettingByte(NULL, parent->m_szModuleName, FACEBOOK_KEY_DISABLE_LOGOUT, 0))
+ if ( db_get_b(NULL, parent->m_szModuleName, FACEBOOK_KEY_DISABLE_LOGOUT, 0))
return true;
handle_entry( "logout" );
@@ -1125,7 +1125,7 @@ bool facebook_client::send_message( std::string message_recipient, std::string m {
HANDLE hContact = parent->ContactIDToHContact( message_recipient );
if (hContact != NULL)
- DBWriteContactSettingWord(hContact,parent->m_szModuleName,"Status",ID_STATUS_OFFLINE);
+ db_set_w(hContact,parent->m_szModuleName,"Status",ID_STATUS_OFFLINE);
return false;
} break;
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index 33a168929f..799a66f50e 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -140,10 +140,10 @@ bool FacebookProto::NegotiateConnection( ) DBVARIANT dbv = {0};
error = true;
- if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_LOGIN,&dbv))
+ if ( !db_get_s(NULL,m_szModuleName,FACEBOOK_KEY_LOGIN,&dbv))
{
user = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
error = user.empty();
}
if (error)
@@ -153,12 +153,12 @@ bool FacebookProto::NegotiateConnection( ) }
error = true;
- if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_PASS,&dbv))
+ if ( !db_get_s(NULL,m_szModuleName,FACEBOOK_KEY_PASS,&dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,
reinterpret_cast<LPARAM>(dbv.pszVal));
pass = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
error = pass.empty();
}
if (error)
@@ -168,20 +168,20 @@ bool FacebookProto::NegotiateConnection( ) }
// Load machine name
- if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_DEVICE_ID,&dbv))
+ if ( !db_get_s(NULL,m_szModuleName,FACEBOOK_KEY_DEVICE_ID,&dbv))
{
facy.cookies["datr"] = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// Refresh last time of feeds update
facy.last_feeds_update_ = ::time(NULL);
// Get info about secured connection
- facy.https_ = DBGetContactSettingByte(NULL, m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS, DEFAULT_FORCE_HTTPS ) != 0;
+ facy.https_ = db_get_b(NULL, m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS, DEFAULT_FORCE_HTTPS ) != 0;
// Create default group for new contacts
- if (!DBGetContactSettingTString(NULL, m_szModuleName, FACEBOOK_KEY_DEF_GROUP, &dbv) && lstrlen(dbv.ptszVal) > 0)
+ if (!db_get_ts(NULL, m_szModuleName, FACEBOOK_KEY_DEF_GROUP, &dbv) && lstrlen(dbv.ptszVal) > 0)
{
CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)dbv.ptszVal);
}
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index ba9107d79e..c54060a049 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -30,7 +30,7 @@ bool FacebookProto::IsMyContact(HANDLE hContact, bool include_chat) if( include_chat )
return true;
else
- return DBGetContactSettingByte(hContact,m_szModuleName,"ChatRoom",0) == 0;
+ return db_get_b(hContact,m_szModuleName,"ChatRoom",0) == 0;
} else {
return false;
}
@@ -46,14 +46,14 @@ HANDLE FacebookProto::ChatIDToHContact(std::string chat_id) continue;
DBVARIANT dbv;
- if( !DBGetContactSettingString(hContact,m_szModuleName,"ChatRoomID",&dbv))
+ if( !db_get_s(hContact,m_szModuleName,"ChatRoomID",&dbv))
{
if( strcmp(chat_id.c_str(),dbv.pszVal) == 0 )
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return hContact;
} else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -71,14 +71,14 @@ HANDLE FacebookProto::ContactIDToHContact(std::string user_id) continue;
DBVARIANT dbv;
- if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
if( strcmp(user_id.c_str(),dbv.pszVal) == 0 )
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return hContact;
} else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -103,19 +103,19 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_ {
if( CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)m_szModuleName) == 0 )
{
- DBWriteContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,fbu->user_id.c_str());
+ db_set_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,fbu->user_id.c_str());
std::string homepage = FACEBOOK_URL_PROFILE + fbu->user_id;
- DBWriteContactSettingString(hContact, m_szModuleName,"Homepage", homepage.c_str());
- DBWriteContactSettingString(hContact, m_szModuleName, "MirVer", fbu->status_id == ID_STATUS_ONTHEPHONE ? FACEBOOK_MOBILE : FACEBOOK_NAME);
+ db_set_s(hContact, m_szModuleName,"Homepage", homepage.c_str());
+ db_set_s(hContact, m_szModuleName, "MirVer", fbu->status_id == ID_STATUS_ONTHEPHONE ? FACEBOOK_MOBILE : FACEBOOK_NAME);
- DBDeleteContactSetting(hContact, "CList", "MyHandle");
+ db_unset(hContact, "CList", "MyHandle");
DBVARIANT dbv;
- if( !DBGetContactSettingTString(NULL,m_szModuleName,FACEBOOK_KEY_DEF_GROUP,&dbv))
+ if( !db_get_ts(NULL,m_szModuleName,FACEBOOK_KEY_DEF_GROUP,&dbv))
{
- DBWriteContactSettingTString(hContact,"CList","Group",dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_set_ts(hContact,"CList","Group",dbv.ptszVal);
+ db_free(&dbv);
}
if (strlen(new_name) > 0)
@@ -124,7 +124,7 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_ DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, new_name);
}
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, type);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, type);
if (getByte(FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, 0))
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, (LPARAM)IGNOREEVENT_USERONLINE);
@@ -149,17 +149,17 @@ void FacebookProto::SetAllContactStatuses(int status, bool reset_client) if (reset_client) {
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact,m_szModuleName,"MirVer",&dbv)) {
+ if (!db_get_ts(hContact,m_szModuleName,"MirVer",&dbv)) {
if (_tcscmp(dbv.ptszVal, _T(FACEBOOK_NAME)))
- DBWriteContactSettingTString(hContact,m_szModuleName,"MirVer", _T(FACEBOOK_NAME));
- DBFreeVariant(&dbv);
+ db_set_ts(hContact,m_szModuleName,"MirVer", _T(FACEBOOK_NAME));
+ db_free(&dbv);
}
/*std::tstring foldername = GetAvatarFolder() + L"\\smileys\\";
TCHAR *path = _tcsdup(foldername.c_str());
- if (DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS)) {
+ if (db_get_b(NULL,m_szModuleName,FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS)) {
SMADD_CONT cont;
cont.cbSize = sizeof(SMADD_CONT);
cont.hContact = hContact;
@@ -170,8 +170,8 @@ void FacebookProto::SetAllContactStatuses(int status, bool reset_client) }*/
}
- if (DBGetContactSettingWord(hContact,m_szModuleName,"Status",ID_STATUS_OFFLINE) != status)
- DBWriteContactSettingWord(hContact,m_szModuleName,"Status",status);
+ if (db_get_w(hContact,m_szModuleName,"Status",ID_STATUS_OFFLINE) != status)
+ db_set_w(hContact,m_szModuleName,"Status",status);
}
}
@@ -209,9 +209,9 @@ void FacebookProto::DeleteContactFromServer(void *data) // If contact wasn't deleted from database
if (hContact != NULL)
{
- DBWriteContactSettingWord(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE);
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
- DBWriteContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
+ db_set_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
+ db_set_dw(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
}
NotifyEvent(m_tszUserName, TranslateT("Contact was removed from your server list."), NULL, FACEBOOK_EVENT_OTHER, NULL);
@@ -251,7 +251,7 @@ void FacebookProto::AddContactToServer(void *data) // If contact wasn't deleted from database
if (hContact != NULL)
{
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_REQUEST);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_REQUEST);
}
NotifyEvent(m_tszUserName, TranslateT("Request for friendship was sent."), NULL, FACEBOOK_EVENT_OTHER, NULL);
@@ -280,10 +280,10 @@ void FacebookProto::ApproveContactToServer(void *data) std::string get_data = "id=";
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
+ if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
{
get_data += dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
http::response resp = facy.flap( FACEBOOK_REQUEST_APPROVE_FRIEND, &post_data, &get_data );
@@ -291,7 +291,7 @@ void FacebookProto::ApproveContactToServer(void *data) // Process result data
facy.validate_response(&resp);
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
}
void FacebookProto::CancelFriendsRequest(void *data)
@@ -309,10 +309,10 @@ void FacebookProto::CancelFriendsRequest(void *data) query += "&__user=" + facy.self_.user_id;
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
+ if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
{
query += "&friend=" + std::string(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// Get unread inbox threads
@@ -323,7 +323,7 @@ void FacebookProto::CancelFriendsRequest(void *data) if (resp.data.find("\"payload\":null", 0) != std::string::npos)
{
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
NotifyEvent(m_tszUserName, TranslateT("Request for friendship was canceled."), NULL, FACEBOOK_EVENT_OTHER, NULL);
} else {
facy.client_notify( TranslateT("Error occured when canceling friendship request."));
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index 25d3356574..f7a3a560f3 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -23,19 +23,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once
// DB macros
-#define getByte( setting, error ) DBGetContactSettingByte( NULL, m_szModuleName, setting, error )
-#define setByte( setting, value ) DBWriteContactSettingByte( NULL, m_szModuleName, setting, value )
-#define getWord( setting, error ) DBGetContactSettingWord( NULL, m_szModuleName, setting, error )
-#define setWord( setting, value ) DBWriteContactSettingWord( NULL, m_szModuleName, setting, value )
-#define getDword( setting, error ) DBGetContactSettingDword( NULL, m_szModuleName, setting, error )
-#define setDword( setting, value ) DBWriteContactSettingDword( NULL, m_szModuleName, setting, value )
-#define getString( setting, dest ) DBGetContactSettingString( NULL, m_szModuleName, setting, dest )
-#define setString( setting, value ) DBWriteContactSettingString( NULL, m_szModuleName, setting, value )
-#define getTString( setting, dest ) DBGetContactSettingTString( NULL, m_szModuleName, setting, dest )
-#define setTString( setting, value ) DBWriteContactSettingTString( NULL, m_szModuleName, setting, value )
+#define getByte( setting, error ) db_get_b( NULL, m_szModuleName, setting, error )
+#define setByte( setting, value ) db_set_b( NULL, m_szModuleName, setting, value )
+#define getWord( setting, error ) db_get_w( NULL, m_szModuleName, setting, error )
+#define setWord( setting, value ) db_set_w( NULL, m_szModuleName, setting, value )
+#define getDword( setting, error ) db_get_dw( NULL, m_szModuleName, setting, error )
+#define setDword( setting, value ) db_set_dw( NULL, m_szModuleName, setting, value )
+#define getString( setting, dest ) db_get_s( NULL, m_szModuleName, setting, dest )
+#define setString( setting, value ) db_set_s( NULL, m_szModuleName, setting, value )
+#define getTString( setting, dest ) db_get_ts( NULL, m_szModuleName, setting, dest )
+#define setTString( setting, value ) db_set_ts( NULL, m_szModuleName, setting, value )
#define getU8String( setting, dest ) DBGetContactSettingUTF8String( NULL, m_szModuleName, setting, dest )
#define setU8String( setting, value ) DBWriteContactSettingUTF8String( NULL, m_szModuleName, setting, value )
-#define deleteSetting( setting ) DBDeleteContactSetting( NULL, m_szModuleName, setting )
+#define deleteSetting( setting ) db_unset( NULL, m_szModuleName, setting )
// DB keys
#define FACEBOOK_KEY_LOGIN "Email"
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index f30122be5d..e5bbf76d8f 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static BOOL LoadDBCheckState(FacebookProto* ppro, HWND hwnd, int idCtrl, const char* szSetting, BYTE bDef)
{
- BOOL state = DBGetContactSettingByte(NULL, ppro->m_szModuleName, szSetting, bDef);
+ BOOL state = db_get_b(NULL, ppro->m_szModuleName, szSetting, bDef);
CheckDlgButton(hwnd, idCtrl, state);
return state;
}
@@ -32,7 +32,7 @@ static BOOL LoadDBCheckState(FacebookProto* ppro, HWND hwnd, int idCtrl, const c static BOOL StoreDBCheckState(FacebookProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
BOOL state = IsDlgButtonChecked(hwnd, idCtrl);
- DBWriteContactSettingByte(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
+ db_set_b(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
return state;
}
@@ -50,18 +50,18 @@ INT_PTR CALLBACK FBAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
DBVARIANT dbv;
- if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv))
+ if ( !db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv))
{
SetDlgItemTextA(hwnd,IDC_UN,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
+ if ( !db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,
reinterpret_cast<LPARAM>(dbv.pszVal));
SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!proto->isOffline()) {
@@ -96,11 +96,11 @@ INT_PTR CALLBACK FBAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l char str[128];
GetDlgItemTextA(hwnd,IDC_UN,str,sizeof(str));
- DBWriteContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
+ db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str));
CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast<LPARAM>(str));
- DBWriteContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,str);
+ db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_PASS,str);
return TRUE;
}
@@ -128,10 +128,10 @@ INT_PTR CALLBACK FBMindProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lpar DBVARIANT dbv = { DBVT_TCHAR };
- if (!DBGetContactSettingTString(NULL,proto->m_szModuleName,FACEBOOK_KEY_NAME,&dbv))
+ if (!db_get_ts(NULL,proto->m_szModuleName,FACEBOOK_KEY_NAME,&dbv))
{
SetWindowText( hwnd, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
}
@@ -196,17 +196,17 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
DBVARIANT dbv;
- if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv))
+ if ( !db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv))
{
SetDlgItemTextA(hwnd,IDC_UN,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
+ if ( !db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,reinterpret_cast<LPARAM>(dbv.pszVal));
SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!proto->isOffline())
@@ -217,10 +217,10 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, FACEBOOK_GROUP_NAME_LIMIT, 0);
- if ( !DBGetContactSettingTString(0,proto->ModuleName(),FACEBOOK_KEY_DEF_GROUP,&dbv))
+ if ( !db_get_ts(0,proto->ModuleName(),FACEBOOK_KEY_DEF_GROUP,&dbv))
{
SetDlgItemText(hwnd,IDC_GROUP,dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
LoadDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, DEFAULT_DISABLE_STATUS_NOTIFY);
@@ -255,20 +255,20 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l char str[128]; TCHAR tstr[128];
GetDlgItemTextA(hwnd,IDC_UN,str,sizeof(str));
- DBWriteContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
+ db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str));
CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast<LPARAM>(str));
- DBWriteContactSettingString(NULL,proto->m_szModuleName,FACEBOOK_KEY_PASS,str);
+ db_set_s(NULL,proto->m_szModuleName,FACEBOOK_KEY_PASS,str);
GetDlgItemText(hwnd,IDC_GROUP,tstr,sizeof(tstr));
if ( lstrlen( tstr ) > 0 )
{
- DBWriteContactSettingTString(NULL,proto->m_szModuleName,FACEBOOK_KEY_DEF_GROUP,tstr);
+ db_set_ts(NULL,proto->m_szModuleName,FACEBOOK_KEY_DEF_GROUP,tstr);
CallService( MS_CLIST_GROUPCREATE, 0, (LPARAM)tstr );
}
else
- DBDeleteContactSetting(NULL,proto->m_szModuleName,FACEBOOK_KEY_DEF_GROUP);
+ db_unset(NULL,proto->m_szModuleName,FACEBOOK_KEY_DEF_GROUP);
StoreDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY);
StoreDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS);
@@ -334,10 +334,10 @@ INT_PTR CALLBACK FBOptionsAdvancedProc( HWND hwnd, UINT message, WPARAM wparam, StoreDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS);
BOOL setStatus = IsDlgButtonChecked(hwnd, IDC_SET_STATUS);
- BOOL setStatusOld = DBGetContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS);
+ BOOL setStatusOld = db_get_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS);
if (setStatus != setStatusOld)
{
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_SET_MIRANDA_STATUS, setStatus);
+ db_set_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_SET_MIRANDA_STATUS, setStatus);
if (setStatus && proto->isOnline())
{
ForkThread(&FacebookProto::SetAwayMsgWorker, proto, NULL);
@@ -373,7 +373,7 @@ INT_PTR CALLBACK FBEventsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp SendDlgItemMessageA(hwnd,IDC_FEED_TYPE,CB_INSERTSTRING,i,
reinterpret_cast<LPARAM>(Translate(feed_types[i].name)));
}
- SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_SETCURSEL, DBGetContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, 0), 0);
+ SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, 0), 0);
LoadDBCheckState(proto, hwnd, IDC_SYSTRAY_NOTIFY, FACEBOOK_KEY_SYSTRAY_NOTIFY, DEFAULT_SYSTRAY_NOTIFY);
LoadDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_ENABLE, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE);
@@ -381,18 +381,18 @@ INT_PTR CALLBACK FBEventsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp LoadDBCheckState(proto, hwnd, IDC_CLIENT_ENABLE, FACEBOOK_KEY_EVENT_CLIENT_ENABLE, DEFAULT_EVENT_CLIENT_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_OTHER_ENABLE, FACEBOOK_KEY_EVENT_OTHER_ENABLE, DEFAULT_EVENT_OTHER_ENABLE);
- SendDlgItemMessage(hwnd, IDC_COLBACK, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK,DEFAULT_EVENT_COLBACK));
- SendDlgItemMessage(hwnd, IDC_COLTEXT, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT,DEFAULT_EVENT_COLTEXT));
- SetDlgItemInt(hwnd, IDC_TIMEOUT,DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_TIMEOUT, 0),TRUE);
- SendDlgItemMessage(hwnd, IDC_COLBACK2, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLBACK,DEFAULT_EVENT_COLBACK));
- SendDlgItemMessage(hwnd, IDC_COLTEXT2, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLTEXT,DEFAULT_EVENT_COLTEXT));
- SetDlgItemInt(hwnd, IDC_TIMEOUT2,DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_TIMEOUT, 0),TRUE);
- SendDlgItemMessage(hwnd, IDC_COLBACK3, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLBACK,DEFAULT_EVENT_COLBACK));
- SendDlgItemMessage(hwnd, IDC_COLTEXT3, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLTEXT,DEFAULT_EVENT_COLTEXT));
- SetDlgItemInt(hwnd, IDC_TIMEOUT3,DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_TIMEOUT, 0),TRUE);
- SendDlgItemMessage(hwnd, IDC_COLBACK4, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLBACK,DEFAULT_EVENT_COLBACK));
- SendDlgItemMessage(hwnd, IDC_COLTEXT4, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLTEXT,DEFAULT_EVENT_COLTEXT));
- SetDlgItemInt(hwnd, IDC_TIMEOUT4,DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_TIMEOUT, 0),TRUE);
+ SendDlgItemMessage(hwnd, IDC_COLBACK, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK,DEFAULT_EVENT_COLBACK));
+ SendDlgItemMessage(hwnd, IDC_COLTEXT, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT,DEFAULT_EVENT_COLTEXT));
+ SetDlgItemInt(hwnd, IDC_TIMEOUT,db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_TIMEOUT, 0),TRUE);
+ SendDlgItemMessage(hwnd, IDC_COLBACK2, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLBACK,DEFAULT_EVENT_COLBACK));
+ SendDlgItemMessage(hwnd, IDC_COLTEXT2, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLTEXT,DEFAULT_EVENT_COLTEXT));
+ SetDlgItemInt(hwnd, IDC_TIMEOUT2,db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_TIMEOUT, 0),TRUE);
+ SendDlgItemMessage(hwnd, IDC_COLBACK3, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLBACK,DEFAULT_EVENT_COLBACK));
+ SendDlgItemMessage(hwnd, IDC_COLTEXT3, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLTEXT,DEFAULT_EVENT_COLTEXT));
+ SetDlgItemInt(hwnd, IDC_TIMEOUT3,db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_TIMEOUT, 0),TRUE);
+ SendDlgItemMessage(hwnd, IDC_COLBACK4, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLBACK,DEFAULT_EVENT_COLBACK));
+ SendDlgItemMessage(hwnd, IDC_COLTEXT4, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLTEXT,DEFAULT_EVENT_COLTEXT));
+ SetDlgItemInt(hwnd, IDC_TIMEOUT4,db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_TIMEOUT, 0),TRUE);
LoadDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_DEFAULT, FACEBOOK_KEY_EVENT_NOTIFICATIONS_DEFAULT, 0);
LoadDBCheckState(proto, hwnd, IDC_FEEDS_DEFAULT, FACEBOOK_KEY_EVENT_FEEDS_DEFAULT, 0);
@@ -446,7 +446,7 @@ INT_PTR CALLBACK FBEventsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp {
if ( reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY )
{
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_GETCURSEL, 0, 0));
StoreDBCheckState(proto, hwnd, IDC_SYSTRAY_NOTIFY, FACEBOOK_KEY_SYSTRAY_NOTIFY);
@@ -460,21 +460,21 @@ INT_PTR CALLBACK FBEventsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp StoreDBCheckState(proto, hwnd, IDC_OTHER_DEFAULT, FACEBOOK_KEY_EVENT_OTHER_DEFAULT);
StoreDBCheckState(proto, hwnd, IDC_CLIENT_DEFAULT, FACEBOOK_KEY_EVENT_CLIENT_DEFAULT);
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT,NULL,TRUE));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT,NULL,TRUE));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK2,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT2,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT2,NULL,TRUE));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK2,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT2,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT2,NULL,TRUE));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK3,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT3,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT3,NULL,TRUE));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK3,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT3,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT3,NULL,TRUE));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK4,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT4,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT4,NULL,TRUE));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK4,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT4,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT4,NULL,TRUE));
}
}
return TRUE;
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index f12740a111..89e2359dfa 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -433,7 +433,7 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess }
else if ( type.Value() == "notification_json" ) // event notification
{
- if (!DBGetContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE))
+ if (!db_get_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE))
continue;
const Array& notificationsArray = objMember["nodes"];
@@ -470,8 +470,8 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess HANDLE hContact = proto->AddToContactList(&fbu, FACEBOOK_CONTACT_FRIEND);
- if ( DBGetContactSettingWord(hContact,proto->m_szModuleName,"Status", 0) == ID_STATUS_OFFLINE )
- DBWriteContactSettingWord(hContact,proto->m_szModuleName,"Status",ID_STATUS_ONLINE);
+ if ( db_get_w(hContact,proto->m_szModuleName,"Status", 0) == ID_STATUS_OFFLINE )
+ db_set_w(hContact,proto->m_szModuleName,"Status",ID_STATUS_ONLINE);
const Number& state = objMember["st"];
if (state.Value() == 1)
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index 85a9f3c17a..52faf83b0d 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -26,10 +26,10 @@ int FacebookProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) {
DBVARIANT dbv;
- if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if ( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
ForkThread( &FacebookProto::MessagingWorker, this, new send_messaging(dbv.pszVal, FACEBOOK_RECV_MESSAGE ));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
@@ -52,7 +52,7 @@ void FacebookProto::SendMsgWorker(void *p) {
ProtoBroadcastAck(m_szModuleName, data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, data->msgid, (LPARAM)Translate("You cannot send messages when you are offline."));
}
- else if ( !DBGetContactSettingString(data->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ else if ( !db_get_s(data->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
//parseSmileys(data->msg, data->hContact);
@@ -70,7 +70,7 @@ void FacebookProto::SendMsgWorker(void *p) char *err = mir_utf8decodeA(error_text.c_str());
ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED, data->msgid,(LPARAM)err);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
delete data;
@@ -88,9 +88,9 @@ void FacebookProto::SendChatMsgWorker(void *p) if (hContact) {
std::string tid;
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_TID, &dbv)) {
+ if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_TID, &dbv)) {
tid = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
std::string post_data = "threads[group_ids][0]=" + data->chat_id;
post_data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
@@ -101,7 +101,7 @@ void FacebookProto::SendChatMsgWorker(void *p) facy.validate_response(&resp);
tid = utils::text::source_get_value(&resp.data, 2, "\"thread_id\":\"", "\"");
- DBWriteContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_TID, tid.c_str());
+ db_set_s(hContact, m_szModuleName, FACEBOOK_KEY_TID, tid.c_str());
Log(" Got thread info: %s = %s", data->chat_id.c_str(), tid.c_str());
}
@@ -139,8 +139,8 @@ void FacebookProto::SendTypingWorker(void *p) send_typing *typing = static_cast<send_typing*>(p);
// Dont send typing notifications to contacts, that are offline or not friends
- if ( DBGetContactSettingWord(typing->hContact,m_szModuleName,"Status", 0) == ID_STATUS_OFFLINE
- || DBGetContactSettingByte(typing->hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND)
+ if ( db_get_w(typing->hContact,m_szModuleName,"Status", 0) == ID_STATUS_OFFLINE
+ || db_get_b(typing->hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND)
return;
// TODO RM: maybe better send typing optimalization
@@ -154,7 +154,7 @@ void FacebookProto::SendTypingWorker(void *p) }
DBVARIANT dbv;
- if ( !DBGetContactSettingString(typing->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if ( !db_get_s(typing->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
std::string data = "&source=mercury-chat";
data += (typing->status == PROTOTYPE_SELFTYPING_ON ? "&typ=1" : "&typ=0"); // PROTOTYPE_SELFTYPING_OFF
@@ -164,7 +164,7 @@ void FacebookProto::SendTypingWorker(void *p) http::response resp = facy.flap( FACEBOOK_REQUEST_TYPING_SEND, &data );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
delete typing;
@@ -185,7 +185,7 @@ void FacebookProto::MessagingWorker(void *p) void FacebookProto::parseSmileys(std::string message, HANDLE hContact)
{
- if (!DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS))
+ if (!db_get_b(NULL,m_szModuleName,FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS))
return;
HANDLE nlc = NULL;
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index a89862a2f4..c1e4dcea1f 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -42,7 +42,7 @@ void FacebookProto::ProcessBuddyList( void* data ) p->parse_buddy_list( data, &facy.buddies );
delete p;
- bool use_mobile_status = DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_LOAD_MOBILE, DEFAULT_LOAD_MOBILE) != 0;
+ bool use_mobile_status = db_get_b(NULL,m_szModuleName,FACEBOOK_KEY_LOAD_MOBILE, DEFAULT_LOAD_MOBILE) != 0;
for ( List::Item< facebook_user >* i = facy.buddies.begin( ); i != NULL; )
{
@@ -73,19 +73,19 @@ void FacebookProto::ProcessBuddyList( void* data ) DBVARIANT dbv;
TCHAR* client = on_mobile ? _T(FACEBOOK_MOBILE) : _T(FACEBOOK_NAME);
- if (!DBGetContactSettingTString(hContact,m_szModuleName,"MirVer",&dbv)) {
+ if (!db_get_ts(hContact,m_szModuleName,"MirVer",&dbv)) {
if (_tcscmp(dbv.ptszVal, client))
- DBWriteContactSettingTString(hContact,m_szModuleName,"MirVer",client);
- DBFreeVariant(&dbv);
+ db_set_ts(hContact,m_szModuleName,"MirVer",client);
+ db_free(&dbv);
} else {
- DBWriteContactSettingTString(hContact,m_szModuleName,"MirVer",client);
+ db_set_ts(hContact,m_szModuleName,"MirVer",client);
}
}
if (fbu->status_id == ID_STATUS_OFFLINE || fbu->deleted)
{
if (fbu->handle)
- DBWriteContactSettingWord(fbu->handle, m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ db_set_w(fbu->handle, m_szModuleName, "Status", ID_STATUS_OFFLINE);
std::string to_delete( i->key );
i = i->next;
@@ -102,18 +102,18 @@ void FacebookProto::ProcessBuddyList( void* data ) }
}
- if (DBGetContactSettingWord(fbu->handle,m_szModuleName,"Status", 0) != fbu->status_id ) {
- DBWriteContactSettingWord(fbu->handle,m_szModuleName,"Status", fbu->status_id );
+ if (db_get_w(fbu->handle,m_szModuleName,"Status", 0) != fbu->status_id ) {
+ db_set_w(fbu->handle,m_szModuleName,"Status", fbu->status_id );
}
- if (DBGetContactSettingByte(fbu->handle, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) {
- DBWriteContactSettingByte(fbu->handle, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
+ if (db_get_b(fbu->handle, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) {
+ db_set_b(fbu->handle, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
// TODO: remove that popup and use "Contact added you" event?
}
// Wasn't contact removed from "server-list" someday?
- if ( DBGetContactSettingDword(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) {
- DBDeleteContactSetting(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED);
+ if ( db_get_dw(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) {
+ db_unset(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED);
std::string url = FACEBOOK_URL_PROFILE + fbu->user_id;
@@ -169,9 +169,9 @@ void FacebookProto::ProcessFriendList( void* data ) DBVARIANT dbv;
facebook_user *fbu;
- if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) {
+ if ( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) {
std::string id = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
std::map< std::string, facebook_user* >::iterator iter;
@@ -185,14 +185,14 @@ void FacebookProto::ProcessFriendList( void* data ) // TODO RM: remove, because contacts cant change it, so its only for "first run"
// - but what with contacts, that was added after logon?
// Update gender
- if ( DBGetContactSettingByte(hContact, m_szModuleName, "Gender", 0) != fbu->gender )
- DBWriteContactSettingByte(hContact, m_szModuleName, "Gender", fbu->gender);
+ if ( db_get_b(hContact, m_szModuleName, "Gender", 0) != fbu->gender )
+ db_set_b(hContact, m_szModuleName, "Gender", fbu->gender);
// Update real name
if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv))
{
update_required = strcmp( dbv.pszVal, fbu->real_name.c_str()) != 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( update_required )
{
@@ -200,14 +200,14 @@ void FacebookProto::ProcessFriendList( void* data ) DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str());
}
- if (DBGetContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) {
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
+ if (db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) {
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
// TODO: remove that popup and use "Contact added you" event?
}
// Wasn't contact removed from "server-list" someday?
- if ( DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) {
- DBDeleteContactSetting(hContact, m_szModuleName, FACEBOOK_KEY_DELETED);
+ if ( db_get_dw(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) {
+ db_unset(hContact, m_szModuleName, FACEBOOK_KEY_DELETED);
std::string url = FACEBOOK_URL_PROFILE + fbu->user_id;
@@ -227,17 +227,17 @@ void FacebookProto::ProcessFriendList( void* data ) // Contact was removed from "server-list", notify it
// Wasnt we already been notified about this contact? And was this real friend?
- if (!DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)
- && DBGetContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) == FACEBOOK_CONTACT_FRIEND)
+ if (!db_get_dw(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)
+ && db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) == FACEBOOK_CONTACT_FRIEND)
{
- DBWriteContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
+ db_set_dw(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
std::string contactname = id;
if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) {
contactname = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
std::string url = FACEBOOK_URL_PROFILE + id;
@@ -259,11 +259,11 @@ void FacebookProto::ProcessFriendList( void* data ) HANDLE hContact = AddToContactList(fbu, FACEBOOK_CONTACT_FRIEND, true); // This contact is surely new
- DBWriteContactSettingByte(hContact, m_szModuleName, "Gender", fbu->gender );
+ db_set_b(hContact, m_szModuleName, "Gender", fbu->gender );
DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, fbu->real_name.c_str());
DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str());
- DBWriteContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, fbu->image_url.c_str());
-// DBWriteContactSettingWord(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE );
+ db_set_s(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, fbu->image_url.c_str());
+// db_set_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE );
}
LOG("***** Friend list processed");
@@ -595,19 +595,19 @@ void FacebookProto::ProcessFriendRequests( void* ) if (fbu->user_id.length() && fbu->real_name.length())
{
HANDLE hContact = AddToContactList(fbu, FACEBOOK_CONTACT_APPROVE, false, fbu->real_name.c_str());
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_APPROVE);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_APPROVE);
bool seen = false;
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, m_szModuleName, "RequestTime", &dbv)) {
+ if (!db_get_s(hContact, m_szModuleName, "RequestTime", &dbv)) {
seen = !strcmp(dbv.pszVal, time.c_str());
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!seen) {
// This is new request
- DBWriteContactSettingString(hContact, m_szModuleName, "RequestTime", time.c_str());
+ db_set_s(hContact, m_szModuleName, "RequestTime", time.c_str());
//blob is: uin( DWORD ), hContact( HANDLE ), nick( ASCIIZ ), first( ASCIIZ ), last( ASCIIZ ), email( ASCIIZ ), reason( ASCIIZ )
//blob is: 0( DWORD ), hContact( HANDLE ), nick( ASCIIZ ), ""( ASCIIZ ), ""( ASCIIZ ), ""( ASCIIZ ), ""( ASCIIZ )
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 5b88516ffe..3dbaebea54 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -156,7 +156,7 @@ int FacebookProto::SetStatus( int new_status ) case ID_STATUS_IDLE:
default:
m_iDesiredStatus = ID_STATUS_INVISIBLE;
- if (DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_MAP_STATUSES, DEFAULT_MAP_STATUSES))
+ if (db_get_b(NULL,m_szModuleName,FACEBOOK_KEY_MAP_STATUSES, DEFAULT_MAP_STATUSES))
break;
case ID_STATUS_ONLINE:
case ID_STATUS_FREECHAT:
@@ -247,13 +247,13 @@ HANDLE FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) if (hContact) {
if (flags & PALF_TEMPORARY)
{
- DBWriteContactSettingByte(hContact, "Clist", "Hidden", 1);
- DBWriteContactSettingByte(hContact, "Clist", "NotOnList", 1);
+ db_set_b(hContact, "Clist", "Hidden", 1);
+ db_set_b(hContact, "Clist", "NotOnList", 1);
}
- else if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ else if (db_get_b(hContact, "CList", "NotOnList", 0))
{
- DBDeleteContactSetting(hContact, "CList", "Hidden");
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "NotOnList");
}
}
@@ -294,7 +294,7 @@ int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason) // TODO: hide from facebook requests list
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (db_get_b(hContact, "CList", "NotOnList", 0))
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
return 0;
@@ -312,7 +312,7 @@ int FacebookProto::GetMyAwayMsg( WPARAM wParam, LPARAM lParam ) if ( !getTString( "StatusMsg", &dbv ) && lstrlen( dbv.ptszVal ) != 0 )
{
int res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(dbv.ptszVal) : (INT_PTR)mir_t2a(dbv.ptszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return res;
} else {
return 0;
@@ -470,15 +470,15 @@ int FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) // TODO: why isn't wParam == 0 when is status menu moved to main menu?
if (wParam != 0 && IsMyContact(hContact)) {
- if (!DBGetContactSettingString(hContact, m_szModuleName, "Homepage", &dbv)) {
+ if (!db_get_s(hContact, m_szModuleName, "Homepage", &dbv)) {
// Homepage link already present, get it
url = dbv.pszVal;
- DBFreeVariant(&dbv);
- } else if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) {
+ db_free(&dbv);
+ } else if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) {
// No homepage link, create and save it
url += dbv.pszVal;
- DBWriteContactSettingString(hContact, m_szModuleName, "Homepage", url.c_str());
- DBFreeVariant(&dbv);
+ db_set_s(hContact, m_szModuleName, "Homepage", url.c_str());
+ db_free(&dbv);
}
}
@@ -497,24 +497,24 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
// Ignore groupchats and, if deleting, also not-friends
- if (DBGetContactSettingByte(hContact, m_szModuleName, "ChatRoom", 0)
- || (deleting && DBGetContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND))
+ if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0)
+ || (deleting && db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND))
return 0;
DBVARIANT dbv;
TCHAR tstr[256];
- if ( !DBGetContactSettingTString(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) {
+ if ( !db_get_ts(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) {
mir_sntprintf(tstr,SIZEOF(tstr),TranslateT("Do you want to cancel your friendship with '%s'?"), dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else if ( !DBGetContactSettingTString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) {
+ db_free(&dbv);
+ } else if ( !db_get_ts(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) {
mir_sntprintf(tstr,SIZEOF(tstr),TranslateT("Do you want to cancel your friendship with '%s'?"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (MessageBox( 0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) == IDYES) {
- if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if ( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
std::string* id = new std::string(dbv.pszVal);
@@ -526,7 +526,7 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) }
ForkThread( &FacebookProto::DeleteContactFromServer, this, ( void* )id );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -542,11 +542,11 @@ int FacebookProto::RequestFriendship(WPARAM wParam,LPARAM lParam) HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
DBVARIANT dbv;
- if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if ( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
std::string* id = new std::string(dbv.pszVal);
ForkThread( &FacebookProto::AddContactToServer, this, ( void* )id );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index c71e8df0bc..f2b14ce3bf 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -63,9 +63,7 @@ char *GetIconDescription(const char* name) }
// Contact List menu stuff
-HANDLE hHookPreBuildMenu;
-HANDLE g_hContactMenuItems[CMITEMS_COUNT];
-HANDLE g_hContactMenuSvc[CMITEMS_COUNT];
+HGENMENU g_hContactMenuItems[CMITEMS_COUNT];
// Helper functions
static FacebookProto * GetInstanceByHContact(HANDLE hContact)
@@ -91,9 +89,7 @@ INT_PTR GlobalService(WPARAM wParam,LPARAM lParam) static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam)
{
for (size_t i=0; i<SIZEOF(g_hContactMenuItems); i++)
- {
- EnableMenuItem(g_hContactMenuItems[i], false);
- }
+ Menu_ShowItem(g_hContactMenuItems[i], false);
FacebookProto *proto = GetInstanceByHContact(reinterpret_cast<HANDLE>(wParam));
return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0;
@@ -101,7 +97,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam) void InitContactMenus()
{
- hHookPreBuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU,PrebuildContactMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU,PrebuildContactMenu);
CLISTMENUITEM mi = {sizeof(mi)};
mi.flags = CMIF_ICONFROMICOLIB;
@@ -110,35 +106,35 @@ void InitContactMenus() mi.icolibItem = GetIconHandle("homepage");
mi.pszName = GetIconDescription("homepage");
mi.pszService = "FacebookProto/VisitProfile";
- g_hContactMenuSvc[CMI_VISIT_PROFILE] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::VisitProfile>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::VisitProfile>);
g_hContactMenuItems[CMI_VISIT_PROFILE] = Menu_AddContactMenuItem(&mi);
mi.position=-2000006001;
mi.icolibItem = GetIconHandle("authRevoke");
mi.pszName = GetIconDescription("authRevoke");
mi.pszService = "FacebookProto/CancelFriendship";
- g_hContactMenuSvc[CMI_AUTH_REVOKE] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::CancelFriendship>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::CancelFriendship>);
g_hContactMenuItems[CMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi);
mi.position=-2000006001;
mi.icolibItem = GetIconHandle("authRevokeReq");
mi.pszName = GetIconDescription("authRevokeReq");
mi.pszService = "FacebookProto/CancelFriendshipRequest";
- g_hContactMenuSvc[CMI_AUTH_CANCEL] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::OnCancelFriendshipRequest>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::OnCancelFriendshipRequest>);
g_hContactMenuItems[CMI_AUTH_CANCEL] = Menu_AddContactMenuItem(&mi);
mi.position=-2000006002;
mi.icolibItem = GetIconHandle("authAsk");
mi.pszName = GetIconDescription("authAsk");
mi.pszService = "FacebookProto/RequestFriendship";
- g_hContactMenuSvc[CMI_AUTH_ASK] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::RequestFriendship>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::RequestFriendship>);
g_hContactMenuItems[CMI_AUTH_ASK] = Menu_AddContactMenuItem(&mi);
mi.position=-2000006003;
mi.icolibItem = GetIconHandle("authGrant");
mi.pszName = GetIconDescription("authGrant");
mi.pszService = "FacebookProto/ApproveFriendship";
- g_hContactMenuSvc[CMI_AUTH_GRANT] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::ApproveFriendship>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::ApproveFriendship>);
g_hContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
}
@@ -146,39 +142,24 @@ void UninitContactMenus() {
for(size_t i=0; i<SIZEOF(g_hContactMenuItems); i++)
CallService(MS_CLIST_REMOVECONTACTMENUITEM,(WPARAM)g_hContactMenuItems[i],0);
-
- for(size_t i=0; i<SIZEOF(g_hContactMenuSvc); i++)
- DestroyServiceFunction(g_hContactMenuSvc[i]);
-
- UnhookEvent(hHookPreBuildMenu);
-}
-
-void EnableMenuItem(HANDLE hMenuItem, bool enable)
-{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
- if (!enable)
- clmi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi);
}
int FacebookProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam)
{
HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
- EnableMenuItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true);
+ Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true);
- if (!isOffline() && !DBGetContactSettingByte(hContact, m_szModuleName, "ChatRoom", 0))
+ if (!isOffline() && !db_get_b(hContact, m_szModuleName, "ChatRoom", 0))
{
bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
- BYTE type = DBGetContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0);
+ BYTE type = db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0);
- EnableMenuItem(g_hContactMenuItems[CMI_AUTH_ASK], ctrlPressed || type == FACEBOOK_CONTACT_NONE || !type);
- EnableMenuItem(g_hContactMenuItems[CMI_AUTH_GRANT], ctrlPressed || type == FACEBOOK_CONTACT_APPROVE);
- EnableMenuItem(g_hContactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || type == FACEBOOK_CONTACT_FRIEND);
- EnableMenuItem(g_hContactMenuItems[CMI_AUTH_CANCEL], ctrlPressed || type == FACEBOOK_CONTACT_REQUEST);
+ Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_ASK], ctrlPressed || type == FACEBOOK_CONTACT_NONE || !type);
+ Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_GRANT], ctrlPressed || type == FACEBOOK_CONTACT_APPROVE);
+ Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || type == FACEBOOK_CONTACT_FRIEND);
+ Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_CANCEL], ctrlPressed || type == FACEBOOK_CONTACT_REQUEST);
}
return 0;
diff --git a/protocols/FacebookRM/src/theme.h b/protocols/FacebookRM/src/theme.h index 9f130958f6..e86bfa995b 100644 --- a/protocols/FacebookRM/src/theme.h +++ b/protocols/FacebookRM/src/theme.h @@ -27,7 +27,6 @@ HANDLE GetIconHandle(const char *name); void InitContactMenus(void);
void UninitContactMenus(void);
-void EnableMenuItem(HANDLE hMenuItem, bool enable);
/* Contact menu item indexes */
#define CMI_VISIT_PROFILE 0
diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp index 77772175d9..ea1518f841 100644 --- a/protocols/FacebookRM/src/utils.cpp +++ b/protocols/FacebookRM/src/utils.cpp @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. std::string utils::url::encode(const std::string &s)
{
- return mir_ptr<char>( mir_urlEncode( s.c_str()));
+ return (char*)mir_ptr<char>( mir_urlEncode( s.c_str()));
}
std::string utils::url::decode(std::string data)
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index e1dd02b925..fecfe82523 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -360,7 +360,7 @@ IJabberInterface* IsGoogleAccount(LPCSTR szModuleName) if (!japi) return NULL;
DBVARIANT dbv;
- if ( DBGetContactSettingString(NULL, szModuleName, "ManualHost", &dbv))
+ if ( db_get_s(NULL, szModuleName, "ManualHost", &dbv))
return NULL;
bool res = !strcmp(dbv.pszVal, "talk.google.com");
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index bb699e365c..d325a90819 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -241,7 +241,7 @@ void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) void OpenContactInbox(LPCSTR acc)
{
DBVARIANT dbv;
- if ( DBGetContactSettingTString(0, acc, "jid", &dbv))
+ if ( db_get_ts(0, acc, "jid", &dbv))
return;
LPTSTR host = _tcschr(dbv.ptszVal, '@');
@@ -256,5 +256,5 @@ void OpenContactInbox(LPCSTR acc) mir_sntprintf(buf, SIZEOF(buf), INBOX_URL_FORMAT, _T(""), _T("mail")); // common
OpenUrl(acc, dbv.ptszVal, buf);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index 995848e0e4..343112cca9 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -53,12 +53,12 @@ LPCSTR GetJidAcc(LPCTSTR jid) DBVARIANT dbv;
for (int i=0; i < count; i++)
if (getJabberApi(protos[i]->szModuleName))
- if (!DBGetContactSettingTString(0, protos[i]->szModuleName, "jid", &dbv))
+ if (!db_get_ts(0, protos[i]->szModuleName, "jid", &dbv))
__try {
if (!lstrcmpi(jid, dbv.ptszVal)) return protos[i]->szModuleName;
}
__finally {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return NULL;
@@ -144,9 +144,9 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP extern HICON g_hPopupIcon;
data->lchIcon = g_hPopupIcon;
- data->iSeconds = (int)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0);
- data->colorBack = (COLORREF)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0);
- data->colorText = (COLORREF)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0);
+ data->iSeconds = (int)db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0);
+ data->colorBack = (COLORREF)db_get_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0);
+ data->colorText = (COLORREF)db_get_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0);
if (data->colorBack == data->colorText) {
data->colorBack = 0;
data->colorText = 0;
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index 37191383f8..1d2fb700d3 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -66,7 +66,7 @@ BOOL ReadCheckbox(HWND wnd, int id, DWORD controls) DWORD ReadCheckboxes(HWND wnd, LPCSTR mod)
{
- DWORD controls = DBGetContactSettingDword(0, NOTIFY_SETTINGS_FROM_MOD_NAME, mod, 0);
+ DWORD controls = db_get_dw(0, NOTIFY_SETTINGS_FROM_MOD_NAME, mod, 0);
ReadCheckbox(wnd, IDC_POPUPSENABLED, controls);
ReadCheckbox(wnd, IDC_POPUPSINFULLSCREEN, controls);
ReadCheckbox(wnd, IDC_AUTHONMAILBOX, controls);
@@ -171,13 +171,13 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM case WM_INITDIALOG:
TranslateDialogDefault(wnd);
SendMessage(GetDlgItem(wnd, IDC_BACKCOLORPICKER), CPM_SETCOLOUR, 0,
- (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0));
+ (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0));
SendMessage(GetDlgItem(wnd, IDC_TEXTCOLORPICKER), CPM_SETCOLOUR, 0,
- (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0));
+ (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0));
{
LPTSTR timeout = (LPTSTR)malloc(11 * sizeof(TCHAR));
__try {
- wsprintf(timeout, _T("%d"), DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0));
+ wsprintf(timeout, _T("%d"), db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0));
SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_SETTEXT, 0, (LPARAM)timeout);
}
__finally {
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index cacdf5878e..8acb72ce60 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -57,7 +57,7 @@ void ShiftTipperSettings(LPSTR buff, int count, LPSTR format) if (CallService(MS_DB_CONTACT_GETSETTING, 0, (LPARAM)&cgs)) break;
__try {
if (DBVT_ASCIIZ == cws.value.type) {
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
cws.value.type = DBVT_WCHAR;
if (CallService(MS_DB_CONTACT_GETSETTING_STR, 0, (LPARAM)&cgs)) break;
}
@@ -70,7 +70,7 @@ void ShiftTipperSettings(LPSTR buff, int count, LPSTR format) CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
}
__finally {
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
}
}
}
@@ -80,10 +80,10 @@ void SetLabelProp(int index, LPSTR setting) sprintf(setting, LABEL_SETTING_PROP, index);
DBVARIANT dbv1 = {0};
- if (!DBGetContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv1))
+ if (!db_get_ts(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv1))
__try {
DBVARIANT dbv2 = {0};
- if (!DBGetContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, &dbv2))
+ if (!db_get_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, &dbv2))
__try {
if (!lstrcmp(dbv1.ptszVal, dbv2.ptszVal)) {
LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
@@ -92,17 +92,17 @@ void SetLabelProp(int index, LPSTR setting) }
}
__finally {
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
}
__finally {
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
}
void AddTipperItem()
{
- unsigned short itemCount = DBGetContactSettingWord(0, TIPPER_ITEMS_MOD_NAME,
+ unsigned short itemCount = db_get_w(0, TIPPER_ITEMS_MOD_NAME,
TIPPER_ITEM_COUNT_SETTING , unsigned short(-1));
if (unsigned short(-1) == itemCount) return;
@@ -116,7 +116,7 @@ void AddTipperItem() sprintf(setting, VALUE_SETTING_PROP, i);
DBVARIANT dbv = {0};
- if (!DBGetContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv))
+ if (!db_get_ts(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv))
__try {
if (!lstrcmp(UNREAD_THREADS_RAW, dbv.ptszVal)) {
SetLabelProp(i, setting);
@@ -124,7 +124,7 @@ void AddTipperItem() }
}
__finally {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -152,6 +152,6 @@ void AddTipperItem() free(setting);
}
- DBWriteContactSettingWord(0, TIPPER_ITEMS_MOD_NAME,
+ db_set_w(0, TIPPER_ITEMS_MOD_NAME,
TIPPER_ITEM_COUNT_SETTING, itemCount + 1);
}
\ No newline at end of file diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index f3d2b87807..674a2e37ed 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -63,7 +63,7 @@ void GGPROTO::getAvatarFilename(HANDLE hContact, TCHAR *pszDest, int cbLen) TCHAR* avatarHashT = mir_a2t(dbv.pszVal);
mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s.%s"), avatarHashT, avatartype);
mir_free(avatarHashT);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else {
mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s avatar.%s"), m_tszUserName, avatartype);
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 7fb2b52aea..6d3b91fe28 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -72,7 +72,7 @@ void GGPROTO::disconnect() if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_ONLINE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case ID_STATUS_AWAY:
@@ -82,7 +82,7 @@ void GGPROTO::disconnect() if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_AWAY, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case ID_STATUS_DND:
@@ -92,7 +92,7 @@ void GGPROTO::disconnect() if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_DND, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case ID_STATUS_FREECHAT:
@@ -102,7 +102,7 @@ void GGPROTO::disconnect() if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_FREECHAT, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case ID_STATUS_INVISIBLE:
@@ -112,7 +112,7 @@ void GGPROTO::disconnect() if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_INVISIBLE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
default:
@@ -311,7 +311,7 @@ void __cdecl GGPROTO::mainthread(void *) if (!db_get_s(NULL, m_szModuleName, GG_KEY_SERVERHOSTS, &dbv, DBVT_ASCIIZ))
{
hostcount = gg_decodehosts(dbv.pszVal, hosts, 64);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -320,7 +320,7 @@ void __cdecl GGPROTO::mainthread(void *) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
p.password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
@@ -381,7 +381,7 @@ void __cdecl GGPROTO::mainthread(void *) else
netlog("mainthread() (%x): Loading forwarding host %s and port %d.", dbv.pszVal, p.external_port, this);
if (p.external_addr) p.external_port = db_get_w(NULL, m_szModuleName, GG_KEY_FORWARDPORT, GG_KEYDEF_FORWARDPORT);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
// Setup client port
@@ -924,7 +924,7 @@ retry: TCHAR* nickT;
if (!db_get_s(NULL, m_szModuleName, GG_KEY_NICK, &dbv, DBVT_TCHAR)){
nickT = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
nickT = mir_tstrdup(TranslateT("Me"));
}
@@ -1325,7 +1325,7 @@ int GGPROTO::contactdeleted(WPARAM wParam, LPARAM lParam) CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gcevent);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -1402,7 +1402,7 @@ int GGPROTO::dbsettingchanged(WPARAM wParam, LPARAM lParam) CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gcevent);
/* FIXME */ cascade = 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
// Change contact name on all chats
gc_changenick(hContact, ptszVal);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 97afdbcb89..3f8a29053c 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -145,7 +145,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, if (!unspecified)
SetDlgItemText(hwndDlg, idCtrl, ptstr);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
////////////////////////////////////////////////////////////////////////////////
@@ -193,7 +193,7 @@ void GGPROTO::checknewuser(uin_t uin, const char* passwd) if (!db_get_s(NULL, m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ))
{
if (dbv.pszVal) strcpy(oldpasswd, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (uin > 0 && strlen(passwd) > 0 && (uin != olduin || strcmp(oldpasswd, passwd)))
@@ -256,11 +256,11 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
@@ -419,14 +419,14 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_PASSWORD, "");
// Update e-mail
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_EMAIL, "");
@@ -618,7 +618,7 @@ static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, TranslateDialogDefault(hwndDlg);
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_SERVERHOSTS, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_HOST, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_HOST, GG_KEYDEF_SERVERHOSTS);
@@ -638,7 +638,7 @@ static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, CheckDlgButton(hwndDlg, IDC_FORWARDING, db_get_b(NULL, gg->m_szModuleName, GG_KEY_FORWARDING, GG_KEYDEF_FORWARDING));
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_FORWARDHOST, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (num = db_get_w(NULL, gg->m_szModuleName, GG_KEY_FORWARDPORT, GG_KEYDEF_FORWARDPORT))
SetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, ditoa(num));
@@ -983,11 +983,11 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
}
@@ -1026,14 +1026,14 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_PASSWORD, "");
// Update e-mail
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_EMAIL, "");
}
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 1c6caf192a..133c38469f 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -688,7 +688,7 @@ void __cdecl GGPROTO::getawaymsgthread(void *hContact) {
ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) dbv.ptszVal);
netlog("getawaymsgthread(): Reading away msg <%S>.", dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) NULL);
}
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index a0768e238f..ff8e0bfccd 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -151,7 +151,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam) {
if (dbv.ptszVal && !_tcscmp(gch->pDest->ptszID, dbv.ptszVal))
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
hContact = db_find_next(hContact);
}
@@ -177,7 +177,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam) TCHAR* nickT;
if (!db_get_s(NULL, m_szModuleName, GG_KEY_NICK, &dbv, DBVT_TCHAR)){
nickT = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
nickT = mir_tstrdup(TranslateT("Me"));
}
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index c0ee96e5e9..0cbded18f8 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -34,10 +34,10 @@ int GroupNameExists(const char *name) _itoa(i, idstr, 10);
if (db_get_s(NULL, "CListGroups", idstr, &dbv, DBVT_ASCIIZ)) break;
if (!strcmp(dbv.pszVal + 1, name)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -86,7 +86,7 @@ char *CreateGroup(char *groupName) _itoa(groupId, groupIdStr,10);
if (db_get_s(NULL, "CListGroups", groupIdStr, &dbv, DBVT_ASCIIZ))
break;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
groupName2[0] = 1|GROUPF_EXPANDED; // 1 is required so we never get '\0'
@@ -115,7 +115,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) char* pszValA = mir_t2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
string_append_c(s, ';');
// Readup LastName
@@ -124,7 +124,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) char* pszValA = mir_t2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
string_append_c(s, ';');
@@ -138,14 +138,14 @@ char *gg_makecontacts(GGPROTO *gg, int cr) char* pszValA = mir_t2a(dbv2.ptszVal);
string_append(s, pszValA);
mir_free(pszValA);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
} else {
string_append(s, dbvA);
}
string_append_c(s, ';');
string_append(s, dbvA);
mir_free(dbvA);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
string_append_c(s, ';');
@@ -159,14 +159,14 @@ char *gg_makecontacts(GGPROTO *gg, int cr) if (sms) *sms = 0;
string_append(s, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
string_append_c(s, ';');
// Readup Group
if (!db_get_s(hContact, "CList", "Group", &dbv, DBVT_ASCIIZ))
{
string_append(s, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
string_append_c(s, ';');
// Readup Uin
@@ -176,7 +176,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) if (!db_get_s(hContact, "UserInfo", "Mye-mail0", &dbv, DBVT_ASCIIZ))
{
string_append(s, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (cr)
string_append(s, ";0;;0;\r\n");
@@ -349,7 +349,7 @@ INT_PTR GGPROTO::import_server(WPARAM wParam, LPARAM lParam) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
password = _strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else return 0;
@@ -396,7 +396,7 @@ INT_PTR GGPROTO::remove_server(WPARAM wParam, LPARAM lParam) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
password = _strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else return 0;
@@ -577,7 +577,7 @@ INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
password = _strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else return 0;
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index a7e5ebac80..6773b61cf6 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -365,16 +365,16 @@ char* GGPROTO::oauth_header(const char *httpmethod, const char *url) if (!db_get_s(NULL, m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(int)strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, m_szModuleName, GG_KEY_TOKEN, &dbv, DBVT_ASCIIZ)) {
token = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, m_szModuleName, GG_KEY_TOKENSECRET, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(int)strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
token_secret = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
res = oauth_auth_header(httpmethod, url, HMACSHA1, uin, password, token, token_secret);
@@ -399,7 +399,7 @@ int GGPROTO::oauth_receivetoken() if (!db_get_s(NULL, m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// 1. Obtaining an Unauthorized Request Token
@@ -562,12 +562,12 @@ int GGPROTO::oauth_checktoken(int force) if (!db_get_s(NULL, m_szModuleName, GG_KEY_TOKEN, &dbv, DBVT_ASCIIZ)) {
token = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, m_szModuleName, GG_KEY_TOKENSECRET, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(int)strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
token_secret = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (token == NULL || token_secret == NULL) {
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 09067b1ff0..93be5e73f3 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -233,10 +233,10 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) netlog("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS");
_tcscpy_s(pai->filename, SIZEOF(pai->filename) ,dbv.ptszVal);
pai->format = GetImageFormat(pai->filename);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return GAIR_SUCCESS;
} else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -257,11 +257,11 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (!db_get_s(pai->hContact, m_szModuleName, GG_KEY_AVATARURL, &dbv, DBVT_ASCIIZ)) {
AvatarURL = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(pai->hContact, m_szModuleName, GG_KEY_AVATARTS, &dbv, DBVT_ASCIIZ)) {
AvatarTs = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (AvatarURL != NULL && strlen(AvatarURL) > 0 && AvatarTs != NULL && strlen(AvatarTs) > 0) {
char *AvatarName = strrchr(AvatarURL, '/');
@@ -273,7 +273,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (!db_get_s(pai->hContact, m_szModuleName, GG_KEY_AVATARHASH, &dbv, DBVT_ASCIIZ)) {
AvatarSavedHash = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (AvatarHash != NULL && AvatarSavedHash != NULL) {
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index e92188fe59..c00d615ad1 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -135,7 +135,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv_email, DBVT_ASCIIZ))
{
strncpy(email, dbv_email.pszVal, sizeof(email));
- DBFreeVariant(&dbv_email);
+ db_free(&dbv_email);
}
// Load token
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index e2b0454a35..d3f4aed5de 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -32,8 +32,8 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, CONTACT usertemp = { (TCHAR*)name.c_str(), NULL, NULL, false, false, true};
hc = CList_FindContact( &usertemp );
- if ( hc && DBGetContactSettingByte( hc, "CList", "NotOnList", 0) == 0
- && DBGetContactSettingByte(hc,"CList", "Hidden", 0) == 0)
+ if ( hc && db_get_b( hc, "CList", "NotOnList", 0) == 0
+ && db_get_b(hc,"CList", "Hidden", 0) == 0)
{
bFlag = true;
}
@@ -93,9 +93,9 @@ HANDLE CIrcProto::CList_AddContact(CONTACT * user, bool InList, bool SetOnline) HANDLE hContact = CList_FindContact(user);
if ( hContact ) {
if ( InList )
- DBDeleteContactSetting( hContact, "CList", "NotOnList" );
+ db_unset( hContact, "CList", "NotOnList" );
setTString(hContact, "Nick", user->name);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
if (SetOnline && getWord(hContact, "Status", ID_STATUS_OFFLINE)== ID_STATUS_OFFLINE)
setWord(hContact, "Status", ID_STATUS_ONLINE);
return hContact;
@@ -107,10 +107,10 @@ HANDLE CIrcProto::CList_AddContact(CONTACT * user, bool InList, bool SetOnline) CallService( MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM)m_szModuleName );
if ( InList )
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
else
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ db_unset(hContact, "CList", "Hidden");
setTString(hContact, "Nick", user->name);
setTString(hContact, "Default", user->name);
setWord(hContact, "Status", SetOnline ? ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
@@ -131,7 +131,7 @@ HANDLE CIrcProto::CList_SetOffline(struct CONTACT * user) setString(hContact, "Host", "");
setTString(hContact, "Nick", dbv.ptszVal);
setWord(hContact, "Status", ID_STATUS_OFFLINE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return hContact;
} }
@@ -156,9 +156,9 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo) else if ( !getTString( hContact, "Default", &dbv )) {
setTString( hContact, "Nick", dbv.ptszVal);
setWord( hContact, "Status", ID_STATUS_OFFLINE );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
- DBDeleteContactSetting( hContact, m_szModuleName, "IP" );
+ db_unset( hContact, m_szModuleName, "IP" );
setString( hContact, "User", "" );
setString( hContact, "Host", "" );
} }
@@ -227,11 +227,11 @@ HANDLE CIrcProto::CList_FindContact (CONTACT* user) hContact_temp = hContact;
} }
- if ( DBDefault ) DBFreeVariant(&dbv1);
- if ( DBNick ) DBFreeVariant(&dbv2);
- if ( DBWildcard ) DBFreeVariant(&dbv3);
- if ( DBUser ) DBFreeVariant(&dbv4);
- if ( DBHost ) DBFreeVariant(&dbv5);
+ if ( DBDefault ) db_free(&dbv1);
+ if ( DBNick ) db_free(&dbv2);
+ if ( DBWildcard ) db_free(&dbv3);
+ if ( DBUser ) db_free(&dbv4);
+ if ( DBHost ) db_free(&dbv5);
if ( hContact_temp != NULL ) {
mir_free(lowercasename);
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index bd6021e292..752e764ccf 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -148,19 +148,19 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) BYTE bRoom = ppro->getByte(hContact, "ChatRoom", 0);
if ( bRoom == 0 ) {
BYTE bDCC = ppro->getByte(hContact, "DCC", 0);
- BYTE bHidden = DBGetContactSettingByte(hContact,"CList", "Hidden", 0);
+ BYTE bHidden = db_get_b(hContact,"CList", "Hidden", 0);
if ( bDCC == 0 && bHidden == 0 ) {
if ( !ppro->getTString( hContact, "Default", &dbv )) {
BYTE bAdvanced = ppro->getByte(hContact, "AdvancedMode", 0) ;
if ( !bAdvanced ) {
- DBFreeVariant( &dbv );
+ db_free( &dbv );
if ( !ppro->getTString( hContact, "Nick", &dbv )) {
ppro->m_namesToUserhost += CMString(dbv.ptszVal) + _T(" ");
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
}
else {
- DBFreeVariant( &dbv );
+ db_free( &dbv );
DBVARIANT dbv2;
TCHAR* DBNick = NULL;
@@ -175,8 +175,8 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) else if ( DBWildcard )
ppro->m_namesToWho += CMString(DBWildcard) + _T(" ");
- if ( DBNick ) DBFreeVariant(&dbv);
- if ( DBWildcard ) DBFreeVariant(&dbv2);
+ if ( DBNick ) db_free(&dbv);
+ if ( DBWildcard ) db_free(&dbv2);
} } } } }
hContact = db_find_next(hContact);
@@ -714,7 +714,7 @@ bool CIrcProto::OnIrc_PRIVMSG( const CIrcMessage* pmsg ) if (( m_ignore && IsIgnored( pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'q' ))) {
HANDLE hContact = CList_FindContact( &user );
- if ( !hContact || ( hContact && DBGetContactSettingByte( hContact,"CList", "Hidden", 0) == 1 ))
+ if ( !hContact || ( hContact && db_get_b( hContact,"CList", "Hidden", 0) == 1 ))
return true;
}
@@ -1082,8 +1082,8 @@ bool CIrcProto::IsCTCP( const CIrcMessage* pmsg ) // check if it should be ignored
if ( m_DCCChatIgnore == 1 ||
m_DCCChatIgnore == 2 && hContact &&
- DBGetContactSettingByte(hContact,"CList", "NotOnList", 0) == 0 &&
- DBGetContactSettingByte(hContact,"CList", "Hidden", 0) == 0)
+ db_get_b(hContact,"CList", "NotOnList", 0) == 0 &&
+ db_get_b(hContact,"CList", "Hidden", 0) == 0)
{
CMString host = pmsg->prefix.sUser + _T("@") + pmsg->prefix.sHost;
CList_AddDCCChat(pmsg->prefix.sNick, host, dwAdr, iPort); // add a CHAT event to the clist
@@ -1431,10 +1431,10 @@ bool CIrcProto::OnIrc_ENDNAMES( const CIrcMessage* pmsg ) else CallChatEvent( SESSION_INITDONE, (LPARAM)&gce);
if ( save.IsEmpty())
- DBDeleteContactSetting(NULL, m_szModuleName, "JTemp");
+ db_unset(NULL, m_szModuleName, "JTemp");
else
setTString("JTemp", save.c_str());
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else CallChatEvent( SESSION_INITDONE, (LPARAM)&gce);
@@ -1791,13 +1791,13 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER( const CIrcMessage* pmsg ) else {
if ( !getTString( hContact, "UWildcard", &dbv2 )) {
DoUserhostWithReason(2, ((CMString)_T("S") + dbv2.ptszVal).c_str(), true, dbv2.ptszVal );
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
else DoUserhostWithReason(2, ((CMString)_T("S") + dbv.ptszVal).c_str(), true, dbv.ptszVal );
}
setString(hContact, "User", "");
setString(hContact, "Host", "");
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} } }
ShowMessage( pmsg );
@@ -1855,10 +1855,10 @@ bool CIrcProto::OnIrc_JOINERROR( const CIrcMessage* pmsg ) save += command + _T(" ");
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if ( save.IsEmpty())
- DBDeleteContactSetting( NULL, m_szModuleName, "JTemp" );
+ db_unset( NULL, m_szModuleName, "JTemp" );
else
setTString( "JTemp", save.c_str());
} }
@@ -2018,13 +2018,13 @@ bool CIrcProto::OnIrc_WHO_END( const CIrcMessage* pmsg ) setString(hContact, "Host", "");
}
LBL_Exit:
- if ( DBDefault ) DBFreeVariant(&dbv1);
- if ( DBNick ) DBFreeVariant(&dbv2);
- if ( DBWildcard ) DBFreeVariant(&dbv3);
- if ( DBUser ) DBFreeVariant(&dbv4);
- if ( DBHost ) DBFreeVariant(&dbv5);
- if ( DBManUser ) DBFreeVariant(&dbv6);
- if ( DBManHost ) DBFreeVariant(&dbv7);
+ if ( DBDefault ) db_free(&dbv1);
+ if ( DBNick ) db_free(&dbv2);
+ if ( DBWildcard ) db_free(&dbv3);
+ if ( DBUser ) db_free(&dbv4);
+ if ( DBHost ) db_free(&dbv5);
+ if ( DBManUser ) db_free(&dbv6);
+ if ( DBManHost ) db_free(&dbv7);
}
mir_free( UserList );
}
@@ -2291,7 +2291,7 @@ void CIrcProto::OnIrcDefault( const CIrcMessage* pmsg ) void CIrcProto::OnIrcDisconnected()
{
m_statusMessage = _T("");
- DBDeleteContactSetting(NULL, m_szModuleName, "JTemp");
+ db_unset(NULL, m_szModuleName, "JTemp");
bTempDisableCheck = false;
bTempForceCheck = false;
m_iTempCheckTime = 0;
@@ -2432,7 +2432,7 @@ int CIrcProto::DoPerform( const char* event ) PostIrcMessageWnd( NULL, NULL, dbv.ptszVal );
else
mir_forkthread( AwayWarningThread, NULL );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return 1;
}
return 0;
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index eafeae75fb..2f87cb1409 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -52,7 +52,7 @@ void CIrcProto::FormatMsg(CMString& text) DBVARIANT dbv;
if ( !getTString( "PNick", &dbv )) {
sNick4Perform = dbv.ptszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
ReplaceString( sNewNick, NICKSUBSTITUTE, sNick4Perform.c_str());
@@ -579,7 +579,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac CMString S = _T("S");
S += dbv1.ptszVal;
DoUserhostWithReason(2, S.c_str(), true, dbv1.ptszVal);
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
else {
CMString S = _T("S");
@@ -653,7 +653,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac if ( !getTString( hContact, "UWildcard", &dbv1 )) {
S += dbv1.ptszVal;
DoUserhostWithReason(2, S.c_str(), true, dbv1.ptszVal );
- DBFreeVariant( &dbv1 );
+ db_free( &dbv1 );
}
else {
S += two;
@@ -825,7 +825,7 @@ bool CIrcProto::PostIrcMessageWnd( TCHAR* window, HANDLE hContact, const TCHAR* if ( hContact && !getTString( hContact, "Nick", &dbv )) {
lstrcpyn( windowname, dbv.ptszVal, 255);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else if ( window )
lstrcpyn( windowname, window, 255 );
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index e6fd017765..0ebc2d4da0 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -552,11 +552,11 @@ CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const TCHAR* szName) DBVARIANT dbv;
if ( !getTString(p->di->hContact, "Nick", &dbv)) {
if ( p->di->iType == DCC_SEND && !p->di->bSender && !lstrcmpi( szName, dbv.ptszVal) && iPort == p->di->iPort ) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
LeaveCriticalSection(&m_dcc);
return p;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 95df8741a2..55566a75c0 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -196,7 +196,7 @@ int CIrcProto::OnModulesLoaded( WPARAM, LPARAM ) NETLIBUSER nlu = {0};
TCHAR name[128];
- DBDeleteContactSetting( NULL, m_szModuleName, "JTemp" );
+ db_unset( NULL, m_szModuleName, "JTemp" );
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING|NUF_INCOMING|NUF_HTTPCONNS|NUF_TCHAR;
@@ -305,10 +305,10 @@ int CIrcProto::OnModulesLoaded( WPARAM, LPARAM ) String s = performToConvert[i];
DBVARIANT dbv;
if ( !getTString( s, &dbv )) {
- DBDeleteContactSetting( NULL, m_szModuleName, s );
+ db_unset( NULL, m_szModuleName, s );
s.MakeUpper();
setTString( s, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
setByte( "PerformConversionDone", 1 );
@@ -362,7 +362,7 @@ HANDLE __cdecl CIrcProto::AddToList( int, PROTOSEARCHRESULT* psr ) if ( !getTString(hContact, "UWildcard", &dbv1 )) {
S += dbv1.ptszVal;
DoUserhostWithReason(2, S, true, dbv1.ptszVal);
- DBFreeVariant( &dbv1 );
+ db_free( &dbv1 );
}
else {
S += user.name;
@@ -787,7 +787,7 @@ HANDLE __cdecl CIrcProto::SendFile( HANDLE hContact, const TCHAR*, TCHAR** ppszF index++;
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
if (dci)
@@ -953,14 +953,14 @@ HANDLE __cdecl CIrcProto::GetAwayMsg( HANDLE hContact ) if ( hContact && !getTString( hContact, "Nick", &dbv)) {
int i = getWord( hContact, "Status", ID_STATUS_OFFLINE );
if ( i != ID_STATUS_AWAY) {
- DBFreeVariant( &dbv);
+ db_free( &dbv);
return 0;
}
CMString S = _T("WHOIS ");
S += dbv.ptszVal;
if (IsConnected())
SendIrcMessage( S.c_str(), false);
- DBFreeVariant( &dbv);
+ db_free( &dbv);
} }
return (HANDLE)1;
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index d05b07df1a..a0103154d7 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -52,7 +52,7 @@ void CIrcProto::ReadSettings( TDbSetting* sets, int count ) ptr[len] = 0;
}
else *( char** )ptr = mir_strdup( dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else {
if ( p->size != -1 )
@@ -69,7 +69,7 @@ void CIrcProto::ReadSettings( TDbSetting* sets, int count ) *( TCHAR* )&ptr[len*sizeof(TCHAR)] = 0;
}
else *( TCHAR** )ptr = mir_tstrdup( dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else {
if ( p->size != -1 ) {
@@ -115,7 +115,7 @@ void CIrcProto::WriteSettings( TDbSetting* sets, int count ) static int sttServerEnum( const char* szSetting, LPARAM )
{
DBVARIANT dbv;
- if ( DBGetContactSettingString( NULL, SERVERSMODULE, szSetting, &dbv ))
+ if ( db_get_s( NULL, SERVERSMODULE, szSetting, &dbv ))
return 0;
SERVER_INFO* pData = new SERVER_INFO;
@@ -159,7 +159,7 @@ static int sttServerEnum( const char* szSetting, LPARAM ) lstrcpynA( pData->m_group, p1, p2-p1+1 );
g_servers.insert( pData );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return 0;
}
@@ -814,7 +814,7 @@ void CConnectPrefsDlg::OnApply() mir_snprintf(TextLine, sizeof(TextLine), "SERVER:SSL%u%s:%d-%dGROUP:%s", pData->m_iSSL, pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
else
mir_snprintf(TextLine, sizeof(TextLine), "SERVER:%s:%d-%dGROUP:%s", pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
- DBWriteContactSettingString( NULL, SERVERSMODULE, pData->m_name, TextLine );
+ db_set_s( NULL, SERVERSMODULE, pData->m_name, TextLine );
// combobox might contain new items
if ( g_servers.find( pData ) == NULL )
@@ -1211,7 +1211,7 @@ void COtherPrefsDlg::OnApply() if ( !pPerf->mText.IsEmpty())
m_proto->setTString( pPerf->mSetting.c_str(), pPerf->mText.c_str());
else
- DBDeleteContactSetting( NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str());
+ db_unset( NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str());
} }
m_proto->WriteSettings( OtherSettings, SIZEOF( OtherSettings ));
}
@@ -1225,7 +1225,7 @@ void COtherPrefsDlg::addPerformComboValue( int idx, const char* szValueName ) DBVARIANT dbv;
if ( !m_proto->getTString( sSetting.c_str(), &dbv )) {
pPref = new PERFORM_INFO( sSetting.c_str(), dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else pPref = new PERFORM_INFO( sSetting.c_str(), _T(""));
m_performCombo.SetItemData( idx, ( LPARAM )pPref );
@@ -1407,7 +1407,7 @@ void CIrcProto::InitIgnore( void ) CMString flags = GetWord( dbv.ptszVal, 1 );
CMString network = GetWord( dbv.ptszVal, 2 );
m_ignoreItems.insert( new CIrcIgnoreItem( mask.c_str(), flags.c_str(), network.c_str()));
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
void CIrcProto::RewriteIgnoreSettings( void )
@@ -1417,7 +1417,7 @@ void CIrcProto::RewriteIgnoreSettings( void ) int i=0;
for ( ;; ) {
mir_snprintf( settingName, sizeof(settingName), "IGNORE:%d", i++ );
- if ( DBDeleteContactSetting( NULL, m_szModuleName, settingName ))
+ if ( db_unset( NULL, m_szModuleName, settingName ))
break;
}
@@ -1733,11 +1733,11 @@ void CIrcProto::InitPrefs(void) int x = getDword( "SizeOfListBottom", -1 );
if ( x != -1 ) {
- DBDeleteContactSetting( NULL, m_szModuleName, "SizeOfListBottom" );
+ db_unset( NULL, m_szModuleName, "SizeOfListBottom" );
setDword( "channelList_height", x );
}
if (( x = getDword( "SizeOfListWidth", -1 )) != -1 ) {
- DBDeleteContactSetting( NULL, m_szModuleName, "SizeOfListWidth" );
+ db_unset( NULL, m_szModuleName, "SizeOfListWidth" );
setDword( "channelList_width", x );
}
@@ -1892,7 +1892,7 @@ static void sttImportIni( const TCHAR* szIniFile ) memcpy( buf2, p, int(p1-p));
buf2[ int(p1-p) ] = 0;
- DBWriteContactSettingString( NULL, SERVERSMODULE, buf2, p1 );
+ db_set_s( NULL, SERVERSMODULE, buf2, p1 );
}
fclose( serverFile );
::_tremove( szIniFile );
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index c8204ac5d6..31706f1858 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -248,7 +248,7 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM) dcc->Disconnect();
} }
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -262,7 +262,7 @@ INT_PTR __cdecl CIrcProto::OnJoinChat(WPARAM wp, LPARAM) if ( !getTString(( HANDLE )wp, "Nick", &dbv)) {
if ( getByte(( HANDLE )wp, "ChatRoom", 0) == GCW_CHATROOM)
PostIrcMessage( _T("/JOIN %s"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -288,7 +288,7 @@ INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM wp, LPARAM) gcd.ptszID = ( TCHAR* )S.c_str();
CallChatEvent( SESSION_TERMINATE, (LPARAM)&gce);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -302,7 +302,7 @@ INT_PTR __cdecl CIrcProto::OnMenuChanSettings(WPARAM wp, LPARAM) DBVARIANT dbv;
if ( !getTString( hContact, "Nick", &dbv )) {
PostIrcMessageWnd(dbv.ptszVal, NULL, _T("/CHANNELMANAGER"));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -316,7 +316,7 @@ INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM wp, LPARAM) if ( !getTString(( HANDLE )wp, "Nick", &dbv)) {
PostIrcMessage( _T("/WHOIS %s %s"), dbv.ptszVal, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -352,10 +352,10 @@ INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM wp, LPARAM) PostIrcMessage( _T("/IGNORE %%question=\"%s\",\"%s\",\"*!*@%S\" %s"),
TranslateT("Please enter the hostmask (nick!user@host) \nNOTE! Contacts on your contact list are never ignored"),
TranslateT("Ignore"), host, S.c_str());
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -649,7 +649,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
if ( !getTString( "Nick", &dbv )) {
PostIrcMessage( _T("/nickserv SENDPASS %s"), dbv.ptszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
break;
case 10: // nickserv set new password
@@ -940,7 +940,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) gcmi->nItems = SIZEOF(nickItems);
gcmi->Item = nickItems;
- BOOL bIsInList = (hContact && DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 0);
+ BOOL bIsInList = (hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 0);
gcmi->Item[gcmi->nItems-1].bDisabled = bIsInList;
unsigned long ulAdr = 0;
@@ -1033,12 +1033,12 @@ int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM) if ( !getString( hContact, "Host", &dbv3)) {
if (dbv3.pszVal[0] == 0)
bEnabled = false;
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
}
Menu_ShowItem(hUMenuIgnore, bEnabled);
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
}
@@ -1063,7 +1063,7 @@ int __cdecl CIrcProto::OnDbSettingChanged(WPARAM wParam, LPARAM lParam) if ( !getTString( hContact, "Nick", &dbv )) {
if ( getByte( "MirVerAutoRequest", 1))
PostIrcMessage( _T("/PRIVMSG %s \001VERSION\001"), dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
return 0;
}
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index a665eb205c..a656313cc2 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -25,83 +25,83 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Standard functions
int CIrcProto::getByte( const char* name, BYTE defaultValue )
-{ return DBGetContactSettingByte( NULL, m_szModuleName, name, defaultValue );
+{ return db_get_b( NULL, m_szModuleName, name, defaultValue );
}
int CIrcProto::getByte( HANDLE hContact, const char* name, BYTE defaultValue )
-{ return DBGetContactSettingByte(hContact, m_szModuleName, name, defaultValue );
+{ return db_get_b(hContact, m_szModuleName, name, defaultValue );
}
int CIrcProto::getDword( const char* name, DWORD defaultValue )
-{ return DBGetContactSettingDword( NULL, m_szModuleName, name, defaultValue );
+{ return db_get_dw( NULL, m_szModuleName, name, defaultValue );
}
int CIrcProto::getDword( HANDLE hContact, const char* name, DWORD defaultValue )
-{ return DBGetContactSettingDword(hContact, m_szModuleName, name, defaultValue );
+{ return db_get_dw(hContact, m_szModuleName, name, defaultValue );
}
int CIrcProto::getString( const char* name, DBVARIANT* result )
-{ return DBGetContactSettingString( NULL, m_szModuleName, name, result );
+{ return db_get_s( NULL, m_szModuleName, name, result );
}
int CIrcProto::getString( HANDLE hContact, const char* name, DBVARIANT* result )
-{ return DBGetContactSettingString( hContact, m_szModuleName, name, result );
+{ return db_get_s( hContact, m_szModuleName, name, result );
}
int CIrcProto::getTString( const char* name, DBVARIANT* result )
-{ return DBGetContactSettingTString( NULL, m_szModuleName, name, result );
+{ return db_get_ts( NULL, m_szModuleName, name, result );
}
int CIrcProto::getTString( HANDLE hContact, const char* name, DBVARIANT* result )
-{ return DBGetContactSettingTString( hContact, m_szModuleName, name, result );
+{ return db_get_ts( hContact, m_szModuleName, name, result );
}
int CIrcProto::getWord( const char* name, WORD defaultValue )
-{ return DBGetContactSettingWord( NULL, m_szModuleName, name, defaultValue );
+{ return db_get_w( NULL, m_szModuleName, name, defaultValue );
}
int CIrcProto::getWord( HANDLE hContact, const char* name, WORD defaultValue )
-{ return DBGetContactSettingWord(hContact, m_szModuleName, name, defaultValue );
+{ return db_get_w(hContact, m_szModuleName, name, defaultValue );
}
void CIrcProto::setByte( const char* name, BYTE value )
-{ DBWriteContactSettingByte(NULL, m_szModuleName, name, value );
+{ db_set_b(NULL, m_szModuleName, name, value );
}
void CIrcProto::setByte( HANDLE hContact, const char* name, BYTE value )
-{ DBWriteContactSettingByte(hContact, m_szModuleName, name, value );
+{ db_set_b(hContact, m_szModuleName, name, value );
}
void CIrcProto::setDword( const char* name, DWORD value )
-{ DBWriteContactSettingDword(NULL, m_szModuleName, name, value );
+{ db_set_dw(NULL, m_szModuleName, name, value );
}
void CIrcProto::setDword( HANDLE hContact, const char* name, DWORD value )
-{ DBWriteContactSettingDword(hContact, m_szModuleName, name, value );
+{ db_set_dw(hContact, m_szModuleName, name, value );
}
void CIrcProto::setString( const char* name, const char* value )
-{ DBWriteContactSettingString(NULL, m_szModuleName, name, value );
+{ db_set_s(NULL, m_szModuleName, name, value );
}
void CIrcProto::setString( HANDLE hContact, const char* name, const char* value )
-{ DBWriteContactSettingString(hContact, m_szModuleName, name, value );
+{ db_set_s(hContact, m_szModuleName, name, value );
}
void CIrcProto::setTString( const char* name, const TCHAR* value )
-{ DBWriteContactSettingTString(NULL, m_szModuleName, name, value );
+{ db_set_ts(NULL, m_szModuleName, name, value );
}
void CIrcProto::setTString( HANDLE hContact, const char* name, const TCHAR* value )
-{ DBWriteContactSettingTString(hContact, m_szModuleName, name, value );
+{ db_set_ts(hContact, m_szModuleName, name, value );
}
void CIrcProto::setWord( const char* name, int value )
-{ DBWriteContactSettingWord(NULL, m_szModuleName, name, value );
+{ db_set_w(NULL, m_szModuleName, name, value );
}
void CIrcProto::setWord( HANDLE hContact, const char* name, int value )
-{ DBWriteContactSettingWord(hContact, m_szModuleName, name, value );
+{ db_set_w(hContact, m_szModuleName, name, value );
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -126,7 +126,7 @@ void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand) DBVARIANT dbv;
if ( !getTString( "JTemp", &dbv )) {
res = CMString(dbv.ptszVal) + _T(" ") + res;
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
setTString("JTemp", res.c_str());
diff --git a/protocols/IRCG/src/ui_utils.cpp b/protocols/IRCG/src/ui_utils.cpp index c1cf19309f..b86263dbfd 100644 --- a/protocols/IRCG/src/ui_utils.cpp +++ b/protocols/IRCG/src/ui_utils.cpp @@ -1757,15 +1757,15 @@ CDbLink::~CDbLink() mir_free(m_szSetting);
mir_free(m_szDefault);
if (dbv.type != DBVT_DELETED)
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
DWORD CDbLink::LoadInt()
{
switch (m_type) {
- case DBVT_BYTE: return DBGetContactSettingByte(NULL, m_szModule, m_szSetting, m_iDefault);
- case DBVT_WORD: return DBGetContactSettingWord(NULL, m_szModule, m_szSetting, m_iDefault);
- case DBVT_DWORD: return DBGetContactSettingDword(NULL, m_szModule, m_szSetting, m_iDefault);
+ case DBVT_BYTE: return db_get_b(NULL, m_szModule, m_szSetting, m_iDefault);
+ case DBVT_WORD: return db_get_w(NULL, m_szModule, m_szSetting, m_iDefault);
+ case DBVT_DWORD: return db_get_dw(NULL, m_szModule, m_szSetting, m_iDefault);
default: return m_iDefault;
}
}
@@ -1773,16 +1773,16 @@ DWORD CDbLink::LoadInt() void CDbLink::SaveInt(DWORD value)
{
switch (m_type) {
- case DBVT_BYTE: DBWriteContactSettingByte(NULL, m_szModule, m_szSetting, (BYTE)value); break;
- case DBVT_WORD: DBWriteContactSettingWord(NULL, m_szModule, m_szSetting, (WORD)value); break;
- case DBVT_DWORD: DBWriteContactSettingDword(NULL, m_szModule, m_szSetting, value); break;
+ case DBVT_BYTE: db_set_b(NULL, m_szModule, m_szSetting, (BYTE)value); break;
+ case DBVT_WORD: db_set_w(NULL, m_szModule, m_szSetting, (WORD)value); break;
+ case DBVT_DWORD: db_set_dw(NULL, m_szModule, m_szSetting, value); break;
}
}
TCHAR* CDbLink::LoadText()
{
- if (dbv.type != DBVT_DELETED) DBFreeVariant(&dbv);
- if (!DBGetContactSettingTString(NULL, m_szModule, m_szSetting, &dbv))
+ if (dbv.type != DBVT_DELETED) db_free(&dbv);
+ if (!db_get_ts(NULL, m_szModule, m_szSetting, &dbv))
{
if (dbv.type == DBVT_TCHAR)
return dbv.ptszVal;
@@ -1795,7 +1795,7 @@ TCHAR* CDbLink::LoadText() void CDbLink::SaveText(TCHAR *value)
{
- DBWriteContactSettingTString(NULL, m_szModule, m_szSetting, value);
+ db_set_ts(NULL, m_szModule, m_szSetting, value);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 35a23f3ca1..ef79488499 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -66,24 +66,24 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
if ( !p->ppro->getTString( p->hContact, "Default", &dbv)) {
SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else {
SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
if ( !p->ppro->getTString( p->hContact, "UWildcard", &dbv)) {
SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
if ( !p->ppro->getTString( p->hContact, "UUser", &dbv)) {
SetDlgItemText( m_hwnd, IDC_USER, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !p->ppro->getTString( p->hContact, "UHost", &dbv)) {
SetDlgItemText( m_hwnd, IDC_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
ProtoBroadcastAck(p->ppro->m_szModuleName, p->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
}
@@ -119,17 +119,17 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM S += _T(")");
if (( lstrlen(temp) < 4 && lstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
MessageBox( NULL, TranslateTS( S.c_str()), TranslateT( "IRC error" ), MB_OK | MB_ICONERROR );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return FALSE;
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
GetDlgItemText( m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
if ( lstrlen( GetWord(temp, 0).c_str()))
p->ppro->setTString( p->hContact, "UWildcard", GetWord(temp, 0).c_str());
else
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UWildcard");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UWildcard");
}
p->ppro->setByte( p->hContact, "AdvancedMode", bAdvanced);
@@ -138,13 +138,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM if (lstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString( p->hContact, "UUser", GetWord(temp, 0).c_str());
else
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UUser");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UUser");
GetDlgItemText( m_hwnd, IDC_HOST, temp, SIZEOF(temp));
if (lstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString( p->hContact, "UHost", GetWord(temp, 0).c_str());
else
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UHost");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UHost");
EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON), FALSE);
}
@@ -154,9 +154,9 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM SetDlgItemTextA( m_hwnd, IDC_WILDCARD, "");
SetDlgItemTextA( m_hwnd, IDC_HOST, "" );
SetDlgItemTextA( m_hwnd, IDC_USER, "" );
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UWildcard");
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UUser");
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UHost");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UWildcard");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UUser");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UHost");
EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON), FALSE );
EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON2), FALSE );
}
@@ -167,7 +167,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM DBVARIANT dbv;
if ( !p->ppro->getTString( p->hContact, "Default", &dbv )) {
SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
EnableWindow(GetDlgItem( m_hwnd, IDC_WILDCARD), FALSE );
}
@@ -177,7 +177,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
if ( !p->ppro->getTString( p->hContact, "UWildcard", &dbv )) {
SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
EnableWindow(GetDlgItem( m_hwnd, IDC_WILDCARD), true);
}
@@ -202,10 +202,10 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
if ( !getTString( hContact, "Default", &dbv )) {
if ( IsChannel( dbv.ptszVal )) {
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
OPTIONSDIALOGPAGE odp = { 0 };
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index c20ceebc1c..354f8aec0e 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -220,7 +220,7 @@ void CNickDlg::OnInitDialog() if ( !GetWord( dbv.ptszVal, i).IsEmpty())
SendDlgItemMessage( m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)GetWord(dbv.ptszVal, i).c_str());
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
void CNickDlg::OnDestroy()
@@ -243,7 +243,7 @@ void CNickDlg::OnOk( CCtrlButton* ) if ( !s.IsEmpty() && s != szTemp)
S += _T(" ") + s;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
m_proto->setTString( "RecentNicks", S.c_str());
}
@@ -517,7 +517,7 @@ void CJoinDlg::OnInitDialog() ReplaceString( S, _T("%newl"), _T(" "));
SendDlgItemMessage( m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)S.c_str());
} }
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
void CJoinDlg::OnDestroy()
@@ -546,7 +546,7 @@ void CJoinDlg::OnOk( CCtrlButton* ) if ( !W.IsEmpty() && W != SL)
S += _T(" ") + W;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
m_proto->setTString("RecentChannels", S.c_str());
}
@@ -582,19 +582,19 @@ void CQuickDlg::OnInitDialog() DBVARIANT dbv;
if ( !m_proto->getString( "ServerName", &dbv )) {
m_si->m_address = mir_strdup( dbv.pszVal );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else m_si->m_address = mir_strdup( Translate("Type new server address here"));
if ( !m_proto->getString( "PortStart", &dbv )) {
m_si->m_portStart = atoi( dbv.pszVal );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else m_si->m_portStart = 6667;
if ( !m_proto->getString( "PortEnd", &dbv )) {
m_si->m_portEnd = atoi( dbv.pszVal );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else m_si->m_portEnd = 6667;
@@ -1287,7 +1287,7 @@ void CManagerDlg::InitManager( int mode, const TCHAR* window ) #endif
m_topic.SendMsg( CB_ADDSTRING, 0, (LPARAM)S.c_str());
} }
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
mir_free(p);
}
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 2f795f0872..0ef10c220d 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -155,7 +155,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) if (m_options.BsProxyManual) {
proxyJid = NULL;
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "BsProxyServer", &dbv)) {
+ if ( !db_get_s(NULL, m_szModuleName, "BsProxyServer", &dbv)) {
proxyJid = mir_a2t(dbv.pszVal);
db_free(&dbv);
}
@@ -199,7 +199,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) if (bDirect) {
if (m_options.BsDirectManual) {
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "BsDirectAddr", &dbv))
+ if ( !db_get_s(NULL, m_szModuleName, "BsDirectAddr", &dbv))
localAddr = dbv.pszVal;
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 4182cccb23..36a4dbcf40 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -145,7 +145,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM* item) DBVARIANT dbv;
if (JABBER_LIST_ITEM* bookmark = ListGetItemPtr(LIST_BOOKMARK, item->jid))
if (bookmark->name) {
- if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbv))
+ if ( !db_get_ts(hContact, "CList", "MyHandle", &dbv))
db_free(&dbv);
else
db_set_ts(hContact, "CList", "MyHandle", bookmark->name);
@@ -380,7 +380,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM* item, int code, HXML reason) CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, (LPARAM)&gce);
DBVARIANT dbvMessage;
- if ( !DBGetContactSettingTString(NULL, m_szModuleName, "GcMsgQuit", &dbvMessage)) {
+ if ( !db_get_ts(NULL, m_szModuleName, "GcMsgQuit", &dbvMessage)) {
szMessage = NEWTSTR_ALLOCA(dbvMessage.ptszVal);
db_free(&dbvMessage);
}
@@ -1079,7 +1079,7 @@ static void sttNickListHook(CJabberProto* ppro, JABBER_LIST_ITEM* item, GCHOOK* {
if (ppro->m_bJabberOnline) {
DBVARIANT dbv = {0};
- TCHAR *szMessage = DBGetContactSettingTString(NULL, ppro->m_szModuleName, "GcMsgSlap", &dbv) ?
+ TCHAR *szMessage = db_get_ts(NULL, ppro->m_szModuleName, "GcMsgSlap", &dbv) ?
NEWTSTR_ALLOCA(TranslateTS(JABBER_GC_MSG_SLAP)) : dbv.ptszVal;
TCHAR buf[256];
diff --git a/protocols/JabberG/src/jabber_db_utils.h b/protocols/JabberG/src/jabber_db_utils.h index d5a74d22b0..9695fe2380 100644 --- a/protocols/JabberG/src/jabber_db_utils.h +++ b/protocols/JabberG/src/jabber_db_utils.h @@ -143,7 +143,7 @@ public: {
CMString result;
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, m_proto->m_szModuleName, m_szSetting, &dbv))
+ if ( !db_get_ts(NULL, m_proto->m_szModuleName, m_szSetting, &dbv))
{
result = dbv.ptszVal;
db_free(&dbv);
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 4baa572ed0..cfd0bdc946 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -96,7 +96,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hCon return;
TCHAR* nick;
- if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "MyHandle", &dbv)) {
nick = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -164,7 +164,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING* cws, HANDL TCHAR *nick;
Log("Add %S permanently to list", jid.pszVal);
- if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "MyHandle", &dbv)) {
nick = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -178,7 +178,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING* cws, HANDL return;
}
- if ( !DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "Group", &dbv)) {
AddContactToRoster(jid.ptszVal, nick, dbv.ptszVal);
db_free(&dbv);
}
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 3a0c5cdb06..3ade62cdd2 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -307,7 +307,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) char *myAddr = NULL;
DBVARIANT dbv;
if (m_options.BsDirect && m_options.BsDirectManual) {
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "BsDirectAddr", &dbv))
+ if ( !db_get_s(NULL, m_szModuleName, "BsDirectAddr", &dbv))
myAddr = dbv.pszVal;
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 56f181e658..9d3bb562cf 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -503,7 +503,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) // Don't set group again if already correct, or Miranda may show wrong group count in some case
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "Group", &dbv)) {
if (lstrcmp(dbv.ptszVal, item->group))
db_set_ts(hContact, "CList", "Group", item->group);
db_free(&dbv);
@@ -1116,7 +1116,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) else {
char text[ 100 ];
sprintf(text, "e-mail%d", nEmail-1);
- if ( DBGetContactSettingString(hContact, m_szModuleName, text, &dbv)) break;
+ if ( db_get_s(hContact, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
JDeleteSetting(hContact, text);
}
@@ -1127,7 +1127,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) while (true) {
char text[ 100 ];
sprintf(text, "e-mail%d", nEmail);
- if ( DBGetContactSettingString(NULL, m_szModuleName, text, &dbv)) break;
+ if ( db_get_s(NULL, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
JDeleteSetting(NULL, text);
sprintf(text, "e-mailFlag%d", nEmail);
@@ -1160,7 +1160,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) while (true) {
char text[ 100 ];
sprintf(text, "Phone%d", nPhone);
- if ( DBGetContactSettingString(NULL, m_szModuleName, text, &dbv)) break;
+ if ( db_get_s(NULL, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
JDeleteSetting(NULL, text);
sprintf(text, "PhoneFlag%d", nPhone);
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index f6f404c4e0..c0348c53a3 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -518,7 +518,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM) if (ListGetItemPtr(LIST_ROSTER, roomID) == NULL) {
TCHAR *nick = 0;
TCHAR *group = 0;
- if ( !DBGetContactSettingTString((HANDLE)wParam, "CList", "Group", &dbv)) {
+ if ( !db_get_ts((HANDLE)wParam, "CList", "Group", &dbv)) {
group = NEWTSTR_ALLOCA(dbv.ptszVal);
db_free(&dbv);
}
@@ -1065,10 +1065,10 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) DBVARIANT dbv;
BOOL bSupportTyping = FALSE;
- if ( !DBGetContactSetting(event->hContact, "SRMsg", "SupportTyping", &dbv)) {
+ if ( !db_get(event->hContact, "SRMsg", "SupportTyping", &dbv)) {
bSupportTyping = dbv.bVal == 1;
db_free(&dbv);
- } else if ( !DBGetContactSetting(NULL, "SRMsg", "DefaultTyping", &dbv)) {
+ } else if ( !db_get(NULL, "SRMsg", "DefaultTyping", &dbv)) {
bSupportTyping = dbv.bVal == 1;
db_free(&dbv);
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index da614d2e33..9e42b13f53 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -75,7 +75,7 @@ static void JabberContactListCreateClistGroup(TCHAR* groupName) for (i=0;;i++) {
_itoa(i, str, 10);
- if ( DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
+ if ( db_get_ts(NULL, "CListGroups", str, &dbv))
break;
TCHAR* name = dbv.ptszVal;
if (name[0]!='\0' && !_tcscmp(name+1, groupName)) {
@@ -299,8 +299,8 @@ void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbL }
else {
DBVARIANT dbv1, dbv2;
- BOOL res1 = DBGetContactSettingString(NULL, m_szModuleName, "LoginName", &dbv1);
- BOOL res2 = DBGetContactSettingString(NULL, m_szModuleName, "LoginServer", &dbv2);
+ BOOL res1 = db_get_s(NULL, m_szModuleName, "LoginName", &dbv1);
+ BOOL res2 = db_get_s(NULL, m_szModuleName, "LoginServer", &dbv2);
mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%S@%S avatar.%S"),
res1 ? "noname" : dbv1.pszVal,
res2 ? m_szModuleName : dbv2.pszVal,
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 64c09c4966..614baef47f 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -470,7 +470,7 @@ protected: if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
- if ( !DBGetContactSettingTString(NULL, m_proto->m_szModuleName, "Resource", &dbv))
+ if ( !db_get_ts(NULL, m_proto->m_szModuleName, "Resource", &dbv))
{
if (CB_ERR == m_cbResource.FindString(dbv.ptszVal, -1, true))
m_cbResource.AddString(dbv.ptszVal);
@@ -1079,11 +1079,11 @@ void CJabberProto::_RosterHandleGetRequest(HXML node) TCHAR *name = NULL;
TCHAR *group = NULL;
DBVARIANT dbvtemp;
- if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbvtemp)) {
+ if ( !db_get_ts(hContact, "CList", "MyHandle", &dbvtemp)) {
name = mir_tstrdup(dbvtemp.ptszVal);
db_free(&dbvtemp);
}
- if ( !DBGetContactSettingTString(hContact, "CList", "Group", &dbvtemp)) {
+ if ( !db_get_ts(hContact, "CList", "Group", &dbvtemp)) {
group = mir_tstrdup(dbvtemp.ptszVal);
db_free(&dbvtemp);
}
@@ -1702,7 +1702,7 @@ protected: if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
- if ( !DBGetContactSettingTString(NULL, m_proto->m_szModuleName, "Resource", &dbv))
+ if ( !db_get_ts(NULL, m_proto->m_szModuleName, "Resource", &dbv))
{
if (CB_ERR == m_cbResource.FindString(dbv.ptszVal, -1, true))
m_cbResource.AddString(dbv.ptszVal);
@@ -1725,7 +1725,7 @@ protected: m_cbType.AddString(TranslateT("S.ms"), ACC_SMS);
m_cbServer.GetTextA(server, SIZEOF(server));
- if ( !DBGetContactSettingString(NULL, m_proto->m_szModuleName, "ManualHost", &dbv))
+ if ( !db_get_s(NULL, m_proto->m_szModuleName, "ManualHost", &dbv))
{
lstrcpynA(manualServer, dbv.pszVal, SIZEOF(manualServer));
db_free(&dbv);
@@ -1780,7 +1780,7 @@ protected: m_txtManualHost.Enable();
m_txtPort.Enable();
- if ( !DBGetContactSettingTString(NULL, m_proto->m_szModuleName, "ManualHost", &dbv))
+ if ( !db_get_ts(NULL, m_proto->m_szModuleName, "ManualHost", &dbv))
{
m_txtManualHost.SetText(dbv.ptszVal);
db_free(&dbv);
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 4581325496..04289ee5d8 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -480,7 +480,7 @@ public: for (int i = 0; ; i++)
{
mir_snprintf(buf, 20, "%d", i);
- if ( DBGetContactSettingTString(NULL, "CListGroups", buf, &dbv))
+ if ( db_get_ts(NULL, "CListGroups", buf, &dbv))
break;
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, (LPARAM)&dbv.ptszVal[1]);
@@ -1382,7 +1382,7 @@ bool CJabberDlgPrivacyLists::CListIsGroup(HANDLE hGroup) _i64toa((INT_PTR)hGroup-1, idstr, 10);
DBVARIANT dbv;
- bool result = DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv) == 0;
+ bool result = db_get_ts(NULL, "CListGroups", idstr, &dbv) == 0;
if (result)
db_free(&dbv);
@@ -1400,7 +1400,7 @@ HANDLE CJabberDlgPrivacyLists::CListFindGroupByName(TCHAR *name) {
_itoa(i, idstr, 10);
- if ( DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if ( db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
if ( !_tcscmp(dbv.ptszVal + 1, name))
@@ -1607,7 +1607,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) char idstr[33];
_itoa(iGroup-1, idstr, 10);
DBVARIANT dbv = {0};
- if ( DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if ( db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
hItem = m_clcClist.FindGroup((HANDLE)iGroup);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index b4083314e9..4986c7f401 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -195,7 +195,7 @@ CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) : }
else m_tszSelectedLang = mir_tstrdup(_T("en"));
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "Password", &dbv)) {
+ if ( !db_get_s(NULL, m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, lstrlenA(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
TCHAR *pssw = mir_a2t(dbv.pszVal);
JSetStringCrypt(NULL, "LoginPassword", pssw);
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp index 9d4ae894fd..373c0681f7 100644 --- a/protocols/JabberG/src/jabber_std.cpp +++ b/protocols/JabberG/src/jabber_std.cpp @@ -110,12 +110,12 @@ int CJabberProto::JGetStaticString(const char* valueName, HANDLE hContact, char* int CJabberProto::JGetStringUtf(HANDLE hContact, char* valueName, DBVARIANT* dbv)
{
- return DBGetContactSettingStringUtf(hContact, m_szModuleName, valueName, dbv);
+ return db_get_utf(hContact, m_szModuleName, valueName, dbv);
}
int CJabberProto::JGetStringT(HANDLE hContact, char* valueName, DBVARIANT* dbv)
{
- return DBGetContactSettingTString(hContact, m_szModuleName, valueName, dbv);
+ return db_get_ts(hContact, m_szModuleName, valueName, dbv);
}
TCHAR *CJabberProto::JGetStringT(HANDLE hContact, char* valueName)
@@ -214,7 +214,7 @@ void __forceinline sttCryptString(char *str) TCHAR* CJabberProto::JGetStringCrypt(HANDLE hContact, char *valueName)
{
DBVARIANT dbv;
- if ( DBGetContactSettingString(hContact, m_szModuleName, valueName, &dbv))
+ if ( db_get_s(hContact, m_szModuleName, valueName, &dbv))
return NULL;
sttCryptString(dbv.pszVal);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index e38dbf1c67..3660fbce04 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -259,7 +259,7 @@ void CJabberProto::ServerThread(ThreadData* info) info->auth = NULL;
if (m_options.ManualConnect == TRUE) {
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "ManualHost", &dbv)) {
+ if ( !db_get_s(NULL, m_szModuleName, "ManualHost", &dbv)) {
strncpy(info->manualHost, dbv.pszVal, SIZEOF(info->manualHost));
info->manualHost[SIZEOF(info->manualHost)-1] = '\0';
db_free(&dbv);
@@ -315,7 +315,7 @@ LBL_FatalError: goto LBL_Exit;
}
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "LoginServer", &dbv)) {
+ if ( !db_get_s(NULL, m_szModuleName, "LoginServer", &dbv)) {
strncpy(info->server, dbv.pszVal, SIZEOF(info->server)-1);
db_free(&dbv);
}
@@ -923,7 +923,7 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData* info) }
Log("Success: Logged-in.");
- if ( DBGetContactSettingString(NULL, m_szModuleName, "Nick", &dbv))
+ if ( db_get_s(NULL, m_szModuleName, "Nick", &dbv))
JSetStringT(NULL, "Nick", info->username);
else
db_free(&dbv);
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index ed7adff6f9..fd036db767 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -51,7 +51,7 @@ static void SetDialogField(CJabberProto* ppro, HWND hwndDlg, int nDlgItem, char* {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, ppro->m_szModuleName, key, &dbv)) {
+ if ( !db_get_ts(NULL, ppro->m_szModuleName, key, &dbv)) {
SetDlgItemText(hwndDlg, nDlgItem, (bTranslate) ? TranslateTS(dbv.ptszVal) : dbv.ptszVal);
db_free(&dbv);
}
@@ -566,7 +566,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowText(hwndDlg, TranslateT("Jabber vCard: Edit Email Address"));
wsprintfA(idstr, "e-mail%d", dat->id);
- if ( !DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) {
+ if ( !db_get_s(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
db_free(&dbv);
wsprintfA(idstr, "e-mailFlag%d", lParam);
@@ -590,7 +590,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (dat->id < 0) {
for (dat->id=0;;dat->id++) {
mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", dat->id);
- if ( DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_s(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
db_free(&dbv);
} }
GetDlgItemText(hwndDlg, IDC_EMAIL, text, SIZEOF(text));
@@ -632,7 +632,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowText(hwndDlg, TranslateT("Jabber vCard: Edit Phone Number"));
wsprintfA(idstr, "Phone%d", dat->id);
- if ( !DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) {
+ if ( !db_get_s(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_PHONE, dbv.pszVal);
db_free(&dbv);
wsprintfA(idstr, "PhoneFlag%d", dat->id);
@@ -664,7 +664,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (dat->id < 0) {
for (dat->id=0;;dat->id++) {
wsprintfA(idstr, "Phone%d", dat->id);
- if ( DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_s(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
db_free(&dbv);
}
}
@@ -747,7 +747,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0;
for (i=0;;i++) {
wsprintfA(idstr, "e-mail%d", i);
- if ( DBGetContactSettingTString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_ts(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
wsprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
@@ -766,7 +766,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0;
for (i=0;;i++) {
wsprintfA(idstr, "Phone%d", i);
- if ( DBGetContactSettingTString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_ts(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
wsprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
@@ -873,7 +873,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP WORD nFlag;
wsprintfA(idstr, szIdTemplate, i+1);
- if ( DBGetContactSettingString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_s(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
wsprintfA(idstr,szIdTemplate,i);
ppro->JSetString(NULL, idstr, dbv.pszVal);
wsprintfA(idstr, szFlagTemplate, i+1);
@@ -1021,7 +1021,7 @@ void CJabberProto::AppendVcardFromDB(HXML n, char* tag, char* key) return;
DBVARIANT dbv;
- if ( DBGetContactSettingTString(NULL, m_szModuleName, key, &dbv))
+ if ( db_get_ts(NULL, m_szModuleName, key, &dbv))
n << XCHILD(_A2T(tag));
else {
n << XCHILD(_A2T(tag), dbv.ptszVal);
@@ -1058,7 +1058,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) for (i=0;;i++) {
wsprintfA(idstr, "e-mail%d", i);
- if ( DBGetContactSettingTString(NULL, m_szModuleName, idstr, &dbv))
+ if ( db_get_ts(NULL, m_szModuleName, idstr, &dbv))
break;
HXML e = v << XCHILD(_T("EMAIL"), dbv.ptszVal);
@@ -1106,7 +1106,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) for (i=0;;i++) {
wsprintfA(idstr, "Phone%d", i);
- if ( DBGetContactSettingTString(NULL, m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_ts(NULL, m_szModuleName, idstr, &dbv)) break;
db_free(&dbv);
n = v << XCHILD(_T("TEL"));
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 5427401826..306527b920 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -1513,7 +1513,7 @@ char *CJabberProto::ReadAdvStatusA(HANDLE hContact, const char *pszSlot, const c mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", m_szModuleName, pszSlot, pszValue);
DBVARIANT dbv;
- if ( DBGetContactSettingString(hContact, "AdvStatus", szSetting, &dbv))
+ if ( db_get_s(hContact, "AdvStatus", szSetting, &dbv))
return NULL;
char *res = mir_strdup(dbv.pszVal);
@@ -1527,7 +1527,7 @@ TCHAR *CJabberProto::ReadAdvStatusT(HANDLE hContact, const char *pszSlot, const mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", m_szModuleName, pszSlot, pszValue);
DBVARIANT dbv;
- if ( DBGetContactSettingTString(hContact, "AdvStatus", szSetting, &dbv))
+ if ( db_get_ts(hContact, "AdvStatus", szSetting, &dbv))
return NULL;
TCHAR *res = mir_tstrdup(dbv.ptszVal);
diff --git a/protocols/JabberG/src/ui_utils.cpp b/protocols/JabberG/src/ui_utils.cpp index 584c3cf081..2e51880d81 100644 --- a/protocols/JabberG/src/ui_utils.cpp +++ b/protocols/JabberG/src/ui_utils.cpp @@ -2431,7 +2431,7 @@ void CDbLink::SaveInt(DWORD value) TCHAR* CDbLink::LoadText()
{
if (dbv.type != DBVT_DELETED) db_free(&dbv);
- if ( !DBGetContactSettingTString(NULL, m_szModule, m_szSetting, &dbv))
+ if ( !db_get_ts(NULL, m_szModule, m_szSetting, &dbv))
{
if (dbv.type == DBVT_TCHAR)
return dbv.ptszVal;
diff --git a/protocols/MRA/src/MraAntiSpam.cpp b/protocols/MRA/src/MraAntiSpam.cpp index 8b60ade855..0650dfe833 100644 --- a/protocols/MRA/src/MraAntiSpam.cpp +++ b/protocols/MRA/src/MraAntiSpam.cpp @@ -52,7 +52,7 @@ size_t MraAntiSpamLoadBadWordsW() CharLowerBuffW(pmabwBadWords[i].lpwszBadWord, DWORD(dwValueSize));
pmabwBadWords[i].dwBadWordLen = DWORD(dwValueSize);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (pmabwBadWords[i].lpwszBadWord == NULL)
break;
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index a4612ab56d..9ca0b135e5 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -94,7 +94,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) InterlockedExchange((volatile LONG*)&pmraaqAvatarsQueue->bIsRunning, TRUE);
pmraaqAvatarsQueue->hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- pmraaqAvatarsQueue->iThreadsCount = DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "WorkThreadsCount", MRA_AVT_DEFAULT_WRK_THREAD_COUNTS);
+ pmraaqAvatarsQueue->iThreadsCount = db_get_dw(NULL, MRA_AVT_SECT_NAME, "WorkThreadsCount", MRA_AVT_DEFAULT_WRK_THREAD_COUNTS);
if (pmraaqAvatarsQueue->iThreadsCount == 0)
pmraaqAvatarsQueue->iThreadsCount = 1;
if (pmraaqAvatarsQueue->iThreadsCount > MAXIMUM_WAIT_OBJECTS)
@@ -207,7 +207,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) bDefaultAvt = FALSE;
if (DB_GetStaticStringA(NULL, MRA_AVT_SECT_NAME, "Server", szServer, SIZEOF(szServer), NULL) == FALSE) memmove(szServer, MRA_AVT_DEFAULT_SERVER, sizeof(MRA_AVT_DEFAULT_SERVER));
- dwServerPort = DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT);
+ dwServerPort = db_get_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT);
bUseKeepAliveConn = db_get_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", MRA_AVT_DEFAULT_USE_KEEPALIVE_CONN);
if ( mraGetStaticStringA(pmraaqiAvatarsQueueItem->hContact, "e-mail", szEMail, SIZEOF(szEMail), &dwEMailSize)) {
@@ -288,7 +288,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwWritten = 0;
bContinue = TRUE;
- nls.dwTimeout = (1000*DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "TimeOutReceive", MRA_AVT_DEFAULT_TIMEOUT_RECV));
+ nls.dwTimeout = (1000*db_get_dw(NULL, MRA_AVT_SECT_NAME, "TimeOutReceive", MRA_AVT_DEFAULT_TIMEOUT_RECV));
nls.hReadConns[0] = hConnection;
while ( bContinue ) {
@@ -381,11 +381,11 @@ HANDLE MraAvatarsHttpConnect(HANDLE hNetlibUser, LPSTR lpszHost, DWORD dwPort) nloc.flags = (NLOCF_HTTP|NLOCF_V2);
nloc.szHost = lpszHost;
nloc.wPort = ( IsHTTPSProxyUsed(hNetlibUser)) ? MRA_SERVER_PORT_HTTPS : dwPort;
- nloc.timeout = DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "TimeOutConnect", MRA_AVT_DEFAULT_TIMEOUT_CONN);
+ nloc.timeout = db_get_dw(NULL, MRA_AVT_SECT_NAME, "TimeOutConnect", MRA_AVT_DEFAULT_TIMEOUT_CONN);
if (nloc.timeout<MRA_TIMEOUT_CONN_MIN) nloc.timeout = MRA_TIMEOUT_CONN_MIN;
if (nloc.timeout>MRA_TIMEOUT_CONN_ÌÀÕ) nloc.timeout = MRA_TIMEOUT_CONN_ÌÀÕ;
- DWORD dwConnectReTryCount = DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "ConnectReTryCount", MRA_AVT_DEFAULT_CONN_RETRY_COUNT);
+ DWORD dwConnectReTryCount = db_get_dw(NULL, MRA_AVT_SECT_NAME, "ConnectReTryCount", MRA_AVT_DEFAULT_CONN_RETRY_COUNT);
DWORD dwCurConnectReTryCount = dwConnectReTryCount;
HANDLE hConnection;
do {
@@ -602,7 +602,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFl GetSystemTimeAsFileTime(&ftCurrentTime);
SystemTimeToFileTime(&stAvatarLastCheckTime, &ftExpireTime);
- (*((DWORDLONG*)&ftExpireTime)) += (FILETIME_MINUTE*(DWORDLONG)DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL));
+ (*((DWORDLONG*)&ftExpireTime)) += (FILETIME_MINUTE*(DWORDLONG)db_get_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL));
if ((*((DWORDLONG*)&ftExpireTime))>(*((DWORDLONG*)&ftCurrentTime)))
if ( MraAvatarsGetFileName(hAvatarsQueueHandle, hContact, GetContactAvatarFormat(hContact, PA_FORMAT_DEFAULT), wszFileName, SIZEOF(wszFileName), &dwPathSize) == NO_ERROR)
@@ -679,9 +679,9 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara else
SET_DLG_ITEM_TEXTA(hWndDlg, IDC_SERVER, MRA_AVT_DEFAULT_SERVER);
- SetDlgItemInt(hWndDlg, IDC_SERVERPORT, DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT), FALSE);
+ SetDlgItemInt(hWndDlg, IDC_SERVERPORT, db_get_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT), FALSE);
CHECK_DLG_BUTTON(hWndDlg, IDC_USE_KEEPALIVE_CONN, db_get_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", MRA_AVT_DEFAULT_USE_KEEPALIVE_CONN));
- SetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL), FALSE);
+ SetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, db_get_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL), FALSE);
CHECK_DLG_BUTTON(hWndDlg, IDC_RETURN_ABC_PATH, db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH));
CHECK_DLG_BUTTON(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE, db_get_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", MRA_DELETE_AVT_ON_CONTACT_DELETE));
@@ -708,12 +708,12 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara {
WCHAR szServer[MAX_PATH];
- DBWriteContactSettingByte(NULL, MRA_AVT_SECT_NAME, "Enable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ENABLE));
- DBWriteContactSettingByte(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE));
- DBWriteContactSettingByte(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_RETURN_ABC_PATH));
- DBWriteContactSettingDword(NULL, MRA_AVT_SECT_NAME, "CheckInterval", GetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, NULL, FALSE));
- DBWriteContactSettingByte(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_USE_KEEPALIVE_CONN));
- DBWriteContactSettingDword(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
+ db_set_b(NULL, MRA_AVT_SECT_NAME, "Enable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ENABLE));
+ db_set_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE));
+ db_set_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_RETURN_ABC_PATH));
+ db_set_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", GetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, NULL, FALSE));
+ db_set_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_USE_KEEPALIVE_CONN));
+ db_set_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
GET_DLG_ITEM_TEXT(hWndDlg, IDC_SERVER, szServer, SIZEOF(szServer));
db_set_ws(NULL, MRA_AVT_SECT_NAME, "Server", szServer);
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 7eb0edc10b..1d052f8029 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -278,7 +278,7 @@ void CMraProto::MraChatSendPrivateMessage(LPWSTR lpwszEMail) BOOL bAdded;
HANDLE hContact = MraHContactFromEmail(szEMail, dwEMailSize, TRUE, TRUE, &bAdded);
if (bAdded)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, IGNOREEVENT_ALL);
CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index df74806fc0..2165803c22 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -152,7 +152,7 @@ void CMraProto::InitContactMenu() CListCreateMenu(2000060000, -500050000, NULL, NULL, FALSE, gdiContactMenuItems, SIZEOF(gdiContactMenuItems), hContactMenuItems);
}
-void CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsMain, const GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HANDLE *hResult)
+void CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsMain, const GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HGENMENU *hResult)
{
if (!pgdiItems || !dwCount || !hResult)
return;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index e28eded3af..bc36693813 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -204,9 +204,9 @@ HANDLE CMraProto::AddToListByEmail(LPCTSTR plpsEMail, LPCTSTR plpsNick, LPCTSTR mraSetStringW(hContact, "LastName", plpsLastName);
if (dwFlags & PALF_TEMPORARY)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
else
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
if (bAdded)
MraUpdateContactInfo(hContact);
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index e98a02f0fe..9af64edb8c 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -127,7 +127,7 @@ struct CMraProto : public PROTO_INTERFACE __forceinline BOOL mraSetStringA(HANDLE Contact, const char *valueName, const char *parValue) {
return DB_SetStringExA(Contact, m_szModuleName, valueName, parValue, lstrlenA(parValue)); }
__forceinline BOOL mraSetStringW(HANDLE Contact, const char *valueName, const WCHAR *parValue) {
- return DBWriteContactSettingWString(Contact, m_szModuleName, valueName, parValue); }
+ return db_set_ws(Contact, m_szModuleName, valueName, parValue); }
__forceinline BOOL mraSetLPSStringA(HANDLE Contact, const char *valueName, MRA_LPS *parValue) {
return DB_SetStringExA(Contact, m_szModuleName, valueName, parValue->lpszData, parValue->dwSize); }
@@ -210,16 +210,16 @@ struct CMraProto : public PROTO_INTERFACE HANDLE hAvatarsQueueHandle;
- HANDLE hMainMenuItems[MAIN_MENU_ITEMS_COUNT+4];
- HANDLE hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+4];
+ HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT+4];
+ HGENMENU hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+4];
- HWND hWndEMailPopupStatus;
- DWORD dwEmailMessagesTotal, dwEmailMessagesUnread;
+ HWND hWndEMailPopupStatus;
+ DWORD dwEmailMessagesTotal, dwEmailMessagesUnread;
- BOOL bHideXStatusUI;
- HANDLE hXStatusMenuItems[MRA_XSTATUS_COUNT+4];
- HANDLE hExtraXstatusIcon;
- HANDLE hExtraInfo;
+ BOOL bHideXStatusUI;
+ HGENMENU hXStatusMenuItems[MRA_XSTATUS_COUNT+4];
+ HANDLE hExtraXstatusIcon;
+ HANDLE hExtraInfo;
char szNewMailSound[MAX_PATH];
@@ -299,8 +299,7 @@ struct CMraProto : public PROTO_INTERFACE void InitMainMenu();
void InitContactMenu();
- void CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsStatus, const struct GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HANDLE *hResult);
- void CListShowMenuItem(HANDLE hMenuItem, BOOL bShow);
+ void CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsStatus, const struct GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HGENMENU *hResult);
DWORD ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam, size_t paramSize = 0);
DWORD CreateBlobFromContact(HANDLE hContact, LPWSTR lpwszRequestReason, size_t dwRequestReasonSize, LPBYTE lpbBuff, size_t dwBuffSize, size_t *pdwBuffSizeRet);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 7d645b10c8..5d07eab6cc 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -234,7 +234,7 @@ BOOL DB_GetStaticStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam }
if (pdwRetBuffSize) (*pdwRetBuffSize) = dwRetBuffSizeLocal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}else {
if (lpszRetBuff && dwRetBuffSize >= sizeof(WORD)) (*((WORD*)lpszRetBuff)) = 0;
if (pdwRetBuffSize) (*pdwRetBuffSize) = 0;
@@ -267,7 +267,7 @@ BOOL DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam }
if (pdwRetBuffSize) (*pdwRetBuffSize) = dwReadedStringLen;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}else {
if (lpwszRetBuff && dwRetBuffSize >= sizeof(WCHAR)) (*((WCHAR*)lpwszRetBuff)) = 0;
if (pdwRetBuffSize) (*pdwRetBuffSize) = 0;
@@ -303,7 +303,7 @@ BOOL DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L }
else {
bRet = TRUE;
- DBDeleteContactSetting(hContact, lpszModule, lpszValueName);
+ db_unset(hContact, lpszModule, lpszValueName);
}
return bRet;
}
@@ -330,7 +330,7 @@ BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L }
else {
bRet = TRUE;
- DBDeleteContactSetting(hContact, lpszModule, lpszValueName);
+ db_unset(hContact, lpszModule, lpszValueName);
}
return bRet;
}
@@ -367,7 +367,7 @@ BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszVal }
if (pdwRetBuffSize) (*pdwRetBuffSize) = dbv.cpbVal;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
if (pdwRetBuffSize) (*pdwRetBuffSize) = 0;
@@ -421,9 +421,9 @@ DWORD CMraProto::SetContactFlags(HANDLE hContact, DWORD dwContactFlag) mraSetDword(hContact, "ContactFlags", dwContactFlag);
if (dwContactFlag&CONTACT_FLAG_SHADOW)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
else
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
switch (dwContactFlag&(CONTACT_FLAG_INVISIBLE|CONTACT_FLAG_VISIBLE)) {
case CONTACT_FLAG_INVISIBLE:
@@ -577,7 +577,7 @@ HANDLE CMraProto::MraHContactFromEmail(LPSTR lpszEMail, size_t dwEMailSize, BOOL if (mraGetStaticStringA(hContact, "e-mail", szEMailLocal, SIZEOF(szEMailLocal), &dwEMailLocalSize))
if (CompareStringA( MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, szEMailLocal, dwEMailLocalSize, lpszEMail, dwEMailSize) == CSTR_EQUAL)
{
- if (bTemporary == FALSE) DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ if (bTemporary == FALSE) db_unset(hContact, "CList", "NotOnList");
bFound = TRUE;
break;
}
@@ -623,7 +623,7 @@ HANDLE CMraProto::MraHContactFromEmail(LPSTR lpszEMail, size_t dwEMailSize, BOOL SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS|SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_ONLINE, lpszEMail, dwEMailSize, NULL, 0, NULL, 0);
else {
if (bTemporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
mraSetStringExA(hContact, "MirVer", MIRVER_UNKNOWN, (sizeof(MIRVER_UNKNOWN)-1));
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS|SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_OFFLINE, lpszEMail, dwEMailSize, NULL, 0, NULL, 0);
}
@@ -1144,16 +1144,6 @@ DWORD CMraProto::CreateBlobFromContact(HANDLE hContact, LPWSTR lpwszRequestReaso return dwRetErrorCode;
}
-void CMraProto::CListShowMenuItem(HANDLE hMenuItem, BOOL bShow)
-{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
- if (bShow == FALSE)
- mi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi);
-}
-
size_t CopyNumber(LPCVOID lpcOutBuff, LPCVOID lpcBuff, size_t dwLen)
{
BYTE btChar;
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 162dd9686c..e927d2dd0f 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -676,7 +676,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd dwTemp &= ~CONTACT_INTFLAG_NOT_AUTHORIZED;
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, SCBIF_SERVER_FLAG, 0, 0, 0, dwTemp, 0, NULL, 0, NULL, 0, NULL, 0);
mraSetDword(hContact, "HooksLocked", TRUE);
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
mraSetDword(hContact, "HooksLocked", FALSE);
}
break;
@@ -1520,8 +1520,8 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd if (GetContactBasicInfoW(hContact, &dwID, NULL, NULL, NULL, NULL, szEMail, SIZEOF(szEMail), &dwEMailSize, NULL, 0, NULL, NULL, 0, NULL) == NO_ERROR)
if (dwID == -1) {
if (IsEMailChatAgent(szEMail, dwEMailSize)) {// ÷àò: åù¸ ðàç çàïðîñèì àâòîðèçàöèþ, ïîìåòèì êàê âèäèìûé â ñïèñêå, ïîñòîÿííûé
- DBDeleteContactSetting(hContact, "CList", "Hidden");
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "NotOnList");
SetExtraIcons(hContact);
MraSetContactStatus(hContact, ID_STATUS_ONLINE);
@@ -1998,7 +1998,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl }
if (bAdded)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
if (bAutoGrantAuth) { // auto grant auth
DBEVENTINFO dbei = { sizeof(dbei) };
@@ -2018,7 +2018,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl }
}
else {
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
if (dwFlags & MESSAGE_FLAG_CONTACT) { // contacts received
LPBYTE lpbBuffer, lpbBufferCurPos;
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 9cbc06c9b3..4c5ebe50c0 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -529,7 +529,7 @@ int CMraProto::MraDbSettingChanged(WPARAM wParam, LPARAM lParam) dwAuthMessageSize = lstrlenW(wszAuthMessage);
}
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
GetContactBasicInfoW(hContact, NULL, &dwGroupID, &dwContactFlag, NULL, NULL, szEMail, SIZEOF(szEMail), &dwEMailSize, wszNick, SIZEOF(wszNick), &dwNickSize, szPhones, SIZEOF(szPhones), &dwPhonesSize);
MraAddContactW(hContact, dwContactFlag, dwGroupID, szEMail, dwEMailSize, wszNick, dwNickSize, szPhones, dwPhonesSize, wszAuthMessage, dwAuthMessageSize, 0);
}
@@ -604,34 +604,34 @@ int CMraProto::MraRebuildContactMenu(WPARAM wParam, LPARAM lParam) else bHasEMail = bHasEMailMR = bChatAgent = FALSE;
//"Request authorization"
- CListShowMenuItem(hContactMenuItems[0], (m_bLoggedIn && bIsContactMRA));// && (dwContactSeverFlags&CONTACT_INTFLAG_NOT_AUTHORIZED)
+ Menu_ShowItem(hContactMenuItems[0], (m_bLoggedIn && bIsContactMRA));// && (dwContactSeverFlags&CONTACT_INTFLAG_NOT_AUTHORIZED)
//"Grant authorization"
- CListShowMenuItem(hContactMenuItems[1], (m_bLoggedIn && bIsContactMRA && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[1], (m_bLoggedIn && bIsContactMRA && bChatAgent == FALSE));
//"&Send postcard"
- CListShowMenuItem(hContactMenuItems[2], (m_bLoggedIn && bHasEMail && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[2], (m_bLoggedIn && bHasEMail && bChatAgent == FALSE));
//"&View Album"
- CListShowMenuItem(hContactMenuItems[3], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[3], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"&Read Blog"
- CListShowMenuItem(hContactMenuItems[4], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[4], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"Reply Blog Status"
- CListShowMenuItem(hContactMenuItems[5], (m_bLoggedIn && dwBlogStatusMsgSize && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[5], (m_bLoggedIn && dwBlogStatusMsgSize && bChatAgent == FALSE));
//"View Video"
- CListShowMenuItem(hContactMenuItems[6], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[6], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"Answers"
- CListShowMenuItem(hContactMenuItems[7], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[7], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"World"
- CListShowMenuItem(hContactMenuItems[8], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[8], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"Send &Nudge"
- CListShowMenuItem(hContactMenuItems[9], (!heNudgeReceived) ? (m_bLoggedIn && bIsContactMRA) : 0);
+ Menu_ShowItem(hContactMenuItems[9], (!heNudgeReceived) ? (m_bLoggedIn && bIsContactMRA) : 0);
return 0;
}
@@ -860,7 +860,7 @@ INT_PTR CMraProto::MraSetXStatusEx(WPARAM wParam, LPARAM lParam) if (pData->flags & CSSF_DISABLE_UI) {
bHideXStatusUI = (*pData->wParam)? FALSE:TRUE;
for (DWORD i = 0; i < MRA_XSTATUS_COUNT; i++)
- CListShowMenuItem(hXStatusMenuItems[i], !bHideXStatusUI);
+ Menu_ShowItem(hXStatusMenuItems[i], !bHideXStatusUI);
}
}
return iRet;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index c86c1779f8..0d161f53cb 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -683,7 +683,7 @@ void CMsnProto::sttProcessYFind(char* buf, size_t len) MSN_AddUser(hContact, szEmail, netId, LIST_PL + LIST_REMOVE);
MSN_AddUser(hContact, szEmail, netId, LIST_BL + LIST_REMOVE);
MSN_AddUser(hContact, szEmail, netId, LIST_AL);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
}
MSN_SetContactDb(hContact, szEmail);
}
@@ -822,9 +822,9 @@ void CMsnProto::sttProcessStatusMessage(char* buf, unsigned len, const char* wli {
stripBBCode((char*)szStatMsg);
stripColorCode((char*)szStatMsg);
- DBWriteContactSettingStringUtf(hContact, "CList", "StatusMsg", szStatMsg);
+ db_set_utf(hContact, "CList", "StatusMsg", szStatMsg);
}
- else DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ else db_unset(hContact, "CList", "StatusMsg");
{
mir_ptr<TCHAR> tszStatus( mir_utf8decodeT(szStatMsg));
@@ -1365,7 +1365,7 @@ LBL_InvalidCommand: setStringUtf(hContact, "Nick", data.userNick);
lastStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE);
if (lastStatus == ID_STATUS_OFFLINE || lastStatus == ID_STATUS_INVISIBLE)
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ db_unset(hContact, "CList", "StatusMsg");
int newStatus = MSNStatusToMiranda(params);
setWord(hContact, "Status", newStatus != ID_STATUS_IDLE ? newStatus : ID_STATUS_AWAY);
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index d860b1d8e5..f1848a738e 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -40,7 +40,7 @@ HANDLE CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, setString(hContact, "e-mail", szEmail);
setStringUtf(hContact, "Nick", msnNick ? msnNick : wlid);
if (temporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
Lists_Add(0, NETID_MSN, wlid, hContact);
}
@@ -56,10 +56,10 @@ void CMsnProto::MSN_SetContactDb(HANDLE hContact, const char *szEmail) if (listId & LIST_FL)
{
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1)
+ if (db_get_b(hContact, "CList", "NotOnList", 0) == 1)
{
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "Hidden");
}
if (listId & (LIST_BL | LIST_AL))
@@ -185,7 +185,7 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f if (res)
{
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, "CList", "Group", &dbv))
+ if (!db_get_utf(hContact, "CList", "Group", &dbv))
{
MSN_MoveContactToGroup(hContact, dbv.pszVal);
MSN_FreeVariant(&dbv);
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 0c36aa4c65..fa11d889eb 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -420,6 +420,6 @@ void CMsnProto::displayEmailCount(HANDLE hContact) getByte("DisableHotmailJunk", 0) ? _T("%s [%d]") : _T("%s [%d][%d]"), name, mUnreadMessages, mUnreadJunkEmails);
nickChg = true;
- DBWriteContactSettingTString(hContact, "CList", "MyHandle", szNick);
+ db_set_ts(hContact, "CList", "MyHandle", szNick);
nickChg = false;
}
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index f39fe781c0..9e110b8fd0 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -435,7 +435,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(HANDLE hContact, TCHAR* pszDest, si }
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
TCHAR *tszModuleName = mir_a2t(m_szModuleName);
@@ -520,7 +520,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha char* p;
DBVARIANT dbv;
- if (!DBGetContactSettingString(NULL, "SRMsg", "Font0", &dbv)) {
+ if (!db_get_s(NULL, "SRMsg", "Font0", &dbv)) {
for (p = dbv.pszVal; *p; p++)
if (BYTE(*p) >= 128 || *p < 32)
break;
@@ -531,13 +531,13 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha }
}
- int tStyle = DBGetContactSettingByte(NULL, "SRMsg", "Font0Sty", 0);
+ int tStyle = db_get_b(NULL, "SRMsg", "Font0Sty", 0);
p = tFontStyle;
if (tStyle & 1) *p++ = 'B';
if (tStyle & 2) *p++ = 'I';
*p = 0;
- tFontColor = DBGetContactSettingDword(NULL, "SRMsg", "Font0Col", 0);
+ tFontColor = db_get_dw(NULL, "SRMsg", "Font0Col", 0);
}
else {
tFontColor = 0;
@@ -849,7 +849,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) }
msnNsThread->sendPacket("CHG", "%s %u:%u %s", szStatusName, myFlags, myFlagsEx, msnObject.pszVal ? msnObject.pszVal : "0");
- DBFreeVariant(&msnObject);
+ db_free(&msnObject);
}
else msnNsThread->sendPacket("CHG", szStatusName);
}
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 2acbb835b1..644fddaa6e 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -435,8 +435,8 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam proto->setByte("SlowSend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SLOWSEND ));
if (proto->getByte("SlowSend", FALSE))
{
- if (DBGetContactSettingDword(NULL, "SRMsg", "MessageTimeout", 60000) < 60000 ||
- DBGetContactSettingDword(NULL, "SRMM", "MessageTimeout", 60000) < 60000)
+ if (db_get_dw(NULL, "SRMsg", "MessageTimeout", 60000) < 60000 ||
+ db_get_dw(NULL, "SRMM", "MessageTimeout", 60000) < 60000)
{
MessageBox(NULL, TranslateT("MSN Protocol requires message timeout to be not less then 60 sec. Correct the timeout value."),
TranslateT("MSN Protocol"), MB_OK|MB_ICONINFORMATION);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 8df8e48531..04a079bfd3 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -114,10 +114,10 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : if (MyOptions.SlowSend)
{
- if (DBGetContactSettingDword(NULL, "SRMsg", "MessageTimeout", 10000) < 60000)
- DBWriteContactSettingDword(NULL, "SRMsg", "MessageTimeout", 60000);
- if (DBGetContactSettingDword(NULL, "SRMM", "MessageTimeout", 10000) < 60000)
- DBWriteContactSettingDword(NULL, "SRMM", "MessageTimeout", 60000);
+ if (db_get_dw(NULL, "SRMsg", "MessageTimeout", 10000) < 60000)
+ db_set_dw(NULL, "SRMsg", "MessageTimeout", 60000);
+ if (db_get_dw(NULL, "SRMM", "MessageTimeout", 10000) < 60000)
+ db_set_dw(NULL, "SRMM", "MessageTimeout", 60000);
}
mailsoundname = (char*)mir_alloc(64);
@@ -244,12 +244,12 @@ HANDLE CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD fl if (flags & PALF_TEMPORARY)
{
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ if (db_get_b(hContact, "CList", "NotOnList", 0) == 1)
+ db_set_b(hContact, "CList", "Hidden", 1);
}
else
{
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
if (msnLoggedIn)
{
// int netId = Lists_GetNetId(email);
@@ -260,7 +260,7 @@ HANDLE CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD fl MSN_AddUser(hContact, email, netId, LIST_PL + LIST_REMOVE);
MSN_AddUser(hContact, email, netId, LIST_BL + LIST_REMOVE);
MSN_AddUser(hContact, email, netId, LIST_AL);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
}
MSN_SetContactDb(hContact, email);
@@ -681,7 +681,7 @@ void __cdecl CMsnProto::MsnGetAwayMsgThread(void* arg) AwayMsgInfo *inf = (AwayMsgInfo*)arg;
DBVARIANT dbv;
- if (!DBGetContactSettingTString(inf->hContact, "CList", "StatusMsg", &dbv)) {
+ if (!db_get_ts(inf->hContact, "CList", "StatusMsg", &dbv)) {
SendBroadcast(inf->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)inf->id, (LPARAM)dbv.ptszVal);
MSN_FreeVariant(&dbv);
}
@@ -771,7 +771,7 @@ int __cdecl CMsnProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) getStaticString(hContact, "e-mail", tEmail, sizeof(tEmail));
if (Lists_IsInList(LIST_FL, tEmail))
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
return Proto_RecvMessage(hContact, pre);
}
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index c3ec9f6020..d0e1e6b32c 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -834,7 +834,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas if (strcmp(ezxml_txt(ezxml_child(anot, "Name")), "AB.NickName") == 0)
{
szNick = ezxml_txt(ezxml_child(anot, "Value"));
- DBWriteContactSettingStringUtf(hContact, "CList", "MyHandle", szNick);
+ db_set_utf(hContact, "CList", "MyHandle", szNick);
}
if (strcmp(ezxml_txt(ezxml_child(anot, "Name")), "AB.JobTitle") == 0)
{
@@ -844,7 +844,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas anot = ezxml_next(anot);
}
if (szNick == NULL)
- DBDeleteContactSetting(hContact, "CList", "MyHandle");
+ db_unset(hContact, "CList", "MyHandle");
setString(hContact, "ID", szContId);
@@ -893,8 +893,8 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas }
szTmp = ezxml_txt(ezxml_child(contInf, "comment"));
- if (*szTmp) DBWriteContactSettingString(hContact, "UserInfo", "MyNotes", szTmp);
- // else DBDeleteContactSetting(hContact, "UserInfo", "MyNotes");
+ if (*szTmp) db_set_s(hContact, "UserInfo", "MyNotes", szTmp);
+ // else db_unset(hContact, "UserInfo", "MyNotes");
ezxml_t loc = ezxml_get(contInf, "locations", 0, "ContactLocation", -1);
while (loc != NULL)
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index 0f75491617..cbff0068a8 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -238,7 +238,7 @@ void CMsnProto::MSN_UploadServerGroups(char* group) if (msc == NULL) break;
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(msc->hContact, "CList", "Group", &dbv))
+ if (!db_get_utf(msc->hContact, "CList", "Group", &dbv))
{
char szGroupID[100];
if (group == NULL || (strcmp(group, dbv.pszVal) == 0 &&
@@ -263,12 +263,12 @@ void CMsnProto::MSN_SyncContactToServerGroup(HANDLE hContact, const char* szCont const char* szGrpName = "";
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, "CList", "Group", &dbv))
+ if (!db_get_utf(hContact, "CList", "Group", &dbv))
{
if (strcmp(dbv.pszVal, "MetaContacts Hidden Group") == 0)
{
MSN_FreeVariant(&dbv);
- if (!DBGetContactSettingStringUtf(hContact, "MetaContacts", "OldCListGroup", &dbv))
+ if (!db_get_utf(hContact, "MetaContacts", "OldCListGroup", &dbv))
{
szGrpName = NEWSTR_ALLOCA(dbv.pszVal);
MSN_FreeVariant(&dbv);
@@ -301,12 +301,12 @@ void CMsnProto::MSN_SyncContactToServerGroup(HANDLE hContact, const char* szCont setString(hContact, "GroupID", szGrpIdF);
const char* szGrpNameById = MSN_GetGroupById(szGrpIdF);
if (strcmp(szGrpNameById, szGrpName))
- DBWriteContactSettingStringUtf(hContact, "CList", "Group", szGrpNameById);
+ db_set_utf(hContact, "CList", "Group", szGrpNameById);
}
else
{
if (szGrpName[0])
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
deleteSetting(hContact, "GroupID");
}
}
diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index d96e13d8fa..43532ec6a5 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.cpp @@ -27,47 +27,47 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // Standard functions
void CMsnProto::deleteSetting(HANDLE hContact, const char* valueName)
-{ DBDeleteContactSetting(hContact, m_szModuleName, valueName);
+{ db_unset(hContact, m_szModuleName, valueName);
}
int CMsnProto::getByte(const char* name, BYTE defaultValue)
-{ return DBGetContactSettingByte(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_b(NULL, m_szModuleName, name, defaultValue);
}
int CMsnProto::getByte(HANDLE hContact, const char* name, BYTE defaultValue)
-{ return DBGetContactSettingByte(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_b(hContact, m_szModuleName, name, defaultValue);
}
int CMsnProto::getDword(const char* name, DWORD defaultValue)
-{ return DBGetContactSettingDword(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_dw(NULL, m_szModuleName, name, defaultValue);
}
int CMsnProto::getDword(HANDLE hContact, const char* name, DWORD defaultValue)
-{ return DBGetContactSettingDword(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_dw(hContact, m_szModuleName, name, defaultValue);
}
int CMsnProto::getString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(NULL, m_szModuleName, name, result);
+{ return db_get_s(NULL, m_szModuleName, name, result);
}
int CMsnProto::getString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(hContact, m_szModuleName, name, result);
+{ return db_get_s(hContact, m_szModuleName, name, result);
}
int CMsnProto::getTString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingTString(NULL, m_szModuleName, name, result);
+{ return db_get_ts(NULL, m_szModuleName, name, result);
}
int CMsnProto::getTString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingTString(hContact, m_szModuleName, name, result);
+{ return db_get_ts(hContact, m_szModuleName, name, result);
}
int CMsnProto::getStringUtf(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingStringUtf(hContact, m_szModuleName, name, result);
+{ return db_get_utf(hContact, m_szModuleName, name, result);
}
int CMsnProto::getStringUtf(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingStringUtf(NULL, m_szModuleName, name, result);
+{ return db_get_utf(NULL, m_szModuleName, name, result);
}
int CMsnProto::getStaticString(HANDLE hContact, const char* valueName, char* dest, unsigned dest_len)
@@ -88,55 +88,55 @@ int CMsnProto::getStaticString(HANDLE hContact, const char* valueName, char* de }
WORD CMsnProto::getWord(const char* name, WORD defaultValue)
-{ return DBGetContactSettingWord(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_w(NULL, m_szModuleName, name, defaultValue);
}
WORD CMsnProto::getWord(HANDLE hContact, const char* name, WORD defaultValue)
-{ return DBGetContactSettingWord(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_w(hContact, m_szModuleName, name, defaultValue);
}
void CMsnProto::setByte(const char* name, BYTE value)
-{ DBWriteContactSettingByte(NULL, m_szModuleName, name, value);
+{ db_set_b(NULL, m_szModuleName, name, value);
}
void CMsnProto::setByte(HANDLE hContact, const char* name, BYTE value)
-{ DBWriteContactSettingByte(hContact, m_szModuleName, name, value);
+{ db_set_b(hContact, m_szModuleName, name, value);
}
void CMsnProto::setDword(const char* name, DWORD value)
-{ DBWriteContactSettingDword(NULL, m_szModuleName, name, value);
+{ db_set_dw(NULL, m_szModuleName, name, value);
}
void CMsnProto::setDword(HANDLE hContact, const char* name, DWORD value)
-{ DBWriteContactSettingDword(hContact, m_szModuleName, name, value);
+{ db_set_dw(hContact, m_szModuleName, name, value);
}
void CMsnProto::setString(const char* name, const char* value)
-{ DBWriteContactSettingString(NULL, m_szModuleName, name, value);
+{ db_set_s(NULL, m_szModuleName, name, value);
}
void CMsnProto::setString(HANDLE hContact, const char* name, const char* value)
-{ DBWriteContactSettingString(hContact, m_szModuleName, name, value);
+{ db_set_s(hContact, m_szModuleName, name, value);
}
void CMsnProto::setStringUtf(HANDLE hContact, const char* name, const char* value)
-{ DBWriteContactSettingStringUtf(hContact, m_szModuleName, name, value);
+{ db_set_utf(hContact, m_szModuleName, name, value);
}
void CMsnProto::setTString(const char* name, const TCHAR* value)
-{ DBWriteContactSettingTString(NULL, m_szModuleName, name, value);
+{ db_set_ts(NULL, m_szModuleName, name, value);
}
void CMsnProto::setTString(HANDLE hContact, const char* name, const TCHAR* value)
-{ DBWriteContactSettingTString(hContact, m_szModuleName, name, value);
+{ db_set_ts(hContact, m_szModuleName, name, value);
}
void CMsnProto::setWord(const char* name, WORD value)
-{ DBWriteContactSettingWord(NULL, m_szModuleName, name, value);
+{ db_set_w(NULL, m_szModuleName, name, value);
}
void CMsnProto::setWord(HANDLE hContact, const char* name, WORD value)
-{ DBWriteContactSettingWord(hContact, m_szModuleName, name, value);
+{ db_set_w(hContact, m_szModuleName, name, value);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -206,7 +206,7 @@ TCHAR* CMsnProto::GetContactNameT(HANDLE hContact) void MSN_FreeVariant(DBVARIANT* dbv)
{
- DBFreeVariant(dbv);
+ db_free(dbv);
}
char* MSN_Translate(const char* str)
diff --git a/protocols/MSN/src/msn_useropts.cpp b/protocols/MSN/src/msn_useropts.cpp index 24b04705e0..ee7856fe9b 100644 --- a/protocols/MSN/src/msn_useropts.cpp +++ b/protocols/MSN/src/msn_useropts.cpp @@ -36,8 +36,8 @@ INT_PTR CALLBACK MsnDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam const HANDLE hContact = (HANDLE)lParam;
- SetDlgItemInt(hwndDlg, IDC_MOBILE, DBGetContactSettingByte(hContact, m_szModuleName, "MobileAllowed", 0), 0);
- SetDlgItemInt(hwndDlg, IDC_MSN_MOBILE, DBGetContactSettingByte(hContact, m_szModuleName, "MobileEnabled", 0), 0);
+ SetDlgItemInt(hwndDlg, IDC_MOBILE, db_get_b(hContact, m_szModuleName, "MobileAllowed", 0), 0);
+ SetDlgItemInt(hwndDlg, IDC_MSN_MOBILE, db_get_b(hContact, m_szModuleName, "MobileEnabled", 0), 0);
DWORD dwFlagBits = setDword(hContact, "FlagBits", 0);
SetDlgItemTextA(hwndDlg, IDC_WEBMESSENGER, (dwFlagBits & 0x200) ? "Y" : "N");
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 7b16ccdfc3..647f012b40 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -108,7 +108,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
if ( !getU8String( OMEGLE_KEY_LAST_QUESTION,&dbv )) {
params = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (params.empty()) {
@@ -139,7 +139,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
if ( !getU8String( OMEGLE_KEY_ASL,&dbv )) {
text = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
UpdateChat(NULL, TranslateT("Your '/asl' setting is empty."), false);
break;
@@ -367,13 +367,13 @@ void OmegleProto::SetChatStatus(int status) // Load actual name from database
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, m_szModuleName, OMEGLE_KEY_NAME, &dbv))
+ if ( !db_get_ts(NULL, m_szModuleName, OMEGLE_KEY_NAME, &dbv))
{
facy.nick_ = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
facy.nick_ = mir_tstrdup(TranslateT("You"));
- DBWriteContactSettingTString(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_);
+ db_set_ts(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_);
}
// Add self contact
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index 047e6177a3..ea4604b167 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -117,7 +117,7 @@ bool Omegle_client::handle_error( std::string method, bool force_disconnect ) if ( force_disconnect )
result = false;
- else if ( error_count_ <= (UINT)DBGetContactSettingByte(NULL,parent->m_szModuleName,OMEGLE_KEY_TIMEOUTS_LIMIT,OMEGLE_TIMEOUTS_LIMIT))
+ else if ( error_count_ <= (UINT)db_get_b(NULL,parent->m_szModuleName,OMEGLE_KEY_TIMEOUTS_LIMIT,OMEGLE_TIMEOUTS_LIMIT))
result = true;
else
result = false;
@@ -138,7 +138,7 @@ std::string Omegle_client::get_server( bool not_last ) {
BYTE q = not_last ? 1 : 0;
- BYTE server = DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
+ BYTE server = db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
if (server < 0 || server >= (SIZEOF(servers)-q))
server = 0;
@@ -327,10 +327,10 @@ bool Omegle_client::start() } else {
data = "&ask=" + utils::url::encode(this->question_);
data += "&cansavequestion=";
- data += DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_REUSE_QUESTION, 0) ? "1" : "0";
+ data += db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_REUSE_QUESTION, 0) ? "1" : "0";
}
}
- else if ( DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0))
+ else if ( db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0))
{
DBVARIANT dbv;
if (!DBGetContactSettingUTF8String(NULL, parent->m_szModuleName, OMEGLE_KEY_INTERESTS, &dbv))
@@ -338,7 +338,7 @@ bool Omegle_client::start() std::string topics = dbv.pszVal;
std::string topic;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
std::string::size_type pos = 0;
std::string::size_type pos2 = 0;
@@ -376,7 +376,7 @@ bool Omegle_client::start() }
}
- if (DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER_INFO, 0))
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER_INFO, 0))
{
std::string count = get_page( OMEGLE_REQUEST_COUNT );
if (!count.empty()) {
@@ -608,7 +608,7 @@ bool Omegle_client::events( ) if ( resp.data.find( "[\"strangerDisconnected\"]" ) != std::string::npos ) {
// Stranger disconnected
- if (DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
{
SkinPlaySound( "StrangerChange" );
parent->NewChat();
@@ -633,7 +633,7 @@ bool Omegle_client::events( ) mir_free(msg);
// Stranger disconnected
- if (DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
{
SkinPlaySound( "StrangerChange" );
parent->NewChat();
@@ -670,11 +670,11 @@ bool Omegle_client::events( ) if (newStranger && state_ != STATE_SPY) {
// We got new stranger in this event, lets say him "Hi message" if enabled
- if ( DBGetContactSettingByte( NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0 )) {
+ if ( db_get_b( NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0 )) {
DBVARIANT dbv;
if ( !DBGetContactSettingUTF8String( NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv )) {
std::string *message = new std::string(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
parent->Log("**Chat - saying Hi! message");
ForkThread(&OmegleProto::SendMsgWorker, parent, (void*)message);
diff --git a/protocols/Omegle/src/db.h b/protocols/Omegle/src/db.h index ea80a53d48..6543b9f2d8 100644 --- a/protocols/Omegle/src/db.h +++ b/protocols/Omegle/src/db.h @@ -23,19 +23,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once
// DB macros
-#define getByte( setting, error ) DBGetContactSettingByte( NULL, m_szModuleName, setting, error )
-#define setByte( setting, value ) DBWriteContactSettingByte( NULL, m_szModuleName, setting, value )
-#define getWord( setting, error ) DBGetContactSettingWord( NULL, m_szModuleName, setting, error )
-#define setWord( setting, value ) DBWriteContactSettingWord( NULL, m_szModuleName, setting, value )
-#define getDword( setting, error ) DBGetContactSettingDword( NULL, m_szModuleName, setting, error )
-#define setDword( setting, value ) DBWriteContactSettingDword( NULL, m_szModuleName, setting, value )
-#define getString( setting, dest ) DBGetContactSettingString( NULL, m_szModuleName, setting, dest )
-#define setString( setting, value ) DBWriteContactSettingString( NULL, m_szModuleName, setting, value )
-#define getTString( setting, dest ) DBGetContactSettingTString( NULL, m_szModuleName, setting, dest )
-#define setTString( setting, value ) DBWriteContactSettingTString( NULL, m_szModuleName, setting, value )
+#define getByte( setting, error ) db_get_b( NULL, m_szModuleName, setting, error )
+#define setByte( setting, value ) db_set_b( NULL, m_szModuleName, setting, value )
+#define getWord( setting, error ) db_get_w( NULL, m_szModuleName, setting, error )
+#define setWord( setting, value ) db_set_w( NULL, m_szModuleName, setting, value )
+#define getDword( setting, error ) db_get_dw( NULL, m_szModuleName, setting, error )
+#define setDword( setting, value ) db_set_dw( NULL, m_szModuleName, setting, value )
+#define getString( setting, dest ) db_get_s( NULL, m_szModuleName, setting, dest )
+#define setString( setting, value ) db_set_s( NULL, m_szModuleName, setting, value )
+#define getTString( setting, dest ) db_get_ts( NULL, m_szModuleName, setting, dest )
+#define setTString( setting, value ) db_set_ts( NULL, m_szModuleName, setting, value )
#define getU8String( setting, dest ) DBGetContactSettingUTF8String( NULL, m_szModuleName, setting, dest )
#define setU8String( setting, value ) DBWriteContactSettingUTF8String( NULL, m_szModuleName, setting, value )
-#define deleteSetting( setting ) DBDeleteContactSetting( NULL, m_szModuleName, setting )
+#define deleteSetting( setting ) db_unset( NULL, m_szModuleName, setting )
// DB settings
#define OMEGLE_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN]
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index 19f9fde011..a3dff58abc 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static BOOL LoadDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting, BYTE bDef = 0)
{
- BOOL state = DBGetContactSettingByte(NULL, ppro->m_szModuleName, szSetting, bDef);
+ BOOL state = db_get_b(NULL, ppro->m_szModuleName, szSetting, bDef);
CheckDlgButton(hwnd, idCtrl, state);
return state;
}
@@ -32,17 +32,17 @@ static BOOL LoadDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const cha static BOOL StoreDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
BOOL state = IsDlgButtonChecked(hwnd, idCtrl);
- DBWriteContactSettingByte(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
+ db_set_b(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
return state;
}
static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, ppro->m_szModuleName, szSetting, &dbv))
+ if ( !db_get_ts(NULL, ppro->m_szModuleName, szSetting, &dbv))
{
SetDlgItemText(hwnd, idCtrl, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -52,9 +52,9 @@ static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* sz GetDlgItemText(hwnd, idCtrl, tstr, sizeof(tstr));
if ( _tcsclen( tstr ) > 0 ) {
- DBWriteContactSettingTString(NULL, ppro->m_szModuleName, szSetting, tstr);
+ db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr);
} else {
- DBDeleteContactSetting(NULL, ppro->m_szModuleName, szSetting);
+ db_unset(NULL, ppro->m_szModuleName, szSetting);
}
}
@@ -80,7 +80,7 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR {
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
}
- SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, DBGetContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
+ SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
LoadDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
@@ -114,7 +114,7 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR {
proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
StoreDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
StoreDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
@@ -152,7 +152,7 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR {
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
}
- SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, DBGetContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
+ SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
LoadDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
@@ -208,7 +208,7 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR {
proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
StoreDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
StoreDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 2380eb48ec..ad5229f13d 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -236,7 +236,7 @@ int OmegleProto::OnContactDeleted(WPARAM wparam,LPARAM) if ( include_chat )
return true;
else
- return DBGetContactSettingByte(hContact,m_szModuleName,"ChatRoom",0) == 0;
+ return db_get_b(hContact,m_szModuleName,"ChatRoom",0) == 0;
} else {
return false;
}
diff --git a/protocols/Omegle/src/utils.cpp b/protocols/Omegle/src/utils.cpp index 09b6eed036..b259fa5933 100644 --- a/protocols/Omegle/src/utils.cpp +++ b/protocols/Omegle/src/utils.cpp @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. std::string utils::url::encode(const std::string &s)
{
- return mir_ptr<char>( mir_urlEncode( s.c_str()));
+ return (char*)mir_ptr<char>( mir_urlEncode( s.c_str()));
}
void utils::text::replace_first( std::string* data, std::string from, std::string to )
diff --git a/protocols/Tlen/src/jabber.h b/protocols/Tlen/src/jabber.h index 954e3b4069..2b3899cc3a 100644 --- a/protocols/Tlen/src/jabber.h +++ b/protocols/Tlen/src/jabber.h @@ -283,14 +283,14 @@ struct TlenProtocol : public PROTO_INTERFACE struct ThreadDataStruct *threadData;
HANDLE hTlenNudge;
- HANDLE hMenuMUC;
- HANDLE hMenuChats;
- HANDLE hMenuInbox;
- HANDLE hMenuContactMUC;
- HANDLE hMenuContactVoice;
- HANDLE hMenuContactGrantAuth;
- HANDLE hMenuContactRequestAuth;
- HANDLE hMenuPicture;
+ HGENMENU hMenuMUC;
+ HGENMENU hMenuChats;
+ HGENMENU hMenuInbox;
+ HGENMENU hMenuContactMUC;
+ HGENMENU hMenuContactVoice;
+ HGENMENU hMenuContactGrantAuth;
+ HGENMENU hMenuContactRequestAuth;
+ HGENMENU hMenuPicture;
HANDLE* hServices;
unsigned serviceNum;
diff --git a/protocols/Tlen/src/jabber_iqid.cpp b/protocols/Tlen/src/jabber_iqid.cpp index 3cf0e0f2ae..ef5a6844dc 100644 --- a/protocols/Tlen/src/jabber_iqid.cpp +++ b/protocols/Tlen/src/jabber_iqid.cpp @@ -38,10 +38,10 @@ void JabberIqResultAuth(TlenProtocol *proto, XmlNode *iqNode) if (!strcmp(type, "result")) {
DBVARIANT dbv;
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "Nick", &dbv))
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "Nick", proto->threadData->username);
+ if (db_get(NULL, proto->m_szModuleName, "Nick", &dbv))
+ db_set_s(NULL, proto->m_szModuleName, "Nick", proto->threadData->username);
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
// iqId = JabberSerialNext();
// JabberIqAdd(iqId, IQ_PROC_NONE, JabberIqResultGetRoster);
// JabberSend(info, "<iq type='get' id='"JABBER_IQID"%d'><query xmlns='jabber:iq:roster'/></iq>", iqId);
@@ -77,8 +77,8 @@ void JabberResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { str = JabberXmlGetAttrValue(itemNode, "subscription");
if (!strcmp(str, "remove")) {
if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
- if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
JabberListRemove(proto, LIST_ROSTER, jid);
} else {
@@ -103,21 +103,21 @@ void JabberResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { // Add the jid (with empty resource) to Miranda contact list.
hContact = JabberDBCreateContact(proto, jid, nick, FALSE);
}
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
if ((groupNode=JabberXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
JabberContactListCreateGroup(item->group);
// Don't set group again if already correct, or Miranda may show wrong group count in some case
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if (!db_get(hContact, "CList", "Group", &dbv)) {
if (strcmp(dbv.pszVal, item->group))
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, "CList", "Group", item->group);
+ db_free(&dbv);
} else
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
+ db_set_s(hContact, "CList", "Group", item->group);
} else {
item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
}
}
@@ -175,37 +175,37 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) // Add the jid (with empty resource) to Miranda contact list.
hContact = JabberDBCreateContact(proto, jid, nick, FALSE);
}
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
if ((groupNode=JabberXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
JabberContactListCreateGroup(item->group);
// Don't set group again if already correct, or Miranda may show wrong group count in some case
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if (!db_get(hContact, "CList", "Group", &dbv)) {
if (strcmp(dbv.pszVal, item->group))
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, "CList", "Group", item->group);
+ db_free(&dbv);
}
else
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
+ db_set_s(hContact, "CList", "Group", item->group);
}
else {
item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "AvatarHash", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "AvatarHash", &dbv)) {
if (item->avatarHash) mir_free(item->avatarHash);
item->avatarHash = mir_strdup(dbv.pszVal);
JabberLog(proto, "Setting hash [%s] = %s", nick, item->avatarHash);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- item->avatarFormat = DBGetContactSettingDword(hContact, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
+ item->avatarFormat = db_get_dw(hContact, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
}
}
}
}
// Delete orphaned contacts (if roster sync is enabled)
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "RosterSync", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "RosterSync", FALSE) == TRUE) {
HANDLE *list;
int listSize, listAllocSize;
@@ -215,7 +215,7 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) while (hContact != NULL) {
str = GetContactProto(hContact);
if (str != NULL && !strcmp(str, proto->m_szModuleName)) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
if (!JabberListExist(proto, LIST_ROSTER, dbv.pszVal)) {
JabberLog(proto, "Syncing roster: preparing to delete %s (hContact=0x%x)", dbv.pszVal, hContact);
if (listSize >= listAllocSize) {
@@ -227,7 +227,7 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) }
list[listSize++] = hContact;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hContact = db_find_next(hContact);
@@ -279,20 +279,20 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
if ((itemNode=JabberXmlGetChild(queryNode, "item")) == NULL) return;
if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
+ if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
if (strchr(jid, '@') != NULL) {
sprintf(text, "%s", jid);
} else {
sprintf(text, "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if ((hContact=JabberHContactFromJID(proto, text)) == NULL) {
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv)) return;
+ if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) return;
if (strcmp(dbv.pszVal, jid)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else {
hContact = NULL;
@@ -305,7 +305,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasFirst = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "FirstName", nText);
+ db_set_s(hContact, proto->m_szModuleName, "FirstName", nText);
mir_free(nText);
}
}
@@ -313,7 +313,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasLast = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "LastName", nText);
+ db_set_s(hContact, proto->m_szModuleName, "LastName", nText);
mir_free(nText);
}
}
@@ -321,7 +321,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasNick = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "Nick", nText);
+ db_set_s(hContact, proto->m_szModuleName, "Nick", nText);
mir_free(nText);
}
}
@@ -329,7 +329,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasEmail = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "e-mail", nText);
+ db_set_s(hContact, proto->m_szModuleName, "e-mail", nText);
mir_free(nText);
}
}
@@ -337,7 +337,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasCity = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "City", nText);
+ db_set_s(hContact, proto->m_szModuleName, "City", nText);
mir_free(nText);
}
}
@@ -346,20 +346,20 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) WORD nAge;
hasAge = TRUE;
nAge = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Age", nAge);
+ db_set_w(hContact, proto->m_szModuleName, "Age", nAge);
}
}
else if (!strcmp(n->name, "s")) {
if (n->text != NULL && n->text[1] == '\0' && (n->text[0] == '1' || n->text[0] == '2')) {
hasGender = TRUE;
- DBWriteContactSettingByte(hContact, proto->m_szModuleName, "Gender", (BYTE) (n->text[0] == '1'?'M':'F'));
+ db_set_b(hContact, proto->m_szModuleName, "Gender", (BYTE) (n->text[0] == '1'?'M':'F'));
}
}
else if (!strcmp(n->name, "e")) {
if (n->text != NULL) {
hasSchool = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "School", nText);
+ db_set_s(hContact, proto->m_szModuleName, "School", nText);
mir_free(nText);
}
}
@@ -368,7 +368,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) WORD nOccupation;
hasOccupation = TRUE;
nOccupation = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Occupation", nOccupation);
+ db_set_w(hContact, proto->m_szModuleName, "Occupation", nOccupation);
}
}
else if (!strcmp(n->name, "r")) {
@@ -376,45 +376,45 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) WORD nLookFor;
hasLookFor = TRUE;
nLookFor = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "LookingFor", nLookFor);
+ db_set_w(hContact, proto->m_szModuleName, "LookingFor", nLookFor);
}
}
else if (!strcmp(n->name, "g")) { // voice chat enabled
if (n->text != NULL) {
BYTE bVoice;
bVoice = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "VoiceChat", bVoice);
+ db_set_w(hContact, proto->m_szModuleName, "VoiceChat", bVoice);
}
}
else if (!strcmp(n->name, "v")) { // status visibility
if (n->text != NULL) {
BYTE bPublic;
bPublic = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "PublicStatus", bPublic);
+ db_set_w(hContact, proto->m_szModuleName, "PublicStatus", bPublic);
}
}
}
if (!hasFirst)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "FirstName");
+ db_unset(hContact, proto->m_szModuleName, "FirstName");
if (!hasLast)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "LastName");
+ db_unset(hContact, proto->m_szModuleName, "LastName");
// We are not removing "Nick"
// if (!hasNick)
-// DBDeleteContactSetting(hContact, m_szModuleName, "Nick");
+// db_unset(hContact, m_szModuleName, "Nick");
if (!hasEmail)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "e-mail");
+ db_unset(hContact, proto->m_szModuleName, "e-mail");
if (!hasCity)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "City");
+ db_unset(hContact, proto->m_szModuleName, "City");
if (!hasAge)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Age");
+ db_unset(hContact, proto->m_szModuleName, "Age");
if (!hasGender)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Gender");
+ db_unset(hContact, proto->m_szModuleName, "Gender");
if (!hasSchool)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "School");
+ db_unset(hContact, proto->m_szModuleName, "School");
if (!hasOccupation)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Occupation");
+ db_unset(hContact, proto->m_szModuleName, "Occupation");
if (!hasLookFor)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "LookingFor");
+ db_unset(hContact, proto->m_szModuleName, "LookingFor");
ProtoBroadcastAck(proto->m_szModuleName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
}
}
@@ -435,7 +435,7 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) if (!strcmp(type, "result")) {
if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
jsr.hdr.flags = PSR_TCHAR;
for (i=0; i<queryNode->numChild; i++) {
@@ -510,7 +510,7 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) mir_free(proto->searchJID);
proto->searchJID = NULL;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
found = 0;
if (queryNode->numChild == TLEN_MAX_SEARCH_RESULTS_PER_PAGE) {
@@ -604,9 +604,9 @@ void TlenIqResultVersion(TlenProtocol *proto, XmlNode *iqNode) item->system = NULL;
if (( hContact=JabberHContactFromJID(proto, item->jid )) != NULL ) {
if (item->software != NULL) {
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "MirVer", item->software);
+ db_set_s(hContact, proto->m_szModuleName, "MirVer", item->software);
} else {
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "MirVer");
+ db_unset(hContact, proto->m_szModuleName, "MirVer");
}
}
}
@@ -629,7 +629,7 @@ void TlenIqResultInfo(TlenProtocol *proto, XmlNode *iqNode) if (item->software == NULL) {
char str[128];
mir_snprintf(str, sizeof(str), "Tlen Protocol %s", item->protocolVersion);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "MirVer", str);
+ db_set_s(hContact, proto->m_szModuleName, "MirVer", str);
}
}
}
diff --git a/protocols/Tlen/src/jabber_misc.cpp b/protocols/Tlen/src/jabber_misc.cpp index fccf376f72..30ec49b67d 100644 --- a/protocols/Tlen/src/jabber_misc.cpp +++ b/protocols/Tlen/src/jabber_misc.cpp @@ -50,13 +50,13 @@ void JabberDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) // strip resource if present
s = JabberLoginFromJID(jid);
_strlwr(s);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "jid", s);
+ db_set_s(hContact, proto->m_szModuleName, "jid", s);
mir_free(s);
}
else {
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Hidden");
+ db_unset(hContact, proto->m_szModuleName, "Hidden");
}
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "Nick", nick);
+ db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
JabberLog(proto, "auth request: %s, %s", jid, nick);
//blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
//blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
@@ -76,9 +76,9 @@ char *JabberJIDFromHContact(TlenProtocol *proto, HANDLE hContact) {
char *p = NULL;
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
p = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return p;
}
@@ -95,15 +95,15 @@ HANDLE JabberHContactFromJID(TlenProtocol *proto, const char *jid) while (hContact != NULL) {
szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(proto->m_szModuleName, szProto)) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
if ((p=dbv.pszVal) != NULL) {
if (!stricmp(p, jid)) { // exact match (node@domain/resource)
hContactMatched = hContact;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hContact = db_find_next(hContact);
@@ -123,11 +123,11 @@ HANDLE JabberDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL te if ((hContact=JabberHContactFromJID(proto, jid)) == NULL) {
hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "jid", jid);
+ db_set_s(hContact, proto->m_szModuleName, "jid", jid);
if (nick != NULL && nick[0] != '\0')
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "Nick", nick);
+ db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
if (temporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
}
return hContact;
}
@@ -141,22 +141,22 @@ static void JabberContactListCreateClistGroup(char *groupName) for (i=0;;i++) {
itoa(i, str, 10);
- if (DBGetContactSetting(NULL, "CListGroups", str, &dbv))
+ if (db_get(NULL, "CListGroups", str, &dbv))
break;
name = dbv.pszVal;
if (name[0] != '\0' && !strcmp(name+1, groupName)) {
// Already exist, no need to create
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// Create new group with id = i (str is the text representation of i)
newName[0] = 1 | GROUPF_EXPANDED;
strncpy(newName+1, groupName, sizeof(newName)-1);
newName[sizeof(newName)-1] = '\0';
- DBWriteContactSettingString(NULL, "CListGroups", str, newName);
+ db_set_s(NULL, "CListGroups", str, newName);
CallService(MS_CLUI_GROUPADDED, i+1, 0);
}
diff --git a/protocols/Tlen/src/jabber_opt.cpp b/protocols/Tlen/src/jabber_opt.cpp index 594bbe0ade..fb0e68de1d 100644 --- a/protocols/Tlen/src/jabber_opt.cpp +++ b/protocols/Tlen/src/jabber_opt.cpp @@ -47,23 +47,23 @@ static TabDef tabPages[] = { void TlenLoadOptions(TlenProtocol *proto)
{
- proto->tlenOptions.savePassword = DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE);
- proto->tlenOptions.useEncryption = DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", TRUE);
- proto->tlenOptions.reconnect = DBGetContactSettingByte(NULL, proto->m_szModuleName, "Reconnect", TRUE);
- proto->tlenOptions.alertPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "AlertPolicy", TLEN_ALERTS_IGNORE_NIR);
- proto->tlenOptions.rosterSync = DBGetContactSettingByte(NULL, proto->m_szModuleName, "RosterSync", FALSE);
- proto->tlenOptions.offlineAsInvisible = DBGetContactSettingByte(NULL, proto->m_szModuleName, "OfflineAsInvisible", FALSE);
- proto->tlenOptions.leaveOfflineMessage = DBGetContactSettingByte(NULL, proto->m_szModuleName, "LeaveOfflineMessage", TRUE);
- proto->tlenOptions.offlineMessageOption = DBGetContactSettingWord(NULL, proto->m_szModuleName, "OfflineMessageOption", 0);
- proto->tlenOptions.ignoreAdvertisements = DBGetContactSettingByte(NULL, proto->m_szModuleName, "IgnoreAdvertisements", TRUE);
- proto->tlenOptions.groupChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "GroupChatPolicy", TLEN_MUC_ASK);
- proto->tlenOptions.voiceChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceChatPolicy", TLEN_MUC_ASK);
- proto->tlenOptions.imagePolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "ImagePolicy",TLEN_IMAGES_IGNORE_NIR);
- proto->tlenOptions.enableAvatars = DBGetContactSettingByte(NULL, proto->m_szModuleName, "EnableAvatars", TRUE);
- proto->tlenOptions.enableVersion = DBGetContactSettingByte(NULL, proto->m_szModuleName, "EnableVersion", TRUE);
- proto->tlenOptions.useNudge = DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseNudge", FALSE);
- proto->tlenOptions.logAlerts = DBGetContactSettingByte(NULL, proto->m_szModuleName, "LogAlerts", TRUE);
- proto->tlenOptions.sendKeepAlive = DBGetContactSettingByte(NULL, proto->m_szModuleName, "KeepAlive", TRUE);
+ proto->tlenOptions.savePassword = db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE);
+ proto->tlenOptions.useEncryption = db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE);
+ proto->tlenOptions.reconnect = db_get_b(NULL, proto->m_szModuleName, "Reconnect", TRUE);
+ proto->tlenOptions.alertPolicy = db_get_w(NULL, proto->m_szModuleName, "AlertPolicy", TLEN_ALERTS_IGNORE_NIR);
+ proto->tlenOptions.rosterSync = db_get_b(NULL, proto->m_szModuleName, "RosterSync", FALSE);
+ proto->tlenOptions.offlineAsInvisible = db_get_b(NULL, proto->m_szModuleName, "OfflineAsInvisible", FALSE);
+ proto->tlenOptions.leaveOfflineMessage = db_get_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", TRUE);
+ proto->tlenOptions.offlineMessageOption = db_get_w(NULL, proto->m_szModuleName, "OfflineMessageOption", 0);
+ proto->tlenOptions.ignoreAdvertisements = db_get_b(NULL, proto->m_szModuleName, "IgnoreAdvertisements", TRUE);
+ proto->tlenOptions.groupChatPolicy = db_get_w(NULL, proto->m_szModuleName, "GroupChatPolicy", TLEN_MUC_ASK);
+ proto->tlenOptions.voiceChatPolicy = db_get_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", TLEN_MUC_ASK);
+ proto->tlenOptions.imagePolicy = db_get_w(NULL, proto->m_szModuleName, "ImagePolicy",TLEN_IMAGES_IGNORE_NIR);
+ proto->tlenOptions.enableAvatars = db_get_b(NULL, proto->m_szModuleName, "EnableAvatars", TRUE);
+ proto->tlenOptions.enableVersion = db_get_b(NULL, proto->m_szModuleName, "EnableVersion", TRUE);
+ proto->tlenOptions.useNudge = db_get_b(NULL, proto->m_szModuleName, "UseNudge", FALSE);
+ proto->tlenOptions.logAlerts = db_get_b(NULL, proto->m_szModuleName, "LogAlerts", TRUE);
+ proto->tlenOptions.sendKeepAlive = db_get_b(NULL, proto->m_szModuleName, "KeepAlive", TRUE);
proto->tlenOptions.useNewP2P = TRUE;
}
@@ -126,16 +126,16 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE));
+ CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE));
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), JabberValidateUsernameWndProc);
}
@@ -164,23 +164,23 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DBVARIANT dbv;
GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "Password", text);
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "Password", text);
}
else
- DBDeleteContactSetting(NULL, proto->m_szModuleName, "Password");
+ db_unset(NULL, proto->m_szModuleName, "Password");
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
+ db_set_b(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
if (reconnectRequired && proto->isConnected)
MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
TlenLoadOptions(proto);
@@ -205,16 +205,16 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE));
+ CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE));
CheckDlgButton(hwndDlg, IDC_RECONNECT, proto->tlenOptions.reconnect);
CheckDlgButton(hwndDlg, IDC_ROSTER_SYNC, proto->tlenOptions.rosterSync);
@@ -304,36 +304,36 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara DBVARIANT dbv;
GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "Password", text);
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "Password", text);
}
else
- DBDeleteContactSetting(NULL, proto->m_szModuleName, "Password");
-
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "Reconnect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RECONNECT));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "RosterSync", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ROSTER_SYNC));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "OfflineAsInvisible", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOW_OFFLINE));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "IgnoreAdvertisements", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_IGNORE_ADVERTISEMENTS));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "LeaveOfflineMessage", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_OFFLINE_MESSAGE));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "OfflineMessageOption", (WORD) SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "AlertPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "GroupChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "ImagePolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "EnableAvatars", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARS));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "EnableVersion", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VERSIONINFO));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "UseNudge", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NUDGE_SUPPORT));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "LogAlerts", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LOG_ALERTS));
+ db_unset(NULL, proto->m_szModuleName, "Password");
+
+ db_set_b(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
+ db_set_b(NULL, proto->m_szModuleName, "Reconnect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RECONNECT));
+ db_set_b(NULL, proto->m_szModuleName, "RosterSync", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ROSTER_SYNC));
+ db_set_b(NULL, proto->m_szModuleName, "OfflineAsInvisible", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOW_OFFLINE));
+ db_set_b(NULL, proto->m_szModuleName, "IgnoreAdvertisements", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_IGNORE_ADVERTISEMENTS));
+ db_set_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_OFFLINE_MESSAGE));
+ db_set_w(NULL, proto->m_szModuleName, "OfflineMessageOption", (WORD) SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "AlertPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "GroupChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "ImagePolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, "EnableAvatars", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARS));
+ db_set_b(NULL, proto->m_szModuleName, "EnableVersion", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VERSIONINFO));
+ db_set_b(NULL, proto->m_szModuleName, "UseNudge", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NUDGE_SUPPORT));
+ db_set_b(NULL, proto->m_szModuleName, "LogAlerts", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LOG_ALERTS));
if (reconnectRequired && proto->isConnected)
MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
ApplyChanges(proto, 1);
@@ -377,9 +377,9 @@ static INT_PTR CALLBACK TlenVoiceOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
{
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "VoiceChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceIn", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_IN, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceOut", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_OUT, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "VoiceDeviceIn", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_IN, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "VoiceDeviceOut", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_OUT, CB_GETCURSEL, 0, 0));
ApplyChanges(proto, 2);
return TRUE;
}
@@ -403,9 +403,9 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, _T("tlen.pl"));
}
@@ -413,21 +413,21 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_HOST), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_HOSTPORT), TRUE);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "ManualHost", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "ManualHost", &dbv)) {
SetDlgItemText(hwndDlg, IDC_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
SetDlgItemText(hwndDlg, IDC_HOST, _T("s1.tlen.pl"));
- SetDlgItemInt(hwndDlg, IDC_HOSTPORT, DBGetContactSettingWord(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_HOSTPORT, db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT), FALSE);
- CheckDlgButton(hwndDlg, IDC_KEEPALIVE, DBGetContactSettingByte(NULL, proto->m_szModuleName, "KeepAlive", TRUE));
+ CheckDlgButton(hwndDlg, IDC_KEEPALIVE, db_get_b(NULL, proto->m_szModuleName, "KeepAlive", TRUE));
- CheckDlgButton(hwndDlg, IDC_USE_SSL, DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", TRUE));
+ CheckDlgButton(hwndDlg, IDC_USE_SSL, db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE));
- CheckDlgButton(hwndDlg, IDC_VISIBILITY_SUPPORT, DBGetContactSettingByte(NULL, proto->m_szModuleName, "VisibilitySupport", FALSE));
+ CheckDlgButton(hwndDlg, IDC_VISIBILITY_SUPPORT, db_get_b(NULL, proto->m_szModuleName, "VisibilitySupport", FALSE));
// File transfer options
bChecked = FALSE;
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseFileProxy", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "UseFileProxy", FALSE) == TRUE) {
bChecked = TRUE;
CheckDlgButton(hwndDlg, IDC_FILE_USE_PROXY, TRUE);
}
@@ -438,7 +438,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT_LABEL), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USE_AUTH), bChecked);
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE) == TRUE) {
CheckDlgButton(hwndDlg, IDC_FILE_PROXY_USE_AUTH, TRUE);
} else {
bChecked = FALSE;
@@ -451,20 +451,20 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Forwarding"));
SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("SOCKS4"));
SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("SOCKS5"));
- SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_SETCURSEL, DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyType", 0), 0);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
+ SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_SETCURSEL, db_get_w(NULL, proto->m_szModuleName, "FileProxyType", 0), 0);
+ if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FILE_PROXY_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- SetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyPort", 0), FALSE);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
+ SetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, db_get_w(NULL, proto->m_szModuleName, "FileProxyPort", 0), FALSE);
+ if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FILE_PROXY_USER, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
}
@@ -520,43 +520,43 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, BOOL reconnectRequired = FALSE;
DBVARIANT dbv;
GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "LoginServer", strlwr(text));
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text));
GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "ManualHost", text);
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "ManualHost", text);
port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE);
- if (DBGetContactSettingWord(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port)
+ if (db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port)
reconnectRequired = TRUE;
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "ManualPort", port);
+ db_set_w(NULL, proto->m_szModuleName, "ManualPort", port);
proto->tlenOptions.sendKeepAlive = IsDlgButtonChecked(hwndDlg, IDC_KEEPALIVE);
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive);
+ db_set_b(NULL, proto->m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive);
useEncryption = IsDlgButtonChecked(hwndDlg, IDC_USE_SSL);
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption)
+ if (db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption)
reconnectRequired = TRUE;
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption);
+ db_set_b(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption);
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT));
+ db_set_b(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT));
// File transfer options
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
+ db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, sizeof(text));
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "FileProxyHost", text);
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text);
+ db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
+ db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, sizeof(text));
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "FileProxyUsername", text);
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text);
GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, sizeof(text));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "FileProxyPassword", text);
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text);
if (reconnectRequired && proto->isConnected)
MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
ApplyChanges(proto, 4);
@@ -600,11 +600,11 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE));
- SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupBack", POPUP_DEFAULT_COLORBKG));
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupText", POPUP_DEFAULT_COLORTXT));
- SetDlgItemInt(hwndDlg, IDC_DELAY, DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupDelay", 4), FALSE);
- delayMode = DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
+ CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, db_get_b(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE));
+ SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, "MailPopupBack", POPUP_DEFAULT_COLORBKG));
+ SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, "MailPopupText", POPUP_DEFAULT_COLORTXT));
+ SetDlgItemInt(hwndDlg, IDC_DELAY, db_get_dw(NULL, proto->m_szModuleName, "MailPopupDelay", 4), FALSE);
+ delayMode = db_get_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
if (delayMode == 1) {
CheckDlgButton(hwndDlg, IDC_DELAY_CUSTOM, TRUE);
} else if (delayMode == 2) {
@@ -653,10 +653,10 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY:
{
BYTE delayMode;
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
+ db_set_b(NULL, proto->m_szModuleName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP));
+ db_set_dw(NULL, proto->m_szModuleName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
delayMode=0;
if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_CUSTOM)) {
delayMode=1;
@@ -664,7 +664,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, delayMode=2;
}
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "MailPopupDelayMode", delayMode);
+ db_set_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", delayMode);
ApplyChanges(proto, 8);
return TRUE;
}
diff --git a/protocols/Tlen/src/jabber_svc.cpp b/protocols/Tlen/src/jabber_svc.cpp index 30e4764e4f..db39892f83 100644 --- a/protocols/Tlen/src/jabber_svc.cpp +++ b/protocols/Tlen/src/jabber_svc.cpp @@ -193,10 +193,10 @@ static HANDLE AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flag jid = mir_strdup(newJid); _strlwr(jid);
hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "jid", jid);
+ db_set_s(hContact, proto->m_szModuleName, "jid", jid);
if ((nick=JabberNickFromJID(newJid)) == NULL)
nick = mir_strdup(newJid);
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
mir_free(nick);
mir_free(jid);
@@ -208,15 +208,15 @@ static HANDLE AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flag // PS_ADDTOLIST is called but before the add dialog issue deletion of
// "NotOnList".
// If temporary add, "NotOnList" won't be deleted, and that's expected.
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
if (flags & PALF_TEMPORARY)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
}
else {
// already exist
// Set up a dummy "NotOnList" when adding permanently only
if (!(flags&PALF_TEMPORARY))
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
}
return hContact;
@@ -301,7 +301,7 @@ int __cdecl TlenProtocol::Authorize(HANDLE hDbEvent) JabberSend(this, "<presence to='%s' type='subscribed'/>", jid);
// Automatically add this user to my roster if option is enabled
- if (DBGetContactSettingByte(NULL, m_szModuleName, "AutoAdd", TRUE) == TRUE) {
+ if (db_get_b(NULL, m_szModuleName, "AutoAdd", TRUE) == TRUE) {
HANDLE hContact;
JABBER_LIST_ITEM *item;
@@ -310,7 +310,7 @@ int __cdecl TlenProtocol::Authorize(HANDLE hDbEvent) if ((hContact=AddToListByJID(this, jid, 0)) != NULL) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and JabberDbSettingChanged().
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
}
}
}
@@ -495,7 +495,7 @@ int __cdecl TlenProtocol::GetInfo(HANDLE hContact, int infoType) JabberIqAdd(this, iqId, IQ_PROC_NONE, TlenIqResultVcard);
JabberSend(this, "<iq type='get' id='"JABBER_IQID"%d' to='tuba'><query xmlns='jabber:iq:register'></query></iq>", iqId);
} else {
- if (DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) return 1;
+ if (db_get(hContact, m_szModuleName, "jid", &dbv)) return 1;
if ((nick=JabberNickFromJID(dbv.pszVal)) != NULL) {
if ((pNick=JabberTextEncode(nick)) != NULL) {
iqId = JabberSerialNext(this);
@@ -505,7 +505,7 @@ int __cdecl TlenProtocol::GetInfo(HANDLE hContact, int infoType) }
mir_free(nick);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -517,12 +517,12 @@ int __cdecl TlenProtocol::SetApparentMode(HANDLE hContact, int mode) char *jid;
if (!isOnline) return 0;
- if (!DBGetContactSettingByte(NULL, m_szModuleName, "VisibilitySupport", FALSE)) return 0;
+ if (!db_get_b(NULL, m_szModuleName, "VisibilitySupport", FALSE)) return 0;
if (mode != 0 && mode != ID_STATUS_ONLINE && mode != ID_STATUS_OFFLINE) return 1;
- oldMode = DBGetContactSettingWord(hContact, m_szModuleName, "ApparentMode", 0);
+ oldMode = db_get_w(hContact, m_szModuleName, "ApparentMode", 0);
if ((int) mode == oldMode) return 1;
- DBWriteContactSettingWord(hContact, m_szModuleName, "ApparentMode", (WORD) mode);
- if (!DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) {
+ db_set_w(hContact, m_szModuleName, "ApparentMode", (WORD) mode);
+ if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
jid = dbv.pszVal;
switch (mode) {
case ID_STATUS_ONLINE:
@@ -540,7 +540,7 @@ int __cdecl TlenProtocol::SetApparentMode(HANDLE hContact, int mode) JabberSend(this, "<presence to='%s'><show>available</show></presence>", jid);
break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -571,16 +571,16 @@ static void __cdecl TlenGetAwayMsgThread(void *ptr) DBVARIANT dbv;
JABBER_LIST_ITEM *item;
SENDACKTHREADDATA *data = (SENDACKTHREADDATA *)ptr;
- if (!DBGetContactSetting(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(data->proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (item->statusMessage != NULL) {
ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) item->statusMessage);
return;
}
}
else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) "");
@@ -592,10 +592,10 @@ INT_PTR TlenSendAlert(void *ptr, LPARAM wParam, LPARAM lParam) HANDLE hContact = ( HANDLE )wParam;
DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
- if (proto->isOnline && !DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (proto->isOnline && !db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<m tp='a' to='%s'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -608,7 +608,7 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg) int id;
char msgType[16];
- if (!isOnline || DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) {
+ if (!isOnline || db_get(hContact, m_szModuleName, "jid", &dbv)) {
SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
tdata->proto = this;
tdata->hContact = hContact;
@@ -632,12 +632,12 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg) if ((msgEnc=JabberTextEncode(msg)) != NULL) {
if (JabberListExist(this, LIST_CHATROOM, dbv.pszVal) && strchr(dbv.pszVal, '/') == NULL) {
strcpy(msgType, "groupchat");
- } else if (DBGetContactSettingByte(hContact, m_szModuleName, "bChat", FALSE)) {
+ } else if (db_get_b(hContact, m_szModuleName, "bChat", FALSE)) {
strcpy(msgType, "privchat");
} else {
strcpy(msgType, "chat");
}
- if (!strcmp(msgType, "groupchat") || DBGetContactSettingByte(NULL, m_szModuleName, "MsgAck", FALSE) == FALSE) {
+ if (!strcmp(msgType, "groupchat") || db_get_b(NULL, m_szModuleName, "MsgAck", FALSE) == FALSE) {
SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
tdata->proto = this;
tdata->hContact = hContact;
@@ -660,7 +660,7 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg) }
mir_free(msgEnc);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
@@ -678,9 +678,9 @@ static INT_PTR TlenGetAvatarInfo(void *ptr, LPARAM wParam, LPARAM lParam) if (!proto->tlenOptions.enableAvatars) return GAIR_NOAVATAR;
if (AI->hContact != NULL) {
- if (!DBGetContactSetting(AI->hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(AI->hContact, proto->m_szModuleName, "jid", &dbv)) {
item = JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (item != NULL) {
downloadingAvatar = item->newAvatarDownloading;
avatarHash = item->avatarHash;
@@ -801,8 +801,8 @@ HANDLE __cdecl TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescri int id;
if (!isOnline) return 0;
-// if (DBGetContactSettingWord(ccs->hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0;
- if (DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) return 0;
+// if (db_get_w(ccs->hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0;
+ if (db_get(hContact, m_szModuleName, "jid", &dbv)) return 0;
ft = TlenFileCreateFT(this, dbv.pszVal);
for (ft->fileCount=0; ppszFiles[ft->fileCount]; ft->fileCount++);
ft->files = (char **) mir_alloc(sizeof(char *) * ft->fileCount);
@@ -823,7 +823,7 @@ HANDLE __cdecl TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescri ft->szDescription = mir_t2a(szDescription);
ft->hContact = hContact;
ft->currentFile = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
id = JabberSerialNext(this);
_snprintf(idStr, sizeof(idStr), "%d", id);
@@ -908,18 +908,18 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) hContact = (HANDLE) wParam;
szProto = GetContactProto(hContact);
if (szProto == NULL || strcmp(szProto, proto->m_szModuleName)) return 0;
-// if (DBGetContactSettingByte(hContact, proto->m_szModuleName, "ChatRoom", 0) != 0) return 0;
+// if (db_get_b(hContact, proto->m_szModuleName, "ChatRoom", 0) != 0) return 0;
// A contact's group is changed
if (!strcmp(cws->szSetting, "Group")) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- DBFreeVariant(&dbv);
- if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
+ db_free(&dbv);
+ if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
nick = JabberTextEncode(dbv.pszVal);
- DBFreeVariant(&dbv);
- } else if (!DBGetContactSetting(hContact, proto->m_szModuleName, "Nick", &dbv)) {
+ db_free(&dbv);
+ } else if (!db_get(hContact, proto->m_szModuleName, "Nick", &dbv)) {
nick = JabberTextEncode(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
nick = JabberNickFromJID(item->jid);
}
@@ -943,7 +943,7 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) }
}
else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -955,7 +955,7 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) // szProto = GetContactProto(hContact);
// if (szProto == NULL || strcmp(szProto, proto->m_szModuleName)) return 0;
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
jid = dbv.pszVal;
if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
if (cws->value.type == DBVT_DELETED) {
@@ -980,7 +980,7 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) }
if (newNick != NULL) mir_free(newNick);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
// A temporary contact has been added permanently
@@ -988,33 +988,33 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) char *jid, *nick, *pGroup;
if (cws->value.type==DBVT_DELETED || (cws->value.type==DBVT_BYTE && cws->value.bVal==0)) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
jid = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
JabberLog(proto, "Add %s permanently to list", jid);
- if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
+ if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
nick = JabberTextEncode(dbv.pszVal); //Utf8Encode
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
nick = JabberNickFromJID(jid);
}
if (nick != NULL) {
JabberLog(proto, "jid=%s nick=%s", jid, nick);
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if (!db_get(hContact, "CList", "Group", &dbv)) {
if ((pGroup=TlenGroupEncode(dbv.pszVal)) != NULL) {
JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, jid, pGroup);
JabberSend(proto, "<presence to='%s' type='subscribe'/>", jid);
mir_free(pGroup);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'/></query></iq>", nick, jid);
JabberSend(proto, "<presence to='%s' type='subscribe'/>", jid);
}
mir_free(nick);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
}
mir_free(jid);
}
@@ -1036,7 +1036,7 @@ int JabberContactDeleted(void *ptr, WPARAM wParam, LPARAM lParam) szProto = GetContactProto((HANDLE)wParam);
if (szProto == NULL || strcmp(szProto, proto->m_szModuleName))
return 0;
- if (!DBGetContactSetting((HANDLE) wParam, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get((HANDLE) wParam, proto->m_szModuleName, "jid", &dbv)) {
char *jid, *p, *q;
jid = dbv.pszVal;
@@ -1049,7 +1049,7 @@ int JabberContactDeleted(void *ptr, WPARAM wParam, LPARAM lParam) JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item jid='%s' subscription='remove'/></query></iq>", jid);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -1060,7 +1060,7 @@ int __cdecl TlenProtocol::UserIsTyping(HANDLE hContact, int type) JABBER_LIST_ITEM *item;
if (!isOnline) return 0;
- if (!DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL /*&& item->wantComposingEvent == TRUE*/) {
switch (type) {
case PROTOTYPE_SELFTYPING_OFF:
@@ -1071,7 +1071,7 @@ int __cdecl TlenProtocol::UserIsTyping(HANDLE hContact, int type) break;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -1282,15 +1282,15 @@ TlenProtocol::TlenProtocol( const char* aProtoName, const TCHAR* aUserName ) DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, m_szModuleName, "LoginServer", &dbv)) {
- DBFreeVariant(&dbv);
+ if (!db_get(NULL, m_szModuleName, "LoginServer", &dbv)) {
+ db_free(&dbv);
} else {
- DBWriteContactSettingString(NULL, m_szModuleName, "LoginServer", "tlen.pl");
+ db_set_s(NULL, m_szModuleName, "LoginServer", "tlen.pl");
}
- if (!DBGetContactSetting(NULL, m_szModuleName, "ManualHost", &dbv)) {
- DBFreeVariant(&dbv);
+ if (!db_get(NULL, m_szModuleName, "ManualHost", &dbv)) {
+ db_free(&dbv);
} else {
- DBWriteContactSettingString(NULL, m_szModuleName, "ManualHost", "s1.tlen.pl");
+ db_set_s(NULL, m_szModuleName, "ManualHost", "s1.tlen.pl");
}
TlenLoadOptions(this);
diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp index 3b93aa51d5..31fb47a10f 100644 --- a/protocols/Tlen/src/jabber_thread.cpp +++ b/protocols/Tlen/src/jabber_thread.cpp @@ -133,12 +133,12 @@ void __cdecl JabberServerThread(ThreadData *info) info->proto->threadData = info;
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
strncpy(info->username, dbv.pszVal, sizeof(info->username));
info->username[sizeof(info->username)-1] = '\0';
_strlwr(info->username);
- DBWriteContactSettingString(NULL, info->proto->m_szModuleName, "LoginName", info->username);
- DBFreeVariant(&dbv);
+ db_set_s(NULL, info->proto->m_szModuleName, "LoginName", info->username);
+ db_free(&dbv);
} else {
JabberLog(info->proto, "Thread ended, login name is not configured");
@@ -146,12 +146,12 @@ void __cdecl JabberServerThread(ThreadData *info) }
if (loginErr == 0) {
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "LoginServer", &dbv)) {
strncpy(info->server, dbv.pszVal, sizeof(info->server));
info->server[sizeof(info->server)-1] = '\0';
_strlwr(info->server);
- DBWriteContactSettingString(NULL, info->proto->m_szModuleName, "LoginServer", info->server);
- DBFreeVariant(&dbv);
+ db_set_s(NULL, info->proto->m_szModuleName, "LoginServer", info->server);
+ db_free(&dbv);
} else {
JabberLog(info->proto, "Thread ended, login server is not configured");
loginErr = LOGINERR_NONETWORK;
@@ -178,11 +178,11 @@ void __cdecl JabberServerThread(ThreadData *info) loginErr = LOGINERR_BADUSERID;
}
} else {
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "Password", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
strncpy(info->password, dbv.pszVal, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
JabberLog(info->proto, "Thread ended, password is not configured");
loginErr = LOGINERR_BADUSERID;
@@ -207,14 +207,14 @@ void __cdecl JabberServerThread(ThreadData *info) }
_snprintf(jidStr, sizeof(jidStr), "%s@%s", info->username, info->server);
- DBWriteContactSettingString(NULL, info->proto->m_szModuleName, "jid", jidStr);
+ db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr);
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost));
info->manualHost[sizeof(info->manualHost)-1] = '\0';
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- info->port = DBGetContactSettingWord(NULL, info->proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT);
+ info->port = db_get_w(NULL, info->proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT);
info->useEncryption = info->proto->tlenOptions.useEncryption;
if (info->manualHost[0])
@@ -225,11 +225,11 @@ void __cdecl JabberServerThread(ThreadData *info) JabberLog(info->proto, "Thread server='%s' port='%d'", connectHost, info->port);
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) {
strcpy(info->proto->threadData->avatarHash, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- info->avatarFormat = DBGetContactSettingDword(NULL, info->proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
+ info->avatarFormat = db_get_dw(NULL, info->proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
reconnectMaxTime = 10;
@@ -367,8 +367,8 @@ void __cdecl JabberServerThread(ThreadData *info) while (hContact != NULL) {
str = GetContactProto(hContact);
if (str != NULL && !strcmp(str, info->proto->m_szModuleName)) {
- if (DBGetContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- DBWriteContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
}
hContact = db_find_next(hContact);
@@ -810,20 +810,20 @@ static void JabberProcessIq(XmlNode *node, ThreadData *info) // Add the jid (with empty resource) to Miranda contact list.
hContact = JabberDBCreateContact(info->proto, jid, nick, FALSE);
}
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
if ((groupNode=JabberXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
JabberContactListCreateGroup(item->group);
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
+ db_set_s(hContact, "CList", "Group", item->group);
}
else {
item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
if (!strcmp(str, "none") || (!strcmp(str, "from") && strchr(jid, '@') != NULL)) {
- if (DBGetContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
}
else {
@@ -842,8 +842,8 @@ static void JabberProcessIq(XmlNode *node, ThreadData *info) // remove, so that history will be retained.
if (!strcmp(str, "remove")) {
if ((hContact=JabberHContactFromJID(info->proto, jid)) != NULL) {
- if (DBGetContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
JabberListRemove(info->proto, LIST_ROSTER, jid);
}
}
@@ -1087,7 +1087,7 @@ static void TlenProcessM(XmlNode *node, ThreadData *info) /* MUC private message */
str = JabberResourceFromJID(f);
hContact = JabberDBCreateContact(info->proto, f, str, TRUE);
- DBWriteContactSettingByte(hContact, info->proto->m_szModuleName, "bChat", TRUE);
+ db_set_b(hContact, info->proto->m_szModuleName, "bChat", TRUE);
mir_free(str);
localMessage = JabberTextDecode(bNode->text);
recv.flags = 0;
@@ -1146,18 +1146,18 @@ static void TlenMailPopup(TlenProtocol *proto, char *title, char *emailInfo) {
if ( !ServiceExists(MS_POPUP_ADDPOPUP))
return;
- if (!DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE))
+ if (!db_get_b(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE))
return;
POPUPDATA ppd = { 0 };
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIL));
strcpy(ppd.lpzContactName, title);
strcpy(ppd.lpzText, emailInfo);
- ppd.colorBack = DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupBack", 0);
- ppd.colorText = DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupText", 0);
- BYTE delayMode = DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
+ ppd.colorBack = db_get_dw(NULL, proto->m_szModuleName, "MailPopupBack", 0);
+ ppd.colorText = db_get_dw(NULL, proto->m_szModuleName, "MailPopupText", 0);
+ BYTE delayMode = db_get_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
if (delayMode == 1)
- ppd.iSeconds = DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupDelay", 4);
+ ppd.iSeconds = db_get_dw(NULL, proto->m_szModuleName, "MailPopupDelay", 4);
else if (delayMode == 2)
ppd.iSeconds = -1;
PUAddPopUp(&ppd);
@@ -1281,12 +1281,12 @@ static void TlenProcessP(XmlNode *node, ThreadData *info) n = mir_strdup(Translate("Private conference"));// JabberNickFromJID(f);
}
sprintf(jid, "%s/%s", f, info->username);
-// if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
+// if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
// always real username
// sprintf(jid, "%s/%s", f, dbv.pszVal);
TlenMUCCreateWindow(info->proto, f, n, 0, NULL, id);
TlenMUCRecvPresence(info->proto, jid, ID_STATUS_ONLINE, flags, k);
-// DBFreeVariant(&dbv);
+// db_free(&dbv);
// }
mir_free(n);
}
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 4b392137e0..495a89a0ee 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -119,55 +119,28 @@ static void TlenRegisterIcons() int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact;
- DBVARIANT dbv;
- CLISTMENUITEM clmi = { sizeof(clmi) };
- JABBER_LIST_ITEM *item;
+ HANDLE hContact = (HANDLE)wParam;
TlenProtocol *proto = (TlenProtocol *)ptr;
- if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- if (item->subscription == SUB_NONE || item->subscription == SUB_FROM)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
-
- if (item->subscription == SUB_NONE || item->subscription == SUB_TO)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
-
- if (item->status != ID_STATUS_OFFLINE)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
-
- if (item->status != ID_STATUS_OFFLINE && !TlenVoiceIsInUse(proto))
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
-
- if (item->status != ID_STATUS_OFFLINE)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuPicture, (LPARAM) &clmi);
-
- DBFreeVariant(&dbv);
+ if (hContact != NULL && proto->isOnline) {
+ DBVARIANT dbv;
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ JABBER_LIST_ITEM *item = JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal);
+ db_free(&dbv);
+ if (item != NULL) {
+ Menu_ShowItem(proto->hMenuContactRequestAuth, item->subscription == SUB_NONE || item->subscription == SUB_FROM);
+ Menu_ShowItem(proto->hMenuContactGrantAuth, item->subscription == SUB_NONE || item->subscription == SUB_TO);
+ Menu_ShowItem(proto->hMenuContactMUC, item->status != ID_STATUS_OFFLINE);
+ Menu_ShowItem(proto->hMenuContactVoice, item->status != ID_STATUS_OFFLINE && !TlenVoiceIsInUse(proto));
+ Menu_ShowItem(proto->hMenuPicture, item->status != ID_STATUS_OFFLINE);
return 0;
}
- DBFreeVariant(&dbv);
}
}
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
+
+ Menu_ShowItem(proto->hMenuContactMUC, false);
+ Menu_ShowItem(proto->hMenuContactVoice, false);
+ Menu_ShowItem(proto->hMenuContactRequestAuth, false);
+ Menu_ShowItem(proto->hMenuContactGrantAuth, false);
return 0;
}
@@ -177,9 +150,9 @@ INT_PTR TlenContactMenuHandleRequestAuth(void *ptr, LPARAM wParam, LPARAM lParam DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<presence to='%s' type='subscribe'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -191,9 +164,9 @@ INT_PTR TlenContactMenuHandleGrantAuth(void *ptr, LPARAM wParam, LPARAM lParam) DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<presence to='%s' type='subscribed'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -220,15 +193,15 @@ INT_PTR TlenMenuHandleInbox(void *ptr, LPARAM wParam, LPARAM lParam) char form[1024];
char cookie[1024];
TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
login = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE) == TRUE) {
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv)) {
+ if (db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE) == TRUE) {
+ if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else if (proto->threadData != NULL && strlen(proto->threadData->password) > 0) {
password = mir_strdup(proto->threadData->password);
@@ -287,8 +260,8 @@ int TlenOnModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam) while (hContact != NULL) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(szProto, proto->m_szModuleName)) {
- if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
}
hContact = db_find_next(hContact);
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index f6460e905b..1df8c8836d 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -50,7 +50,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, JABBER_LIST_ITEM *item, TCHAR* p } else if (proto->threadData != NULL) {
format = proto->threadData->avatarFormat;
} else {
- format = DBGetContactSettingDword(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
+ format = db_get_dw(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
}
tszFileType = TEXT("png");
switch(format) {
@@ -81,9 +81,9 @@ static void RemoveAvatar(TlenProtocol *proto, HANDLE hContact) { }
TlenGetAvatarFileName( proto, NULL, tFileName, sizeof tFileName );
DeleteFile(tFileName);
- DBDeleteContactSetting(hContact, "ContactPhoto", "File");
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "AvatarHash");
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "AvatarFormat");
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, proto->m_szModuleName, "AvatarHash");
+ db_unset(hContact, proto->m_szModuleName, "AvatarFormat");
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
@@ -118,9 +118,9 @@ static void SetAvatar(TlenProtocol *proto, HANDLE hContact, JABBER_LIST_ITEM *it if ( out != NULL ) {
fwrite( data, len, 1, out );
fclose( out );
- DBWriteContactSettingTString(hContact, "ContactPhoto", "File", filename );
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "AvatarHash", md5);
- DBWriteContactSettingDword(hContact, proto->m_szModuleName, "AvatarFormat", format);
+ db_set_ts(hContact, "ContactPhoto", "File", filename );
+ db_set_s(hContact, proto->m_szModuleName, "AvatarHash", md5);
+ db_set_dw(hContact, proto->m_szModuleName, "AvatarFormat", format);
}
ProtoBroadcastAck( proto->m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL , 0);
}
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp index d28c4ed37b..c43ee11edd 100644 --- a/protocols/Tlen/src/tlen_muc.cpp +++ b/protocols/Tlen/src/tlen_muc.cpp @@ -72,9 +72,9 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) char jid[256];
HANDLE hContact;
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (((hContact=JabberHContactFromJID(proto, jid)) != NULL) || !strcmp(id, proto->threadData->username)) {
ZeroMemory(&ci, sizeof(ci));
ci.cbSize = sizeof(ci);
@@ -250,14 +250,14 @@ static int TlenMUCHandleEvent(void *ptr, WPARAM wParam, LPARAM lParam) char str[256];
sprintf(str, "%s/%s", mucce->pszID, nick);
hContact = JabberDBCreateContact(proto, str, nick, TRUE); //(char *)mucce->pszUID
- DBWriteContactSettingByte(hContact, proto->m_szModuleName, "bChat", TRUE);
+ db_set_b(hContact, proto->m_szModuleName, "bChat", TRUE);
CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
} else {
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
char str[512];
_snprintf(str, sizeof(str), "%s@%s", nick, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
hContact = JabberDBCreateContact(proto, str, nick, TRUE);
CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
}
@@ -277,7 +277,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r char *nick;
int ignore, ask, groupChatPolicy;
if (roomId == NULL) return 1;
- groupChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "GroupChatPolicy", 0);
+ groupChatPolicy = db_get_w(NULL, proto->m_szModuleName, "GroupChatPolicy", 0);
ask = TRUE;
ignore = FALSE;
if (groupChatPolicy == TLEN_MUC_ASK) {
@@ -288,9 +288,9 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r } else if (groupChatPolicy == TLEN_MUC_IGNORE_NIR) {
char jid[256];
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -300,9 +300,9 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r char jid[256];
JABBER_LIST_ITEM *item;
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -961,12 +961,12 @@ static void __cdecl TlenMUCCSendQueryResultThread(void *ptr) while (hContact != NULL) {
char *str = GetContactProto(hContact);
if (str != NULL && !strcmp(str, threadData->proto->m_szModuleName)) {
- if (!DBGetContactSettingByte(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
- if (!DBGetContactSetting(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get_b(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
+ if (!db_get(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
if (strcmp(dbv.pszVal, "b73@tlen.pl")) {
queryResult.iItemsNum++;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -979,14 +979,14 @@ static void __cdecl TlenMUCCSendQueryResultThread(void *ptr) while (hContact != NULL) {
char *baseProto = GetContactProto(hContact);
if (baseProto != NULL && !strcmp(baseProto, threadData->proto->m_szModuleName)) {
- if (!DBGetContactSettingByte(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
- if (!DBGetContactSetting(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get_b(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
+ if (!db_get(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
if (strcmp(dbv.pszVal, "b73@tlen.pl")) {
queryResult.pItems[queryResult.iItemsNum].pszID = mir_strdup(dbv.pszVal);
queryResult.pItems[queryResult.iItemsNum].pszName = mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
queryResult.iItemsNum++;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -1056,13 +1056,13 @@ INT_PTR TlenMUCContactMenuHandleMUC(void *ptr, LPARAM wParam, LPARAM lParam) return 1;
}
if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char serialId[32];
sprintf(serialId, JABBER_IQID"%d", JabberSerialNext(proto));
item = JabberListAdd(proto, LIST_INVITATIONS, serialId);
item->nick = mir_strdup(dbv.pszVal);
JabberSend(proto, "<p to='c' tp='c' id='%s'/>", serialId);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index 7c1f706d49..308079097c 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -466,27 +466,27 @@ JABBER_SOCKET TlenP2PListen(TLEN_FILE_TRANSFER *ft) if (ft->localName != NULL) mir_free(ft->localName);
ft->localName = NULL;
ft->wPort = 0;
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseFileProxy", FALSE)) {
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
+ if (db_get_b(NULL, proto->m_szModuleName, "UseFileProxy", FALSE)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
strcpy(sb.szHost, dbv.pszVal);
- DBFreeVariant(&dbv);
- sb.wPort = DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyPort", 0);
+ db_free(&dbv);
+ sb.wPort = db_get_w(NULL, proto->m_szModuleName, "FileProxyPort", 0);
sb.useAuth = FALSE;
strcpy(sb.szUser, "");
strcpy(sb.szPassword, "");
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) {
+ if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) {
sb.useAuth = TRUE;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
strcpy(sb.szUser, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
strcpy(sb.szPassword, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
- switch (DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyType", 0)) {
+ switch (db_get_w(NULL, proto->m_szModuleName, "FileProxyType", 0)) {
case 0: // forwarding
useProxy = 1;
break;
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index d61842d8dd..c0233ee233 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -256,7 +256,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) {
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char *jid = dbv.pszVal;
char szFilter[512];
char *szFileName = (char*) mir_alloc(_MAX_PATH);
@@ -314,7 +314,7 @@ BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) { fclose(fp);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return FALSE;
}
diff --git a/protocols/Tlen/src/tlen_presence.cpp b/protocols/Tlen/src/tlen_presence.cpp index 7dc15f41f6..1207857241 100644 --- a/protocols/Tlen/src/tlen_presence.cpp +++ b/protocols/Tlen/src/tlen_presence.cpp @@ -73,19 +73,19 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) p = NULL; JabberListAddResource(proto, LIST_ROSTER, from, status, statusNode?p:NULL); if (p) { - DBWriteContactSettingString(hContact, "CList", "StatusMsg", p); + db_set_s(hContact, "CList", "StatusMsg", p); mir_free(p); } else { - DBDeleteContactSetting(hContact, "CList", "StatusMsg"); + db_unset(hContact, "CList", "StatusMsg"); } // Determine status to show for the contact and request version information if (item != NULL) { laststatus = item->status; item->status = status; } - if (strchr(from, '@') != NULL || DBGetContactSettingByte(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { - if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) - DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", (WORD) status); + if (strchr(from, '@') != NULL || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { + if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) + db_set_w(hContact, proto->m_szModuleName, "Status", (WORD) status); } if (item != NULL) { if (!item->infoRequested) { @@ -122,9 +122,9 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) JabberListAddResource(proto, LIST_ROSTER, from, status, p); if ((hContact=JabberHContactFromJID(proto, from)) != NULL) { if (p) { - DBWriteContactSettingString(hContact, "CList", "StatusMsg", p); + db_set_s(hContact, "CList", "StatusMsg", p); } else { - DBDeleteContactSetting(hContact, "CList", "StatusMsg"); + db_unset(hContact, "CList", "StatusMsg"); } } if (p) mir_free(p); @@ -136,9 +136,9 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) item->infoRequested = FALSE; } if ((hContact=JabberHContactFromJID(proto, from)) != NULL) { - if (strchr(from, '@') != NULL || DBGetContactSettingByte(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { - if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) - DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", (WORD) status); + if (strchr(from, '@') != NULL || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { + if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) + db_set_w(hContact, proto->m_szModuleName, "Status", (WORD) status); } if (item != NULL && item->isTyping) { item->isTyping = FALSE; @@ -214,8 +214,8 @@ static void JabberSendPresenceTo(TlenProtocol *proto, int status, char *to) break; case ID_STATUS_OFFLINE: presenceType = "unavailable"; - if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "LeaveOfflineMessage", FALSE)) { - int offlineMessageOption = DBGetContactSettingWord(NULL, proto->m_szModuleName, "OfflineMessageOption", 0); + if (db_get_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", FALSE)) { + int offlineMessageOption = db_get_w(NULL, proto->m_szModuleName, "OfflineMessageOption", 0); if (offlineMessageOption == 0) { switch (proto->m_iStatus) { case ID_STATUS_ONLINE: @@ -245,11 +245,11 @@ static void JabberSendPresenceTo(TlenProtocol *proto, int status, char *to) } else if (offlineMessageOption < 7) { DBVARIANT dbv; const char *statusNames[] = {"OnDefault", "AwayDefault", "NaDefault", "DndDefault", "FreeChatDefault", "InvDefault"}; - if (!DBGetContactSetting(NULL, "SRAway", statusNames[offlineMessageOption-1], &dbv)) { + if (!db_get(NULL, "SRAway", statusNames[offlineMessageOption-1], &dbv)) { int i; char substituteStr[128]; ptr = mir_strdup(dbv.pszVal); - DBFreeVariant(&dbv); + db_free(&dbv); for (i=0;ptr[i];i++) { if (ptr[i] != '%') continue; if (!_strnicmp(ptr+i,"%time%",6)) diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp index 25f2858d8a..933841fd3f 100644 --- a/protocols/Tlen/src/tlen_userinfo.cpp +++ b/protocols/Tlen/src/tlen_userinfo.cpp @@ -191,35 +191,35 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, _T(""));
SetFocus(GetDlgItem(hwndDlg, IDC_STATIC));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "FirstName", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "FirstName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FIRSTNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_FIRSTNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "LastName", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "LastName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_LASTNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_LASTNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "Nick", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "Nick", &dbv)) {
SetDlgItemText(hwndDlg, IDC_NICKNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_NICKNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "e-mail", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "e-mail", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EMAIL, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_EMAIL, _T(""));
- if (!DBGetContactSetting(data->hContact, data->proto->m_szModuleName, "Age", &dbv)) {
+ if (!db_get(data->hContact, data->proto->m_szModuleName, "Age", &dbv)) {
SetDlgItemInt(hwndDlg, IDC_AGE, dbv.wVal, FALSE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_AGE, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "City", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "City", &dbv)) {
SetDlgItemText(hwndDlg, IDC_CITY, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_CITY, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "School", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "School", &dbv)) {
SetDlgItemText(hwndDlg, IDC_SCHOOL, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_SCHOOL, _T(""));
- switch (DBGetContactSettingByte(data->hContact, data->proto->m_szModuleName, "Gender", '?')) {
+ switch (db_get_b(data->hContact, data->proto->m_szModuleName, "Gender", '?')) {
case 'M':
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 1, 0);
SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, TranslateTS(tlenFieldGender[0].name));
@@ -233,7 +233,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, _T(""));
break;
}
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "Occupation", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "Occupation", 0);
if (i>0 && i<13) {
SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, TranslateTS(tlenFieldOccupation[i-1].name));
SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, i, 0);
@@ -241,7 +241,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, _T(""));
SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, 0, 0);
}
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "LookingFor", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "LookingFor", 0);
if (i>0 && i<6) {
SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, TranslateTS(tlenFieldLookfor[i-1].name));
SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, i, 0);
@@ -249,11 +249,11 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, _T(""));
SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, 0, 0);
}
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "VoiceChat", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "VoiceChat", 0);
CheckDlgButton(hwndDlg, IDC_VOICECONVERSATIONS, i);
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "PublicStatus", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "PublicStatus", 0);
CheckDlgButton(hwndDlg, IDC_PUBLICSTATUS, i);
- if (!DBGetContactSetting(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
jid = JabberTextDecode(dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_INFO_JID, jid);
mir_free(jid);
@@ -281,7 +281,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, TranslateT("not on roster"));
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
break;
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index c476d55116..cd8b7dda3b 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -131,7 +131,7 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) control->waveHeadersPos = 0;
control->waveHeadersNum = FRAMES_AVAILABLE_MAX_LIMIT + 2;
- j = DBGetContactSettingWord(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0);
+ j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0);
iSelDev = WAVE_MAPPER;
if (j != 0) {
iNumDevs = waveOutGetNumDevs();
@@ -198,7 +198,7 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) SetThreadPriority(control->hThread, THREAD_PRIORITY_ABOVE_NORMAL);
- j = DBGetContactSettingWord(NULL, control->proto->m_szModuleName, "VoiceDeviceIn", 0);
+ j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceIn", 0);
iSelDev = WAVE_MAPPER;
if (j != 0) {
iNumDevs = waveInGetNumDevs();
@@ -708,7 +708,7 @@ INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, LPARAM wParam, LPARAM lParam) return 1;
}
if ((hContact=(HANDLE) wParam) != NULL) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char serialId[32];
sprintf(serialId, "%d", JabberSerialNext(proto));
if ((item = JabberListAdd(proto, LIST_VOICE, serialId)) != NULL) {
@@ -720,7 +720,7 @@ INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, LPARAM wParam, LPARAM lParam) TlenVoiceStart(ft, 2);
JabberSend(ft->proto, "<v t='%s' e='1' i='%s' v='1'/>", ft->jid, serialId);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -953,9 +953,9 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) char jid[256];
HANDLE hContact;
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
return mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
}
@@ -1025,7 +1025,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) int ask, ignore, voiceChatPolicy;
ask = TRUE;
ignore = FALSE;
- voiceChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceChatPolicy", 0);
+ voiceChatPolicy = db_get_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", 0);
if (voiceChatPolicy == TLEN_MUC_ASK) {
ignore = FALSE;
ask = TRUE;
@@ -1034,9 +1034,9 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) } else if (voiceChatPolicy == TLEN_MUC_IGNORE_NIR) {
char jid[256];
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -1045,9 +1045,9 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) } else if (voiceChatPolicy == TLEN_MUC_ACCEPT_IR) {
char jid[256];
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -1095,7 +1095,7 @@ int TlenVoiceBuildInDeviceList(TlenProtocol *proto, HWND hWnd) }
}
}
- i = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceIn", 0);
+ i = db_get_w(NULL, proto->m_szModuleName, "VoiceDeviceIn", 0);
if (i>j) i = 0;
SendMessage(hWnd, CB_SETCURSEL, i, 0);
return 0;
@@ -1114,7 +1114,7 @@ int TlenVoiceBuildOutDeviceList(TlenProtocol *proto, HWND hWnd) }
}
}
- i = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceOut", 0);
+ i = db_get_w(NULL, proto->m_szModuleName, "VoiceDeviceOut", 0);
if (i>j) i = 0;
SendMessage(hWnd, CB_SETCURSEL, i, 0);
return 0;
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index 5d866160aa..7c55bfaa98 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -48,7 +48,7 @@ HANDLE GetIconHandle(const char* name) }
// Contact List menu stuff
-static HANDLE g_hMenuItems[2];
+static HGENMENU g_hMenuItems[2];
static HANDLE g_hMenuEvts[3];
// Helper functions
@@ -115,12 +115,5 @@ void UninitContactMenus() void ShowContactMenus(bool show)
{
for(size_t i=0; i<SIZEOF(g_hMenuItems); i++)
- {
- CLISTMENUITEM item = { sizeof(item) };
- item.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- if(!show)
- item.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM,reinterpret_cast<WPARAM>(g_hMenuItems[i]),reinterpret_cast<LPARAM>(&item));
- }
+ Menu_ShowItem(g_hMenuItems[i], show);
}
\ No newline at end of file diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index a3354d88f1..6b2e6c43d7 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -101,12 +101,12 @@ void Xfire_base::readStringfromDB(char*name,unsigned int dbid,char**to) //wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- if(!DBGetContactSettingString(NULL, protocolname, temp,&dbv))
+ if(!db_get_s(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
//dbval wieder freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -119,12 +119,12 @@ void Xfire_base::readStringfromDB(char*name,unsigned int dbid,int id,char**to) //wert aus der dblesen
sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
- if(!DBGetContactSettingString(NULL, protocolname, temp,&dbv))
+ if(!db_get_s(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
//dbval wieder freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -142,7 +142,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,char**to) //string setzen
setString(dbv.pszVal,to);
//dbval wieder freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -160,7 +160,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,int id,char**t //string setzen
setString(dbv.pszVal,to);
//dbval wieder freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -174,7 +174,7 @@ void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,int id,char*val) //wert aus der dblesen
sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
- DBWriteContactSettingString(NULL, protocolname, temp,val);
+ db_set_s(NULL, protocolname, temp,val);
}
//schreibt einen stringval in die db welche unterid hat
@@ -186,7 +186,7 @@ void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,char*val) //wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- DBWriteContactSettingString(NULL, protocolname, temp,val);
+ db_set_s(NULL, protocolname, temp,val);
}
//schreibt einen stringval in die db welche unterid hat
@@ -223,7 +223,7 @@ void Xfire_base::writeBytetoDB(char*name,unsigned int dbid,int val) //wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- DBWriteContactSettingByte(NULL, protocolname, temp, val);
+ db_set_b(NULL, protocolname, temp, val);
}
//schreibt einen wordwert in die db
@@ -235,7 +235,7 @@ void Xfire_base::writeWordtoDB(char*name,unsigned int dbid,int val) //wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- DBWriteContactSettingWord(NULL, protocolname, temp, val);
+ db_set_w(NULL, protocolname, temp, val);
}
@@ -248,7 +248,7 @@ unsigned char Xfire_base::readBytefromDB(char*name,unsigned int dbid,int default //wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- return DBGetContactSettingByte(NULL, protocolname, temp, defaultval);
+ return db_get_b(NULL, protocolname, temp, defaultval);
}
//liest einen wordval aus der db und gibt es zurück
@@ -260,7 +260,7 @@ unsigned int Xfire_base::readWordfromDB(char*name,unsigned int dbid,int defaultv //wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- return DBGetContactSettingWord(NULL, protocolname, temp, defaultval);
+ return db_get_w(NULL, protocolname, temp, defaultval);
}
//entfernt einen dbeintrag
@@ -274,10 +274,10 @@ BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid) sprintf_s(temp,128,"%s_%i",name,dbid);
//eintrag entfernen
- if(!DBGetContactSetting(NULL, protocolname, temp,&dbv))
+ if(!db_get(NULL, protocolname, temp,&dbv))
{
- DBFreeVariant(&dbv);
- DBDeleteContactSetting(NULL, protocolname, temp);
+ db_free(&dbv);
+ db_unset(NULL, protocolname, temp);
return TRUE;
}
@@ -295,10 +295,10 @@ BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid,int id) sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
//eintrag entfernen
- if(!DBGetContactSetting(NULL, protocolname, temp,&dbv))
+ if(!db_get(NULL, protocolname, temp,&dbv))
{
- DBFreeVariant(&dbv);
- DBDeleteContactSetting(NULL, protocolname, temp);
+ db_free(&dbv);
+ db_unset(NULL, protocolname, temp);
return TRUE;
}
@@ -507,9 +507,9 @@ BOOL Xfire_base::getGamename(unsigned int gameid,char* out,int outsize){ DBVARIANT dbv;
char dbstr[80]="";
sprintf_s(dbstr,XFIRE_MAXSIZEOFGAMENAME,"customgamename_%d",gameid);
- if(!DBGetContactSetting(NULL,protocolname,dbstr,&dbv)) {
+ if(!db_get(NULL,protocolname,dbstr,&dbv)) {
sprintf_s(out,outsize,"%s",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return TRUE;
}
else
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index 196584b580..bd8e2b0e2a 100644 --- a/protocols/Xfire/src/Xfire_game.cpp +++ b/protocols/Xfire/src/Xfire_game.cpp @@ -471,14 +471,6 @@ void Xfire_game::remoteMenuitem() //aktualisiert menüpunkt ob hidden
void Xfire_game::refreshMenuitem()
{
- if(menuhandle!=NULL)
- {
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
-
- if(this->notinstartmenu)
- mi.flags|= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )menuhandle, ( LPARAM )&mi );
- }
+ if(menuhandle != NULL)
+ Menu_ShowItem(menuhandle, !this->notinstartmenu);
}
\ No newline at end of file diff --git a/protocols/Xfire/src/Xfire_game.h b/protocols/Xfire/src/Xfire_game.h index 56a0e6e6e7..8fa5c7f5a2 100644 --- a/protocols/Xfire/src/Xfire_game.h +++ b/protocols/Xfire/src/Xfire_game.h @@ -44,7 +44,7 @@ public: //id des spiels
unsigned int id;
//handle des menuitems
- HANDLE menuhandle;
+ HGENMENU menuhandle;
//spiel soll bei der detection übersprungen werden
BOOL skip;
//voicehat?
diff --git a/protocols/Xfire/src/Xfire_gamelist.cpp b/protocols/Xfire/src/Xfire_gamelist.cpp index c4fb12ee20..eca9f00b13 100644 --- a/protocols/Xfire/src/Xfire_gamelist.cpp +++ b/protocols/Xfire/src/Xfire_gamelist.cpp @@ -191,7 +191,7 @@ void Xfire_gamelist::writeDatabase() }
//anzahl aktualisieren
- DBWriteContactSettingWord(NULL, protocolname, "foundgames", gamelist.size());
+ db_set_w(NULL, protocolname, "foundgames", gamelist.size());
}
//prüft ob ein game schon in der liste is
diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp index f5612e8e56..0a583a6998 100644 --- a/protocols/Xfire/src/Xfire_icon_mng.cpp +++ b/protocols/Xfire/src/Xfire_icon_mng.cpp @@ -177,7 +177,7 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { //icon vom xfire server laden
HICON Xfire_icon_mng::downloadIcon(char* shortname) {
//nur vom internetladen, wenn die option aktiv ist
- if(!DBGetContactSettingByte(NULL,protocolname,"xfiresitegameico",0))
+ if(!db_get_b(NULL,protocolname,"xfiresitegameico",0))
return NULL;
//keinen namen angegeben?
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp index a1c6483b00..d14ae6f9d5 100644 --- a/protocols/Xfire/src/Xfire_voicechat.cpp +++ b/protocols/Xfire/src/Xfire_voicechat.cpp @@ -159,27 +159,27 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) { if(packet==NULL || packet->gameid==XFIREVOICECHAT_NOVOICE) {
//einträge aus der db entfernen
- DBDeleteContactSetting(NULL,protocolname, "VServerIP");
- DBDeleteContactSetting(NULL,protocolname, "currentvoicename");
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "currentvoicename");
//zurück
return;
}
//ip speichern
sprintf_s(temp,32,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "VServerIP", temp);
+ db_set_s(NULL, protocolname, "VServerIP", temp);
//namen jeh nach id schreiben
switch(packet->gameid) {
case XFIREVOICECHAT_TS3:
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Teamspeak 3");
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak 3");
break;
case XFIREVOICECHAT_TS2:
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Teamspeak 2");
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak 2");
break;
case XFIREVOICECHAT_MUMBLE:
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Mumble");
+ db_set_s(NULL, protocolname, "currentvoicename", "Mumble");
break;
case XFIREVOICECHAT_VENTRILO:
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Ventrilo");
+ db_set_s(NULL, protocolname, "currentvoicename", "Ventrilo");
break;
};
}
diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp index 7063507879..b033b4e3bb 100644 --- a/protocols/Xfire/src/all_statusmsg.cpp +++ b/protocols/Xfire/src/all_statusmsg.cpp @@ -26,7 +26,7 @@ int statustype; BOOL BackupStatusMsg() {
DBVARIANT dbv;
- statustype=DBGetContactSettingByte(NULL,protocolname,"statuschgtype",0);
+ statustype=db_get_b(NULL,protocolname,"statuschgtype",0);
XFireLog("Backup Status Message ...");
@@ -67,7 +67,7 @@ BOOL BackupStatusMsg() { sprintf_s(ttemp,128,"%s%s",temp[i]->szModuleName,PS_SETAWAYMSG);
//xfire wird geskipped, offline prots und invs prots auch, und locked status prots auch
- if(!temp[i]->bIsEnabled||statusid==ID_STATUS_INVISIBLE||statusid==ID_STATUS_OFFLINE||!lstrcmpiA( temp[i]->szModuleName, protocolname )||!ServiceExists(ttemp)||DBGetContactSettingByte(NULL,temp[i]->szModuleName,"LockMainStatus",0)==1)
+ if(!temp[i]->bIsEnabled||statusid==ID_STATUS_INVISIBLE||statusid==ID_STATUS_OFFLINE||!lstrcmpiA( temp[i]->szModuleName, protocolname )||!ServiceExists(ttemp)||db_get_b(NULL,temp[i]->szModuleName,"LockMainStatus",0)==1)
{
XFireLog("-> Skip %s.",temp[i]->szModuleName);
@@ -87,7 +87,7 @@ BOOL BackupStatusMsg() { int caps=CallProtoService(temp[i]->szModuleName,PS_GETCAPS,PFLAGNUM_2,0);
//normale statusreihenfolge
- if(DBGetContactSettingByte(NULL,protocolname,"dndfirst",0)==0)
+ if(db_get_b(NULL,protocolname,"dndfirst",0)==0)
{
if(caps&PF2_LIGHTDND)
{
@@ -149,35 +149,35 @@ BOOL BackupStatusMsg() { switch(statusid)
{
case ID_STATUS_ONLINE:
- if(DBGetContactSetting(NULL,"SRAway","OnMsg",&dbv))
+ if(db_get(NULL,"SRAway","OnMsg",&dbv))
olstatusmsg->push_back(Translate("Yep, I'm here."));
break;
case ID_STATUS_AWAY:
- if(DBGetContactSetting(NULL,"SRAway","AwayMsg",&dbv))
+ if(db_get(NULL,"SRAway","AwayMsg",&dbv))
olstatusmsg->push_back(Translate("I've been away since %time%."));
break;
case ID_STATUS_NA:
- if(DBGetContactSetting(NULL,"SRAway","NaMsg",&dbv))
+ if(db_get(NULL,"SRAway","NaMsg",&dbv))
olstatusmsg->push_back(Translate("Give it up, I'm not in!"));
break;
case ID_STATUS_OCCUPIED:
- if(DBGetContactSetting(NULL,"SRAway","OccupiedMsg",&dbv))
+ if(db_get(NULL,"SRAway","OccupiedMsg",&dbv))
olstatusmsg->push_back(Translate("Not right now."));
break;
case ID_STATUS_DND:
- if(DBGetContactSetting(NULL,"SRAway","DndMsg",&dbv))
+ if(db_get(NULL,"SRAway","DndMsg",&dbv))
olstatusmsg->push_back(Translate("Give a guy some peace, would ya?"));
break;
case ID_STATUS_FREECHAT:
- if(DBGetContactSetting(NULL,"SRAway","FreeChatMsg",&dbv))
+ if(db_get(NULL,"SRAway","FreeChatMsg",&dbv))
olstatusmsg->push_back(Translate("Well, I would talk to you if Miranda ICQ supported chat"));
break;
case ID_STATUS_ONTHEPHONE:
- if(DBGetContactSetting(NULL,"SRAway","OtpMsg",&dbv))
+ if(db_get(NULL,"SRAway","OtpMsg",&dbv))
olstatusmsg->push_back(Translate("That'll be the phone."));
break;
case ID_STATUS_OUTTOLUNCH:
- if(DBGetContactSetting(NULL,"SRAway","OtlMsg",&dbv))
+ if(db_get(NULL,"SRAway","OtlMsg",&dbv))
olstatusmsg->push_back(Translate("Mmm...food."));
break;
default:
@@ -195,7 +195,7 @@ BOOL BackupStatusMsg() { olstatusmsg->push_back(string(dbv.pszVal));
protoname->push_back(temp[i]->szModuleName);
//freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
protoname->push_back(temp[i]->szModuleName);
@@ -216,23 +216,23 @@ BOOL SetGameStatusMsg() if (ServiceExists(MS_VARS_FORMATSTRING))
{
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,"setstatusmsg",&dbv)) {
+ if(!db_get(NULL,protocolname,"setstatusmsg",&dbv)) {
//direkte funktionen verwenden
statusmsg = variables_parse(dbv.pszVal,NULL,0);
if (statusmsg == NULL)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return FALSE;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
{
//alternativ zweig ohne variables
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,"setstatusmsg",&dbv)) {
+ if(!db_get(NULL,protocolname,"setstatusmsg",&dbv)) {
DBVARIANT dbv3;
@@ -242,37 +242,37 @@ BOOL SetGameStatusMsg() //mit den vars ersetzen beginnen
//derzeitiges spiel
- if(!DBGetContactSetting(NULL,protocolname, "currentgamename",&dbv3))
+ if(!db_get(NULL,protocolname, "currentgamename",&dbv3))
{
xgamelist.strreplace("%myxfiregame%",dbv3.pszVal,&statusmsg);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
else
xgamelist.strreplace("%myxfiregame%","",&statusmsg);
//derzeitiges voiceprogram
- if(!DBGetContactSetting(NULL,protocolname, "currentvoicename",&dbv3))
+ if(!db_get(NULL,protocolname, "currentvoicename",&dbv3))
{
xgamelist.strreplace("%myxfirevoice%",dbv3.pszVal,&statusmsg);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
else
xgamelist.strreplace("%myxfirevoice%","",&statusmsg);
//derzeitige voiceip
- if(!DBGetContactSetting(NULL,protocolname, "VServerIP",&dbv3))
+ if(!db_get(NULL,protocolname, "VServerIP",&dbv3))
{
xgamelist.strreplace("%myxfirevoiceip%",dbv3.pszVal,&statusmsg);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
else
xgamelist.strreplace("%myxfirevoiceip%","",&statusmsg);
//derzeitige gameip
- if(!DBGetContactSetting(NULL,protocolname, "ServerIP",&dbv3))
+ if(!db_get(NULL,protocolname, "ServerIP",&dbv3))
{
xgamelist.strreplace("%myxfireserverip%",dbv3.pszVal,&statusmsg);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
else
xgamelist.strreplace("%myxfireserverip%","",&statusmsg);
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp index b26d07266a..d2ae949d7a 100644 --- a/protocols/Xfire/src/buddylist.cpp +++ b/protocols/Xfire/src/buddylist.cpp @@ -148,10 +148,10 @@ namespace xfirelib { char * dummy; sprintf_s(temp,255,"Clan_%d",entry->clanid); - DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,temp,&dbv))
- {
- dummy=dbv.pszVal;
+ DBVARIANT dbv; + if(!db_get(NULL,protocolname,temp,&dbv)) + { + dummy=dbv.pszVal; } else dummy=NULL; diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp index 4ccf320b9b..cc835332a4 100644 --- a/protocols/Xfire/src/iniupdater.cpp +++ b/protocols/Xfire/src/iniupdater.cpp @@ -65,7 +65,7 @@ void UpdateMyXFireIni(LPVOID dummy) { if(CheckWWWContent(request))
{
- if(DBGetContactSettingByte(NULL,protocolname,"dontaskforupdate",0)==1||DialogBox(hinstance,MAKEINTRESOURCE(IDD_UPDATE),NULL,DlgUpdateDialogProc)==IDOK)
+ if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==1||DialogBox(hinstance,MAKEINTRESOURCE(IDD_UPDATE),NULL,DlgUpdateDialogProc)==IDOK)
{
if(GetWWWContent2(request,file,FALSE))
{
@@ -74,12 +74,12 @@ void UpdateMyXFireIni(LPVOID dummy) { //derzeitige ini und sichern
rename(file2,file3);
//lösche .old, wenn aktiv
- if(DBGetContactSettingByte(NULL,protocolname,"nobackupini",0))
+ if(db_get_b(NULL,protocolname,"nobackupini",0))
remove(file3);
//neue aktiv schalten
rename(file,file2);
- if(DBGetContactSettingByte(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The xfire_games.ini was updated."));
+ if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The xfire_games.ini was updated."));
}
else
MSGBOX(Translate("Error during xfire_games Update."));
@@ -105,7 +105,7 @@ void UpdateMyIcons(LPVOID dummy) { if(CheckWWWContent(request))
{
- if(DBGetContactSettingByte(NULL,protocolname,"dontaskforupdate",0)==1||MessageBox(NULL,Translate("There is a new Icons.dll online, do you want to update now?"),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
+ if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==1||MessageBox(NULL,Translate("There is a new Icons.dll online, do you want to update now?"),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
{
if(GetWWWContent2(request,file,FALSE)) {
//altes backup löschen
@@ -113,12 +113,12 @@ void UpdateMyIcons(LPVOID dummy) { //derzeitige ini und sichern
rename(file2,file3);
//lösche .old, wenn aktiv
- if(DBGetContactSettingByte(NULL,protocolname,"nobackupini",0))
+ if(db_get_b(NULL,protocolname,"nobackupini",0))
remove(file3);
//neue aktiv schalten
rename(file,file2);
- if(DBGetContactSettingByte(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The Icons.dll was updated."));
+ if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The Icons.dll was updated."));
}
else
MSGBOX(Translate("Error during Icons.dll Update."));
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index ae7fcc07e3..0c0a76ce4b 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -98,7 +98,7 @@ HINSTANCE hinstance = NULL; int hLangpack;
HANDLE hExtraIcon1, hExtraIcon2;
HANDLE heventXStatusIconChanged;
-HANDLE copyipport,gotoclansite,vipport,joingame,startthisgame,removefriend,blockfriend;
+HGENMENU copyipport,gotoclansite,vipport,joingame,startthisgame,removefriend,blockfriend;
int foundgames=0;
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
@@ -250,10 +250,10 @@ void XFireClient::CheckAvatar(BuddyListEntry* entry) { return;
//keine avatars?
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)==0)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)==0)
{
//avatar gelocked?
- if(DBGetContactSettingByte(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
+ if(db_get_b(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
{
//avatar lade auftrag übergeben
this->avatarloader->loadAvatar(entry->hcontact,(char*)entry->username.c_str(),entry->userid);
@@ -382,7 +382,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { {
temp=0;
}
- DBWriteContactSettingByte(NULL,protocolname,xfireconfigitems[i].dbentry,temp);
+ db_set_b(NULL,protocolname,xfireconfigitems[i].dbentry,temp);
}
}
break;
@@ -494,7 +494,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { sprintf(temp,"Clan_%d",clan->clanid);
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,temp,&dbv))
+ if(!db_get(NULL,protocolname,temp,&dbv))
{
dummy=dbv.pszVal;
}
@@ -517,17 +517,17 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { char fofname[128]=LPGEN("Friends of Friends Playing");
DBVARIANT dbv;
//gruppennamen überladen
- if(!DBGetContactSetting(NULL,protocolname,"overload_fofgroupname",&dbv))
+ if(!db_get(NULL,protocolname,"overload_fofgroupname",&dbv))
{
strcpy_s(fofname,128,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
CreateGroup(Translate(fofname),"fofgroup");
HANDLE hc=handlingBuddys(entry,-1,Translate(fofname));
if(hc)
{
CheckAvatar(entry);
- DBWriteContactSettingByte(hc,protocolname,"friendoffriend",1);
+ db_set_b(hc,protocolname,"friendoffriend",1);
}
}
}
@@ -579,17 +579,10 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { }
else
{
- if(entry->game==0&&
- entry->hcontact!=0&&
- DBGetContactSettingByte(entry->hcontact,protocolname,"friendoffriend",0)==1)
- {
- DBWriteContactSettingWord(entry->hcontact,protocolname,"Status",ID_STATUS_OFFLINE);
- //CallService( MS_DB_CONTACT_DELETE, (WPARAM) entry->hcontact, 0);
- }
+ if(entry->game == 0 && entry->hcontact != 0 && db_get_b(entry->hcontact,protocolname,"friendoffriend",0)==1)
+ db_set_w(entry->hcontact,protocolname,"Status",ID_STATUS_OFFLINE);
else
- {
- handlingBuddys(entry,0,NULL);
- }
+ handlingBuddys(entry,0,NULL);
}
}
}
@@ -617,7 +610,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { InviteRequestPacket *invite = (InviteRequestPacket*)content;
//nur nich blockierte buddy's durchlassen
- if(!DBGetContactSettingByte(NULL,"XFireBlock",(char*)invite->name.c_str(),0))
+ if(!db_get_b(NULL,"XFireBlock",(char*)invite->name.c_str(),0))
{
XFireContact xfire_newc;
xfire_newc.username=(char*)invite->name.c_str();
@@ -656,12 +649,12 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { for(int i=0;i<clan->count;i++)
{
sprintf(temp,"Clan_%d",clan->clanid[i]);
- DBWriteContactSettingString(NULL, protocolname, temp, (char*)clan->name[i].c_str());
+ db_set_s(NULL, protocolname, temp, (char*)clan->name[i].c_str());
sprintf(temp,"ClanUrl_%d",clan->clanid[i]);
- DBWriteContactSettingString(NULL, protocolname, temp, (char*)clan->url[i].c_str());
+ db_set_s(NULL, protocolname, temp, (char*)clan->url[i].c_str());
- if(!DBGetContactSettingByte(NULL,protocolname,"noclangroups",0)) {
+ if(!db_get_b(NULL,protocolname,"noclangroups",0)) {
CreateGroup((char*)clan->name[i].c_str(),"mainclangroup");
}
}
@@ -676,9 +669,9 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { LoginSuccessPacket *login = (LoginSuccessPacket*)content;
char * temp = mir_utf8decode((char*)login->nick.c_str(),NULL);
//nick speichern
- DBWriteContactSettingString(NULL,protocolname,"Nick",temp);
+ db_set_s(NULL,protocolname,"Nick",temp);
//uid speichern
- DBWriteContactSettingDword(NULL,protocolname,"myuid",login->myuid);
+ db_set_dw(NULL,protocolname,"myuid",login->myuid);
this->myuid=login->myuid;
//avatar auslesen
GetBuddyInfo* buddyinfo=new GetBuddyInfo();
@@ -694,9 +687,9 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { if((unsigned int)client->protocolVersion<(unsigned int)version->newversion)
{
- DBWriteContactSettingByte(NULL,protocolname,"protover",version->newversion);
+ db_set_b(NULL,protocolname,"protover",version->newversion);
//recprotoverchg
- if(DBGetContactSettingWord(NULL,protocolname,"recprotoverchg",0)==0)
+ if(db_get_w(NULL,protocolname,"recprotoverchg",0)==0)
{
sprintf_s(temp,255,Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."),client->protocolVersion,version->newversion);
MSGBOXE(temp);
@@ -824,9 +817,9 @@ void StartIniUpdateAndDetection(LPVOID dummy) EnterCriticalSection(&connectingMutex);
//ini/ico updater, nur wenn aktiv
- if(DBGetContactSettingByte(NULL,protocolname,"autoiniupdate",0))
+ if(db_get_b(NULL,protocolname,"autoiniupdate",0))
UpdateMyXFireIni(NULL);
- if(DBGetContactSettingByte(NULL,protocolname,"autoicodllupdate",0))
+ if(db_get_b(NULL,protocolname,"autoicodllupdate",0))
UpdateMyIcons(NULL);
#ifndef NO_PTHREAD
@@ -996,7 +989,7 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) SkinAddNewSoundEx("xfirebstartgame",protocolname,LPGEN("Buddy start a game"));
//hook für mbot einfügen, nur wenn mbot option aktiv
- if(DBGetContactSettingByte(NULL,protocolname,"mbotsupport",0))
+ if(db_get_b(NULL,protocolname,"mbotsupport",0))
HookEvent(XFIRE_INGAMESTATUSHOOK, mBotNotify);
//init der extraicons wenn service vorhanden
@@ -1043,9 +1036,9 @@ int ExtraImageApply(WPARAM wparam, LPARAM lparam) HANDLE hContact=(HANDLE)wparam;
// TODO: maybe need to fix extra icons
char *szProto = GetContactProto(hContact);
- if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ) && DBGetContactSettingWord(hContact, protocolname, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) {
- int gameid=DBGetContactSettingWord(hContact, protocolname, "GameId", 0);
- int gameid2=DBGetContactSettingWord(hContact, protocolname, "VoiceId", 0);
+ if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ) && db_get_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) {
+ int gameid=db_get_w(hContact, protocolname, "GameId", 0);
+ int gameid2=db_get_w(hContact, protocolname, "VoiceId", 0);
if(gameid!=0)
{
@@ -1074,20 +1067,20 @@ extern "C" __declspec(dllexport) int Load(void) //void* init = GetProcAddress(LoadLibrary("atl"),"AtlAxWinInit"); _asm call init;
//keine protoversion in der db, dann wohl der erste start von xfire
- if(DBGetContactSettingByte(NULL,protocolname,"protover",0)==0)
+ if(db_get_b(NULL,protocolname,"protover",0)==0)
{
- DBWriteContactSettingByte(NULL,protocolname,"protover",0x84);
- DBWriteContactSettingWord(NULL,protocolname,"avatarloadlatency",1000);
- DBWriteContactSettingByte(NULL,protocolname,"gameico",0);
- DBWriteContactSettingByte(NULL,protocolname,"voiceico",1);
- DBWriteContactSettingByte(NULL,protocolname,"specialavatarload",1);
- DBWriteContactSettingByte(NULL,protocolname,"xfiresitegameico",1);
- DBWriteContactSettingByte(NULL,protocolname,"recprotoverchg",1);
+ db_set_b(NULL,protocolname,"protover",0x84);
+ db_set_w(NULL,protocolname,"avatarloadlatency",1000);
+ db_set_b(NULL,protocolname,"gameico",0);
+ db_set_b(NULL,protocolname,"voiceico",1);
+ db_set_b(NULL,protocolname,"specialavatarload",1);
+ db_set_b(NULL,protocolname,"xfiresitegameico",1);
+ db_set_b(NULL,protocolname,"recprotoverchg",1);
if(MessageBoxA(NULL,Translate("It seems that is the first time you use this plugin. Do you want to automatically download the latest available xfire_games.ini and icons.dll?\r\nWithout the ini xfire can't detect any games on your computer."),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
{
- DBWriteContactSettingByte(NULL,protocolname,"autoiniupdate",1);
- DBWriteContactSettingByte(NULL,protocolname,"autoicodllupdate",1);
+ db_set_b(NULL,protocolname,"autoiniupdate",1);
+ db_set_b(NULL,protocolname,"autoicodllupdate",1);
}
}
@@ -1348,10 +1341,10 @@ extern "C" __declspec(dllexport) int Load(void) //lade GetExtendedUdpTable Funktion
HMODULE hmod=LoadLibraryA("IpHlpApi.dll");
_GetExtendedUdpTable=(pGetExtendedUdpTable)GetProcAddress(hmod,"GetExtendedUdpTable");
- if(_GetExtendedUdpTable==NULL&&DBGetContactSettingByte(NULL,protocolname,"ipportdetec",0))
+ if(_GetExtendedUdpTable==NULL&&db_get_b(NULL,protocolname,"ipportdetec",0))
{
//MessageBoxA(0,"GetExtendedUdpTable not found. ServerIP/Port detection feature will be disabled.","Miranda XFire Protocol Plugin",MB_OK|MB_ICONINFORMATION);
- DBWriteContactSettingByte(NULL,protocolname,"ipportdetec",0);
+ db_set_b(NULL,protocolname,"ipportdetec",0);
XFireLog("Wasn't able to get GetExtendedUdpTable function");
}
@@ -1381,7 +1374,7 @@ INT_PTR GetXStatusIcon(WPARAM wParam, LPARAM lParam) { INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam)
{
CCSDATA *ccs = ( CCSDATA* )lParam;
- DBDeleteContactSetting(ccs->hContact, "CList", "Hidden");
+ db_unset(ccs->hContact, "CList", "Hidden");
char *szProto = GetContactProto(ccs->hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ))
@@ -1424,16 +1417,16 @@ static INT_PTR UserIsTyping(WPARAM wParam, LPARAM lParam) if(lParam==PROTOTYPE_SELFTYPING_ON)
{
- if(DBGetContactSettingByte(NULL,protocolname,"sendtyping",1)==1)
+ if(db_get_b(NULL,protocolname,"sendtyping",1)==1)
{
if(myClient!=NULL)
if(myClient->client->connected)
- if(!DBGetContactSettingString(hContact, protocolname, "Username",&dbv))
+ if(!db_get_s(hContact, protocolname, "Username",&dbv))
{
SendTypingPacket typing;
typing.init(myClient->client, dbv.pszVal);
myClient->client->send( &typing );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -1452,9 +1445,9 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
int sended=0;
- DBGetContactSettingString(ccs->hContact, protocolname, "Username",&dbv);
+ db_get_s(ccs->hContact, protocolname, "Username",&dbv);
if(myClient!=NULL)
- if(myClient->client->connected&&DBGetContactSettingWord(ccs->hContact, protocolname, "Status", -1)!=ID_STATUS_OFFLINE)
+ if(myClient->client->connected&&db_get_w(ccs->hContact, protocolname, "Status", -1)!=ID_STATUS_OFFLINE)
{
/*if(myClient->useutf8)
myClient->sendmsg(dbv.pszVal, ( char* )ccs->lParam);
@@ -1468,7 +1461,7 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) {
mir_forkthread(SendBadAck,ccs->hContact);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return sended;
}
@@ -1484,7 +1477,7 @@ INT_PTR GetCaps(WPARAM wParam,LPARAM lParam) else if(wParam==PFLAGNUM_2)
return PF2_ONLINE|PF2_SHORTAWAY; // add the possible statuses here.
else if(wParam==PFLAGNUM_3)
- return PF2_ONLINE|(DBGetContactSettingByte(NULL,protocolname,"nocustomaway",0)==1?0:PF2_SHORTAWAY);
+ return PF2_ONLINE|(db_get_b(NULL,protocolname,"nocustomaway",0)==1?0:PF2_SHORTAWAY);
else if(wParam==PFLAGNUM_4)
return PF4_SUPPORTTYPING|PF4_AVATARS;
else if(wParam==PFLAG_UNIQUEIDTEXT)
@@ -1539,7 +1532,7 @@ static void ConnectingThread(LPVOID params) }
else
{
- if(DBGetContactSettingWord(NULL,protocolname,"noconnectfailedbox",0)==0) MSGBOXE(Translate("Unable to connect to XFire."));
+ if(db_get_w(NULL,protocolname,"noconnectfailedbox",0)==0) MSGBOXE(Translate("Unable to connect to XFire."));
wParam =ID_STATUS_OFFLINE;
}
@@ -1565,7 +1558,7 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) return 0;
if(wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE&&wParam!=ID_STATUS_AWAY&&wParam!=ID_STATUS_RECONNECT)
- if(DBGetContactSettingByte(NULL,protocolname,"oninsteadafk",0)==0)
+ if(db_get_b(NULL,protocolname,"oninsteadafk",0)==0)
wParam=ID_STATUS_AWAY; //protokoll auf away schalten
else
wParam=ID_STATUS_ONLINE; //protokoll auf online schalten
@@ -1585,12 +1578,12 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
DBVARIANT dbv2;
- if(DBGetContactSetting(NULL,protocolname,"login",&dbv))
+ if(db_get(NULL,protocolname,"login",&dbv))
{
MSGBOXE(Translate("No Loginname is set!"));
wParam=ID_STATUS_OFFLINE;
}
- else if(DBGetContactSetting(NULL,protocolname,"password",&dbv2))
+ else if(db_get(NULL,protocolname,"password",&dbv2))
{
MSGBOXE(Translate("No Password is set!"));
wParam=ID_STATUS_OFFLINE;
@@ -1603,26 +1596,26 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) delete myClient;
//alter proxycode, entfernt da über netlib die proxysache geregelt wird
- /* if(DBGetContactSettingByte(NULL, protocolname, "useproxy" ,0))
+ /* if(db_get_b(NULL, protocolname, "useproxy" ,0))
{
//verbindung über proxy
DBVARIANT dbv3;
DBVARIANT dbv4;
- if(!DBGetContactSetting(NULL,protocolname,"proxyip",&dbv3))
+ if(!db_get(NULL,protocolname,"proxyip",&dbv3))
{
- if(!DBGetContactSetting(NULL,protocolname,"proxyport",&dbv4))
+ if(!db_get(NULL,protocolname,"proxyport",&dbv4))
{
- myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,DBGetContactSettingByte(NULL,protocolname,"protover",0),1,dbv3.pszVal,atoi(dbv4.pszVal));
- DBFreeVariant(&dbv4);
+ myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0),1,dbv3.pszVal,atoi(dbv4.pszVal));
+ db_free(&dbv4);
}
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
}
else */
- myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,DBGetContactSettingByte(NULL,protocolname,"protover",0));
+ myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0));
//prüfe ob utf8 option aktiv, dann schlater auf true
- if(DBGetContactSettingByte(NULL,protocolname,"useutf8",0))
+ if(db_get_b(NULL,protocolname,"useutf8",0))
{
myClient->useutf8=TRUE;
}
@@ -1648,13 +1641,13 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) }
*/
//für die vars
- DBDeleteContactSetting(NULL,protocolname,"currentgamename");
- DBDeleteContactSetting(NULL,protocolname,"currentvoicename");
- DBDeleteContactSetting(NULL,protocolname,"VServerIP");
- DBDeleteContactSetting(NULL,protocolname,"ServerIP");
+ db_unset(NULL,protocolname,"currentgamename");
+ db_unset(NULL,protocolname,"currentvoicename");
+ db_unset(NULL,protocolname,"VServerIP");
+ db_unset(NULL,protocolname,"ServerIP");
- DBFreeVariant(&dbv);
- DBFreeVariant(&dbv2);
+ db_free(&dbv);
+ db_free(&dbv2);
return 0;
}
}
@@ -1667,7 +1660,7 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) else if(myClient!=NULL&&myClient->client->connected) // online --> afk
{
//setze bei aktivem nocustomaway die alte awaystatusmsg zurück, bugfix
- if(DBGetContactSettingByte(NULL,protocolname,"nocustomaway",0))
+ if(db_get_b(NULL,protocolname,"nocustomaway",0))
strcpy_s(statusmessage[1],1024,"(AFK) Away from Keyboard");
myClient->Status(statusmessage[1]);
@@ -1686,10 +1679,10 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) //teamspeak/ventrilo pid sowie gamepid auf NULL setzen, damit bei einem reconnect die neuerkannt werden
pid=NULL;
ts2pid=NULL;
- DBWriteContactSettingWord(NULL,protocolname,"currentgame",0);
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",0);
- DBDeleteContactSetting(NULL,protocolname, "VServerIP");
- DBDeleteContactSetting(NULL,protocolname, "ServerIP");
+ db_set_w(NULL,protocolname,"currentgame",0);
+ db_set_w(NULL,protocolname,"currentvoice",0);
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "ServerIP");
if(wParam == ID_STATUS_RECONNECT)
{
@@ -1737,34 +1730,34 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan) CallService( MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM)protocolname );
if ( InList )
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
else
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ db_unset(hContact, "CList", "Hidden");
if(strlen(xfc.nick)>0)
{
if(myClient->useutf8)
DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", xfc.nick);
else
- DBWriteContactSettingString(hContact, protocolname, "Nick", mir_utf8decode(( char* )xfc.nick,NULL));
+ db_set_s(hContact, protocolname, "Nick", mir_utf8decode(( char* )xfc.nick,NULL));
}
else if(strlen(xfc.username)>0)
- DBWriteContactSettingString(hContact, protocolname, "Nick", xfc.username);
+ db_set_s(hContact, protocolname, "Nick", xfc.username);
- DBWriteContactSettingString(hContact, protocolname, "Username", xfc.username);
+ db_set_s(hContact, protocolname, "Username", xfc.username);
- //DBWriteContactSettingString(hContact, protocolname, "Screenname", xfc.nick);
- DBWriteContactSettingDword(hContact, protocolname, "UserId", xfc.id);
+ //db_set_s(hContact, protocolname, "Screenname", xfc.nick);
+ db_set_dw(hContact, protocolname, "UserId", xfc.id);
if(clan>0)
- DBWriteContactSettingDword(hContact, protocolname, "Clan", clan);
+ db_set_dw(hContact, protocolname, "Clan", clan);
- DBWriteContactSettingWord(hContact, protocolname, "Status", SetOnline ? ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
+ db_set_w(hContact, protocolname, "Status", SetOnline ? ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)==0)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)==0)
{
- if(!DBGetContactSettingByte(NULL,protocolname,"specialavatarload",0))
+ if(!db_get_b(NULL,protocolname,"specialavatarload",0))
{
XFire_SetAvatar* xsa=new XFire_SetAvatar;
xsa->hContact=hContact;
@@ -1789,8 +1782,8 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan) }
if (xfc.id==0) {
- DBWriteContactSettingByte( hContact, "CList", "NotOnList", 1 );
- DBWriteContactSettingByte( hContact, "CList", "Hidden", 1 );
+ db_set_b( hContact, "CList", "NotOnList", 1 );
+ db_set_b( hContact, "CList", "Hidden", 1 );
}
return hContact;
@@ -1813,7 +1806,7 @@ HANDLE CList_FindContact (int uid) while (hContact) {
char *szProto = GetContactProto(hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, protocolname )) {
- if ( DBGetContactSettingDword(hContact, protocolname, "UserId",-1)==uid)
+ if ( db_get_dw(hContact, protocolname, "UserId",-1)==uid)
return hContact;
}
hContact = db_find_next(hContact);
@@ -1830,60 +1823,60 @@ void CList_MakeAllOffline() if ( szProto != NULL && !lstrcmpiA( szProto, protocolname )) {
//freunde von freunden in eine seperate liste setzen
//nur wenn das nicht abgestellt wurde
- if(DBGetContactSettingByte(hContact,protocolname,"friendoffriend",0)==1&&
- DBGetContactSettingByte(NULL,protocolname,"fofdbremove",0)==1)
+ if(db_get_b(hContact,protocolname,"friendoffriend",0)==1&&
+ db_get_b(NULL,protocolname,"fofdbremove",0)==1)
{
fhandles.push_back(hContact);
}
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "ServerName");
- DBDeleteContactSetting(hContact, protocolname, "GameType");
- DBDeleteContactSetting(hContact, protocolname, "Map");
- DBDeleteContactSetting(hContact, protocolname, "Players");
- DBDeleteContactSetting(hContact, protocolname, "Passworded");
+ db_unset(hContact, "CList", "StatusMsg");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "ServerName");
+ db_unset(hContact, protocolname, "GameType");
+ db_unset(hContact, protocolname, "Map");
+ db_unset(hContact, protocolname, "Players");
+ db_unset(hContact, protocolname, "Passworded");
- DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "XStatusId");
- DBDeleteContactSetting(hContact, protocolname, "XStatusName");
+ db_unset(hContact, protocolname, "XStatusMsg");
+ db_unset(hContact, protocolname, "XStatusId");
+ db_unset(hContact, protocolname, "XStatusName");
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)==1)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)==1)
{
- DBDeleteContactSetting(hContact, "ContactPhoto", "File");
- DBDeleteContactSetting(hContact, "ContactPhoto", "RFile");
- DBDeleteContactSetting(hContact, "ContactPhoto", "Backup");
- DBDeleteContactSetting(hContact, "ContactPhoto", "Format");
- DBDeleteContactSetting(hContact, "ContactPhoto", "ImageHash");
- DBDeleteContactSetting(hContact, "ContactPhoto", "XFireAvatarId");
- DBDeleteContactSetting(hContact, "ContactPhoto", "XFireAvatarMode");
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, "ContactPhoto", "RFile");
+ db_unset(hContact, "ContactPhoto", "Backup");
+ db_unset(hContact, "ContactPhoto", "Format");
+ db_unset(hContact, "ContactPhoto", "ImageHash");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarId");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
}
else
{
//prüf ob der avatar noch existiert
DBVARIANT dbv;
- if(!DBGetContactSettingString(hContact, "ContactPhoto", "File",&dbv))
+ if(!db_get_s(hContact, "ContactPhoto", "File",&dbv))
{
FILE*f=fopen(dbv.pszVal,"r");
if(f==NULL)
{
- DBDeleteContactSetting(hContact, "ContactPhoto", "File");
- DBDeleteContactSetting(hContact, "ContactPhoto", "RFile");
- DBDeleteContactSetting(hContact, "ContactPhoto", "Backup");
- DBDeleteContactSetting(hContact, "ContactPhoto", "Format");
- DBDeleteContactSetting(hContact, "ContactPhoto", "ImageHash");
- DBDeleteContactSetting(hContact, "ContactPhoto", "XFireAvatarId");
- DBDeleteContactSetting(hContact, "ContactPhoto", "XFireAvatarMode");
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, "ContactPhoto", "RFile");
+ db_unset(hContact, "ContactPhoto", "Backup");
+ db_unset(hContact, "ContactPhoto", "Format");
+ db_unset(hContact, "ContactPhoto", "ImageHash");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarId");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
}
else
{
fclose(f);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
- DBWriteContactSettingWord(hContact,protocolname,"Status",ID_STATUS_OFFLINE);
+ db_set_w(hContact,protocolname,"Status",ID_STATUS_OFFLINE);
}
hContact = db_find_next(hContact);
}
@@ -1900,7 +1893,7 @@ void SetIcon(HANDLE hcontact,HANDLE hicon,int ctype) void SetAvatar2(LPVOID lparam) {
static int lasttime=0;
- int sleep=DBGetContactSettingWord(NULL,protocolname,"avatarloadlatency",1000);
+ int sleep=db_get_w(NULL,protocolname,"avatarloadlatency",1000);
lasttime+=sleep;
if(mySleep(lasttime,hConnectionClose))
@@ -1925,7 +1918,7 @@ void SetAvatar(LPVOID lparam) //EnterCriticalSection(&avatarMutex);
//WaitForSingleObject(hMutex, INFINITE);
static int lasttime=0;
- int sleep=DBGetContactSettingWord(NULL,protocolname,"avatarloadlatency",250);
+ int sleep=db_get_w(NULL,protocolname,"avatarloadlatency",250);
if(bpStatus==ID_STATUS_OFFLINE)
return;
@@ -2082,16 +2075,16 @@ static INT_PTR GetIPPort(WPARAM wParam,LPARAM lParam) HGLOBAL clipbuffer;
char* buffer;
- if(DBGetContactSettingWord((HANDLE)wParam, protocolname, "Port", -1)==0)
+ if(db_get_w((HANDLE)wParam, protocolname, "Port", -1)==0)
return 0;
DBVARIANT dbv;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "ServerIP",&dbv))
+ if(db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv))
return 0;
- sprintf(temp,"%s:%d",dbv.pszVal,DBGetContactSettingWord((HANDLE)wParam, protocolname, "Port", -1));
+ sprintf(temp,"%s:%d",dbv.pszVal,db_get_w((HANDLE)wParam, protocolname, "Port", -1));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if(OpenClipboard(NULL))
{
@@ -2115,16 +2108,16 @@ static INT_PTR GetVIPPort(WPARAM wParam,LPARAM lParam) HGLOBAL clipbuffer;
char* buffer;
- if(DBGetContactSettingWord((HANDLE)wParam, protocolname, "VPort", -1)==0)
+ if(db_get_w((HANDLE)wParam, protocolname, "VPort", -1)==0)
return 0;
DBVARIANT dbv;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "VServerIP",&dbv))
+ if(db_get_s((HANDLE)wParam, protocolname, "VServerIP",&dbv))
return 0;
- sprintf(temp,"%s:%d",dbv.pszVal,DBGetContactSettingWord((HANDLE)wParam, protocolname, "VPort", -1));
+ sprintf(temp,"%s:%d",dbv.pszVal,db_get_w((HANDLE)wParam, protocolname, "VPort", -1));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if(OpenClipboard(NULL))
{
@@ -2147,12 +2140,12 @@ static INT_PTR GotoProfile(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
char temp[64]="";
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "Username",&dbv))
+ if(db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
return 0;
strcpy(temp,"http://xfire.com/profile/");
strcat_s(temp,64,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
CallService( MS_UTILS_OPENURL, 1, (LPARAM)temp );
@@ -2163,15 +2156,15 @@ static INT_PTR GotoXFireClanSite(WPARAM wParam,LPARAM lParam) { DBVARIANT dbv;
char temp[64]="";
- int clanid=DBGetContactSettingDword((HANDLE)wParam, protocolname, "Clan",-1);
+ int clanid=db_get_dw((HANDLE)wParam, protocolname, "Clan",-1);
sprintf(temp,"ClanUrl_%d",clanid);
- if(DBGetContactSettingString(NULL, protocolname, temp,&dbv))
+ if(db_get_s(NULL, protocolname, temp,&dbv))
return 0;
strcpy(temp,"http://xfire.com/clans/");
strcat_s(temp,64,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
CallService( MS_UTILS_OPENURL, 1, (LPARAM)temp );
@@ -2183,12 +2176,12 @@ static INT_PTR GotoProfile2(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
char temp[64]="";
- if(DBGetContactSettingString(NULL, protocolname, "login",&dbv))
+ if(db_get_s(NULL, protocolname, "login",&dbv))
return 0;
strcpy(temp,"http://xfire.com/profile/");
strcat_s(temp,64,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
CallService( MS_UTILS_OPENURL, 1, (LPARAM)temp );
@@ -2205,12 +2198,12 @@ static INT_PTR GotoProfileAct(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
char temp[64]="";
- if(DBGetContactSettingString(NULL, protocolname, "login",&dbv))
+ if(db_get_s(NULL, protocolname, "login",&dbv))
return 0;
strcpy(temp,"http://www.xfire.com/?username=");
strcat_s(temp,64,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
CallService( MS_UTILS_OPENURL, 1, (LPARAM)temp );
@@ -2224,107 +2217,60 @@ static INT_PTR GotoProfileAct(WPARAM wParam,LPARAM lParam) int RebuildContactMenu( WPARAM wParam, LPARAM lParam )
{
- // !!!!!!!! check it later
- CLISTMENUITEM clmi = { 0 };
- clmi.cbSize = sizeof( clmi );
- CLISTMENUITEM clmi2 = { 0 };
- clmi2.cbSize = sizeof( clmi2 );
- CLISTMENUITEM clmi3 = { 0 };
- clmi3.cbSize = sizeof( clmi3 );
- CLISTMENUITEM clmi4 = { 0 };
- clmi4.cbSize = sizeof( clmi4 );
- CLISTMENUITEM clmi5 = { 0 };
- clmi5.cbSize = sizeof( clmi5 );
- CLISTMENUITEM clmi6 = { 0 };
- clmi6.cbSize = sizeof( clmi6 );
- CLISTMENUITEM clmi7 = { 0 };
- clmi7.cbSize = sizeof( clmi7 );
- CLISTMENUITEM clmi8 = { 0 };
- clmi8.cbSize = sizeof( clmi8 );
-
- //kopieren von port und ip nur erlauben, wenn verfügbar
- clmi.flags = CMIM_FLAGS;
- clmi2.flags = CMIM_FLAGS;
- clmi3.flags = CMIM_FLAGS;
- clmi4.flags = CMIM_FLAGS;
- clmi5.flags = CMIM_FLAGS;
- clmi6.flags = CMIM_FLAGS;
- clmi7.flags = CMIM_FLAGS;
- clmi8.flags = CMIM_FLAGS;
+ HANDLE hContact = (HANDLE)wParam;
+ bool bEnabled = true, bEnabled2 = true;
DBVARIANT dbv;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "ServerIP",&dbv))
- clmi.flags|= CMIF_HIDDEN;
+ if (db_get_s(hContact, protocolname, "ServerIP", &dbv))
+ bEnabled = false;
else
- DBFreeVariant(&dbv);
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )copyipport, ( LPARAM )&clmi );
+ db_free(&dbv);
+ Menu_ShowItem(copyipport, bEnabled);
//kopieren von voice port und ip nur erlauben, wenn verfügbar
- DBVARIANT dbv2;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "VServerIP",&dbv2))
- {
- clmi2.flags|= CMIF_HIDDEN;
- }
+ bEnabled = true;
+ if(db_get_s(hContact, protocolname, "VServerIP", &dbv))
+ bEnabled = false;
else
- DBFreeVariant(&dbv2);
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )vipport, ( LPARAM )&clmi2 );
+ db_free(&dbv);
+ Menu_ShowItem(vipport, bEnabled);
//clansite nur bei clanmembern anbieten
- if(DBGetContactSettingDword((HANDLE)wParam, protocolname, "Clan",0)==0)
- clmi3.flags|= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )gotoclansite, ( LPARAM )&clmi3 );
+ Menu_ShowItem(gotoclansite, db_get_dw(hContact, protocolname, "Clan",0) != 0);
//NotOnList
- if(DBGetContactSettingDword((HANDLE)wParam, "CList", "NotOnList",0)==0)
- clmi5.flags|= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )blockfriend, ( LPARAM )&clmi5 );
+ Menu_ShowItem(blockfriend, db_get_dw(hContact, "CList", "NotOnList",0) != 0);
//speichere gameid ab
- int gameid=DBGetContactSettingWord((HANDLE)wParam, protocolname, "GameId",0);
+ int gameid = db_get_w(hContact, protocolname, "GameId",0);
//spiel in xfirespieliste?
- if(!xgamelist.Gameinlist(gameid))
- {
+ bEnabled = bEnabled2 = true;
+ if(!xgamelist.Gameinlist(gameid)) {
//nein, dann start und join auf unsichbar schalten
- clmi7.flags|= CMIF_HIDDEN;
- clmi4.flags|= CMIF_HIDDEN;
+ bEnabled = bEnabled2 = false;
}
- else
- {
+ else {
//gameobject holen
Xfire_game* game=xgamelist.getGamebyGameid(gameid);
//hat das spiel netzwerkparameter?
- if(game)
- {
- if(game->networkparams)
- {
+ if(game) {
+ if(game->networkparams) {
//is beim buddy ein port hinterlegt, also spielt er im internet?
- if(!DBGetContactSettingDword((HANDLE)wParam, protocolname, "Port",0))
- {
+ if( !db_get_dw(hContact, protocolname, "Port",0)) {
//nein, dann join button auch ausblenden
- clmi4.flags|= CMIF_HIDDEN;
+ bEnabled = false;
}
}
- else
- clmi4.flags|= CMIF_HIDDEN;
+ else bEnabled = false;
}
- else
- clmi4.flags|= CMIF_HIDDEN;
+ else bEnabled = false;
}
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )joingame, ( LPARAM )&clmi4 );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )startthisgame, ( LPARAM )&clmi7 );
-
+ Menu_ShowItem(joingame, bEnabled);
+ Menu_ShowItem(startthisgame, bEnabled2);
//remove freind nur bei noramlen buddies
- if(DBGetContactSettingByte((HANDLE)wParam, protocolname, "friendoffriend",0)==1)
- clmi8.flags|= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )removefriend, ( LPARAM )&clmi8 );
-
+ Menu_ShowItem(removefriend, db_get_b(hContact, protocolname, "friendoffriend",0) != 1);
return 0;
}
@@ -2387,14 +2333,14 @@ void gamedetectiont(LPVOID lparam) time_t t1;
- if(DBGetContactSettingByte(NULL,protocolname,"nogamedetect",0))
+ if(db_get_b(NULL,protocolname,"nogamedetect",0))
#ifndef NO_PTHREAD
return ptr;
#else
return;
#endif
- DWORD lowpids=DBGetContactSettingByte(NULL,protocolname,"skiplowpid",100);
+ DWORD lowpids=db_get_b(NULL,protocolname,"skiplowpid",100);
//XFireLog("XFire Gamedetectionthread started ...","");
@@ -2431,7 +2377,7 @@ void gamedetectiont(LPVOID lparam) {
//erstmal nach TS2 suchen
//XFireLog("Teamspeak detection ...","");
- if(DBGetContactSettingByte(NULL,protocolname,"ts2detection",0))
+ if(db_get_b(NULL,protocolname,"ts2detection",0))
{
SendGameStatus2Packet *packet = new SendGameStatus2Packet();
if(voicechat.checkVoicechat(packet)) {
@@ -2448,24 +2394,24 @@ void gamedetectiont(LPVOID lparam) //if (hMapObject) {
//}
//wenn remote feature aktiviert, darüber ip erkennen
- /*if(DBGetContactSettingByte(NULL,protocolname,"ts2useremote",0))
+ /*if(db_get_b(NULL,protocolname,"ts2useremote",0))
{
//ipholen
SendGameStatus2Packet *packet = new SendGameStatus2Packet();
if(TSSetupPacket(packet,&ts2pid,&ts2port))
{
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",packet->gameid);
+ db_set_w(NULL,protocolname,"currentvoice",packet->gameid);
if(packet->ip[3]!=0)
{
sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "VServerIP", temp);
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Teamspeak");
+ db_set_s(NULL, protocolname, "VServerIP", temp);
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
}
else
{
- DBDeleteContactSetting(NULL,protocolname, "VServerIP");
- DBDeleteContactSetting(NULL,protocolname, "currentvoicename");
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "currentvoicename");
}
if(myClient!=NULL)
@@ -2490,16 +2436,16 @@ void gamedetectiont(LPVOID lparam) packet->gameid=vid;
if(vid==32)
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Teamspeak");
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
else if(vid==33)
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Ventrilo");
+ db_set_s(NULL, protocolname, "currentvoicename", "Ventrilo");
else if(vid==34)
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Mumble");
+ db_set_s(NULL, protocolname, "currentvoicename", "Mumble");
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",vid);
+ db_set_w(NULL,protocolname,"currentvoice",vid);
sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "VServerIP", temp);
+ db_set_s(NULL, protocolname, "VServerIP", temp);
if(myClient!=NULL)
myClient->client->send( packet );
@@ -2518,9 +2464,9 @@ void gamedetectiont(LPVOID lparam) {
SendGameStatus2Packet *packet = new SendGameStatus2Packet();
packet->gameid=0;
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",0);
- DBDeleteContactSetting(NULL,protocolname, "VServerIP");
- DBDeleteContactSetting(NULL,protocolname, "currentvoicename");
+ db_set_w(NULL,protocolname,"currentvoice",0);
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "currentvoicename");
if(myClient!=NULL)
myClient->client->send( packet );
@@ -2536,10 +2482,10 @@ void gamedetectiont(LPVOID lparam) if(packet->port!=0)
{
packet->gameid=vid;
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",vid);
+ db_set_w(NULL,protocolname,"currentvoice",vid);
sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "VServerIP", temp);
+ db_set_s(NULL, protocolname, "VServerIP", temp);
if(myClient!=NULL)
myClient->client->send( packet );
@@ -2573,7 +2519,7 @@ void gamedetectiont(LPVOID lparam) //XFireLog("XFire Gamedetection - Game was closed ID: %i",currentgame);
SendGameStatusPacket *packet = new SendGameStatusPacket();
packet->gameid=0;
- if(DBGetContactSettingByte(NULL,protocolname,"sendgamestatus",1))
+ if(db_get_b(NULL,protocolname,"sendgamestatus",1))
if(myClient!=NULL)
myClient->client->send( packet );
@@ -2594,17 +2540,17 @@ void gamedetectiont(LPVOID lparam) }
sprintf(temp,Translate("Last game: %s playtime: %.2d:%.2d:%.2d"),currentgame->name,mytm->tm_hour,mytm->tm_min,mytm->tm_sec);
- DBWriteContactSettingString(NULL, protocolname, "LastGame", temp);
+ db_set_s(NULL, protocolname, "LastGame", temp);
- if(currentgame->noicqstatus!=TRUE&&DBGetContactSettingByte(NULL,protocolname,"autosetstatusmsg",0))
+ if(currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
SetOldStatusMsg();
- DBWriteContactSettingWord(NULL,protocolname,"currentgame",0);
- DBDeleteContactSetting(NULL,protocolname,"currentgamename");
+ db_set_w(NULL,protocolname,"currentgame",0);
+ db_unset(NULL,protocolname,"currentgamename");
//popup wieder aktivieren, menuservice funk aufrufen, nur wenn popups vorher abgestellt wurden
if(disabledpopups)
- if(DBGetContactSettingByte(NULL,protocolname,"nopopups",0))
+ if(db_get_b(NULL,protocolname,"nopopups",0))
{
if(ServiceExists("PopUp/EnableDisableMenuCommand"))
{
@@ -2618,14 +2564,14 @@ void gamedetectiont(LPVOID lparam) }
//sound wieder aktivieren, nur wenn es vorher abgestellt wurde
if(disabledsound)
- if(DBGetContactSettingByte(NULL,protocolname,"nosoundev",0))
+ if(db_get_b(NULL,protocolname,"nosoundev",0))
{
- DBWriteContactSettingByte(NULL,"Skin","UseSound",1);
+ db_set_b(NULL,"Skin","UseSound",1);
disabledsound=FALSE;
}
//bug beseitigt, wenn spiel beendet, alte ip entfernen
- DBDeleteContactSetting(NULL,protocolname, "ServerIP");
+ db_unset(NULL,protocolname, "ServerIP");
pid=NULL;
currentgame=NULL;
@@ -2639,7 +2585,7 @@ void gamedetectiont(LPVOID lparam) {
//XFireLog("Spiel noch offen ...","");
//nur nwspiele nach ip/port scannen
- if(DBGetContactSettingByte(NULL,protocolname,"ipportdetec",0))
+ if(db_get_b(NULL,protocolname,"ipportdetec",0))
if(currentgame->networkparams!=NULL&¤tgame->send_gameid>0)
{
SendGameStatusPacket *packet = new SendGameStatusPacket();
@@ -2652,20 +2598,20 @@ void gamedetectiont(LPVOID lparam) if(packet->ip[3]!=0)
{
sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "ServerIP", temp);
+ db_set_s(NULL, protocolname, "ServerIP", temp);
XFireLog("Got IPPort: %s",temp);
}
else {
- DBDeleteContactSetting(NULL,protocolname, "ServerIP");
+ db_unset(NULL,protocolname, "ServerIP");
XFireLog("NO IPPort","");
}
packet->gameid=currentgame->send_gameid;
- if(DBGetContactSettingByte(NULL,protocolname,"sendgamestatus",1))
+ if(db_get_b(NULL,protocolname,"sendgamestatus",1))
if(myClient!=NULL)
myClient->client->send( packet );
- if(currentgame->noicqstatus!=TRUE&&DBGetContactSettingByte(NULL,protocolname,"autosetstatusmsg",0))
+ if(currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
SetGameStatusMsg();
} else {
XFireLog("GetServerIPPort failed","");
@@ -2712,12 +2658,12 @@ void gamedetectiont(LPVOID lparam) {
currentgame=nextgame;
pid=processInfo->th32ProcessID;
- DBWriteContactSettingWord(NULL,protocolname,"currentgame",currentgame->id);
- DBWriteContactSettingString(NULL,protocolname,"currentgamename",currentgame->name);
+ db_set_w(NULL,protocolname,"currentgame",currentgame->id);
+ db_set_s(NULL,protocolname,"currentgamename",currentgame->name);
packet->gameid=currentgame->send_gameid;
t1=time(NULL);
- if(DBGetContactSettingByte(NULL,protocolname,"sendgamestatus",1))
+ if(db_get_b(NULL,protocolname,"sendgamestatus",1))
{
XFireLog("XFire Gamedetection - Sendgame-ID: %i",currentgame->send_gameid);
if(currentgame->send_gameid>0)
@@ -2738,29 +2684,29 @@ void gamedetectiont(LPVOID lparam) SetXFireGameStatusMsg(currentgame);
}
- if(currentgame->noicqstatus!=TRUE&&DBGetContactSettingByte(NULL,protocolname,"autosetstatusmsg",0))
+ if(currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
{
BackupStatusMsg();
SetGameStatusMsg();
}
//popup abschalten, menuservice funk aufrufen
- if(DBGetContactSettingByte(NULL,protocolname,"nopopups",0))
+ if(db_get_b(NULL,protocolname,"nopopups",0))
{
- if(ServiceExists("PopUp/EnableDisableMenuCommand")&&DBGetContactSettingByte(NULL,"PopUp","ModuleIsEnabled",0)==1) /**/
+ if(ServiceExists("PopUp/EnableDisableMenuCommand")&&db_get_b(NULL,"PopUp","ModuleIsEnabled",0)==1) /**/
{
disabledpopups=TRUE;
CallService("PopUp/EnableDisableMenuCommand",NULL,NULL);
}
- else if(ServiceExists("PopUp/ToggleEnabled")&&DBGetContactSettingByte(NULL,"YAPP","Enabled",0)==1)
+ else if(ServiceExists("PopUp/ToggleEnabled")&&db_get_b(NULL,"YAPP","Enabled",0)==1)
{
disabledpopups=TRUE;
CallService("PopUp/ToggleEnabled",NULL,NULL);
}
}
//sound abschalten
- if(DBGetContactSettingByte(NULL,protocolname,"nosoundev",0)&&DBGetContactSettingByte(NULL,"Skin","UseSound",0)==1)
+ if(db_get_b(NULL,protocolname,"nosoundev",0)&&db_get_b(NULL,"Skin","UseSound",0)==1)
{
- DBWriteContactSettingByte(NULL,"Skin","UseSound",0);
+ db_set_b(NULL,"Skin","UseSound",0);
disabledsound=TRUE;
}
}
@@ -2782,7 +2728,7 @@ void gamedetectiont(LPVOID lparam) static INT_PTR ReScanMyGames(WPARAM wParam,LPARAM lParam)
{
- DBDeleteContactSetting(NULL, protocolname, "foundgames");
+ db_unset(NULL, protocolname, "foundgames");
mir_forkthread(Scan4Games,NULL);
@@ -2807,33 +2753,33 @@ void setBuddyStatusMsg(BuddyListEntry *entry) {
ostringstream xstatus;
DBVARIANT dbv;
- if (!DBGetContactSettingString(entry->hcontact, protocolname, "RGame", &dbv))
+ if (!db_get_s(entry->hcontact, protocolname, "RGame", &dbv))
{
xstatus << dbv.pszVal << " ";
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSettingByte(NULL, protocolname, "noipportinstatus", 0))
+ if (!db_get_b(NULL, protocolname, "noipportinstatus", 0))
{
- if (!DBGetContactSettingString(entry->hcontact, protocolname, "ServerName", &dbv))
+ if (!db_get_s(entry->hcontact, protocolname, "ServerName", &dbv))
{
xstatus << dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- else if (!DBGetContactSettingString(entry->hcontact,protocolname, "ServerIP",&dbv))
+ else if (!db_get_s(entry->hcontact,protocolname, "ServerIP",&dbv))
{
- xstatus << "(" << dbv.pszVal << ":" << DBGetContactSettingWord(entry->hcontact, protocolname, "Port", 0) << ")";
- DBFreeVariant(&dbv);
+ xstatus << "(" << dbv.pszVal << ":" << db_get_w(entry->hcontact, protocolname, "Port", 0) << ")";
+ db_free(&dbv);
}
}
DBWriteContactSettingUTF8String(entry->hcontact, protocolname, "XStatusMsg", xstatus.str().c_str());
}
else
{
- //DBWriteContactSettingByte(entry->hcontact, protocolname, "XStatusId", 1);
- DBDeleteContactSetting(entry->hcontact, protocolname, "XStatusId");
- DBDeleteContactSetting(entry->hcontact, protocolname, "XStatusName");
- DBDeleteContactSetting(entry->hcontact, protocolname, "XStatusMsg");
+ //db_set_b(entry->hcontact, protocolname, "XStatusId", 1);
+ db_unset(entry->hcontact, protocolname, "XStatusId");
+ db_unset(entry->hcontact, protocolname, "XStatusName");
+ db_unset(entry->hcontact, protocolname, "XStatusMsg");
}
/*//statusmsg umwandeln
@@ -2844,12 +2790,12 @@ void setBuddyStatusMsg(BuddyListEntry *entry) string afk = entry->statusmsg.substr(0, 5);
int status_id = (afk == "(AFK)" || afk == "(ABS)") ? ID_STATUS_AWAY : ID_STATUS_ONLINE;
- DBWriteContactSettingWord(entry->hcontact, protocolname, "Status", status_id);
+ db_set_w(entry->hcontact, protocolname, "Status", status_id);
if (!entry->statusmsg.empty())
DBWriteContactSettingUTF8String(entry->hcontact, "CList", "StatusMsg", entry->statusmsg.c_str());
else
- DBDeleteContactSetting(entry->hcontact, "CList", "StatusMsg");
+ db_unset(entry->hcontact, "CList", "StatusMsg");
}
/*void CheckAvatar(void *ventry)
@@ -2858,13 +2804,13 @@ void setBuddyStatusMsg(BuddyListEntry *entry) DBVARIANT dbv;
if(entry==NULL)
return;
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)==0)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)==0)
{
- if(DBGetContactSettingByte(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
+ if(db_get_b(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
{
- if(!DBGetContactSettingByte(NULL,protocolname,"specialavatarload",0))
+ if(!db_get_b(NULL,protocolname,"specialavatarload",0))
{
- if(DBGetContactSetting(entry->hcontact,"ContactPhoto", "File",&dbv))
+ if(db_get(entry->hcontact,"ContactPhoto", "File",&dbv))
{
XFire_SetAvatar* xsa=new XFire_SetAvatar;
xsa->hContact=entry->hcontact;
@@ -2907,8 +2853,8 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) entry->hcontact=CList_FindContact(entry->userid);
if(entry->hcontact&&clan==-1)
{
- DBWriteContactSettingWord(entry->hcontact, protocolname, "Status", ID_STATUS_ONLINE);
- DBWriteContactSettingString(entry->hcontact, protocolname, "MirVer", "xfire");
+ db_set_w(entry->hcontact, protocolname, "Status", ID_STATUS_ONLINE);
+ db_set_s(entry->hcontact, protocolname, "MirVer", "xfire");
}
}
@@ -2927,7 +2873,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) if (hContact!=0)
{
- if (!entry->nick.empty() && DBGetContactSettingByte(NULL, protocolname, "shownicks", 1)) {
+ if (!entry->nick.empty() && db_get_b(NULL, protocolname, "shownicks", 1)) {
char*nick=NULL;
if (myClient->useutf8)
@@ -2940,33 +2886,33 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) if(myClient->useutf8)
DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", nick);
else
- DBWriteContactSettingString(hContact, protocolname, "Nick", nick);
+ db_set_s(hContact, protocolname, "Nick", nick);
}
else
- DBWriteContactSettingString(hContact, protocolname, "Nick", entry->username.c_str());
+ db_set_s(hContact, protocolname, "Nick", entry->username.c_str());
- //DBWriteContactSettingStringUtf(hContact, protocolname, "Nick", entry->nick.c_str());
+ //db_set_utf(hContact, protocolname, "Nick", entry->nick.c_str());
//DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", ( char* )entry->nick.c_str());
} else
- DBWriteContactSettingString(hContact, protocolname, "Nick", entry->username.c_str());
+ db_set_s(hContact, protocolname, "Nick", entry->username.c_str());
if(!entry->isOnline())
{
- DBWriteContactSettingWord(hContact, protocolname, "Status", ID_STATUS_OFFLINE);
- DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "XStatusId");
- DBDeleteContactSetting(hContact, protocolname, "XStatusName");
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ db_set_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE);
+ db_unset(hContact, protocolname, "XStatusMsg");
+ db_unset(hContact, protocolname, "XStatusId");
+ db_unset(hContact, protocolname, "XStatusName");
+ db_unset(hContact, "CList", "StatusMsg");
//DBWriteContactSettingUTF8String(hContact, protocolname, "XStatusName", "");
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
- DBDeleteContactSetting(hContact, protocolname, "RVoice");
- DBDeleteContactSetting(hContact, protocolname, "RGame");
- DBDeleteContactSetting(hContact, protocolname, "GameId");
- DBDeleteContactSetting(hContact, protocolname, "VoiceId");
- DBDeleteContactSetting(hContact, protocolname, "GameInfo");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "RVoice");
+ db_unset(hContact, protocolname, "RGame");
+ db_unset(hContact, protocolname, "GameId");
+ db_unset(hContact, protocolname, "VoiceId");
+ db_unset(hContact, protocolname, "GameInfo");
}
else if(entry->game>0||entry->game2>0)
{
@@ -2976,7 +2922,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) DummyXFireGame *gameob;
if(strlen(entry->gameinfo.c_str())>0)
- DBWriteContactSettingString(hContact, protocolname, "GameInfo", entry->gameinfo.c_str());
+ db_set_s(hContact, protocolname, "GameInfo", entry->gameinfo.c_str());
//beim voicechat foglendes machn
if(entry->game2>0)
@@ -2985,33 +2931,33 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) xgamelist.getGamename(entry->game2,gname,255);
- DBWriteContactSettingString(hContact, protocolname, "RVoice", gname);
+ db_set_s(hContact, protocolname, "RVoice", gname);
if(gameob)
{
if((unsigned char)gameob->ip[3]!=0) // wenn ip, dann speichern
{
sprintf(temp,"%d.%d.%d.%d",(unsigned char)gameob->ip[3],(unsigned char)gameob->ip[2],(unsigned char)gameob->ip[1],(unsigned char)gameob->ip[0]);
- DBWriteContactSettingString(hContact, protocolname, "VServerIP", temp);
- DBWriteContactSettingWord(hContact, protocolname, "VPort", (unsigned long)gameob->port);
+ db_set_s(hContact, protocolname, "VServerIP", temp);
+ db_set_w(hContact, protocolname, "VPort", (unsigned long)gameob->port);
}
else
{
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
}
}
- DBWriteContactSettingWord(hContact, protocolname, "VoiceId", entry->game2);
+ db_set_w(hContact, protocolname, "VoiceId", entry->game2);
SetIcon(hContact,xgamelist.iconmngr.getGameIconHandle(entry->game2),2); //icon seperat setzen
}
else
{
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
- DBDeleteContactSetting(hContact, protocolname, "RVoice");
- DBDeleteContactSetting(hContact, protocolname, "VoiceId");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "RVoice");
+ db_unset(hContact, protocolname, "VoiceId");
SetIcon(hContact,(HANDLE)-1,2);
}
@@ -3022,13 +2968,13 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) xgamelist.getGamename(entry->game,gname,255);
- DBWriteContactSettingString(hContact, protocolname, "RGame", gname);
+ db_set_s(hContact, protocolname, "RGame", gname);
//beinhaltet ip und port
gameob=(DummyXFireGame*)entry->gameObj;
//popup, wenn jemand was spielt
- if(DBGetContactSettingByte(NULL,protocolname,"gamepopup",0)==1) {
+ if(db_get_b(NULL,protocolname,"gamepopup",0)==1) {
char temp[256]="";
sprintf(temp,Translate("%s is playing %s."),
@@ -3095,12 +3041,12 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) {
//ip und port in kontakt speichern
sprintf(temp,"%d.%d.%d.%d",(unsigned char)gameob->ip[3],(unsigned char)gameob->ip[2],(unsigned char)gameob->ip[1],(unsigned char)gameob->ip[0]);
- DBWriteContactSettingString(hContact, protocolname, "ServerIP", temp);
- DBWriteContactSettingWord(hContact, protocolname, "Port", (unsigned long)gameob->port);
+ db_set_s(hContact, protocolname, "ServerIP", temp);
+ db_set_w(hContact, protocolname, "Port", (unsigned long)gameob->port);
//lass das query arbeiten
if(dontscan==FALSE)
- if(ServiceExists("GameServerQuery/Query")&&DBGetContactSettingByte(NULL,protocolname,"gsqsupport",0))
+ if(ServiceExists("GameServerQuery/Query")&&db_get_b(NULL,protocolname,"gsqsupport",0))
{
GameServerQuery_query gsqq={0};
gsqq.port=gameob->port;
@@ -3111,36 +3057,36 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) }
else
{
- DBDeleteContactSetting(hContact, protocolname, "ServerName");
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "ServerName");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
}
}
SetIcon(hContact,xgamelist.iconmngr.getGameIconHandle(entry->game));
- //DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- DBWriteContactSettingWord(hContact, protocolname, "Status", ID_STATUS_ONLINE);
+ //db_unset(hContact, "CList", "StatusMsg");
+ db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE);
DBWriteContactSettingUTF8String(hContact, protocolname, "XStatusName", Translate("Playing"));
setBuddyStatusMsg(entry);
- DBWriteContactSettingByte(hContact, protocolname, "XStatusId", xgamelist.iconmngr.getGameIconId(entry->game)+2);
+ db_set_b(hContact, protocolname, "XStatusId", xgamelist.iconmngr.getGameIconId(entry->game)+2);
//buddy vorher ein spielgestartet, wenn nicht sound spielen?
- if(!DBGetContactSettingWord(hContact, protocolname, "GameId",0))
+ if(!db_get_w(hContact, protocolname, "GameId",0))
SkinPlaySound("xfirebstartgame");
- DBWriteContactSettingWord(hContact, protocolname, "GameId", entry->game);
+ db_set_w(hContact, protocolname, "GameId", entry->game);
}
else
{
SetIcon(hContact,(HANDLE)-1);
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "XStatusId");
- DBDeleteContactSetting(hContact, protocolname, "XStatusName");
- DBDeleteContactSetting(hContact, protocolname, "RGame");
- DBDeleteContactSetting(hContact, protocolname, "GameId");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "XStatusMsg");
+ db_unset(hContact, protocolname, "XStatusId");
+ db_unset(hContact, protocolname, "XStatusName");
+ db_unset(hContact, protocolname, "RGame");
+ db_unset(hContact, protocolname, "GameId");
setBuddyStatusMsg(entry);
}
}
@@ -3150,20 +3096,20 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) SetIcon(hContact,(HANDLE)-1);
SetIcon(hContact,(HANDLE)-1,2);
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
- DBDeleteContactSetting(hContact, protocolname, "RVoice");
- DBDeleteContactSetting(hContact, protocolname, "RGame");
- DBDeleteContactSetting(hContact, protocolname, "GameId");
- DBDeleteContactSetting(hContact, protocolname, "VoiceId");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "RVoice");
+ db_unset(hContact, protocolname, "RGame");
+ db_unset(hContact, protocolname, "GameId");
+ db_unset(hContact, protocolname, "VoiceId");
}
else
{
- if(DBGetContactSettingWord(entry->hcontact, protocolname, "Status", -1)==ID_STATUS_OFFLINE)
+ if(db_get_w(entry->hcontact, protocolname, "Status", -1)==ID_STATUS_OFFLINE)
{
- if(DBGetContactSettingByte(NULL, protocolname, "noclanavatars", 0)==1&&clan>0)
+ if(db_get_b(NULL, protocolname, "noclanavatars", 0)==1&&clan>0)
;
else
if(myClient) myClient->CheckAvatar(entry);
@@ -3171,75 +3117,75 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) SetIcon(hContact,(HANDLE)-1);
SetIcon(hContact,(HANDLE)-1,2);
- DBWriteContactSettingWord(hContact, protocolname, "Status", ID_STATUS_ONLINE);
- DBWriteContactSettingString(entry->hcontact, protocolname, "MirVer", "xfire");
- if(clan>0) DBWriteContactSettingDword(hContact, protocolname, "Clan", clan);
+ db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE);
+ db_set_s(entry->hcontact, protocolname, "MirVer", "xfire");
+ if(clan>0) db_set_dw(hContact, protocolname, "Clan", clan);
//DBWriteContactSettingUTF8String(hContact, "CList", "StatusMsg", "");
- DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "XStatusId");
- DBDeleteContactSetting(hContact, protocolname, "XStatusName");
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
- DBDeleteContactSetting(hContact, protocolname, "RVoice");
- DBDeleteContactSetting(hContact, protocolname, "RGame");
- DBDeleteContactSetting(hContact, protocolname, "GameId");
- DBDeleteContactSetting(hContact, protocolname, "VoiceId");
+ db_unset(hContact, protocolname, "XStatusMsg");
+ db_unset(hContact, protocolname, "XStatusId");
+ db_unset(hContact, protocolname, "XStatusName");
+ db_unset(hContact, "CList", "StatusMsg");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "RVoice");
+ db_unset(hContact, protocolname, "RGame");
+ db_unset(hContact, protocolname, "GameId");
+ db_unset(hContact, protocolname, "VoiceId");
}
}
if(group!=NULL)
{
- if(!DBGetContactSettingByte(NULL,protocolname,"noclangroups",0))
+ if(!db_get_b(NULL,protocolname,"noclangroups",0))
{
if(clan>0)
{
- int val=DBGetContactSettingByte(NULL,protocolname,"mainclangroup",0);
+ int val=db_get_b(NULL,protocolname,"mainclangroup",0);
- if( DBGetContactSettingByte(NULL,protocolname,"skipfriendsgroups",0)==0 ||
- (DBGetContactSettingByte(NULL,protocolname,"skipfriendsgroups",0)==1&&
- DBGetContactSettingByte(entry->hcontact, protocolname, "isfriend", 0)==0)
+ if( db_get_b(NULL,protocolname,"skipfriendsgroups",0)==0 ||
+ (db_get_b(NULL,protocolname,"skipfriendsgroups",0)==1&&
+ db_get_b(entry->hcontact, protocolname, "isfriend", 0)==0)
)
{
if(val==0)
{
- DBWriteContactSettingString(entry->hcontact, "CList", "Group", group);
+ db_set_s(entry->hcontact, "CList", "Group", group);
}
else
{
char temp[256];
DBVARIANT dbv;
sprintf_s(temp,256,"%d",val-1);
- DBGetContactSettingString(NULL,"CListGroups",temp,&dbv);
+ db_get_s(NULL,"CListGroups",temp,&dbv);
if(dbv.pszVal!=NULL)
{
sprintf_s(temp,256,"%s\\%s",&dbv.pszVal[1],group);
- DBWriteContactSettingString(entry->hcontact, "CList", "Group", temp);
- DBFreeVariant(&dbv);
+ db_set_s(entry->hcontact, "CList", "Group", temp);
+ db_free(&dbv);
}
}
}
}
else if(clan==-1)//hauptgruppe für fof
{
- int val=DBGetContactSettingByte(NULL,protocolname,"fofgroup",0);
+ int val=db_get_b(NULL,protocolname,"fofgroup",0);
if(val==0)
{
- DBWriteContactSettingString(entry->hcontact, "CList", "Group", group);
+ db_set_s(entry->hcontact, "CList", "Group", group);
}
else
{
char temp[256];
DBVARIANT dbv;
sprintf_s(temp,256,"%d",val-1);
- DBGetContactSettingString(NULL,"CListGroups",temp,&dbv);
+ db_get_s(NULL,"CListGroups",temp,&dbv);
if(dbv.pszVal!=NULL)
{
sprintf_s(temp,256,"%s\\%s",&dbv.pszVal[1],group);
- DBWriteContactSettingString(entry->hcontact, "CList", "Group", temp);
- DBFreeVariant(&dbv);
+ db_set_s(entry->hcontact, "CList", "Group", temp);
+ db_free(&dbv);
}
}
}
@@ -3247,7 +3193,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) }
else
{
- DBWriteContactSettingByte(entry->hcontact, protocolname, "isfriend", 1);
+ db_set_b(entry->hcontact, protocolname, "isfriend", 1);
}
return hContact;
@@ -3259,7 +3205,7 @@ INT_PTR AddtoList( WPARAM wParam, LPARAM lParam ) { if (ccs->hContact)
{
DBVARIANT dbv2;
- if(!DBGetContactSetting(ccs->hContact,protocolname,"Username",&dbv2)) {
+ if(!db_get(ccs->hContact,protocolname,"Username",&dbv2)) {
if(myClient!=NULL)
if(myClient->client->connected)
@@ -3270,7 +3216,7 @@ INT_PTR AddtoList( WPARAM wParam, LPARAM lParam ) { }
//temporären buddy entfernen, da eh ein neues packet kommt
- DBWriteContactSettingByte(ccs->hContact, protocolname, "DontSendDenyPacket", 1);
+ db_set_b(ccs->hContact, protocolname, "DontSendDenyPacket", 1);
CallService(MS_DB_CONTACT_DELETE, (WPARAM) ccs->hContact, 0);
}
}
@@ -3333,7 +3279,7 @@ void CreateGroup(char*grpn,char*field) { DBVARIANT dbv;
char* grp[255];
- int val=DBGetContactSettingByte(NULL,protocolname,field,0);
+ int val=db_get_b(NULL,protocolname,field,0);
if(val==0)
{
@@ -3344,16 +3290,16 @@ void CreateGroup(char*grpn,char*field) { char temp[255];
DBVARIANT dbv;
sprintf_s(temp,255,"%d",val-1);
- DBGetContactSettingString(NULL,"CListGroups",temp,&dbv);
+ db_get_s(NULL,"CListGroups",temp,&dbv);
if(dbv.pszVal!=NULL)
{
sprintf_s((char*)grp,255,"%s\\%s",&dbv.pszVal[1],(char*)grpn);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else //gruppe existiert nciht mehr, auf root alles legen
{
strcpy_s((char*)grp,255,grpn);
- DBWriteContactSettingByte(NULL,protocolname,field,0);
+ db_set_b(NULL,protocolname,field,0);
}
}
@@ -3364,22 +3310,22 @@ void CreateGroup(char*grpn,char*field) { for (i = 0;; i++)
{
sprintf(temp,"%d",i);
- if (DBGetContactSettingString(NULL, "CListGroups", temp, &dbv))
+ if (db_get_s(NULL, "CListGroups", temp, &dbv))
{
i--;
break;
}
if (dbv.pszVal[0] != '\0' && !lstrcmp(dbv.pszVal + 1, (char*)grp)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
strcpy_s(group,255,"D");
strcat_s(group,255,(char*)grp);
group[0]= 1 | GROUPF_EXPANDED;
sprintf(temp,"%d",i+1);
- DBWriteContactSettingString(NULL, "CListGroups", temp, group);
+ db_set_s(NULL, "CListGroups", temp, group);
CallServiceSync(MS_CLUI_GROUPADDED, i + 1, 0);
}
@@ -3392,7 +3338,7 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) { {
strcpy(statusmessage[0],"");
}
- else if((wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE)/*&&DBGetContactSettingByte(NULL,protocolname,"nocustomaway",0)==0*/)
+ else if((wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE)/*&&db_get_b(NULL,protocolname,"nocustomaway",0)==0*/)
{
strcpy(statusmessage[1],"(AFK) Away from Keyboard");
}
@@ -3403,7 +3349,7 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) { {
strcpy(statusmessage[0],( char* )lParam);
}
- else if((wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE)&&DBGetContactSettingByte(NULL,protocolname,"nocustomaway",0)==0&&strlen(( char* )lParam)>0)
+ else if((wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE)&&db_get_b(NULL,protocolname,"nocustomaway",0)==0&&strlen(( char* )lParam)>0)
{
sprintf(statusmessage[1], "(AFK) %s", (char*)lParam);
//strcpy(statusmessage[1],( char* )lParam);
@@ -3451,7 +3397,7 @@ INT_PTR SetNickName(WPARAM newnick, LPARAM lparam) if(myClient->client->connected)
{
myClient->setNick((char*)newnick);
- DBWriteContactSettingString(NULL,protocolname,"Nick",(char*)newnick);
+ db_set_s(NULL,protocolname,"Nick",(char*)newnick);
return TRUE;
}
return FALSE;
@@ -3483,25 +3429,27 @@ INT_PTR GetAwayMsg(WPARAM /*wParam*/, LPARAM lParam) return 1;
}
-int ContactDeleted(WPARAM wParam,LPARAM lParam) {
- if(!DBGetContactSettingByte((HANDLE)wParam, protocolname, "DontSendDenyPacket", 0))
- if(DBGetContactSettingByte((HANDLE)wParam,"CList","NotOnList",0))
+int ContactDeleted(WPARAM wParam,LPARAM lParam)
+{
+ if(!db_get_b((HANDLE)wParam, protocolname, "DontSendDenyPacket", 0))
+ if(db_get_b((HANDLE)wParam,"CList","NotOnList",0))
+ {
+ if(myClient!=NULL)
+ if(myClient->client->connected)
{
- if(myClient!=NULL)
- if(myClient->client->connected)
- {
- DBVARIANT dbv2;
- if(!DBGetContactSetting((HANDLE)wParam,protocolname,"Username",&dbv2)) {
- SendDenyInvitationPacket deny;
- deny.name = dbv2.pszVal;
- myClient->client->send( &deny );
- }
- }
- }
- return 0;
+ DBVARIANT dbv2;
+ if(!db_get((HANDLE)wParam,protocolname,"Username",&dbv2)) {
+ SendDenyInvitationPacket deny;
+ deny.name = dbv2.pszVal;
+ myClient->client->send( &deny );
+ }
+ }
+ }
+ return 0;
}
-INT_PTR StartGame(WPARAM wParam,LPARAM lParam,LPARAM fParam) {
+INT_PTR StartGame(WPARAM wParam,LPARAM lParam,LPARAM fParam)
+{
//gamelist blocken
xgamelist.Block(TRUE);
@@ -3522,7 +3470,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) { char temp[256];
DBVARIANT dbv;
- if(!DBGetContactSettingString((HANDLE)wParam, protocolname, "Username",&dbv))
+ if(!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
{
sprintf(temp,Translate("Do you really want delete your friend %s?"),dbv.pszVal);
if(MessageBoxA(NULL,temp,Translate("Confirm Delete"),MB_YESNO|MB_ICONQUESTION)==IDYES)
@@ -3533,7 +3481,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) { {
SendRemoveBuddyPacket removeBuddy;
- removeBuddy.userid=DBGetContactSettingDword((HANDLE)wParam,protocolname,"UserId",0);
+ removeBuddy.userid=db_get_dw((HANDLE)wParam,protocolname,"UserId",0);
if(removeBuddy.userid!=0)
{
@@ -3542,7 +3490,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) { }
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -3550,7 +3498,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) { INT_PTR BlockFriend(WPARAM wParam,LPARAM lParam) {
DBVARIANT dbv;
- if(!DBGetContactSettingString((HANDLE)wParam, protocolname, "Username",&dbv))
+ if(!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
{
if(MessageBoxA(NULL,Translate("Block this user from ever contacting you again?"),Translate("Block Confirmation"),MB_YESNO|MB_ICONQUESTION)==IDYES)
{
@@ -3558,7 +3506,7 @@ INT_PTR BlockFriend(WPARAM wParam,LPARAM lParam) { {
if(myClient->client->connected)
{
- DBWriteContactSettingByte(NULL,"XFireBlock",dbv.pszVal,1);
+ db_set_b(NULL,"XFireBlock",dbv.pszVal,1);
SendDenyInvitationPacket deny;
deny.name = dbv.pszVal;
@@ -3567,7 +3515,7 @@ INT_PTR BlockFriend(WPARAM wParam,LPARAM lParam) { }
}
CallService( MS_DB_CONTACT_DELETE, (WPARAM) wParam, 1 );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -3577,7 +3525,7 @@ INT_PTR StartThisGame(WPARAM wParam,LPARAM lParam) { xgamelist.Block(TRUE);
//hole die gameid des spiels
- int id=DBGetContactSettingWord((HANDLE)wParam, protocolname, "GameId",0);
+ int id=db_get_w((HANDLE)wParam, protocolname, "GameId",0);
//hole passendes spielobjekt
Xfire_game*game=xgamelist.getGamebyGameid(id);
@@ -3597,7 +3545,7 @@ INT_PTR JoinGame(WPARAM wParam,LPARAM lParam) { xgamelist.Block(TRUE);
//hole die gameid des spiels
- int id=DBGetContactSettingWord((HANDLE)wParam, protocolname, "GameId",0);
+ int id=db_get_w((HANDLE)wParam, protocolname, "GameId",0);
//hole passendes spielobjekt
Xfire_game*game=xgamelist.getGamebyGameid(id);
@@ -3606,12 +3554,12 @@ INT_PTR JoinGame(WPARAM wParam,LPARAM lParam) { if(game)
{
DBVARIANT dbv; //dbv.pszVal
- int port=DBGetContactSettingWord((HANDLE)wParam, protocolname, "Port",0);
- if(!DBGetContactSettingString((HANDLE)wParam, protocolname, "ServerIP",&dbv))
+ int port=db_get_w((HANDLE)wParam, protocolname, "Port",0);
+ if(!db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv))
{
//starte spiel mit netzwerk parametern
game->start_game(dbv.pszVal,port);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -3627,12 +3575,12 @@ int doneQuery( WPARAM wParam, LPARAM lParam ) { char temp[256];
BuddyListEntry* bud=(BuddyListEntry*)wParam;
gServerstats* gameinfo = (gServerstats*)lParam;
- DBWriteContactSettingString(bud->hcontact, protocolname, "ServerName", gameinfo->name);
- DBWriteContactSettingString(bud->hcontact, protocolname, "GameType", gameinfo->gametype);
- DBWriteContactSettingString(bud->hcontact, protocolname, "Map", gameinfo->map);
+ db_set_s(bud->hcontact, protocolname, "ServerName", gameinfo->name);
+ db_set_s(bud->hcontact, protocolname, "GameType", gameinfo->gametype);
+ db_set_s(bud->hcontact, protocolname, "Map", gameinfo->map);
sprintf(temp,"(%d/%d)",gameinfo->players,gameinfo->maxplayers);
- DBWriteContactSettingString(bud->hcontact, protocolname, "Players", temp);
- DBWriteContactSettingByte(bud->hcontact, protocolname, "Passworded", gameinfo->password);
+ db_set_s(bud->hcontact, protocolname, "Players", temp);
+ db_set_b(bud->hcontact, protocolname, "Passworded", gameinfo->password);
if(myClient!=NULL)
handlingBuddys(bud,0,NULL,TRUE);
@@ -3668,18 +3616,18 @@ int IconLibChanged(WPARAM wParam, LPARAM lParam) { INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)!=0)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)!=0)
return GAIR_NOAVATAR;
- pai->format=DBGetContactSettingWord(pai->hContact,"ContactPhoto","Format",0);
+ pai->format=db_get_w(pai->hContact,"ContactPhoto","Format",0);
if(pai->format==0)
return GAIR_NOAVATAR;
DBVARIANT dbv;
- if(!DBGetContactSetting(pai->hContact,"ContactPhoto","File",&dbv))
+ if(!db_get(pai->hContact,"ContactPhoto","File",&dbv))
{
strcpy(pai->filename,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
return GAIR_NOAVATAR;
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index e5e9b1ee2e..f252282e40 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -169,30 +169,30 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else
dllfound = FALSE;
- if(!DBGetContactSetting(NULL,protocolname,"login",&dbv)) {
+ if(!db_get(NULL,protocolname,"login",&dbv)) {
SetDlgItemText(hwndDlg,IDC_LOGIN,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(NULL,protocolname,"Nick",&dbv)) {
+ if(!db_get(NULL,protocolname,"Nick",&dbv)) {
SetDlgItemText(hwndDlg,IDC_NICK,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(NULL,protocolname,"password",&dbv)) {
+ if(!db_get(NULL,protocolname,"password",&dbv)) {
//bit of a security hole here, since it's easy to extract a password from an edit box
CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,(LPARAM)dbv.pszVal);
SetDlgItemText(hwndDlg,IDC_PASSWORD,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
char temp[255]="";
- sprintf(temp,"%d",DBGetContactSettingByte(NULL,protocolname,"protover",0x5b));
+ sprintf(temp,"%d",db_get_b(NULL,protocolname,"protover",0x5b));
SetDlgItemText(hwndDlg,IDC_PVER,temp);
EnableWindow(GetDlgItem(hwndDlg,IDC_LASTGAME),FALSE);
- if(!DBGetContactSetting(NULL,protocolname,"LastGame",&dbv)) {
+ if(!db_get(NULL,protocolname,"LastGame",&dbv)) {
SetDlgItemText(hwndDlg,IDC_LASTGAME,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if(bpStatus==ID_STATUS_OFFLINE&&bpStatus!=ID_STATUS_CONNECTING) {
@@ -267,9 +267,9 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR GetDlgItemText(hwndDlg,IDC_LOGIN,login,sizeof(login));
dbv.pszVal=NULL;
- if(DBGetContactSetting(NULL,protocolname,"login",&dbv) || strcmp(login,dbv.pszVal))
+ if(db_get(NULL,protocolname,"login",&dbv) || strcmp(login,dbv.pszVal))
reconnectRequired=1;
- if(dbv.pszVal!=NULL) DBFreeVariant(&dbv);
+ if(dbv.pszVal!=NULL) db_free(&dbv);
//den login lowercasen
int size=strlen(login);
@@ -285,26 +285,26 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemText(hwndDlg,IDC_LOGIN,login);
}
- DBWriteContactSettingString(NULL,protocolname,"login",login);
- DBWriteContactSettingString(NULL,protocolname,"Username",login);
+ db_set_s(NULL,protocolname,"login",login);
+ db_set_s(NULL,protocolname,"Username",login);
//nur wenn der nick erfolgreich übertragen wurde
GetDlgItemText(hwndDlg,IDC_NICK,login,sizeof(login));
dbv.pszVal=NULL;
- if(DBGetContactSetting(NULL,protocolname,"Nick",&dbv) || strcmp(login,dbv.pszVal))
+ if(db_get(NULL,protocolname,"Nick",&dbv) || strcmp(login,dbv.pszVal))
{
if(CallService(XFIRE_SET_NICK,0,(WPARAM)login))
- DBWriteContactSettingString(NULL,protocolname,"Nick",login);
+ db_set_s(NULL,protocolname,"Nick",login);
}
- if(dbv.pszVal!=NULL) DBFreeVariant(&dbv);
+ if(dbv.pszVal!=NULL) db_free(&dbv);
GetDlgItemText(hwndDlg,IDC_PASSWORD,str,sizeof(str));
CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),(LPARAM)str);
dbv.pszVal=NULL;
- if(DBGetContactSetting(NULL,protocolname,"password",&dbv) || strcmp(str,dbv.pszVal))
+ if(db_get(NULL,protocolname,"password",&dbv) || strcmp(str,dbv.pszVal))
reconnectRequired=1;
- if(dbv.pszVal!=NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL,protocolname,"password",str);
+ if(dbv.pszVal!=NULL) db_free(&dbv);
+ db_set_s(NULL,protocolname,"password",str);
GetDlgItemText(hwndDlg,IDC_SERVER,str,sizeof(str));
//neue preferencen sichern
@@ -315,7 +315,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR {
if(!(BYTE)IsDlgButtonChecked(hwndDlg, xfireconfigitems[i].id))
{
- DBWriteContactSettingByte(NULL,protocolname,xfireconfigitems[i].dbentry,0);
+ db_set_b(NULL,protocolname,xfireconfigitems[i].dbentry,0);
xfireconfig[xfireconfigitems[i].xfireconfigid].wasset=1;
xfireconfig[xfireconfigitems[i].xfireconfigid].data[0]=1;
xfireconfig[xfireconfigitems[i].xfireconfigid].data[1]=1;
@@ -325,7 +325,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else
{
xfireconfig[xfireconfigitems[i].xfireconfigid].wasset=0;
- DBWriteContactSettingByte(NULL,protocolname,xfireconfigitems[i].dbentry,1);
+ db_set_b(NULL,protocolname,xfireconfigitems[i].dbentry,1);
}
}
CallService(XFIRE_SEND_PREFS,0,0);
@@ -333,7 +333,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //protocolversion wird autoamtisch vergeben
//GetDlgItemText(hwndDlg,IDC_PVER,str,sizeof(str));
- //DBWriteContactSettingByte(NULL,protocolname,"protover",(char)atoi(str));
+ //db_set_b(NULL,protocolname,"protover",(char)atoi(str));
if(reconnectRequired) MessageBox(hwndDlg,Translate("The changes you have made require you to reconnect to the XFire network before they take effect"),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION);
return TRUE;
@@ -375,9 +375,9 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage( hwndDlg, IDC_SCANUPDATECB, CB_ADDSTRING, 0, (LPARAM)TranslateT("On every start" ));
SendDlgItemMessage( hwndDlg, IDC_SCANUPDATECB, CB_ADDSTRING, 0, (LPARAM)TranslateT("Daily" ));
- SendDlgItemMessage( hwndDlg, IDC_SCANUPDATECB, CB_SETCURSEL, DBGetContactSettingByte(NULL,protocolname,"scanalways",0), 0);
+ SendDlgItemMessage( hwndDlg, IDC_SCANUPDATECB, CB_SETCURSEL, db_get_b(NULL,protocolname,"scanalways",0), 0);
- SendDlgItemMessage( hwndDlg, IDC_NOMSG, CB_SETCURSEL, nomsgboxsel[DBGetContactSettingByte(NULL,protocolname,"nomsgbox",0)], 0);
+ SendDlgItemMessage( hwndDlg, IDC_NOMSG, CB_SETCURSEL, nomsgboxsel[db_get_b(NULL,protocolname,"nomsgbox",0)], 0);
/* Gruppen raussuchen */
{
@@ -389,7 +389,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>" ));
sprintf_s(temp,8,"%d",gruppen_id);
- while(!DBGetContactSettingString(NULL,"CListGroups",temp,&dbv))
+ while(!db_get_s(NULL,"CListGroups",temp,&dbv))
{
gruppen_id++;
sprintf_s(temp,8,"%d",gruppen_id);
@@ -397,11 +397,11 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if(dbv.pszVal!=NULL) {
SendDlgItemMessage( hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
- SendDlgItemMessage( hwndDlg, IDC_CLANGROUP, CB_SETCURSEL, DBGetContactSettingByte(NULL,protocolname,"mainclangroup",0), 0);
- SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_SETCURSEL, DBGetContactSettingByte(NULL,protocolname,"fofgroup",0), 0);
+ SendDlgItemMessage( hwndDlg, IDC_CLANGROUP, CB_SETCURSEL, db_get_b(NULL,protocolname,"mainclangroup",0), 0);
+ SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_SETCURSEL, db_get_b(NULL,protocolname,"fofgroup",0), 0);
}
@@ -445,7 +445,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else
{
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(DBGetContactSettingByte(NULL,protocolname,mytree[i].dbentry,0)==1?2:1);
+ tvis.item.state = INDEXTOSTATEIMAGEMASK(db_get_b(NULL,protocolname,mytree[i].dbentry,0)==1?2:1);
tvis.item.lParam = 0;
tvis.item.pszText = Translate(mytree[i].name);
mytree[i].hitem=TreeView_InsertItem( hwndTree, &tvis );
@@ -542,24 +542,24 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TreeView_GetItem(hwndTree, &tvic);
if ((( tvic.state & TVIS_STATEIMAGEMASK ) >> 12 == 2 ))
- DBWriteContactSettingByte(NULL,protocolname,mytree[i].dbentry,1);
+ db_set_b(NULL,protocolname,mytree[i].dbentry,1);
else
- DBWriteContactSettingByte(NULL,protocolname,mytree[i].dbentry,0);
+ db_set_b(NULL,protocolname,mytree[i].dbentry,0);
}
}
- DBWriteContactSettingByte(NULL,protocolname,"nomsgbox",(BYTE)nomsgboxsel[SendDlgItemMessage(hwndDlg, IDC_NOMSG, CB_GETCURSEL, 0, 0)]);
+ db_set_b(NULL,protocolname,"nomsgbox",(BYTE)nomsgboxsel[SendDlgItemMessage(hwndDlg, IDC_NOMSG, CB_GETCURSEL, 0, 0)]);
ccc=SendDlgItemMessage(hwndDlg, IDC_CLANGROUP, CB_GETCURSEL, 0, 0);
- DBWriteContactSettingByte(NULL,protocolname,"mainclangroup",(BYTE)ccc);
+ db_set_b(NULL,protocolname,"mainclangroup",(BYTE)ccc);
ccc=SendDlgItemMessage(hwndDlg, IDC_FOFGROUP, CB_GETCURSEL, 0, 0);
- DBWriteContactSettingByte(NULL,protocolname,"fofgroup",(BYTE)ccc);
+ db_set_b(NULL,protocolname,"fofgroup",(BYTE)ccc);
ccc=SendDlgItemMessage(hwndDlg, IDC_SCANUPDATECB, CB_GETCURSEL, 0, 0);
- DBWriteContactSettingByte(NULL,protocolname,"scanalways",(BYTE)ccc);
+ db_set_b(NULL,protocolname,"scanalways",(BYTE)ccc);
//protocolversion wird autoamtisch vergeben
//GetDlgItemText(hwndDlg,IDC_PVER,str,sizeof(str));
- //DBWriteContactSettingByte(NULL,protocolname,"protover",(char)atoi(str));
+ //db_set_b(NULL,protocolname,"protover",(char)atoi(str));
if(reconnectRequired) MessageBox(hwndDlg,Translate("The changes you have made require you to reconnect to the XFire network before they take effect"),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION);
return TRUE;
@@ -651,7 +651,7 @@ static INT_PTR CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR {
SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETTEXT, sel, (LPARAM)temp);
SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_DELETESTRING, sel, 0);
- DBDeleteContactSetting(NULL,"XFireBlock",temp);
+ db_unset(NULL,"XFireBlock",temp);
if(SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETCOUNT, 0, 0)==0)
EnableDlgItem(hwndDlg, IDC_REMUSER, FALSE);
}
@@ -689,12 +689,12 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR {
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg,IDC_ENABLESTSMSG,DBGetContactSettingByte(NULL,protocolname,"autosetstatusmsg",0));
- CheckDlgButton(hwndDlg,IDC_CHGSTATUS,DBGetContactSettingByte(NULL,protocolname,"statuschgtype",0));
- CheckDlgButton(hwndDlg,IDC_DNDFIRST,DBGetContactSettingByte(NULL,protocolname,"dndfirst",0));
- if(!DBGetContactSetting(NULL,protocolname,"setstatusmsg",&dbv)) {
+ CheckDlgButton(hwndDlg,IDC_ENABLESTSMSG,db_get_b(NULL,protocolname,"autosetstatusmsg",0));
+ CheckDlgButton(hwndDlg,IDC_CHGSTATUS,db_get_b(NULL,protocolname,"statuschgtype",0));
+ CheckDlgButton(hwndDlg,IDC_DNDFIRST,db_get_b(NULL,protocolname,"dndfirst",0));
+ if(!db_get(NULL,protocolname,"setstatusmsg",&dbv)) {
SetDlgItemText(hwndDlg,IDC_STATUSMSG,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if(!IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG))
{
@@ -740,11 +740,11 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR char str[512];
GetDlgItemText(hwndDlg,IDC_STATUSMSG,str,sizeof(str));
- DBWriteContactSettingString(NULL,protocolname,"setstatusmsg",str);
+ db_set_s(NULL,protocolname,"setstatusmsg",str);
- DBWriteContactSettingByte(NULL,protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG));
- DBWriteContactSettingByte(NULL,protocolname, "statuschgtype", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHGSTATUS));
- DBWriteContactSettingByte(NULL,protocolname, "dndfirst", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DNDFIRST));
+ db_set_b(NULL,protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG));
+ db_set_b(NULL,protocolname, "statuschgtype", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHGSTATUS));
+ db_set_b(NULL,protocolname, "dndfirst", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DNDFIRST));
return TRUE;
}
@@ -786,13 +786,13 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //spielliste leeren
SendDlgItemMessage( (HWND)hwndDlg, IDC_LGAMELIST, LB_RESETCONTENT, 0, 0);
//spiele auslesen und in die liste einfügen
- int found=DBGetContactSettingWord(NULL,protocolname,"foundgames",0);
+ int found=db_get_w(NULL,protocolname,"foundgames",0);
char temp[XFIRE_MAXSIZEOFGAMENAME];
for(int i=0;i<found;i++)
{
//id auslesen
sprintf_s(temp,XFIRE_MAXSIZEOFGAMENAME,"gameid_%d",i);
- int gameid=DBGetContactSettingWord(NULL,protocolname,temp,0);
+ int gameid=db_get_w(NULL,protocolname,temp,0);
//spielnamen auslesen
xgamelist.getGamename(gameid,temp,XFIRE_MAXSIZEOFGAMENAME);
//eintrag einfügen
@@ -1001,11 +1001,11 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //gameskip wert setzen
char temp[64]="";
sprintf_s(temp,64,"gameskip_%d",gameid);
- CheckDlgButton(hwndDlg,IDC_DONTDETECT,DBGetContactSettingByte(NULL,protocolname,temp,0));
+ CheckDlgButton(hwndDlg,IDC_DONTDETECT,db_get_b(NULL,protocolname,temp,0));
sprintf_s(temp,64,"gamenostatus_%d",gameid);
- CheckDlgButton(hwndDlg,IDC_NOSTATUSMSG,DBGetContactSettingByte(NULL,protocolname,temp,0));
+ CheckDlgButton(hwndDlg,IDC_NOSTATUSMSG,db_get_b(NULL,protocolname,temp,0));
sprintf_s(temp,64,"notinstartmenu_%d",gameid);
- CheckDlgButton(hwndDlg,IDC_NOTINSTARTMENU,DBGetContactSettingByte(NULL,protocolname,temp,0));
+ CheckDlgButton(hwndDlg,IDC_NOTINSTARTMENU,db_get_b(NULL,protocolname,temp,0));
//extra parameter auslesen, aber nur, wenn das spiel auch sowas unterstützt
if(xgtemp && xgtemp->haveExtraGameArgs())
@@ -1013,10 +1013,10 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, TRUE);
sprintf_s(temp,64,"gameextraparams_%d",gameid);
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,temp,&dbv))
+ if(!db_get(NULL,protocolname,temp,&dbv))
{
SetDlgItemText(hwndDlg,IDC_EXTRAPARAMS,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemText(hwndDlg,IDC_EXTRAPARAMS,"");
diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp index 38f195b127..32ac9d9808 100644 --- a/protocols/Xfire/src/processbuddyinfo.cpp +++ b/protocols/Xfire/src/processbuddyinfo.cpp @@ -5,10 +5,10 @@ /*
-DBWriteContactSettingString(xsa->hContact, "ContactPhoto", "Backup", av.backup);
-DBWriteContactSettingString(xsa->hContact, "ContactPhoto", "File", av.file);
-DBWriteContactSettingString(xsa->hContact, "ContactPhoto", "RFile", av.rfile);
-DBWriteContactSettingWord(xsa->hContact, "ContactPhoto", "Format", av.type);
+db_set_s(xsa->hContact, "ContactPhoto", "Backup", av.backup);
+db_set_s(xsa->hContact, "ContactPhoto", "File", av.file);
+db_set_s(xsa->hContact, "ContactPhoto", "RFile", av.rfile);
+db_set_w(xsa->hContact, "ContactPhoto", "Format", av.type);
*/
extern HANDLE XFireAvatarFolder;
@@ -36,18 +36,18 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* //versuche doppeltes laden zuvermeiden
if(hcontact) //avatar von freunden
{
- if(DBGetContactSettingDword(hcontact, "ContactPhoto", "XFireAvatarId", 0)==buddyinfo->avatarid &&
- DBGetContactSettingByte(hcontact, "ContactPhoto", "XFireAvatarMode", 0)==buddyinfo->avatarmode)
+ if(db_get_dw(hcontact, "ContactPhoto", "XFireAvatarId", 0)==buddyinfo->avatarid &&
+ db_get_b(hcontact, "ContactPhoto", "XFireAvatarMode", 0)==buddyinfo->avatarmode)
return;
}
else //eigeneder avatar
{
- if(DBGetContactSettingDword(hcontact, protocolname, "XFireAvatarId", 0)==buddyinfo->avatarid &&
- DBGetContactSettingByte(hcontact, protocolname, "XFireAvatarMode", 0)==buddyinfo->avatarmode)
+ if(db_get_dw(hcontact, protocolname, "XFireAvatarId", 0)==buddyinfo->avatarid &&
+ db_get_b(hcontact, protocolname, "XFireAvatarMode", 0)==buddyinfo->avatarmode)
return;
//alten dateipfad des avatars löschen, wenn sichw as geändert hat
- DBDeleteContactSetting(NULL,protocolname, "MyAvatarFile");
+ db_unset(NULL,protocolname, "MyAvatarFile");
}
strcpy(filename, XFireGetFoldersPath ("Avatar"));
@@ -88,8 +88,8 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* {
if(hcontact) //buddyavatar setzen
{
- DBWriteContactSettingDword(hcontact, "ContactPhoto", "XFireAvatarId", buddyinfo->avatarid);
- DBWriteContactSettingByte(hcontact, "ContactPhoto", "XFireAvatarMode", buddyinfo->avatarmode);
+ db_set_dw(hcontact, "ContactPhoto", "XFireAvatarId", buddyinfo->avatarid);
+ db_set_b(hcontact, "ContactPhoto", "XFireAvatarMode", buddyinfo->avatarmode);
PROTO_AVATAR_INFORMATION AI;
AI.cbSize = sizeof(AI);
AI.format = type;
@@ -99,10 +99,10 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* }
else //eigenen avatar setzen
{
- DBWriteContactSettingDword(NULL, protocolname, "XFireAvatarId", buddyinfo->avatarid);
- DBWriteContactSettingByte(NULL, protocolname, "XFireAvatarMode", buddyinfo->avatarmode);
+ db_set_dw(NULL, protocolname, "XFireAvatarId", buddyinfo->avatarid);
+ db_set_b(NULL, protocolname, "XFireAvatarMode", buddyinfo->avatarmode);
//neuen avatarfilepath eintragen
- DBWriteContactSettingString(NULL,protocolname, "MyAvatarFile",filename);
+ db_set_s(NULL,protocolname, "MyAvatarFile",filename);
//beshceid geben, avatar hat sich geändert
CallService(MS_AV_REPORTMYAVATARCHANGED,(WPARAM)protocolname,0);
}
diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp index e7d1137c30..509dc28d0a 100644 --- a/protocols/Xfire/src/searching4games.cpp +++ b/protocols/Xfire/src/searching4games.cpp @@ -174,18 +174,18 @@ void Scan4Games( LPVOID lparam ) xgamelist.clearGamelist();
//prüfe ob schon gescannt wurde, dann das aus der db nehmen, beschleunigt den start
- foundgames=DBGetContactSettingWord(NULL, protocolname, "foundgames",-1);
+ foundgames=db_get_w(NULL, protocolname, "foundgames",-1);
//um bei einer neuen version einen rescan zuforcen, bei bestimmten wert found auf 0 resetten
- if(DBGetContactSettingWord(NULL, protocolname, "scanver",0)!=XFIRE_SCAN_VAL)
+ if(db_get_w(NULL, protocolname, "scanver",0)!=XFIRE_SCAN_VAL)
foundgames=-1;
BOOL loadgamesfromdb=FALSE;
- if(DBGetContactSettingByte(NULL,protocolname,"scanalways",0)==0)
+ if(db_get_b(NULL,protocolname,"scanalways",0)==0)
loadgamesfromdb=TRUE;
else
{
- if(DBGetContactSettingByte(NULL,protocolname,"scanalways",0)==2)
+ if(db_get_b(NULL,protocolname,"scanalways",0)==2)
{
time_t zeit;
struct tm *t;
@@ -194,9 +194,9 @@ void Scan4Games( LPVOID lparam ) if(t!=NULL)
{
- if(t->tm_yday!=DBGetContactSettingWord(NULL,protocolname,"scanalways_t",0))
+ if(t->tm_yday!=db_get_w(NULL,protocolname,"scanalways_t",0))
{
- DBWriteContactSettingWord(NULL,protocolname,"scanalways_t",t->tm_yday);
+ db_set_w(NULL,protocolname,"scanalways_t",t->tm_yday);
}
else
loadgamesfromdb=TRUE;
@@ -238,7 +238,7 @@ void Scan4Games( LPVOID lparam ) HWND hwnd=NULL;
//suche dialog anzeigen
- if(!DBGetContactSettingByte(NULL,protocolname,"dontdissstatus",0))
+ if(!db_get_b(NULL,protocolname,"dontdissstatus",0))
{
mir_forkthread(ShowSearchDialog,&hwnd);
}
@@ -717,11 +717,11 @@ void Scan4Games( LPVOID lparam ) xgamelist.writeDatabase();
//scanversion setzen, um ungewollten rescan zu vermeiden
- DBWriteContactSettingWord(NULL, protocolname, "scanver", XFIRE_SCAN_VAL);
+ db_set_w(NULL, protocolname, "scanver", XFIRE_SCAN_VAL);
EndDialog(hwnd,0);
- if(!DBGetContactSettingByte(NULL,protocolname,"dontdisresults",0))
+ if(!db_get_b(NULL,protocolname,"dontdisresults",0))
{
int p=strlen(gamelist)-2;
if(p>-1)
diff --git a/protocols/Xfire/src/services.cpp b/protocols/Xfire/src/services.cpp index 54059eef17..e6147b6009 100644 --- a/protocols/Xfire/src/services.cpp +++ b/protocols/Xfire/src/services.cpp @@ -1,21 +1,21 @@ /*
* Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
*
- * Copyright (C) 2010 by - * dufte <dufte@justmail.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * Copyright (C) 2010 by
+ * dufte <dufte@justmail.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Based on J. Lawler - BaseProtocol
@@ -34,17 +34,17 @@ BOOL IsContactMySelf(std::string buddyusername) { DBVARIANT dbv;
//nur wenn option aktiv, sonst immer FALSE
- if(!DBGetContactSettingByte(NULL,protocolname,"skipmyself",0))
+ if(!db_get_b(NULL,protocolname,"skipmyself",0))
return FALSE;
- if(!DBGetContactSetting(NULL,protocolname,"login",&dbv))
+ if(!db_get(NULL,protocolname,"login",&dbv))
{
if(!lstrcmpiA( dbv.pszVal, buddyusername.c_str() ))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return TRUE;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
return FALSE;
@@ -56,10 +56,10 @@ BOOL IsContactMySelf(std::string buddyusername) { INT_PTR GetMyAvatar(WPARAM wparam,LPARAM lparam) {
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,"MyAvatarFile",&dbv))
+ if(!db_get(NULL,protocolname,"MyAvatarFile",&dbv))
{
strncpy((char*)wparam, dbv.pszVal, (int)lparam);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
diff --git a/protocols/Xfire/src/setnickname.cpp b/protocols/Xfire/src/setnickname.cpp index f2e1863970..c6908755d6 100644 --- a/protocols/Xfire/src/setnickname.cpp +++ b/protocols/Xfire/src/setnickname.cpp @@ -13,9 +13,9 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara SendMessage(hwndDlg,WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,"Nick",&dbv)) {
+ if(!db_get(NULL,protocolname,"Nick",&dbv)) {
SetDlgItemText(hwndDlg,IDC_NICKNAME,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
}
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index 8d16127d26..9dff6e4d61 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -157,7 +157,7 @@ char*menuitemtext(char*mtext) void Message(LPVOID msg)
{
- switch(DBGetContactSettingByte(NULL,protocolname,"nomsgbox",0))
+ switch(db_get_b(NULL,protocolname,"nomsgbox",0))
{
case 1:
return;
@@ -184,7 +184,7 @@ void Message(LPVOID msg) void MessageE(LPVOID msg)
{
static BOOL already=FALSE;
- switch(DBGetContactSettingByte(NULL,protocolname,"nomsgbox",0))
+ switch(db_get_b(NULL,protocolname,"nomsgbox",0))
{
case 0:
if(!already)
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index 13b7548d75..e571dedc6a 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -64,7 +64,7 @@ void LoadProfilStatus(LPVOID lparam) { void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HANDLE hcontact,int type)
{
DBVARIANT dbv;
- if(!DBGetContactSetting(hcontact,protocolname,feld,&dbv)) {
+ if(!db_get(hcontact,protocolname,feld,&dbv)) {
if(type==1)
{
char temp[255];
@@ -75,7 +75,7 @@ void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HANDLE hcontact,int type) {
SetDlgItemText(hwndDlg,feldid,dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
EnableDlgItem(hwndDlg,feldid,TRUE);
}
else
@@ -91,16 +91,16 @@ static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2) HGLOBAL clipbuffer;
char* buffer;
- if(DBGetContactSettingWord((HANDLE)wParam, protocolname, feld2, -1)==0)
+ if(db_get_w((HANDLE)wParam, protocolname, feld2, -1)==0)
return 0;
DBVARIANT dbv;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, feld1,&dbv))
+ if(db_get_s((HANDLE)wParam, protocolname, feld1,&dbv))
return 0;
- sprintf(temp,"%s:%d",dbv.pszVal,DBGetContactSettingWord((HANDLE)wParam, protocolname, feld2, -1));
+ sprintf(temp,"%s:%d",dbv.pszVal,db_get_w((HANDLE)wParam, protocolname, feld2, -1));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if(OpenClipboard(NULL))
{
@@ -121,7 +121,7 @@ static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2) void addToList(HWND listbox,HANDLE hContact,char*key,char*val)
{
DBVARIANT dbv;
- if(!DBGetContactSetting(hContact,protocolname,val,&dbv))
+ if(!db_get(hContact,protocolname,val,&dbv))
{
LVITEM lvitem;
memset(&lvitem,0,sizeof(lvitem));
@@ -134,7 +134,7 @@ void addToList(HWND listbox,HANDLE hContact,char*key,char*val) lvitem.iSubItem++;
lvitem.pszText=dbv.pszVal;
SendMessageA(listbox,LVM_SETITEM,0,(LPARAM)&lvitem);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -262,7 +262,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam if (hContact)
{
DBVARIANT dbv;
- if(!DBGetContactSetting(hContact,protocolname,"Username",&dbv))
+ if(!db_get(hContact,protocolname,"Username",&dbv))
{
int usernamesize=strlen(dbv.pszVal)+1;
char* username=new char[usernamesize];
@@ -272,13 +272,13 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam mir_forkthread(LoadProfilStatus,(LPVOID)username);
}
//LoadProfilStatus
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"GameInfo",&dbv))
+ if(!db_get(hContact,protocolname,"GameInfo",&dbv))
{
setGameInfo(listbox,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
addToList(listbox,hContact,"Servername","ServerName");
@@ -301,26 +301,26 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam {
DBVARIANT dbv;
- if(!DBGetContactSetting(hContact,protocolname,"GameId",&dbv))
+ if(!db_get(hContact,protocolname,"GameId",&dbv))
{
SendMessage(GetDlgItem(hwndDlg,IDC_GAMEICO),STM_SETICON,(WPARAM)xgamelist.iconmngr.getGameIcon(dbv.wVal),0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"VoiceId",&dbv))
+ if(!db_get(hContact,protocolname,"VoiceId",&dbv))
{
SendMessage(GetDlgItem(hwndDlg,IDC_VOICEICO),STM_SETICON,(WPARAM)xgamelist.iconmngr.getGameIcon(dbv.wVal),0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(DBGetContactSetting(hContact,protocolname,"ServerIP",&dbv))
+ if(db_get(hContact,protocolname,"ServerIP",&dbv))
{
EnableWindow(GetDlgItem(hwndDlg,IDC_COPYGAME),FALSE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(DBGetContactSetting(hContact,protocolname,"VServerIP",&dbv))
+ if(db_get(hContact,protocolname,"VServerIP",&dbv))
{
EnableWindow(GetDlgItem(hwndDlg,IDC_COPYVOICE),FALSE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
//ShowWindow(GetDlgItem(hwndDlg,IDC_VOICEICO),FALSE)
@@ -388,30 +388,30 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam char nick[256]="";
char status[256]="";
char game[512]="";
- if(!DBGetContactSetting(hContact,"ContactPhoto","File",&dbv))
+ if(!db_get(hContact,"ContactPhoto","File",&dbv))
{
snprintf(img,256,"<img src=\"%s\">",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"Username",&dbv))
+ if(!db_get(hContact,protocolname,"Username",&dbv))
{
snprintf(username,256,"<b>Username:</b> %s<br>",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"Nick",&dbv))
+ if(!db_get(hContact,protocolname,"Nick",&dbv))
{
snprintf(nick,256,"<b>Nick:</b> %s<br>",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"XStatusMsg",&dbv))
+ if(!db_get(hContact,protocolname,"XStatusMsg",&dbv))
{
snprintf(status,256,"<b>Status:</b> %s<br>",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"RGame",&dbv))
+ if(!db_get(hContact,protocolname,"RGame",&dbv))
{
snprintf(game,512,"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
snprintf(profil,2056,"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
HWND hWnd = ::CreateWindow("AtlAxWin", profil,
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp index d1e0d64df0..34c1dec6f2 100644 --- a/protocols/Xfire/src/variables.cpp +++ b/protocols/Xfire/src/variables.cpp @@ -21,10 +21,10 @@ char* Varxfiregame(ARGUMENTSINFO *ai) {
char temp[256];
DBVARIANT dbv3;
- if(!DBGetContactSetting(ai->fi->hContact,protocolname, "RGame",&dbv3))
+ if(!db_get(ai->fi->hContact,protocolname, "RGame",&dbv3))
{
strncpy(temp,dbv3.pszVal,255);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return mir_strdup(temp);
}
}
@@ -39,10 +39,10 @@ char* Varmyxfiregame(ARGUMENTSINFO *ai) return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(NULL,protocolname, "currentgamename",&dbv3))
+ if(!db_get(NULL,protocolname, "currentgamename",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
ai->flags = AIF_FALSE;
@@ -55,10 +55,10 @@ char* Varxfirevoice(ARGUMENTSINFO *ai) return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(ai->fi->hContact,protocolname, "RVoice",&dbv3))
+ if(!db_get(ai->fi->hContact,protocolname, "RVoice",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
@@ -72,10 +72,10 @@ char* Varmyxfirevoiceip(ARGUMENTSINFO *ai) { return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(NULL,protocolname, "VServerIP",&dbv3))
+ if(!db_get(NULL,protocolname, "VServerIP",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
@@ -88,10 +88,10 @@ char* Varmyxfireserverip(ARGUMENTSINFO *ai) { return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(NULL,protocolname, "ServerIP",&dbv3))
+ if(!db_get(NULL,protocolname, "ServerIP",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
@@ -112,10 +112,10 @@ char* Varxfireserverip(ARGUMENTSINFO *ai) { {
char temp[24];
DBVARIANT dbv3;
- if(!DBGetContactSetting(ai->fi->hContact,protocolname, "ServerIP",&dbv3))
+ if(!db_get(ai->fi->hContact,protocolname, "ServerIP",&dbv3))
{
- sprintf(temp,"%s:%d",dbv3.pszVal,DBGetContactSettingWord(ai->fi->hContact,protocolname, "Port",0));
- DBFreeVariant(&dbv3);
+ sprintf(temp,"%s:%d",dbv3.pszVal,db_get_w(ai->fi->hContact,protocolname, "Port",0));
+ db_free(&dbv3);
return mir_strdup(temp);
}
ai->flags = AIF_FALSE;
@@ -139,10 +139,10 @@ char* Varxfirevoiceip(ARGUMENTSINFO *ai) { {
char temp[24];
DBVARIANT dbv3;
- if(!DBGetContactSetting(ai->fi->hContact,protocolname, "VServerIP",&dbv3))
+ if(!db_get(ai->fi->hContact,protocolname, "VServerIP",&dbv3))
{
- sprintf(temp,"%s:%d",dbv3.pszVal,DBGetContactSettingWord(ai->fi->hContact,protocolname, "VPort",0));
- DBFreeVariant(&dbv3);
+ sprintf(temp,"%s:%d",dbv3.pszVal,db_get_w(ai->fi->hContact,protocolname, "VPort",0));
+ db_free(&dbv3);
return mir_strdup(temp);
}
ai->flags = AIF_FALSE;
@@ -159,10 +159,10 @@ char* Varmyxfirevoice(ARGUMENTSINFO *ai) return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(NULL,protocolname, "currentvoicename",&dbv3))
+ if(!db_get(NULL,protocolname, "currentvoicename",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index d9d32221e7..856e04b282 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -291,7 +291,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", dbv.pszVal, cksum, who));
//void yahoo_send_picture_info(int id, const char *me, const char *who, const char *pic_url, int cksum)
yahoo_send_picture_info(m_id, who, 2, dbv.pszVal, cksum);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
} else
LOG(("No AvatarURL???"));
@@ -301,7 +301,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p */
if (GetByte("AvatarUL", 0) != 1) {
// NO avatar URL??
- if (!DBGetContactSettingTString(NULL, m_szModuleName, "AvatarFile", &dbv)) {
+ if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) {
struct _stat statbuf;
if (_tstat( dbv.ptszVal, &statbuf ) != 0) {
@@ -311,7 +311,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p SendAvatar(dbv.ptszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
LOG(("[ext_yahoo_got_picture] No Local Avatar File??? "));
}
@@ -415,7 +415,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] We just reuploaded! Stop screwing with Yahoo FT. "));
// don't leak stuff
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
}*/
@@ -423,10 +423,10 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] Buddy: %s told us this is bad??Expired??. Re-uploading", who));
db_unset(NULL, m_szModuleName, "AvatarURL");
- if (!DBGetContactSettingTString(NULL, m_szModuleName, "AvatarFile", &dbv2)) {
+ if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv2)) {
db_set_s(NULL, m_szModuleName, "AvatarInv", who);
SendAvatar(dbv2.ptszVal);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
} else {
LOG(("[ext_yahoo_got_picture] No Local Avatar File??? "));
}
@@ -435,7 +435,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p yahoo_send_picture_info(m_id, who, 2, dbv.pszVal, mcksum);
}
// don't leak stuff
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
LOG(("[ext_yahoo_got_picture] no AvatarURL?"));
}
@@ -562,7 +562,7 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne yahoo_send_picture_info(m_id, dbv.pszVal, 2, url, cksum);
db_unset(NULL, m_szModuleName, "AvatarInv");
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -667,7 +667,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) if (!GetString(AI->hContact, YAHOO_LOGINID, &dbv)) {
DebugLog("[YAHOO_GETAVATARINFO] For: %s", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}else {
DebugLog("[YAHOO_GETAVATARINFO]");
}
@@ -711,7 +711,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) DebugLog("[YAHOO_GETAVATARINFO] Requesting avatar!");
request_avatar(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return GAIR_WAITFOR;
} else {
@@ -799,14 +799,14 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) int ret = -3;
if (GetDword("AvatarHash", 0)) {
- if (!DBGetContactSettingTString(NULL, m_szModuleName, "AvatarFile", &dbv)) {
+ if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) {
if (_taccess(dbv.ptszVal, 0) == 0) {
lstrcpyn(buffer, dbv.ptszVal, size-1);
buffer[size-1] = '\0';
ret = 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index 2b5aa75c21..46acda427b 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -753,7 +753,7 @@ HANDLE __cdecl CYahooProto::SendFile( HANDLE hContact, const PROTOCHAR* szDescri sf = new_ft(this, m_id, hContact, dbv.pszVal, ( char* )szDescription,
NULL, NULL, 0, fs, 1 /* sending */);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (sf == NULL) {
DebugLog("SF IS NULL!!!");
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 607221d2c9..4892832ed0 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -210,7 +210,7 @@ int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc YForkThread( &CYahooProto::im_sendacksuccess, hContact );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
@@ -252,7 +252,7 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
if (!GetString(hContact, YAHOO_LOGINID, &dbv)) {
send_msg(dbv.pszVal, GetWord(hContact, "yprotoid", 0), "<ding>", 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
YForkThread( &CYahooProto::im_sendacksuccess, hContact );
return 1;
diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 08b5cbcfda..cc3e96913e 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -38,19 +38,19 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if ( !ppro->GetString( YAHOO_LOGINID, &dbv )) {
SetDlgItemTextA(hwndDlg,IDC_HANDLE,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !ppro->GetString("Nick", &dbv )) {
SetDlgItemTextA(hwndDlg,IDC_NICK,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !ppro->GetString( YAHOO_PASSWORD, &dbv )) {
//bit of a security hole here, since it's easy to extract a password from an edit box
CallService( MS_DB_CRYPT_DECODESTRING, strlen( dbv.pszVal )+1, (LPARAM)dbv.pszVal );
SetDlgItemTextA( hwndDlg, IDC_PASSWORD, dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
//SetButtonCheck( hwndDlg, IDC_DISABLE_UTF8, ppro->GetByte("DisableUTF8", 0));
@@ -105,7 +105,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
ppro->SetString( YAHOO_LOGINID, str );
@@ -115,7 +115,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if ( ppro->GetString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal ))
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
ppro->SetString( YAHOO_PASSWORD, str );
GetDlgItemTextA( hwndDlg, IDC_NICK, str, sizeof( str ));
@@ -171,7 +171,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar if ( !ppro->GetString( YAHOO_LOGINSERVER, &dbv )) {
SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER,
ppro->GetByte("YahooJapan", 0)
@@ -225,7 +225,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
ppro->SetString( YAHOO_LOGINSERVER, str );
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 245a1fbd1f..e24666ef02 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -459,7 +459,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) lstrcpynA(m_yahoo_id, dbv.pszVal, 255);
} else
err++;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
ProtoBroadcastAck(m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
err++;
@@ -475,7 +475,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) } else
err++;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
ProtoBroadcastAck(m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
err++;
@@ -502,7 +502,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) m_pw_token = strdup(dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
//db_get_w(NULL, m_szModuleName, "StartupStatus", status);
@@ -546,14 +546,14 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) if (!GetString(hContact, "YGMsg", &dbv)) {
gm = strdup(dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
- if (! DBGetContactSettingString(hContact, "CList", "StatusMsg", &dbv )) {
+ if (! db_get_s(hContact, "CList", "StatusMsg", &dbv )) {
if (lstrlenA(dbv.pszVal) >= 1)
sm = strdup(dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
WORD status = GetWord(hContact, "YStatus", YAHOO_STATUS_OFFLINE);
sm = yahoo_status_code( yahoo_status( status ));
@@ -704,7 +704,7 @@ int __cdecl CYahooProto::UserIsTyping( HANDLE hContact, int type ) if (type == PROTOTYPE_SELFTYPING_OFF || type == PROTOTYPE_SELFTYPING_ON) {
sendtyping(dbv.pszVal, GetWord(hContact, "yprotoid", 0), type == PROTOTYPE_SELFTYPING_ON?1:0);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -756,14 +756,14 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if ( !ppro->GetString(YAHOO_LOGINID, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_HANDLE, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !ppro->GetString(YAHOO_PASSWORD, &dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->GetByte("YahooJapan", 0));
@@ -808,7 +808,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
ppro->SetString(YAHOO_LOGINID, str);
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str));
@@ -817,7 +817,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if ( ppro->GetString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal ))
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
if (reconnectRequired ) {
db_unset(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN);
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 6aed26d1a0..1ad0249b06 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -109,7 +109,7 @@ int __cdecl CYahooProto::OnContactDeleted( WPARAM wParam, LPARAM lParam ) DebugLog("[YahooContactDeleted] Removing %s", dbv.pszVal);
remove_buddy(dbv.pszVal, GetWord(hContact, "yprotoid", 0));
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
DebugLog("[YahooContactDeleted] Can't retrieve contact Yahoo ID");
}
@@ -133,11 +133,11 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam SendMessage( hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)ppro->LoadIconEx("yahoo", true ));
SendMessage( hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)ppro->LoadIconEx("yahoo"));
- if ( !DBGetContactSettingString( NULL, ppro->m_szModuleName, YAHOO_CUSTSTATDB, &dbv )) {
+ if ( !db_get_s( NULL, ppro->m_szModuleName, YAHOO_CUSTSTATDB, &dbv )) {
SetDlgItemTextA( hwndDlg, IDC_CUSTSTAT, dbv. pszVal );
EnableWindow( GetDlgItem( hwndDlg, IDOK ), lstrlenA(dbv.pszVal) > 0);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else {
SetDlgItemTextA( hwndDlg, IDC_CUSTSTAT, "");
@@ -269,7 +269,7 @@ INT_PTR __cdecl CYahooProto::OnShowProfileCommand( WPARAM wParam, LPARAM lParam return 0;
_snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
OpenURL(tUrl, 0);
return 0;
@@ -295,7 +295,7 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand( WPARAM wParam, LPARAM lPara char tUrl[ 4096 ];
_snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
OpenURL(tUrl, 0);
return 0;
diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp index 26c8e484c9..05def506b0 100644 --- a/protocols/Yahoo/src/user_info.cpp +++ b/protocols/Yahoo/src/user_info.cpp @@ -64,7 +64,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa if (ppro->GetString( hContact, YAHOO_LOGINID, &dbv ) == 0) {
strcpy(z, dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
strcpy(z, "???");
}
@@ -73,7 +73,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa if (ppro->GetString( hContact, "Transport", &dbv ) == 0) {
strcpy(z, dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
strcpy(z, "Yahoo");
}
@@ -82,7 +82,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa if (ppro->GetString( hContact, "MirVer", &dbv ) == 0) {
strcpy(z, dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
strcpy(z, "???");
}
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 864fedd128..0a02e6b498 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -166,15 +166,15 @@ int CYahooProto::SendBroadcast( HANDLE hContact, int type, int result, HANDLE hP }
int CYahooProto::GetString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(NULL, m_szModuleName, name, result);
+{ return db_get_s(NULL, m_szModuleName, name, result);
}
int CYahooProto::GetString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(hContact, m_szModuleName, name, result);
+{ return db_get_s(hContact, m_szModuleName, name, result);
}
int CYahooProto::GetStringUtf(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingStringUtf(hContact, m_szModuleName, name, result);
+{ return db_get_utf(hContact, m_szModuleName, name, result);
}
void CYahooProto::SetString(const char* name, const char* value)
@@ -291,7 +291,7 @@ int __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam) if (!GetString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) {
int iAdd = (ID_STATUS_OFFLINE == GetWord((HANDLE) wParam, "ApparentMode", 0));
stealth(dbv.pszVal, iAdd);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index ada93c72db..f7cce7d094 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -196,7 +196,7 @@ void CYahooProto::remove_buddy(const char *who, int protocol) }
yahoo_remove_buddy(m_id, who, protocol, dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
void CYahooProto::sendtyping(const char *who, int protocol, int stat)
@@ -244,7 +244,7 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg) if (!GetString(hContact, YAHOO_LOGINID, &dbv))
{
who = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
return;
@@ -255,19 +255,19 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg) if (!GetString(hContact, "MyIdentity", &dbv))
{
ident = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!GetStringUtf(NULL, "FirstName", &dbv))
{
fname = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!GetStringUtf(NULL, "LastName", &dbv))
{
lname = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
SetStringUtf(hContact, "YGroup", group);
@@ -298,7 +298,7 @@ HANDLE CYahooProto::getbuddyH(const char *yahoo_id) {
int tCompareResult = lstrcmpiA( dbv.pszVal, yahoo_id );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
if ( tCompareResult )
continue;
}
@@ -359,7 +359,7 @@ const char* CYahooProto::find_buddy( const char *yahoo_id) return NULL;
strncpy(nick, dbv.pszVal, 128);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return nick;
}
@@ -647,7 +647,7 @@ void CYahooProto::ext_got_stealth(char *stealthlist) db_unset(hContact, m_szModuleName, "ApparentMode");
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
}
}
@@ -1563,7 +1563,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) if (host[0] == '\0') {
if (!GetString(YAHOO_LOGINSERVER, &dbv)) {
mir_snprintf(host, sizeof(host), "%s", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
snprintf(host, sizeof(host), "%s",
diff --git a/src/core/stdauth/authdialogs.cpp b/src/core/stdauth/authdialogs.cpp index 0fd7b44cce..23586bf564 100644 --- a/src/core/stdauth/authdialogs.cpp +++ b/src/core/stdauth/authdialogs.cpp @@ -95,7 +95,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA, (LONG_PTR)hContact);
- if (hContact == INVALID_HANDLE_VALUE || !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (hContact == INVALID_HANDLE_VALUE || !db_get_b(hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
}
return TRUE;
@@ -111,7 +111,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
HANDLE hContact = (HANDLE)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA);
- if ((hContact == INVALID_HANDLE_VALUE) || !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if ((hContact == INVALID_HANDLE_VALUE) || !db_get_b(hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
break;
}
@@ -213,7 +213,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
SetDlgItemText(hwndDlg, IDC_REASON, reasonT);
- if (hContact == INVALID_HANDLE_VALUE || !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (hContact == INVALID_HANDLE_VALUE || !db_get_b(hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
SendDlgItemMessage(hwndDlg, IDC_DENYREASON, EM_LIMITTEXT, 255, 0);
@@ -221,7 +221,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hwndDlg, IDC_DENYREASON), FALSE);
SetDlgItemText(hwndDlg, IDC_DENYREASON, TranslateT("Feature is not supported by protocol"));
}
- if ( !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) {
+ if ( !db_get_b(hContact, "CList", "NotOnList", 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_ADDCHECK), FALSE);
CheckDlgButton(hwndDlg, IDC_ADDCHECK, BST_UNCHECKED);
}
diff --git a/src/core/stdaway/awaymsg.cpp b/src/core/stdaway/awaymsg.cpp index dc1e2441db..6cfc28c725 100644 --- a/src/core/stdaway/awaymsg.cpp +++ b/src/core/stdaway/awaymsg.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int LoadAwayMessageSending(void);
-static HANDLE hAwayMsgMenuItem;
+static HGENMENU hAwayMsgMenuItem;
static HANDLE hWindowList;
struct AwayMsgDlgData {
@@ -54,7 +54,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP TCHAR str[256], format[128];
TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
char *szProto = GetContactProto(dat->hContact);
- WORD dwStatus = DBGetContactSettingWord(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE);
TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0);
GetWindowText(hwndDlg, format, SIZEOF(format));
@@ -139,9 +139,9 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM) mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR;
if (szProto != NULL) {
- int chatRoom = szProto ? DBGetContactSettingByte((HANDLE)wParam, szProto, "ChatRoom", 0) : 0;
+ int chatRoom = szProto ? db_get_b((HANDLE)wParam, szProto, "ChatRoom", 0) : 0;
if ( !chatRoom) {
- int status = DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE);
+ int status = db_get_w((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE);
mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s Message"), pcli->pfnGetStatusModeDescription(status, 0));
mi.ptszName = str;
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
@@ -150,7 +150,7 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM) mi.hIcon = LoadSkinProtoIcon(szProto, status);
} } } }
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hAwayMsgMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(hAwayMsgMenuItem, &mi);
IcoLib_ReleaseIcon(mi.hIcon, 0);
return 0;
}
diff --git a/src/core/stdaway/sendmsg.cpp b/src/core/stdaway/sendmsg.cpp index c0742aeb9a..e9119d4eda 100644 --- a/src/core/stdaway/sendmsg.cpp +++ b/src/core/stdaway/sendmsg.cpp @@ -33,7 +33,7 @@ static bool Proto_IsAccountEnabled(PROTOACCOUNT* pa) static bool Proto_IsAccountLocked(PROTOACCOUNT* pa)
{
- return pa && DBGetContactSettingByte(NULL, pa->szModuleName, "LockMainStatus", 0) != 0;
+ return pa && db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0) != 0;
}
static const TCHAR *GetDefaultMessage(int status)
@@ -98,11 +98,11 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) DBVARIANT dbv;
if ( GetStatusModeByte(statusMode, "UsePrev")) {
- if ( DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Msg"), &dbv))
+ if ( db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Msg"), &dbv))
dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusMode));
}
else {
- if ( DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Default"), &dbv))
+ if ( db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Default"), &dbv))
dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusMode));
for (int i=0; dbv.ptszVal[i]; i++) {
@@ -281,7 +281,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa TCHAR str[1024];
GetDlgItemText(hwndDlg, IDC_MSG, str, SIZEOF(str));
ChangeAllProtoMessages(dat->szProto, dat->statusMode, str);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(dat->statusMode, "Msg"), str);
+ db_set_ts(NULL, "SRAway", StatusModeToDbSetting(dat->statusMode, "Msg"), str);
DestroyWindow(hwndDlg);
}
else PostMessage(hwndDlg, WM_CLOSE, 0, 0);
@@ -408,8 +408,8 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam dat->info[j].usePrevious = GetStatusModeByte(statusModes[i], "UsePrev");
DBVARIANT dbv;
- if (DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Default"), &dbv))
- if (DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Msg"), &dbv))
+ if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Default"), &dbv))
+ if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Msg"), &dbv))
dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusModes[i]));
lstrcpy(dat->info[j].msg, dbv.ptszVal);
mir_free(dbv.ptszVal);
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index 34562d4d52..0aee3295ba 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -398,6 +398,8 @@ typedef struct{ COLORCHOOSER;
//main.c
+extern HGENMENU hJoinMenuItem, hLeaveMenuItem;
+
void LoadIcons(void);
void LoadLogIcons(void);
void FreeIcons(void);
diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp index 7761fdab1c..31e47b1f6a 100644 --- a/src/core/stdchat/src/clist.cpp +++ b/src/core/stdchat/src/clist.cpp @@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h"
-extern HANDLE hJoinMenuItem, hLeaveMenuItem;
-
HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* pszDisplayName, int iType)
{
HANDLE hContact = CList_FindRoom(pszModule, pszRoom);
@@ -29,10 +27,10 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p TCHAR pszGroup[50];
*pszGroup = '\0';
- if ( !DBGetContactSettingTString( NULL, "Chat", "AddToGroup", &dbv )) {
+ if ( !db_get_ts( NULL, "Chat", "AddToGroup", &dbv )) {
if ( lstrlen( dbv.ptszVal ) > 0 )
lstrcpyn( pszGroup, dbv.ptszVal, 50);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else lstrcpyn( pszGroup, _T("Chat rooms"), 50);
@@ -48,25 +46,25 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p if ( pszGroup[0] ) {
for (i = 0;; i++) {
_itoa( i, str, 10 );
- if ( DBGetContactSettingTString( NULL, "CListGroups", str, &dbv )) {
- DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup);
+ if ( db_get_ts( NULL, "CListGroups", str, &dbv )) {
+ db_set_ts(hContact, "CList", "Group", pszGroup);
goto END_GROUPLOOP;
}
- if ( !DBGetContactSettingTString( hContact, "CList", "Group", &dbv2 )) {
+ if ( !db_get_ts( hContact, "CList", "Group", &dbv2 )) {
if ( dbv.ptszVal[0] != '\0' && dbv2.ptszVal[0] != '\0' && !lstrcmpi( dbv.ptszVal + 1, dbv2.ptszVal )) {
- DBFreeVariant( &dbv );
- DBFreeVariant( &dbv2 );
+ db_free( &dbv );
+ db_free( &dbv2 );
goto END_GROUPLOOP;
}
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
END_GROUPLOOP:
db_set_w( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
- DBWriteContactSettingTString(hContact, pszModule, "Nick", pszDisplayName );
+ db_set_ts(hContact, pszModule, "Nick", pszDisplayName );
return hContact;
}
@@ -76,12 +74,12 @@ END_GROUPLOOP: CallService( MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) pszModule );
if ( pszGroup && lstrlen( pszGroup ) > 0 )
- DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup );
+ db_set_ts(hContact, "CList", "Group", pszGroup );
else
db_unset( hContact, "CList", "Group" );
- DBWriteContactSettingTString( hContact, pszModule, "Nick", pszDisplayName );
- DBWriteContactSettingTString( hContact, pszModule, "ChatRoomID", pszRoom );
- DBWriteContactSettingByte( hContact, pszModule, "ChatRoom", (BYTE)iType );
+ db_set_ts( hContact, pszModule, "Nick", pszDisplayName );
+ db_set_ts( hContact, pszModule, "ChatRoomID", pszRoom );
+ db_set_b( hContact, pszModule, "ChatRoom", (BYTE)iType );
db_set_w( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
return hContact;
}
@@ -90,7 +88,7 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) {
if ( hContact ) {
char* szProto = GetContactProto(hContact);
- int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
+ int i = db_get_b(hContact, szProto, "ChatRoom", 0);
db_set_w(hContact, szProto,"ApparentMode",(LPARAM) 0);
db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
return TRUE;
@@ -109,7 +107,7 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) szProto = GetContactProto(hContact);
if ( MM_FindModule( szProto )) {
if ( !pszModule || ( pszModule && !strcmp( pszModule, szProto ))) {
- int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
+ int i = db_get_b(hContact, szProto, "ChatRoom", 0);
if ( i != 0 ) {
db_set_w(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0);
db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
@@ -131,15 +129,15 @@ int CList_RoomDoubleclicked( WPARAM wParam, LPARAM lParam ) szProto = GetContactProto(hContact);
if ( MM_FindModule(szProto)) {
- if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0 ) == 0 )
+ if ( db_get_b( hContact, szProto, "ChatRoom", 0 ) == 0 )
return 0;
- if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) {
+ if ( !db_get_ts( hContact, szProto, "ChatRoomID", &dbv )) {
SESSION_INFO* si = SM_FindSession( dbv.ptszVal, szProto );
if ( si ) {
// is the "toggle visibility option set, so we need to close the window?
if (si->hWnd != NULL
- && DBGetContactSettingByte(NULL, "Chat", "ToggleVisibility", 0)==1
+ && db_get_b(NULL, "Chat", "ToggleVisibility", 0)==1
&& !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)
&& IsWindowVisible(si->hWnd)
&& !IsIconic(si->hWnd))
@@ -148,12 +146,12 @@ int CList_RoomDoubleclicked( WPARAM wParam, LPARAM lParam ) SendMessage(si->hWnd, GC_REMOVETAB, 1, (LPARAM) si );
else
PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
ShowRoom(si, WINDOW_VISIBLE, TRUE);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
} }
@@ -171,7 +169,7 @@ INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam) if ( hContact ) {
char* szProto = GetContactProto(hContact);
if ( szProto ) {
- if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE )
+ if ( db_get_w( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE )
CallProtoService( szProto, PS_JOINCHAT, wParam, lParam );
else
CList_RoomDoubleclicked( wParam, 0 );
@@ -194,31 +192,28 @@ INT_PTR CList_LeaveChat(WPARAM wParam, LPARAM lParam) int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- if ( hContact ) {
- char* szProto = GetContactProto(hContact);
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN;
-
- if ( szProto ) {
- // display this menu item only for chats
- if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0 )) {
- // still hide it for offline protos
- if ( CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) != ID_STATUS_OFFLINE ) {
- mi.flags &= ~CMIF_HIDDEN;
- mi.flags |= CMIM_NAME;
-
- if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE )
- mi.pszName = ( char* )LPGEN("Join chat");
- else
- mi.pszName = ( char* )LPGEN("Open chat window");
- } } }
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hJoinMenuItem, ( LPARAM )&mi );
+ if (hContact == NULL)
+ return 0;
- mi.flags &= ~(CMIM_NAME | CMIF_DEFAULT);
- mi.flags |= CMIF_NOTOFFLINE;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hLeaveMenuItem, ( LPARAM )&mi );
- }
+ bool bEnabled = false;
+ char *szProto = GetContactProto(hContact);
+ if (szProto) {
+ // display this menu item only for chats
+ if ( db_get_b(hContact, szProto, "ChatRoom", 0)) {
+ // still hide it for offline protos
+ if ( CallProtoService(szProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE ) {
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_NAME;
+ if ( db_get_w( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE )
+ mi.pszName = ( char* )LPGEN("Join chat");
+ else
+ mi.pszName = ( char* )LPGEN("Open chat window");
+ Menu_ModifyItem(hJoinMenuItem, &mi);
+ bEnabled = true;
+ } } }
+
+ Menu_ShowItem(hJoinMenuItem, bEnabled);
+ Menu_ShowItem(hLeaveMenuItem, bEnabled);
return 0;
}
@@ -241,21 +236,21 @@ void CList_CreateGroup(TCHAR* group) for (i = 0;; i++)
{
_itoa(i, str, 10);
- if ( DBGetContactSettingTString( NULL, "CListGroups", str, &dbv ))
+ if ( db_get_ts( NULL, "CListGroups", str, &dbv ))
break;
if ( dbv.pszVal[0] != '\0' && !lstrcmpi(dbv.ptszVal + 1, group)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
name[0] = 1 | GROUPF_EXPANDED;
_tcsncpy(name + 1, group, SIZEOF(name) - 1);
name[ lstrlen(group) + 1] = '\0';
- DBWriteContactSettingTString(NULL, "CListGroups", str, name);
+ db_set_ts(NULL, "CListGroups", str, name);
CallService(MS_CLUI_GROUPADDED, i + 1, 0);
}
@@ -297,14 +292,14 @@ HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom) while (hContact) {
char *szProto = GetContactProto(hContact);
if ( szProto && !lstrcmpiA( szProto, pszModule )) {
- if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0) != 0 ) {
+ if ( db_get_b( hContact, szProto, "ChatRoom", 0) != 0 ) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) {
+ if ( !db_get_ts( hContact, szProto, "ChatRoomID", &dbv )) {
if ( !lstrcmpi(dbv.ptszVal, pszRoom)) {
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return hContact;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} } }
hContact = db_find_next(hContact);
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp index 7720d1dddf..85b52d5262 100644 --- a/src/core/stdchat/src/log.cpp +++ b/src/core/stdchat/src/log.cpp @@ -664,7 +664,7 @@ void LoadMsgLogBitmaps(void) int rtfHeaderSize;
PBYTE pBmpBits;
- hBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW)));
+ hBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW)));
bih.biSize = sizeof(bih);
bih.biBitCount = 24;
bih.biCompression = BI_RGB;
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 92be0f2cce..d3a8c58007 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -117,7 +117,7 @@ extern "C" __declspec(dllexport) int Unload(void) void UpgradeCheck(void)
{
- DWORD dwVersion = DBGetContactSettingDword(NULL, "Chat", "OldVersion", PLUGIN_MAKE_VERSION(0,2,9,9));
+ DWORD dwVersion = db_get_dw(NULL, "Chat", "OldVersion", PLUGIN_MAKE_VERSION(0,2,9,9));
if (pluginInfo.version > dwVersion && dwVersion < PLUGIN_MAKE_VERSION(0,3,0,0)) {
db_unset(NULL, "ChatFonts", "Font18");
db_unset(NULL, "ChatFonts", "Font18Col");
diff --git a/src/core/stdchat/src/manager.cpp b/src/core/stdchat/src/manager.cpp index 00f6aa4d3b..5dead6fe83 100644 --- a/src/core/stdchat/src/manager.cpp +++ b/src/core/stdchat/src/manager.cpp @@ -130,14 +130,14 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeConta pTemp->nUsersInNicklist = 0;
// contact may have been deleted here already, since function may be called after deleting
- // contact so the handle may be invalid, therefore DBGetContactSettingByte shall return 0
- if (pTemp->hContact && DBGetContactSettingByte( pTemp->hContact, pTemp->pszModule, "ChatRoom", 0 ) != 0)
+ // contact so the handle may be invalid, therefore db_get_b shall return 0
+ if (pTemp->hContact && db_get_b( pTemp->hContact, pTemp->pszModule, "ChatRoom", 0 ) != 0)
{
CList_SetOffline(pTemp->hContact, pTemp->iType == GCW_CHATROOM?TRUE:FALSE);
/* if (pTemp->iType != GCW_SERVER)
- DBWriteContactSettingByte(pTemp->hContact, "CList", "Hidden", 1);*/
- DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule, "Topic", "");
- DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule, "StatusBar", "");
+ db_set_b(pTemp->hContact, "CList", "Hidden", 1);*/
+ db_set_s(pTemp->hContact, pTemp->pszModule, "Topic", "");
+ db_set_s(pTemp->hContact, pTemp->pszModule, "StatusBar", "");
db_unset(pTemp->hContact, "CList", "StatusMsg");
if (removeContact)
@@ -774,9 +774,9 @@ BOOL SM_RemoveAll (void) DoEventHook(m_WndList->ptszID, m_WndList->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)m_WndList->dwItemData);
if (m_WndList->hContact)
CList_SetOffline(m_WndList->hContact, m_WndList->iType == GCW_CHATROOM?TRUE:FALSE);
- DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule , "Topic", "");
+ db_set_s(m_WndList->hContact, m_WndList->pszModule , "Topic", "");
db_unset(m_WndList->hContact, "CList", "StatusMsg");
- DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule, "StatusBar", "");
+ db_set_s(m_WndList->hContact, m_WndList->pszModule, "StatusBar", "");
UM_RemoveAll(&m_WndList->pUsers);
TM_RemoveAll(&m_WndList->pStatuses);
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index d184b976ef..c0107ea3b5 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -220,9 +220,9 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, const struct branch_t * tvis.item.pszText = TranslateTS(branch[i].szDescr);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
if (branch[i].iMode)
- iState = ((DBGetContactSettingDword(NULL, "Chat", branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode)!=0?2:1;
+ iState = ((db_get_dw(NULL, "Chat", branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode)!=0?2:1;
else
- iState = DBGetContactSettingByte(NULL, "Chat", branch[i].szDBName, branch[i].bDefault)!=0?2:1;
+ iState = db_get_b(NULL, "Chat", branch[i].szDBName, branch[i].bDefault)!=0?2:1;
tvis.item.state=INDEXTOSTATEIMAGEMASK(iState);
hItemB[i] = TreeView_InsertItem(hwndTree, &tvis);
} }
@@ -246,7 +246,7 @@ static void SaveBranch(HWND hwndTree, const struct branch_t *branch, HTREEITEM * iState |= GC_EVENT_REMOVESTATUS;
db_set_dw(NULL, "Chat", branch[i].szDBName, (DWORD)iState);
}
- else DBWriteContactSettingByte(NULL, "Chat", branch[i].szDBName, bChecked);
+ else db_set_b(NULL, "Chat", branch[i].szDBName, bChecked);
} }
static void CheckHeading(HWND hwndTree, HTREEITEM hHeading)
@@ -327,32 +327,32 @@ void LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF* colour) if (colour) {
wsprintfA(str, "Font%dCol", i);
- *colour = DBGetContactSettingDword(NULL, "ChatFonts", str, fontOptionsList[i].defColour);
+ *colour = db_get_dw(NULL, "ChatFonts", str, fontOptionsList[i].defColour);
}
if (lf) {
wsprintfA(str, "Font%dSize", i);
- lf->lfHeight = (char) DBGetContactSettingByte(NULL, "ChatFonts", str, fontOptionsList[i].defSize);
+ lf->lfHeight = (char) db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
wsprintfA(str, "Font%dSty", i);
- style = DBGetContactSettingByte(NULL, "ChatFonts", str, fontOptionsList[i].defStyle);
+ style = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defStyle);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = 0;
lf->lfStrikeOut = 0;
wsprintfA(str, "Font%dSet", i);
- lf->lfCharSet = DBGetContactSettingByte(NULL, "ChatFonts", str, fontOptionsList[i].defCharset);
+ lf->lfCharSet = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defCharset);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
wsprintfA(str, "Font%d", i);
- if (DBGetContactSettingTString(NULL, "ChatFonts", str, &dbv))
+ if (db_get_ts(NULL, "ChatFonts", str, &dbv))
lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
else {
lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} } }
void RegisterFonts( void )
@@ -484,9 +484,9 @@ HICON LoadIconEx( char* pszIcoLibName, BOOL big ) static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "Chat", pszSetting, &dbv )) {
+ if ( !db_get_ts(NULL, "Chat", pszSetting, &dbv )) {
replaceStr( ppPointer, dbv.ptszVal );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else replaceStr( ppPointer, pszDefault );
}
@@ -509,14 +509,14 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHECKBOXES),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHECKBOXES),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
- hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), DBGetContactSettingByte(NULL, "Chat", "Branch0Exp", 0)?TRUE:FALSE);
- hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), DBGetContactSettingByte(NULL, "Chat", "Branch1Exp", 0)?TRUE:FALSE);
- hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), DBGetContactSettingByte(NULL, "Chat", "Branch2Exp", 0)?TRUE:FALSE);
- hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the \'event filter\' is enabled"), DBGetContactSettingByte(NULL, "Chat", "Branch3Exp", 0)?TRUE:FALSE);
- hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the message log"), DBGetContactSettingByte(NULL, "Chat", "Branch4Exp", 0)?TRUE:FALSE);
- hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), DBGetContactSettingByte(NULL, "Chat", "Branch5Exp", 0)?TRUE:FALSE);
+ hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), db_get_b(NULL, "Chat", "Branch0Exp", 0)?TRUE:FALSE);
+ hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), db_get_b(NULL, "Chat", "Branch1Exp", 0)?TRUE:FALSE);
+ hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), db_get_b(NULL, "Chat", "Branch2Exp", 0)?TRUE:FALSE);
+ hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the \'event filter\' is enabled"), db_get_b(NULL, "Chat", "Branch3Exp", 0)?TRUE:FALSE);
+ hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the message log"), db_get_b(NULL, "Chat", "Branch4Exp", 0)?TRUE:FALSE);
+ hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), db_get_b(NULL, "Chat", "Branch5Exp", 0)?TRUE:FALSE);
if (PopUpInstalled)
- hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Pop-ups to display"), DBGetContactSettingByte(NULL, "Chat", "Branch6Exp", 0)?TRUE:FALSE);
+ hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Pop-ups to display"), db_get_b(NULL, "Chat", "Branch6Exp", 0)?TRUE:FALSE);
FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, branch0, hItemB0, SIZEOF(branch0), 0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, hItemB1, SIZEOF(branch1), 0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, hItemB2, SIZEOF(branch2), 0);
@@ -585,7 +585,7 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
{
- BYTE b = DBGetContactSettingByte(NULL, "Chat", "Tabs", 1);
+ BYTE b = db_get_b(NULL, "Chat", "Tabs", 1);
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch0, hItemB0, SIZEOF(branch0));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, hItemB1, SIZEOF(branch1));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, hItemB2, SIZEOF(branch2));
@@ -594,17 +594,17 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch5, hItemB5, SIZEOF(branch5));
if (PopUpInstalled)
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch6, hItemB6, SIZEOF(branch6));
- g_Settings.dwIconFlags = DBGetContactSettingDword(NULL, "Chat", "IconFlags", 0x0000);
- g_Settings.dwTrayIconFlags = DBGetContactSettingDword(NULL, "Chat", "TrayIconFlags", 0x1000);
- g_Settings.dwPopupFlags = DBGetContactSettingDword(NULL, "Chat", "PopupFlags", 0x0000);
- g_Settings.StripFormat = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TrimFormatting", 0);
- g_Settings.TrayIconInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TrayIconInactiveOnly", 1);
- g_Settings.PopUpInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "PopUpInactiveOnly", 1);
- g_Settings.LogIndentEnabled = (DBGetContactSettingByte(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
-
- if (b != DBGetContactSettingByte(NULL, "Chat", "Tabs", 1)) {
+ g_Settings.dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000);
+ g_Settings.dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000);
+ g_Settings.dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000);
+ g_Settings.StripFormat = (BOOL)db_get_b(NULL, "Chat", "TrimFormatting", 0);
+ g_Settings.TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
+ g_Settings.PopUpInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1);
+ g_Settings.LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
+
+ if (b != db_get_b(NULL, "Chat", "Tabs", 1)) {
SM_BroadcastMessage(NULL, GC_CLOSEWINDOW, 0, 1, FALSE);
- g_Settings.TabsEnable = DBGetContactSettingByte(NULL, "Chat", "Tabs", 1);
+ g_Settings.TabsEnable = db_get_b(NULL, "Chat", "Tabs", 1);
}
else SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
}
@@ -615,20 +615,20 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case WM_DESTROY:
{
BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch1Exp", b);
+ db_set_b(NULL, "Chat", "Branch1Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch2Exp", b);
+ db_set_b(NULL, "Chat", "Branch2Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch3Exp", b);
+ db_set_b(NULL, "Chat", "Branch3Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch4Exp", b);
+ db_set_b(NULL, "Chat", "Branch4Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch5Exp", b);
+ db_set_b(NULL, "Chat", "Branch5Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch0Exp", b);
+ db_set_b(NULL, "Chat", "Branch0Exp", b);
if (PopUpInstalled) {
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch6Exp", b);
+ db_set_b(NULL, "Chat", "Branch6Exp", b);
} }
break;
}
@@ -644,11 +644,11 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SendDlgItemMessage(hwndDlg,IDC_SPIN2,UDM_SETRANGE,0,MAKELONG(5000,0));
- SendDlgItemMessage(hwndDlg,IDC_SPIN2,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"Chat","LogLimit",100),0));
+ SendDlgItemMessage(hwndDlg,IDC_SPIN2,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"Chat","LogLimit",100),0));
SendDlgItemMessage(hwndDlg,IDC_SPIN3,UDM_SETRANGE,0,MAKELONG(10000,0));
- SendDlgItemMessage(hwndDlg,IDC_SPIN3,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"Chat","LoggingLimit",100),0));
+ SendDlgItemMessage(hwndDlg,IDC_SPIN3,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"Chat","LoggingLimit",100),0));
SendDlgItemMessage(hwndDlg,IDC_SPIN4,UDM_SETRANGE,0,MAKELONG(255,10));
- SendDlgItemMessage(hwndDlg,IDC_SPIN4,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"Chat","NicklistRowDist",12),0));
+ SendDlgItemMessage(hwndDlg,IDC_SPIN4,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"Chat","NicklistRowDist",12),0));
{
TCHAR* pszGroup = NULL;
InitSetting(&pszGroup, "AddToGroup", _T("Chat rooms"));
@@ -742,7 +742,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA *p2 = ' ';
p2 = _tcschr(ptszText, ',');
}
- DBWriteContactSettingTString(NULL, "Chat", "HighlightWords", ptszText);
+ db_set_ts(NULL, "Chat", "HighlightWords", ptszText);
mir_free(ptszText);
}
}
@@ -752,7 +752,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) {
pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR));
GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText,iLen + 1);
- DBWriteContactSettingTString(NULL, "Chat", "LogDirectory", pszText);
+ db_set_ts(NULL, "Chat", "LogDirectory", pszText);
}
else db_unset(NULL, "Chat", "LogDirectory");
@@ -762,7 +762,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) {
pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR));
GetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen+1);
- DBWriteContactSettingTString(NULL, "Chat", "LogTimestamp", pszText);
+ db_set_ts(NULL, "Chat", "LogTimestamp", pszText);
}
else db_unset(NULL, "Chat", "LogTimestamp");
@@ -770,7 +770,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) {
pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR));
GetDlgItemText(hwndDlg, IDC_TIMESTAMP, pszText, iLen+1);
- DBWriteContactSettingTString(NULL, "Chat", "HeaderTime", pszText);
+ db_set_ts(NULL, "Chat", "HeaderTime", pszText);
}
else db_unset(NULL, "Chat", "HeaderTime");
@@ -778,7 +778,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) {
pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR));
GetDlgItemText(hwndDlg, IDC_INSTAMP, pszText,iLen+1);
- DBWriteContactSettingTString(NULL, "Chat", "HeaderIncoming", pszText);
+ db_set_ts(NULL, "Chat", "HeaderIncoming", pszText);
}
else db_unset(NULL, "Chat", "HeaderIncoming");
@@ -786,15 +786,15 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) {
pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR));
GetDlgItemText(hwndDlg, IDC_OUTSTAMP, pszText,iLen+1);
- DBWriteContactSettingTString(NULL, "Chat", "HeaderOutgoing", pszText);
+ db_set_ts(NULL, "Chat", "HeaderOutgoing", pszText);
}
else db_unset(NULL, "Chat", "HeaderOutgoing");
g_Settings.HighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHT) == BST_CHECKED?TRUE:FALSE;
- DBWriteContactSettingByte(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.HighlightEnabled);
+ db_set_b(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.HighlightEnabled);
g_Settings.LoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED?TRUE:FALSE;
- DBWriteContactSettingByte(NULL, "Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled);
+ db_set_b(NULL, "Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled);
if ( g_Settings.LoggingEnabled )
CreateDirectoryTreeT(g_Settings.pszLogDir);
@@ -807,14 +807,14 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if (iLen > 0) {
pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR));
GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen+1);
- DBWriteContactSettingTString(NULL, "Chat", "AddToGroup", pszText);
+ db_set_ts(NULL, "Chat", "AddToGroup", pszText);
}
- else DBWriteContactSettingString(NULL, "Chat", "AddToGroup", "");
+ else db_set_s(NULL, "Chat", "AddToGroup", "");
mir_free(pszText);
iLen = SendDlgItemMessage(hwndDlg,IDC_SPIN4,UDM_GETPOS,0,0);
if (iLen > 0)
- DBWriteContactSettingByte(NULL, "Chat", "NicklistRowDist", (BYTE)iLen);
+ db_set_b(NULL, "Chat", "NicklistRowDist", (BYTE)iLen);
else
db_unset(NULL, "Chat", "NicklistRowDist");
@@ -884,7 +884,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam iLen = 1;
g_Settings.iPopupStyle = iLen;
- DBWriteContactSettingByte(NULL, "Chat", "PopupStyle", (BYTE)iLen);
+ db_set_b(NULL, "Chat", "PopupStyle", (BYTE)iLen);
iLen = SendDlgItemMessage(hwndDlg,IDC_SPIN1,UDM_GETPOS,0,0);
g_Settings.iPopupTimeout = iLen;
@@ -938,38 +938,38 @@ void LoadGlobalSettings(void) {
LOGFONT lf;
- g_Settings.LogLimitNames = DBGetContactSettingByte(NULL, "Chat", "LogLimitNames", 1);
- g_Settings.ShowTime = DBGetContactSettingByte(NULL, "Chat", "ShowTimeStamp", 1);
- g_Settings.TabsEnable = DBGetContactSettingByte(NULL, "Chat", "Tabs", 1);
- g_Settings.TabsAtBottom = DBGetContactSettingByte(NULL, "Chat", "TabBottom", 0);
- g_Settings.TabCloseOnDblClick = DBGetContactSettingByte(NULL, "Chat", "TabCloseOnDblClick", 0);
- g_Settings.TabRestore = DBGetContactSettingByte(NULL, "Chat", "TabRestore", 0);
- g_Settings.SoundsFocus = DBGetContactSettingByte(NULL, "Chat", "SoundsFocus", 0);
- g_Settings.ShowTimeIfChanged = (BOOL)DBGetContactSettingByte(NULL, "Chat", "ShowTimeStampIfChanged", 0);
- g_Settings.TimeStampEventColour = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TimeStampEventColour", 0);
- g_Settings.iEventLimit = DBGetContactSettingWord(NULL, "Chat", "LogLimit", 100);
- g_Settings.dwIconFlags = DBGetContactSettingDword(NULL, "Chat", "IconFlags", 0x0000);
- g_Settings.dwTrayIconFlags = DBGetContactSettingDword(NULL, "Chat", "TrayIconFlags", 0x1000);
- g_Settings.dwPopupFlags = DBGetContactSettingDword(NULL, "Chat", "PopupFlags", 0x0000);
- g_Settings.LoggingLimit = DBGetContactSettingWord(NULL, "Chat", "LoggingLimit", 100);
- g_Settings.LoggingEnabled = (BOOL)DBGetContactSettingByte(NULL, "Chat", "LoggingEnabled", 0);
- g_Settings.FlashWindow = (BOOL)DBGetContactSettingByte(NULL, "Chat", "FlashWindow", 0);
- g_Settings.HighlightEnabled = (BOOL)DBGetContactSettingByte(NULL, "Chat", "HighlightEnabled", 1);
- g_Settings.crUserListColor = DBGetContactSettingDword(NULL, "ChatFonts", "Font18Col", RGB(0,0,0));
- g_Settings.crUserListBGColor = DBGetContactSettingDword(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
- g_Settings.crUserListSelectedBGColor = DBGetContactSettingDword(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
- g_Settings.crUserListHeadingsColor = DBGetContactSettingDword(NULL, "ChatFonts", "Font19Col", RGB(170,170,170));
- g_Settings.crLogBackground = DBGetContactSettingDword(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW));
- g_Settings.StripFormat = (BOOL)DBGetContactSettingByte(NULL, "Chat", "StripFormatting", 0);
- g_Settings.TrayIconInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TrayIconInactiveOnly", 1);
- g_Settings.PopUpInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "PopUpInactiveOnly", 1);
- g_Settings.AddColonToAutoComplete = (BOOL)DBGetContactSettingByte(NULL, "Chat", "AddColonToAutoComplete", 1);
- g_Settings.iPopupStyle = DBGetContactSettingByte(NULL, "Chat", "PopupStyle", 1);
- g_Settings.iPopupTimeout = DBGetContactSettingWord(NULL, "Chat", "PopupTimeout", 3);
- g_Settings.crPUBkgColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
- g_Settings.crPUTextColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorText", 0);
- g_Settings.ShowContactStatus = DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0);
- g_Settings.ContactStatusFirst = DBGetContactSettingByte(NULL, "Chat", "ContactStatusFirst", 0);
+ g_Settings.LogLimitNames = db_get_b(NULL, "Chat", "LogLimitNames", 1);
+ g_Settings.ShowTime = db_get_b(NULL, "Chat", "ShowTimeStamp", 1);
+ g_Settings.TabsEnable = db_get_b(NULL, "Chat", "Tabs", 1);
+ g_Settings.TabsAtBottom = db_get_b(NULL, "Chat", "TabBottom", 0);
+ g_Settings.TabCloseOnDblClick = db_get_b(NULL, "Chat", "TabCloseOnDblClick", 0);
+ g_Settings.TabRestore = db_get_b(NULL, "Chat", "TabRestore", 0);
+ g_Settings.SoundsFocus = db_get_b(NULL, "Chat", "SoundsFocus", 0);
+ g_Settings.ShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0);
+ g_Settings.TimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0);
+ g_Settings.iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100);
+ g_Settings.dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000);
+ g_Settings.dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000);
+ g_Settings.dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000);
+ g_Settings.LoggingLimit = db_get_w(NULL, "Chat", "LoggingLimit", 100);
+ g_Settings.LoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0);
+ g_Settings.FlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0);
+ g_Settings.HighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1);
+ g_Settings.crUserListColor = db_get_dw(NULL, "ChatFonts", "Font18Col", RGB(0,0,0));
+ g_Settings.crUserListBGColor = db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
+ g_Settings.crUserListSelectedBGColor = db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
+ g_Settings.crUserListHeadingsColor = db_get_dw(NULL, "ChatFonts", "Font19Col", RGB(170,170,170));
+ g_Settings.crLogBackground = db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW));
+ g_Settings.StripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0);
+ g_Settings.TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
+ g_Settings.PopUpInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1);
+ g_Settings.AddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1);
+ g_Settings.iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1);
+ g_Settings.iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3);
+ g_Settings.crPUBkgColour = db_get_dw(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
+ g_Settings.crPUTextColour = db_get_dw(NULL, "Chat", "PopupColorText", 0);
+ g_Settings.ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0);
+ g_Settings.ContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0);
InitSetting( &g_Settings.pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
InitSetting( &g_Settings.pszTimeStampLog, "LogTimestamp", _T("[%d %b %y %H:%M]"));
@@ -981,9 +981,9 @@ void LoadGlobalSettings(void) TCHAR pszTemp[MAX_PATH];
DBVARIANT dbv;
g_Settings.pszLogDir = (TCHAR *)mir_realloc(g_Settings.pszLogDir, MAX_PATH*sizeof(TCHAR));
- if (!DBGetContactSettingTString(NULL, "Chat", "LogDirectory", &dbv)) {
+ if (!db_get_ts(NULL, "Chat", "LogDirectory", &dbv)) {
lstrcpyn(pszTemp, dbv.ptszVal, MAX_PATH);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_logpath%\\Chat"));
@@ -994,7 +994,7 @@ void LoadGlobalSettings(void) PathToAbsoluteT(pszTemp, g_Settings.pszLogDir);
}
- g_Settings.LogIndentEnabled = (DBGetContactSettingByte(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
+ g_Settings.LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
if ( g_Settings.MessageBoxFont )
DeleteObject( g_Settings.MessageBoxFont );
@@ -1013,11 +1013,11 @@ void LoadGlobalSettings(void) if (hListBkgBrush != NULL) {
DeleteObject(hListBkgBrush);
}
- hListBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)));
+ hListBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)));
if (hListSelectedBkgBrush != NULL) {
DeleteObject(hListSelectedBkgBrush);
}
- hListSelectedBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)));
+ hListSelectedBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)));
}
static void FreeGlobalSettings(void)
@@ -1052,12 +1052,12 @@ int OptionsInit(void) g_Settings.UserListFont = NULL;
g_Settings.UserListHeadingsFont = NULL;
g_Settings.MessageBoxFont = NULL;
- g_Settings.iSplitterX = DBGetContactSettingWord(NULL, "Chat", "SplitterX", 105);
- g_Settings.iSplitterY = DBGetContactSettingWord(NULL, "Chat", "SplitterY", 90);
- g_Settings.iX = DBGetContactSettingDword(NULL, "Chat", "roomx", -1);
- g_Settings.iY = DBGetContactSettingDword(NULL, "Chat", "roomy", -1);
- g_Settings.iWidth = DBGetContactSettingDword(NULL, "Chat", "roomwidth", -1);
- g_Settings.iHeight = DBGetContactSettingDword(NULL, "Chat", "roomheight", -1);
+ g_Settings.iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105);
+ g_Settings.iSplitterY = db_get_w(NULL, "Chat", "SplitterY", 90);
+ g_Settings.iX = db_get_dw(NULL, "Chat", "roomx", -1);
+ g_Settings.iY = db_get_dw(NULL, "Chat", "roomy", -1);
+ g_Settings.iWidth = db_get_dw(NULL, "Chat", "roomwidth", -1);
+ g_Settings.iHeight = db_get_dw(NULL, "Chat", "roomheight", -1);
LoadGlobalSettings();
SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message"));
diff --git a/src/core/stdchat/src/services.cpp b/src/core/stdchat/src/services.cpp index 9a65d483ac..6a2cc1db9a 100644 --- a/src/core/stdchat/src/services.cpp +++ b/src/core/stdchat/src/services.cpp @@ -31,8 +31,8 @@ extern BOOL PopUpInstalled; extern BOOL IEviewInstalled;
HANDLE hSendEvent;
-HANDLE hBuildMenuEvent ;
-HANDLE hJoinMenuItem, hLeaveMenuItem;
+HANDLE hBuildMenuEvent;
+HGENMENU hJoinMenuItem, hLeaveMenuItem;
SESSION_INFO g_TabSession;
CRITICAL_SECTION cs;
@@ -169,7 +169,7 @@ static int FontsChanged(WPARAM wParam,LPARAM lParam) DeleteObject(hFont);
g_Settings.LogTextIndent = iText;
g_Settings.LogTextIndent = g_Settings.LogTextIndent*12/10;
- g_Settings.LogIndentEnabled = (DBGetContactSettingByte(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
+ g_Settings.LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
}
MM_FontsChanged();
MM_FixColors();
@@ -342,9 +342,9 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->ptszStatusbarText = a2tf( gcw->ptszStatusbarText, gcw->dwFlags );
si->iSplitterX = g_Settings.iSplitterX;
si->iSplitterY = g_Settings.iSplitterY;
- si->iLogFilterFlags = (int)DBGetContactSettingDword(NULL, "Chat", "FilterFlags", 0x03E0);
- si->bFilterEnabled = DBGetContactSettingByte(NULL, "Chat", "FilterEnabled", 0);
- si->bNicklistEnabled = DBGetContactSettingByte(NULL, "Chat", "ShowNicklist", 1);
+ si->iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0);
+ si->bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0);
+ si->bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1);
if ( !( gcw->dwFlags & GC_UNICODE )) {
si->pszID = mir_strdup( gcw->pszID );
si->pszName = mir_strdup( gcw->pszName );
@@ -363,12 +363,12 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) else
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName);
si->hContact = CList_AddRoom( gcw->pszModule, ptszID, szTemp, si->iType);
- DBWriteContactSettingString(si->hContact, si->pszModule , "Topic", "");
+ db_set_s(si->hContact, si->pszModule , "Topic", "");
db_unset(si->hContact, "CList", "StatusMsg");
if (si->ptszStatusbarText)
- DBWriteContactSettingTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
+ db_set_ts(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
- DBWriteContactSettingString(si->hContact, si->pszModule, "StatusBar", "");
+ db_set_s(si->hContact, si->pszModule, "StatusBar", "");
}
else {
SESSION_INFO* si2 = SM_FindSession( ptszID, gcw->pszModule );
@@ -423,7 +423,7 @@ static int DoControl(GCEVENT * gce, WPARAM wp) SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
si->bInitDone = TRUE;
- if (wp != SESSION_INITDONE || DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0) == 0)
+ if (wp != SESSION_INITDONE || db_get_b(NULL, "Chat", "PopupOnJoin", 0) == 0)
ShowRoom(si, wp, TRUE);
return 0;
} }
@@ -495,9 +495,9 @@ static int DoControl(GCEVENT * gce, WPARAM wp) if (si) {
replaceStr( &si->ptszStatusbarText, gce->ptszText );
if ( si->ptszStatusbarText )
- DBWriteContactSettingTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
+ db_set_ts(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
- DBWriteContactSettingString(si->hContact, si->pszModule, "StatusBar", "");
+ db_set_s(si->hContact, si->pszModule, "StatusBar", "");
if ( si->hWnd ) {
g_TabSession.ptszStatusbarText = si->ptszStatusbarText;
SendMessage(si->hWnd, GC_UPDATESTATUSBAR, 0, 0);
@@ -611,9 +611,9 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) replaceStr( &si->ptszTopic, gce->ptszText);
if ( si->hWnd )
g_TabSession.ptszTopic = si->ptszTopic;
- DBWriteContactSettingTString( si->hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic ));
- if ( DBGetContactSettingByte( NULL, "Chat", "TopicOnClist", 0 ))
- DBWriteContactSettingTString( si->hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic ));
+ db_set_ts( si->hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic ));
+ if ( db_get_b( NULL, "Chat", "TopicOnClist", 0 ))
+ db_set_ts( si->hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic ));
} }
break;
}
@@ -843,9 +843,9 @@ void TabsInit(void) g_TabSession.iType = GCW_TABROOM;
g_TabSession.iSplitterX = g_Settings.iSplitterX;
g_TabSession.iSplitterY = g_Settings.iSplitterY;
- g_TabSession.iLogFilterFlags = (int)DBGetContactSettingDword(NULL, "Chat", "FilterFlags", 0x03E0);
- g_TabSession.bFilterEnabled = DBGetContactSettingByte(NULL, "Chat", "FilterEnabled", 0);
- g_TabSession.bNicklistEnabled = DBGetContactSettingByte(NULL, "Chat", "ShowNicklist", 1);
+ g_TabSession.iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0);
+ g_TabSession.bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0);
+ g_TabSession.bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1);
g_TabSession.iFG = 4;
g_TabSession.bFGSet = TRUE;
g_TabSession.iBG = 2;
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index d27c147617..45ef0ed99a 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -299,9 +299,9 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
if (bInactive || !g_Settings.SoundsFocus)
SkinPlaySound("ChatHighlight");
- if (!g_Settings.TabsEnable && bInactive && si->hWnd && DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0)
+ if (!g_Settings.TabsEnable && bInactive && si->hWnd && db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0)
SetTimer(si->hWnd, TIMERID_FLASHWND, 900, NULL);
- if (DBGetContactSettingByte(si->hContact, "CList", "Hidden", 0) != 0)
+ if (db_get_b(si->hContact, "CList", "Hidden", 0) != 0)
db_unset(si->hContact, "CList", "Hidden");
if (bInactive)
DoTrayIcon(si, gce);
@@ -404,7 +404,7 @@ void CheckColorsInModule(const char* pszModule) MODULEINFO * pMod = MM_FindModule( pszModule );
int i = 0;
COLORREF crFG;
- COLORREF crBG = (COLORREF)DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW));
+ COLORREF crBG = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW));
LoadMsgDlgFont(17, NULL, &crFG);
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 0627dfbea1..c56f80b6c7 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -134,10 +134,10 @@ static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc) RECT rc, rcTabs;
SESSION_INFO* si = (SESSION_INFO*)lParam;
int TabHeight;
- BOOL bControl = (BOOL)DBGetContactSettingByte(NULL, "Chat", "ShowTopButtons", 1);
- BOOL bFormat = (BOOL)DBGetContactSettingByte(NULL, "Chat", "ShowFormatButtons", 1);
+ BOOL bControl = (BOOL)db_get_b(NULL, "Chat", "ShowTopButtons", 1);
+ BOOL bFormat = (BOOL)db_get_b(NULL, "Chat", "ShowFormatButtons", 1);
BOOL bToolbar = bFormat || bControl;
- BOOL bSend = (BOOL)DBGetContactSettingByte(NULL, "Chat", "ShowSend", 0);
+ BOOL bSend = (BOOL)db_get_b(NULL, "Chat", "ShowSend", 0);
BOOL bNick = si->iType!=GCW_SERVER && si->bNicklistEnabled;
BOOL bTabs = g_Settings.TabsEnable;
BOOL bTabBottom = g_Settings.TabsAtBottom;
@@ -298,11 +298,11 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return TRUE;
if (wParam == '\n' || wParam == '\r') {
- if ((isCtrl != 0) ^ (0 != DBGetContactSettingByte(NULL, "Chat", "SendOnEnter", 1))) {
+ if ((isCtrl != 0) ^ (0 != db_get_b(NULL, "Chat", "SendOnEnter", 1))) {
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
- if (DBGetContactSettingByte(NULL, "Chat", "SendOnDblEnter", 0)) {
+ if (db_get_b(NULL, "Chat", "SendOnDblEnter", 0)) {
if (dat->lastEnterTime + 2 < time(NULL))
dat->lastEnterTime = time(NULL);
else {
@@ -330,10 +330,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
if (wParam == VK_RETURN) {
dat->szTabSave[0] = '\0';
- if ((isCtrl != 0) ^ (0 != DBGetContactSettingByte(NULL, "Chat", "SendOnEnter", 1)))
+ if ((isCtrl != 0) ^ (0 != db_get_b(NULL, "Chat", "SendOnEnter", 1)))
return 0;
- if (DBGetContactSettingByte(NULL, "Chat", "SendOnDblEnter", 0))
+ if (db_get_b(NULL, "Chat", "SendOnDblEnter", 0))
if (dat->lastEnterTime + 2 >= time(NULL))
return 0;
@@ -681,7 +681,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bBkgColor) {
int index = GetColorIndex(Parentsi->pszModule, cf.crBackColor);
- COLORREF crB = (COLORREF)DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW));
+ COLORREF crB = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW));
u = IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR);
if (index >= 0) {
@@ -812,7 +812,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L HWND hColor = GetDlgItem(GetParent(hwnd), IDC_COLOR);
HWND hBGColor = GetDlgItem(GetParent(hwnd), IDC_BKGCOLOR);
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) != 0) {
+ if (db_get_b(NULL, "Chat", "RightClickFilter", 0) != 0) {
if (hFilter == hwnd)
SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0);
if (hColor == hwnd)
@@ -894,7 +894,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR s = (SESSION_INFO* ) tc.lParam;
if (s)
{
- BOOL bOnline = DBGetContactSettingWord(s->hContact, s->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE?TRUE:FALSE;
+ BOOL bOnline = db_get_w(s->hContact, s->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE?TRUE:FALSE;
bDragging = TRUE;
iBeginIndex = i;
ImageList_BeginDrag(hIconsList, bOnline?(MM_FindModule(s->pszModule))->OnlineIconIndex:(MM_FindModule(s->pszModule))->OfflineIconIndex, 8, 8);
@@ -1112,13 +1112,13 @@ static int RestoreWindowPosition(HWND hwnd, HANDLE hContact, char * szModule, ch wp.length=sizeof(wp);
GetWindowPlacement(hwnd,&wp);
wsprintfA(szSettingName,"%sx",szNamePrefix);
- x=DBGetContactSettingDword(hContact,szModule,szSettingName,-1);
+ x=db_get_dw(hContact,szModule,szSettingName,-1);
wsprintfA(szSettingName,"%sy",szNamePrefix);
- y=(int)DBGetContactSettingDword(hContact,szModule,szSettingName,-1);
+ y=(int)db_get_dw(hContact,szModule,szSettingName,-1);
wsprintfA(szSettingName,"%swidth",szNamePrefix);
- width=DBGetContactSettingDword(hContact,szModule,szSettingName,-1);
+ width=db_get_dw(hContact,szModule,szSettingName,-1);
wsprintfA(szSettingName,"%sheight",szNamePrefix);
- height=DBGetContactSettingDword(hContact,szModule,szSettingName,-1);
+ height=db_get_dw(hContact,szModule,szSettingName,-1);
if (x==-1)
return 0;
@@ -1218,7 +1218,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) }
// restore previous tabs
- if (g_Settings.TabsEnable && DBGetContactSettingByte(NULL, "Chat", "TabRestore", 0)) {
+ if (g_Settings.TabsEnable && db_get_b(NULL, "Chat", "TabRestore", 0)) {
TABLIST * node = g_TabList;
while (node) {
SESSION_INFO* s = SM_FindSession(node->pszID, node->pszModule);
@@ -1279,8 +1279,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) cf.dwMask = CFM_COLOR|CFM_BOLD|CFM_UNDERLINE|CFM_BACKCOLOR;
cf.dwEffects = 0;
cf.crTextColor = crFore;
- cf.crBackColor = (COLORREF)DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW));
- SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETBKGNDCOLOR , 0, DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)));
+ cf.crBackColor = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW));
+ SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETBKGNDCOLOR , 0, db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM) g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL , (LPARAM)&cf);
}
@@ -1292,7 +1292,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) ih = GetTextPixelSize( _T("AQGglo"), g_Settings.UserListFont,FALSE);
ih2 = GetTextPixelSize( _T("AQGglo"), g_Settings.UserListHeadingsFont,FALSE);
- height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
+ height = db_get_b(NULL, "Chat", "NicklistRowDist", 12);
font = ih > ih2?ih:ih2;
// make sure we have space for icon!
@@ -1365,7 +1365,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) SESSION_INFO* pActive = GetActiveSession();
WINDOWPLACEMENT wp;
RECT screen;
- int savePerContact = DBGetContactSettingByte(NULL, "Chat", "SavePosition", 0);
+ int savePerContact = db_get_b(NULL, "Chat", "SavePosition", 0);
wp.length=sizeof(wp);
GetWindowPlacement(hwndDlg,&wp);
@@ -1388,7 +1388,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) }
else SetWindowPos(hwndDlg, 0, (screen.right-screen.left)/2- (550)/2,(screen.bottom-screen.top)/2- (400)/2, (550), (400), SWP_NOZORDER |SWP_HIDEWINDOW|SWP_NOACTIVATE);
- if (!g_Settings.TabsEnable && pActive && pActive->hWnd && DBGetContactSettingByte(NULL, "Chat", "CascadeWindows", 1)) {
+ if (!g_Settings.TabsEnable && pActive && pActive->hWnd && db_get_b(NULL, "Chat", "CascadeWindows", 1)) {
RECT rcThis, rcNew;
int dwFlag = SWP_NOZORDER|SWP_NOACTIVATE;
if (!IsWindowVisible ((HWND)wParam))
@@ -1598,7 +1598,7 @@ END_REMOVETAB: indexfound = i;
} }
- w = DBGetContactSettingWord(s2->hContact, s2->pszModule, "TabPosition", 0);
+ w = db_get_w(s2->hContact, s2->pszModule, "TabPosition", 0);
if (w)
lastlocked = (int)w;
} }
@@ -1618,7 +1618,7 @@ END_REMOVETAB: tci.lParam = lParam;
// determine insert position
- w = DBGetContactSettingWord(s1->hContact, s1->pszModule, "TabPosition", 0);
+ w = db_get_w(s1->hContact, s1->pszModule, "TabPosition", 0);
if (wParam == -1)
insertat = w == 0?tabId:(int)w-1;
else
@@ -1687,7 +1687,7 @@ END_REMOVETAB: if (SM_FindSession(si->ptszID, si->pszModule) == s2)
si->wState = s2->wState;
SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)s2);
- if (DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != hwndDlg)
+ if (db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != hwndDlg)
SetTimer(hwndDlg, TIMERID_FLASHWND, 900, NULL);
break;
} }
@@ -1780,7 +1780,7 @@ END_REMOVETAB: for (i = 0; i< tabId ; i++) {
TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB),i, &tci);
s = (SESSION_INFO*)tci.lParam;
- if (s && s->hContact && DBGetContactSettingWord(s->hContact, s->pszModule, "TabPosition", 0) != 0)
+ if (s && s->hContact && db_get_w(s->hContact, s->pszModule, "TabPosition", 0) != 0)
db_set_w(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1));
} } }
break;
@@ -1827,7 +1827,7 @@ END_REMOVETAB: int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE);
int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE);
int font = ih > ih2?ih:ih2;
- int height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
+ int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12);
// make sure we have space for icon!
if (g_Settings.ShowContactStatus)
@@ -1931,7 +1931,7 @@ END_REMOVETAB: case SESSION_TERMINATE:
SendMessage(hwndDlg,GC_SAVEWNDPOS,0,0);
- if (DBGetContactSettingByte(NULL, "Chat", "SavePosition", 0)) {
+ if (db_get_b(NULL, "Chat", "SavePosition", 0)) {
db_set_dw(si->hContact, "Chat", "roomx", si->iX);
db_set_dw(si->hContact, "Chat", "roomy", si->iY);
db_set_dw(si->hContact, "Chat", "roomwidth" , si->iWidth);
@@ -1953,7 +1953,7 @@ END_REMOVETAB: goto LABEL_SHOWWINDOW;
case SESSION_INITDONE:
- if (DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0)!=0)
+ if (db_get_b(NULL, "Chat", "PopupOnJoin", 0)!=0)
return TRUE;
// fall through
case WINDOW_VISIBLE:
@@ -2124,7 +2124,7 @@ LABEL_SHOWWINDOW: if (KillTimer(hwndDlg, TIMERID_FLASHWND))
FlashWindow(hwndDlg, FALSE);
- if (DBGetContactSettingWord(si->hContact, si->pszModule ,"ApparentMode", 0) != 0)
+ if (db_get_w(si->hContact, si->pszModule ,"ApparentMode", 0) != 0)
db_set_w(si->hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
@@ -2163,7 +2163,7 @@ LABEL_SHOWWINDOW: hSubMenu = GetSubMenu(g_hMenu, 5);
TranslateMenu(hSubMenu);
if (s) {
- WORD w = DBGetContactSettingWord(s->hContact, s->pszModule, "TabPosition", 0);
+ WORD w = db_get_w(s->hContact, s->pszModule, "TabPosition", 0);
if ( w == 0)
CheckMenuItem(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND|MF_UNCHECKED);
else
@@ -2549,7 +2549,7 @@ LABEL_SHOWWINDOW: si->bFilterEnabled = !si->bFilterEnabled;
SendDlgItemMessage(hwndDlg,IDC_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadIconEx( si->bFilterEnabled ? "filter" : "filter2", FALSE ));
- if (si->bFilterEnabled && DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0) {
+ if (si->bFilterEnabled && db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) {
SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
break;
}
@@ -2567,7 +2567,7 @@ LABEL_SHOWWINDOW: break;
if (IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR )) {
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
+ if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0)
SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR);
else if (si->bBGSet) {
cf.dwMask = CFM_BACKCOLOR;
@@ -2576,7 +2576,7 @@ LABEL_SHOWWINDOW: } }
else {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW));
+ cf.crBackColor = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
} }
break;
@@ -2591,7 +2591,7 @@ LABEL_SHOWWINDOW: break;
if (IsDlgButtonChecked(hwndDlg, IDC_COLOR )) {
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
+ if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0)
SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR);
else if (si->bFGSet) {
cf.dwMask = CFM_COLOR;
diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index fe578c6fd9..83bbd93e60 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -149,7 +149,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
{
int i;
- DWORD exStyle = DBGetContactSettingDword(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
+ DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
for (i = 0; i < SIZEOF(checkBoxToStyleEx); i++)
CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id,
(exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag *
@@ -160,28 +160,28 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, SIZEOF(accel), (LPARAM) & accel);
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingWord(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
+ MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
}
- CheckDlgButton(hwndDlg, IDC_IDLE, DBGetContactSettingByte(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IDLE, db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(64, 0));
SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingByte(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN), 0));
+ MAKELONG(db_get_b(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN), 0));
SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0));
SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingByte(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT), 0));
+ MAKELONG(db_get_b(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT), 0));
CheckDlgButton(hwndDlg, IDC_GREYOUT,
- DBGetContactSettingDword(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING));
EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, SIZEOF(greyoutValues),
- DBGetContactSettingDword(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
+ db_get_dw(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, SIZEOF(offlineValues),
- DBGetContactSettingDword(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
- CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, DBGetContactSettingByte(NULL, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_GAMMACORRECT, DBGetContactSettingByte(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
+ CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(NULL, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_GAMMACORRECT, db_get_b(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT) ? BST_CHECKED : BST_UNCHECKED);
{
LONG minHeight = CalcMinRowHeight();
- LONG rowHeight = DBGetContactSettingByte(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
+ LONG rowHeight = db_get_b(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
if (rowHeight < minHeight) {
rowHeight = minHeight;
}
@@ -243,26 +243,26 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not)
exStyle |= checkBoxToStyleEx[i].flag;
- DBWriteContactSettingDword(NULL, "CLC", "ExStyle", exStyle);
+ db_set_dw(NULL, "CLC", "ExStyle", exStyle);
{
DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS));
- DBWriteContactSettingDword(NULL, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
+ db_set_dw(NULL, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
if (IsDlgButtonChecked(hwndDlg, IDC_GREYOUT))
- DBWriteContactSettingDword(NULL, "CLC", "GreyoutFlags", fullGreyoutFlags);
+ db_set_dw(NULL, "CLC", "GreyoutFlags", fullGreyoutFlags);
else
- DBWriteContactSettingDword(NULL, "CLC", "GreyoutFlags", 0);
+ db_set_dw(NULL, "CLC", "GreyoutFlags", 0);
}
- DBWriteContactSettingByte(NULL, "CLC", "ShowIdle", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0));
- DBWriteContactSettingDword(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
- DBWriteContactSettingByte(NULL, "CLC", "LeftMargin",
+ db_set_b(NULL, "CLC", "ShowIdle", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0));
+ db_set_dw(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
+ db_set_b(NULL, "CLC", "LeftMargin",
(BYTE) SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, "CLC", "ScrollTime",
+ db_set_w(NULL, "CLC", "ScrollTime",
(WORD) SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CLC", "GroupIndent",
+ db_set_b(NULL, "CLC", "GroupIndent",
(BYTE) SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CLC", "NoVScrollBar", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
- DBWriteContactSettingByte(NULL, "CLC", "RowHeight", (BYTE) SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CLC", "GammaCorrect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_GAMMACORRECT));
+ db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
+ db_set_b(NULL, "CLC", "RowHeight", (BYTE) SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, "CLC", "GammaCorrect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_GAMMACORRECT));
pcli->pfnClcOptionsChanged();
return TRUE;
}
@@ -282,29 +282,29 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_BITMAP,
- DBGetContactSettingByte(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP) ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, WM_USER + 10, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_BKCOLOUR);
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR));
+ SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR));
SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_SELBKCOLOUR);
SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETCOLOUR, 0,
- DBGetContactSettingDword(NULL, "CLC", "SelBkColour", CLCDEFAULT_SELBKCOLOUR));
- CheckDlgButton(hwndDlg, IDC_WINCOLOUR, DBGetContactSettingByte(NULL, "CLC", "UseWinColours", 0));
+ db_get_dw(NULL, "CLC", "SelBkColour", CLCDEFAULT_SELBKCOLOUR));
+ CheckDlgButton(hwndDlg, IDC_WINCOLOUR, db_get_b(NULL, "CLC", "UseWinColours", 0));
SendMessage(hwndDlg, WM_USER + 11, 0, 0);
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(NULL, "CLC", "BkBitmap", &dbv)) {
+ if (!db_get_s(NULL, "CLC", "BkBitmap", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_FILENAME, dbv.pszVal);
char szPath[MAX_PATH];
if ( PathToAbsolute(dbv.pszVal, szPath))
SetDlgItemTextA(hwndDlg, IDC_FILENAME, szPath);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
{
- WORD bmpUse = DBGetContactSettingWord(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
+ WORD bmpUse = db_get_w(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
CheckDlgButton(hwndDlg, IDC_STRETCHH, bmpUse & CLB_STRETCHH ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_STRETCHV, bmpUse & CLB_STRETCHV ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_TILEH, bmpUse & CLBF_TILEH ? BST_CHECKED : BST_UNCHECKED);
@@ -372,28 +372,28 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case 0:
switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
- DBWriteContactSettingByte(NULL, "CLC", "UseBitmap", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
+ db_set_b(NULL, "CLC", "UseBitmap", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
{
COLORREF col;
col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
if (col == CLCDEFAULT_BKCOLOUR)
- DBDeleteContactSetting(NULL, "CLC", "BkColour");
+ db_unset(NULL, "CLC", "BkColour");
else
- DBWriteContactSettingDword(NULL, "CLC", "BkColour", col);
+ db_set_dw(NULL, "CLC", "BkColour", col);
col = SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_GETCOLOUR, 0, 0);
if (col == CLCDEFAULT_SELBKCOLOUR)
- DBDeleteContactSetting(NULL, "CLC", "SelBkColour");
+ db_unset(NULL, "CLC", "SelBkColour");
else
- DBWriteContactSettingDword(NULL, "CLC", "SelBkColour", col);
- DBWriteContactSettingByte(NULL, "CLC", "UseWinColours", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR)));
+ db_set_dw(NULL, "CLC", "SelBkColour", col);
+ db_set_b(NULL, "CLC", "UseWinColours", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR)));
}
{
char str[MAX_PATH], strrel[MAX_PATH];
GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
if ( PathToRelative(str, strrel))
- DBWriteContactSettingString(NULL, "CLC", "BkBitmap", strrel);
+ db_set_s(NULL, "CLC", "BkBitmap", strrel);
else
- DBWriteContactSettingString(NULL, "CLC", "BkBitmap", str);
+ db_set_s(NULL, "CLC", "BkBitmap", str);
}
{
WORD flags = 0;
@@ -409,7 +409,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, flags |= CLBF_SCROLL;
if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL))
flags |= CLBF_PROPORTIONAL;
- DBWriteContactSettingWord(NULL, "CLC", "BkBmpUse", flags);
+ db_set_w(NULL, "CLC", "BkBmpUse", flags);
}
pcli->pfnClcOptionsChanged();
return TRUE;
diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index f0c54cd3e8..194d6e20e3 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -43,23 +43,23 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1));
- CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE,
- DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS,
- DBGetContactSettingByte(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS,
- DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_SORTBYNAME, !DBGetContactSettingByte(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT)
- && !DBGetContactSettingByte(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_SORTBYNAME, !db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT)
+ && !db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS,
- DBGetContactSettingByte(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SORTBYPROTO,
- DBGetContactSettingByte(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE,
- DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTOHIDE,
- DBGetContactSettingByte(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
{
@@ -79,28 +79,28 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1));
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
+ MAKELONG(db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
CheckDlgButton(hwndDlg, IDC_ONECLK,
- DBGetContactSettingByte(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS,
- DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI,
- !DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ !db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DONTCYCLE,
- DBGetContactSettingByte(NULL, "CList", "TrayIcon",
+ db_get_b(NULL, "CList", "TrayIcon",
SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CYCLE,
- DBGetContactSettingByte(NULL, "CList", "TrayIcon",
+ db_get_b(NULL, "CList", "TrayIcon",
SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_MULTITRAY,
- DBGetContactSettingByte(NULL, "CList", "TrayIcon",
+ db_get_b(NULL, "CList", "TrayIcon",
SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEBLINK,
- DBGetContactSettingByte(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKTIME), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
EnableWindow(GetDlgItem(hwndDlg, IDC_STMSDELAY), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
- CheckDlgButton(hwndDlg, IDC_ICONBLINK, DBGetContactSettingByte(NULL, "CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ICONBLINK, db_get_b(NULL, "CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE);
@@ -117,12 +117,12 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1));
SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
+ MAKELONG(db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
{
int i, count, item;
PROTOACCOUNT **accs;
DBVARIANT dbv = { DBVT_DELETED };
- DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv);
+ db_get(NULL, "CList", "PrimaryStatus", &dbv);
CallService( MS_PROTO_ENUMACCOUNTS, (WPARAM)&count, (LPARAM)&accs);
item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) TranslateT("Global"));
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM) 0);
@@ -134,13 +134,13 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dbv.type == DBVT_ASCIIZ && !lstrcmpA(dbv.pszVal, accs[i]->szModuleName))
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (-1 == (int) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0))
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM) GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy
SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250));
- SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550), 0));
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "IconFlashTime", 550), 0));
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDC_AUTOHIDE) {
@@ -173,49 +173,49 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case 0:
switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
- DBWriteContactSettingByte(NULL, "CList", "HideOffline", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
+ db_set_b(NULL, "CList", "HideOffline", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
{
DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0);
if (caps & CLUIF_HIDEEMPTYGROUPS)
- DBWriteContactSettingByte(NULL, "CList", "HideEmptyGroups",
+ db_set_b(NULL, "CList", "HideEmptyGroups",
(BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
if (caps & CLUIF_DISABLEGROUPS)
- DBWriteContactSettingByte(NULL, "CList", "UseGroups", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
+ db_set_b(NULL, "CList", "UseGroups", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
if (!(caps & CLUIF_HASONTOPOPTION)) {
- DBWriteContactSettingByte(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
+ db_set_b(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
SetWindowPos( pcli->hwndContactList,
IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
}
if (!(caps & CLUIF_HASAUTOHIDEOPTION)) {
- DBWriteContactSettingByte(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- DBWriteContactSettingWord(NULL, "CList", "HideTime",
+ db_set_b(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
+ db_set_w(NULL, "CList", "HideTime",
(WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
}
}
- DBWriteContactSettingByte(NULL, "CList", "SortByStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS));
- DBWriteContactSettingByte(NULL, "CList", "SortByProto", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO));
- DBWriteContactSettingByte(NULL, "CList", "ConfirmDelete", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE));
- DBWriteContactSettingByte(NULL, "CList", "Tray1Click", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
- DBWriteContactSettingByte(NULL, "CList", "AlwaysStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
- DBWriteContactSettingByte(NULL, "CList", "AlwaysMulti", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
- DBWriteContactSettingByte(NULL, "CList", "TrayIcon",
+ db_set_b(NULL, "CList", "SortByStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS));
+ db_set_b(NULL, "CList", "SortByProto", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO));
+ db_set_b(NULL, "CList", "ConfirmDelete", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE));
+ db_set_b(NULL, "CList", "Tray1Click", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
+ db_set_b(NULL, "CList", "AlwaysStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
+ db_set_b(NULL, "CList", "AlwaysMulti", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
+ db_set_b(NULL, "CList", "TrayIcon",
(BYTE) (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE
: (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE :
SETTING_TRAYICON_MULTI)));
- DBWriteContactSettingWord(NULL, "CList", "CycleTime",
+ db_set_w(NULL, "CList", "CycleTime",
(WORD) SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, "CList", "IconFlashTime",
+ db_set_w(NULL, "CList", "IconFlashTime",
(WORD) SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CList", "DisableTrayFlash", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
- DBWriteContactSettingByte(NULL, "CList", "NoIconBlink", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK));
+ db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
+ db_set_b(NULL, "CList", "NoIconBlink", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK));
{
int cur = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
PROTOACCOUNT* pa = ( PROTOACCOUNT* )SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cur, 0 );
if ( pa == NULL )
- DBDeleteContactSetting(NULL, "CList", "PrimaryStatus");
+ db_unset(NULL, "CList", "PrimaryStatus");
else
- DBWriteContactSettingString(NULL, "CList", "PrimaryStatus", pa->szModuleName );
+ db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName );
}
pcli->pfnTrayIconIconsChanged();
diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 3a4bf267de..d3e248056e 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -31,38 +31,38 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT,
- DBGetContactSettingByte(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_TOOLWND,
- DBGetContactSettingByte(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_MIN2TRAY,
- DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND))
EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE);
CheckDlgButton(hwndDlg, IDC_SHOWCAPTION,
- DBGetContactSettingByte(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU,
- DBGetContactSettingByte(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CLIENTDRAG,
- DBGetContactSettingByte(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_TOOLWND), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), FALSE);
}
- CheckDlgButton(hwndDlg, IDC_FADEINOUT, DBGetContactSettingByte(NULL, "CLUI", "FadeInOut", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOSIZE, DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DROPSHADOW, DBGetContactSettingByte(NULL, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONDESKTOP, DBGetContactSettingByte(NULL, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DISABLEDOCKING, DBGetContactSettingByte(NULL, "CLUI", "DockToSides", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(NULL, "CLUI", "FadeInOut", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOSIZE, db_get_b(NULL, "CLUI", "AutoSize", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(NULL, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(NULL, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DISABLEDOCKING, db_get_b(NULL, "CLUI", "DockToSides", 1) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, DBGetContactSettingByte(NULL, "CLUI", "MaxSizeHeight", 75));
- CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, DBGetContactSettingByte(NULL, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "MaxSizeHeight", 75));
+ CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(NULL, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTOHIDE,
- DBGetContactSettingByte(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1));
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0,
- MAKELONG(DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
+ MAKELONG(db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
@@ -75,9 +75,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
{ DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "CList", "TitleText", &dbv)) {
+ if ( !db_get_ts(NULL, "CList", "TitleText", &dbv)) {
SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME);
}
@@ -88,7 +88,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
else
CheckDlgButton(hwndDlg, IDC_TRANSPARENT,
- DBGetContactSettingByte(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (!IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC11), FALSE);
@@ -100,9 +100,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
- SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, DBGetContactSettingByte(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT));
+ SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT));
SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE,
- DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT));
+ db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT));
SendMessage(hwndDlg, WM_HSCROLL, 0x12345678, 0);
return TRUE;
@@ -159,29 +159,29 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_NOTIFY:
if (((LPNMHDR) lParam)->code == PSN_APPLY)
{
- DBWriteContactSettingByte(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
- DBWriteContactSettingByte(NULL, "CList", "ToolWindow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TOOLWND));
- DBWriteContactSettingByte(NULL, "CList", "BringToFront", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
- DBWriteContactSettingByte(NULL, "CLUI", "FadeInOut", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
- DBWriteContactSettingByte(NULL, "CLUI", "AutoSize", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- DBWriteContactSettingByte(NULL, "CLUI", "MaxSizeHeight", (BYTE) GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, "CLUI", "AutoSizeUpward", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
- DBWriteContactSettingByte(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- DBWriteContactSettingWord(NULL, "CList", "HideTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CList", "Transparent", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- DBWriteContactSettingByte(NULL, "CList", "Alpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CList", "AutoAlpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, "CList", "WindowShadow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW));
- DBWriteContactSettingByte(NULL, "CList", "OnDesktop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP));
- DBWriteContactSettingByte(NULL, "CLUI", "DockToSides", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEDOCKING));
- DBWriteContactSettingByte(NULL, "CLUI", "ShowCaption", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION));
- DBWriteContactSettingByte(NULL, "CLUI", "ShowMainMenu", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU));
- DBWriteContactSettingByte(NULL, "CLUI", "ClientAreaDrag", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG));
- DBWriteContactSettingByte(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
+ db_set_b(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
+ db_set_b(NULL, "CList", "ToolWindow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TOOLWND));
+ db_set_b(NULL, "CList", "BringToFront", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
+ db_set_b(NULL, "CLUI", "FadeInOut", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
+ db_set_b(NULL, "CLUI", "AutoSize", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
+ db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE) GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE));
+ db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
+ db_set_b(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
+ db_set_w(NULL, "CList", "HideTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, "CList", "Transparent", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
+ db_set_b(NULL, "CList", "Alpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
+ db_set_b(NULL, "CList", "AutoAlpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
+ db_set_b(NULL, "CList", "WindowShadow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW));
+ db_set_b(NULL, "CList", "OnDesktop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP));
+ db_set_b(NULL, "CLUI", "DockToSides", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEDOCKING));
+ db_set_b(NULL, "CLUI", "ShowCaption", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION));
+ db_set_b(NULL, "CLUI", "ShowMainMenu", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU));
+ db_set_b(NULL, "CLUI", "ClientAreaDrag", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG));
+ db_set_b(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
{
TCHAR title[256];
GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, SIZEOF(title));
- DBWriteContactSettingTString(NULL, "CList", "TitleText", title);
+ db_set_ts(NULL, "CList", "TitleText", title);
SetWindowText(pcli->hwndContactList, title);
}
@@ -239,7 +239,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
if (MySetLayeredWindowAttributes)
MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0),
- (BYTE) DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT),
+ (BYTE) db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT),
LWA_ALPHA);
}
else
@@ -259,18 +259,18 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SHOWSBAR, DBGetContactSettingByte(NULL, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED);
{
- BYTE showOpts = DBGetContactSettingByte(NULL, "CLUI", "SBarShow", 1);
+ BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1);
CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts & 1 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts & 2 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts & 4 ? BST_CHECKED : BST_UNCHECKED);
}
- CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, DBGetContactSettingByte(NULL, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, db_get_b(NULL, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, !IsDlgButtonChecked(hwndDlg, IDC_RIGHTSTATUS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, DBGetContactSettingByte(NULL, "CLUI", "EqualSections", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, DBGetContactSettingByte(NULL, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWGRIP, DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL, "CLUI", "EqualSections", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, db_get_b(NULL, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWGRIP, db_get_b(NULL, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWICON), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWPROTO), FALSE);
@@ -297,23 +297,23 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_NOTIFY:
if (((LPNMHDR) lParam)->code == PSN_APPLY ) {
- DBWriteContactSettingByte(NULL, "CLUI", "ShowSBar", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- DBWriteContactSettingByte(NULL, "CLUI", "SBarShow",
+ db_set_b(NULL, "CLUI", "ShowSBar", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
+ db_set_b(NULL, "CLUI", "SBarShow",
(BYTE) ((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0)));
- DBWriteContactSettingByte(NULL, "CLUI", "SBarRightClk", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
- DBWriteContactSettingByte(NULL, "CLUI", "EqualSections", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
- DBWriteContactSettingByte(NULL, "CLUI", "SBarBevel", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
+ db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
+ db_set_b(NULL, "CLUI", "EqualSections", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
+ db_set_b(NULL, "CLUI", "SBarBevel", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
pcli->pfnLoadCluiGlobalOpts();
- if (DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) != (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
+ if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
HWND parent = GetParent(pcli->hwndStatus);
int flags = WS_CHILD | CCS_BOTTOM;
- DBWriteContactSettingByte(NULL, "CLUI", "ShowGrip", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
+ db_set_b(NULL, "CLUI", "ShowGrip", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
ShowWindow(pcli->hwndStatus, SW_HIDE);
DestroyWindow(pcli->hwndStatus);
- flags |= DBGetContactSettingByte(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
- flags |= DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
+ flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
+ flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, parent, NULL, g_hInst, NULL);
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR))
diff --git a/src/core/stdclist/src/commonheaders.h b/src/core/stdclist/src/commonheaders.h index e21c8c91a6..b1aabc39e0 100644 --- a/src/core/stdclist/src/commonheaders.h +++ b/src/core/stdclist/src/commonheaders.h @@ -70,7 +70,7 @@ extern HINSTANCE g_hInst; all the bad free()'s to good ones, however it's still incorrect code. The reasons for not
changing them include:
- * DBFreeVariant has a CallService() lookup
+ * db_free has a CallService() lookup
* free() is executed in some large loops to do with clist creation of group data
* easy search and replace
diff --git a/src/core/stdemail/email.cpp b/src/core/stdemail/email.cpp index d744e71f51..95f772884b 100644 --- a/src/core/stdemail/email.cpp +++ b/src/core/stdemail/email.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "commonheaders.h"
-static HANDLE hEMailMenuItem;
+static HGENMENU hEMailMenuItem;
void SendEmailThread(void *szUrl)
{
@@ -35,8 +35,8 @@ static INT_PTR SendEMailCommand(WPARAM wParam, LPARAM lParam) {
DBVARIANT dbv;
char *szProto = GetContactProto((HANDLE)wParam);
- if (szProto == NULL || DBGetContactSettingString((HANDLE)wParam, szProto, "e-mail", &dbv)) {
- if (DBGetContactSettingString((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv)) {
+ if (szProto == NULL || db_get_s((HANDLE)wParam, szProto, "e-mail", &dbv)) {
+ if (db_get_s((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv)) {
MessageBox((HWND)lParam, TranslateT("User has not registered an e-mail address"), TranslateT("Send e-mail"), MB_OK);
return 1;
}
@@ -51,17 +51,15 @@ static INT_PTR SendEMailCommand(WPARAM wParam, LPARAM lParam) static int EMailPreBuildMenu(WPARAM wParam, LPARAM)
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
-
+ bool bEnabled = true;
DBVARIANT dbv = { 0 };
char *szProto = GetContactProto((HANDLE)wParam);
- if (szProto == NULL || DBGetContactSettingString((HANDLE)wParam, szProto, "e-mail", & dbv))
- if (DBGetContactSettingString((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv))
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
+ if (szProto == NULL || db_get_s((HANDLE)wParam, szProto, "e-mail", & dbv))
+ if (db_get_s((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv))
+ bEnabled = false;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hEMailMenuItem, (LPARAM)&mi);
- if (dbv.pszVal) DBFreeVariant(&dbv);
+ Menu_ShowItem(hEMailMenuItem, bEnabled);
+ if (dbv.pszVal) db_free(&dbv);
return 0;
}
diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index 048125abac..8e67d7f802 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -27,22 +27,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TCHAR* PFTS_StringToTchar(int flags, const PROTOCHAR* s);
int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR *r);
-static HANDLE hSRFileMenuItem;
+static HGENMENU hSRFileMenuItem;
TCHAR *GetContactID(HANDLE hContact)
{
TCHAR *theValue = {0};
char *szProto = GetContactProto(hContact);
- 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)) {
theValue = (TCHAR *)mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return theValue;
- } }
+ }
+ }
else {
- CONTACTINFO ci = {0};
- ci.cbSize = sizeof(ci);
+ CONTACTINFO ci = { sizeof(ci) };
ci.hContact = hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
@@ -50,11 +50,11 @@ TCHAR *GetContactID(HANDLE hContact) switch (ci.type) {
case CNFT_ASCIIZ:
return (TCHAR *)ci.pszVal;
- break;
case CNFT_DWORD:
return _itot(ci.dVal, (TCHAR *)mir_alloc(sizeof(TCHAR)*32), 10);
- break;
- } } }
+ }
+ }
+ }
return NULL;
}
@@ -71,20 +71,20 @@ static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam) {
FileSendData fsd;
fsd.hContact = (HANDLE)wParam;
-
- char** ppFiles = (char**)lParam;
- int count = 0;
- while (ppFiles[count] != NULL)
- count++;
-
- fsd.ppFiles = (const TCHAR**)alloca((count+1) * sizeof(void*));
- for (int i=0; i < count; i++)
- fsd.ppFiles[i] = (const TCHAR*)mir_a2t(ppFiles[i]);
- fsd.ppFiles[ count ] = NULL;
-
+
+ char** ppFiles = (char**)lParam;
+ int count = 0;
+ while (ppFiles[count] != NULL)
+ count++;
+
+ fsd.ppFiles = (const TCHAR**)alloca((count+1) * sizeof(void*));
+ for (int i=0; i < count; i++)
+ fsd.ppFiles[i] = (const TCHAR*)mir_a2t(ppFiles[i]);
+ fsd.ppFiles[ count ] = NULL;
+
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
for (int j = 0; j < count; j++)
- mir_free((void*)fsd.ppFiles[j]);
+ mir_free((void*)fsd.ppFiles[j]);
return 0;
}
@@ -99,11 +99,11 @@ static INT_PTR SendSpecificFilesT(WPARAM wParam, LPARAM lParam) static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam)
{
- TCHAR buf[MAX_PATH];
+ TCHAR buf[MAX_PATH];
GetContactReceivedFilesDir((HANDLE)wParam, buf, MAX_PATH, TRUE);
- char* dir = mir_t2a(buf);
- lstrcpynA((char*)lParam, dir, MAX_PATH);
- mir_free(dir);
+ char* dir = mir_t2a(buf);
+ lstrcpynA((char*)lParam, dir, MAX_PATH);
+ mir_free(dir);
return 0;
}
@@ -120,7 +120,7 @@ void PushFileEvent(HANDLE hContact, HANDLE hdbe, LPARAM lParam) cle.hContact = hContact;
cle.hDbEvent = hdbe;
cle.lParam = lParam;
- if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) {
+ if (db_get_b(NULL, "SRFile", "AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) {
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle);
}
else {
@@ -134,7 +134,7 @@ void PushFileEvent(HANDLE hContact, HANDLE hdbe, LPARAM lParam) cle.hIcon = LoadSkinIcon(SKINICON_EVENT_FILE);
cle.pszService = "SRFile/RecvFile";
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
-} }
+ } }
static int FileEventAdded(WPARAM wParam, LPARAM lParam)
{
@@ -158,7 +158,7 @@ int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValu if (RegOpenKeyEx(hKeyBase, szSubKey, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
return 0;
-
+
if (RegQueryValueEx(hKey, szValue, NULL, NULL, (PBYTE)szOutput, &cbOut) != ERROR_SUCCESS) {
RegCloseKey(hKey);
return 0;
@@ -175,15 +175,15 @@ void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsO else if (size<100*1024) unitsOverride = UNITS_KBPOINT1;
else if (size<1024*1024) unitsOverride = UNITS_KBPOINT0;
else if (size<1024*1024*1024) unitsOverride = UNITS_MBPOINT2;
- else unitsOverride = UNITS_GBPOINT3;
+ else unitsOverride = UNITS_GBPOINT3;
}
if (unitsUsed) *unitsUsed = unitsOverride;
switch(unitsOverride) {
- case UNITS_BYTES: mir_sntprintf(szOut, cchOut, _T("%u%s%s"), (int)size, appendUnits?_T(" "):_T(""), appendUnits?TranslateT("bytes"):_T("")); break;
- case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, _T("%.1lf%s"), size/1024.0, appendUnits?_T(" KB"):_T("")); break;
- case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, _T("%u%s"), (int)(size/1024), appendUnits?_T(" KB"):_T("")); break;
- case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, _T("%.3f%s"), (size >> 20)/1024.0, appendUnits?_T(" GB"):_T("")); break;
- default: mir_sntprintf(szOut, cchOut, _T("%.2lf%s"), size/1048576.0, appendUnits?_T(" MB"):_T("")); break;
+ case UNITS_BYTES: mir_sntprintf(szOut, cchOut, _T("%u%s%s"), (int)size, appendUnits?_T(" "):_T(""), appendUnits?TranslateT("bytes"):_T("")); break;
+ case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, _T("%.1lf%s"), size/1024.0, appendUnits?_T(" KB"):_T("")); break;
+ case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, _T("%u%s"), (int)(size/1024), appendUnits?_T(" KB"):_T("")); break;
+ case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, _T("%.3f%s"), (size >> 20)/1024.0, appendUnits?_T(" GB"):_T("")); break;
+ default: mir_sntprintf(szOut, cchOut, _T("%.2lf%s"), size/1048576.0, appendUnits?_T(" MB"):_T("")); break;
}
}
@@ -281,8 +281,8 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS dest->currentFileSize = src->currentFileSize;
dest->currentFileProgress = src->currentFileProgress;
dest->currentFileTime = src->currentFileTime;
- dest->flags &= ~PFTS_UTF;
- dest->flags |= PFTS_TCHAR;
+ dest->flags &= ~PFTS_UTF;
+ dest->flags |= PFTS_TCHAR;
}
static void RemoveUnreadFileEvents(void)
@@ -303,19 +303,18 @@ static void RemoveUnreadFileEvents(void) static int SRFilePreBuildMenu(WPARAM wParam, LPARAM)
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
+ bool bEnabled = false;
char *szProto = GetContactProto((HANDLE)wParam);
if (szProto != NULL) {
if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_FILESEND) {
if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_OFFLINEFILES)
- mi.flags = CMIM_FLAGS;
- else if (DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- mi.flags = CMIM_FLAGS;
- } }
+ bEnabled = true;
+ else if (db_get_w((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ bEnabled = true;
+ }
+ }
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hSRFileMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hSRFileMenuItem, bEnabled);
return 0;
}
@@ -365,7 +364,7 @@ static void sttRecvCreateBlob(DBEVENTINFO& dbei, int fileCount, char** pszFiles, for (int i=0; i < fileCount; i++)
dbei.cbBlob += lstrlenA(pszFiles[i]) + 1;
}
-
+
dbei.cbBlob += lstrlenA(szDescr) + 1;
if ((dbei.pBlob = (BYTE*)mir_alloc(dbei.cbBlob)) == 0)
diff --git a/src/core/stdfile/fileopts.cpp b/src/core/stdfile/fileopts.cpp index 5e9a465d63..c018c18a5f 100644 --- a/src/core/stdfile/fileopts.cpp +++ b/src/core/stdfile/fileopts.cpp @@ -71,16 +71,16 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetDlgItemText(hwndDlg, IDC_FILEDIR, str);
}
- CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOMIN, DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, DBGetContactSettingByte(NULL, "SRFile", "AutoClose", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, DBGetContactSettingByte(NULL, "SRFile", "AutoClear", 1) ? BST_CHECKED : BST_UNCHECKED);
- switch(DBGetContactSettingByte(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE)) {
+ CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, db_get_b(NULL, "SRFile", "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, "SRFile", "AutoMin", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, db_get_b(NULL, "SRFile", "AutoClose", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, db_get_b(NULL, "SRFile", "AutoClear", 1) ? BST_CHECKED : BST_UNCHECKED);
+ switch(db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE)) {
case VIRUSSCAN_AFTERDL: CheckDlgButton(hwndDlg, IDC_SCANAFTERDL, BST_CHECKED); break;
case VIRUSSCAN_DURINGDL: CheckDlgButton(hwndDlg, IDC_SCANDURINGDL, BST_CHECKED); break;
default: CheckDlgButton(hwndDlg, IDC_NOSCANNER, BST_CHECKED); break;
}
- CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, DBGetContactSettingByte(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED);
{ TCHAR szScanExe[MAX_PATH];
int i, iItem;
@@ -98,9 +98,9 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
DBVARIANT dbv;
- if (DBGetContactSettingTString(NULL, "SRFile", "ScanCmdLine", &dbv) == 0) {
+ if (db_get_ts(NULL, "SRFile", "ScanCmdLine", &dbv) == 0) {
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
if (SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETCOUNT, 0, 0)) {
@@ -108,7 +108,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L PostMessage(hwndDlg, M_SCANCMDLINESELCHANGE, 0, 0);
}
}
- switch(DBGetContactSettingByte(NULL, "SRFile", "IfExists", FILERESUME_ASK)) {
+ switch(db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK)) {
case FILERESUME_RESUMEALL: CheckDlgButton(hwndDlg, IDC_RESUME, BST_CHECKED); break;
case FILERESUME_OVERWRITEALL: CheckDlgButton(hwndDlg, IDC_OVERWRITE, BST_CHECKED); break;
case FILERESUME_RENAMEALL: CheckDlgButton(hwndDlg, IDC_RENAME, BST_CHECKED); break;
@@ -211,16 +211,16 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { TCHAR str[512];
GetDlgItemText(hwndDlg, IDC_FILEDIR, str, SIZEOF(str));
RemoveInvalidPathChars(str);
- DBWriteContactSettingTString(NULL, "SRFile", "RecvFilesDirAdv", str);
- DBWriteContactSettingByte(NULL, "SRFile", "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT));
- DBWriteContactSettingByte(NULL, "SRFile", "AutoMin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
- DBWriteContactSettingByte(NULL, "SRFile", "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
- DBWriteContactSettingByte(NULL, "SRFile", "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR));
- DBWriteContactSettingByte(NULL, "SRFile", "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL)?VIRUSSCAN_AFTERDL:(IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL)?VIRUSSCAN_DURINGDL:VIRUSSCAN_DISABLE)));
+ db_set_ts(NULL, "SRFile", "RecvFilesDirAdv", str);
+ db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT));
+ db_set_b(NULL, "SRFile", "AutoMin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
+ db_set_b(NULL, "SRFile", "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
+ db_set_b(NULL, "SRFile", "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR));
+ db_set_b(NULL, "SRFile", "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL)?VIRUSSCAN_AFTERDL:(IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL)?VIRUSSCAN_DURINGDL:VIRUSSCAN_DISABLE)));
GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, SIZEOF(str));
- DBWriteContactSettingTString(NULL, "SRFile", "ScanCmdLine", str);
- DBWriteContactSettingByte(NULL, "SRFile", "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING));
- DBWriteContactSettingByte(NULL, "SRFile", "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK)?FILERESUME_ASK:(IsDlgButtonChecked(hwndDlg, IDC_RESUME)?FILERESUME_RESUMEALL:(IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE)?FILERESUME_OVERWRITEALL:FILERESUME_RENAMEALL))));
+ db_set_ts(NULL, "SRFile", "ScanCmdLine", str);
+ db_set_b(NULL, "SRFile", "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING));
+ db_set_b(NULL, "SRFile", "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK)?FILERESUME_ASK:(IsDlgButtonChecked(hwndDlg, IDC_RESUME)?FILERESUME_RESUMEALL:(IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE)?FILERESUME_OVERWRITEALL:FILERESUME_RENAMEALL))));
return TRUE;
}
}
diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index f9e2c3ddce..5633073ac4 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -136,10 +136,10 @@ void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL TCHAR szTemp[MAX_PATH];
szTemp[0] = 0;
- if ( !DBGetContactSettingTString(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
+ if ( !db_get_ts(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
if (lstrlen(dbv.ptszVal) > 0)
lstrcpyn(szTemp, dbv.ptszVal, SIZEOF(szTemp));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !szTemp[0])
@@ -185,10 +185,10 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir) TCHAR szTemp[MAX_PATH];
szTemp[0] = 0;
- if ( !DBGetContactSettingTString(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
+ if ( !db_get_ts(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
if (lstrlen(dbv.ptszVal) > 0)
lstrcpyn(szTemp, dbv.ptszVal, SIZEOF(szTemp));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !szTemp[0])
@@ -241,10 +241,10 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i);
DBVARIANT dbv;
- if (DBGetContactSettingTString(NULL, "SRFile", idstr, &dbv))
+ if (db_get_ts(NULL, "SRFile", idstr, &dbv))
break;
SendDlgItemMessage(hwndDlg, IDC_FILEDIR, CB_ADDSTRING, 0, (LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
db_event_markRead(dat->hContact, dat->hDbEvent);
@@ -302,18 +302,18 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_NAME, contactName);
}
- if (DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) {
+ if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
RECT rcBtn1, rcBtn2, rcDateCtrl;
GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rcBtn1);
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rcBtn2);
GetWindowRect(GetDlgItem(hwndDlg, IDC_DATE), &rcDateCtrl);
SetWindowPos(GetDlgItem(hwndDlg, IDC_DATE), 0, 0, 0, rcDateCtrl.right-rcDateCtrl.left-(rcBtn2.left-rcBtn1.left), rcDateCtrl.bottom-rcDateCtrl.top, SWP_NOZORDER|SWP_NOMOVE);
}
- else if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0)) {
+ else if (db_get_b(NULL, "SRFile", "AutoAccept", 0)) {
//don't check auto-min here to fix BUG#647620
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK));
}
- if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
return TRUE;
@@ -362,12 +362,12 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l DBVARIANT dbv;
for (i = MAX_MRU_DIRS-2;i>=0;i--) {
mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i);
- if (DBGetContactSettingTString(NULL, "SRFile", idstr, &dbv)) continue;
+ if (db_get_ts(NULL, "SRFile", idstr, &dbv)) continue;
mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i+1);
- DBWriteContactSettingTString(NULL, "SRFile", idstr, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_set_ts(NULL, "SRFile", idstr, dbv.ptszVal);
+ db_free(&dbv);
}
- DBWriteContactSettingTString(NULL, "SRFile", idstr, szRecvDir);
+ db_set_ts(NULL, "SRFile", idstr, szRecvDir);
}
}
EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAMES), FALSE);
@@ -381,7 +381,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l dat->hwndTransfer = FtMgr_AddTransfer(dat);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
//check for auto-minimize here to fix BUG#647620
- if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0)) {
+ if (db_get_b(NULL, "SRFile", "AutoAccept", 0) && db_get_b(NULL, "SRFile", "AutoMin", 0)) {
ShowWindow(hwndDlg, SW_HIDE);
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
}
@@ -401,7 +401,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l acs.handleType = HANDLE_CONTACT;
acs.szProto = "";
CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
- if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
break;
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp index 93354d07d4..593008551e 100644 --- a/src/core/stdfile/filexferdlg.cpp +++ b/src/core/stdfile/filexferdlg.cpp @@ -32,7 +32,7 @@ static int CheckVirusScanned(HWND hwnd, struct FileDlgData *dat, int i) if (dat->send) return 1;
if (dat->fileVirusScanned == NULL) return 0;
if (dat->fileVirusScanned[i]) return 1;
- if (DBGetContactSettingByte(NULL, "SRFile", "WarnBeforeOpening", 1) == 0) return 1;
+ if (db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) == 0) return 1;
return IDYES == MessageBox(hwnd, TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"), TranslateT("File Received"), MB_YESNO|MB_DEFBUTTON2);
}
@@ -103,7 +103,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) DBVARIANT dbv;
TCHAR szCmdLine[768];
- if ( !DBGetContactSettingTString(NULL, "SRFile", "ScanCmdLine", &dbv))
+ if ( !db_get_ts(NULL, "SRFile", "ScanCmdLine", &dbv))
{
if (dbv.ptszVal[0])
{
@@ -125,7 +125,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) CloseHandle(pi.hThread);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
mir_free(info->szFile);
mir_free(info);
@@ -255,8 +255,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CreateDirectoryTreeT(dat->szSavePath);
dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILEALLOWT, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath);
- if (DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK;
- else dat->resumeBehaviour = DBGetContactSettingByte(NULL, "SRFile", "IfExists", FILERESUME_ASK);
+ if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK;
+ else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK);
SetFtStatus(hwndDlg, LPGENT("Waiting for connection..."), FTS_TEXT);
}
{
@@ -530,7 +530,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemTextA(hwndDlg, IDC_FILENAME, "");
if (dat->transferStatus.currentFileNumber == 1 && dat->transferStatus.totalFiles>1 && !dat->send)
SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1);
- if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && DBGetContactSettingByte(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) {
+ if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) {
if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY)
PostMessage(hwndDlg, M_VIRUSSCANDONE, dat->transferStatus.currentFileNumber, 0);
else {
@@ -666,7 +666,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR LPGENT("Transfer completed, open folder."),
FTS_OPEN);
- int useScanner = DBGetContactSettingByte(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE);
+ int useScanner = db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE);
if (useScanner != VIRUSSCAN_DISABLE) {
struct virusscanthreadstartinfo *vstsi;
vstsi = (struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo));
diff --git a/src/core/stdfile/ftmanager.cpp b/src/core/stdfile/ftmanager.cpp index deb1bd3ef7..65b74a75fc 100644 --- a/src/core/stdfile/ftmanager.cpp +++ b/src/core/stdfile/ftmanager.cpp @@ -162,7 +162,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA if (i == dat->wnds->realCount)
PostMessage(GetParent(hwnd), WM_TIMER, 1, NULL);
- if(dat->runningCount == 0 && (int)wParam == ACKRESULT_SUCCESS && DBGetContactSettingByte(NULL, "SRFile", "AutoClose", 0))
+ if(dat->runningCount == 0 && (int)wParam == ACKRESULT_SUCCESS && db_get_b(NULL, "SRFile", "AutoClose", 0))
ShowWindow(hwndFtMgr, SW_HIDE);
break;
@@ -414,7 +414,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_CLOSE:
ShowWindow(hwnd, SW_HIDE);
- if (DBGetContactSettingByte(NULL, "SRFile", "AutoClear", 1)) {
+ if (db_get_b(NULL, "SRFile", "AutoClear", 1)) {
PostMessage(dat->hwndIncoming, WM_FT_CLEANUP, 0, 0);
PostMessage(dat->hwndOutgoing, WM_FT_CLEANUP, 0, 0);
}
@@ -476,7 +476,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HWND FtMgr_Show(bool bForceActivate, bool bFromMenu)
{
- bool bAutoMin = DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0) != 0; /* lqbe */
+ bool bAutoMin = db_get_b(NULL, "SRFile", "AutoMin", 0) != 0; /* lqbe */
bool bJustCreated = (hwndFtMgr == NULL);
if (bJustCreated)
@@ -520,7 +520,7 @@ void FtMgr_ShowPage(int page) HWND FtMgr_AddTransfer(FileDlgData *fdd)
{
- bool bForceActivate = fdd->send || !DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0);
+ bool bForceActivate = fdd->send || !db_get_b(NULL, "SRFile", "AutoAccept", 0);
TFtMgrData *dat = (TFtMgrData*)GetWindowLongPtr(FtMgr_Show(bForceActivate, false), GWLP_USERDATA);
if (dat == NULL)
return NULL;
diff --git a/src/core/stdidle/idle.cpp b/src/core/stdidle/idle.cpp index 3f73f6511f..a66f05d93e 100644 --- a/src/core/stdidle/idle.cpp +++ b/src/core/stdidle/idle.cpp @@ -169,7 +169,7 @@ static void IdleObject_ReadSettings(IdleObject * obj) {
obj->useridlecheck = db_get_b(NULL, IDLEMOD, IDL_USERIDLECHECK, 0);
obj->minutes = db_get_b(NULL, IDLEMOD, IDL_IDLETIME1ST, 10);
- obj->aastatus = !db_get_b(NULL, IDLEMOD, IDL_AAENABLE, 0) ? 0 : DBGetContactSettingWord(NULL, IDLEMOD, IDL_AASTATUS, 0);
+ obj->aastatus = !db_get_b(NULL, IDLEMOD, IDL_AAENABLE, 0) ? 0 : db_get_w(NULL, IDLEMOD, IDL_AASTATUS, 0);
if ( db_get_b(NULL, IDLEMOD, IDL_IDLESOUNDSOFF, 1))
obj->aasoundsoff = 1;
else
@@ -372,7 +372,7 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L for (j = 0; j < SIZEOF(aa_Status); j++)
SendDlgItemMessage(hwndDlg, IDC_AASTATUS, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(aa_Status[j], 0));
- j = IdleGetStatusIndex((WORD)(DBGetContactSettingWord(NULL, IDLEMOD, IDL_AASTATUS, 0)));
+ j = IdleGetStatusIndex((WORD)(db_get_w(NULL, IDLEMOD, IDL_AASTATUS, 0)));
SendDlgItemMessage(hwndDlg, IDC_AASTATUS, CB_SETCURSEL, j, 0);
SendMessage(hwndDlg, WM_USER+2, 0, 0);
return TRUE;
@@ -393,23 +393,23 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (hdr && hdr->code == PSN_APPLY) {
int method = IsDlgButtonChecked(hwndDlg, IDC_IDLEONWINDOWS) == BST_CHECKED;
int mins = SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_GETPOS, 0, 0);
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLETIME1ST, (BYTE)(HIWORD(mins) == 0 ? LOWORD(mins) : 10));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_USERIDLECHECK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLESHORT) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLEMETHOD, (BYTE)(method ? 0 : 1));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLEONSAVER, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCREENSAVER) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLEONFULLSCR, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FULLSCREEN) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLEONLOCK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLEONTSDC, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLETERMINAL) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLEPRIVATE, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLEPRIVATE) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_AAENABLE, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_AASHORTIDLE) == BST_CHECKED?1:0));
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLESTATUSLOCK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLESTATUSLOCK) == BST_CHECKED?1:0));
+ db_set_b(NULL, IDLEMOD, IDL_IDLETIME1ST, (BYTE)(HIWORD(mins) == 0 ? LOWORD(mins) : 10));
+ db_set_b(NULL, IDLEMOD, IDL_USERIDLECHECK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLESHORT) == BST_CHECKED));
+ db_set_b(NULL, IDLEMOD, IDL_IDLEMETHOD, (BYTE)(method ? 0 : 1));
+ db_set_b(NULL, IDLEMOD, IDL_IDLEONSAVER, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCREENSAVER) == BST_CHECKED));
+ db_set_b(NULL, IDLEMOD, IDL_IDLEONFULLSCR, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FULLSCREEN) == BST_CHECKED));
+ db_set_b(NULL, IDLEMOD, IDL_IDLEONLOCK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED));
+ db_set_b(NULL, IDLEMOD, IDL_IDLEONTSDC, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLETERMINAL) == BST_CHECKED));
+ db_set_b(NULL, IDLEMOD, IDL_IDLEPRIVATE, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLEPRIVATE) == BST_CHECKED));
+ db_set_b(NULL, IDLEMOD, IDL_AAENABLE, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_AASHORTIDLE) == BST_CHECKED?1:0));
+ db_set_b(NULL, IDLEMOD, IDL_IDLESTATUSLOCK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLESTATUSLOCK) == BST_CHECKED?1:0));
{
int curSel = SendDlgItemMessage(hwndDlg, IDC_AASTATUS, CB_GETCURSEL, 0, 0);
if (curSel != CB_ERR) {
- DBWriteContactSettingWord(NULL, IDLEMOD, IDL_AASTATUS, (WORD)(aa_Status[curSel]));
+ db_set_w(NULL, IDLEMOD, IDL_AASTATUS, (WORD)(aa_Status[curSel]));
}
}
- DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLESOUNDSOFF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLESOUNDSOFF) == BST_CHECKED));
+ db_set_b(NULL, IDLEMOD, IDL_IDLESOUNDSOFF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLESOUNDSOFF) == BST_CHECKED));
// destroy any current idle and reset settings.
IdleObject_Destroy(&gIdleObject);
IdleObject_Create(&gIdleObject);
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index ee2b0550dc..086510461a 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -113,10 +113,10 @@ void ReloadGlobals() if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWFORMAT, SRMSGDEFSET_SHOWFORMAT))
g_dat.flags |= SMF_SHOWFORMAT;
- g_dat.openFlags = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
+ g_dat.openFlags = db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
g_dat.nFlashMax = db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT);
- g_dat.msgTimeout = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
+ g_dat.msgTimeout = db_get_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
if (g_dat.msgTimeout < SRMSGSET_MSGTIMEOUT_MIN) g_dat.msgTimeout = SRMSGDEFSET_MSGTIMEOUT;
}
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 74029cd726..4ffeaf5467 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -655,10 +655,10 @@ static void NotifyTyping(struct SrmmWindowData *dat, int mode) if (protoStatus < ID_STATUS_ONLINE)
return;
- if (protoCaps & PF1_VISLIST && DBGetContactSettingWord(dat->hContact, dat->szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
+ if (protoCaps & PF1_VISLIST && db_get_w(dat->hContact, dat->szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
return;
- if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && DBGetContactSettingWord(dat->hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
+ if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(dat->hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
return;
if ( !(g_dat.flags & SMF_TYPINGUNKNOWN) && db_get_b(dat->hContact, "CList", "NotOnList", 0))
@@ -722,14 +722,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_MESSAGE));
// avatar stuff
- dat->limitAvatarH = db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT)?DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT):0;
+ dat->limitAvatarH = db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT)?db_get_dw(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT):0;
if (dat->hContact && dat->szProto != NULL)
- dat->wStatus = DBGetContactSettingWord(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
else
dat->wStatus = ID_STATUS_OFFLINE;
dat->wOldStatus = dat->wStatus;
- dat->splitterPos = (int) DBGetContactSettingDword(db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT)?dat->hContact:NULL, SRMMMOD, "splitterPos", (DWORD) - 1);
+ dat->splitterPos = (int) db_get_dw(db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT)?dat->hContact:NULL, SRMMMOD, "splitterPos", (DWORD) - 1);
dat->cmdList = List_Create(0, 20);
dat->cmdListInd = -1;
dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF;
@@ -789,7 +789,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
HANDLE hPrevEvent;
DBEVENTINFO dbei = { sizeof(dbei) };
- for (int i = DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i--; ) {
+ for (int i = db_get_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i--; ) {
if (dat->hDbEventFirst == NULL)
hPrevEvent = db_event_last(dat->hContact);
else
@@ -812,7 +812,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else
db_event_get( dat->hDbEventFirst, &dbei);
- DWORD firstTime = dbei.timestamp - 60 * DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
+ DWORD firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
for (;;) {
HANDLE hPrevEvent;
if (dat->hDbEventFirst == NULL)
@@ -851,7 +851,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP //restore saved msg if any...
if (dat->hContact) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(dat->hContact, SRMSGMOD, DBSAVEDMSG, &dbv)) {
+ if ( !db_get_ts(dat->hContact, SRMSGMOD, DBSAVEDMSG, &dbv)) {
if (dbv.ptszVal[0]) {
SetDlgItemText(hwndDlg, IDC_MESSAGE, dbv.ptszVal);
EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
@@ -1003,7 +1003,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP Window_FreeIcon_IcoLib(hwndDlg);
if (dat->szProto) {
- wStatus = DBGetContactSettingWord(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) LoadSkinnedProtoIconBig(dat->szProto, wStatus));
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadSkinnedProtoIcon(dat->szProto, wStatus));
break;
@@ -1071,7 +1071,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->hBkgBrush)
DeleteObject(dat->hBkgBrush);
{
- COLORREF colour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ COLORREF colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
dat->hBkgBrush = CreateSolidBrush(colour);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETBKGNDCOLOR, 0, colour);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETBKGNDCOLOR, 0, colour);
@@ -1082,7 +1082,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_AVATARS)
{
dat->limitAvatarH = db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT) ?
- DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT) : 0;
+ db_get_dw(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT) : 0;
}
if ( !wParam) SendMessage(hwndDlg, DM_GETAVATAR, 0, 0);
}
@@ -1136,7 +1136,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR buf[128] = _T("");
int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON);
- dat->wStatus = DBGetContactSettingWord(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
contactName = ( TCHAR* )CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) dat->hContact, GCDNF_TCHAR);
if (strcmp(dat->szProto, "MetaContacts")) {
@@ -1162,7 +1162,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else
SetDlgItemText(hwndDlg, IDC_NAME, contactName);
- szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dat->szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), GSMDF_TCHAR);
+ szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), GSMDF_TCHAR);
if (statusIcon)
mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s - %s"), contactName, TranslateTS(pszNewTitleEnd));
else
@@ -1494,10 +1494,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP HICON hIcon;
int dwStatus;
- dwStatus = DBGetContactSettingWord(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ dwStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
hIcon = LoadSkinnedProtoIcon(dat->szProto, dwStatus);
if (hIcon) {
- if (DBGetContactSettingDword(dat->hContact, dat->szProto, "IdleTS", 0)) {
+ if (db_get_dw(dat->hContact, dat->szProto, "IdleTS", 0)) {
HIMAGELIST hImageList;
hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0);
@@ -1813,9 +1813,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP msg = (TCHAR*)alloca(sizeof(TCHAR) * len);
GetDlgItemText(hwndDlg, IDC_MESSAGE, msg, len);
if (msg[0])
- DBWriteContactSettingTString(dat->hContact, SRMSGMOD, DBSAVEDMSG, msg);
+ db_set_ts(dat->hContact, SRMSGMOD, DBSAVEDMSG, msg);
else
- DBDeleteContactSetting(dat->hContact, SRMSGMOD, DBSAVEDMSG);
+ db_unset(dat->hContact, SRMSGMOD, DBSAVEDMSG);
}
KillTimer(hwndDlg, TIMERID_TYPE);
if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
@@ -1827,7 +1827,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DestroyWindow(dat->hwndStatus);
tcmdlist_free(dat->cmdList);
WindowList_Remove(g_dat.hMessageWindowList, hwndDlg);
- DBWriteContactSettingDword(db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT)?dat->hContact:NULL, SRMMMOD, "splitterPos", dat->splitterPos);
+ db_set_dw(db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT)?dat->hContact:NULL, SRMMMOD, "splitterPos", dat->splitterPos);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_UNSUBCLASSED, 0, 0);
{
HFONT hFont = (HFONT) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
@@ -1845,11 +1845,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wp.length = sizeof(wp);
GetWindowPlacement(hwndDlg, &wp);
if ( !dat->windowWasCascaded) {
- DBWriteContactSettingDword(hContact, SRMMMOD, "x", wp.rcNormalPosition.left);
- DBWriteContactSettingDword(hContact, SRMMMOD, "y", wp.rcNormalPosition.top);
+ db_set_dw(hContact, SRMMMOD, "x", wp.rcNormalPosition.left);
+ db_set_dw(hContact, SRMMMOD, "y", wp.rcNormalPosition.top);
}
- DBWriteContactSettingDword(hContact, SRMMMOD, "width", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- DBWriteContactSettingDword(hContact, SRMMMOD, "height", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
+ db_set_dw(hContact, SRMMMOD, "width", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
+ db_set_dw(hContact, SRMMMOD, "height", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
}
NotifyLocalWinEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE);
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 6dc9aad95e..fec3d93737 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -588,7 +588,7 @@ void LoadMsgLogIcons(void) int rtfHeaderSize;
PBYTE pBmpBits;
- hBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
+ hBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
bih.biSize = sizeof(bih);
bih.biBitCount = 24;
bih.biCompression = BI_RGB;
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index b92bc17027..fc74d0ec0d 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -62,7 +62,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) if (colour) {
mir_snprintf(str, SIZEOF(str), "SRMFont%dCol", i);
- *colour = DBGetContactSettingDword(NULL, SRMMMOD, str, fontOptionsList[i].defColour);
+ *colour = db_get_dw(NULL, SRMMMOD, str, fontOptionsList[i].defColour);
}
if (lf) {
mir_snprintf(str, SIZEOF(str), "SRMFont%dSize", i);
@@ -83,7 +83,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) mir_snprintf(str, SIZEOF(str), "SRMFont%d", i);
DBVARIANT dbv;
- if ( DBGetContactSettingTString(NULL, SRMMMOD, str, &dbv))
+ if ( db_get_ts(NULL, SRMMMOD, str, &dbv))
_tcscpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
else {
lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
@@ -191,7 +191,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, SIZEOF(statusValues), DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, SIZEOF(statusValues), db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
CheckDlgButton(hwndDlg, IDC_DONOTSTEALFOCUS, db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS));
SetDlgItemInt(hwndDlg, IDC_NFLASHES, db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT), FALSE);
CheckDlgButton(hwndDlg, IDC_SHOWBUTTONLINE, g_dat.flags&SMF_SHOWBTNS);
@@ -206,7 +206,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat.flags&SMF_AVATAR);
CheckDlgButton(hwndDlg, IDC_LIMITAVATARH, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT));
- avatarHeight = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT);
+ avatarHeight = db_get_dw(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT);
SetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, avatarHeight, FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITAVATARH), IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
if (!IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT))
@@ -216,7 +216,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_CHARCOUNT, db_get_b(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, SRMSGDEFSET_CHARCOUNT));
CheckDlgButton(hwndDlg, IDC_CTRLSUPPORT, db_get_b(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, SRMSGDEFSET_CTRLSUPPORT));
CheckDlgButton(hwndDlg, IDC_DELTEMP, db_get_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP));
- msgTimeout = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
+ msgTimeout = db_get_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
SetDlgItemInt(hwndDlg, IDC_SECONDS, msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout / 1000 : SRMSGDEFSET_MSGTIMEOUT / 1000, FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CASCADE), !IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
EnableWindow(GetDlgItem(hwndDlg, IDC_CTRLSUPPORT), !IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
@@ -286,32 +286,32 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
DWORD avatarHeight, msgTimeout;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DONOTSTEALFOCUS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWBUTTONLINE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWINFOLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOLINE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CASCADE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN));
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH));
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DONOTSTEALFOCUS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWBUTTONLINE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOLINE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CASCADE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN));
+
+ db_set_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH));
avatarHeight = GetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, NULL, TRUE);
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, avatarHeight<=0?SRMSGDEFSET_AVHEIGHT:avatarHeight);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, avatarHeight<=0?SRMSGDEFSET_AVHEIGHT:avatarHeight);
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSENDBTN));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CHARCOUNT));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CTRLSUPPORT));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, (BYTE) GetDlgItemInt(hwndDlg, IDC_NFLASHES, NULL, TRUE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SENDBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSENDBTN));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CHARCOUNT));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CTRLSUPPORT));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, (BYTE) GetDlgItemInt(hwndDlg, IDC_NFLASHES, NULL, TRUE));
msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) * 1000;
if (msgTimeout < SRMSGSET_MSGTIMEOUT_MIN) msgTimeout = SRMSGDEFSET_MSGTIMEOUT;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
ReloadGlobals();
WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
@@ -351,9 +351,9 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT));
+ SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT));
SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(12 * 60, 0));
- SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME));
+ SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME));
CheckDlgButton(hwndDlg, IDC_SHOWLOGICONS, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS));
CheckDlgButton(hwndDlg, IDC_SHOWNAMES, !db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES));
@@ -397,20 +397,20 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME))
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
else
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSECS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSCHANGES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWFORMAT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWFORMATTING));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
+ db_set_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWSECS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSECS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSCHANGES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWFORMAT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWFORMATTING));
FreeMsgLogIcons();
LoadMsgLogIcons();
@@ -469,16 +469,16 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) HANDLE hContact, hItem;
if (hItemNew) {
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemNew, 0) ? 1 : 0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemNew, 0) ? 1 : 0));
}
if (hItemUnknown) {
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 1 : 0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 1 : 0));
}
hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem) {
- DBWriteContactSettingByte(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0));
+ db_set_b(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0));
}
} while (hContact = db_find_next(hContact));
}
@@ -566,10 +566,10 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam case PSN_APPLY:
{
SaveList(hwndDlg, hItemNew, hItemUnknown);
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
ReloadGlobals();
WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
}
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 7079ff4b65..61ed781665 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -28,8 +28,9 @@ const CLSID IID_IRichEditOle = { 0x00020D00, 0x00, 0x00, { 0xC0, 0x00, 0x00, 0x0 const CLSID IID_IRichEditOleCallback = { 0x00020D03, 0x00, 0x00, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
#endif
-HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
-HANDLE hHookWinEvt, hHookWinPopup, hMsgMenuItem;
+HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
+HANDLE hHookWinEvt, hHookWinPopup;
+HGENMENU hMsgMenuItem;
static int SRMMStatusToPf2(int status)
{
@@ -347,19 +348,16 @@ static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam;
if ( hContact ) {
+ bool bEnabled = false;
char* szProto = GetContactProto(hContact);
-
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN;
-
if ( szProto ) {
// leave this menu item hidden for chats
if ( !db_get_b( hContact, szProto, "ChatRoom", 0 ))
if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND )
- clmi.flags &= ~CMIF_HIDDEN;
+ bEnabled = true;
}
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMsgMenuItem, ( LPARAM )&clmi );
+ Menu_ShowItem(hMsgMenuItem, bEnabled);
}
return 0;
}
diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index e13aa9172f..6dc1017b8f 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -125,7 +125,7 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) { char buff[256];
HWND hwnd;
sprintf(buff, "SRMMStatusIconFlags%d", sid->dwId);
- DBWriteContactSettingByte(hContact, sid->szModule, buff, (BYTE)sid->flags);
+ db_set_b(hContact, sid->szModule, buff, (BYTE)sid->flags);
if (hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact)) {
PostMessage(hwnd, DM_STATUSICONCHANGE, 0, 0);
}
diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp index 68818744b4..945cdefabe 100644 --- a/src/core/stdurl/url.cpp +++ b/src/core/stdurl/url.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE hUrlWindowList = NULL;
static HANDLE hEventContactSettingChange = NULL;
static HANDLE hContactDeleted = NULL;
-static HANDLE hSRUrlMenuItem = NULL;
+static HGENMENU hSRUrlMenuItem = NULL;
INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -108,15 +108,13 @@ static int ContactSettingChanged(WPARAM wParam, LPARAM lParam) static int SRUrlPreBuildMenu(WPARAM wParam, LPARAM)
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
+ bool bEnabled = false;
char *szProto = GetContactProto((HANDLE)wParam);
if (szProto != NULL)
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_URLSEND)
- mi.flags = CMIM_FLAGS;
+ bEnabled = true;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hSRUrlMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hSRUrlMenuItem, bEnabled);
return 0;
}
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index b824c20618..8cdb93ba51 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -64,7 +64,7 @@ static void sttUpdateTitle(HWND hwndDlg, HANDLE hContact) else
SetDlgItemText(hwndDlg, IDC_NAME, contactName);
- szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
+ szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s %s (%s)"), pszNewTitleStart, contactName, szStatus);
}
}
@@ -119,7 +119,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
// From message dlg
- if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0);
@@ -217,7 +217,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP acs.szProto = 0;
CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
}
- if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) {
+ if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
}
break;
@@ -488,7 +488,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP mir_subclassWindow( GetWindow(GetDlgItem(hwndDlg, IDC_URLS), GW_CHILD), SendEditSubclassProc);
// From message dlg
- if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0);
@@ -612,7 +612,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP acs.szProto = 0;
CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
- if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
}
break;
diff --git a/src/core/stduserinfo/contactinfo.cpp b/src/core/stduserinfo/contactinfo.cpp index 993d8de838..21fcb7a203 100644 --- a/src/core/stduserinfo/contactinfo.cpp +++ b/src/core/stduserinfo/contactinfo.cpp @@ -271,13 +271,13 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.iItem = 0;
for (i = -1;; i++) {
if (i == -1) {
- if (DBGetContactSettingTString(hContact, szProto, "e-mail", &dbv))
+ if (db_get_ts(hContact, szProto, "e-mail", &dbv))
continue;
lvi.pszText = TranslateT("Primary");
}
else {
mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", i);
- if (DBGetContactSettingTString(hContact, szProto, idstr, &dbv))
+ if (db_get_ts(hContact, szProto, idstr, &dbv))
break;
lvi.pszText = idstr2;
@@ -285,20 +285,20 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
lvi.iSubItem = 0;
for (i=0;;i++) {
lvi.lParam = i;
mir_snprintf(idstr, SIZEOF(idstr), "Mye-mail%d", i);
- if (DBGetContactSettingTString(hContact, "UserInfo", idstr, &dbv))
+ if (db_get_ts(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText = idstr2;
mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"), i+1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
lvi.mask = LVIF_PARAM;
@@ -310,21 +310,21 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.lParam = (LPARAM)(-1);
lvi.iSubItem = 0;
lvi.iItem = 0;
- if ( !DBGetContactSettingTString(hContact, szProto, "Phone", &dbv)) {
+ if ( !db_get_ts(hContact, szProto, "Phone", &dbv)) {
lvi.pszText = TranslateT("Primary");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
- if ( !DBGetContactSettingTString(hContact, szProto, "Fax", &dbv)) {
+ if ( !db_get_ts(hContact, szProto, "Fax", &dbv)) {
lvi.pszText = TranslateT("Fax");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
- if ( !DBGetContactSettingTString(hContact, szProto, "Cellular", &dbv)) {
+ if ( !db_get_ts(hContact, szProto, "Cellular", &dbv)) {
lvi.pszText = TranslateT("Mobile");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
if (lstrlenA(dbv.pszVal)>4 && !lstrcmpA(dbv.pszVal+lstrlenA(dbv.pszVal)-4, " SMS")) {
@@ -332,28 +332,28 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dbv.ptszVal[lstrlen(dbv.ptszVal)-4] = '\0';
}
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
- if ( !DBGetContactSettingTString(hContact, szProto, "CompanyPhone", &dbv)) {
+ if ( !db_get_ts(hContact, szProto, "CompanyPhone", &dbv)) {
lvi.pszText = TranslateT("Work Phone");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
- if ( !DBGetContactSettingTString(hContact, szProto, "CompanyFax", &dbv)) {
+ if ( !db_get_ts(hContact, szProto, "CompanyFax", &dbv)) {
lvi.pszText = TranslateT("Work Fax");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
lvi.iSubItem = 0;
for (i=0;; i++) {
lvi.lParam = i;
mir_snprintf(idstr, SIZEOF(idstr), "MyPhone%d", i);
- if (DBGetContactSettingTString(hContact, "UserInfo", idstr, &dbv))
+ if (db_get_ts(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText = idstr2;
mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"), i+1);
@@ -363,7 +363,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dbv.ptszVal[lstrlen(dbv.ptszVal)-4] = '\0';
}
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
lvi.mask = LVIF_PARAM;
@@ -464,10 +464,10 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
for (int i=0;; i++) {
mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
- if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
- DBFreeVariant(&dbv);
+ if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
+ db_free(&dbv);
}
- DBWriteContactSettingString(hContact, "UserInfo", idstr, szNewData);
+ db_set_s(hContact, "UserInfo", idstr, szNewData);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
}
@@ -477,13 +477,13 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBVARIANT dbv;
for (i = lvi.lParam;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i+1);
- if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
+ if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
- DBWriteContactSettingString(hContact, "UserInfo", idstr, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, "UserInfo", idstr, dbv.pszVal);
+ db_free(&dbv);
}
mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
- DBDeleteContactSetting(hContact, "UserInfo", idstr);
+ db_unset(hContact, "UserInfo", idstr);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
else if (hti.iSubItem-2 == (nm->hdr.idFrom == IDC_PHONES)) {
@@ -491,12 +491,12 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP char szText[256], idstr[33];
DBVARIANT dbv;
mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, lvi.lParam);
- if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
+ if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
lstrcpynA(szText, dbv.pszVal, SIZEOF(szText));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szText))
break;
- DBWriteContactSettingString(hContact, "UserInfo", idstr, szText);
+ db_set_s(hContact, "UserInfo", idstr, szText);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
}
diff --git a/src/core/stduserinfo/stdinfo.cpp b/src/core/stduserinfo/stdinfo.cpp index 41f394cbba..033cb23cac 100644 --- a/src/core/stduserinfo/stdinfo.cpp +++ b/src/core/stduserinfo/stdinfo.cpp @@ -114,7 +114,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, if (wSave == (WORD)-1) {
char szSettingName[100];
mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sName", szSetting);
- if ( !DBGetContactSettingTString(hContact, szModule, szSettingName, &dbv)) {
+ if ( !db_get_ts(hContact, szModule, szSettingName, &dbv)) {
ptstr = dbv.ptszVal;
unspecified = false;
break;
@@ -179,7 +179,7 @@ LBL_Exit: if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -410,38 +410,38 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Past%d", i);
if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
- ( !proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
+ ( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Past%dText", i);
- if (DBGetContactSettingTString(hContact, szProto, idstr, &dbvText))
- {if (proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); break;}
+ if (db_get_ts(hContact, szProto, idstr, &dbvText))
+ {if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;}
lvi.pszText = dbv.ptszVal;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PAST), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PAST), lvi.iItem, 1, dbvText.ptszVal);
- DBFreeVariant(&dbvText);
+ db_free(&dbvText);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%d", i);
if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
- ( !proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
+ ( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%dText", i);
- if (DBGetContactSettingTString(hContact, szProto, idstr, &dbvText))
- {if (proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); break;}
+ if (db_get_ts(hContact, szProto, idstr, &dbvText))
+ {if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;}
lvi.pszText = dbv.ptszVal;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PAST), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PAST), lvi.iItem, 1, dbvText.ptszVal);
- DBFreeVariant(&dbvText);
+ db_free(&dbvText);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
@@ -455,19 +455,19 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dCat", i);
if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
- ( !proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
+ ( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dText", i);
- if (DBGetContactSettingTString(hContact, szProto, idstr, &dbvText))
- {if (proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); break;}
+ if (db_get_ts(hContact, szProto, idstr, &dbvText))
+ {if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;}
lvi.pszText = dbv.ptszVal;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_INTERESTS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_INTERESTS), lvi.iItem, 1, dbvText.ptszVal);
- DBFreeVariant(&dbvText);
+ db_free(&dbvText);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
lvi.iItem++;
}
ResizeColumns(GetDlgItem(hwndDlg, IDC_INTERESTS));
@@ -521,9 +521,9 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM) hFont, MAKELPARAM(TRUE, 0));
- if ( !DBGetContactSettingString((HANDLE)lParam, "UserInfo", "MyNotes", &dbv)) {
+ if ( !db_get_s((HANDLE)lParam, "UserInfo", "MyNotes", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_MYNOTES, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
SendDlgItemMessage(hwndDlg, IDC_MYNOTES, EM_LIMITTEXT, 2048, 0);
@@ -547,9 +547,9 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MYNOTES))) {
char text[2048];
GetDlgItemTextA(hwndDlg, IDC_MYNOTES, text, SIZEOF(text));
- DBWriteContactSettingString(hContact, "UserInfo", "MyNotes", text);
+ db_set_s(hContact, "UserInfo", "MyNotes", text);
}
- else DBDeleteContactSetting(hContact, "UserInfo", "MyNotes");
+ else db_unset(hContact, "UserInfo", "MyNotes");
break;
}
}
diff --git a/src/core/stduserinfo/userinfo.cpp b/src/core/stduserinfo/userinfo.cpp index edee081064..d9bf4050b3 100644 --- a/src/core/stduserinfo/userinfo.cpp +++ b/src/core/stduserinfo/userinfo.cpp @@ -274,7 +274,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP LPTSTR ptszLastTab;
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "UserInfo", "LastTab", &dbv)) {
+ if ( !db_get_ts(NULL, "UserInfo", "LastTab", &dbv)) {
ptszLastTab = NEWTSTR_ALLOCA(dbv.ptszVal);
db_free(&dbv);
}
@@ -594,7 +594,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP tvi.pszText = name;
tvi.cchTextMax = SIZEOF(name);
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_PAGETREE), &tvi);
- DBWriteContactSettingTString(NULL, "UserInfo", "LastTab", name);
+ db_set_ts(NULL, "UserInfo", "LastTab", name);
Window_FreeIcon_IcoLib(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_NAME, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDC_WHITERECT, WM_GETFONT, 0, 0), 0);
diff --git a/src/core/stduseronline/useronline.cpp b/src/core/stduseronline/useronline.cpp index 390be3051a..2d367053af 100644 --- a/src/core/stduseronline/useronline.cpp +++ b/src/core/stduseronline/useronline.cpp @@ -37,17 +37,17 @@ static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) return 0;
int newStatus = cws->value.wVal;
- int oldStatus = DBGetContactSettingWord((HANDLE)wParam, "UserOnline", "OldStatus", ID_STATUS_OFFLINE);
- DBWriteContactSettingWord((HANDLE)wParam, "UserOnline", "OldStatus", (WORD)newStatus);
+ int oldStatus = db_get_w((HANDLE)wParam, "UserOnline", "OldStatus", ID_STATUS_OFFLINE);
+ db_set_w((HANDLE)wParam, "UserOnline", "OldStatus", (WORD)newStatus);
if (CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_USERONLINE)) return 0;
- if (DBGetContactSettingByte((HANDLE)wParam, "CList", "Hidden", 0)) return 0;
+ if (db_get_b((HANDLE)wParam, "CList", "Hidden", 0)) return 0;
if (newStatus == ID_STATUS_OFFLINE && oldStatus != ID_STATUS_OFFLINE) {
// Remove the event from the queue if it exists since they are now offline
- int lastEvent = (int)DBGetContactSettingDword((HANDLE)wParam, "UserOnline", "LastEvent", 0);
+ int lastEvent = (int)db_get_dw((HANDLE)wParam, "UserOnline", "LastEvent", 0);
if (lastEvent) {
CallService(MS_CLIST_REMOVEEVENT, wParam, (LPARAM)lastEvent);
- DBWriteContactSettingDword((HANDLE)wParam, "UserOnline", "LastEvent", 0);
+ db_set_dw((HANDLE)wParam, "UserOnline", "LastEvent", 0);
}
}
if ((newStatus == ID_STATUS_ONLINE || newStatus == ID_STATUS_FREECHAT) &&
@@ -70,7 +70,7 @@ static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) cle.ptszTooltip = tooltip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
IcoLib_ReleaseIcon(cle.hIcon, 0);
- DBWriteContactSettingDword(cle.hContact, "UserOnline", "LastEvent", (DWORD)cle.hDbEvent);
+ db_set_dw(cle.hContact, "UserOnline", "LastEvent", (DWORD)cle.hDbEvent);
SkinPlaySound("UserOnline");
}
}
diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index 30875f70fc..b6ff5cb2c3 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -91,7 +91,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp char idstr[4];
int id;
_itoa(groupId, idstr, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv)) break;
+ if (db_get_ts(NULL, "CListGroups", idstr, &dbv)) break;
id = SendDlgItemMessage(hdlg, IDC_GROUP, CB_ADDSTRING, 0, (LPARAM)(dbv.ptszVal+1));
SendDlgItemMessage(hdlg, IDC_GROUP, CB_SETITEMDATA , id, groupId+1);
db_free(&dbv);
@@ -180,7 +180,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)hContact, item);
}
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
if (IsDlgButtonChecked(hdlg, IDC_ADDED))
CallContactService(hContact, PSS_ADDED, 0, 0);
diff --git a/src/modules/clist/Docking.cpp b/src/modules/clist/Docking.cpp index 40e147ee1a..323ca4829d 100644 --- a/src/modules/clist/Docking.cpp +++ b/src/modules/clist/Docking.cpp @@ -156,9 +156,9 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) }
else
{
- DBDeleteContactSetting(NULL, "CList", "Docked");
- DBDeleteContactSetting(NULL, "CList", "DockX");
- DBDeleteContactSetting(NULL, "CList", "DockY");
+ db_unset(NULL, "CList", "Docked");
+ db_unset(NULL, "CList", "DockX");
+ db_unset(NULL, "CList", "DockY");
}
}
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index b81523c3af..33e0c49989 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -188,7 +188,7 @@ static int ClcIconsChanged(WPARAM, LPARAM) static INT_PTR SetInfoTipHoverTime(WPARAM wParam, LPARAM)
{
- DBWriteContactSettingWord(NULL, "CLC", "InfoTipHoverTime", (WORD) wParam);
+ db_set_w(NULL, "CLC", "InfoTipHoverTime", (WORD) wParam);
cli.pfnClcBroadcast(INTM_SETINFOTIPHOVERTIME, wParam, 0);
return 0;
}
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index d4b8e83a4e..f2e6dac894 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -228,7 +228,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd if (szProto != NULL)
status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
+ if (db_get_ts(hContact, "CList", "Group", &dbv))
group = &dat->list;
else {
group = cli.pfnAddGroup(hwnd, dat, dbv.ptszVal, (DWORD) - 1, 0, 0);
@@ -322,7 +322,7 @@ void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem) int i, nameOffset;
if ( !IsHContactContact(hItem))
return;
- if (DBGetContactSettingTString(hItem, "CList", "Group", &dbv))
+ if (db_get_ts(hItem, "CList", "Group", &dbv))
return;
//decrease member counts of all parent groups too
@@ -374,7 +374,7 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) hContact = db_find_first();
while (hContact) {
if (style & CLS_SHOWHIDDEN || !db_get_b(hContact, "CList", "Hidden", 0)) {
- if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
+ if (db_get_ts(hContact, "CList", "Group", &dbv))
group = &dat->list;
else {
group = cli.pfnAddGroup(hwnd, dat, dbv.ptszVal, (DWORD) - 1, 0, 0);
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index b4873b9d03..4de2705787 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -428,7 +428,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save) cli.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
TCHAR* otherName = cli.pfnGetContactDisplayName(contact->hContact, GCDNF_NOMYHANDLE);
if ( !text[0] || !lstrcmp(otherName, text))
- DBDeleteContactSetting(contact->hContact, "CList", "MyHandle");
+ db_unset(contact->hContact, "CList", "MyHandle");
else
db_set_ts(contact->hContact, "CList", "MyHandle", text);
mir_free(otherName);
@@ -697,7 +697,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) cli.pfnGetDefaultFontSetting(i, lf, colour);
mir_snprintf(idstr, SIZEOF(idstr), "Font%dName", i);
- if ( !DBGetContactSettingTString(NULL, "CLC", idstr, &dbv)) {
+ if ( !db_get_ts(NULL, "CLC", idstr, &dbv)) {
lstrcpy(lf->lfFaceName, dbv.ptszVal);
mir_free(dbv.pszVal);
}
@@ -763,7 +763,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->hBmpBackground = NULL;
}
if (db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- if ( !DBGetContactSettingString(NULL, "CLC", "BkBitmap", &dbv)) {
+ if ( !db_get_s(NULL, "CLC", "BkBitmap", &dbv)) {
dat->hBmpBackground = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM) dbv.pszVal);
mir_free(dbv.pszVal);
}
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index 2039e7ca7f..edabd41796 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -633,7 +633,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) Proto_SetStatus(pa->szModuleName, cli.currentDesiredStatusMode);
}
NotifyEventHooks(hStatusModeChangeEvent, cli.currentDesiredStatusMode, 0);
- DBWriteContactSettingWord(NULL, "CList", "Status", (WORD)cli.currentDesiredStatusMode);
+ db_set_w(NULL, "CList", "Status", (WORD)cli.currentDesiredStatusMode);
return 1;
}
}
@@ -830,7 +830,7 @@ int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos) _itoa(Pos, buf, 10);
DBVARIANT dbv;
- if ( !DBGetContactSettingString(NULL, "Protocols", buf, &dbv)) {
+ if ( !db_get_s(NULL, "Protocols", buf, &dbv)) {
for (int p=0; p < protoCnt; p++) {
if (lstrcmpA(proto[p]->szName, dbv.pszVal) == 0) {
db_free(&dbv);
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 8a2188ce69..606d8e6864 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -68,7 +68,7 @@ void fnCheckCacheItem(ClcCacheEntry *p) {
DBVARIANT dbv;
if (p->tszGroup == NULL) {
- if ( !DBGetContactSettingTString(p->hContact, "CList", "Group", &dbv)) {
+ if ( !db_get_ts(p->hContact, "CList", "Group", &dbv)) {
p->tszGroup = mir_tstrdup(dbv.ptszVal);
mir_free(dbv.ptszVal);
}
@@ -237,7 +237,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) return 0;
dbv.pszVal = NULL;
- if ( !DBGetContactSetting(hContact, "Protocol", "p", &dbv)) {
+ if ( !db_get(hContact, "Protocol", "p", &dbv)) {
if ( !strcmp(cws->szModule, dbv.pszVal)) {
cli.pfnInvalidateDisplayNameCacheEntry(hContact);
if ( !strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName")
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 6373b1a193..2bb5356a60 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -271,7 +271,7 @@ int fnTrayIconInit(HWND hwnd) if (trayIconSetting == SETTING_TRAYICON_SINGLE) {
DBVARIANT dbv = { DBVT_DELETED };
char *szProto;
- if ( !DBGetContactSettingString(NULL, "CList", "PrimaryStatus", &dbv)
+ if ( !db_get_s(NULL, "CList", "PrimaryStatus", &dbv)
&& (averageMode < 0 || db_get_b(NULL, "CList", "AlwaysPrimary", 0)))
szProto = dbv.pszVal;
else
@@ -535,7 +535,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) {
DBVARIANT dbv = { DBVT_DELETED };
char *szProto;
- if (DBGetContactSettingString(NULL, "CList", "PrimaryStatus", &dbv))
+ if (db_get_s(NULL, "CList", "PrimaryStatus", &dbv))
szProto = NULL;
else
szProto = dbv.pszVal;
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index ab38b19c07..f99841a069 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -301,7 +301,7 @@ int LoadCLUIModule(void) wndclass.hIconSm = LoadSkinIcon(SKINICON_OTHER_MIRANDA);
RegisterClassEx(&wndclass);
- if (DBGetContactSettingTString(NULL, "CList", "TitleText", &dbv))
+ if (db_get_ts(NULL, "CList", "TitleText", &dbv))
lstrcpyn(titleText, _T(MIRANDANAME), SIZEOF(titleText));
else {
lstrcpyn(titleText, dbv.ptszVal, SIZEOF(titleText));
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index 01e60c94fc..209f8fc052 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -163,7 +163,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam) CallService(MS_CLUI_CONTACTDELETED, wParam, 0);
if ((HANDLE) lParam == NULL)
- DBDeleteContactSetting((HANDLE)wParam, "CList", "Group");
+ db_unset((HANDLE)wParam, "CList", "Group");
else {
grpChg.pszNewName = cli.pfnGetGroupName(lParam, NULL);
db_set_ts((HANDLE)wParam, "CList", "Group", grpChg.pszNewName);
diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index bcc2b6091a..d15bbd5e6c 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -49,9 +49,9 @@ static int GetDatabaseString(CONTACTINFO *ci, const char* setting, DBVARIANT* db }
if (ci->dwFlag & CNF_UNICODE)
- return DBGetContactSettingWString(ci->hContact, ci->szProto, setting, dbv);
+ return db_get_ws(ci->hContact, ci->szProto, setting, dbv);
- return DBGetContactSettingString(ci->hContact, ci->szProto, setting, dbv);
+ return db_get_s(ci->hContact, ci->szProto, setting, dbv);
}
static int ProcessDatabaseValueDefault(CONTACTINFO *ci, const char* setting)
@@ -70,7 +70,7 @@ static int ProcessDatabaseValueDefault(CONTACTINFO *ci, const char* setting) db_free(&dbv);
}
- if (DBGetContactSetting(ci->hContact, ci->szProto, setting, &dbv))
+ if (db_get(ci->hContact, ci->szProto, setting, &dbv))
return 1;
switch (dbv.type) {
@@ -146,7 +146,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { if ( !GetDatabaseString(ci, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv))
return 0;
- if ( !DBGetContactSetting(ci->hContact, ci->szProto, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv)) {
+ if ( !db_get(ci->hContact, ci->szProto, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv)) {
if (dbv.type == DBVT_WORD) {
int i, countryCount;
struct CountryListEntry *countries;
@@ -513,7 +513,7 @@ int LoadContactsModule(void) nameOrder[i] = i;
DBVARIANT dbv;
- if ( !DBGetContactSetting(NULL, "Contact", "NameOrder", &dbv)) {
+ if ( !db_get(NULL, "Contact", "NameOrder", &dbv)) {
CopyMemory(nameOrder, dbv.pbVal, dbv.cpbVal);
db_free(&dbv);
}
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 1ccb2da031..b7df40afcb 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -930,7 +930,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para // mi.pszName
mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName);
- if ( !DBGetContactSettingTString(NULL, MenuNameItems, DBString, &dbv)) {
+ if ( !db_get_ts(NULL, MenuNameItems, DBString, &dbv)) {
if (_tcslen(dbv.ptszVal) > 0)
replaceStrT(pmi->CustomName, dbv.ptszVal);
db_free(&dbv);
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 3922e42533..7aea8fe0c6 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -114,7 +114,7 @@ static int SaveTree(HWND hwndDlg) if (lstrcmp(iod->name, iod->defname) != 0)
db_set_ts(NULL, MenuNameItems, DBString, iod->name);
else
- DBDeleteContactSetting(NULL, MenuNameItems, DBString);
+ db_unset(NULL, MenuNameItems, DBString);
runtimepos += 100;
}
@@ -264,7 +264,7 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) DBVARIANT dbv;
mir_snprintf(buf, SIZEOF(buf), "%s_name", menuItemName);
- if ( !DBGetContactSettingTString(NULL, MenuNameItems, buf, &dbv)) {
+ if ( !db_get_ts(NULL, MenuNameItems, buf, &dbv)) {
PD->name = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index 7a289603c2..eb221ae5c7 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -37,7 +37,7 @@ static int CountGroups(void) for (i=0;; i++) {
_itoa(i, str, 10);
- if (DBGetContactSetting(NULL, "CListGroups", str, &dbv))
+ if (db_get(NULL, "CListGroups", str, &dbv))
break;
db_free(&dbv);
}
@@ -54,7 +54,7 @@ static int GroupNameExists(const TCHAR *name, int skipGroup) if (i == skipGroup)
continue;
_itoa(i, idstr, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
if ( !_tcscmp(dbv.ptszVal + 1, name)) {
db_free(&dbv);
@@ -76,7 +76,7 @@ static INT_PTR CreateGroup(WPARAM wParam, LPARAM lParam) const TCHAR* grpName = lParam ? (TCHAR*)lParam : TranslateT("New Group");
if (wParam) {
_itoa(wParam - 1, str, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
+ if (db_get_ts(NULL, "CListGroups", str, &dbv))
return 0;
mir_sntprintf(newBaseName, SIZEOF(newBaseName), _T("%s\\%s"), dbv.ptszVal + 1, grpName);
@@ -116,7 +116,7 @@ static INT_PTR GetGroupName2(WPARAM wParam, LPARAM lParam) static char name[128];
_itoa(wParam - 1, idstr, 10);
- if (DBGetContactSettingString(NULL, "CListGroups", idstr, &dbv))
+ if (db_get_s(NULL, "CListGroups", idstr, &dbv))
return (INT_PTR) (char *) NULL;
lstrcpynA(name, dbv.pszVal + 1, SIZEOF(name));
if ((DWORD *) lParam != NULL)
@@ -132,7 +132,7 @@ TCHAR* fnGetGroupName(int idx, DWORD* pdwFlags) static TCHAR name[128];
_itoa(idx-1, idstr, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
return NULL;
lstrcpyn(name, dbv.ptszVal + 1, SIZEOF(name));
@@ -161,7 +161,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) //get the name
_itoa(wParam - 1, str, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
+ if (db_get_ts(NULL, "CListGroups", str, &dbv))
return 1;
lstrcpyn(name, dbv.ptszVal + 1, SIZEOF(name));
db_free(&dbv);
@@ -188,7 +188,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) hContact;
hContact = db_find_next(hContact))
{
- if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
+ if (db_get_ts(hContact, "CList", "Group", &dbv))
continue;
if (_tcscmp(dbv.ptszVal, name))
@@ -205,7 +205,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) }
else
{
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
grpChg.pszNewName = NULL;
}
NotifyEventHooks(hGroupChangeEvent, (WPARAM)hContact, (LPARAM)&grpChg);
@@ -213,14 +213,14 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) //shuffle list of groups up to fill gap
for (i = wParam - 1;; i++) {
_itoa(i + 1, str, 10);
- if (DBGetContactSettingStringUtf(NULL, "CListGroups", str, &dbv))
+ if (db_get_utf(NULL, "CListGroups", str, &dbv))
break;
_itoa(i, str, 10);
- DBWriteContactSettingStringUtf(NULL, "CListGroups", str, dbv.pszVal);
+ db_set_utf(NULL, "CListGroups", str, dbv.pszVal);
db_free(&dbv);
}
_itoa(i, str, 10);
- DBDeleteContactSetting(NULL, "CListGroups", str);
+ db_unset(NULL, "CListGroups", str);
//rename subgroups
{
TCHAR szNewName[256];
@@ -229,7 +229,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) len = lstrlen(name);
for (i=0;; i++) {
_itoa(i, str, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
+ if (db_get_ts(NULL, "CListGroups", str, &dbv))
break;
if ( !_tcsncmp(dbv.ptszVal + 1, name, len) && dbv.pszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
if (szNewParent[0])
@@ -265,7 +265,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) //do the change
_itoa(groupId, idstr, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
return 1;
str[0] = dbv.pszVal[0] & 0x7F;
lstrcpyn(oldName, dbv.ptszVal + 1, SIZEOF(oldName));
@@ -295,7 +295,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) if (i == groupId)
continue;
_itoa(i, idstr, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
if ( !_tcsncmp(dbv.ptszVal + 1, oldName, len) && dbv.ptszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szName, dbv.ptszVal + len + 2);
@@ -316,7 +316,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) *pszLastBackslash = '\0';
for (i=0;; i++) {
_itoa(i, idstr, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
if ( !lstrcmp(dbv.ptszVal + 1, str)) {
if (i < groupId)
@@ -354,13 +354,13 @@ static INT_PTR SetGroupExpandedState(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
_itoa(wParam - 1, idstr, 10);
- if (DBGetContactSettingStringUtf(NULL, "CListGroups", idstr, &dbv))
+ if (db_get_utf(NULL, "CListGroups", idstr, &dbv))
return 1;
if (lParam)
dbv.pszVal[0] |= GROUPF_EXPANDED;
else
dbv.pszVal[0] = dbv.pszVal[0] & ~GROUPF_EXPANDED;
- DBWriteContactSettingStringUtf(NULL, "CListGroups", idstr, dbv.pszVal);
+ db_set_utf(NULL, "CListGroups", idstr, dbv.pszVal);
db_free(&dbv);
return 0;
}
@@ -372,12 +372,12 @@ static INT_PTR SetGroupFlags(WPARAM wParam, LPARAM lParam) int flags, oldval, newval;
_itoa(wParam - 1, idstr, 10);
- if (DBGetContactSettingStringUtf(NULL, "CListGroups", idstr, &dbv))
+ if (db_get_utf(NULL, "CListGroups", idstr, &dbv))
return 1;
flags = LOWORD(lParam) & HIWORD(lParam);
oldval = dbv.pszVal[0];
newval = dbv.pszVal[0] = ((oldval & ~HIWORD(lParam)) | flags) & 0x7f;
- DBWriteContactSettingStringUtf(NULL, "CListGroups", idstr, dbv.pszVal);
+ db_set_utf(NULL, "CListGroups", idstr, dbv.pszVal);
db_free(&dbv);
if ((oldval & GROUPF_HIDEOFFLINE) != (newval & GROUPF_HIDEOFFLINE))
cli.pfnLoadContactTree();
@@ -394,7 +394,7 @@ static INT_PTR MoveGroupBefore(WPARAM wParam, LPARAM lParam) if (wParam == 0 || (LPARAM) wParam == lParam)
return 0;
_itoa(wParam - 1, str, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
+ if (db_get_ts(NULL, "CListGroups", str, &dbv))
return 0;
szMoveName = dbv.ptszVal;
//shuffle list of groups up to fill gap
@@ -418,24 +418,24 @@ static INT_PTR MoveGroupBefore(WPARAM wParam, LPARAM lParam) if (shuffleDir == -1) {
for (i = shuffleFrom; i != shuffleTo; i++) {
_itoa(i + 1, str, 10);
- if (DBGetContactSettingStringUtf(NULL, "CListGroups", str, &dbv)) {
+ if (db_get_utf(NULL, "CListGroups", str, &dbv)) {
shuffleTo = i;
break;
}
_itoa(i, str, 10);
- DBWriteContactSettingStringUtf(NULL, "CListGroups", str, dbv.pszVal);
+ db_set_utf(NULL, "CListGroups", str, dbv.pszVal);
db_free(&dbv);
}
}
else {
for (i = shuffleFrom; i != shuffleTo; i--) {
_itoa(i - 1, str, 10);
- if (DBGetContactSettingStringUtf(NULL, "CListGroups", str, &dbv)) {
+ if (db_get_utf(NULL, "CListGroups", str, &dbv)) {
mir_free(szMoveName);
return 1;
} //never happens
_itoa(i, str, 10);
- DBWriteContactSettingStringUtf(NULL, "CListGroups", str, dbv.pszVal);
+ db_set_utf(NULL, "CListGroups", str, dbv.pszVal);
db_free(&dbv);
}
}
@@ -456,13 +456,13 @@ static INT_PTR BuildGroupMenu(WPARAM, LPARAM) int menuId, compareResult, menuItemCount;
MENUITEMINFO mii = { 0 };
- if (DBGetContactSettingStringUtf(NULL, "CListGroups", "0", &dbv))
+ if (db_get_utf(NULL, "CListGroups", "0", &dbv))
return (INT_PTR) (HMENU) NULL;
db_free(&dbv);
hRootMenu = CreateMenu();
for (groupId = 0;; groupId++) {
_itoa(groupId, idstr, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
pNextField = dbv.ptszVal + 1;
@@ -547,12 +547,12 @@ int InitGroupServices(void) _itoa(i, str, 10);
DBVARIANT dbv;
- if (DBGetContactSettingStringUtf(NULL, "CListGroups", str, &dbv))
+ if (db_get_utf(NULL, "CListGroups", str, &dbv))
break;
if (dbv.pszVal[0] & 0x80)
{
dbv.pszVal[0] &= 0x7f;
- DBWriteContactSettingStringUtf(NULL, "CListGroups", str, dbv.pszVal);
+ db_set_utf(NULL, "CListGroups", str, dbv.pszVal);
}
db_free(&dbv);
}
diff --git a/src/modules/clist/keyboard.cpp b/src/modules/clist/keyboard.cpp index 2ac34532c1..93b9c1226e 100644 --- a/src/modules/clist/keyboard.cpp +++ b/src/modules/clist/keyboard.cpp @@ -34,7 +34,7 @@ static INT_PTR hkHideShow(WPARAM, LPARAM) INT_PTR hkSearch(WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingString(NULL, "CList", "SearchUrl", &dbv)) {
+ if ( !db_get_s(NULL, "CList", "SearchUrl", &dbv)) {
CallService(MS_UTILS_OPENURL, db_get_b(NULL, "CList", "HKSearchNewWnd", 0), (LPARAM)dbv.pszVal);
db_free(&dbv);
}
diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index fe5b43e933..b661c90c55 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -114,7 +114,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) _itoa(i, intname, 10);
DBVARIANT dbv;
- if (DBGetContactSettingTString(NULL, "CListGroups", intname, &dbv))
+ if (db_get_ts(NULL, "CListGroups", intname, &dbv))
break;
if (dbv.ptszVal[0])
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index 442bd35567..a23726f133 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -322,7 +322,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf break;
case 'w':
case 'W':
- DBWriteContactSettingWord(NULL, szSection, szName, (WORD)strtol(szValue+1, NULL, 0));
+ db_set_w(NULL, szSection, szName, (WORD)strtol(szValue+1, NULL, 0));
break;
case 'd':
case 'D':
@@ -330,7 +330,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf break;
case 'l':
case 'L':
- DBDeleteContactSetting(NULL, szSection, szName);
+ db_unset(NULL, szSection, szName);
break;
case 'e':
case 'E':
@@ -357,7 +357,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf }
case 'u':
case 'U':
- DBWriteContactSettingStringUtf(NULL, szSection, szName, szValue+1);
+ db_set_utf(NULL, szSection, szName, szValue+1);
break;
case 'n':
case 'h':
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index 9f70e1abec..4e88e1fcce 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -229,7 +229,7 @@ static INT_PTR DbDeleteModule(WPARAM, LPARAM lParam) CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces);
for (int i = vars.getCount()-1; i >= 0; i--) {
- DBDeleteContactSetting(NULL, (char*)lParam, vars[i]);
+ db_unset(NULL, (char*)lParam, vars[i]);
mir_free(vars[i]);
}
vars.destroy();
diff --git a/src/modules/extraicons/DefaultExtraIcons.cpp b/src/modules/extraicons/DefaultExtraIcons.cpp index e14ed64fc0..590d21c715 100644 --- a/src/modules/extraicons/DefaultExtraIcons.cpp +++ b/src/modules/extraicons/DefaultExtraIcons.cpp @@ -164,7 +164,7 @@ static void SetExtraIcons(HANDLE hContact) break;
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, p.db[j] == NULL ? proto : p.db[j], p.db[j+1], &dbv)) {
+ if (!db_get_s(hContact, p.db[j] == NULL ? proto : p.db[j], p.db[j+1], &dbv)) {
if (!IsEmpty(dbv.pszVal)) {
p.SetIcon(hContact, &p, dbv.pszVal);
show = true;
@@ -241,7 +241,7 @@ static int DefaultOnClick(WPARAM wParam, LPARAM lParam, LPARAM param) break;
DBVARIANT dbv;
- if ( !DBGetContactSettingString(hContact, p->db[j] == NULL ? proto : p->db[j], p->db[j+1], &dbv)) {
+ if ( !db_get_s(hContact, p->db[j] == NULL ? proto : p->db[j], p->db[j+1], &dbv)) {
if (!IsEmpty(dbv.pszVal)) {
p->OnClick(p, dbv.pszVal);
found = true;
diff --git a/src/modules/extraicons/ExtraIconGroup.cpp b/src/modules/extraicons/ExtraIconGroup.cpp index 2c95e2820b..5da0f4f9b3 100644 --- a/src/modules/extraicons/ExtraIconGroup.cpp +++ b/src/modules/extraicons/ExtraIconGroup.cpp @@ -94,7 +94,7 @@ void ExtraIconGroup::setSlot(int slot) ExtraIcon * ExtraIconGroup::getCurrentItem(HANDLE hContact) const
{
- int id = (int)DBGetContactSettingDword(hContact, MODULE_NAME, name.c_str(), 0);
+ int id = (int)db_get_dw(hContact, MODULE_NAME, name.c_str(), 0);
if (id < 1)
return NULL;
diff --git a/src/modules/extraicons/IcolibExtraIcon.cpp b/src/modules/extraicons/IcolibExtraIcon.cpp index d361e2074b..dc20e94572 100644 --- a/src/modules/extraicons/IcolibExtraIcon.cpp +++ b/src/modules/extraicons/IcolibExtraIcon.cpp @@ -56,7 +56,7 @@ void IcolibExtraIcon::applyIcon(HANDLE hContact) HANDLE hImage = INVALID_HANDLE_VALUE;
DBVARIANT dbv;
- if ( !DBGetContactSettingString(hContact, MODULE_NAME, name.c_str(), &dbv)) {
+ if ( !db_get_s(hContact, MODULE_NAME, name.c_str(), &dbv)) {
if (!IsEmpty(dbv.pszVal))
hImage = GetIcon(dbv.pszVal);
@@ -76,7 +76,7 @@ int IcolibExtraIcon::setIcon(int id, HANDLE hContact, HANDLE hIcoLib) if ( isEnabled()) {
DBVARIANT dbv;
- if ( !DBGetContactSettingString(hContact, MODULE_NAME, name.c_str(), &dbv)) {
+ if ( !db_get_s(hContact, MODULE_NAME, name.c_str(), &dbv)) {
if (!IsEmpty(dbv.pszVal))
RemoveIcon(dbv.pszVal);
@@ -104,7 +104,7 @@ int IcolibExtraIcon::setIconByName(int id, HANDLE hContact, const char *icon) if ( isEnabled()) {
DBVARIANT dbv;
- if ( !DBGetContactSettingString(hContact, MODULE_NAME, name.c_str(), &dbv)) {
+ if ( !db_get_s(hContact, MODULE_NAME, name.c_str(), &dbv)) {
if (!IsEmpty(dbv.pszVal))
RemoveIcon(dbv.pszVal);
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp index 80187be9af..24cec55b7f 100644 --- a/src/modules/extraicons/extraicons.cpp +++ b/src/modules/extraicons/extraicons.cpp @@ -157,7 +157,7 @@ static void LoadGroups(vector<ExtraIconGroup *> &groups) mir_snprintf(setting, SIZEOF(setting), "%d_%d", i, j);
DBVARIANT dbv;
- if (!DBGetContactSettingString(NULL, MODULE_NAME "Groups", setting, &dbv)) {
+ if (!db_get_s(NULL, MODULE_NAME "Groups", setting, &dbv)) {
if (!IsEmpty(dbv.pszVal)) {
BaseExtraIcon *extra = GetExtraIconByName(dbv.pszVal);
if (extra != NULL) {
diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp index 65866ae24b..99d5f8c91d 100644 --- a/src/modules/extraicons/options_ei.cpp +++ b/src/modules/extraicons/options_ei.cpp @@ -541,20 +541,20 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP char setting[512];
mir_snprintf(setting, SIZEOF(setting), "Position_%s", extra->getName());
- DBWriteContactSettingWord(NULL, MODULE_NAME, setting, extra->getPosition());
+ db_set_w(NULL, MODULE_NAME, setting, extra->getPosition());
mir_snprintf(setting, SIZEOF(setting), "Slot_%s", extra->getName());
- DBWriteContactSettingWord(NULL, MODULE_NAME, setting, extra->getSlot());
+ db_set_w(NULL, MODULE_NAME, setting, extra->getSlot());
}
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM) MODULE_NAME "Groups");
- DBWriteContactSettingWord(NULL, MODULE_NAME "Groups", "Count", (WORD)groups.size());
+ db_set_w(NULL, MODULE_NAME "Groups", "Count", (WORD)groups.size());
for (i = 0; i < groups.size(); i++) {
ExtraIconGroup *group = groups[i];
char setting[512];
mir_snprintf(setting, SIZEOF(setting), "%d_count", i);
- DBWriteContactSettingWord(NULL, MODULE_NAME "Groups", setting, (WORD)group->items.size());
+ db_set_w(NULL, MODULE_NAME "Groups", setting, (WORD)group->items.size());
for (unsigned int j = 0; j < group->items.size(); j++) {
BaseExtraIcon *extra = group->items[j];
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 98197ddaf4..91a53c8ffd 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -343,7 +343,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR *szProto = NULL;
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "FindAdd", "LastSearched", &dbv)){
+ if ( !db_get_ts(NULL, "FindAdd", "LastSearched", &dbv)){
szProto = NEWTSTR_ALLOCA(dbv.ptszVal);
db_free(&dbv); /* free string szProto was fetched with */
}
diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index e93d4d9048..1efff177d4 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -51,7 +51,7 @@ void SaveColumnSizes(HWND hwndResults) db_set_b(NULL, "FindAdd", szSetting, (BYTE)columnOrder[i]);
if (i>=columnCount) continue;
mir_snprintf(szSetting, SIZEOF(szSetting), "ColWidth%d", i);
- DBWriteContactSettingWord(NULL, "FindAdd", szSetting, (WORD)ListView_GetColumnWidth(hwndResults, i));
+ db_set_w(NULL, "FindAdd", szSetting, (WORD)ListView_GetColumnWidth(hwndResults, i));
}
db_set_b(NULL, "FindAdd", "SortColumn", (BYTE)dat->iLastColumnSortIndex);
db_set_b(NULL, "FindAdd", "SortAscending", (BYTE)dat->bSortAscending);
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 4e33c31cc1..beb9f5f3ee 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -567,10 +567,10 @@ static void sttSaveFontData(HWND hwndDlg, FontInternal &F) db_set_dw(NULL, F.dbSettingsGroup, str, F.value.colour);
if (F.flags & FIDF_NOAS) {
mir_snprintf(str, SIZEOF(str), "%sAs", F.prefix);
- DBWriteContactSettingWord(NULL, F.dbSettingsGroup, str, (WORD)0x00FF);
+ db_set_w(NULL, F.dbSettingsGroup, str, (WORD)0x00FF);
}
mir_snprintf(str, SIZEOF(str), "%sFlags", F.prefix);
- DBWriteContactSettingWord(NULL, F.dbSettingsGroup, str, (WORD)F.flags);
+ db_set_w(NULL, F.dbSettingsGroup, str, (WORD)F.flags);
}
static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index d016317f25..d9cbd1a964 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -144,7 +144,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR if (flags & FIDF_APPENDNAME) mir_snprintf(idstr, SIZEOF(idstr), "%sName", prefix);
else mir_snprintf(idstr, SIZEOF(idstr), "%s", prefix);
- if ( !DBGetContactSettingTString(NULL, settings_group, idstr, &dbv)) {
+ if ( !db_get_ts(NULL, settings_group, idstr, &dbv)) {
_tcscpy(lf->lfFaceName, dbv.ptszVal);
db_free(&dbv);
}
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index 51b443197d..f5e7484df2 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -679,7 +679,7 @@ HICON IconItem_GetIcon(IcolibItem* item, bool big) big = big && !item->cx;
IconSourceItem* &source = big ? item->source_big : item->source_small;
- if ( !source && !DBGetContactSettingTString(NULL, "SkinIcons", item->name, &dbv)) {
+ if ( !source && !db_get_ts(NULL, "SkinIcons", item->name, &dbv)) {
TCHAR tszFullPath[MAX_PATH];
PathToAbsoluteT(dbv.ptszVal, tszFullPath);
int cx = item->cx ? item->cx : GetSystemMetrics(big ? SM_CXICON : SM_CXSMICON);
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 107149f087..94f024ba81 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -940,7 +940,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM for (int indx = 0; indx < iconList.getCount(); indx++) {
IcolibItem *item = iconList[indx];
if (item->temp_reset) {
- DBDeleteContactSetting(NULL, "SkinIcons", item->name);
+ db_unset(NULL, "SkinIcons", item->name);
if (item->source_small != item->default_icon) {
IconSourceItem_Release(&item->source_small);
}
diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index ba049b80c3..e77f0e6321 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -304,7 +304,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem) SaveItemMask( GetDlgItem(hwndDlg, IDC_LIST), hContact, hItem, "Mask1");
if (SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0))
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
else
db_set_b(hContact, "CList", "Hidden", 1);
}
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index 5758824627..f3ba8e0e12 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -103,8 +103,8 @@ void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs) static INT_PTR GetNetlibUserSettingInt(const char *szUserModule, const char *szSetting, int defValue)
{
DBVARIANT dbv;
- if (DBGetContactSetting(NULL, szUserModule, szSetting, &dbv)
- && DBGetContactSetting(NULL, "Netlib", szSetting, &dbv))
+ if (db_get(NULL, szUserModule, szSetting, &dbv)
+ && db_get(NULL, "Netlib", szSetting, &dbv))
return defValue;
if (dbv.type == DBVT_BYTE) return dbv.bVal;
if (dbv.type == DBVT_WORD) return dbv.wVal;
@@ -114,8 +114,8 @@ static INT_PTR GetNetlibUserSettingInt(const char *szUserModule, const char *szS static char *GetNetlibUserSettingString(const char *szUserModule, const char *szSetting, int decode)
{
DBVARIANT dbv;
- if (DBGetContactSettingString(NULL, szUserModule, szSetting, &dbv)
- && DBGetContactSettingString(NULL, "Netlib", szSetting, &dbv)) {
+ if (db_get_s(NULL, szUserModule, szSetting, &dbv)
+ && db_get_s(NULL, "Netlib", szSetting, &dbv)) {
return NULL;
}
else {
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 76331b51e3..b8567a494f 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -90,7 +90,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa CheckDlgButton(hwndDlg, IDC_SHOWTHISDLGATSTART, db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0)?BST_CHECKED:BST_UNCHECKED);
{
DBVARIANT dbv;
- if ( !DBGetContactSettingString(NULL, "Netlib", "RunAtStart", &dbv)) {
+ if ( !db_get_s(NULL, "Netlib", "RunAtStart", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_RUNATSTART, dbv.pszVal);
db_free(&dbv);
}
@@ -563,7 +563,7 @@ void NetlibLogInit(void) logOptions.toFile = db_get_b(NULL, "Netlib", "ToFile", 0);
logOptions.toLog = db_get_dw(NULL, "Netlib", "NLlog", 1);
- if ( !DBGetContactSettingTString(NULL, "Netlib", "File", &dbv)) {
+ if ( !db_get_ts(NULL, "Netlib", "File", &dbv)) {
logOptions.szUserFile = mir_tstrdup(dbv.ptszVal);
TCHAR path[MAX_PATH];
@@ -587,7 +587,7 @@ void NetlibLogInit(void) if (db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0))
NetlibLogShowOptions();
- if ( !DBGetContactSettingTString(NULL, "Netlib", "RunAtStart", &dbv)) {
+ if ( !db_get_ts(NULL, "Netlib", "RunAtStart", &dbv)) {
STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi;
si.cb = sizeof(si);
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index 49be304e5b..b165f55156 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -201,7 +201,7 @@ static void WriteSettingsStructToDb(const char *szSettingsModule, NETLIBUSERSETT db_set_b(NULL, szSettingsModule, "NLUseProxy", (BYTE)settings->useProxy);
db_set_b(NULL, szSettingsModule, "NLProxyType", (BYTE)settings->proxyType);
db_set_s(NULL, szSettingsModule, "NLProxyServer", settings->szProxyServer?settings->szProxyServer:"");
- DBWriteContactSettingWord(NULL, szSettingsModule, "NLProxyPort", (WORD)settings->wProxyPort);
+ db_set_w(NULL, szSettingsModule, "NLProxyPort", (WORD)settings->wProxyPort);
db_set_b(NULL, szSettingsModule, "NLUseProxyAuth", (BYTE)settings->useProxyAuth);
db_set_s(NULL, szSettingsModule, "NLProxyAuthUser", settings->szProxyAuthUser?settings->szProxyAuthUser:"");
lstrcpynA(szEncodedPassword, settings->szProxyAuthPassword?settings->szProxyAuthPassword:"", SIZEOF(szEncodedPassword));
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 7c49a8c973..881258106e 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -687,13 +687,13 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L dat->currentPage = -1;
if (ood->pszPage == NULL) {
- if ( !DBGetContactSettingTString(NULL, "Options", "LastPage", &dbv)) {
+ if ( !db_get_ts(NULL, "Options", "LastPage", &dbv)) {
lastPage = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
if (ood->pszGroup == NULL) {
- if ( !DBGetContactSettingTString(NULL, "Options", "LastGroup", &dbv)) {
+ if ( !db_get_ts(NULL, "Options", "LastGroup", &dbv)) {
lastGroup = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -706,7 +706,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L }
if (ood->pszTab == NULL) {
- if ( !DBGetContactSettingTString(NULL, "Options", "LastTab", &dbv)) {
+ if ( !db_get_ts(NULL, "Options", "LastTab", &dbv)) {
lastTab = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -1192,17 +1192,17 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L if (opd->ptszTab)
db_set_ts(NULL, "Options", "LastTab", opd->ptszTab);
else
- DBDeleteContactSetting(NULL, "Options", "LastTab");
+ db_unset(NULL, "Options", "LastTab");
if (opd->ptszGroup)
db_set_ts(NULL, "Options", "LastGroup", opd->ptszGroup);
else
- DBDeleteContactSetting(NULL, "Options", "LastGroup");
+ db_unset(NULL, "Options", "LastGroup");
db_set_ts(NULL, "Options", "LastPage", opd->ptszTitle);
}
else {
- DBDeleteContactSetting(NULL, "Options", "LastTab");
- DBDeleteContactSetting(NULL, "Options", "LastGroup");
- DBDeleteContactSetting(NULL, "Options", "LastPage");
+ db_unset(NULL, "Options", "LastTab");
+ db_unset(NULL, "Options", "LastGroup");
+ db_unset(NULL, "Options", "LastPage");
}
Utils_SaveWindowPosition(hdlg, NULL, "Options", "");
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index ae487ea866..72f78988c3 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -44,7 +44,7 @@ LIST<PROTOACCOUNT> accounts(10, CompareAccounts); static int EnumDbModules(const char *szModuleName, DWORD ofsModuleName, LPARAM lParam)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingString(NULL, szModuleName, "AM_BaseProto", &dbv)) {
+ if ( !db_get_s(NULL, szModuleName, "AM_BaseProto", &dbv)) {
if ( !Proto_GetAccount(szModuleName)) {
PROTOACCOUNT* pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
pa->cbSize = sizeof(*pa);
@@ -70,7 +70,7 @@ void LoadDbAccounts(void) for (i=0; i < count; i++) {
char buf[10];
_itoa(i, buf, 10);
- if (DBGetContactSettingString(NULL, "Protocols", buf, &dbv))
+ if (db_get_s(NULL, "Protocols", buf, &dbv))
continue;
PROTOACCOUNT* pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
@@ -91,7 +91,7 @@ void LoadDbAccounts(void) if (ver >= 4) {
db_free(&dbv);
_itoa(OFFSET_NAME+i, buf, 10);
- if ( !DBGetContactSettingTString(NULL, "Protocols", buf, &dbv)) {
+ if ( !db_get_ts(NULL, "Protocols", buf, &dbv)) {
pa->tszAccountName = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -99,7 +99,7 @@ void LoadDbAccounts(void) _itoa(OFFSET_ENABLED+i, buf, 10);
pa->bIsEnabled = db_get_dw(NULL, "Protocols", buf, 1);
- if ( !DBGetContactSettingString(NULL, pa->szModuleName, "AM_BaseProto", &dbv)) {
+ if ( !db_get_s(NULL, pa->szModuleName, "AM_BaseProto", &dbv)) {
pa->szProtoName = mir_strdup(dbv.pszVal);
db_free(&dbv);
}
@@ -163,7 +163,7 @@ void WriteDbAccounts() if (param.arrlen) {
int i;
for (i=0; i < param.arrlen; i++) {
- DBDeleteContactSetting(0, "Protocols", param.pszSettingName[i]);
+ db_unset(0, "Protocols", param.pszSettingName[i]);
mir_free(param.pszSettingName[i]);
}
mir_free(param.pszSettingName);
@@ -190,7 +190,7 @@ void WriteDbAccounts() db_set_ts(NULL, "Protocols", buf, pa->tszAccountName);
}
- DBDeleteContactSetting(0, "Protocols", "ProtoCount");
+ db_unset(0, "Protocols", "ProtoCount");
db_set_dw(0, "Protocols", "ProtoCount", accounts.getCount());
db_set_dw(0, "Protocols", "PrVer", 4);
}
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index 4eec5c28b1..90e9ac6df6 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -174,7 +174,7 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam for (;;) {
DBVARIANT dbv;
mir_snprintf(buf, SIZEOF(buf), "%s_%d", pa->szProtoName, count++);
- if (DBGetContactSettingString(NULL, buf, "AM_BaseProto", &dbv))
+ if (db_get_s(NULL, buf, "AM_BaseProto", &dbv))
break;
db_free(&dbv);
}
diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index ed6a4bd40b..07c31fdc91 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -319,7 +319,7 @@ static void sttOptionsSaveItem(THotkeyItem *item) item->type = item->OptType;
item->Enabled = item->OptEnabled;
- DBWriteContactSettingWord(NULL, DBMODULENAME, item->pszName, item->Hotkey);
+ db_set_w(NULL, DBMODULENAME, item->pszName, item->Hotkey);
db_set_b(NULL, DBMODULENAME "Off", item->pszName, (BYTE)!item->Enabled);
if (item->type != HKT_MANUAL)
db_set_b(NULL, DBMODULENAME "Types", item->pszName, (BYTE)item->type);
@@ -332,7 +332,7 @@ static void sttOptionsSaveItem(THotkeyItem *item) subItem->type = subItem->OptType;
mir_snprintf(buf, SIZEOF(buf), "%s$%d", item->pszName, item->nSubHotkeys);
- DBWriteContactSettingWord(NULL, DBMODULENAME, buf, subItem->Hotkey);
+ db_set_w(NULL, DBMODULENAME, buf, subItem->Hotkey);
if (subItem->type != HKT_MANUAL)
db_set_b(NULL, DBMODULENAME "Types", buf, (BYTE)subItem->type);
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index d7635de2d5..4da60bfbb8 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -375,13 +375,13 @@ int LoadSkinHotkeys(void) WORD key;
if ((key = db_get_w(NULL, "Clist", szSetting, 0))) {
- DBDeleteContactSetting(NULL, "Clist", szSetting);
- DBWriteContactSettingWord(NULL, DBMODULENAME, newSettings[i], key);
+ db_unset(NULL, "Clist", szSetting);
+ db_set_w(NULL, DBMODULENAME, newSettings[i], key);
}
mir_snprintf(szSetting, SIZEOF(szSetting), "HKEn%s", oldSettings[i]);
if ((key = db_get_b(NULL, "Clist", szSetting, 0))) {
- DBDeleteContactSetting(NULL, "Clist", szSetting);
+ db_unset(NULL, "Clist", szSetting);
db_set_b(NULL, DBMODULENAME "Off", newSettings[i], (BYTE)(key == 0));
}
}
diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index cd959b877a..d2f602be45 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -380,13 +380,13 @@ static void convertOneProtocol(char *moduleName, char *iconName) _itoa(statusIcons[i].id, pm, 10);
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv)) {
+ if ( !db_get_ts(NULL, "Icons", moduleName, &dbv)) {
_itoa(i, pi, 10);
db_set_ts(NULL, "SkinIcons", iconName, dbv.ptszVal);
db_free(&dbv);
- DBDeleteContactSetting(NULL, "Icons", moduleName);
+ db_unset(NULL, "Icons", moduleName);
} } }
static INT_PTR sttLoadSkinIcon(WPARAM wParam, LPARAM lParam)
@@ -422,7 +422,7 @@ int LoadSkinIcons(void) for (i=0; i < SIZEOF(mainIcons); i++) {
_itoa(mainIcons[i].id, moduleName, 10);
- if (DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv))
+ if (db_get_ts(NULL, "Icons", moduleName, &dbv))
break;
mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i);
@@ -430,7 +430,7 @@ int LoadSkinIcons(void) db_set_ts(NULL, "SkinIcons", iconName, dbv.ptszVal);
db_free(&dbv);
- DBDeleteContactSetting(NULL, "Icons", moduleName);
+ db_unset(NULL, "Icons", moduleName);
}
for (;;) {
@@ -438,10 +438,10 @@ int LoadSkinIcons(void) moduleName[0] = 'p';
moduleName[1] = 0;
_itoa(j++, moduleName+1, 100);
- if (DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv))
+ if (db_get_ts(NULL, "Icons", moduleName, &dbv))
break;
- DBDeleteContactSetting(NULL, "Icons", moduleName);
+ db_unset(NULL, "Icons", moduleName);
// make old skinicons' prefix
mir_snprintf(moduleName, SIZEOF(moduleName), "%S", dbv.ptszVal);
diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index 614c99f1f4..aba9154f15 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -93,7 +93,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM wParam, LPARAM lParam) if (ptszDefaultFile) {
DBVARIANT dbv;
- if (DBGetContactSettingString(NULL, "SkinSounds", item->name, &dbv))
+ if (db_get_s(NULL, "SkinSounds", item->name, &dbv))
db_set_ts(NULL, "SkinSounds", item->name, ptszDefaultFile);
else
db_free(&dbv);
@@ -139,7 +139,7 @@ static INT_PTR ServiceSkinPlaySound(WPARAM, LPARAM lParam) return 1;
DBVARIANT dbv;
- if ( DBGetContactSettingTString(NULL, "SkinSounds", pszSoundName, &dbv) == 0) {
+ if ( db_get_ts(NULL, "SkinSounds", pszSoundName, &dbv) == 0) {
ServiceSkinPlaySoundFile(0, (LPARAM)dbv.ptszVal);
db_free(&dbv);
return 0;
@@ -261,7 +261,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM NotifyEventHooks(hPlayEvent, 1, (LPARAM)arSounds[tvi.lParam].ptszTempFile);
else {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
+ if ( !db_get_ts(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
TCHAR szPathFull[MAX_PATH];
PathToAbsoluteT(dbv.ptszVal, szPathFull);
NotifyEventHooks(hPlayEvent, 1, (LPARAM)szPathFull);
@@ -292,7 +292,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM else {
if (db_get_b(NULL, "SkinSoundsOff", snd.name, 0) == 0) {
DBVARIANT dbv;
- if (DBGetContactSettingTString(NULL, "SkinSounds", snd.name, &dbv) == 0) {
+ if (db_get_ts(NULL, "SkinSounds", snd.name, &dbv) == 0) {
PathToAbsoluteT(dbv.ptszVal, strdir);
db_free(&dbv);
} } }
@@ -394,7 +394,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_LOCATION, arSounds[tvi.lParam].ptszTempFile);
else {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
+ if ( !db_get_ts(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
SetDlgItemText(hwndDlg, IDC_LOCATION, dbv.ptszVal);
db_free(&dbv);
}
diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index 764169f268..70590c8ebf 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -56,7 +56,7 @@ static void OpenURLThread(void *arg) // check user defined browser for opening urls
DBVARIANT dbv;
- if (!DBGetContactSettingTString(NULL, "Miranda", "OpenUrlBrowser", &dbv)) {
+ if (!db_get_ts(NULL, "Miranda", "OpenUrlBrowser", &dbv)) {
ShellExecute(NULL, _T("open"), dbv.ptszVal, szResult, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
db_free(&dbv);
}
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index 75fad634e8..40c591a1e4 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -70,7 +70,7 @@ TCHAR *GetContactID(HANDLE hContact) char *szProto = GetContactProto(hContact);
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)) {
theValue = (TCHAR *)mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
return theValue;
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index a22dd4ef26..8bcd80f4ac 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -199,7 +199,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ;
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
+ if ( !db_get_ts(hContact, "UserInfo", "TzName", &dbv))
{
HANDLE res = timeapiGetInfoByName(dbv.ptszVal, dwFlags);
db_free(&dbv);
@@ -210,7 +210,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) if (timezone == -1)
{
char* szProto = GetContactProto(hContact);
- if ( !DBGetContactSettingTString(hContact, szProto, "TzName", &dbv))
+ if ( !db_get_ts(hContact, szProto, "TzName", &dbv))
{
HANDLE res = timeapiGetInfoByName(dbv.ptszVal, dwFlags);
db_free(&dbv);
@@ -265,8 +265,8 @@ static void timeapiSetInfoByContact(HANDLE hContact, HANDLE hTZ) }
else
{
- DBDeleteContactSetting(hContact, "UserInfo", "TzName");
- DBDeleteContactSetting(hContact, "UserInfo", "Timezone");
+ db_unset(hContact, "UserInfo", "TzName");
+ db_unset(hContact, "UserInfo", "Timezone");
}
}
@@ -391,7 +391,7 @@ static int timeapiSelectListItem(HANDLE hContact, HWND hWnd, DWORD dwFlags) if (hContact)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
+ if ( !db_get_ts(hContact, "UserInfo", "TzName", &dbv))
{
unsigned hash = mir_hashstrT(dbv.ptszVal);
for (int i=0; i < g_timezonesBias.getCount(); i++)
|