From 0ea13a4872aa7bace03f5a638ae4dd8173f52fb8 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Thu, 31 May 2012 18:31:22 +0000 Subject: Goodbye Dbrw git-svn-id: http://svn.miranda-ng.org/main/trunk@248 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbrw/dbrw.c | 340 ---------------------------------------------------- 1 file changed, 340 deletions(-) delete mode 100644 plugins/Dbrw/dbrw.c (limited to 'plugins/Dbrw/dbrw.c') diff --git a/plugins/Dbrw/dbrw.c b/plugins/Dbrw/dbrw.c deleted file mode 100644 index 94ba1543f7..0000000000 --- a/plugins/Dbrw/dbrw.c +++ /dev/null @@ -1,340 +0,0 @@ -/* -dbRW - -Copyright (c) 2005-2009 Robert Rainwater - -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; either version 2 -of the License, or (at your option) any later version. - -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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "dbrw.h" - -PLUGININFOEX pluginInfo = { - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCR SQLITE_VERSION, - __AUTHOR, - __AUTHOREMAIL, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - DEFMOD_DB, - {0xf3ca0e5e, 0x249a, 0x40f0, {0x8d, 0x74, 0x80, 0xa8, 0xe, 0xf0, 0xc8, 0x3d}} // {F3CA0E5E-249A-40f0-8D74-80A80EF0C83D} -}; - -HINSTANCE g_hInst; - -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; -struct LIST_INTERFACE li; -int hLangpack; - -sqlite3 *g_sqlite; -char g_szDbPath[MAX_PATH]; -HANDLE hSettingChangeEvent; -HANDLE hContactDeletedEvent; -HANDLE hContactAddedEvent; -HANDLE hEventFilterAddedEvent; -HANDLE hEventAddedEvent; -HANDLE hEventDeletedEvent; -PLUGINLINK *pluginLink; - - -enum { - DBRW_TABLE_SETTINGS = 0, - DBRW_TABLE_CONTACTS, - DBRW_TABLE_EVENTS, - DBRW_TABLE_CORE, - DBRW_TABLE_COUNT -}; -char *dbrw_tables[DBRW_TABLE_COUNT] = { -"create table dbrw_settings (id integer, module varchar(255), setting varchar(255), type integer, val any, primary key(id,module,setting));", -"create table dbrw_contacts (id integer primary key,createtime integer);", -"create table dbrw_events (id integer primary key,eventtime integer,flags integer,eventtype integer, blob any, blobsize integer, contactid integer,modulename varchar(255),inserttime integer);", -"create table dbrw_core (setting varchar(255) primary key not null, val any);" -}; - -static int dbrw_getCaps(int flags); -static int dbrw_getFriendlyName(char *buf, size_t cch, int shortName); -static int dbrw_makeDatabase(char *profile, int *error); -static int dbrw_grokHeader(char *profile, int *error); -static int dbrw_Load(char *profile, void *link); -static int dbrw_Unload(int wasLoaded); - -DATABASELINK dblink = { - sizeof(DATABASELINK), - dbrw_getCaps, - dbrw_getFriendlyName, - dbrw_makeDatabase, - dbrw_grokHeader, - dbrw_Load, - dbrw_Unload -}; - -char* utf8_encode(const char* src) { - size_t len; - char* result; - wchar_t* tempBuf; - - if (src==NULL) - return NULL; - len = strlen(src); - result = (char*)malloc(len*3+1); - if (result==NULL) - return NULL; - tempBuf = (wchar_t*)alloca((len+1)*sizeof(wchar_t)); - MultiByteToWideChar(CP_ACP, 0, src, -1, tempBuf, (int)len); - tempBuf[len] = 0; - { - wchar_t* s = tempBuf; - BYTE* d = (BYTE*)result; - - while(*s) { - int U = *s++; - - if (U<0x80) { - *d++ = (BYTE)U; - } - else if (U<0x800) { - *d++ = 0xC0+((U>>6)&0x3F); - *d++ = 0x80+(U&0x003F); - } - else { - *d++ = 0xE0+(U>>12); - *d++ = 0x80+((U>>6)&0x3F); - *d++ = 0x80+(U&0x3F); - } - } - *d = 0; - } - return result; -} - -static int dbrw_getCaps(int flags) { - return 0; -} - -static int dbrw_getFriendlyName(char *buf, size_t cch, int shortName) { - strncpy(buf, shortName?"dbRW Driver":pluginInfo.shortName, cch); - return 0; -} - -static int dbrw_makeDatabase(char *profile, int *error) { - sqlite3 *sql = NULL; - int rc; - char *szPath = utf8_encode(profile); - - rc = sqlite3_open(szPath, &sql); - free(szPath); - if (rc==SQLITE_OK) { - int x; - - sqlite3_exec(sql, "PRAGMA page_size = 8192;", NULL, NULL, NULL); - for (x=0;x