From 3e577372cab9dde2981fb4ac143cacce0419b069 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Thu, 5 Jul 2012 12:35:02 +0000 Subject: m_api: hide hLangpack from interface part History++ small cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@770 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_api.pas | 6 +- plugins/HistoryPlusPlus/GlobalSearch.pas | 2 +- plugins/HistoryPlusPlus/HistoryControls.pas | 2 +- plugins/HistoryPlusPlus/HistoryControls_Design.pas | 2 - plugins/HistoryPlusPlus/HistoryForm.pas | 2 +- plugins/HistoryPlusPlus/HistoryGrid.pas | 4 - plugins/HistoryPlusPlus/historypp.dpr | 17 +-- plugins/HistoryPlusPlus/hpp_events.pas | 170 +++++++++------------ plugins/HistoryPlusPlus/hpp_external.pas | 2 +- plugins/HistoryPlusPlus/hpp_externalgrid.pas | 2 +- plugins/HistoryPlusPlus/hpp_global.pas | 60 ++++---- plugins/HistoryPlusPlus/hpp_itemprocess.pas | 9 +- plugins/HistoryPlusPlus/hpp_mescatcher.pas | 1 - plugins/HistoryPlusPlus/hpp_options.pas | 30 ++-- 14 files changed, 138 insertions(+), 171 deletions(-) diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas index b818a41cc8..56bbe9cf3b 100644 --- a/include/delphi/m_api.pas +++ b/include/delphi/m_api.pas @@ -83,9 +83,6 @@ type true: (w:PWideChar); // Unicode end; -const - hLangpack:THANDLE = 0; - {$include m_core.inc} {$include m_system.inc} @@ -282,6 +279,9 @@ var implementation +const + hLangpack:THANDLE = 0; + {$undef M_API_UNIT} {$include m_helpers.inc} {$include m_clistint.inc} diff --git a/plugins/HistoryPlusPlus/GlobalSearch.pas b/plugins/HistoryPlusPlus/GlobalSearch.pas index 0294f6124d..83d878289e 100644 --- a/plugins/HistoryPlusPlus/GlobalSearch.pas +++ b/plugins/HistoryPlusPlus/GlobalSearch.pas @@ -398,7 +398,7 @@ uses hpp_options, PassForm, hpp_itemprocess, hpp_messages, CustomizeFiltersForm; {$R *.DFM} -{$include inc\m_speak.inc} +{$include m_speak.inc} function TfmGlobalSearch.AddContact(hContact: THandle): THPPContactInfo; var diff --git a/plugins/HistoryPlusPlus/HistoryControls.pas b/plugins/HistoryPlusPlus/HistoryControls.pas index e0da805ab6..c4035dba8a 100644 --- a/plugins/HistoryPlusPlus/HistoryControls.pas +++ b/plugins/HistoryPlusPlus/HistoryControls.pas @@ -21,7 +21,7 @@ unit HistoryControls; -{$I compilers.inc} +{$define THEME_7_UP} interface diff --git a/plugins/HistoryPlusPlus/HistoryControls_Design.pas b/plugins/HistoryPlusPlus/HistoryControls_Design.pas index 1f0c018d8f..4c0a90e85e 100644 --- a/plugins/HistoryPlusPlus/HistoryControls_Design.pas +++ b/plugins/HistoryPlusPlus/HistoryControls_Design.pas @@ -21,8 +21,6 @@ unit HistoryControls_Design; -{$I compilers.inc} - interface procedure Register; diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas index e6e83eb404..fb523319f8 100644 --- a/plugins/HistoryPlusPlus/HistoryForm.pas +++ b/plugins/HistoryPlusPlus/HistoryForm.pas @@ -475,7 +475,7 @@ uses EventDetailForm, PassForm, hpp_options, hpp_services, hpp_eventfilters, {$R *.DFM} -{$include inc\m_speak.inc} +{$include m_speak.inc} const HPP_SESS_YEARFORMAT = 'yyyy'; diff --git a/plugins/HistoryPlusPlus/HistoryGrid.pas b/plugins/HistoryPlusPlus/HistoryGrid.pas index 2dec9ab957..254c65b0aa 100644 --- a/plugins/HistoryPlusPlus/HistoryGrid.pas +++ b/plugins/HistoryPlusPlus/HistoryGrid.pas @@ -70,8 +70,6 @@ unit HistoryGrid; -{$I compilers.inc} - interface {$DEFINE CUST_SB} @@ -807,8 +805,6 @@ procedure Register; implementation -{$I compilers.inc} - uses hpp_options, hpp_arrays, hpp_strparser, ComObj; diff --git a/plugins/HistoryPlusPlus/historypp.dpr b/plugins/HistoryPlusPlus/historypp.dpr index f4716c5024..adba99a1cb 100644 --- a/plugins/HistoryPlusPlus/historypp.dpr +++ b/plugins/HistoryPlusPlus/historypp.dpr @@ -29,12 +29,10 @@ library historypp; {$R 'hpp_res_ver.res' 'hpp_res_ver.rc'} {$R 'hpp_opt_dialog.res' 'hpp_opt_dialog.rc'} -{$I compilers.inc} - uses Windows, SysUtils, - m_api in '..\inc\m_api.pas', + m_api, Forms, hpp_global in 'hpp_global.pas', hpp_contacts in 'hpp_contacts.pas', @@ -165,11 +163,11 @@ end; function Load():Integer; cdecl; begin - CallService(MS_LANGPACK_REGISTER,WPARAM(@hLangpack),LPARAM(@PluginInfo)); + Langpack_Register(); // Getting langpack codepage for ansi translation hppCodepage := CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); - if (hppCodepage = CALLSERVICE_NOTFOUND) or (hppCodepage = CP_ACP) then + if hppCodepage = CP_ACP then hppCodepage := GetACP(); // Checking the version of richedit is available, need 2.0+ hppRichEditVersion := InitRichEditLibrary; @@ -183,15 +181,6 @@ begin exit; end; - // Get profile dir - SetLength(hppProfileDir, MAX_PATH); - CallService(MS_DB_GETPROFILEPATH, MAX_PATH, lParam(@hppProfileDir[1])); - SetLength(hppProfileDir, StrLen(pAnsiChar(@hppProfileDir[1]))); - // Get plugins dir - SetLength(hppPluginsDir, MAX_PATH); - SetLength(hppPluginsDir, GetModuleFileNameW(hInstance, @hppPluginsDir[1], MAX_PATH)); - hppDllName := ExtractFileName(hppPluginsDir); - hppPluginsDir := ExtractFilePath(hppPluginsDir); // init history functions later HookModulesLoad := HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoad); HookOptInit := HookEvent(ME_OPT_INITIALISE, OnOptInit); diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas index 88f8a5d388..c980a78bcc 100644 --- a/plugins/HistoryPlusPlus/hpp_events.pas +++ b/plugins/HistoryPlusPlus/hpp_events.pas @@ -51,31 +51,45 @@ unit hpp_events; interface -{$I compilers.inc} - uses Windows, SysUtils, m_api, hpp_global, hpp_contacts; type - TTextFunction = procedure(EventInfo: TDBEventInfo; var Hi: THistoryItem); - - TEventTableItem = record - EventType: Word; - MessageType: TMessageType; - TextFunction: TTextFunction; - end; - PEventRecord = ^TEventRecord; TEventRecord = record - Name: String; - XML: AnsiString; - i: SmallInt; + Name : String; + XML : AnsiString; + i : SmallInt; iName: PAnsiChar; iSkin: SmallInt; end; +const + EventRecords: array[TMessageType] of TEventRecord = ( + (Name:'Unknown'; XML:''; i:-1; iSkin:-1), + (Name:'Incoming events'; XML:''; i:HPP_ICON_EVENT_INCOMING; iName:'hppevn_inc'; iSkin:-1), + (Name:'Outgoing events'; XML:''; i:HPP_ICON_EVENT_OUTGOING; iName:'hppevn_out'; iSkin:-1), + (Name:'Message'; XML:'MSG'; i:HPP_SKIN_EVENT_MESSAGE; iSkin:SKINICON_EVENT_MESSAGE), + (Name:'Link'; XML:'URL'; i:HPP_SKIN_EVENT_URL; iSkin:SKINICON_EVENT_URL), + (Name:'File transfer'; XML:'FILE'; i:HPP_SKIN_EVENT_FILE; iSkin:SKINICON_EVENT_FILE), + (Name:'System message'; XML:'SYS'; i:HPP_ICON_EVENT_SYSTEM; iName:'hppevn_sys'; iSkin:-1), + (Name:'Contacts'; XML:'ICQCNT'; i:HPP_ICON_EVENT_CONTACTS; iName:'hppevn_icqcnt'; iSkin:-1), + (Name:'SMS message'; XML:'SMS'; i:HPP_ICON_EVENT_SMS; iName:'hppevn_sms'; iSkin:-1), + (Name:'Webpager message'; XML:'ICQWP'; i:HPP_ICON_EVENT_WEBPAGER; iName:'hppevn_icqwp'; iSkin:-1), + (Name:'EMail Express message'; XML:'ICQEX'; i:HPP_ICON_EVENT_EEXPRESS; iName:'hppevn_icqex'; iSkin:-1), + (Name:'Status changes'; XML:'STATUSCNG'; i:HPP_ICON_EVENT_STATUS; iName:'hppevn_status'; iSkin:-1), + (Name:'SMTP Simple Email'; XML:'SMTP'; i:HPP_ICON_EVENT_SMTPSIMPLE;iName:'hppevn_smtp'; iSkin:-1), + (Name:'Other events (unknown)';XML:'OTHER'; i:HPP_SKIN_OTHER_MIRANDA; iSkin:SKINICON_OTHER_MIRANDA), + (Name:'Nick changes'; XML:'NICKCNG'; i:HPP_ICON_EVENT_NICK; iName:'hppevn_nick'; iSkin:-1), + (Name:'Avatar changes'; XML:'AVACNG'; i:HPP_ICON_EVENT_AVATAR; iName:'hppevn_avatar'; iSkin:-1), + (Name:'WATrack notify'; XML:'WATRACK'; i:HPP_ICON_EVENT_WATRACK; iName:'hppevn_watrack'; iSkin:-1), + (Name:'Status message changes';XML:'STATUSMSGCHG';i:HPP_ICON_EVENT_STATUSMES; iName:'hppevn_statuschng';iSkin:-1), + (Name:'Voice call'; XML:'VCALL'; i:HPP_ICON_EVENT_VOICECALL; iName:'hppevn_vcall'; iSkin:-1), + (Name:'Custom'; XML:''; i:-1; iSkin:-1) + ); + const EVENTTYPE_STATUSCHANGE = 25368; // from srmm's EVENTTYPE_SMTPSIMPLE = 2350; // from SMTP Simple @@ -85,38 +99,12 @@ const EVENTTYPE_CONTACTLEFTCHANNEL = 9004; // from pescuma EVENTTYPE_VOICE_CALL = 8739; // from pescuma - EventRecords: array[TMessageType] of TEventRecord = ( - (Name:'Unknown'; XML:''; i:-1; iSkin:-1), - (Name:'Incoming events'; XML:''; i:HPP_ICON_EVENT_INCOMING; iName:'hppevn_inc'; iSkin:-1), - (Name:'Outgoing events'; XML:''; i:HPP_ICON_EVENT_OUTGOING; iName:'hppevn_out'; iSkin:-1), - (Name:'Message'; XML:'MSG'; i:HPP_SKIN_EVENT_MESSAGE; iSkin: SKINICON_EVENT_MESSAGE), - (Name:'Link'; XML:'URL'; i:HPP_SKIN_EVENT_URL; iSkin:SKINICON_EVENT_URL), - (Name:'File transfer'; XML:'FILE'; i:HPP_SKIN_EVENT_FILE; iSkin:SKINICON_EVENT_FILE), - (Name:'System message'; XML:'SYS'; i:HPP_ICON_EVENT_SYSTEM; iName:'hppevn_sys'; iSkin:-1), - (Name:'Contacts'; XML:'ICQCNT'; i:HPP_ICON_EVENT_CONTACTS; iName:'hppevn_icqcnt'; iSkin:-1), - (Name:'SMS message'; XML:'SMS'; i:HPP_ICON_EVENT_SMS; iName:'hppevn_sms'; iSkin:-1), - (Name:'Webpager message'; XML:'ICQWP'; i:HPP_ICON_EVENT_WEBPAGER; iName:'hppevn_icqwp'; iSkin:-1), - (Name:'EMail Express message'; XML:'ICQEX'; i:HPP_ICON_EVENT_EEXPRESS; iName:'hppevn_icqex'; iSkin:-1), - (Name:'Status changes'; XML:'STATUSCNG'; i:HPP_ICON_EVENT_STATUS; iName:'hppevn_status'; iSkin:-1), - (Name:'SMTP Simple Email'; XML:'SMTP'; i:HPP_ICON_EVENT_SMTPSIMPLE; iName:'hppevn_smtp'; iSkin:-1), - (Name:'Other events (unknown)'; XML:'OTHER'; i:HPP_SKIN_OTHER_MIRANDA; iSkin:SKINICON_OTHER_MIRANDA), - (Name:'Nick changes'; XML:'NICKCNG'; i:HPP_ICON_EVENT_NICK; iName:'hppevn_nick'; iSkin:-1), - (Name:'Avatar changes'; XML:'AVACNG'; i:HPP_ICON_EVENT_AVATAR; iName:'hppevn_avatar'; iSkin:-1), - (Name:'WATrack notify'; XML:'WATRACK'; i:HPP_ICON_EVENT_WATRACK; iName:'hppevn_watrack'; iSkin:-1), - (Name:'Status message changes'; XML:'STATUSMSGCHG'; i:HPP_ICON_EVENT_STATUSMES; iName:'hppevn_statuschng'; iSkin:-1), - (Name:'Voice call'; XML:'VCALL'; i:HPP_ICON_EVENT_VOICECALL; iName:'hppevn_vcall'; iSkin:-1), - (Name:'Custom'; XML:''; i:-1; iSkin:-1) - ); - -// General timstamp function -function UnixTimeToDateTime(const UnixTime: DWord): TDateTime; -function DateTimeToUnixTime(const DateTime: TDateTime): DWord; // Miranda timestamp to TDateTime function TimestampToDateTime(const Timestamp: DWord): TDateTime; function TimestampToString(const Timestamp: DWord): String; // general routine function ReadEvent(hDBEvent: THandle; UseCP: Cardinal = CP_ACP): THistoryItem; -function GetEventInfo(hDBEvent: DWord): TDBEventInfo; +function GetEventInfo(hDBEvent: THANDLE): TDBEventInfo; function GetEventTimestamp(hDBEvent: THandle): DWord; function GetEventMessageType(hDBEvent: THandle): TMessageTypes; function GetEventDateTime(hDBEvent: THandle): TDateTime; @@ -150,16 +138,13 @@ procedure GetEventTextWATrackRequest(EventInfo: TDBEventInfo; var Hi: THistoryIt procedure GetEventTextWATrackAnswer(EventInfo: TDBEventInfo; var Hi: THistoryItem); procedure GetEventTextWATrackError(EventInfo: TDBEventInfo; var Hi: THistoryItem); procedure GetEventTextForOther(EventInfo: TDBEventInfo; var Hi: THistoryItem); -// service routines -function TextHasUrls(var Text: String): Boolean; -function Utf8ToWideChar(Dest: PWideChar; MaxDestChars: Integer; Source: PAnsiChar; SourceBytes: Integer; CodePage: Cardinal = CP_ACP): Integer; implementation uses hpp_options; -{$include inc\m_music.inc} +{$include m_music.inc} const // registered Jabber db event types (not public) JABBER_DB_EVENT_TYPE_CHATSTATES = 2000; @@ -192,50 +177,47 @@ type EventRecord: TEventRecord; end; -// OXY: -// Routines UnixTimeToDate and DateTimeToUnixTime are taken -// from JclDateTime.pas -// See JclDateTime.pas for copyright and license information -// JclDateTime.pas is part of Project JEDI Code Library (JCL) -// [http://www.delphi-jedi.org], [http://jcl.sourceforge.net] -const - // 1970-01-01T00:00:00 in TDateTime - UnixTimeStart = 25569; - SecondsPerDay = 60* 24 * 60; + TTextFunction = procedure(EventInfo: TDBEventInfo; var Hi: THistoryItem); + + TEventTableItem = record + EventType : Word; + MessageType : TMessageType; + TextFunction: TTextFunction; + end; var EventTable: array[0..28] of TEventTableItem = ( // must be the first item in array for unknown events - (EventType: MaxWord; MessageType: mtOther; TextFunction: GetEventTextForOther), + (EventType: MaxWord; MessageType: mtOther; TextFunction: GetEventTextForOther), // events definitions - (EventType: EVENTTYPE_MESSAGE; MessageType: mtMessage; TextFunction: GetEventTextForMessage), - (EventType: EVENTTYPE_FILE; MessageType: mtFile; TextFunction: GetEventTextForFile), - (EventType: EVENTTYPE_URL; MessageType: mtUrl; TextFunction: GetEventTextForUrl), - (EventType: EVENTTYPE_AUTHREQUEST; MessageType: mtSystem; TextFunction: GetEventTextForAuthRequest), - (EventType: EVENTTYPE_ADDED; MessageType: mtSystem; TextFunction: GetEventTextForYouWereAdded), - (EventType: EVENTTYPE_CONTACTS; MessageType: mtContacts; TextFunction: GetEventTextForContacts), - (EventType: EVENTTYPE_STATUSCHANGE; MessageType: mtStatus; TextFunction: GetEventTextForStatusChange), - (EventType: EVENTTYPE_SMTPSIMPLE; MessageType: mtSMTPSimple; TextFunction: GetEventTextForMessage), - (EventType: ICQEVENTTYPE_SMS; MessageType: mtSMS; TextFunction: GetEventTextForSMS), - (EventType: ICQEVENTTYPE_WEBPAGER; MessageType: mtWebPager; TextFunction: GetEventTextForWebPager), - (EventType: ICQEVENTTYPE_EMAILEXPRESS; MessageType: mtEmailExpress; TextFunction: GetEventTextForEmailExpress), - (EventType: EVENTTYPE_NICKNAMECHANGE; MessageType: mtNickChange; TextFunction: GetEventTextForMessage), - (EventType: EVENTTYPE_STATUSMESSAGECHANGE; MessageType: mtStatusMessage; TextFunction: GetEventTextForMessage), - (EventType: EVENTTYPE_AVATARCHANGE; MessageType: mtAvatarChange; TextFunction: GetEventTextForAvatarChange), - (EventType: ICQEVENTTYPE_AUTH_GRANTED; MessageType: mtSystem; TextFunction: GetEventTextForICQAuthGranted), - (EventType: ICQEVENTTYPE_AUTH_DENIED; MessageType: mtSystem; TextFunction: GetEventTextForICQAuthDenied), - (EventType: ICQEVENTTYPE_SELF_REMOVE; MessageType: mtSystem; TextFunction: GetEventTextForICQSelfRemove), - (EventType: ICQEVENTTYPE_FUTURE_AUTH; MessageType: mtSystem; TextFunction: GetEventTextForICQFutureAuth), - (EventType: ICQEVENTTYPE_CLIENT_CHANGE; MessageType: mtSystem; TextFunction: GetEventTextForICQClientChange), - (EventType: ICQEVENTTYPE_CHECK_STATUS; MessageType: mtSystem; TextFunction: GetEventTextForICQCheckStatus), - (EventType: ICQEVENTTYPE_IGNORECHECK_STATUS; MessageType: mtSystem; TextFunction: GetEventTextForICQIgnoreCheckStatus), - (EventType: ICQEVENTTYPE_BROADCAST; MessageType: mtSystem; TextFunction: GetEventTextForICQBroadcast), - (EventType: JABBER_DB_EVENT_TYPE_CHATSTATES; MessageType: mtStatus; TextFunction: GetEventTextForJabberChatStates), - (EventType: EVENTTYPE_CONTACTLEFTCHANNEL; MessageType: mtStatus; TextFunction: GetEventTextForMessage), - (EventType: EVENTTYPE_WAT_REQUEST; MessageType: mtWATrack; TextFunction: GetEventTextWATrackRequest), - (EventType: EVENTTYPE_WAT_ANSWER; MessageType: mtWATrack; TextFunction: GetEventTextWATrackAnswer), - (EventType: EVENTTYPE_WAT_ERROR; MessageType: mtWATrack; TextFunction: GetEventTextWATrackError), - (EventType: EVENTTYPE_VOICE_CALL; MessageType: mtVoiceCall; TextFunction: GetEventTextForMessage) + (EventType: EVENTTYPE_MESSAGE; MessageType: mtMessage; TextFunction: GetEventTextForMessage), + (EventType: EVENTTYPE_FILE; MessageType: mtFile; TextFunction: GetEventTextForFile), + (EventType: EVENTTYPE_URL; MessageType: mtUrl; TextFunction: GetEventTextForUrl), + (EventType: EVENTTYPE_AUTHREQUEST; MessageType: mtSystem; TextFunction: GetEventTextForAuthRequest), + (EventType: EVENTTYPE_ADDED; MessageType: mtSystem; TextFunction: GetEventTextForYouWereAdded), + (EventType: EVENTTYPE_CONTACTS; MessageType: mtContacts; TextFunction: GetEventTextForContacts), + (EventType: EVENTTYPE_STATUSCHANGE; MessageType: mtStatus; TextFunction: GetEventTextForStatusChange), + (EventType: EVENTTYPE_SMTPSIMPLE; MessageType: mtSMTPSimple; TextFunction: GetEventTextForMessage), + (EventType: ICQEVENTTYPE_SMS; MessageType: mtSMS; TextFunction: GetEventTextForSMS), + (EventType: ICQEVENTTYPE_WEBPAGER; MessageType: mtWebPager; TextFunction: GetEventTextForWebPager), + (EventType: ICQEVENTTYPE_EMAILEXPRESS; MessageType: mtEmailExpress; TextFunction: GetEventTextForEmailExpress), + (EventType: EVENTTYPE_NICKNAMECHANGE; MessageType: mtNickChange; TextFunction: GetEventTextForMessage), + (EventType: EVENTTYPE_STATUSMESSAGECHANGE; MessageType: mtStatusMessage; TextFunction: GetEventTextForMessage), + (EventType: EVENTTYPE_AVATARCHANGE; MessageType: mtAvatarChange; TextFunction: GetEventTextForAvatarChange), + (EventType: ICQEVENTTYPE_AUTH_GRANTED; MessageType: mtSystem; TextFunction: GetEventTextForICQAuthGranted), + (EventType: ICQEVENTTYPE_AUTH_DENIED; MessageType: mtSystem; TextFunction: GetEventTextForICQAuthDenied), + (EventType: ICQEVENTTYPE_SELF_REMOVE; MessageType: mtSystem; TextFunction: GetEventTextForICQSelfRemove), + (EventType: ICQEVENTTYPE_FUTURE_AUTH; MessageType: mtSystem; TextFunction: GetEventTextForICQFutureAuth), + (EventType: ICQEVENTTYPE_CLIENT_CHANGE; MessageType: mtSystem; TextFunction: GetEventTextForICQClientChange), + (EventType: ICQEVENTTYPE_CHECK_STATUS; MessageType: mtSystem; TextFunction: GetEventTextForICQCheckStatus), + (EventType: ICQEVENTTYPE_IGNORECHECK_STATUS; MessageType: mtSystem; TextFunction: GetEventTextForICQIgnoreCheckStatus), + (EventType: ICQEVENTTYPE_BROADCAST; MessageType: mtSystem; TextFunction: GetEventTextForICQBroadcast), + (EventType: JABBER_DB_EVENT_TYPE_CHATSTATES; MessageType: mtStatus; TextFunction: GetEventTextForJabberChatStates), + (EventType: EVENTTYPE_CONTACTLEFTCHANNEL; MessageType: mtStatus; TextFunction: GetEventTextForMessage), + (EventType: EVENTTYPE_WAT_REQUEST; MessageType: mtWATrack; TextFunction: GetEventTextWATrackRequest), + (EventType: EVENTTYPE_WAT_ANSWER; MessageType: mtWATrack; TextFunction: GetEventTextWATrackAnswer), + (EventType: EVENTTYPE_WAT_ERROR; MessageType: mtWATrack; TextFunction: GetEventTextWATrackError), + (EventType: EVENTTYPE_VOICE_CALL; MessageType: mtVoiceCall; TextFunction: GetEventTextForMessage) ); var @@ -243,28 +225,20 @@ var RecentEvent: THandle = 0; RecentEventInfo: TDBEventInfo; -const - SHRINK_ON_CALL = 50; - SHRINK_TO_LEN = 512; - var EventBuffer: THppBuffer; TextBuffer: THppBuffer; -function UnixTimeToDateTime(const UnixTime: DWord): TDateTime; -begin - Result:= UnixTimeStart + (UnixTime / SecondsPerDay); -end; - -function DateTimeToUnixTime(const DateTime: TDateTime): DWord; -begin - Result := Trunc((DateTime-UnixTimeStart) * SecondsPerDay); -end; +const + // 1970-01-01T00:00:00 in TDateTime + UnixTimeStart = 25569; + SecondsPerDay = 60*60*24; // Miranda timestamp to TDateTime function TimestampToDateTime(const Timestamp: DWord): TDateTime; begin - Result := UnixTimeToDateTime(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,WPARAM(Timestamp),0)); + Result := UnixTimeStart + + CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,WPARAM(Timestamp),0) / SecondsPerDay; end; // should probably add function param to use @@ -452,7 +426,7 @@ begin TextBuffer.Unlock; end; -function GetEventInfo(hDBEvent: DWord): TDBEventInfo; +function GetEventInfo(hDBEvent: THANDLE): TDBEventInfo; var BlobSize: integer; begin diff --git a/plugins/HistoryPlusPlus/hpp_external.pas b/plugins/HistoryPlusPlus/hpp_external.pas index 6be84f51ca..3f941a30bc 100644 --- a/plugins/HistoryPlusPlus/hpp_external.pas +++ b/plugins/HistoryPlusPlus/hpp_external.pas @@ -62,7 +62,7 @@ procedure UnregisterExtGridServices; implementation -{$include inc\m_ieview.inc} +{$include m_ieview.inc} function _ExtWindow(wParam:WPARAM; lParam: LPARAM; GridMode: TExGridMode): int_ptr; var diff --git a/plugins/HistoryPlusPlus/hpp_externalgrid.pas b/plugins/HistoryPlusPlus/hpp_externalgrid.pas index 6f05e24a4b..0694cf0788 100644 --- a/plugins/HistoryPlusPlus/hpp_externalgrid.pas +++ b/plugins/HistoryPlusPlus/hpp_externalgrid.pas @@ -178,7 +178,7 @@ implementation uses hpp_options, hpp_sessionsthread; -{$include inc\m_speak.inc} +{$include m_speak.inc} { TExtHistoryGrid } diff --git a/plugins/HistoryPlusPlus/hpp_global.pas b/plugins/HistoryPlusPlus/hpp_global.pas index a247076bd6..cf6de81b39 100644 --- a/plugins/HistoryPlusPlus/hpp_global.pas +++ b/plugins/HistoryPlusPlus/hpp_global.pas @@ -107,7 +107,7 @@ type TSendMethod = (smSend,smPost); TUrlProto = record - Proto: PWideChar; + Proto: PChar; Idn: Boolean; end; @@ -270,10 +270,6 @@ const var hppCodepage: Cardinal; - hppIconPack: String; - hppProfileDir: String; - hppPluginsDir: String; - hppDllName: String; hppRichEditVersion: Integer; {$I m_historypp.inc} @@ -435,7 +431,32 @@ begin Result := True; end; - +procedure OpenUrl(URLText: String; NewWindow: Boolean); +var + URLTextW: String; + URLTextA: AnsiString; +begin +{ + if EncodeURL(URLText, URLTextW) then + begin + URLTextA := WideToAnsiString(URLTextW, CP_ACP); + if not SameStr(URLTextW, AnsiToWideString(URLTextA, CP_ACP)) then + URLTextA := QuoteURL(URLTextW); + end + else + URLTextA := WideToAnsiString(URLText, CP_ACP); + CallService(MS_UTILS_OPENURL,WPARAM(NewWindow),LPARAM(@URLTextA[1])); +} + if EncodeURL(URLText, URLTextW) then + begin + URLTextA := AnsiString(URLTextW); + if not SameStr(URLTextW, String(URLTextA)) then + URLTextA := QuoteURL(URLTextW); + end + else + URLTextA := AnsiString(URLText); + CallService(MS_UTILS_OPENURL,WPARAM(NewWindow),LPARAM(@URLTextA[1])); +end; function AnsiToWideString(const S: AnsiString; CodePage: Cardinal; InLength: Integer = -1): WideString; var @@ -605,33 +626,6 @@ begin end; end; -procedure OpenUrl(URLText: String; NewWindow: Boolean); -var - URLTextW: String; - URLTextA: AnsiString; -begin -{ - if EncodeURL(URLText, URLTextW) then - begin - URLTextA := WideToAnsiString(URLTextW, CP_ACP); - if not SameStr(URLTextW, AnsiToWideString(URLTextA, CP_ACP)) then - URLTextA := QuoteURL(URLTextW); - end - else - URLTextA := WideToAnsiString(URLText, CP_ACP); - CallService(MS_UTILS_OPENURL,WPARAM(NewWindow),LPARAM(@URLTextA[1])); -} - if EncodeURL(URLText, URLTextW) then - begin - URLTextA := AnsiString(URLTextW); - if not SameStr(URLTextW, String(URLTextA)) then - URLTextA := QuoteURL(URLTextW); - end - else - URLTextA := AnsiString(URLText); - CallService(MS_UTILS_OPENURL,WPARAM(NewWindow),LPARAM(@URLTextA[1])); -end; - function HppMessageBox(Handle: THandle; const Text: String; const Caption: String; Flags: Integer): Integer; begin Result := MessageBox(Handle,PChar(Text),PChar(Caption),Flags); diff --git a/plugins/HistoryPlusPlus/hpp_itemprocess.pas b/plugins/HistoryPlusPlus/hpp_itemprocess.pas index 392aa195b5..8ddb7968e7 100644 --- a/plugins/HistoryPlusPlus/hpp_itemprocess.pas +++ b/plugins/HistoryPlusPlus/hpp_itemprocess.pas @@ -75,7 +75,7 @@ uses m_api, hpp_global, hpp_richedit, hpp_events{, RichEdit -- used for CHARRANGE and EM_EXTSETSEL}; -{$include inc\m_mathmodule.inc} +{$include m_mathmodule.inc} const EM_EXSETSEL = WM_USER + 55; // from RichEdit @@ -506,6 +506,7 @@ var Link: AnsiString; hBmp: hBitmap; cr: CHARRANGE; + hppProfileDir:AnsiString; begin Result := 0; ird := Pointer(alParam); @@ -518,7 +519,13 @@ begin (ird.pExtended[2] = '\')) then Link := ird.pExtended else + begin + // Get profile dir + SetLength(hppProfileDir, MAX_PATH); + CallService(MS_DB_GETPROFILEPATH, MAX_PATH, lParam(@hppProfileDir[1])); + SetLength(hppProfileDir, StrLen(pAnsiChar(@hppProfileDir[1]))); Link := AnsiString(hppProfileDir) + '\' + ird.pExtended; //!! + end; hBmp := CallService(MS_UTILS_LOADBITMAP, 0, LPARAM(@Link[1])); if hBmp <> 0 then begin diff --git a/plugins/HistoryPlusPlus/hpp_mescatcher.pas b/plugins/HistoryPlusPlus/hpp_mescatcher.pas index bb91be9aa6..ae95bcbca8 100644 --- a/plugins/HistoryPlusPlus/hpp_mescatcher.pas +++ b/plugins/HistoryPlusPlus/hpp_mescatcher.pas @@ -48,7 +48,6 @@ unit hpp_mescatcher; interface -{$I compilers.inc} {.$DEFINE USE_CUSTOMIDLEHOOK} uses diff --git a/plugins/HistoryPlusPlus/hpp_options.pas b/plugins/HistoryPlusPlus/hpp_options.pas index 758046d0fd..0562463c63 100644 --- a/plugins/HistoryPlusPlus/hpp_options.pas +++ b/plugins/HistoryPlusPlus/hpp_options.pas @@ -64,8 +64,8 @@ type ThppIconsRec = record name: PAnsiChar; - desc: PAnsiChar; - group: PAnsiChar; + desc: PChar; + group: PChar; i: shortint; end; @@ -209,8 +209,8 @@ implementation uses hpp_database, ShellAPI; -{$include inc\m_mathmodule.inc} -{$include inc\m_speak.inc} +{$include m_mathmodule.inc} +{$include m_speak.inc} procedure RegisterFont(Name:PAnsiChar; Order:integer; const defFont:TFontSettings); var @@ -454,7 +454,14 @@ var hppMessage: WideString; CountIconsDll: Integer; DoCheck: boolean; + hppDllName,hppPluginsDir:string; begin + // Get plugins dir + SetLength(hppPluginsDir, MAX_PATH); + SetLength(hppPluginsDir, GetModuleFileNameW(hInstance, @hppPluginsDir[1], MAX_PATH)); + hppDllName := ExtractFileName(hppPluginsDir); + hppPluginsDir := ExtractFilePath(hppPluginsDir); + DoCheck := ForceCheck or GetDBBool(hppDBName, 'CheckIconPack', true); hppIconsDir := ExpandFileName(hppPluginsDir + '..\Icons\'); if FileExists(hppIconsDir + hppIPName) then @@ -500,21 +507,24 @@ var i: Integer; mt: TMessageType; str: PAnsiChar; + hppIconPack: String; begin // Register in IcoLib hppIconPack := FindIconsDll(false); ZeroMemory(@sid, sizeof(sid)); sid.cbSize := sizeof(sid); - sid.szDefaultFile.a := PAnsiChar(AnsiString(hppIconPack)); // !! + sid.Flags:=SIDF_ALL_UNICODE; + + sid.szDefaultFile.w := PChar(hppIconPack); for i := 0 to High(hppIconsDefs) do begin hppIcons[hppIconsDefs[i].i].name := hppIconsDefs[i].name; sid.pszName := hppIconsDefs[i].name; - sid.szDescription.a := hppIconsDefs[i].desc; + sid.szDescription.w := hppIconsDefs[i].desc; if hppIconsDefs[i].group = nil then - sid.szSection.a := hppName + sid.szSection.w := hppName else - sid.szSection.a := PAnsiChar(hppName + '/' + hppIconsDefs[i].group); + sid.szSection.w := PChar(hppName + '/' + hppIconsDefs[i].group); sid.iDefaultIndex := hppIconsDefs[i].i; Skin_AddIcon(@sid); end; @@ -527,8 +537,8 @@ begin begin hppIcons[EventRecords[mt].i].name := EventRecords[mt].iName; sid.pszName := hppIcons[EventRecords[mt].i].name; - sid.szDescription.a := PAnsiChar(WideToAnsiString(EventRecords[mt].name, hppCodepage)); - sid.szSection.a := PAnsiChar(hppName + '/' +'Events'); + sid.szDescription.w := PChar(EventRecords[mt].name); + sid.szSection.w := PChar(hppName + '/' +'Events'); sid.iDefaultIndex := EventRecords[mt].i; Skin_AddIcon(@sid); end -- cgit v1.2.3