![]() |
![]() |
![]() |
NNTPGrab Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
#define NNTPGRAB_PLUGIN_API_VERSION enum NNTPGrabErrCode; enum NNTPGrabDecoderRes; typedef NGPluginCoreData; NGPluginCoreFuncs; NGPlugin; void ng_plugin_set_name (NGPlugin *plugin_data
,const char *name
); void ng_plugin_set_version (NGPlugin *plugin_data
,const char *version
); void ng_plugin_set_author (NGPlugin *plugin_data
,const char *author
); void ng_plugin_set_url (NGPlugin *plugin_data
,const char *url
); void ng_plugin_set_description (NGPlugin *plugin_data
,const char *description
); ngboolean ng_plugin_get_is_loaded (NGPlugin *plugin_data
); ngboolean ng_plugin_register_function (NGPlugin *plugin_data
,const char *function_name
,NGPluginFunction impl
,GSignalCMarshaller marshaller
,GType return_type
,int num_params
,...
); void ng_plugin_set_required_function (NGPlugin *plugin_data
,const char *function_name
); ngboolean ng_plugin_call (NGPlugin *plugin_data
,const char *function_name
,...
); ngboolean ng_plugin_create_event (NGPlugin *plugin_data
,const char *event_name
,int num_params
); void ng_plugin_set_required_event (NGPlugin *plugin_data
,const char *event_name
); ngboolean ng_plugin_connect_event (NGPlugin *plugin_data
,const char *event_name
,NGPluginFunction impl
,void *user_data
); ngboolean ng_plugin_disconnect_event_by_func (NGPlugin *plugin_data
,NGPluginFunction impl
,void *user_data
); ngboolean ng_plugin_emit_event (NGPlugin *plugin_data
,const char *event_name
,const char *params[]
); void ng_plugin_emit_log_msg (NGPlugin *plugin_data
,NGLogLevel log_level
,const char *format
,...
);
typedef enum { NNTP_ERROR_NONE, NNTP_ERROR_HOST_NOT_FOUND, NNTP_ERROR_SSL_INITIALISE, NNTP_ERROR_CONNECTION_REFUSED, NNTP_ERROR_CONNECTION_TIMEOUT, NNTP_ERROR_READ, NNTP_ERROR_WRITE, NNTP_ERROR_INVALID_MSG, NNTP_ERROR_LOGIN_FAILURE, NNTP_ERROR_TOO_MANY_CONNECTIONS, NNTP_ERROR_PART_NOT_AVAILABLE, NNTP_ERROR_NO_SUCH_GROUP, NNTP_ERROR_UNABLE_TO_SAVE_PART, } NNTPGrabErrCode;
typedef enum { DECODER_RESULT_COMPLETE, DECODER_RESULT_INCOMPLETE, DECODER_RESULT_NO_PARTS_AVAIL, DECODER_RESULT_ERROR } NNTPGrabDecoderRes;
typedef struct { NGList *(*config_get_avail_servers) (void); void (*config_free_avail_servers) (NGList *servers); ngboolean (*config_get_server_info) (const char *servername, NGConfigServer *server); ngboolean (*config_add_server) (NGConfigServer new_server, char **errmsg); ngboolean (*config_del_server) (const char *servername, char **errmsg); ngboolean (*config_edit_server) (const char *servername, NGConfigServer server, char **errmsg); NGConfigOpts (*config_get_opts) (void); void (*config_set_opts) (NGConfigOpts opts); ngboolean (*config_save) (char **errmsg); ngboolean (*schedular_start) (void); ngboolean (*schedular_stop) (const char *reason, ngboolean wait); NGSchedularState (*schedular_get_state) (void); ngboolean (*schedular_add_file_to_queue) (const char *collection_name, const char *subject, const char *poster, time_t stamp, nguint64 file_size, NGList *groups, NGList *parts, char **errmsg); ngboolean (*schedular_del_file_from_queue) (const char *collection_name, const char *subject, char **errmsg); ngboolean (*schedular_restart_file) (const char *collection_name, const char *subject, char **errmsg); ngboolean (*schedular_save_queue) (char **errmsg); void (*schedular_foreach_file) (ForeachCollectionFunc collection_func, ForeachFileFunc file_func, ForeachGroupFunc group_func, void *data); ngboolean (*schedular_move_file) (const char *collection_name_src, const char *subject_src, const char *collection_name_dest, int position_dest); ngboolean (*schedular_move_collection) (const char *collection_name, int new_position); ngboolean (*schedular_mark_task_optional) (const char *collection_name, const char *subject, ngboolean is_optional); NGList *(*plugins_get_avail_plugins) (void); void (*plugins_free_avail_plugins) (NGList *plugins); ngboolean (*plugins_get_plugin_info) (const char *plugin_name, NNTPGrabPluginInfo *plugin_info); ngboolean (*plugins_load_plugin) (const char *plugin_name, char **errmsg); ngboolean (*plugins_unload_plugin) (const char *plugin_name, char **errmsg); ngboolean (*plugins_set_persistent) (const char *plugin_name, ngboolean persistent); void (*server_request_quit) (void); void (*set_emit_log_messages) (ngboolean val); } NGPluginCoreFuncs;
Structure containing all the exported functions from the NNTPGrab Core
Get a list of all the available usenet servers. Needs to be free'd using config_free_avail_servers | |
Free a list of usenet servers returned by config_get_avail_servers | |
Retrieve information from a configured usenet server | |
Add a new usenet server to the configuration | |
Delete a usenet server from the configuration | |
Change an already configured usenet server | |
Retrieve general configuration parameters | |
Change general configuration parameters | |
Save the configuration to disk | |
Start the schedular | |
Stop the schedular | |
Retrieve the current state of the schedular | |
Add a file to the download queue | |
Remove a file from the download queue | |
Restart a file in the download queue | |
Force any changes in the download queue to be saved to disk | |
Retrieve a list of all the items in the download queue (by using callback functions) | |
Change the position of a file in the download queue | |
Change the position of a collection in the download queue | |
Mark a task optional or non-optional | |
Retrieve a list of all the available plugins | |
Free a list as returned by the function plugins_get_avail_plugins | |
Retrieve information about a specific plugin | |
Load a plugin | |
Unload a plugin | |
Indicate whether a plugin needs to be automatically loaded on startup | |
Give a signal to the frontend that it must quit the program | |
Indicate whether log messages should be emit |
void ng_plugin_set_name (NGPlugin *plugin_data
,const char *name
);
Set the name of the plugin
|
Structure containing plugin information |
|
Name of the plugin. Will be used to identify plugins. Must be unique |
void ng_plugin_set_version (NGPlugin *plugin_data
,const char *version
);
Set the version of the plugin
|
Structure containing plugin information |
|
Version of the plugin |
void ng_plugin_set_author (NGPlugin *plugin_data
,const char *author
);
Set the author of the plugin
|
Structure containing plugin information |
|
The name of the author(s) of this plugin |
void ng_plugin_set_url (NGPlugin *plugin_data
,const char *url
);
Set the URL of the plugin
|
Structure containing plugin information |
|
Location where users can find out more information about this plugin |
void ng_plugin_set_description (NGPlugin *plugin_data
,const char *description
);
Set the description of the plugin
|
Structure containing plugin information |
|
Description containing the functionality of this plugin |
ngboolean ng_plugin_get_is_loaded (NGPlugin *plugin_data
);
Find out if the plugin is fully loaded at the moment
|
Structure containing plugin information |
Returns : |
TRUE when the plugin is fully loaded |
ngboolean ng_plugin_register_function (NGPlugin *plugin_data
,const char *function_name
,NGPluginFunction impl
,GSignalCMarshaller marshaller
,GType return_type
,int num_params
,...
);
Create a new function which can be called from other plugins
|
Structure containing plugin information |
|
The name of the function. Must be unique |
|
Pointer to the implementation of this function |
|
The function to translate arrays of parameter values to proper parameters |
|
The return type of the function |
|
The number of arguments which this function expects |
|
A list of parameter types |
Returns : |
TRUE if the function was successfully registered, FALSE if it was already registered |
void ng_plugin_set_required_function (NGPlugin *plugin_data
,const char *function_name
);
Indicate that the plugin requires a function from another plugin to function properly
|
Structure containing plugin information |
|
The name of the function which this plugin requires for proper operation |
ngboolean ng_plugin_call (NGPlugin *plugin_data
,const char *function_name
,...
);
Call a function from another plugin
|
Structure containing plugin information |
|
The name of the function which needs to be called |
|
Variable number of arguments to pass on to the function. If a return value is expected, it must be the last argument |
Returns : |
TRUE is the function has been called, FALSE if the function isn't registered |
ngboolean ng_plugin_create_event (NGPlugin *plugin_data
,const char *event_name
,int num_params
);
Create a new event on which other plugins can register to
|
Structure containing plugin information |
|
The name of the event. Must be unique |
|
The number of arguments which this event expects |
Returns : |
TRUE if the event was successfully created, FALSE if it was already registered |
void ng_plugin_set_required_event (NGPlugin *plugin_data
,const char *event_name
);
Indicate that the plugin requires a event from another plugin to function properly
|
Structure containing plugin information |
|
The name of the event which this plugin requires for proper operation |
ngboolean ng_plugin_connect_event (NGPlugin *plugin_data
,const char *event_name
,NGPluginFunction impl
,void *user_data
);
Connect to an event exported from another plugin
|
Structure containing plugin information |
|
The name of the event |
|
The callback function which needs to be called when the event is emit |
|
Optional callback data |
Returns : |
TRUE if the event was successfully connection. FALSE if the event_name isn't known |
ngboolean ng_plugin_disconnect_event_by_func (NGPlugin *plugin_data
,NGPluginFunction impl
,void *user_data
);
Disconnect an event handler Most plugins don't need to use this function as it will be done automatically on unload
|
Structure containing plugin information |
|
The callback function |
|
Optional callback data |
Returns : |
TRUE if the event handler was successfully disconnected. FALSE if no connection exists |
ngboolean ng_plugin_emit_event (NGPlugin *plugin_data
,const char *event_name
,const char *params[]
);
Emit an event
|
Structure containing plugin information |
|
The name of the event which needs to be emit |
|
NULL-terminated array of arguments to pass on to the event handlers |
Returns : |
TRUE if the event was successfully emit. FALSE if the event_name isn't registered yet |
void ng_plugin_emit_log_msg (NGPlugin *plugin_data
,NGLogLevel log_level
,const char *format
,...
);
Emit a message for logging
|
Structure containing plugin information |
|
The log level |
|
The format string |
|
Variable number of arguments containing data for the given format |