text
stringlengths 0
234
|
|---|
function Create_Line_Data (Plugin : Plugin_Ptr; Line : Hashtable_Ptr) return Line_Data is
|
Kind : constant Line_Buffer_Kind := Get_Value (Plugin, Line, "buffer_type");
|
Name : constant SU.Unbounded_String := Get_Value (Plugin, Line, "buffer_name");
|
Message : constant SU.Unbounded_String := Get_Value (Plugin, Line, "message");
|
Displayed : constant Boolean := Get_Value (Plugin, Line, "displayed");
|
Buffer : constant SU.Unbounded_String := Get_Value (Plugin, Line, "buffer");
|
begin
|
case Kind is
|
when Formatted =>
|
return
|
(Kind => Formatted,
|
Buffer => Buffer,
|
Name => Name,
|
Message => Message,
|
Displayed => Displayed,
|
Date => Get_Value (Plugin, Line, "date"),
|
Date_Printed => Get_Value (Plugin, Line, "date_printed"),
|
Date_Display => Get_Value (Plugin, Line, "str_time"),
|
Tags => Get_Value (Plugin, Line, "tags"),
|
Level => Get_Value (Plugin, Line, "notify_level"),
|
Highlight => Get_Value (Plugin, Line, "highlight"),
|
Prefix => Get_Value (Plugin, Line, "prefix"));
|
when Free =>
|
return
|
(Kind => Free,
|
Buffer => Buffer,
|
Name => Name,
|
Message => Message,
|
Displayed => Displayed,
|
Line_Number => Get_Value (Plugin, Line, "y"));
|
end case;
|
end Create_Line_Data;
|
----------------------------------------------------------------------------
|
function Line_Callback
|
(Callback : On_Line_Callback;
|
Data : Data_Ptr;
|
Line : Hashtable_Ptr) return Hashtable_Ptr
|
is
|
use type Ada.Calendar.Time;
|
use type SU.Unbounded_String;
|
Keys_Count : constant := 10;
|
Long_Bytes : constant := long'Size / System.Storage_Unit;
|
begin
|
declare
|
Value : constant Line_Data := Create_Line_Data (Data.Plugin, Line);
|
Result : Line_Data := Value;
|
begin
|
Callback (Data.Plugin, Result);
|
return Table : constant Hashtable_Ptr :=
|
Data.Plugin.Hashtable_New
|
(Long_Bytes * Keys_Count,
|
Weechat_Hashtable_String, Weechat_Hashtable_String, null, null)
|
do
|
if Value.Buffer /= Result.Buffer then
|
Set_Value (Data.Plugin, Table, "buffer", +Result.Buffer);
|
end if;
|
if Value.Name /= Result.Name then
|
Set_Value (Data.Plugin, Table, "name", +Result.Name);
|
end if;
|
if Value.Message /= Result.Message then
|
Set_Value (Data.Plugin, Table, "message", +Result.Message);
|
end if;
|
case Result.Kind is
|
when Formatted =>
|
if Value.Date /= Result.Date then
|
Set_Value (Data.Plugin, Table, "date", Result.Date);
|
end if;
|
if Value.Date_Printed /= Result.Date_Printed then
|
Set_Value (Data.Plugin, Table, "date_printed", Result.Date_Printed);
|
end if;
|
if Value.Date_Display /= Result.Date_Display then
|
Set_Value (Data.Plugin, Table, "str_time", +Result.Date_Display);
|
end if;
|
if Value.Tags /= Result.Tags then
|
Set_Value (Data.Plugin, Table, "tags", +Result.Tags);
|
end if;
|
if Value.Level /= Result.Level then
|
Set_Value (Data.Plugin, Table, "notify_level", Result.Level);
|
end if;
|
if Value.Highlight /= Result.Highlight then
|
Set_Value (Data.Plugin, Table, "highlight", Result.Highlight);
|
end if;
|
if Value.Prefix /= Result.Prefix then
|
Set_Value (Data.Plugin, Table, "prefix", +Result.Prefix);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.