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
//! Server event types.
use crateEvent;
/// Trait implemented by all server event types.
///
/// Used with [`PluginHandle::hook_server`](crate::PluginHandle::hook_server)
/// and [`PluginHandle::hook_server_attrs`](crate::PluginHandle::hook_server_attrs).
///
/// This trait is sealed and cannot be implemented outside of `hexavalent`.
///
/// # Examples
///
/// Registering a hook for a server event.
///
/// ```rust
/// use hexavalent::PluginHandle;
/// use hexavalent::event::server::Privmsg;
/// use hexavalent::hook::{Eat, Priority};
///
/// fn hook_privmsg<P>(ph: PluginHandle<'_, P>) {
/// ph.hook_server(Privmsg, Priority::Normal, |plugin, ph, [sender, _, target, text]| {
/// ph.print(format!("Message from {} to {}: {}", sender, target, text));
/// Eat::None
/// });
/// }
/// ```
pub use *;
/// Special server events types which do not represent a message in the IRC specification.
///
/// Analogous to the special server events documented for [`hexchat_hook_server`](https://hexchat.readthedocs.io/en/latest/plugins.html#c.hexchat_hook_server).