From b5ecb07dcf78667db73b8fad9480118b4c009f8b Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Wed, 4 Jul 2012 07:14:19 +0000 Subject: Changed to support latest PluginInfoEx structure git-svn-id: http://svn.miranda-ng.org/main/trunk@748 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ImportTXT/BICQ6IP(ADO).inc | 103 ++++++++++++++++++++++++++++++++++ plugins/ImportTXT/ImportThrd.pas | 2 +- plugins/ImportTXT/importtxt.dpr | 27 ++++----- plugins/Pascal_Headers/interfaces.inc | 1 - plugins/Pascal_Headers/m_api.pas | 5 +- plugins/Pascal_Headers/m_plugins.inc | 46 --------------- plugins/ShlExt/shlext.dpr | 1 - 7 files changed, 117 insertions(+), 68 deletions(-) create mode 100644 plugins/ImportTXT/BICQ6IP(ADO).inc (limited to 'plugins') diff --git a/plugins/ImportTXT/BICQ6IP(ADO).inc b/plugins/ImportTXT/BICQ6IP(ADO).inc new file mode 100644 index 0000000000..b4c85e5d05 --- /dev/null +++ b/plugins/ImportTXT/BICQ6IP(ADO).inc @@ -0,0 +1,103 @@ +{$IFDEF BIN_IMPORT_} + +var + QR1: TADOQuery; + +var + OneContact: boolean; + flags: integer; + timestamp: LongWord; + Msg: AnsiString; + ADOConnection:TADOConnection; + +function FindUIDinDB(too: string): string; +var + QR2: TADOQuery; +begin + QR2 := TADOQuery.Create(nil); + QR2.Connection := ADOConnection; + QR2.SQL.Text := 'select to, UID from ChatHistory WHERE to=' + too; + QR2.Open; + QR2.First; + result := QR2.FieldByName('UID').AsString; + QR2.Close; + QR2.Free; +end; + +{$ELSE} + +begin + DoUnMapFile; + OneContact := (DContact.hContact <> 0) and (DContact.hContact <> INVALID_HANDLE_VALUE); + try +// coInitialize(nil); + ADOConnection:=TADOConnection.Create(nil); + ADOConnection.Connected:=false; + ADOConnection.LoginPrompt:=false; + ADOConnection.Provider:='Microsoft.Jet.OLEDB.4.0'; + ADOConnection.ConnectionString := + 'User ID=Admin;' + + 'Data Source=' + FileName + + ';Mode=Share Deny None;' + + 'Extended Properties="";' + + 'Locale Identifier=1033;' + + 'Persist Security Info=False;'; + + ADOConnection.Connected:=true; + + QR1 := TADOQuery.Create(nil); + QR1.Connection := ADOConnection; + QR1.SQL.Text := 'SELECT Messages.from, date, to, type, subType, subject FROM Messages'; + QR1.Open; + if (QR1.FieldCount = 7) then + begin + DoMessage(ITXT_THREAD_START, 0, 0); + QR1.First; + DoMessage(ITXT_THREAD_MAXPROGRESS, 0, QR1.RecordCount); + While not QR1.EOF do + begin + try + if (QR1.FieldByName('type').AsString = 'Text') and + (QR1.FieldByName('subType').AsString = 'IM') then + begin + UIDStr := FindUIDinDB(QR1.FieldByName('to').AsString); + if not OneContact then + begin + DContact.ContactUID := UIDStr; + TryDetermContact(DContact); + end; + if (DContact.hContact <> 0) and + (DContact.hContact <> INVALID_HANDLE_VALUE) then + begin + if QR1.Fields[1].AsString = '' then + flags := DBEF_READ or DBEF_UTF or DBEF_SENT + else + flags := DBEF_READ or DBEF_UTF; + timestamp := DateTimeToTimeStamp(QR1.FieldByName('date').AsDateTime - 693594); + Msg := QR1.FieldByName('subject').AsString; + tempstr := ANSIToUTF8(PAnsiChar(Msg), tempstr, cp); + Msg := tempstr; + FreeMem(tempstr); + AddMsgToDB(DContact.hContact, flags, timestamp, Msg, AddedMessages, Duplicates); + end; + end; + except + ShowException(ExceptObject, ExceptAddr) + end; + QR1.Next; + DoMessage(ITXT_THREAD_PROGRESS, QR1.RecNo, 0); + end; // for + end + else + begin + s := WideFormat(TranslateWideString('Its not %s file'), ['ICQ6 mdb']); + DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0); + end; + finally + QR1.Close; + QR1.Free; + ADOConnection.Close; + ADOConnection.Free; + end; +end; +{$ENDIF} diff --git a/plugins/ImportTXT/ImportThrd.pas b/plugins/ImportTXT/ImportThrd.pas index 245276c040..2742ccd63e 100644 --- a/plugins/ImportTXT/ImportThrd.pas +++ b/plugins/ImportTXT/ImportThrd.pas @@ -12,7 +12,7 @@ uses general, ImportT, ImportTU, - KOLEdb; + KOLEdb {ADODB if want to use ADO}; const ITXT_THREAD_BASE = $8000 + $2000; // WM_APP + $2000 diff --git a/plugins/ImportTXT/importtxt.dpr b/plugins/ImportTXT/importtxt.dpr index 5fea1c6a2b..5cc6d12864 100644 --- a/plugins/ImportTXT/importtxt.dpr +++ b/plugins/ImportTXT/importtxt.dpr @@ -42,20 +42,7 @@ uses {$R imptxt_ver.res} -const - PluginInfo:TPLUGININFOEX=( - cbSize :sizeof(TPLUGININFOEX); - shortName :'Import TXT'; - version :$0000010A; - description:'Imports history saved in TXT files from other clients.'; - author :'Abyss'; - authorEmail:'abyss.andrey@gmail.com'; - copyright :'(C)2008 Abyss'; - homepage :'none'; - flags :UNICODE_AWARE; - replacesDefaultModule:0; - uuid:'{6F376B33-D3F4-4c4f-A96B-77DA08043B06}'; - ); +const MIID_IMPORTTEXT:TGUID = '{6F376B33-D3F4-4c4f-A96B-77DA08043B06}'; // Updater compatibility data const @@ -78,8 +65,18 @@ var function MirandaPluginInfoEx(mirandaVersion:DWORD):PPLUGININFOEX; cdecl; begin + PluginInfo.cbSize :=sizeof(TPLUGININFOEX); + PluginInfo.shortName :='Import TXT'; + PluginInfo.version :=$0000010A; + PluginInfo.description:='Imports history saved in TXT files from other clients.'; + PluginInfo.author :='Abyss'; + PluginInfo.authorEmail:='abyss.andrey@gmail.com'; + PluginInfo.copyright :='(C)2008 Abyss'; + PluginInfo.homepage :='none'; + PluginInfo.flags :=UNICODE_AWARE; + PluginInfo.uuid :=MIID_IMPORTTEXT; + result := @PluginInfo; - // PluginInfo.cbSize:=SizeOf(TPLUGININFOEX); end; function ContactMenuCommand(wParam: wParam; lParam: lParam): int_ptr; cdecl; diff --git a/plugins/Pascal_Headers/interfaces.inc b/plugins/Pascal_Headers/interfaces.inc index ca4466271a..fd40e34582 100644 --- a/plugins/Pascal_Headers/interfaces.inc +++ b/plugins/Pascal_Headers/interfaces.inc @@ -12,7 +12,6 @@ const MIID_TRANSLATE :MUUID='{0C0954EA-43D7-4452-99AC-F084D4456716}'; // Replaceable internal modules interface ids const MIID_HISTORY :MUUID='{5CA0CBC1-999A-4EA2-8B44-F8F67D7F8EBE}'; -const MIID_UIFINDADD :MUUID='{B22C528D-6852-48EB-A294-0E26A9161213}'; const MIID_UIUSERINFO :MUUID='{570B931C-9AF8-48F1-AD9F-C4498C618A77}'; const MIID_SRURL :MUUID='{5192445C-F5E8-46C0-8F9E-2B6D43E5C753}'; const MIID_SRAUTH :MUUID='{377780B9-2B3B-405B-9F36-B3C4878E6F33}'; diff --git a/plugins/Pascal_Headers/m_api.pas b/plugins/Pascal_Headers/m_api.pas index c8692b16db..33e27b3158 100644 --- a/plugins/Pascal_Headers/m_api.pas +++ b/plugins/Pascal_Headers/m_api.pas @@ -120,10 +120,7 @@ type copyright :PAnsiChar; homepage :PAnsiChar; flags :Byte; // right now the only flag, UNICODE_AWARE, is recognized here - { one of the DEFMOD_* consts in m_plugin or zero, if non zero, this will - suppress loading of the specified builtin module } - replacesDefaultModule: int; - uuid :MUUID; // Not required until 0.8. + uuid :MUUID; // plugin's unique identifier end; //----- Fork enchancement ----- diff --git a/plugins/Pascal_Headers/m_plugins.inc b/plugins/Pascal_Headers/m_plugins.inc index cb8f346f2b..bb88804666 100644 --- a/plugins/Pascal_Headers/m_plugins.inc +++ b/plugins/Pascal_Headers/m_plugins.inc @@ -43,50 +43,4 @@ type const MS_PLUGINS_ENUMDBPLUGINS:PAnsiChar = 'Plugins/DbEnumerate'; -const -// DEFMOD_PROTOCOLICQ = 1; // removed from v0.3.0.0 alpha -// DEFMOD_PROTOCOLMSN = 2; // removed from v0.1.2.0+ - DEFMOD_UIFINDADD = 3; - DEFMOD_UIUSERINFO = 4; - DEFMOD_SRMESSAGE = 5; // removed from v0.3.3a (temp) - DEFMOD_SRURL = 6; - DEFMOD_SREMAIL = 7; - DEFMOD_SRAUTH = 8; - DEFMOD_SRFILE = 9; - DEFMOD_UIHELP = 10; - DEFMOD_UIHISTORY = 11; -// DEFMOD_RNDCHECKUPD = 12; // removed from v0.3.1 alpha -// DEFMOD_RNDICQIMPORT = 13; // not built in to v0.1.0.1+ (removed from v0.3 alpha) - DEFMOD_RNDAUTOAWAY = 14; - DEFMOD_RNDUSERONLINE = 15; -// DEFMOD_RNDCRYPT = 16; // v0.1.0.1-v0.1.2.0 - DEFMOD_SRAWAY = 17; // v0.1.0.1+ - DEFMOD_RNDIGNORE = 18; // v0.1.0.1+ - DEFMOD_UIVISIBILITY = 19; // v0.1.1.0+, options page only - DEFMOD_UICLUI = 20; // v0.1.1.0+ -// DEFMOD_UIPLUGINOPTS = 21; // v0.1.2.1+ removed from 0.4.0.1 -// DEFMOD_PROTOCOLNETLIB = 22; // v0.1.2.2+ removed from 0.8.0.5 - DEFMOD_RNDIDLE = 23; // v0.3.4a+ - DEFMOD_CLISTALL = 24; // v0.3.4a+ (2004/09/28) - DEFMOD_DB = 25; // v0.3.4.3+ (2004/10/11) -// DEFMOD_FONTSERVICE = 26; // v0.7.0+ (2006/11/17) - DEFMOD_UPDATENOTIFY = 27; -// DEFMOD_ICOLIB = 27; // v0.7.0+ (2006/11/24) - DEFMOD_SSL = 28; // v0.8.0+ - - DEFMOD_HIGHEST = 28; - - { - wParam : 0 - lParam : 0 - Affect : Gets an array of modules that the plugins report they want to replace - Returns: Returns a pointer to an array of int_ptr, with elements 1 or 0, - indexed by the DEFMOD_* constants, 1 is to mark that the default - module shouldn't be loaded, see notes - Notes : this is primarily for use by the core's module initialiser, - but could also be used by modules that are doing - naughty things that are very feature-dependent. - } - MS_PLUGINS_GETDISABLEDEFAULTARRAY:PAnsiChar = 'Plugins/GetDisableDefaultArray'; - {$ENDIF} diff --git a/plugins/ShlExt/shlext.dpr b/plugins/ShlExt/shlext.dpr index 792ed74f90..d8745532f2 100644 --- a/plugins/ShlExt/shlext.dpr +++ b/plugins/ShlExt/shlext.dpr @@ -361,7 +361,6 @@ begin PluginInfo.copyright := '(c) 2009 Sam Kothari (egoDust)'; PluginInfo.homePage := 'http://addons.miranda-im.org/details.php?action=viewfile&id=534'; PluginInfo.flags := 0; - PluginInfo.replacesDefaultModule := 0; { This UUID is fetched twice } CopyMemory(@PluginInfo.uuid, @CLSID_ISHLCOM, sizeof(TMUUID)); { return info } -- cgit v1.2.3