summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/HistoryPlusPlus/CustomizeFiltersForm.pas2
-rw-r--r--plugins/HistoryPlusPlus/HistoryForm.pas8
-rw-r--r--plugins/HistoryPlusPlus/hpp_eventfilters.pas6
-rw-r--r--plugins/HistoryPlusPlus/hpp_events.pas70
-rw-r--r--plugins/HistoryPlusPlus/hpp_global.pas5
5 files changed, 85 insertions, 6 deletions
diff --git a/plugins/HistoryPlusPlus/CustomizeFiltersForm.pas b/plugins/HistoryPlusPlus/CustomizeFiltersForm.pas
index 01bcd7a689..7a42dd1264 100644
--- a/plugins/HistoryPlusPlus/CustomizeFiltersForm.pas
+++ b/plugins/HistoryPlusPlus/CustomizeFiltersForm.pas
@@ -138,7 +138,7 @@ begin
SetLength(LocalFilters,i+1);
LocalFilters[i].Name := NewName;
LocalFilters[i].filMode := FM_INCLUDE;
- LocalFilters[i].filEvents := [mtIncoming,mtOutgoing,mtMessage,mtFile];
+ LocalFilters[i].filEvents := [mtIncoming,mtOutgoing,mtMessage,mtUrl,mtFile];
LocalFilters[i].Events := GenerateEvents(LocalFilters[i].filMode,LocalFilters[i].filEvents);
lbFilters.Items.Add(NewName);
diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas
index a25609e604..ac3fb4589e 100644
--- a/plugins/HistoryPlusPlus/HistoryForm.pas
+++ b/plugins/HistoryPlusPlus/HistoryForm.pas
@@ -2274,6 +2274,14 @@ begin
else
Item.FileName := UTF8Encode(MakeTextXMLedA(tmp));
end
+ else if mtUrl in hg.Items[Index].MessageType then
+ begin
+ tmp := hg.Items[Index].Extended;
+ if tmp = '' then
+ Item.Url := '&UNK;'
+ else
+ Item.Url := UTF8Encode(MakeTextXMLedA(tmp));
+ end
else if mtAvatarChange in hg.Items[Index].MessageType then
begin
tmp := hg.Items[Index].Extended;
diff --git a/plugins/HistoryPlusPlus/hpp_eventfilters.pas b/plugins/HistoryPlusPlus/hpp_eventfilters.pas
index 2353701217..2444b4156b 100644
--- a/plugins/HistoryPlusPlus/hpp_eventfilters.pas
+++ b/plugins/HistoryPlusPlus/hpp_eventfilters.pas
@@ -77,9 +77,10 @@ var
filterAll: TMessageTypes;
const
- hppIntDefEventFilters: array[0..11] of ThppEventFilter = (
+ hppIntDefEventFilters: array[0..12] of ThppEventFilter = (
(Name: 'Show all events'; Events: []; filMode: FM_EXCLUDE; filEvents: []),
(Name: 'Messages'; Events: []; filMode: FM_INCLUDE; filEvents: [mtMessage,mtIncoming,mtOutgoing]),
+ (Name: 'Link URLs'; Events: []; filMode: FM_INCLUDE; filEvents: [mtUrl,mtIncoming,mtOutgoing]),
(Name: 'Files'; Events: []; filMode: FM_INCLUDE; filEvents: [mtFile,mtIncoming,mtOutgoing]),
(Name: 'Contacts'; Events: []; filMode: FM_INCLUDE; filEvents: [mtContacts,mtIncoming,mtOutgoing]),
(Name: 'Status changes'; Events: []; filMode: FM_INCLUDE; filEvents: [mtStatus,mtIncoming,mtOutgoing]),
@@ -90,8 +91,7 @@ const
(Name: 'Voice calls'; Events: []; filMode: FM_INCLUDE; filEvents: [mtVoiceCall,mtIncoming,mtOutgoing]),
(Name: 'All except changes'; Events: []; filMode: FM_EXCLUDE; filEvents: [mtStatus,mtStatusMessage,mtNickChange,mtAvatarChange]),
(Name: 'All except system'; Events: []; filMode: FM_EXCLUDE; filEvents: [mtSystem])
- );
-
+ );
function IsSameAsDefault: Boolean;
var
diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas
index 64548260d9..c4dde1817d 100644
--- a/plugins/HistoryPlusPlus/hpp_events.pas
+++ b/plugins/HistoryPlusPlus/hpp_events.pas
@@ -72,6 +72,7 @@ const
(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),
@@ -111,6 +112,7 @@ function GetEventCoreText(EventInfo: TDBEventInfo; var Hi: THistoryItem): Boolea
// specific routines
procedure GetEventTextForMessage(EventInfo: TDBEventInfo; var Hi: THistoryItem);
procedure GetEventTextForFile(EventInfo: TDBEventInfo; var Hi: THistoryItem);
+procedure GetEventTextForUrl(EventInfo: TDBEventInfo; var Hi: THistoryItem);
procedure GetEventTextForAuthRequest(EventInfo: TDBEventInfo; var Hi: THistoryItem);
procedure GetEventTextForYouWereAdded(EventInfo: TDBEventInfo; var Hi: THistoryItem);
procedure GetEventTextForSms(EventInfo: TDBEventInfo; var Hi: THistoryItem);
@@ -150,11 +152,12 @@ type
end;
var
- EventTable: array[0..16] of TEventTableItem = (
+ EventTable: array[0..17] of TEventTableItem = (
// must be the first item in array for unknown events
(EventType: MaxWord; MessageType: mtOther; TextFunction: GetEventTextForOther),
// events definitions
(EventType: EVENTTYPE_MESSAGE; MessageType: mtMessage; TextFunction: GetEventTextForMessage),
+ (EventType: EVENTTYPE_URL; MessageType: mtUrl; TextFunction: GetEventTextForUrl),
(EventType: EVENTTYPE_FILE; MessageType: mtFile; TextFunction: GetEventTextForFile),
(EventType: EVENTTYPE_AUTHREQUEST; MessageType: mtSystem; TextFunction: GetEventTextForAuthRequest),
(EventType: EVENTTYPE_ADDED; MessageType: mtSystem; TextFunction: GetEventTextForYouWereAdded),
@@ -332,6 +335,48 @@ begin
end;
end;
+function TextHasUrls(var Text: String): Boolean;
+var
+ i,len,lenW: Integer;
+ pText,pPos: PChar;
+begin
+ Result := False;
+ len := Length(Text);
+ if len=0 then exit;
+
+ pText := PChar(Text);
+ for i := 0 to High(UrlPrefix) do
+ begin
+ pPos := StrPos(pText, PChar(UrlPrefix[i]));
+ if not Assigned(pPos) then
+ continue;
+ Result := ((uint_ptr(pPos) = uint_ptr(pText)) or not IsWideCharAlphaNumeric((pPos - 1)^)) and
+ IsWideCharAlphaNumeric((pPos + Length(UrlPrefix[i]))^);
+ if Result then
+ exit;
+ end;
+
+ if not Assigned(StrPos(PChar(Text),':/')) then exit;
+
+ lenW := (len+1)*SizeOf(Char);
+
+ TextBuffer.Lock;
+ TextBuffer.Allocate(lenW);
+ Move(Text[1],TextBuffer.Buffer^,lenW);
+ CharLowerBuffW(PChar(TextBuffer.Buffer),len);
+ for i := 0 to High(UrlProto) do
+ begin
+ pPos := StrPos(PChar(TextBuffer.Buffer), PChar(UrlProto[i].proto));
+ if not Assigned(pPos) then
+ continue;
+ Result := ((uint_ptr(pPos) = uint_ptr(TextBuffer.Buffer)) or
+ not IsWideCharAlphaNumeric((pPos - 1)^));
+ if Result then
+ break;
+ end;
+ TextBuffer.Unlock;
+end;
+
function GetEventInfo(hDBEvent: THANDLE): TDBEventInfo;
var
BlobSize: integer;
@@ -399,6 +444,12 @@ begin
EventTable[EventIndex].TextFunction(EventInfo, Result);
Result.Text := AdjustLineBreaks(Result.Text);
Result.Text := TrimRight(Result.Text);
+ if mtMessage in Result.MessageType then
+ if TextHasUrls(Result.Text) then
+ begin
+ exclude(Result.MessageType, mtMessage);
+ include(Result.MessageType, mtUrl);
+ end;
finally
EventBuffer.Unlock;
end;
@@ -484,6 +535,23 @@ begin
end;
end;
+procedure GetEventTextForUrl(EventInfo: TDBEventInfo; var Hi: THistoryItem);
+var
+ BytePos:LongWord;
+ Url,Desc: AnsiString;
+ cp: Cardinal;
+begin
+ BytePos:=0;
+ ReadStringTillZeroA(Pointer(EventInfo.pBlob),EventInfo.cbBlob,Url,BytePos);
+ ReadStringTillZeroA(Pointer(EventInfo.pBlob),EventInfo.cbBlob,Desc,BytePos);
+ if Boolean(EventInfo.flags and DBEF_UTF) then
+ cp := CP_UTF8
+ else
+ cp := Hi.CodePage;
+ hi.Text := Format(TranslateW('URL: %s'),[AnsiToWideString(url+#13#10+desc,cp)]);
+ hi.Extended := Url;
+end;
+
procedure GetEventTextForFile(EventInfo: TDBEventInfo; var Hi: THistoryItem);
var
BytePos: LongWord;
diff --git a/plugins/HistoryPlusPlus/hpp_global.pas b/plugins/HistoryPlusPlus/hpp_global.pas
index 9da53cab55..b5aca8ae37 100644
--- a/plugins/HistoryPlusPlus/hpp_global.pas
+++ b/plugins/HistoryPlusPlus/hpp_global.pas
@@ -66,7 +66,7 @@ type
mtMessage, mtFile, mtSystem,
mtContacts, mtStatus, mtSMTPSimple,
mtOther,
- mtNickChange,mtAvatarChange,mtWATrack,mtStatusMessage,mtVoiceCall,mtCustom);
+ mtNickChange,mtAvatarChange,mtWATrack,mtStatusMessage,mtVoiceCall,mtCustom, mtUrl);
PMessageTypes = ^TMessageTypes;
TMessageTypes = set of TMessageType;
@@ -146,6 +146,9 @@ const
HM_MIEV_METADEFCHANGED = HM_MIEV_BASE + 5; // ME_MC_DEFAULTTCHANGED
const
+ EVENTTYPE_URL = 1;
+
+const
// History Grid options flags
HGOPT_TEMPLATES = $0001; // templates, datetime format
HGOPT_FONTSERVICE = $0002; // fonts, colors