NeoMutt  2025-12-11-694-ga89709
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
hook.c File Reference

User-defined Hooks. More...

#include "config.h"
#include "mutt/lib.h"
#include "hook.h"
#include "expando/lib.h"
#include "pattern/lib.h"
+ Include dependency graph for hook.c:

Go to the source code of this file.

Functions

void hook_free (struct Hook **ptr)
 Free a Hook.
 
struct Hookhook_new (void)
 Create a Hook.
 

Detailed Description

User-defined Hooks.

Authors
  • Michael R. Elkins, and others
  • Thomas Adam
  • Richard Russon
  • Pietro Cerutti
  • Federico Kircheis
  • Naveen Nathan
  • Oliver Bandel
  • Dennis Schön
  • Tóth János

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file hook.c.

Function Documentation

◆ hook_free()

void hook_free ( struct Hook ** ptr)

Free a Hook.

Parameters
ptrHook to free

Definition at line 47 of file hook.c.

48{
49 if (!ptr || !*ptr)
50 return;
51
52 struct Hook *h = *ptr;
53
54 FREE(&h->command);
55 FREE(&h->source_file);
56 FREE(&h->regex.pattern);
57 if (h->regex.regex)
58 {
59 regfree(h->regex.regex);
60 FREE(&h->regex.regex);
61 }
64 FREE(ptr);
65}
void mutt_pattern_free(struct PatternList **pat)
Free a Pattern.
Definition compile.c:826
void expando_free(struct Expando **ptr)
Free an Expando object.
Definition expando.c:61
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
A list of user hooks.
Definition hook.h:33
struct PatternList * pattern
Used for fcc,save,send-hook.
Definition hook.h:38
struct Regex regex
Regular expression.
Definition hook.h:35
char * command
Filename, command or pattern to execute.
Definition hook.h:36
struct Expando * expando
Used for format hooks.
Definition hook.h:39
char * source_file
Used for relative-directory source.
Definition hook.h:37
char * pattern
printable version
Definition regex3.h:86
regex_t * regex
compiled expression
Definition regex3.h:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hook_new()

struct Hook * hook_new ( void )

Create a Hook.

Return values
ptrNew Hook

Definition at line 71 of file hook.c.

72{
73 return MUTT_MEM_CALLOC(1, struct Hook);
74}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
+ Here is the caller graph for this function: