summaryrefslogtreecommitdiff
path: root/plugins/FTPFileYM/src/mir_db.cpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-10-12 11:29:22 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-10-12 11:29:22 +0000
commit8473fb7c85680042038cc0ad40d4e22bb6a639e7 (patch)
tree3c0e0d3ddd863528e60dd98421d2129a22bd8e0d /plugins/FTPFileYM/src/mir_db.cpp
parent557f2816f5cd30705dec989c97a8a67c026d36d1 (diff)
FTPFileYM: folders restructurization
git-svn-id: http://svn.miranda-ng.org/main/trunk@1885 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FTPFileYM/src/mir_db.cpp')
-rw-r--r--plugins/FTPFileYM/src/mir_db.cpp197
1 files changed, 197 insertions, 0 deletions
diff --git a/plugins/FTPFileYM/src/mir_db.cpp b/plugins/FTPFileYM/src/mir_db.cpp
new file mode 100644
index 0000000000..f5745d9f24
--- /dev/null
+++ b/plugins/FTPFileYM/src/mir_db.cpp
@@ -0,0 +1,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 = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ return ((INT_PTR)szProto != CALLSERVICE_NOTFOUND) ? szProto : NULL;
+} \ No newline at end of file