1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
/*
FTP File YM plugin
Copyright (C) 2007-2010 Jan Holub
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common.h"
int DB::setByte(HANDLE hContact, char *szModule, char *szSetting, int iValue)
{
return DBWriteContactSettingByte(hContact, szModule, szSetting, iValue);
}
int DB::setByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return setByte(hContact, szModule, formSet, iValue);
}
int DB::setWord(HANDLE hContact, char *szModule, char *szSetting, int iValue)
{
return DBWriteContactSettingWord(hContact, szModule, szSetting, iValue);
}
int DB::setWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return setWord(hContact, szModule, formSet, iValue);
}
int DB::setDword(HANDLE hContact, char *szModule, char *szSetting, int iValue)
{
return DBWriteContactSettingDword(hContact, szModule, szSetting, iValue);
}
int DB::setDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return setDword(hContact, szModule, formSet, iValue);
}
int DB::setAString(HANDLE hContact, char *szModule, char *szSetting, char *szValue)
{
return DBWriteContactSettingString(hContact, szModule, szSetting, szValue);
}
int DB::setAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, char *szValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return setAString(hContact, szModule, formSet, szValue);
}
int DB::setString(HANDLE hContact, char *szModule, char *szSetting, TCHAR *stzValue)
{
return DBWriteContactSettingTString(hContact, szModule, szSetting, stzValue);
}
int DB::setStringF(HANDLE hContact, char *szModule, char *szSetting, int id, TCHAR *stzValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return setString(hContact, szModule, formSet, stzValue);
}
int DB::setCryptedString(HANDLE hContact, char *szModule, char *szSetting, char *szValue)
{
char buff[256];
strcpy(buff, szValue);
CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)sizeof(buff), (LPARAM)buff);
return setAString(hContact, szModule, szSetting, buff);
}
int DB::getByte(HANDLE hContact, char *szModule, char *szSetting, int iErrorValue)
{
return DBGetContactSettingByte(hContact, szModule, szSetting, iErrorValue);
}
int DB::getByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return getByte(hContact, szModule, formSet, iErrorValue);
}
int DB::getWord(HANDLE hContact, char *szModule, char *szSetting, int iErrorValue)
{
return DBGetContactSettingWord(hContact, szModule, szSetting, iErrorValue);
}
int DB::getWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return getWord(hContact, szModule, formSet, iErrorValue);
}
int DB::getDword(HANDLE hContact, char *szModule, char *szSetting, int iErrorValue)
{
return DBGetContactSettingDword(hContact, szModule, szSetting, iErrorValue);
}
int DB::getDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return getDword(hContact, szModule, formSet, iErrorValue);
}
int DB::getAString(HANDLE hContact, char *szModule, char *szSetting, char *buff)
{
DBVARIANT dbv;
if (!DBGetContactSettingString(hContact, szModule, szSetting, &dbv))
{
strcpy(buff, dbv.pszVal);
DBFreeVariant(&dbv);
return 0;
}
buff[0] = 0;
return 1;
}
int DB::getAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, char *buff)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return getAString(hContact, szModule, formSet, buff);
}
int DB::getString(HANDLE hContact, char *szModule, char *szSetting, TCHAR *buff)
{
DBVARIANT dbv;
if (!DBGetContactSettingTString(hContact, szModule, szSetting, &dbv))
{
_tcscpy(buff, dbv.ptszVal);
DBFreeVariant(&dbv);
return 0;
}
buff[0] = 0;
return 1;
}
int DB::getStringF(HANDLE hContact, char *szModule, char *szSetting, int id, TCHAR *buff)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return getString(hContact, szModule, formSet, buff);
}
int DB::getCryptedString(HANDLE hContact, char *szModule, char *szSetting, char *szValue)
{
char buff[256];
if (!getAString(hContact, szModule, szSetting, buff))
{
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)sizeof(buff), (LPARAM)buff);
strcpy(szValue, buff);
return 0;
}
szValue[0] = 0;
return 1;
}
int DB::deleteSetting(HANDLE hContact, char *szModule, char *szSetting)
{
return DBDeleteContactSetting(hContact, szModule, szSetting);
}
int DB::deleteSettingF(HANDLE hContact, char *szModule, char *szSetting, int id)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
return deleteSetting(hContact, szModule, formSet);
}
char *DB::getProto(HANDLE hContact)
{
char *szProto = GetContactProto(hContact);
return ((INT_PTR)szProto != CALLSERVICE_NOTFOUND) ? szProto : NULL;
}
|