diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-29 05:38:03 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-29 05:38:03 +0000 |
commit | af7e438cfe8ce85e1da234318ed1584e89d952cc (patch) | |
tree | 4cdb1379ef8d6c00389aa89cfb27a404ae2aba56 /plugins/FTPFileYM/mir_db.cpp | |
parent | 230623d50baff4e8bf13a8572e0b895bad7b7ed4 (diff) |
only add some plugins and protocols, not adapted
See please maybe not all need us
git-svn-id: http://svn.miranda-ng.org/main/trunk@678 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FTPFileYM/mir_db.cpp')
-rw-r--r-- | plugins/FTPFileYM/mir_db.cpp | 198 |
1 files changed, 198 insertions, 0 deletions
diff --git a/plugins/FTPFileYM/mir_db.cpp b/plugins/FTPFileYM/mir_db.cpp new file mode 100644 index 0000000000..1a466f7863 --- /dev/null +++ b/plugins/FTPFileYM/mir_db.cpp @@ -0,0 +1,198 @@ +/*
+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 "mir_db.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;
+}
+
|