comparison man/libirccd-hook.3 @ 1013:efeb73a9918b

man: add C API for what is mostly stabilized
author David Demelier <markand@malikania.fr>
date Wed, 17 Feb 2021 18:16:19 +0100
parents
children f18988efb96b
comparison
equal deleted inserted replaced
1012:027ef1952696 1013:efeb73a9918b
1 .\"
2 .\" Copyright (c) 2013-2021 David Demelier <markand@malikania.fr>
3 .\"
4 .\" Permission to use, copy, modify, and/or distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
7 .\"
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 .\"
16 .Dd @IRCCD_MAN_DATE@
17 .Dt LIBIRCCD-HOOK 3
18 .Os
19 .\" NAME
20 .Sh NAME
21 .Nm libirccd-hook
22 .Nd manipulate hooks
23 .\" SYNOPSIS
24 .Sh SYNOPSIS
25 .In irccd/hook.h
26 .Ft struct irc_hook *
27 .Fn irc_hook_new "const char *name, const char *path"
28 .Ft void
29 .Fn irc_hook_invoke "struct irc_hook *hook, const struct irc_event *ev"
30 .Ft void
31 .Fn irc_hook_finish "struct irc_hook *"
32 .\" DESCRIPTION
33 .Sh DESCRIPTION
34 This header provides functions to create new hook or to invoke them.
35 .Pp
36 The
37 .Vt "struct irc_hook"
38 is declared as:
39 .Bd -literal
40 struct irc_hook {
41 char name[IRC_ID_LEN];
42 char path[PATH_MAX];
43 LIST_ENTRY(irc_hook) link;
44 };
45 .Ed
46 .Pp
47 The fields of
48 .Vt "struct irc_hook"
49 are:
50 .Bl -tag -width name
51 .It Va name
52 Name to identify this hook.
53 .It Va path
54 Absolute path to the hook.
55 .It Va link
56 Abstract entry to be used with the
57 .Xr queue 3
58 macros.
59 .El
60 .Pp
61 The
62 .Fn irc_hook_new
63 allocates a new hook with the identifer
64 .Fa name
65 on the given
66 .Fa path .
67 Those arguments will be copied into the returned structure fields of the same
68 name.
69 .Pp
70 The
71 .Fn irc_hook_invoke
72 will invoke the
73 .Fa hook
74 with the current IRC event pointed by
75 .Fa ev .
76 .Pp
77 The
78 .Fn irc_hook_finish
79 clears resources allocated for the
80 .Fa hook .
81 Make sure to remove it from the linked list where it is attached to before
82 calling this function.
83 .\" SEE ALSO
84 .Sh SEE ALSO
85 .Xr libirccd 3