diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-07 19:47:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-07 19:47:13 +0000 |
commit | 097c52ad9a2928422084bf76cebee58958341574 (patch) | |
tree | 26d6b11e9738fc4e854f68c0ff04eaadf7d849e8 | |
parent | f096b29abb03618ec609ba4acaedaed43eec1fea (diff) |
end of the old database macroses
git-svn-id: http://svn.miranda-ng.org/main/trunk@4373 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
42 files changed, 741 insertions, 907 deletions
diff --git a/include/m_database.h b/include/m_database.h index 6e29b7d3ce..12a1c92ad3 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -832,40 +832,6 @@ Disables a setting saving to the database. #ifndef DB_NOHELPERFUNCTIONS
-/* Deprecated & bizarre aliases */
-#define DBGetContactSettingByte db_get_b
-#define DBGetContactSettingWord db_get_w
-#define DBGetContactSettingDword db_get_dw
-#define DBGetContactSetting db_get
-#define DBGetContactSettingW(a,b,c,d) db_get_s(a,b,c,d,0)
-#define DBGetContactSettingString(a,b,c,d) db_get_s(a,b,c,d,DBVT_ASCIIZ)
-#define DBGetContactSettingWString(a,b,c,d) db_get_s(a,b,c,d,DBVT_WCHAR)
-#define DBGetContactSettingTString(a,b,c,d) db_get_s(a,b,c,d,DBVT_WCHAR)
-#define DBGetContactSettingStringUtf(a,b,c,d) db_get_s(a,b,c,d,DBVT_UTF8)
-#define DBGetContactSettingUTF8String(a,b,c,d) db_get_s(a,b,c,d,DBVT_UTF8)
-#define DBFreeVariant db_free
-
-#define DBGetString db_get_sa
-#define DBGetStringA db_get_sa
-#define DBGetStringW db_get_wsa
-#define DBGetStringT db_get_wsa
-
-#define DBDeleteContactSetting db_unset
-#define DBWriteContactSettingByte db_set_b
-#define DBWriteContactSettingWord db_set_w
-#define DBWriteContactSettingDword db_set_dw
-#define DBWriteContactSettingString db_set_s
-#define DBWriteContactSettingWString db_set_ws
-#define DBWriteContactSettingStringUtf db_set_utf
-#define DBWriteContactSettingUTF8String db_set_utf
-#define DBWriteContactSettingBlob db_set_blob
-
-#ifdef _UNICODE
- #define DBWriteContactSettingTString db_set_ws
-#else
- #define DBWriteContactSettingTString db_set_s
-#endif
-
/* inlined range tolerate versions */
__inline BYTE DBGetContactSettingRangedByte(HANDLE hContact, const char *szModule, const char *szSetting, BYTE errorValue, BYTE minValue, BYTE maxValue)
diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 9409828f48..224feb33cf 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -432,10 +432,9 @@ HTREEITEM FillAvailableSkinList(HWND hwndDlg) if (attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY))
SearchSkinFiles(hwndDlg, SkinsFolder);
{
- TCHAR * skinfile;
TCHAR skinfull[MAX_PATH];
- skinfile = DBGetStringT( NULL, SKIN, "SkinFile");
- if ( skinfile ) {
+ TCHAR *skinfile = db_get_tsa( NULL, SKIN, "SkinFile");
+ if (skinfile) {
PathToAbsoluteT(skinfile, skinfull);
res = AddSkinToListFullName(hwndDlg, skinfull);
@@ -542,7 +541,7 @@ HTREEITEM AddItemToTree(HWND hTree, TCHAR *folder, TCHAR *itemName, void *data) INT_PTR SvcActiveSkin(WPARAM wParam, LPARAM lParam)
{
- TCHAR *skinfile = DBGetStringT(NULL, SKIN, "SkinFile");
+ TCHAR *skinfile = db_get_tsa(NULL, SKIN, "SkinFile");
if ( skinfile ) {
TCHAR skinfull[MAX_PATH];
PathToAbsoluteT(skinfile, skinfull);
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp index f9676744c2..a1a6acf2c3 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -546,7 +546,7 @@ int LocateStorePosition(int Frameid,int maxstored) for (int i=0; i < maxstored; i++) {
char settingname[255];
mir_snprintf(settingname, sizeof(settingname), "Name%d",i);
- LPTSTR frmname = DBGetStringT(0,CLUIFrameModule,settingname);
+ LPTSTR frmname = db_get_tsa(0,CLUIFrameModule,settingname);
if (frmname == NULL)
continue;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index e371374fe7..bd14dfc47b 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -525,20 +525,15 @@ int DBStoreFrameSettingsAtPos(int pos, int Frameid) int LocateStorePosition(int Frameid, int maxstored)
{
- int i;
- LPTSTR frmname;
- char settingname[255];
if (Frames[Frameid].name == NULL) return -1;
- for (i = 0;i < maxstored;i++) {
+ for (int i = 0;i < maxstored;i++) {
+ char settingname[255];
mir_snprintf(settingname, sizeof(settingname), "Name%d", i);
- frmname = DBGetStringT(0, CLUIFrameModule, settingname);
+ mir_ptr<TCHAR> frmname( db_get_tsa(0, CLUIFrameModule, settingname));
if (frmname == NULL) continue;
- if (lstrcmpi(frmname, Frames[Frameid].name) == 0) {
- mir_free(frmname);
+ if (lstrcmpi(frmname, Frames[Frameid].name) == 0)
return i;
- }
- mir_free(frmname);
}
return -1;
}
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 78f5fa52e6..6c3ac3d073 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -109,21 +109,16 @@ char *GetContactUID(HANDLE hContact, int bTchar) return null_strdup(szUid);
}
-
TCHAR* MirandaStatusToStringT(int mirandaStatus)
{
- return (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, mirandaStatus, GSMDF_UNICODE);
+ return (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, mirandaStatus, GSMDF_UNICODE);
}
int DBGetContactSettingT(HANDLE hContact, const char *szModule, const char* szSetting, DBVARIANT *dbv)
{
- if (ServiceExists(MS_DB_CONTACT_GETSETTING_STR))
- return DBGetContactSettingW(hContact, szModule, szSetting, dbv);
- else
- return db_get(hContact, szModule, szSetting, dbv);
+ return db_get_s(hContact, szModule, szSetting, dbv, 0);
}
-
TCHAR* DBGetContactSettingStringT(HANDLE hContact, const char *szModule, const char* szSetting, TCHAR* szDef)
{
DBVARIANT dbv = {DBVT_DELETED};
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 50077160a8..fe3ec781d6 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -8,30 +8,27 @@ void copyModule(char* module, HANDLE hContactFrom, HANDLE hContactTo) EnumSettings(hContactFrom,module, &msll);
setting = msll.first;
- while(setting)
- {
+ while(setting) {
DBVARIANT dbv;
- if (!GetSetting(hContactFrom, module, setting->name, &dbv))
- {
- switch (dbv.type)
- {
- case DBVT_BYTE:
- db_set_b(hContactTo, module, setting->name, dbv.bVal);
+ if (!GetSetting(hContactFrom, module, setting->name, &dbv)) {
+ switch (dbv.type) {
+ case DBVT_BYTE:
+ db_set_b(hContactTo, module, setting->name, dbv.bVal);
break;
- case DBVT_WORD:
- db_set_w(hContactTo, module, setting->name, dbv.wVal);
+ case DBVT_WORD:
+ db_set_w(hContactTo, module, setting->name, dbv.wVal);
break;
- case DBVT_DWORD:
- db_set_dw(hContactTo, module, setting->name, dbv.dVal);
+ case DBVT_DWORD:
+ db_set_dw(hContactTo, module, setting->name, dbv.dVal);
break;
- case DBVT_ASCIIZ:
- db_set_s(hContactTo, module, setting->name, dbv.pszVal);
+ case DBVT_ASCIIZ:
+ db_set_s(hContactTo, module, setting->name, dbv.pszVal);
break;
- case DBVT_UTF8:
- db_set_utf(hContactTo, module, setting->name, dbv.pszVal);
+ case DBVT_UTF8:
+ db_set_utf(hContactTo, module, setting->name, dbv.pszVal);
break;
- case DBVT_BLOB:
- DBWriteContactSettingBlob(hContactTo, module, setting->name, dbv.pbVal, dbv.cpbVal);
+ case DBVT_BLOB:
+ db_set_blob(hContactTo, module, setting->name, dbv.pbVal, dbv.cpbVal);
break;
}
}
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index 08a9a3e5c4..16b952f9f8 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -480,7 +480,7 @@ int replaceModule(HWND hwnd, HANDLE hContact, const char *module, const char *fi db_set_utf(hContact, newModule, setting->name, dbv.pszVal);
break;
case DBVT_BLOB:
- DBWriteContactSettingBlob(hContact, newModule, setting->name, dbv.pbVal, dbv.cpbVal);
+ db_set_blob(hContact, newModule, setting->name, dbv.pbVal, dbv.cpbVal);
break;
}
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 3c36401da3..9dbef4d387 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -363,7 +363,7 @@ int WriteBlobFromString(HANDLE hContact,const char *szModule,const char *szSetti }
if (i)
- return DBWriteContactSettingBlob(hContact,szModule,szSetting, data, (WORD)i);
+ return db_set_blob(hContact,szModule,szSetting, data, (WORD)i);
return 0;
}
diff --git a/plugins/DbEditorPP/src/modules.cpp b/plugins/DbEditorPP/src/modules.cpp index faeae05035..898f581db3 100644 --- a/plugins/DbEditorPP/src/modules.cpp +++ b/plugins/DbEditorPP/src/modules.cpp @@ -32,7 +32,7 @@ void renameModule(char* oldName, char* newName, HANDLE hContact) db_set_utf(hContact, newName, setting->name, dbv.pszVal);
break;
case DBVT_BLOB:
- DBWriteContactSettingBlob(hContact, newName, setting->name, dbv.pbVal, dbv.cpbVal);
+ db_set_blob(hContact, newName, setting->name, dbv.pbVal, dbv.cpbVal);
break;
}
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 816244d8ec..aa5d0ff87a 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -378,159 +378,142 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w if (info->unicode)
wc = mir_a2u(value);
- if (len <= 1 || GetSetting(info->hContact,info->module,info->setting,&dbv))
- {
+ if (len <= 1 || GetSetting(info->hContact,info->module,info->setting, &dbv)) {
SendMessage(hwnd,WM_COMMAND,MAKEWPARAM(IDCANCEL,0),0);
return 0;
}
- switch (info->subitem)
- {
- case 0:// setting name
- if (!mir_strcmp(info->setting,value) || mir_strlen(value)>255)
- {
- db_free(&dbv);
- SendMessage(hwnd,WM_COMMAND,MAKEWPARAM(IDCANCEL,0),0);
- return 0;
- }
- switch (dbv.type)
- {
- case DBVT_UTF8:
- db_set_utf(info->hContact,info->module,value,dbv.pszVal);
- break;
- case DBVT_ASCIIZ:
- db_set_s(info->hContact,info->module,value,dbv.pszVal);
- break;
- case DBVT_BYTE:
- db_set_b(info->hContact,info->module,value,dbv.bVal);
- break;
- case DBVT_WORD:
- db_set_w(info->hContact,info->module,value,dbv.wVal);
- break;
- case DBVT_DWORD:
- 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;
- }
- db_unset(info->hContact,info->module,info->setting);
- {
- LVFINDINFO lvfi;
- int item;
+ switch (info->subitem) {
+ case 0:// setting name
+ if (!mir_strcmp(info->setting,value) || mir_strlen(value)>255) {
+ db_free(&dbv);
+ SendMessage(hwnd,WM_COMMAND,MAKEWPARAM(IDCANCEL,0),0);
+ return 0;
+ }
+ switch (dbv.type) {
+ case DBVT_UTF8:
+ db_set_utf(info->hContact,info->module,value,dbv.pszVal);
+ break;
+ case DBVT_ASCIIZ:
+ db_set_s(info->hContact,info->module,value,dbv.pszVal);
+ break;
+ case DBVT_BYTE:
+ db_set_b(info->hContact,info->module,value,dbv.bVal);
+ break;
+ case DBVT_WORD:
+ db_set_w(info->hContact,info->module,value,dbv.wVal);
+ break;
+ case DBVT_DWORD:
+ db_set_dw(info->hContact,info->module,value,dbv.dVal);
+ break;
+ case DBVT_BLOB:
+ db_set_blob(info->hContact,info->module,value,dbv.pbVal,dbv.cpbVal);
+ break;
+ }
+ db_unset(info->hContact,info->module,info->setting);
+ {
+ LVFINDINFO lvfi;
+ int item;
- lvfi.flags = LVFI_STRING;
- lvfi.psz = info->setting;
- lvfi.vkDirection = VK_DOWN;
+ lvfi.flags = LVFI_STRING;
+ lvfi.psz = info->setting;
+ lvfi.vkDirection = VK_DOWN;
- item = ListView_FindItem(info->hwnd,-1,&lvfi);
- ListView_DeleteItem(info->hwnd,item);
- }
+ item = ListView_FindItem(info->hwnd,-1,&lvfi);
+ ListView_DeleteItem(info->hwnd,item);
+ }
break;
- case 1: // value
+ case 1: // value
{
int val;
int i = 0;
- if (dbv.type == DBVT_BLOB)
- {
+ if (dbv.type == DBVT_BLOB) {
WriteBlobFromString(info->hContact,info->module,info->setting,value,len);
break;
- }
-
- switch (value[0])
- {
- case 'b':
- case 'B':
- if (value[1] == '0' && (value[2] == 'x' || value[2] == 'X'))
- sscanf(&value[3],"%x",&val);
- else if (value[1] >= '0' && value[1] <= '9')
- {
- val = atoi(&value[1]);
- if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)
- db_unset(info->hContact,info->module,info->setting);
+ }
- db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
- }
- else
- writeStandardTextfromLabel(info, value, wc, dbv.type);
+ switch (value[0]) {
+ case 'b':
+ case 'B':
+ if (value[1] == '0' && (value[2] == 'x' || value[2] == 'X'))
+ sscanf(&value[3],"%x",&val);
+ else if (value[1] >= '0' && value[1] <= '9') {
+ val = atoi(&value[1]);
+ if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)
+ db_unset(info->hContact,info->module,info->setting);
+
+ db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
+ }
+ else writeStandardTextfromLabel(info, value, wc, dbv.type);
break;
- case 'w':
- case 'W':
- if (value[1] == '0' && (value[2] == 'x' || value[2] == 'X'))
- sscanf(&value[3],"%x",&val);
- else if (value[1] >= '0' && value[1] <= '9')
- {
- val = atoi(&value[1]);
- if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)
- 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);
+ case 'w':
+ case 'W':
+ if (value[1] == '0' && (value[2] == 'x' || value[2] == 'X'))
+ sscanf(&value[3],"%x",&val);
+ else if (value[1] >= '0' && value[1] <= '9') {
+ val = atoi(&value[1]);
+ if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)
+ 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);
break;
- case 'd':
- case 'D':
- if (value[1] == '0' && (value[2] == 'x' || value[2] == 'X'))
- sscanf(&value[3],"%x",&val);
- else if (value[1] >= '0' && value[1] <= '9')
- {
- val = atoi(&value[1]);
- if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)
- 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);
+ case 'd':
+ case 'D':
+ if (value[1] == '0' && (value[2] == 'x' || value[2] == 'X'))
+ sscanf(&value[3],"%x",&val);
+ else if (value[1] >= '0' && value[1] <= '9') {
+ val = atoi(&value[1]);
+ if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)
+ 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);
break;
- case '0':
- i=1;
- case 'x':
- case 'X':
- if (value[i] == 'x' || value[i] == 'X')
- {
-
- sscanf(&value[i+1],"%x",&val);
- switch (dbv.type)
- {
- case DBVT_UTF8:
- case DBVT_ASCIIZ:
- writeStandardTextfromLabel(info, value, wc, dbv.type);
- break;
- case DBVT_BYTE:
- db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
- break;
- case DBVT_WORD:
- db_set_w(info->hContact,info->module,info->setting,(WORD)val);
- break;
- case DBVT_DWORD:
- db_set_dw(info->hContact,info->module,info->setting,(DWORD)val);
- break;
- }
+ case '0':
+ i=1;
+ case 'x':
+ case 'X':
+ if (value[i] == 'x' || value[i] == 'X') {
+ sscanf(&value[i+1],"%x",&val);
+ switch (dbv.type) {
+ case DBVT_UTF8:
+ case DBVT_ASCIIZ:
+ writeStandardTextfromLabel(info, value, wc, dbv.type);
+ break;
+ case DBVT_BYTE:
+ db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
+ break;
+ case DBVT_WORD:
+ db_set_w(info->hContact,info->module,info->setting,(WORD)val);
+ break;
+ case DBVT_DWORD:
+ db_set_dw(info->hContact,info->module,info->setting,(DWORD)val);
+ break;
}
- else
- {
- val = atoi(value);
- switch (dbv.type)
- {
- case DBVT_ASCIIZ:
- case DBVT_UTF8:
- writeStandardTextfromLabel(info, value, wc, dbv.type);
- break;
- case DBVT_BYTE:
- db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
- break;
- case DBVT_WORD:
- db_set_w(info->hContact,info->module,info->setting,(WORD)val);
- break;
- case DBVT_DWORD:
- db_set_dw(info->hContact,info->module,info->setting,(DWORD)val);
- break;
- }
+ }
+ else {
+ val = atoi(value);
+ switch (dbv.type) {
+ case DBVT_ASCIIZ:
+ case DBVT_UTF8:
+ writeStandardTextfromLabel(info, value, wc, dbv.type);
+ break;
+ case DBVT_BYTE:
+ db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
+ break;
+ case DBVT_WORD:
+ db_set_w(info->hContact,info->module,info->setting,(WORD)val);
+ break;
+ case DBVT_DWORD:
+ db_set_dw(info->hContact,info->module,info->setting,(DWORD)val);
+ break;
}
+ }
break;
- case '\"':
- case '\'':
+ case '\"':
+ case '\'':
{
int nlen = mir_strlen(value);
int sh = 0;
@@ -545,36 +528,35 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w writeStandardTextfromLabel(info, &value[sh], wc, dbv.type);
}
break;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '-':
- val = atoi(value);
- switch (dbv.type)
- {
- case DBVT_ASCIIZ:
- case DBVT_UTF8:
- writeStandardTextfromLabel(info, value, wc, dbv.type);
- break;
- case DBVT_BYTE:
- db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
- break;
- case DBVT_WORD:
- db_set_w(info->hContact,info->module,info->setting,(WORD)val);
- break;
- case DBVT_DWORD:
- db_set_dw(info->hContact,info->module,info->setting,(DWORD)val);
- break;
- }
- break;
- default:
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case '-':
+ val = atoi(value);
+ switch (dbv.type) {
+ case DBVT_ASCIIZ:
+ case DBVT_UTF8:
writeStandardTextfromLabel(info, value, wc, dbv.type);
+ break;
+ case DBVT_BYTE:
+ db_set_b(info->hContact,info->module,info->setting,(BYTE)val);
+ break;
+ case DBVT_WORD:
+ db_set_w(info->hContact,info->module,info->setting,(WORD)val);
+ break;
+ case DBVT_DWORD:
+ db_set_dw(info->hContact,info->module,info->setting,(DWORD)val);
+ break;
+ }
+ break;
+ default:
+ writeStandardTextfromLabel(info, value, wc, dbv.type);
break;
} // switch (value[0])
}
diff --git a/plugins/ExternalAPI/m_trigger.h b/plugins/ExternalAPI/m_trigger.h index e2e60df103..7b35392aeb 100644 --- a/plugins/ExternalAPI/m_trigger.h +++ b/plugins/ExternalAPI/m_trigger.h @@ -616,36 +616,32 @@ static __inline int RemoveAllConditionSettings(DWORD conditionID, char *szModule // Database Helper Functions: Triggers
// --------------------------------------------------------------------------
-static int __inline DBWriteTriggerSettingByte(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val) {
-
+static int __inline DBWriteTriggerSettingByte(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingByte(hContact, szModule, dbSetting, val);
+ return db_set_b(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteTriggerSettingWord(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,WORD val) {
-
+static int __inline DBWriteTriggerSettingWord(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,WORD val)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingWord(hContact, szModule, dbSetting, val);
+ return db_set_w(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteTriggerSettingDword(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val) {
-
+static int __inline DBWriteTriggerSettingDword(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingDword(hContact, szModule, dbSetting, val);
+ return db_set_dw(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteTriggerSettingString(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val) {
-
+static int __inline DBWriteTriggerSettingString(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingString(hContact, szModule, dbSetting, val);
+ return db_set_s(hContact, szModule, dbSetting, val);
}
static int __inline DBWriteTriggerSettingTString(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const TCHAR *val) {
@@ -653,371 +649,316 @@ static int __inline DBWriteTriggerSettingTString(DWORD triggerID, HANDLE hContac char dbSetting[MAX_SETTING_LEN];
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingTString(hContact, szModule, dbSetting, val);
+ return db_set_ts(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteTriggerSettingWString(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val) {
-
+static int __inline DBWriteTriggerSettingWString(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingWString(hContact, szModule, dbSetting, val);
+ return db_set_ws(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteTriggerSettingStringUtf(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val) {
-
+static int __inline DBWriteTriggerSettingStringUtf(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingStringUtf(hContact, szModule, dbSetting, val);
+ return db_set_utf(hContact, szModule, dbSetting, val);
}
-static int __inline DBGetTriggerSettingByte(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
+static int __inline DBGetTriggerSettingByte(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingByte(hContact, szModule, dbSetting, errorValue);
+ return db_get_b(hContact, szModule, dbSetting, errorValue);
}
-static WORD __inline DBGetTriggerSettingWord(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
+static WORD __inline DBGetTriggerSettingWord(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingWord(hContact, szModule, dbSetting, errorValue);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
+ return db_get_w(hContact, szModule, dbSetting, errorValue);
}
-static DWORD __inline DBGetTriggerSettingDword(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
+static DWORD __inline DBGetTriggerSettingDword(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingDword(hContact, szModule, dbSetting, errorValue);
+ return db_get_dw(hContact, szModule, dbSetting, errorValue);
}
-static int __inline DBGetTriggerSetting(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
-
-
+static int __inline DBGetTriggerSetting(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSetting(hContact, szModule, dbSetting, dbv);
+ return db_get(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetTriggerSettingW(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetTriggerSettingW(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingW(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
+ return db_get_s(hContact, szModule, dbSetting, dbv, 0);
}
-static int __inline DBGetTriggerSettingTString(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetTriggerSettingTString(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingTString(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
+ return db_get_ts(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetTriggerSettingWString(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetTriggerSettingWString(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingWString(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
+ return db_get_ws(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetTriggerSettingStringUtf(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetTriggerSettingStringUtf(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingStringUtf(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
+ return db_get_utf(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBDeleteTriggerSetting(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting) {
-
+static int __inline DBDeleteTriggerSetting(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBDeleteContactSetting(hContact, szModule, dbSetting);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
+ return db_unset(hContact, szModule, dbSetting);
}
// --------------------------------------------------------------------------
// Database Helper Functions: Actions
// --------------------------------------------------------------------------
-static int __inline DBWriteActionSettingByte(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val) {
-
+static int __inline DBWriteActionSettingByte(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingByte(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_set_b(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteActionSettingWord(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,WORD val) {
-
+static int __inline DBWriteActionSettingWord(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,WORD val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingWord(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_set_w(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteActionSettingDword(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val) {
-
+static int __inline DBWriteActionSettingDword(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingDword(hContact, szModule, dbSetting, val);
+ return db_set_dw(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteActionSettingString(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val) {
-
+static int __inline DBWriteActionSettingString(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingString(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_set_s(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteActionSettingTString(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const TCHAR *val) {
-
+static int __inline DBWriteActionSettingTString(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const TCHAR *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingTString(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_set_ts(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteActionSettingWString(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val) {
-
+static int __inline DBWriteActionSettingWString(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingWString(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_set_ws(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteActionSettingStringUtf(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val) {
-
+static int __inline DBWriteActionSettingStringUtf(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingStringUtf(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_set_utf(hContact, szModule, dbSetting, val);
}
-static int __inline DBGetActionSettingByte(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
+static int __inline DBGetActionSettingByte(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingByte(hContact, szModule, dbSetting, errorValue);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_get_b(hContact, szModule, dbSetting, errorValue);
}
-static WORD __inline DBGetActionSettingWord(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
+static WORD __inline DBGetActionSettingWord(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingWord(hContact, szModule, dbSetting, errorValue);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_get_w(hContact, szModule, dbSetting, errorValue);
}
-static DWORD __inline DBGetActionSettingDword(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
+static DWORD __inline DBGetActionSettingDword(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingDword(hContact, szModule, dbSetting, errorValue);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_get_dw(hContact, szModule, dbSetting, errorValue);
}
-static int __inline DBGetActionSetting(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
-
-
+static int __inline DBGetActionSetting(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSetting(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_get(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetActionSettingW(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetActionSettingW(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingW(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_get_s(hContact, szModule, dbSetting, dbv, 0);
}
-static int __inline DBGetActionSettingTString(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetActionSettingTString(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingTString(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_get_ts(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetActionSettingWString(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetActionSettingWString(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingWString(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_get_ws(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetActionSettingStringUtf(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetActionSettingStringUtf(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingStringUtf(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_get_utf(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBDeleteActionSetting(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting) {
-
+static int __inline DBDeleteActionSetting(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBDeleteContactSetting(hContact, szModule, dbSetting);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
+ return db_unset(hContact, szModule, dbSetting);
}
// --------------------------------------------------------------------------
// Database Helper Functions: Conditions
// --------------------------------------------------------------------------
-static int __inline DBWriteConditionSettingByte(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val) {
-
+static int __inline DBWriteConditionSettingByte(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingByte(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_set_b(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteConditionSettingWord(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,WORD val) {
-
+static int __inline DBWriteConditionSettingWord(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,WORD val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingWord(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_set_w(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteConditionSettingDword(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val) {
-
+static int __inline DBWriteConditionSettingDword(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingDword(hContact, szModule, dbSetting, val);
+ return db_set_dw(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteConditionSettingString(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val) {
-
+static int __inline DBWriteConditionSettingString(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingString(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_set_s(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteConditionSettingTString(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const TCHAR *val) {
-
+static int __inline DBWriteConditionSettingTString(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const TCHAR *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingTString(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_set_ts(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteConditionSettingWString(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val) {
-
+static int __inline DBWriteConditionSettingWString(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingWString(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_set_ws(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteConditionSettingStringUtf(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val) {
-
+static int __inline DBWriteConditionSettingStringUtf(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingStringUtf(hContact, szModule, dbSetting, val);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_set_utf(hContact, szModule, dbSetting, val);
}
-static int __inline DBGetConditionSettingByte(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
+static int __inline DBGetConditionSettingByte(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingByte(hContact, szModule, dbSetting, errorValue);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_get_b(hContact, szModule, dbSetting, errorValue);
}
-static WORD __inline DBGetConditionSettingWord(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
+static WORD __inline DBGetConditionSettingWord(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
char dbSetting[MAX_SETTING_LEN];
-
mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingWord(hContact, szModule, dbSetting, errorValue);
+ return db_get_w(hContact, szModule, dbSetting, errorValue);
}
-static DWORD __inline DBGetConditionSettingDword(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
+static DWORD __inline DBGetConditionSettingDword(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingDword(hContact, szModule, dbSetting, errorValue);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_get_dw(hContact, szModule, dbSetting, errorValue);
}
-static int __inline DBGetConditionSetting(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
-
-
+static int __inline DBGetConditionSetting(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSetting(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_get(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetConditionSettingW(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetConditionSettingW(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingW(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_get_s(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetConditionSettingTString(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetConditionSettingTString(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingTString(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_get_ts(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetConditionSettingWString(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetConditionSettingWString(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingWString(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_get_ws(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBGetConditionSettingStringUtf(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv) {
-
+static int __inline DBGetConditionSettingStringUtf(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingStringUtf(hContact, szModule, dbSetting, dbv);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_get_utf(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBDeleteConditionSetting(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting) {
-
+static int __inline DBDeleteConditionSetting(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting)
+{
char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBDeleteContactSetting(hContact, szModule, dbSetting);
+ mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
+ return db_unset(hContact, szModule, dbSetting);
}
#endif // nohelper
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 9f9fc15a5e..b3e5ae126e 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -200,9 +200,8 @@ void RenameDbProto(HANDLE hContact, HANDLE hContactNew, char* oldName, char* new db_set_utf(hContactNew, newName, setting->name, dbv.pszVal);
break;
case DBVT_BLOB:
- DBWriteContactSettingBlob(hContactNew, newName, setting->name, dbv.pbVal, dbv.cpbVal);
+ db_set_blob(hContactNew, newName, setting->name, dbv.pbVal, dbv.cpbVal);
break;
-
}
if (delOld)
db_unset(hContact, oldName, setting->name);
@@ -321,21 +320,19 @@ void GetID(HANDLE hContact,LPSTR szProto,LPSTR szID) int StatusMsgExists(HANDLE hContact)
{
- LPSTR module,msg;
char par[32];
BOOL ret = 0;
- int i;
- module = GetContactProto(hContact);
+ LPSTR module = GetContactProto(hContact);
if (!module) return 0;
- for(i = 0; i < SIZEOF(statusMsg); i++) {
+ for(int i = 0; i < SIZEOF(statusMsg); i++) {
if (statusMsg[i].flag & 8)
mir_snprintf(par, SIZEOF(par), "%s/%s", module, statusMsg[i].name);
else
strcpy(par, statusMsg[i].name);
- msg = DBGetString(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par);
+ LPSTR msg = db_get_sa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par);
if (msg) {
if (strlen(msg))
ret |= statusMsg[i].flag;
@@ -367,7 +364,7 @@ BOOL MirVerExists(HANDLE hContact) szProto = GetContactProto(hContact);
if (!szProto) return 0;
- msg = DBGetString(hContact,szProto,"MirVer");
+ msg = db_get_sa(hContact,szProto,"MirVer");
if (msg) {
if (strlen(msg)) ret = 1;
mir_free(msg);
@@ -390,12 +387,10 @@ void getIP(HANDLE hContact,LPSTR szProto,LPSTR szIP) LPSTR getMirVer(HANDLE hContact)
{
- LPSTR szProto, msg;
-
- szProto = GetContactProto(hContact);
+ LPSTR szProto = GetContactProto(hContact);
if (!szProto) return NULL;
- msg = DBGetString(hContact,szProto,"MirVer");
+ LPSTR msg = db_get_sa(hContact,szProto,"MirVer");
if (msg) {
if (strlen(msg))
return msg;
@@ -679,7 +674,7 @@ INT_PTR onCopyStatusMsg(WPARAM wparam,LPARAM lparam) else
strcpy(par, statusMsg[i].name);
- LPTSTR msg = DBGetStringT((HANDLE)wparam, (statusMsg[i].module) ? statusMsg[i].module : module, par);
+ LPTSTR msg = db_get_tsa((HANDLE)wparam, (statusMsg[i].module) ? statusMsg[i].module : module, par);
if (msg) {
if (_tcsclen(msg)) {
if (flags & VF_SMNAME) {
diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp index 6e722ea08d..1587346323 100644 --- a/plugins/MetaContacts/src/meta_utils.cpp +++ b/plugins/MetaContacts/src/meta_utils.cpp @@ -43,7 +43,7 @@ INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, D if ( !strsvcset) {strsvc = ServiceExists(MS_DB_CONTACT_GETSETTING_STR); strsvcset = TRUE;}
// preserve unicode strings - this service should return other data types unchanged
- if (strsvc) return DBGetContactSettingW(hContact, szModule, szSetting, dbv);
+ if (strsvc) return db_get_s(hContact, szModule, szSetting, dbv, 0);
return db_get(hContact, szModule, szSetting, dbv);
}
diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp index 1007d0e848..27de2987ea 100644 --- a/plugins/MirOTR/MirOTR/src/options.cpp +++ b/plugins/MirOTR/MirOTR/src/options.cpp @@ -77,7 +77,7 @@ void LoadOptions() { options.autoshow_verify = (db_get_b(0, MODULENAME, "AutoShowVerify", 1) == 1);
DBVARIANT dbv;
- if (!DBGetContactSettingUTF8String(0, MODULENAME, "Prefix", &dbv)) {
+ if (!db_get_utf(0, MODULENAME, "Prefix", &dbv)) {
strncpy(options.prefix, dbv.pszVal, OPTIONS_PREFIXLEN);
options.prefix[OPTIONS_PREFIXLEN-1] = 0;
db_free(&dbv);
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 093dd46ac2..ab2636c8a2 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -236,7 +236,7 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) break;
}
- if ( !DBGetContactSettingW(smi->hContact, "UserOnline", "OldStatusMsg", &dbv_old)) {
+ if ( !db_get_s(smi->hContact, "UserOnline", "OldStatusMsg", &dbv_old, 0)) {
switch (dbv_old.type) {
case DBVT_ASCIIZ:
smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(dbv_old.pszVal, CP_ACP));
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 9ade55870f..b19e6b3b86 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -574,7 +574,7 @@ void InitSettings(void) FreeSettingBlob(Sz1,P);
}
- g_lpszAltBrowser = DBGetString(0,MODULENAME,"AltBrowser");
+ g_lpszAltBrowser = db_get_sa(0,MODULENAME,"AltBrowser");
g_ShowNotesAtStart = (BOOL)ReadSettingInt(0,MODULENAME,"ShowNotesAtStart",1);
g_ShowNoteButtons = (BOOL)ReadSettingInt(0,MODULENAME,"ShowNoteButtons",1);
diff --git a/plugins/Quotes/src/DBUtils.cpp b/plugins/Quotes/src/DBUtils.cpp index 65ac8b180c..4ef1f1dd3a 100644 --- a/plugins/Quotes/src/DBUtils.cpp +++ b/plugins/Quotes/src/DBUtils.cpp @@ -3,7 +3,7 @@ std::string Quotes_DBGetStringA(HANDLE hContact,const char* szModule,const char* szSetting,const char* pszDefValue /*= NULL*/)
{
std::string sResult;
- char* pszSymbol = DBGetString(hContact,szModule,szSetting);
+ char* pszSymbol = db_get_sa(hContact,szModule,szSetting);
if(NULL != pszSymbol)
{
sResult = pszSymbol;
@@ -20,7 +20,7 @@ std::string Quotes_DBGetStringA(HANDLE hContact,const char* szModule,const char* std::wstring Quotes_DBGetStringW(HANDLE hContact,const char* szModule,const char* szSetting,const wchar_t* pszDefValue/* = NULL*/)
{
std::wstring sResult;
- wchar_t* pszSymbol = DBGetStringW(hContact,szModule,szSetting);
+ wchar_t* pszSymbol = db_get_wsa(hContact,szModule,szSetting);
if(NULL != pszSymbol)
{
sResult = pszSymbol;
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 9ffe857006..106b547f21 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -58,36 +58,38 @@ void SetupInfobar(InfobarWindowData* idat) { RefreshInfobar(idat);
}
-static HICON GetExtraStatusIcon(InfobarWindowData* idat) {
- BYTE bXStatus = db_get_b(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusId", 0);
- if (bXStatus > 0) {
- return (HICON) CallProtoService(idat->mwd->szProto, "/GetXStatusIcon", bXStatus, 0);
- }
- return NULL;
+static HICON GetExtraStatusIcon(InfobarWindowData* idat)
+{
+ BYTE bXStatus = db_get_b(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusId", 0);
+ if (bXStatus > 0) {
+ return (HICON) CallProtoService(idat->mwd->szProto, "/GetXStatusIcon", bXStatus, 0);
+ }
+ return NULL;
}
-void RefreshInfobar(InfobarWindowData* idat) {
+void RefreshInfobar(InfobarWindowData* idat)
+{
HWND hwnd = idat->hWnd;
struct SrmmWindowData *dat = idat->mwd;
- TCHAR *szContactName = GetNickname(dat->windowData.hContact, dat->szProto);
- TCHAR *szContactStatusMsg = DBGetStringT(dat->windowData.hContact, "CList", "StatusMsg");
- TCHAR *szXStatusName = DBGetStringT(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusName");
- TCHAR *szXStatusMsg = DBGetStringT(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusMsg");
- HICON hIcon = GetExtraStatusIcon(idat);
+ TCHAR *szContactName = GetNickname(dat->windowData.hContact, dat->szProto);
+ TCHAR *szContactStatusMsg = db_get_tsa(dat->windowData.hContact, "CList", "StatusMsg");
+ TCHAR *szXStatusName = db_get_tsa(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusName");
+ TCHAR *szXStatusMsg = db_get_tsa(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusMsg");
+ HICON hIcon = GetExtraStatusIcon(idat);
TCHAR szText[2048];
SETTEXTEX st;
if ( szXStatusMsg && *szXStatusMsg )
mir_sntprintf(szText, 2047, _T("%s (%s)"), TranslateTS(szXStatusName), szXStatusMsg);
else
mir_sntprintf(szText, 2047, _T("%s"), TranslateTS(szXStatusName));
- st.flags = ST_DEFAULT;
+ st.flags = ST_DEFAULT;
st.codepage = 1200;
SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactName);
- SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactStatusMsg);
- hIcon = (HICON)SendDlgItemMessage(hwnd, IDC_XSTATUSICON, STM_SETICON, (WPARAM)hIcon, 0);
- if (hIcon) {
- DestroyIcon(hIcon);
- }
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactStatusMsg);
+ hIcon = (HICON)SendDlgItemMessage(hwnd, IDC_XSTATUSICON, STM_SETICON, (WPARAM)hIcon, 0);
+ if (hIcon) {
+ DestroyIcon(hIcon);
+ }
SetToolTipText(hwnd, idat->hXStatusTip, szText, NULL);
SendMessage(hwnd, WM_SIZE, 0, 0);
InvalidateRect(hwnd, NULL, TRUE);
@@ -159,59 +161,59 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA return TRUE;
}
case WM_CTLCOLORDLG:
- case WM_CTLCOLORSTATIC:
+ case WM_CTLCOLORSTATIC:
return (INT_PTR)g_dat.hInfobarBrush;
-
+
case WM_DROPFILES:
SendMessage(GetParent(hwnd), WM_DROPFILES, wParam, lParam);
return FALSE;
-
+
case WM_NOTIFY:
- {
- LPNMHDR pNmhdr = (LPNMHDR)lParam;
- switch (pNmhdr->idFrom) {
- case IDC_INFOBAR_NAME:
- case IDC_INFOBAR_STATUS:
- switch (pNmhdr->code) {
- case EN_MSGFILTER:
- switch (((MSGFILTER *) lParam)->msg) {
- case WM_CHAR:
- SendMessage(GetParent(hwnd), ((MSGFILTER *) lParam)->msg, ((MSGFILTER *) lParam)->wParam, ((MSGFILTER *) lParam)->lParam);
- SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
- case WM_LBUTTONUP:
- {
- CHARRANGE sel;
- SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- bWasCopy = FALSE;
- if (sel.cpMin != sel.cpMax) {
- SendDlgItemMessage(hwnd, pNmhdr->idFrom, WM_COPY, 0, 0);
- sel.cpMin = sel.cpMax ;
- SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM)& sel);
- bWasCopy = TRUE;
- }
- SetFocus(GetParent(hwnd));
- }
- }
- break;
- case EN_LINK:
- switch (((ENLINK *) lParam)->msg) {
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- if (!bWasCopy) {
- if (HandleLinkClick(g_hInst, hwnd, GetDlgItem(GetParent(hwnd), IDC_MESSAGE),(ENLINK*)lParam)) {
- SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
+ {
+ LPNMHDR pNmhdr = (LPNMHDR)lParam;
+ switch (pNmhdr->idFrom) {
+ case IDC_INFOBAR_NAME:
+ case IDC_INFOBAR_STATUS:
+ switch (pNmhdr->code) {
+ case EN_MSGFILTER:
+ switch (((MSGFILTER *) lParam)->msg) {
+ case WM_CHAR:
+ SendMessage(GetParent(hwnd), ((MSGFILTER *) lParam)->msg, ((MSGFILTER *) lParam)->wParam, ((MSGFILTER *) lParam)->lParam);
+ SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ case WM_LBUTTONUP:
+ {
+ CHARRANGE sel;
+ SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
+ bWasCopy = FALSE;
+ if (sel.cpMin != sel.cpMax) {
+ SendDlgItemMessage(hwnd, pNmhdr->idFrom, WM_COPY, 0, 0);
+ sel.cpMin = sel.cpMax ;
+ SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM)& sel);
+ bWasCopy = TRUE;
+ }
+ SetFocus(GetParent(hwnd));
}
}
- bWasCopy = FALSE;
break;
+ case EN_LINK:
+ switch (((ENLINK *) lParam)->msg) {
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ if (!bWasCopy) {
+ if (HandleLinkClick(g_hInst, hwnd, GetDlgItem(GetParent(hwnd), IDC_MESSAGE),(ENLINK*)lParam)) {
+ SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+ }
+ bWasCopy = FALSE;
+ break;
+ }
}
+ break;
}
break;
}
- break;
- }
case WM_DRAWITEM:
{
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index f8108668b6..7cf14db289 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -50,10 +50,10 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) {
int isTemplate;
int i, j, len;
- TCHAR* tokens[4] = {0};
- int tokenLen[4] = {0};
+ TCHAR* tokens[4] = {0};
+ int tokenLen[4] = {0};
TCHAR *p, *tmplt, *title;
- char *accModule;
+ char *accModule;
TCHAR *pszNewTitleEnd = mir_tstrdup(TranslateT("Message Session"));
isTemplate = 0;
if (hContact && szProto) {
@@ -62,7 +62,7 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) tokens[1] = mir_tstrdup((TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto ?
db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE, GSMDF_TCHAR));
tokenLen[1] = lstrlen(tokens[1]);
- tokens[2] = DBGetStringT(hContact, "CList", "StatusMsg");
+ tokens[2] = db_get_tsa(hContact, "CList", "StatusMsg");
if (tokens[2] != NULL) {
tokenLen[2] = (int)lstrlen(tokens[2]);
for (i = j = 0; i < tokenLen[2]; i++) {
@@ -78,15 +78,15 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) tokenLen[2] = j;
}
- accModule = (char *) CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM) hContact, 0);
- if (accModule != NULL) {
- PROTOACCOUNT* proto = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)accModule);
- if (proto != NULL) {
- tokens[3] = mir_tstrdup(proto->tszAccountName);
- tokenLen[3] = lstrlen(tokens[3]);
- }
- }
- tmplt = DBGetStringT(NULL, SRMMMOD, SRMSGSET_WINDOWTITLE);
+ accModule = (char *) CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM) hContact, 0);
+ if (accModule != NULL) {
+ PROTOACCOUNT* proto = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)accModule);
+ if (proto != NULL) {
+ tokens[3] = mir_tstrdup(proto->tszAccountName);
+ tokenLen[3] = lstrlen(tokens[3]);
+ }
+ }
+ tmplt = db_get_tsa(NULL, SRMMMOD, SRMSGSET_WINDOWTITLE);
if (tmplt != NULL) {
isTemplate = 1;
} else {
@@ -101,14 +101,14 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) }
for (len = 0, p = tmplt; *p; p++, len++) {
if (*p == '%') {
- for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
- int tnlen = (int)_tcslen(titleTokenNames[i]);
- if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
- len += tokenLen[i] - 1;
- p += tnlen - 1;
- break;
- }
- }
+ for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
+ int tnlen = (int)_tcslen(titleTokenNames[i]);
+ if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
+ len += tokenLen[i] - 1;
+ p += tnlen - 1;
+ break;
+ }
+ }
}
}
if (!isTemplate) {
@@ -117,17 +117,17 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) title = (TCHAR *)mir_alloc(sizeof(TCHAR) * (len + 1));
for (len = 0, p = tmplt; *p; p++) {
if (*p == '%') {
- for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
- int tnlen = lstrlen(titleTokenNames[i]);
- if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
- if (tokens[i] != NULL) {
- memcpy(title+len, tokens[i], sizeof(TCHAR) * tokenLen[i]);
- len += tokenLen[i];
- }
- p += tnlen - 1;
- break;
- }
- }
+ for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
+ int tnlen = lstrlen(titleTokenNames[i]);
+ if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
+ if (tokens[i] != NULL) {
+ memcpy(title+len, tokens[i], sizeof(TCHAR) * tokenLen[i]);
+ len += tokenLen[i];
+ }
+ p += tnlen - 1;
+ break;
+ }
+ }
if (i < SIZEOF(titleTokenNames)) continue;
}
title[len++] = *p;
@@ -140,22 +140,23 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) if (isTemplate) {
mir_free(tmplt);
}
- for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
- mir_free(tokens[i]);
- }
+ for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
+ mir_free(tokens[i]);
+ }
mir_free(pszNewTitleEnd);
return title;
}
TCHAR* GetTabName(HANDLE *hContact)
{
- if (hContact) {
+ if (hContact)
return GetNickname(hContact, NULL);
- }
+
return NULL;
}
-static int GetChildCount(ParentWindowData *dat) {
+static int GetChildCount(ParentWindowData *dat)
+{
return TabCtrl_GetItemCount(dat->hwndTabs);
}
@@ -166,9 +167,9 @@ static void GetChildWindowRect(ParentWindowData *dat, RECT *rcChild) GetClientRect(dat->hwndTabs, &rcTabs);
TabCtrl_AdjustRect(dat->hwndTabs, FALSE, &rcTabs);
rcStatus.top = rcStatus.bottom = 0;
- if (dat->flags2 & SMF2_SHOWSTATUSBAR) {
+ if (dat->flags2 & SMF2_SHOWSTATUSBAR)
GetWindowRect(dat->hwndStatus, &rcStatus);
- }
+
rcChild->left = 0;
rcChild->right = rc.right;
if (dat->flags2 & SMF2_TABSATBOTTOM) {
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 7f2b2f4dbd..8058d452d7 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -175,7 +175,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar GetWindowRect(hdlg, &rWnd);
x=rWnd.right-rWnd.left;
y=rWnd.bottom-rWnd.top;
- if(IsDlgButtonChecked(hdlg,IDC_SELCONTACTS))
+ if (IsDlgButtonChecked(hdlg,IDC_SELCONTACTS))
{
EnableWindow(GetDlgItem(hdlg,IDC_SANDCCHECK),FALSE);
dy=20;
@@ -228,7 +228,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar {
GetWindowText(GetDlgItem(hdlg, IDC_LIST), szUserSessionName, SIZEOF(szUserSessionName));
szUserSessionName[lenght+1]='\0';
- if(IsDlgButtonChecked(hdlg,IDC_SELCONTACTS)&&bSC)
+ if (IsDlgButtonChecked(hdlg,IDC_SELCONTACTS)&&bSC)
{
HANDLE hContact = db_find_first();
for (i=0; hContact; hContact = db_find_next(hContact))
@@ -252,7 +252,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar {
SaveSessionHandles(0,1);
- if(IsDlgButtonChecked(hdlg,IDC_SANDCCHECK))
+ if (IsDlgButtonChecked(hdlg,IDC_SANDCCHECK))
CloseCurrentSession(0,0);
DestroyWindow(hdlg);
g_hSDlg=0;
@@ -287,7 +287,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar case WM_INITDIALOG:
{
int iDelay=db_get_w(NULL, MODNAME, "StartupModeDelay", 1500);
- if(g_hghostw==TRUE)
+ if (g_hghostw==TRUE)
SetTimer(hdlg, TIMERID_LOAD, iDelay, NULL);
else
{
@@ -296,15 +296,15 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar if ((ses_count=LoadSessionToCombobox(hdlg,0,ses_limit,"SessionDate",0))==ses_limit)
EnableWindow(GetDlgItem(hdlg,IDC_SESSDEL),TRUE);
- if(LoadSessionToCombobox(hdlg,0,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0)
+ if (LoadSessionToCombobox(hdlg,0,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0)
ses_count=0;
- if(session_list_recovered[0])
+ if (session_list_recovered[0])
ses_count=256;
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
LoadPosition(hdlg, "LoadDlg");
- if(StartUp)
+ if (StartUp)
SetTimer(hdlg, TIMERID_SHOW, iDelay, NULL);
else
ShowWindow(g_hDlg,SW_SHOW);
@@ -312,7 +312,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar }break;
case WM_TIMER:
- if(wparam == TIMERID_SHOW)
+ if (wparam == TIMERID_SHOW)
{
KillTimer(hdlg, TIMERID_SHOW);
ShowWindow(hdlg,SW_SHOW);
@@ -345,7 +345,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar {
HWND hCombo = GetDlgItem(hdlg, IDC_LIST);
int index = SendMessage(hCombo, CB_GETCURSEL, 0, 0);
- if(index != CB_ERR)
+ if (index != CB_ERR)
ses_count = SendMessage(hCombo, CB_GETITEMDATA, (WPARAM)index, 0);
}break;
}break;
@@ -353,7 +353,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar case IDC_SESSDEL:
{
- if(session_list_recovered[0]&&ses_count==256)
+ if (session_list_recovered[0]&&ses_count==256)
{
int i=0;
while(session_list_recovered[i])
@@ -370,7 +370,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar if ((ses_count=LoadSessionToCombobox(hdlg,1,ses_limit,"SessionDate",0))==ses_limit)
EnableWindow(GetDlgItem(hdlg,IDC_SESSDEL),TRUE);
- if(LoadSessionToCombobox(hdlg,1,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0)
+ if (LoadSessionToCombobox(hdlg,1,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0)
ses_count=0;
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
@@ -386,10 +386,10 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar if ((ses_count=LoadSessionToCombobox(hdlg,0,ses_limit,"SessionDate",0))==ses_limit)
EnableWindow(GetDlgItem(hdlg,IDC_SESSDEL),TRUE);
- if(LoadSessionToCombobox(hdlg,0,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0)
+ if (LoadSessionToCombobox(hdlg,0,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0)
ses_count=0;
- if(session_list_recovered[0]) ses_count=256;
+ if (session_list_recovered[0]) ses_count=256;
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
}
@@ -401,10 +401,10 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar if ((ses_count=LoadSessionToCombobox(hdlg,0,ses_limit,"SessionDate",0))==ses_limit)
EnableWindow(GetDlgItem(hdlg,IDC_SESSDEL),TRUE);
- if(LoadSessionToCombobox(hdlg,0,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0)
+ if (LoadSessionToCombobox(hdlg,0,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0)
ses_count=0;
- if(session_list_recovered[0]) ses_count=256;
+ if (session_list_recovered[0]) ses_count=256;
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
}
@@ -473,7 +473,7 @@ int SaveSessionHandles(WPARAM wparam,LPARAM lparam) {
int k=0;
- if(session_list[0]!=0)
+ if (session_list[0]!=0)
{
for (HANDLE hContact = db_find_first(); hContact;
hContact = db_find_next(hContact))
@@ -490,7 +490,7 @@ int SaveSessionHandles(WPARAM wparam,LPARAM lparam) AddInSessionOrder((HANDLE)hContact,lparam,0,0);
}
}
- if(lparam==1)
+ if (lparam==1)
{
g_ses_count++;
db_set_b(0, MODNAME, "UserSessionsCount", (BYTE)g_ses_count);
@@ -503,27 +503,27 @@ int SaveSessionHandles(WPARAM wparam,LPARAM lparam) INT_PTR SaveUserSessionHandles(WPARAM wparam,LPARAM lparam)
{
- if (g_hSDlg)
- {
+ if (g_hSDlg) {
ShowWindow(g_hSDlg,SW_SHOW);
return 1;
}
- else
- g_hSDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_SAVEDIALOG), 0, SaveSessionDlgProc);
+ g_hSDlg = CreateDialog(hinstance,MAKEINTRESOURCE(IDD_SAVEDIALOG), 0, SaveSessionDlgProc);
return 0;
}
INT_PTR OpenSessionsManagerWindow(WPARAM wparam,LPARAM lparam)
{
- if (g_hDlg)
- {
+ if (g_hDlg) {
ShowWindow(g_hDlg,SW_SHOW);
return 0;
}
- if(g_bIncompletedSave||DBGetStringT(NULL, MODNAME, "SessionDate_0")||DBGetStringT(NULL, MODNAME, "UserSessionDsc_0"))
- {
- g_hDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc);
+
+ mir_ptr<TCHAR>
+ tszSession(db_get_tsa(NULL, MODNAME, "SessionDate_0")),
+ tszUserSession(db_get_tsa(NULL, MODNAME, "UserSessionDsc_0"));
+ if (g_bIncompletedSave || tszSession || tszUserSession) {
+ g_hDlg = CreateDialog(hinstance,MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc);
return 0;
}
if (g_bOtherWarnings)
@@ -533,7 +533,7 @@ INT_PTR OpenSessionsManagerWindow(WPARAM wparam,LPARAM lparam) int SaveSessionDate()
{
- if(session_list[0]!=0)
+ if (session_list[0]!=0)
{
int TimeSize = GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/, NULL, NULL, NULL, 0);
TCHAR *szTimeBuf = (TCHAR*)mir_alloc((TimeSize+1)*sizeof(TCHAR));
@@ -559,12 +559,12 @@ int SaveSessionDate() mir_free(szSessionTime);
ResaveSettings("SessionDate", 1, ses_limit, szSessionDateBuf_1);
- if(szTimeBuf)
+ if (szTimeBuf)
mir_free(szTimeBuf);
- if(szDateBuf)
+ if (szDateBuf)
mir_free(szDateBuf);
}
- if(g_bCrashRecovery)
+ if (g_bCrashRecovery)
db_set_b(NULL, MODNAME, "lastSaveCompleted", 1);
return 0;
}
@@ -578,7 +578,7 @@ int SaveUserSessionName(TCHAR *szUSessionName) TCHAR *szUserSessionName=NULL;
TCHAR *ptr=NULL;
- if(session_list[0]!=0)
+ if (session_list[0]!=0)
{
szUserSessionName = mir_tstrdup(szUSessionName);
mir_snprintf(szUserSessionNameBuf, SIZEOF(szUserSessionNameBuf), "%s_%u", "UserSessionDsc", 0);
@@ -602,7 +602,7 @@ int SaveUserSessionName(TCHAR *szUSessionName) INT_PTR LoadLastSession(WPARAM wparam,LPARAM lparam)
{
int ret=0;
- if(isLastTRUE)
+ if (isLastTRUE)
ret=LoadSession(wparam,lparam);
else if (g_bOtherWarnings)
MessageBox(NULL, TranslateT("Last Sessions is empty"), TranslateT("Sessions Manager"), MB_OK);
@@ -622,13 +622,13 @@ int LoadSession(WPARAM wparam,LPARAM lparam) mode=1;
lparam-=ses_limit;
}
- if(session_list_recovered[0]&&lparam==256&&mode==0)
+ if (session_list_recovered[0]&&lparam==256&&mode==0)
memcpy(session_list_t,session_list_recovered,SIZEOF(session_list_t));
else
for (hContact = db_find_first(); hContact;
hContact = db_find_next(hContact))
{
- if(LoadContactsFromMask(hContact,mode,lparam))
+ if (LoadContactsFromMask(hContact,mode,lparam))
{
i=GetInSessionOrder(hContact,mode, lparam);
session_list_t[i]=(DWORD)hContact;
@@ -640,7 +640,7 @@ int LoadSession(WPARAM wparam,LPARAM lparam) {
if (CheckForDuplicate(session_list,session_list_t[i])==-1)
CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)session_list_t[i], 0);
- else if(g_bWarnOnHidden)
+ else if (g_bWarnOnHidden)
{
if (!CheckContactVisibility((HANDLE)session_list_t[i]))
{
@@ -652,17 +652,17 @@ int LoadSession(WPARAM wparam,LPARAM lparam) i++;
}
- if(i==0)
+ if (i==0)
{
- if(g_bOtherWarnings)
+ if (g_bOtherWarnings)
MessageBox(NULL, TranslateT("No contacts to open"), TranslateT("Sessions Manager"), MB_OK|MB_ICONWARNING);
return 1;
}
- else if(dup==i)
+ else if (dup==i)
{
if (!hidden)
{
- if(g_bOtherWarnings)
+ if (g_bOtherWarnings)
MessageBox(NULL, TranslateT("This Session already opened"), TranslateT("Sessions Manager"), MB_OK|MB_ICONWARNING);
return 1;
}
@@ -671,9 +671,9 @@ int LoadSession(WPARAM wparam,LPARAM lparam) MessageBox(NULL, TranslateT("This Session already opened"), TranslateT("Sessions Manager"), MB_OK|MB_ICONWARNING);
return 1;
}
- else if(g_bWarnOnHidden)
+ else if (g_bWarnOnHidden)
{
- if(MessageBox(NULL, TranslateT("This Session already opened(but probably hidden)\nDo you want to show hidden contacts?"), TranslateT("Sessions Manager"), MB_YESNO|MB_ICONQUESTION)==IDYES)
+ if (MessageBox(NULL, TranslateT("This Session already opened(but probably hidden)\nDo you want to show hidden contacts?"), TranslateT("Sessions Manager"), MB_YESNO|MB_ICONQUESTION)==IDYES)
{
j=0;
while(hidden[j]!=0)
@@ -695,9 +695,7 @@ int DelUserDefSession(int ses_count) char szSessionName[256]={0};
TCHAR *szSessionNameBuf=NULL;
- for (hContact = db_find_first(); hContact;
- hContact = db_find_next(hContact))
- {
+ for (hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
RemoveSessionMark(hContact,1,ses_count);
SetInSessionOrder(hContact,1,ses_count,0);
}
@@ -708,18 +706,16 @@ int DelUserDefSession(int ses_count) mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", ses_count);
db_unset(NULL, MODNAME, szSessionName);
- for (i=(ses_count+1);;i++)
- {
+ for (i=(ses_count+1);;i++) {
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i);
- if ((szSessionNameBuf=DBGetStringT(NULL, MODNAME, szSessionName))/*&&(szSessionHandlesBuf=DBGetStringT(NULL,PLGNAME,szSessionHandles))*/)
- {
+ if (szSessionNameBuf = db_get_tsa(NULL, MODNAME, szSessionName)) {
MarkUserDefSession(i-1,IsMarkedUserDefSession(i));
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i-1);
db_set_ts(NULL, MODNAME, szSessionName, szSessionNameBuf);
+ mir_free(szSessionNameBuf);
}
- else
- {
+ else {
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i-1);
db_unset(NULL, MODNAME, szSessionName);
@@ -730,7 +726,6 @@ int DelUserDefSession(int ses_count) }
g_ses_count--;
db_set_b(0, MODNAME, "UserSessionsCount", (BYTE)g_ses_count);
- mir_free(szSessionNameBuf);
return 0;
}
@@ -752,24 +747,21 @@ int DeleteAutoSession(int ses_count) mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", ses_count);
db_unset(NULL, MODNAME, szSessionName);
- for (i=(ses_count+1);;i++)
- {
+ for (i=(ses_count+1);;i++) {
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i);
- if ((szSessionNameBuf=DBGetStringT(NULL, MODNAME, szSessionName))/*&&(szSessionHandlesBuf=DBGetStringT(NULL,PLGNAME,szSessionHandles))*/)
- {
+ if (szSessionNameBuf = db_get_tsa(NULL, MODNAME, szSessionName)) {
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i-1);
db_set_ts(NULL, MODNAME, szSessionName, szSessionNameBuf);
-
+ mir_free(szSessionNameBuf);
}
- else
- {
+ else {
mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i-1);
db_unset(NULL, MODNAME, szSessionName);
break;
}
}
- mir_free(szSessionNameBuf);
+
return 0;
}
@@ -785,7 +777,7 @@ int SessionPreShutdown(WPARAM wparam,LPARAM lparam) if (g_hDlg) DestroyWindow(g_hDlg);
if (g_hSDlg) DestroyWindow(g_hSDlg);
- if(g_bIncompletedSave) {
+ if (g_bIncompletedSave) {
int i=0;
while(session_list_recovered[i]) {
db_set_b((HANDLE)session_list_recovered[i], MODNAME, "wasInLastSession", 0);
@@ -801,13 +793,13 @@ int OkToExit(WPARAM wparam,LPARAM lparam) {
int exitmode=db_get_b(NULL, MODNAME, "ShutdownMode", 2);
DONT=1;
- if(exitmode==2&&session_list[0]!=0)
+ if (exitmode==2&&session_list[0]!=0)
{
SaveSessionDate();
SaveSessionHandles(0,0);
db_set_b(NULL, MODNAME, "lastempty", 0);
}
- else if(exitmode==1&&session_list[0]!=0)
+ else if (exitmode==1&&session_list[0]!=0)
{
DialogBox(hinstance,MAKEINTRESOURCE(IDD_EXDIALOG), 0, ExitDlgProc);
}
@@ -819,16 +811,16 @@ static int GetContactHandle(WPARAM wparam,LPARAM lParam) {
MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam;
- if(MWeventdata->uType == MSG_WINDOW_EVT_OPEN)
+ if (MWeventdata->uType == MSG_WINDOW_EVT_OPEN)
{
if (strstr(MWeventdata->szModule,"tabSRMsg")) g_mode=1;
AddToCurSession((DWORD)MWeventdata->hContact,0);
- if(g_bCrashRecovery) db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 1);
+ if (g_bCrashRecovery) db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 1);
}
- else if(MWeventdata->uType == MSG_WINDOW_EVT_CLOSE)
+ else if (MWeventdata->uType == MSG_WINDOW_EVT_CLOSE)
{
if (!DONT) DelFromCurSession((DWORD)MWeventdata->hContact,0);
- if(g_bCrashRecovery) db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 0);
+ if (g_bCrashRecovery) db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 0);
}
return 0;
@@ -843,7 +835,7 @@ INT_PTR BuildFavMenu(WPARAM wparam,LPARAM lparam) GetCursorPos(&pt);
FillFavoritesMenu(hMenu,g_ses_count);
res = TrackPopupMenu(hMenu, TPM_RETURNCMD|TPM_NONOTIFY, pt.x, pt.y, 0, GetActiveWindow(), NULL);
- if(res==0) return 1;
+ if (res==0) return 1;
LoadSession(0,(res-1)+ses_limit);
return 0;
}
@@ -898,10 +890,10 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) g_bOtherWarnings = db_get_b(NULL, MODNAME, "OtherWarnings", 1);
g_bCrashRecovery = db_get_b(NULL, MODNAME, "CrashRecovery", 0);
- if(g_bCrashRecovery)
+ if (g_bCrashRecovery)
g_bIncompletedSave=!db_get_b(NULL, MODNAME, "lastSaveCompleted", 0);
- if(g_bIncompletedSave)
+ if (g_bIncompletedSave)
{
int i=0;
HANDLE hContact;
@@ -910,7 +902,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) for (hContact = db_find_first(); hContact;
hContact = db_find_next(hContact))
{
- if(db_get_b(hContact, MODNAME, "wasInLastSession", 0))
+ if (db_get_b(hContact, MODNAME, "wasInLastSession", 0))
session_list_recovered[i++]=(DWORD)hContact;
}
}
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index 86a435c595..e8860f6f6f 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -51,7 +51,7 @@ int OpLoadSessionContacts(WPARAM wparam,LPARAM lparam) for (hContact = db_find_first(); hContact;
hContact = db_find_next(hContact))
{
- if(LoadContactsFromMask(hContact,1,lparam))
+ if (LoadContactsFromMask(hContact,1,lparam))
{
i=GetInSessionOrder(hContact,1, lparam);
session_list_t[i]=(DWORD)hContact;
@@ -96,7 +96,7 @@ static LRESULT CALLBACK ComboBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }break;
case WM_LBUTTONDOWN:
- if(hOpClistControl)
+ if (hOpClistControl)
break;
HideCaret(hwnd);
@@ -125,7 +125,7 @@ static LRESULT CALLBACK ComboBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break;
case WM_MOUSEMOVE:
- if(hOpClistControl)
+ if (hOpClistControl)
break;
case WM_NCMOUSEMOVE:
@@ -152,7 +152,7 @@ static LRESULT CALLBACK ComboBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_NCHITTEST:
{
LRESULT lr = mir_callNextSubclass(hwnd, ComboBoxSubclassProc, msg, wParam, lParam );
- if(lr==HTNOWHERE )
+ if (lr==HTNOWHERE )
lr = HTOBJECT;
return lr;
}
@@ -198,7 +198,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) CheckDlgButton(hdlg,IDC_CRASHRECOVERY,g_bCrashRecovery?BST_CHECKED:BST_UNCHECKED);
- if(startupmode==1)
+ if (startupmode==1)
CheckDlgButton(hdlg,IDC_STARTDIALOG,BST_CHECKED);
else if (startupmode==3)
{
@@ -218,7 +218,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), FALSE);
EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
}
- if(exitmode==0)
+ if (exitmode==0)
{
CheckDlgButton(hdlg,IDC_REXDSAVE,BST_CHECKED);
EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),FALSE);
@@ -230,7 +230,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) else if (exitmode==2) CheckDlgButton(hdlg,IDC_REXSAVE,BST_CHECKED);
LoadSessionToCombobox (hdlg,1,255,"UserSessionDsc",0);
- if(SendDlgItemMessage(hdlg, IDC_LIST, CB_GETCOUNT, 0, 0))
+ if (SendDlgItemMessage(hdlg, IDC_LIST, CB_GETCOUNT, 0, 0))
{
EnableWindow(GetDlgItem(hdlg,IDC_EDIT),TRUE);
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
@@ -265,18 +265,18 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) db_set_w(0, MODNAME, "StartupModeDelay", (WORD)iDelay);
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_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_STARTDIALOG))
{
if (!IsDlgButtonChecked(hdlg, IDC_CHECKLAST))
db_set_b(NULL, MODNAME, "StartupMode", 1);
else db_set_b(NULL, MODNAME, "StartupMode", 3);
}
- 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);
+ 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);
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)));
@@ -315,10 +315,10 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) {
HWND hCombo = GetDlgItem(hdlg, IDC_LIST);
int index = SendMessage(hCombo, CB_GETCURSEL, 0, 0);
- if(index != CB_ERR) {
+ if (index != CB_ERR) {
opses_count = SendMessage(hCombo, CB_GETITEMDATA, (WPARAM)index, 0);
SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
- if(IsMarkedUserDefSession(opses_count)) {
+ if (IsMarkedUserDefSession(opses_count)) {
hIcon=hMarked;
bChecked=TRUE;
RedrawWindow(hComboBoxEdit, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
@@ -406,8 +406,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) SetInSessionOrder(hContact,1,opses_count,0);
}
}
- if(bSesssionNameChanged) {
- if(GetWindowTextLength(hComboBoxEdit)) {
+ if (bSesssionNameChanged) {
+ if (GetWindowTextLength(hComboBoxEdit)) {
TCHAR szUserSessionName[MAX_PATH]={'\0'};
GetWindowText(hComboBoxEdit, szUserSessionName, SIZEOF(szUserSessionName));
RenameUserDefSession(opses_count,szUserSessionName);
@@ -431,7 +431,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) opses_count=0;
- if(SendDlgItemMessage(hdlg, IDC_LIST, CB_GETCOUNT, 0, 0)) {
+ if (SendDlgItemMessage(hdlg, IDC_LIST, CB_GETCOUNT, 0, 0)) {
EnableWindow(GetDlgItem(hdlg,IDC_EDIT),TRUE);
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
if (!OpLoadSessionContacts(0,opses_count))
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index bab43d06d3..d2f5c58c12 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -26,7 +26,7 @@ void AddSessionMark(HANDLE hContact,int mode,char bit) char temp_1[1]={'\0'},temp_2[1]={'\0'};
char szDst[256]={'\0'};
char* pszBuffer=NULL;
- if(mode==0)
+ if (mode==0)
{
DBVARIANT dbv;
if (!db_get_s(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal)
@@ -44,7 +44,7 @@ void AddSessionMark(HANDLE hContact,int mode,char bit) db_set_s(hContact, MODNAME, "LastSessionsMarks", dbv.pszVal);
db_free(&dbv);
}
- else if(bit=='1') db_set_s(hContact, MODNAME, "LastSessionsMarks", "10000000000");
+ else if (bit=='1') db_set_s(hContact, MODNAME, "LastSessionsMarks", "10000000000");
}
if (mode==1)
@@ -52,7 +52,7 @@ void AddSessionMark(HANDLE hContact,int mode,char bit) DBVARIANT dbv;
if (!db_get_s(hContact, MODNAME, "UserSessionsMarks", &dbv) && dbv.pszVal)
{
- if(strlen(dbv.pszVal)<g_ses_count)
+ if (strlen(dbv.pszVal)<g_ses_count)
{
pszBuffer = (char*)mir_alloc(g_ses_count+1);
ZeroMemory(pszBuffer,g_ses_count+1);
@@ -75,7 +75,7 @@ void AddSessionMark(HANDLE hContact,int mode,char bit) mir_free(pszBuffer);
}
- else if(bit=='1')db_set_s(hContact, MODNAME, "UserSessionsMarks", "10000000000");
+ else if (bit=='1')db_set_s(hContact, MODNAME, "UserSessionsMarks", "10000000000");
else db_set_s(hContact, MODNAME, "UserSessionsMarks", "00000000000");
}
}
@@ -85,7 +85,7 @@ void RemoveSessionMark(HANDLE hContact,int mode,int marknum) unsigned int i=1;
char temp_1[1]={'\0'},temp_2[1]={'\0'};
char szDst[256]={'\0'};
- if(mode==0)
+ if (mode==0)
{
DBVARIANT dbv;
if (!db_get_s(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal)
@@ -118,7 +118,7 @@ void SetSessionMark(HANDLE hContact,int mode,char bit,unsigned int marknum) {
char* pszBuffer=NULL;
- if(mode==0)
+ if (mode==0)
{
DBVARIANT dbv;
if (!db_get_s(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal)
@@ -176,12 +176,12 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) char* pszBuffer=NULL;
char szFormNumBuf[255]={'\0'};
- if(ordernum<10)
+ if (ordernum<10)
mir_snprintf(szFormNumBuf, SIZEOF(szFormNumBuf), "%u%u", 0, ordernum);
else
mir_snprintf(szFormNumBuf, SIZEOF(szFormNumBuf), "%u", ordernum);
- if(mode==0)
+ if (mode==0)
{
DBVARIANT dbv;
if (!db_get_s(hContact, MODNAME, "LastSessionsOrder", &dbv))
@@ -196,7 +196,7 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) ZeroMemory(temp2,len-1);
temp = (char*)mir_alloc(len+1);
ZeroMemory(temp,len+1);
- if(ordernum<10)
+ if (ordernum<10)
{
strncpy( temp2, dbv.pszVal, len-2 );
temp2[len-2]='\0';
@@ -213,10 +213,10 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) mir_free(temp2);
db_free(&dbv);
}
- else if(writemode==1)
+ else if (writemode==1)
{
ZeroMemory(szFormNumBuf,SIZEOF(szFormNumBuf));
- if(ordernum<10)
+ if (ordernum<10)
mir_snprintf(szFormNumBuf, SIZEOF(szFormNumBuf), "%u%u%s", 0, ordernum, "000000000000000000");
else
mir_snprintf(szFormNumBuf, SIZEOF(szFormNumBuf), "%u%s", ordernum, "000000000000000000");
@@ -234,7 +234,7 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) char* temp=NULL;
char* temp2=NULL;
int len=0;
- if(strlen(dbv.pszVal)<(g_ses_count*2))
+ if (strlen(dbv.pszVal)<(g_ses_count*2))
{
pszBuffer = (char*)mir_alloc(g_ses_count*2+1);
ZeroMemory(pszBuffer,g_ses_count*2+1);
@@ -252,7 +252,7 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) temp = (char*)mir_alloc(advlen+1);
ZeroMemory(temp,advlen+1);
- if(ordernum<10)
+ if (ordernum<10)
mir_snprintf(temp, advlen+1, "%u%u%s", 0, ordernum, dbv.pszVal);
else
mir_snprintf(temp, advlen+1, "%u%s", ordernum, dbv.pszVal);
@@ -263,7 +263,7 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) mir_free(temp);
mir_free(pszBuffer);
}
- else if(writemode==1)
+ else if (writemode==1)
db_set_s(hContact, MODNAME, "UserSessionsOrder", szFormNumBuf);
else
db_set_s(hContact, MODNAME, "UserSessionsOrder", "00");
@@ -274,7 +274,7 @@ int GetInSessionOrder(HANDLE hContact,int mode,int count) {
int iOrder=0;
char szTemp[3]={'\0'};
- if(mode==0)
+ if (mode==0)
{
DBVARIANT dbv;
if (!db_get_s(hContact, MODNAME, "LastSessionsOrder", &dbv) && dbv.pszVal)
@@ -304,12 +304,12 @@ void SetInSessionOrder(HANDLE hContact,int mode,int count,unsigned int ordernum) int iOrder=0;
char szTemp[3]={'\0'};
- if(ordernum<10)
+ if (ordernum<10)
mir_snprintf(szTemp, SIZEOF(szTemp), "%u%u", 0, ordernum);
else
mir_snprintf(szTemp, SIZEOF(szTemp), "%u", ordernum);
- if(mode==0)
+ if (mode==0)
{
DBVARIANT dbv;
if (!db_get_s(hContact, MODNAME, "LastSessionsOrder", &dbv) && dbv.pszVal)
@@ -373,7 +373,7 @@ int AddToCurSession (DWORD wparam,LPARAM lparam) {
for (i=0;;i++)
{
- if(session_list[i]==0)
+ if (session_list[i]==0)
{
session_list[i]=wparam;
break;
@@ -388,7 +388,7 @@ int DelFromCurSession(DWORD wparam,LPARAM lparam) int i=0;
while(session_list[i]!=0)
{
- if(session_list[i]==wparam)
+ if (session_list[i]==wparam)
{
while(session_list[i+1]!=0)
{
@@ -419,66 +419,51 @@ int CheckForDuplicate(DWORD contact_list[],DWORD lparam) int LoadSessionToCombobox (HWND hdlg,BOOL mode,int iLimit,char* pszSetting,int iFirstNum)
{
- int ses_count=iFirstNum,i, index;
+ int ses_count=iFirstNum, index;
char szBuffer[256]={0};
- TCHAR *pszBuffer=NULL;
- if(session_list_recovered[0]&&!iFirstNum&&!mode)
- {
+ if (session_list_recovered[0] && !iFirstNum && !mode) {
index = SendDlgItemMessage(hdlg, IDC_LIST, CB_ADDSTRING, 0, (LPARAM)TranslateT("Session Before Last Crash"));
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETITEMDATA, (WPARAM)index, (LPARAM) 256);
}
- for(i=0;i < iLimit; i++)
- {
+ for(int i=0; i < iLimit; i++) {
mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s_%u", pszSetting, i);
- pszBuffer = DBGetStringT(NULL, MODNAME, szBuffer);
- if (pszBuffer)
- {
- if (!IsMarkedUserDefSession(i+iFirstNum)||mode==1)
- {
+ TCHAR *pszBuffer = db_get_tsa(NULL, MODNAME, szBuffer);
+ if (pszBuffer) {
+ if (!IsMarkedUserDefSession(i+iFirstNum)||mode==1) {
index = SendDlgItemMessage(hdlg, IDC_LIST, CB_ADDSTRING, 0, (LPARAM)pszBuffer);
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETITEMDATA, (WPARAM)index, (LPARAM) (DWORD)i+iFirstNum);
}
- else
- {
+ else {
SendDlgItemMessage(hdlg, IDC_LIST, CB_INSERTSTRING, 0, (LPARAM)pszBuffer);
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETITEMDATA, 0, (LPARAM) (DWORD)i+iFirstNum);
}
mir_free(pszBuffer);
- pszBuffer=NULL;
}
- else
- {
+ else {
if (i==0) ses_count=iLimit-iFirstNum;
break;
}
}
- if(pszBuffer)mir_free(pszBuffer);
+
return ses_count;
}
int FillFavoritesMenu (HMENU hMenu,int iLimit)
{
- int i, iItems=0;
- char szBuffer[256]={0};
- TCHAR *pszBuffer=NULL;
+ int iItems=0;
- for(i=0;i < iLimit; i++)
- {
- if(IsMarkedUserDefSession(i))
- {
+ for(int i=0;i < iLimit; i++) {
+ if (IsMarkedUserDefSession(i)) {
+ char szBuffer[256];
mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s_%u", "UserSessionDsc", i);
- pszBuffer = DBGetStringT(NULL, MODNAME, szBuffer);
- if ((pszBuffer = DBGetStringT(NULL, MODNAME, szBuffer)))
- {
+ TCHAR *pszBuffer = db_get_tsa(NULL, MODNAME, szBuffer);
+ if (pszBuffer) {
AppendMenu(hMenu,MF_STRING,i+1,pszBuffer);
iItems++;
- //TODO: test this
mir_free(pszBuffer);
- pszBuffer=NULL;
}
}
}
- if(pszBuffer) mir_free(pszBuffer);
return iItems;
}
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index a9f3881c10..47aa0738fd 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -286,7 +286,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, char szCname[40];
mir_snprintf(szCname, 40, "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
pContainer->settings->fPrivate = false;
- DBWriteContactSettingBlob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings));
+ db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings));
free(pContainer->settings);
}
pContainer->settings = &PluginConfig.globalContainerSettings;
@@ -378,7 +378,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (!IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) {
ReloadGlobalContainerSettings(true);
- ::DBWriteContactSettingBlob(0, SRMSGMOD_T, CNT_KEYNAME, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings));
+ ::db_set_blob(0, SRMSGMOD_T, CNT_KEYNAME, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings));
}
else {
char *szSetting = "CNTW_";
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index cb41598cc4..cd45ba992f 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -630,7 +630,7 @@ int CGlobals::OkToExit(WPARAM wParam, LPARAM lParam) CMimAPI::m_shutDown = true;
PluginConfig.globalContainerSettings.fPrivate = false;
- ::DBWriteContactSettingBlob(0, SRMSGMOD_T, CNT_KEYNAME, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings));
+ ::db_set_blob(0, SRMSGMOD_T, CNT_KEYNAME, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings));
#if defined(__USE_EX_HANDLERS)
}
__except(CGlobals::Ex_ShowDialog(GetExceptionInformation(), __FILE__, __LINE__, L"SHUTDOWN_STAGE1", false)) {
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index d572cafc2a..0ecf80e2d1 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -741,7 +741,7 @@ int Utils::ReadContainerSettingsFromDB(const HANDLE hContact, TContainerSettings int Utils::WriteContainerSettingsToDB(const HANDLE hContact, TContainerSettings *cs, const char *szKey)
{
- DBWriteContactSettingBlob(hContact, SRMSGMOD_T, szKey ? szKey : CNT_KEYNAME, cs, sizeof(TContainerSettings));
+ ::db_set_blob(hContact, SRMSGMOD_T, szKey ? szKey : CNT_KEYNAME, cs, sizeof(TContainerSettings));
return 0;
}
diff --git a/plugins/TopToolBar/src/topbutton.cpp b/plugins/TopToolBar/src/topbutton.cpp index d0d423f7e7..45a13b0dab 100644 --- a/plugins/TopToolBar/src/topbutton.cpp +++ b/plugins/TopToolBar/src/topbutton.cpp @@ -96,10 +96,10 @@ void TopButtonInt::LoadSettings() AS(buf2, "Launch", buf1);
mir_free(pszName);
- pszName = DBGetString(0, TTB_OPTDIR, AS(buf, buf2, "_name"));
+ pszName = db_get_sa(0, TTB_OPTDIR, AS(buf, buf2, "_name"));
mir_free(ptszProgram);
- ptszProgram = DBGetStringT(0, TTB_OPTDIR, AS(buf, buf2, "_lpath"));
+ ptszProgram = db_get_tsa(0, TTB_OPTDIR, AS(buf, buf2, "_lpath"));
arrangedpos = db_get_b(0, TTB_OPTDIR, AS(buf, buf2, "_Position"), Buttons.getCount());
if ( db_get_b(0, TTB_OPTDIR, AS(buf, buf2, "_Visible"), oldv) > 0 )
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index acd369ec6a..6d14bf7cb3 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -176,7 +176,7 @@ static TCHAR *parseDBProfilePath(ARGUMENTSINFO *ai) static TCHAR* getDBSetting(HANDLE hContact, char* module, char* setting, TCHAR* defaultValue)
{
DBVARIANT dbv;
- if (DBGetContactSettingW(hContact, module, setting, &dbv))
+ if (db_get_s(hContact, module, setting, &dbv, 0))
return defaultValue;
TCHAR* var = NULL;
diff --git a/plugins/YahooGroups/src/services.cpp b/plugins/YahooGroups/src/services.cpp index b896f5598f..5334e7f4a2 100644 --- a/plugins/YahooGroups/src/services.cpp +++ b/plugins/YahooGroups/src/services.cpp @@ -101,7 +101,7 @@ void AddNewGroup(char *newGroup) wchar_t wide[MAX_SIZE] = {0};
*wide = 1;
MultiByteToWideChar(currentCodePage, 0, group + 1, -1, wide + 1, MAX_SIZE - 1);
- DBWriteContactSettingWString(NULL, CLIST_GROUPS, tmp, wide);
+ db_set_ws(NULL, CLIST_GROUPS, tmp, wide);
availableGroups.Add(_strdup(group + 1));
}
@@ -111,7 +111,7 @@ void AddContactToGroup(HANDLE hContact, char *group) const int MAX_SIZE = 1024;
wchar_t wide[MAX_SIZE] = {0};
MultiByteToWideChar(currentCodePage, 0, group, -1, wide, MAX_SIZE);
- DBWriteContactSettingWString(hContact, "CList", "Group", wide);
+ db_set_ws(hContact, "CList", "Group", wide);
}
void CreateGroup(char *group)
diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index 0a77deb1e4..4c1022fd76 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -169,34 +169,28 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, int res = 1;
int len;
dbv.type = DBVT_WCHAR;
- if (DBGetContactSettingWString(hContact, szModule, szSettingName, &dbv) == 0)
- {
- res = 0;
- if (dbv.type != DBVT_WCHAR)
- {
- MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count);
- }
- else{
- int tmp = wcslen(dbv.pwszVal);
- len = (tmp < count - 1) ? tmp : count - 1;
- wcsncpy(szResult, dbv.pwszVal, len);
- szResult[len] = L'\0';
- }
- mir_free(dbv.pwszVal);
+ if ( db_get_s(hContact, szModule, szSettingName, &dbv, 0) == 0) {
+ res = 0;
+ if (dbv.type != DBVT_WCHAR)
+ MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count);
+ else {
+ int tmp = wcslen(dbv.pwszVal);
+ len = (tmp < count - 1) ? tmp : count - 1;
+ wcsncpy(szResult, dbv.pwszVal, len);
+ szResult[len] = L'\0';
}
- else{
- res = 1;
- if (szError)
- {
- int tmp = wcslen(szError);
- len = (tmp < count - 1) ? tmp : count - 1;
- wcsncpy(szResult, szError, len);
- szResult[len] = L'\0';
- }
- else{
- szResult[0] = L'\0';
- }
+ mir_free(dbv.pwszVal);
+ }
+ else {
+ res = 1;
+ if (szError) {
+ int tmp = wcslen(szError);
+ len = (tmp < count - 1) ? tmp : count - 1;
+ wcsncpy(szResult, szError, len);
+ szResult[len] = L'\0';
}
+ else szResult[0] = L'\0';
+ }
return res;
}
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index d6dbd885d2..8e3897e2d6 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -782,8 +782,8 @@ bool facebook_client::home( ) // Get real_name
this->self_.real_name = utils::text::source_get_value( &resp.data, 2, "<strong class=\"profileName\">", "</strong>" );
if (!this->self_.real_name.empty()) {
- DBWriteContactSettingUTF8String(NULL, parent->m_szModuleName, FACEBOOK_KEY_NAME, this->self_.real_name.c_str());
- DBWriteContactSettingUTF8String(NULL, parent->m_szModuleName, FACEBOOK_KEY_NICK, this->self_.real_name.c_str());
+ db_set_utf(NULL, parent->m_szModuleName, FACEBOOK_KEY_NAME, this->self_.real_name.c_str());
+ db_set_utf(NULL, parent->m_szModuleName, FACEBOOK_KEY_NICK, this->self_.real_name.c_str());
parent->Log(" Got self real name: %s", this->self_.real_name.c_str());
} else {
client_notify(TranslateT("Something happened to Facebook. Maybe there was some major update so you should wait for an update."));
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index c54060a049..abea7b8f49 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -120,8 +120,8 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_ if (strlen(new_name) > 0)
{
- DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, new_name);
- DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, new_name);
+ db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, new_name);
+ db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NICK, new_name);
}
db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, type);
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index f7a3a560f3..1d309b1160 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -33,8 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #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 getU8String( setting, dest ) db_get_utf( NULL, m_szModuleName, setting, dest )
+#define setU8String( setting, value ) db_set_utf( NULL, m_szModuleName, setting, value )
#define deleteSetting( setting ) db_unset( NULL, m_szModuleName, setting )
// DB keys
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index c1e4dcea1f..c362be15eb 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -97,8 +97,8 @@ void FacebookProto::ProcessBuddyList( void* data ) fbu->handle = AddToContactList(fbu, FACEBOOK_CONTACT_FRIEND);
if (!fbu->real_name.empty()) {
- DBWriteContactSettingUTF8String(fbu->handle,m_szModuleName,FACEBOOK_KEY_NAME,fbu->real_name.c_str());
- DBWriteContactSettingUTF8String(fbu->handle,m_szModuleName,FACEBOOK_KEY_NICK,fbu->real_name.c_str());
+ db_set_utf(fbu->handle,m_szModuleName,FACEBOOK_KEY_NAME,fbu->real_name.c_str());
+ db_set_utf(fbu->handle,m_szModuleName,FACEBOOK_KEY_NICK,fbu->real_name.c_str());
}
}
@@ -189,15 +189,15 @@ void FacebookProto::ProcessFriendList( void* data ) db_set_b(hContact, m_szModuleName, "Gender", fbu->gender);
// Update real name
- if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv))
+ if ( !db_get_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv))
{
update_required = strcmp( dbv.pszVal, fbu->real_name.c_str()) != 0;
db_free(&dbv);
}
if ( update_required )
{
- DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, fbu->real_name.c_str());
- DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str());
+ db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, fbu->real_name.c_str());
+ db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str());
}
if (db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) {
@@ -235,7 +235,7 @@ void FacebookProto::ProcessFriendList( void* data ) 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)) {
+ if ( !db_get_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) {
contactname = dbv.pszVal;
db_free(&dbv);
}
@@ -260,8 +260,8 @@ void FacebookProto::ProcessFriendList( void* data ) HANDLE hContact = AddToContactList(fbu, FACEBOOK_CONTACT_FRIEND, true); // This contact is surely new
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());
+ db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, fbu->real_name.c_str());
+ db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str());
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 );
}
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index 8acb72ce60..77c5e60e95 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -131,22 +131,23 @@ void AddTipperItem() for (i = 0; i < MAX_TIPPER_ITEM_PROP; i++)
ShiftTipperSettings(setting, itemCount, TipperItemProps[i]);
- #define WRITE_TIPPER_PROP(type, index, value)\
+ #define WRITE_TIPPER_PROPS(index, value)\
sprintf(setting, TipperItemProps[##index##], 0);\
- DBWriteContactSetting##type##(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
+ db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
+ #define WRITE_TIPPER_PROPB(index, value)\
+ sprintf(setting, TipperItemProps[##index##], 0);\
+ db_set_b(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
- WRITE_TIPPER_PROP(TString, 0, label);
- WRITE_TIPPER_PROP(Byte, 1, 0);
- WRITE_TIPPER_PROP(Byte, 2, 0);
- WRITE_TIPPER_PROP(Byte, 3, 0);
- WRITE_TIPPER_PROP(TString, 4, UNREAD_THREADS_RAW);
- WRITE_TIPPER_PROP(Byte, 5, 1);
-
- #undef WRITE_TIPPER_PROP
+ WRITE_TIPPER_PROPS(0, label);
+ WRITE_TIPPER_PROPB(1, 0);
+ WRITE_TIPPER_PROPB(2, 0);
+ WRITE_TIPPER_PROPB(3, 0);
+ WRITE_TIPPER_PROPS(4, UNREAD_THREADS_RAW);
+ WRITE_TIPPER_PROPB(5, 1);
}
__finally {
free(setting);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 3f8a29053c..78acff5c01 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -48,88 +48,88 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, dbv.type = DBVT_DELETED;
if (szModule == NULL) unspecified = 1;
- else unspecified = DBGetContactSettingW(hContact, szModule, szSetting, &dbv);
+ else unspecified = db_get(hContact, szModule, szSetting, &dbv);
if (!unspecified) {
switch (dbv.type) {
- case DBVT_BYTE:
- if (special == SVS_GENDER) {
- if (dbv.cVal == 'M') ptstr = TranslateT("Male");
- else if (dbv.cVal == 'F') ptstr = TranslateT("Female");
- else unspecified = 1;
- }
- else if (special == SVS_MONTH) {
- if (dbv.bVal > 0 && dbv.bVal <= 12) {
- ptstr = str;
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, str, SIZEOF(str));
- }
- else unspecified = 1;
- }
- else if (special == SVS_TIMEZONE) {
- if (dbv.cVal == -100) unspecified = 1;
- else {
- ptstr = str;
- mir_sntprintf(str, SIZEOF(str), dbv.cVal ? _T("GMT%+d:%02d") : _T("GMT"), -dbv.cVal / 2, (dbv.cVal & 1) * 30);
- }
- } else {
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0);
- ptstr = _itot(special == SVS_SIGNED ? dbv.cVal : dbv.bVal, str, 10);
- }
- break;
- case DBVT_WORD:
- if (special == SVS_COUNTRY) {
- char* pstr = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, dbv.wVal, 0);
- if (pstr == NULL){
- unspecified = 1;
- } else {
- ptstr = str;
- mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr);
- }
+ case DBVT_BYTE:
+ if (special == SVS_GENDER) {
+ if (dbv.cVal == 'M') ptstr = TranslateT("Male");
+ else if (dbv.cVal == 'F') ptstr = TranslateT("Female");
+ else unspecified = 1;
+ }
+ else if (special == SVS_MONTH) {
+ if (dbv.bVal > 0 && dbv.bVal <= 12) {
+ ptstr = str;
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, str, SIZEOF(str));
}
+ else unspecified = 1;
+ }
+ else if (special == SVS_TIMEZONE) {
+ if (dbv.cVal == -100) unspecified = 1;
else {
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0);
- ptstr = _itot(special == SVS_SIGNED ? dbv.sVal : dbv.wVal, str, 10);
+ ptstr = str;
+ mir_sntprintf(str, SIZEOF(str), dbv.cVal ? _T("GMT%+d:%02d") : _T("GMT"), -dbv.cVal / 2, (dbv.cVal & 1) * 30);
}
- break;
- case DBVT_DWORD:
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.dVal == 0);
- if (special == SVS_IP) {
- struct in_addr ia;
- ia.S_un.S_addr = htonl(dbv.dVal);
- char* pstr = inet_ntoa(ia);
- if (pstr == NULL){
- unspecified = 1;
- } else {
- ptstr = str;
- mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr);
- }
- if (dbv.dVal == 0) unspecified = 1;
- } else if (special == SVS_GGVERSION) {
+ } else {
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0);
+ ptstr = _itot(special == SVS_SIGNED ? dbv.cVal : dbv.bVal, str, 10);
+ }
+ break;
+ case DBVT_WORD:
+ if (special == SVS_COUNTRY) {
+ char* pstr = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, dbv.wVal, 0);
+ if (pstr == NULL){
+ unspecified = 1;
+ } else {
ptstr = str;
- mir_sntprintf(str, SIZEOF(str), _T("%S"), (char *)gg_version2string(dbv.dVal));
+ mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr);
+ }
+ }
+ else {
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0);
+ ptstr = _itot(special == SVS_SIGNED ? dbv.sVal : dbv.wVal, str, 10);
+ }
+ break;
+ case DBVT_DWORD:
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.dVal == 0);
+ if (special == SVS_IP) {
+ struct in_addr ia;
+ ia.S_un.S_addr = htonl(dbv.dVal);
+ char* pstr = inet_ntoa(ia);
+ if (pstr == NULL){
+ unspecified = 1;
} else {
- ptstr = _itot(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10);
+ ptstr = str;
+ mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr);
}
- break;
- case DBVT_ASCIIZ:
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
- ptstr = str;
- mir_sntprintf(str, SIZEOF(str), _T("%S"), dbv.pszVal);
- break;
- case DBVT_TCHAR:
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0');
- ptstr = dbv.ptszVal;
- break;
- case DBVT_UTF8:
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
- valT = mir_utf8decodeT(dbv.pszVal);
- ptstr = str;
- _tcscpy_s(str, SIZEOF(str), valT);
- mir_free(valT);
- break;
- default:
+ if (dbv.dVal == 0) unspecified = 1;
+ } else if (special == SVS_GGVERSION) {
ptstr = str;
- lstrcpy(str, _T("???"));
- break;
+ mir_sntprintf(str, SIZEOF(str), _T("%S"), (char *)gg_version2string(dbv.dVal));
+ } else {
+ ptstr = _itot(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10);
+ }
+ break;
+ case DBVT_ASCIIZ:
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
+ ptstr = str;
+ mir_sntprintf(str, SIZEOF(str), _T("%S"), dbv.pszVal);
+ break;
+ case DBVT_TCHAR:
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0');
+ ptstr = dbv.ptszVal;
+ break;
+ case DBVT_UTF8:
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
+ valT = mir_utf8decodeT(dbv.pszVal);
+ ptstr = str;
+ _tcscpy_s(str, SIZEOF(str), valT);
+ mir_free(valT);
+ break;
+ default:
+ ptstr = str;
+ lstrcpy(str, _T("???"));
+ break;
}
}
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index ea4604b167..fa34f586b8 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -333,7 +333,7 @@ bool Omegle_client::start() 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))
+ if (!db_get_utf(NULL, parent->m_szModuleName, OMEGLE_KEY_INTERESTS, &dbv))
{
std::string topics = dbv.pszVal;
std::string topic;
@@ -672,7 +672,7 @@ bool Omegle_client::events( ) // We got new stranger in this event, lets say him "Hi message" if enabled
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 )) {
+ if ( !db_get_utf( NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv )) {
std::string *message = new std::string(dbv.pszVal);
db_free(&dbv);
diff --git a/protocols/Omegle/src/db.h b/protocols/Omegle/src/db.h index 6543b9f2d8..355c0061ab 100644 --- a/protocols/Omegle/src/db.h +++ b/protocols/Omegle/src/db.h @@ -33,8 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #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 getU8String( setting, dest ) db_get_utf( NULL, m_szModuleName, setting, dest )
+#define setU8String( setting, value ) db_set_utf( NULL, m_szModuleName, setting, value )
#define deleteSetting( setting ) db_unset( NULL, m_szModuleName, setting )
// DB settings
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index 6b2e6c43d7..ff18001f25 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -137,7 +137,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,char**to) //wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- if(!DBGetContactSettingUTF8String(NULL, protocolname, temp,&dbv))
+ if(!db_get_utf(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
@@ -155,7 +155,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,int id,char**t //wert aus der dblesen
sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
- if(!DBGetContactSettingUTF8String(NULL, protocolname, temp,&dbv))
+ if(!db_get_utf(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
@@ -198,7 +198,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,int id,char*val //wert aus der dblesen
sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
- DBWriteContactSettingUTF8String(NULL, protocolname, temp,val);
+ db_set_utf(NULL, protocolname, temp,val);
}
//schreibt einen stringval in die db welche unterid hat
@@ -210,7 +210,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,char*val) //wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- DBWriteContactSettingUTF8String(NULL, protocolname, temp,val);
+ db_set_utf(NULL, protocolname, temp,val);
}
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 0c0a76ce4b..320b2cd4c3 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -1738,7 +1738,7 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan) if(strlen(xfc.nick)>0)
{
if(myClient->useutf8)
- DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", xfc.nick);
+ db_set_utf(hContact, protocolname, "Nick", xfc.nick);
else
db_set_s(hContact, protocolname, "Nick", mir_utf8decode(( char* )xfc.nick,NULL));
}
@@ -2772,7 +2772,7 @@ void setBuddyStatusMsg(BuddyListEntry *entry) db_free(&dbv);
}
}
- DBWriteContactSettingUTF8String(entry->hcontact, protocolname, "XStatusMsg", xstatus.str().c_str());
+ db_set_utf(entry->hcontact, protocolname, "XStatusMsg", xstatus.str().c_str());
}
else
{
@@ -2793,7 +2793,7 @@ void setBuddyStatusMsg(BuddyListEntry *entry) db_set_w(entry->hcontact, protocolname, "Status", status_id);
if (!entry->statusmsg.empty())
- DBWriteContactSettingUTF8String(entry->hcontact, "CList", "StatusMsg", entry->statusmsg.c_str());
+ db_set_utf(entry->hcontact, "CList", "StatusMsg", entry->statusmsg.c_str());
else
db_unset(entry->hcontact, "CList", "StatusMsg");
}
@@ -2884,7 +2884,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) if(nick)
{
if(myClient->useutf8)
- DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", nick);
+ db_set_utf(hContact, protocolname, "Nick", nick);
else
db_set_s(hContact, protocolname, "Nick", nick);
}
@@ -2892,7 +2892,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_set_s(hContact, protocolname, "Nick", entry->username.c_str());
//db_set_utf(hContact, protocolname, "Nick", entry->nick.c_str());
- //DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", ( char* )entry->nick.c_str());
+ //db_set_utf(hContact, protocolname, "Nick", ( char* )entry->nick.c_str());
} else
db_set_s(hContact, protocolname, "Nick", entry->username.c_str());
@@ -2903,7 +2903,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_unset(hContact, protocolname, "XStatusId");
db_unset(hContact, protocolname, "XStatusName");
db_unset(hContact, "CList", "StatusMsg");
- //DBWriteContactSettingUTF8String(hContact, protocolname, "XStatusName", "");
+ //db_set_utf(hContact, protocolname, "XStatusName", "");
db_unset(hContact, protocolname, "ServerIP");
db_unset(hContact, protocolname, "Port");
db_unset(hContact, protocolname, "VServerIP");
@@ -3067,7 +3067,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) //db_unset(hContact, "CList", "StatusMsg");
db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE);
- DBWriteContactSettingUTF8String(hContact, protocolname, "XStatusName", Translate("Playing"));
+ db_set_utf(hContact, protocolname, "XStatusName", Translate("Playing"));
setBuddyStatusMsg(entry);
db_set_b(hContact, protocolname, "XStatusId", xgamelist.iconmngr.getGameIconId(entry->game)+2);
@@ -3120,7 +3120,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) 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", "");
+ //db_set_utf(hContact, "CList", "StatusMsg", "");
db_unset(hContact, protocolname, "XStatusMsg");
db_unset(hContact, protocolname, "XStatusId");
db_unset(hContact, protocolname, "XStatusName");
@@ -3378,7 +3378,7 @@ static void SendAMAck( LPVOID param ) {
DBVARIANT dbv;
- if(!DBGetContactSettingUTF8String((HANDLE)param, protocolname, "XStatusMsg",&dbv))
+ if(!db_get_utf((HANDLE)param, protocolname, "XStatusMsg",&dbv))
{
ProtoBroadcastAck(protocolname, (HANDLE)param, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, LPARAM(dbv.pszVal));
}
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index fcd5827ffd..41f84eb7e7 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -210,16 +210,12 @@ int CYahooProto::Authorize( HANDLE hdbe ) /* Need to remove the buddy from our Miranda Lists */
HANDLE hContact = DbGetAuthEventContact(&dbei);
if (hContact != NULL) {
- char *who = DBGetString(hContact, m_szModuleName, YAHOO_LOGINID);
- if (!who) return 0;
-
- char *myid = DBGetString(hContact, m_szModuleName, "MyIdentity");
-
- DebugLog("Accepting buddy:%s", who);
- accept(myid, who, GetWord(hContact, "yprotoid", 0));
-
- mir_free(myid);
- mir_free(who);
+ mir_ptr<char> who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID));
+ if (who) {
+ mir_ptr<char> myid( db_get_sa(hContact, m_szModuleName, "MyIdentity"));
+ DebugLog("Accepting buddy:%s", who);
+ accept(myid, who, GetWord(hContact, "yprotoid", 0));
+ }
}
return 0;
@@ -259,19 +255,15 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) /* Need to remove the buddy from our Miranda Lists */
HANDLE hContact = DbGetAuthEventContact(&dbei);
if (hContact != NULL) {
- char *who = DBGetString(hContact, m_szModuleName, YAHOO_LOGINID);
- if (!who) return 0;
-
- char *myid = DBGetString(hContact, m_szModuleName, "MyIdentity");
- char *u_reason = mir_utf8encodeT(reason);
-
- DebugLog("Rejecting buddy:%s msg: %s", who, u_reason);
- reject(myid, who, GetWord(hContact, "yprotoid", 0), u_reason);
- CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
-
- mir_free(u_reason);
- mir_free(myid);
- mir_free(who);
+ mir_ptr<char> who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID));
+ if (who) {
+ mir_ptr<char> myid( db_get_sa(hContact, m_szModuleName, "MyIdentity"));
+ mir_ptr<char> u_reason( mir_utf8encodeT(reason));
+
+ DebugLog("Rejecting buddy:%s msg: %s", who, u_reason);
+ reject(myid, who, GetWord(hContact, "yprotoid", 0), u_reason);
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
+ }
}
return 0;
}
diff --git a/src/core/stduserinfo/stdinfo.cpp b/src/core/stduserinfo/stdinfo.cpp index 033cb23cac..9858bf59b1 100644 --- a/src/core/stduserinfo/stdinfo.cpp +++ b/src/core/stduserinfo/stdinfo.cpp @@ -78,7 +78,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, else if (proto_service)
unspecified = Proto_GetContactInfoSetting(hContact, szProto, szModule, szSetting, &dbv, 0);
else
- unspecified = DBGetContactSettingW(hContact, szModule, szSetting, &dbv);
+ unspecified = db_get_s(hContact, szModule, szSetting, &dbv, 0);
if ( !unspecified) {
switch(dbv.type) {
diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index 5877bb9949..97d8c745e9 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -100,7 +100,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)lphGroupsItems[i], 0);
lphGroupsItems.destroy();
- TCHAR *szContactGroup = DBGetStringT((HANDLE)wParam, "CList", "Group");
+ mir_ptr<TCHAR> szContactGroup( db_get_tsa((HANDLE)wParam, "CList", "Group"));
int pos = 1000;
@@ -123,15 +123,12 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) mir_free(dbv.ptszVal);
}
- for (i=0; i < groups.getCount(); i++)
- {
+ for (i=0; i < groups.getCount(); i++) {
bool checked = szContactGroup && !_tcscmp(szContactGroup, groups[i].name);
AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked);
}
groups.destroy();
- mir_free(szContactGroup);
-
return 0;
}
|