Added to, from, and subj to display hyperlinks

Also added a findBoundaries function to only display notes and not erroneous extra information.
master
AardCrowley 2 years ago committed by GitHub
parent 922eaa9a0d
commit 984aba7eef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,7 +43,7 @@
</alias> </alias>
<alias <alias
match="^(note (list(?: \d+)?|unread))$" match="^(note\s?(?:list(?:\s\d+)?|unread|to\s\w+|from\s\w+|subj\s.+)?)$"
enabled="y" enabled="y"
regexp="y" regexp="y"
script="startNoteList" script="startNoteList"
@ -60,7 +60,7 @@ local snapshotV = tonumber(extras.PackageVersion())
local prefix = GetAlphaOption("script_prefix") local prefix = GetAlphaOption("script_prefix")
if (snapshotV < 2245) or (snapshotV < 2252 and tonumber(gmcp("char.base.level")) > 201) then if (snapshotV< 2245) or (snapshotV < 2252 and tonumber(gmcp("char.base.level")) > 201) then
ColourNote("white", "blue", "Sorry, your snapshot of the AardMUSH package is not compatible for your level and you will not be able to use this script. Please update your snapshot of the AardMUSH package to use this plugin. Unloading plugin to prevent issues.") ColourNote("white", "blue", "Sorry, your snapshot of the AardMUSH package is not compatible for your level and you will not be able to use this script. Please update your snapshot of the AardMUSH package to use this plugin. Unloading plugin to prevent issues.")
Execute(prefix .. 'DoAfterSpecial(1, "UnloadPlugin(\'' .. GetPluginID() .. '\')", sendto.script)') Execute(prefix .. 'DoAfterSpecial(1, "UnloadPlugin(\'' .. GetPluginID() .. '\')", sendto.script)')
else else
@ -127,8 +127,37 @@ function addToWindow(lines)
NotesWin:show() NotesWin:show()
end end
function findBoundaries(lines)
local first_index = nil
local last_index = nil
-- Find the first and last indices with ~ in the text field
for i, v in ipairs(lines) do
if (string.find(v[1].text, "~") or string.find(v[1].text, "No more new posts")) and not first_index then
first_index = i
end
if (string.find(v[1].text, "~") or string.find(v[1].text, "There are no new")) then
last_index = i
end
end
-- Remove all the entries before the first ~ and after the last ~
if first_index and last_index then
for i = #lines, last_index + 1, -1 do
table.remove(lines, i)
end
for i = first_index - 1, 1, -1 do
table.remove(lines, i)
end
end
return lines
end
function hyperlinknotes(lines) function hyperlinknotes(lines)
for i,v in ipairs(lines) do for i,v in ipairs(findBoundaries(lines)) do
if i < 5 or i == #lines then if i < 5 or i == #lines then
Simulate(stylesToANSI(v) .. "\n") Simulate(stylesToANSI(v) .. "\n")
else else

Loading…
Cancel
Save