1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Print event types.
//!
//! A list of all print events can also be viewed in HexChat under Settings > Text Events.
use crateEvent;
/// Trait implemented by all print event types.
///
/// Used with [`PluginHandle::emit_print`](crate::PluginHandle::emit_print),
/// [`PluginHandle::emit_print_attrs`](crate::PluginHandle::emit_print_attrs),
/// [`PluginHandle::hook_print`](crate::PluginHandle::hook_print),
/// and [`PluginHandle::hook_print_attrs`](crate::PluginHandle::hook_print_attrs).
///
/// This trait is sealed and cannot be implemented outside of `hexavalent`.
///
/// # Examples
///
/// Emitting a print event.
///
/// ```rust
/// use hexavalent::PluginHandle;
/// use hexavalent::event::print::ChannelMessage;
///
/// fn print_welcome_message<P>(ph: PluginHandle<'_, P>) -> Result<(), ()> {
/// ph.emit_print(ChannelMessage, [c"hexavalent", c"Plugin started!", c"@", c""])
/// }
/// ```
///
/// Registering a hook for a print event.
///
/// ```rust
/// use hexavalent::PluginHandle;
/// use hexavalent::event::print::ChannelMessage;
/// use hexavalent::hook::{Eat, Priority};
///
/// fn hook_message<P>(ph: PluginHandle<'_, P>) {
/// ph.hook_print(ChannelMessage, Priority::Normal, |plugin, ph, [nick, text, mode, ident]| {
/// ph.print(format!(
/// "Message from {} (with mode '{}', ident '{}'): {}",
/// nick, mode, ident, text
/// ));
/// Eat::HexChat
/// });
/// }
/// ```
pub use *;
/// Special print event types which can only be hooked, not emitted.
///
/// Attempting to emit these events with emission functions such as [`PluginHandle::emit_print`](crate::PluginHandle::emit_print) will always fail.
///
/// Analogous to the special print events documented for [`hexchat_hook_print`](https://hexchat.readthedocs.io/en/latest/plugins.html#c.hexchat_hook_print).