#include #include #include #include #include #include "nntpgrab.h"#include "nntpgrab_internal.h"#include "nntpgrab_utils.h"#include "marshalers.h"#include "configuration.h"#include "schedular.h"#include "nntpconnection.h"#include "decoder.h"#include "par2.h"#include "unpack.h"#include "collection_alloc.h"
Data Structures |
|
| struct | NNTPGrabCore |
| struct | NNTPGrabCoreClass |
Defines |
|
| #define | NNTPGRAB_TYPE_CORE (core_get_type ()) |
| #define | NNTPGRAB_CORE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), NNTPGRAB_TYPE_CORE, NNTPGrabCore)) |
| #define | NNTPGRAB_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NNTPGRAB_TYPE_CORE, NNTPGrabCoreClass)) |
| #define | IS_NNTPGRAB_CORE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), NNTPGRAB_TYPE_CORE)) |
| #define | IS_NNTPGRAB_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NNTPGRAB_TYPE_CORE)) |
| #define | NNTPGRAB_CORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NNTPGRAB_TYPE_CORE, NNTPGrabCoreClass)) |
Enumerations |
|
| enum | { CONFIG_CHANGED_SIGNAL, PART_DOWNLOAD_START_SIGNAL, PART_DONE_SIGNAL, PART_FAILED_SIGNAL, PART_PROGRESS_UPDATE_SIGNAL, TRAFFIC_MONITOR_UPDATE_SIGNAL, COLLECTION_ADDED_SIGNAL, COLLECTION_REMOVED_SIGNAL, COLLECTION_MODIFIED_SIGNAL, FILE_ADDED_SIGNAL, FILE_REMOVED_SIGNAL, FILE_DOWNLOAD_STATE_UPDATE_SIGNAL, FILE_STATE_CHANGED_SIGNAL, CONNECTION_CONNECTING_SIGNAL, CONNECTION_CONNECTED_SIGNAL, CONNECTION_DISCONNECT_SIGNAL, SCHEDULAR_STATE_CHANGED_SIGNAL, FATAL_ERROR_SIGNAL, WARNING_MESSAGE_SIGNAL, DEBUG_MESSAGE_SIGNAL, TASK_MOVED_SIGNAL, COLLECTION_MOVED_SIGNAL, PAR2_REPAIR_MESSAGE_SIGNAL, ALL_DOWNLOADS_COMPLETED_SIGNAL, UNPACK_PROGRESS_UPDATE_SIGNAL, UNPACK_MESSAGE_RECEIVED_SIGNAL, UNPACK_WORKING_ARCHIVE_CHANGED_SIGNAL, PAR2_BEGIN_VERIFY_SIGNAL, PAR2_LOAD_PROGRESS_UPDATE_SIGNAL, PAR2_RECOVERY_FILE_LOADED_SIGNAL, PAR2_FILE_LOADED_SIGNAL, PAR2_REPAIR_PROGRESS_UPDATE_SIGNAL, PAR2_REPAIR_FAILURE_SIGNAL, PAR2_REPAIR_SUCCESS_SIGNAL, PAR2_NO_REPAIR_REQUIRED_SIGNAL, LAST_SIGNAL } |
Functions |
|
| NNTPGrabCore * | get_core (void) |
| NNTPGrabCore * | nntpgrab_core_init (int version, char **err, char **warnings) |
| Initialize the NNTPGrab Core library. |
|
| void | nntpgrab_core_cleanup (NNTPGrabCore *obj) |
| Cleanup the NNTPGrab Core library. |
|
| NGList * | nntpgrab_core_config_get_avail_servers (NNTPGrabCore *obj) |
| Retrieve a list of the available usenet servers. |
|
| void | nntpgrab_core_config_free_avail_servers (NNTPGrabCore *obj, NGList *servers) |
| Free the list of available usenet servers. |
|
| ngboolean | nntpgrab_core_config_get_server_info (NNTPGrabCore *obj, const char *servername, ConfigServer *ret) |
| Get the configuration details about a specific usenet server. |
|
| ngboolean | nntpgrab_core_config_add_server (NNTPGrabCore *obj, ConfigServer new_server, char **errmsg) |
| Add a new usenet server to the NNTPGrab configuration. |
|
| ngboolean | nntpgrab_core_config_del_server (NNTPGrabCore *obj, const char *servername, char **errmsg) |
| Remove a usenet server from the NNTPGrab configuration. |
|
| ngboolean | nntpgrab_core_config_edit_server (NNTPGrabCore *obj, const char *servername, ConfigServer server, char **errmsg) |
| Adjust the configuration details of an usenet server. |
|
| ConfigOpts | nntpgrab_core_config_get_opts (NNTPGrabCore *obj) |
| Retrieve the general configuration options. |
|
| void | nntpgrab_core_config_set_opts (NNTPGrabCore *obj, ConfigOpts opts) |
| Adjust the general configuration options. |
|
| ngboolean | nntpgrab_core_config_get_folder_listing (NNTPGrabCore *obj, const char *parent, NGList **folders) |
| Retrieves a list containing all the sub-folders which are in the given folder. |
|
| void | nntpgrab_core_config_free_folder_listing (NNTPGrabCore *obj, NGList *folders) |
| Free a list of sub-folders. |
|
| gboolean | nntpgrab_core_schedular_start (NNTPGrabCore *obj) |
| Start the NNTPGrab schedular. |
|
| ngboolean | nntpgrab_core_schedular_stop (NNTPGrabCore *obj, ngboolean wait) |
| Stop the NNTPGrab schedular. |
|
| SchedularState | nntpgrab_core_schedular_get_state (NNTPGrabCore *obj) |
| Retrieve 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. |
|
| 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. |
|
| ngboolean | nntpgrab_core_schedular_restart_task (NNTPGrabCore *obj, const char *collection_name, const char *subject, char **errmsg) |
| Restart a task in the download queue. |
|
| ngboolean | nntpgrab_core_schedular_save_queue (NNTPGrabCore *obj, char **errmsg) |
| Save any recent changes in the download queue to the disk. |
|
| void | nntpgrab_core_schedular_foreach_task (NNTPGrabCore *obj, ForeachCollectionFunc collection_func, ForeachFileFunc file_func, ForeachGroupFunc group_func, void *data) |
| Retrieve a list of all the items in the download queue (using callback functions). |
|
| 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. |
|
| 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. |
|
| #define IS_NNTPGRAB_CORE | ( | object | ) | (G_TYPE_CHECK_INSTANCE_TYPE ((object), NNTPGRAB_TYPE_CORE)) |
| #define IS_NNTPGRAB_CORE_CLASS | ( | klass | ) | (G_TYPE_CHECK_CLASS_TYPE ((klass), NNTPGRAB_TYPE_CORE)) |
| #define NNTPGRAB_CORE | ( | object | ) | (G_TYPE_CHECK_INSTANCE_CAST ((object), NNTPGRAB_TYPE_CORE, NNTPGrabCore)) |
| #define NNTPGRAB_CORE_CLASS | ( | klass | ) | (G_TYPE_CHECK_CLASS_CAST ((klass), NNTPGRAB_TYPE_CORE, NNTPGrabCoreClass)) |
| #define NNTPGRAB_CORE_GET_CLASS | ( | obj | ) | (G_TYPE_INSTANCE_GET_CLASS ((obj), NNTPGRAB_TYPE_CORE, NNTPGrabCoreClass)) |
| #define NNTPGRAB_TYPE_CORE (core_get_type ()) |
| anonymous enum |
| NNTPGrabCore* get_core | ( | void | ) |
| void nntpgrab_core_cleanup | ( | NNTPGrabCore * | obj | ) |
Cleanup the NNTPGrab Core library.
After this function is called, the NNTPGrabCore instance can't be used anymore
| obj | An instance of the NNTPGrabCore |
| ngboolean nntpgrab_core_config_add_server | ( | NNTPGrabCore * | obj, | |
| ConfigServer | new_server, | |||
| char ** | errmsg | |||
| ) |
Add a new usenet server to the NNTPGrab configuration.
| obj | An instance of the NNTPGrabCore | |
| new_server | A structure containing the details about the new usenet server | |
| errmsg | 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 |
| ngboolean nntpgrab_core_config_del_server | ( | NNTPGrabCore * | obj, | |
| const char * | servername, | |||
| char ** | errmsg | |||
| ) |
Remove a usenet server from the NNTPGrab configuration.
| obj | An instance of the NNTPGrabCore | |
| servername | The name of the server whose entry should be removed | |
| errmsg | 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 |
| ngboolean nntpgrab_core_config_edit_server | ( | NNTPGrabCore * | obj, | |
| const char * | servername, | |||
| ConfigServer | server, | |||
| char ** | errmsg | |||
| ) |
Adjust the configuration details of an usenet server.
| obj | An instance of the NNTPGrabCore | |
| servername | The name of the server whose entry should be adjusted | |
| server | A structure containing the new configuration details of the given servername | |
| errmsg | 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 |
| void nntpgrab_core_config_free_avail_servers | ( | NNTPGrabCore * | obj, | |
| NGList * | servers | |||
| ) |
Free the list of available usenet servers.
| obj | An instance of the NNTPGrabCore | |
| servers | A list of the available usenet servers as returned from the function nntpgrab_config_get_avail_servers() |
| void nntpgrab_core_config_free_folder_listing | ( | NNTPGrabCore * | obj, | |
| NGList * | folders | |||
| ) |
Free a list of sub-folders.
| obj | An instance of the NNTPGrabCore | |
| folders | A list containing subfolders as returned by the function nntpgrab_config_get_folder_listing() |
| NGList* nntpgrab_core_config_get_avail_servers | ( | NNTPGrabCore * | obj | ) |
Retrieve a list of the available usenet servers.
| obj | An instance of the NNTPGrabCore |
| ngboolean nntpgrab_core_config_get_folder_listing | ( | NNTPGrabCore * | obj, | |
| const char * | parent, | |||
| NGList ** | folders | |||
| ) |
Retrieves a list containing all the sub-folders which are in the given folder.
| obj | An instance of the NNTPGrabCore | |
| parent | The name of the directory whose sub-folders should be retrieved | |
| folders | Pointer to a NGList*. The list of sub-folders will be placed in this field. This list needs to be free'd using the function nntpgrab_config_free_folder_listing() |
| ConfigOpts nntpgrab_core_config_get_opts | ( | NNTPGrabCore * | obj | ) |
Retrieve the general configuration options.
| obj | An instance of the NNTPGrabCore |
| ngboolean nntpgrab_core_config_get_server_info | ( | NNTPGrabCore * | obj, | |
| const char * | servername, | |||
| ConfigServer * | server | |||
| ) |
Get the configuration details about a specific usenet server.
| obj | An instance of the NNTPGrabCore | |
| servername | The name of the server whose details should be retrieved | |
| server | The address of a ConfigServer structure which will be used to fill in the configuration details |
| void nntpgrab_core_config_set_opts | ( | NNTPGrabCore * | obj, | |
| ConfigOpts | opts | |||
| ) |
Adjust the general configuration options.
| obj | An instance of the NNTPGrabCore | |
| opts | A structure containing the new general configuration options |
| NNTPGrabCore* nntpgrab_core_init | ( | int | version, | |
| char ** | err, | |||
| char ** | warnings | |||
| ) |
Initialize the NNTPGrab Core library.
This function needs to be called before any other NNTPGrab function can be called
| version | Needs to be NNTPGRAB_API_VERSION, this is used to prevent version conflicts | |
| err | 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 | |
| warnings | Pointer to a char*. If an (non-fatal) warning occurs, the reason will be placed in this field. Needs to be freed using ngfree(). Can be NULL to ignore errors |
| 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.
| obj | An instance of the NNTPGrabCore | |
| collection_name | 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 | |
| subject | The subject of the file | |
| poster | The name of the poster | |
| stamp | The UNIX timestamp of the post date | |
| file_size | The size of the file | |
| groups | A list containing the newsgroups in which this file is posted | |
| parts | A list containing the message-id's of all the individual parts belonging to this file | |
| errmsg | 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 |
| 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.
| obj | An instance of the NNTPGrabCore | |
| collection_name | The name of the collection in which the task resides | |
| subject | The subject of the file | |
| errmsg | 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 |
| void nntpgrab_core_schedular_foreach_task | ( | NNTPGrabCore * | obj, | |
| ForeachCollectionFunc | collection_func, | |||
| ForeachFileFunc | file_func, | |||
| ForeachGroupFunc | group_func, | |||
| void * | data | |||
| ) |
Retrieve a list of all the items in the download queue (using callback functions).
| obj | An instance of the NNTPGrabCore | |
| collection_func | The function which should be called for every collection in the download queue | |
| file_func | The function which should be called for every file in the download queue | |
| group_func | The function which should be called for every group in every file in the download queue | |
| data | Pointer to some data which will be made available in the callback functions |
| SchedularState nntpgrab_core_schedular_get_state | ( | NNTPGrabCore * | obj | ) |
Retrieve the current state of the schedular.
| obj | An instance of the NNTPGrabCore |
| 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.
| obj | An instance of the NNTPGrabCore | |
| collection_name | The name of the collection which needs to be moved | |
| new_position | The position in the download queue where the collection needs to be moved to |
| 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.
| obj | An instance of the NNTPGrabCore | |
| collection_name_src | The name of the collection where the subject is part of | |
| subject_src | The name of the subject which needs to be moved | |
| collection_name_dest | 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 |
| ngboolean nntpgrab_core_schedular_restart_task | ( | NNTPGrabCore * | obj, | |
| const char * | collection_name, | |||
| const char * | subject, | |||
| char ** | errmsg | |||
| ) |
Restart a task in the download queue.
| obj | An instance of the NNTPGrabCore | |
| collection_name | The name of the collection in which the task resides | |
| subject | The subject of the file | |
| errmsg | 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 |
| ngboolean nntpgrab_core_schedular_save_queue | ( | NNTPGrabCore * | obj, | |
| char ** | errmsg | |||
| ) |
Save any recent changes in the download queue to the disk.
| obj | An instance of the NNTPGrabCore | |
| errmsg | 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 |
| gboolean nntpgrab_core_schedular_start | ( | NNTPGrabCore * | obj | ) |
Start the NNTPGrab schedular.
| obj | An instance of the NNTPGrabCore |
| ngboolean nntpgrab_core_schedular_stop | ( | NNTPGrabCore * | obj, | |
| ngboolean | wait | |||
| ) |
Stop the NNTPGrab schedular.
| obj | An instance of the NNTPGrabCore | |
| wait | Whether this function should wait until the schedular really has stopped |