This module calls external programs to delegate functionality like sending E-Mail or displaying HTML. More...
Macros | |
#define | MAIN_ERR_PREFIX "EXT: " |
Message prefix for EXTUTILS module. | |
Functions | |
int | ext_handler_email (const char *recipient, const char *subject, const char *body) |
Send e-mail to single recipient. More... | |
int | ext_handler_uri (const char *uri, int *invalid) |
Start external handler for URI. More... | |
int | ext_editor (const char *tfpn, int async,...) |
Start external editor for article composition. More... | |
int | ext_editor_status (long int editor_pid) |
Poll status of external editor. More... | |
void | ext_editor_terminate (long int editor_pid) |
Terminate external editor. More... | |
const char * | ext_pp_filter (const char *article) |
External post processing filter for outgoing articles. More... | |
int | ext_inews (const char *article) |
Start external inews for article injection. More... | |
int | ext_download_file (const char *lpn, const char *uri) |
Download file from external source. More... | |
void | ext_free (void *p) |
Free an object allocated by external program delegation module. More... | |
This module calls external programs to delegate functionality like sending E-Mail or displaying HTML.
int ext_download_file | ( | const char * | lpn, |
const char * | uri | ||
) |
Download file from external source.
[in] | lpn | Local pathname where the file should be stored |
[in] | uri | URI of file to download |
Definition at line 1064 of file extutils.c.
References enc_ascii_check_printable(), http_download_file(), MAIN_ERR_PREFIX, and PRINT_ERROR.
int ext_editor | ( | const char * | tfpn, |
int | async, | ||
... | |||
) |
Start external editor for article composition.
[in] | tfpn | Pathname of temporary file (with UTF-8 content) to edit |
[in] | async | Flag indicating that function should return immediately |
The name of the external editor is taken from the configfile. It may not be a full pathname, the editor is searched via $PATH
in this case.
If async is zero, the calling thread is blocked until the process with the editor has terminated. No additional parameter should be passed.
If async is nonzero, a third parameter of type (long int*) must be passed by the caller. This function will write the PID of the editor process to this location and the editor will be started asynchronously. If this function returns success, the status of the external editor can be polled with the function ext_editor_status() using the returned PID.
Definition at line 517 of file extutils.c.
References CONF_EDITOR, config, main_debug, MAIN_ERR_PREFIX, PRINT_ERROR, conf_entry_val::s, sighandler_exec_prepare(), and conf::val.
int ext_editor_status | ( | long int | editor_pid | ) |
Poll status of external editor.
[in] | editor_pid | PID of external editor |
Definition at line 603 of file extutils.c.
References PRINT_ERROR.
void ext_editor_terminate | ( | long int | editor_pid | ) |
Terminate external editor.
[in] | editor_pid | PID of external editor |
Definition at line 649 of file extutils.c.
void ext_free | ( | void * | p | ) |
Free an object allocated by external program delegation module.
Use this function to release dynamic memory that was allocated by the external program delegation module.
[in] | p | Pointer to object |
Release the memory for the object pointed to by p.
NULL
and no operation is performed in this case. Definition at line 1143 of file extutils.c.
int ext_handler_email | ( | const char * | recipient, |
const char * | subject, | ||
const char * | body | ||
) |
Send e-mail to single recipient.
[in] | recipient | Recipient (URI or RFC 5322 conformant addr-spec ) |
[in] | subject | Subject (UTF-8 NFC encoded) or NULL |
[in] | body | Cited content for body (UTF-8 NFC encoded) or NULL |
This function calls the external program xdg-email
to handle the e-mail processing.
If recipient is an URI with mailto
scheme, the parameters subject and body should be NULL
and are ignored otherwise.
NULL
the functions return an error. Therefore this must not be checked by the caller.Definition at line 170 of file extutils.c.
int ext_handler_uri | ( | const char * | uri, |
int * | invalid | ||
) |
Start external handler for URI.
[in] | uri | Pointer to URI string |
[out] | invalid | Pointer to invalid encoding flag |
If the URI encoding of uri is invalid, a negative value is returned and a nonzero value is written to the location pointed to by invalid . Otherwise zero is written to the location pointed to by invalid .
This function calls the external program xdg-open
to handle the URI.
xdg-open
starts a WWW browser, call this function only for URIs that typically can be handled by such programs (like http://
or ftp://
types).open
is used to handle the URI.Definition at line 391 of file extutils.c.
int ext_inews | ( | const char * | article | ) |
Start external inews for article injection.
[in] | article | Article to inject in canonical form |
Definition at line 897 of file extutils.c.
References CONF_INEWS, config, fu_check_file(), main_debug, MAIN_ERR_PREFIX, PRINT_ERROR, conf_entry_val::s, sighandler_exec_prepare(), and conf::val.
const char* ext_pp_filter | ( | const char * | article | ) |
External post processing filter for outgoing articles.
[in] | article | Pointer to article (in canonical form) |
The pathname of the external filter is taken from the configfile.
Content-Type
and Content-Transfer-Encoding
and must always create valid UTF-8 encoded data.The Unicode normalization and conversion to the target character set is done after the postprocessing.
The caller is responsible to free the memory allocated for the result.
NULL
on error Definition at line 682 of file extutils.c.
References CONF_PPROC, config, fu_check_file(), main_debug, MAIN_ERR_PREFIX, PRINT_ERROR, conf_entry_val::s, sighandler_exec_prepare(), and conf::val.