![]() |
![]() |
![]() |
NNTPGrab Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#define NNTPGRAB_API_VERSION NntpgrabCore * nntpgrab_core_new (void
); void nntpgrab_core_destroy (NntpgrabCore *obj
); NGList * nntpgrab_core_config_get_avail_servers (NntpgrabCore *obj
); void nntpgrab_core_config_free_avail_servers (NntpgrabCore *obj
,NGList *servers
); ngboolean nntpgrab_core_config_get_server_info (NntpgrabCore *obj
,const char *servername
,NGConfigServer *server
); ngboolean nntpgrab_core_config_add_server (NntpgrabCore *obj
,NGConfigServer new_server
,char **errmsg
); ngboolean nntpgrab_core_config_del_server (NntpgrabCore *obj
,const char *servername
,char **errmsg
); ngboolean nntpgrab_core_config_edit_server (NntpgrabCore *obj
,const char *servername
,NGConfigServer server
,char **errmsg
); NGConfigOpts nntpgrab_core_config_get_opts (NntpgrabCore *obj
); void nntpgrab_core_config_set_opts (NntpgrabCore *obj
,NGConfigOpts opts
); ngboolean nntpgrab_core_schedular_start (NntpgrabCore *obj
); ngboolean nntpgrab_core_schedular_stop (NntpgrabCore *obj
,ngboolean wait
); NGSchedularState nntpgrab_core_schedular_get_state (NntpgrabCore *obj
); ngboolean nntpgrab_core_schedular_add_task_to_queue (NntpgrabCore *obj
,const char *collection_name
,const char *subject
,const char *poster
,time_t stamp
,nguint64 file_size
,NGList *groups
,NGList *parts
,char **errmsg
); ngboolean nntpgrab_core_schedular_del_task_from_queue (NntpgrabCore *obj
,const char *collection_name
,const char *subject
,char **errmsg
); ngboolean nntpgrab_core_schedular_restart_task (NntpgrabCore *obj
,const char *collection_name
,const char *subject
,char **errmsg
); ngboolean nntpgrab_core_schedular_save_queue (NntpgrabCore *obj
,char **errmsg
); void nntpgrab_core_schedular_foreach_task (NntpgrabCore *obj
,ForeachCollectionFunc collection_func
,ForeachFileFunc file_func
,ForeachGroupFunc group_func
,void *user_data
); ngboolean nntpgrab_core_schedular_move_task (NntpgrabCore *obj
,const char *collection_name_src
,const char *subject_src
,const char *collection_name_dest
,int position_dest
); ngboolean nntpgrab_core_schedular_move_collection (NntpgrabCore *obj
,const char *collection_name
,int new_position
); ngboolean nntpgrab_core_schedular_mark_task_optional (NntpgrabCore *obj
,const char *collection_name
,const char *subject
,ngboolean is_optional
); NGList * nntpgrab_core_plugins_get_avail_plugins (NntpgrabCore *obj
); void nntpgrab_core_plugins_free_avail_plugins (NntpgrabCore *obj
,NGList *plugins
); ngboolean nntpgrab_core_plugins_get_plugin_info (NntpgrabCore *obj
,const char *plugin_name
,NNTPGrabPluginInfo *plugin_info
); ngboolean nntpgrab_core_plugins_load_plugin (NntpgrabCore *obj
,const char *plugin_name
,char **errmsg
); ngboolean nntpgrab_core_plugins_unload_plugin (NntpgrabCore *obj
,const char *plugin_name
,char **errmsg
); ngboolean nntpgrab_core_plugins_set_persistent (NntpgrabCore *obj
,const char *plugin_name
,ngboolean persistent
); ngboolean nntpgrab_core_embedded_server_start (NntpgrabCore *obj
,int port
,char **errmsg
);
NntpgrabCore * nntpgrab_core_new (void
);
Creates a new instance of the NntpgrabCore object. This is required for all other NNTPGrab functions
Returns : |
An instance of the NntpgrabCore which need to be used for other NNTPGrab functions |
void nntpgrab_core_destroy (NntpgrabCore *obj
);
Cleanup the NNTPGrab Core library. After this function is called, the NntpgrabCore instance can't be used anymore
|
An instance of the NntpgrabCore |
NGList * nntpgrab_core_config_get_avail_servers
(NntpgrabCore *obj
);
Retrieve a list of the available usenet servers
|
An instance of the NntpgrabCore |
Returns : |
A list of all the available usenet servers. Needs to be freed using nntpgrab_config_free_avail_servers() . [transfer full][element-type utf8]
|
void nntpgrab_core_config_free_avail_servers (NntpgrabCore *obj
,NGList *servers
);
Free the list of available usenet servers
|
An instance of the NntpgrabCore |
|
A list of the available usenet servers as returned from the function nntpgrab_config_get_avail_servers()
|
ngboolean nntpgrab_core_config_get_server_info (NntpgrabCore *obj
,const char *servername
,NGConfigServer *server
);
Get the configuration details about a specific usenet server
|
An instance of the NntpgrabCore |
|
The name of the server whose details should be retrieved |
|
The address of a ConfigServer structure which will be used to fill in the configuration details. [out] |
Returns : |
TRUE on success (server will be filled in), FALSE if the server isn't known |
ngboolean nntpgrab_core_config_add_server (NntpgrabCore *obj
,NGConfigServer new_server
,char **errmsg
);
Add a new usenet server to the NNTPGrab configuration
|
An instance of the NntpgrabCore |
|
A structure containing the details about the new usenet server |
|
Pointer to a char*. If an errors occurs, the reason will be placed in this field. Needs to be freed using ngfree() . Can be NULL to ignore errors. [allow-none][out]
|
Returns : |
TRUE when the server was successfully added. FALSE on failure (the reason will be placed in the errmsg field) |
ngboolean nntpgrab_core_config_del_server (NntpgrabCore *obj
,const char *servername
,char **errmsg
);
Remove a usenet server from the NNTPGrab configuration
|
An instance of the NntpgrabCore |
|
The name of the server whose entry should be removed |
|
Pointer to a char*. If an errors occurs, the reason will be placed in this field. Needs to be freed using ngfree() . Can be NULL to ignore errors. [allow-none][out]
|
Returns : |
TRUE when the server was successfully removed. FALSE on failure (the reason will be placed in the errmsg field) |
ngboolean nntpgrab_core_config_edit_server (NntpgrabCore *obj
,const char *servername
,NGConfigServer server
,char **errmsg
);
Adjust the configuration details of an usenet server
|
An instance of the NntpgrabCore |
|
The name of the server whose entry should be adjusted |
|
A structure containing the new configuration details of the given servername |
|
Pointer to a char*. If an errors occurs, the reason will be placed in this field. Needs to be freed using ngfree() . Can be NULL to ignore errors. [allow-none][out]
|
Returns : |
TRUE when the server was successfully adjusted. FALSE on failure (the reason will be placed in the errmsg field) |
NGConfigOpts nntpgrab_core_config_get_opts (NntpgrabCore *obj
);
Retrieve the general configuration options
|
An instance of the NntpgrabCore |
Returns : |
A structure containing the general configuration options |
void nntpgrab_core_config_set_opts (NntpgrabCore *obj
,NGConfigOpts opts
);
Adjust the general configuration options
|
An instance of the NntpgrabCore |
|
A structure containing the new general configuration options |
ngboolean nntpgrab_core_schedular_start (NntpgrabCore *obj
);
Start the NNTPGrab schedular
|
An instance of the NntpgrabCore |
Returns : |
TRUE is the schedular was successfully started, FALSE if the schedular was already running or in the 'stopping' state |
ngboolean nntpgrab_core_schedular_stop (NntpgrabCore *obj
,ngboolean wait
);
Stop the NNTPGrab schedular
|
An instance of the NntpgrabCore |
|
Whether this function should wait until the schedular really has stopped |
Returns : |
TRUE is schedular was successfully stopped, FALSE if the schedular was already stopped or the in 'stopping' state |
NGSchedularState nntpgrab_core_schedular_get_state (NntpgrabCore *obj
);
Retrieve the current state of the schedular
|
An instance of the NntpgrabCore |
Returns : |
The current state of the schedular |
ngboolean nntpgrab_core_schedular_add_task_to_queue (NntpgrabCore *obj
,const char *collection_name
,const char *subject
,const char *poster
,time_t stamp
,nguint64 file_size
,NGList *groups
,NGList *parts
,char **errmsg
);
Add a new task to the download queue
|
An instance of the NntpgrabCore |
|
The name of the collection in which this task should be added. If there is no collection in the download queue with the given name, it will automatically be created |
|
The subject of the file |
|
The name of the poster |
|
The UNIX timestamp of the post date |
|
The size of the file |
|
A list containing the newsgroups in which this file is posted. [element-type utf8] |
|
A list containing the message-id's of all the individual parts belonging to this file. [element-type NNTPGrabPart] |
|
Pointer to a char*. If an errors occurs, the reason will be placed in this field. Needs to be freed using ngfree() . Can be NULL to ignore errors. [allow-none][out]
|
Returns : |
TRUE if the task was succesfully added, FALSE if an error occured (errmsg will be set) |
ngboolean nntpgrab_core_schedular_del_task_from_queue (NntpgrabCore *obj
,const char *collection_name
,const char *subject
,char **errmsg
);
Remove a task from the download queue
|
An instance of the NntpgrabCore |
|
The name of the collection in which the task resides |
|
The subject of the task
errmsg (allow-none) (out): Pointer to a char*. If an errors occurs, the reason will be placed in this field. Needs to be freed using ngfree() . Can be NULL to ignore errors. [allow-none]
|
Returns : |
TRUE if the task was successfully removed, FALSE if an error occured (errmsg will be set) |
ngboolean nntpgrab_core_schedular_restart_task (NntpgrabCore *obj
,const char *collection_name
,const char *subject
,char **errmsg
);
Restart a task in the download queue
|
An instance of the NntpgrabCore |
|
The name of the collection in which the task resides |
|
The subject of the task
errmsg (allow-none) (out): Pointer to a char*. If an errors occurs, the reason will be placed in this field. Needs to be freed using ngfree() . Can be NULL to ignore errors. [allow-none]
|
Returns : |
TRUE if the task was successfully removed, FALSE if an error occured (errmsg will be set) |
ngboolean nntpgrab_core_schedular_save_queue (NntpgrabCore *obj
,char **errmsg
);
Save any recent changes in the download queue to the disk Note that the download queue will automatically be saved every now and then by the NNTPGrab Core, but it is recommended to perform a manual save as soon as a lot of file have been added to the download queue (like directly after an NZB import)
|
An instance of the NntpgrabCore |
|
Pointer to a char*. If an errors occurs, the reason will be placed in this field. Needs to be freed using ngfree() . Can be NULL to ignore errors. [allow-none][out]
|
Returns : |
TRUE if the task was successfully removed, FALSE if an error occured (errmsg will be set) |
void nntpgrab_core_schedular_foreach_task (NntpgrabCore *obj
,ForeachCollectionFunc collection_func
,ForeachFileFunc file_func
,ForeachGroupFunc group_func
,void *user_data
);
Retrieve a list of all the items in the download queue (using callback functions)
|
An instance of the NntpgrabCore |
|
The function which should be called for every collection in the download queue. [allow-none] |
|
The function which should be called for every file in the download queue. [allow-none] |
|
The function which should be called for every group in every file in the download queue. [allow-none] |
|
Pointer to some data which will be made available in the callback functions. [allow-none] |
ngboolean nntpgrab_core_schedular_move_task (NntpgrabCore *obj
,const char *collection_name_src
,const char *subject_src
,const char *collection_name_dest
,int position_dest
);
Move a task in the download queue
|
An instance of the NntpgrabCore |
|
The name of the collection where the subject is part of |
|
The name of the subject which needs to be moved |
|
The name of the collection where the subject needs to be moved to (if NULL, the task will stay in the same collection as it is now)
position_dest The position in collection_name_dest where the task needs to be placed at. [allow-none]
|
Returns : |
TRUE on success, FALSE if the collection_name_src or subject_src could not be found |
ngboolean nntpgrab_core_schedular_move_collection (NntpgrabCore *obj
,const char *collection_name
,int new_position
);
Move the position of a collection in the download queue
|
An instance of the NntpgrabCore |
|
The name of the collection which needs to be moved |
|
The position in the download queue where the collection needs to be moved to |
Returns : |
TRUE on success, FALSE is the collection_name could not be found |
ngboolean nntpgrab_core_schedular_mark_task_optional (NntpgrabCore *obj
,const char *collection_name
,const char *subject
,ngboolean is_optional
);
Mark a task in the download queue optional or non-optional
|
An instance of the NntpgrabCore |
|
The name of the collection in which the task resides |
|
The subject of the task |
|
TRUE if the task needs to be marked optional, FALSE is the task needs to be marked non-optional |
Returns : |
TRUE if the task was successfully updated, FALSE if the task wasn't found |
NGList * nntpgrab_core_plugins_get_avail_plugins
(NntpgrabCore *obj
);
Retrieve a list of all the available plugins
|
An instance of the NntpgrabCore |
Returns : |
A list containing all the available plugins (const char* items). Needs to be free'd using nntpgrab_core_plugins_free_avail_plugins() . [transfer full][element-type utf8]
|
void nntpgrab_core_plugins_free_avail_plugins (NntpgrabCore *obj
,NGList *plugins
);
Free a list as returned by the function nntpgrab_core_plugins_get_avail_plugins()
|
An instance of the NntpgrabCore |
|
The list of available plugins |
ngboolean nntpgrab_core_plugins_get_plugin_info (NntpgrabCore *obj
,const char *plugin_name
,NNTPGrabPluginInfo *plugin_info
);
Retrieve information about a specific plugin
|
An instance of the NntpgrabCore |
|
The name of the plugin whose information needs to be retrieved |
|
Pointer to an NNTPGrabPluginInfo structure where the plugin information can be saved. [out] |
Returns : |
TRUE on success, FALSE if the given plugin_name is unknown |
ngboolean nntpgrab_core_plugins_load_plugin (NntpgrabCore *obj
,const char *plugin_name
,char **errmsg
);
Load a plugin
|
An instance of the NntpgrabCore |
|
The name of the plugin which needs to be loaded |
|
Pointer to a location where an error message can be saved. Needs to be free'd using ng_free() . [allow-none][out]
|
Returns : |
TRUE on success, FALSE is the given plugin_name is unknown or an error occured while loading the plugin |
ngboolean nntpgrab_core_plugins_unload_plugin (NntpgrabCore *obj
,const char *plugin_name
,char **errmsg
);
Unload a plugin
|
An instance of the NntpgrabCore |
|
The name of the plugin which needs to be unloaded |
|
Pointer to a location where an error message can be saved. Needs to be free'd using ng_free() . [allow-none][out]
|
Returns : |
TRUE on success, FALSE is the given plugin_name is unknown or an error occured while unloading the plugin |
ngboolean nntpgrab_core_plugins_set_persistent (NntpgrabCore *obj
,const char *plugin_name
,ngboolean persistent
);
Indicate whether a plugin needs to be automatically loaded on startup Note that this API function is unused in NNTPGrab 0.6
|
An instance of the NntpgrabCore |
|
The name of the plugin |
|
Flag to indicate whether this plugin needs to be automatically loaded or not |
Returns : |
TRUE on success, FALSE is the given plugin_name is unknown |
ngboolean nntpgrab_core_embedded_server_start (NntpgrabCore *obj
,int port
,char **errmsg
);
Start the embedded server on the specified port (even if it's disabled in the configuration) Note that this API function is implemented temporary for NNTPGrab 0.6. For future versions it needs to be moved to a more generic API function
|
An instance of the NntpgrabCore |
|
The port on which the embedded webserver needs to listen |
|
Pointer to a location where an error message can be saved. Needs to be free'd using ng_free() . [allow-none][out]
|
Returns : |
TRUE on success, FALSE if an error occured (errmsg will be set) |