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 /plugins/DbEditorPP/src | |
| 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
Diffstat (limited to 'plugins/DbEditorPP/src')
| -rw-r--r-- | plugins/DbEditorPP/src/copymodule.cpp | 33 | ||||
| -rw-r--r-- | plugins/DbEditorPP/src/findwindow.cpp | 2 | ||||
| -rw-r--r-- | plugins/DbEditorPP/src/main.cpp | 2 | ||||
| -rw-r--r-- | plugins/DbEditorPP/src/modules.cpp | 2 | ||||
| -rw-r--r-- | plugins/DbEditorPP/src/settinglist.cpp | 306 | 
5 files changed, 162 insertions, 183 deletions
| 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])
  						}
 | 
