this allows most elements to be configured with the "exhaustiveFlags"
flag which ensures that _all_ of the element's flags must be set in the
context for it to be laid out.
After #6909, we can clone message elements. With this PR, we can clone
whole messages. The messages are non-frozen afterward, so plugins can
edit their properties and add/remove elements.
Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This PR adds the ability for plugins to add actions to context menus of
ChannelViews. They can add actions, submenus and separators.
I added the signal to the `WindowManager` to allow plugins to listen to
these events in any channel.
Here's an example plugin:
```lua
c2.windows:on_channelview_context_menu_requested(function(args)
args.menu:add_action("Testing", function()
args.channel:add_system_message("Clicked!")
end)
args.menu:insert_action(1, "First!", function()
local msg = "text='" .. args.message.message_text .. "'"
if args.message_element then
msg = msg .. " element=" .. args.message_element.type
end
if args.split then
msg = msg .. " split={channel=" .. args.split.channel:get_name() .. "}"
end
args.channel:add_system_message(msg)
end)
local sub = args.menu:add_menu("Submenu")
sub:add_action("An action", function() end)
sub:add_separator()
sub:add_action("Second one", function() end)
end)
```
Reviewed-by: Mm2PL <mm2pl+gh@kotmisia.pl>
Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
Before, the schema would use the latest schema.
We should specify that we only need the draft-07 schema like the
Chatterino themes. The newer drafts aren't well-supported. For example,
Visual Studio only recently added support for the 2019 and 2020 drafts
(not even sure if that's released yet).
Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This PR adds `Channel:on_message{_appended, _replaced, s_cleared}`. They
use the same functionality as the display name changed signal and
forward the respective signals in `Channel`.
**They're all synchronous.** This makes the implementation fairly
straight forward, but also a trivial stack overflow. Other than
Chatterino crashing, this shouldn't have any consequences, because the
OS will kill the process. Note that a plugin can already halt Chatterino
by executing an infinite loop, because plugins run in the GUI thread.
Reviewed-by: Mm2PL <mm2pl+gh@kotmisia.pl>
Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
You can query them and on sets, you can change the images. Note that
sets are value types, so getting an image set in Lua will always refer
to a copy, not a reference.
Images are special, because plugin authors can specify a URL that
Chatterino will load if the image is shown. While the plugin can't see
the response, it still causes Chatterino to issue a request, so
_creating_ images will require the network permission.
Tested-by: Mm2PL <mm2pl+gh@kotmisia.pl>
Tested-by: pajlada <rasmus.karlsson@pajlada.com>
Reviewed-by: Mm2PL <mm2pl+gh@kotmisia.pl>
Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>