#include #include #include #include #include #include #include #include #include #include #include #include #include #include "marshalers.h"#include "nntpgrab_glue.h"#include "nntpgrab.h"#include "nntpgrab_internal.h"#include "nntpgrab_utils.h"#include "config.h"
Data Structures |
|
| struct | _connection |
| struct | NNTPGrabGlue |
| struct | NNTPGrabGlueClass |
Defines |
|
| #define | NNTPGRAB_TYPE_GLUE (glue_get_type ()) |
| #define | NNTPGRAB_GLUE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), NNTPGRAB_TYPE_GLUE, NNTPGrabGlue)) |
| #define | NNTPGRAB_GLUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NNTPGRAB_TYPE_GLUE, NNTPGrabGlueClass)) |
| #define | IS_NNTPGRAB_GLUE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), NNTPGRAB_TYPE_GLUE)) |
| #define | IS_NNTPGRAB_GLUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NNTPGRAB_TYPE_GLUE)) |
| #define | NNTPGRAB_GLUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NNTPGRAB_TYPE_GLUE, NNTPGrabGlueClass)) |
| #define | CLOSE(x) close(x) |
| #define | DEBUG(x) |
| #define | READ_TIMEOUT_VALUE 30 |
| #define | EXT ".so.0" |
Typedefs |
|
| typedef struct _connection | Connection |
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, CONNECTION_LOST_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 |
|
| void | connect_signal_handlers (NNTPGrabCore *core) |
| void | disconnect_signal_handlers (NNTPGrabCore *core) |
| void | emit_config_changed (NNTPGrabCore *core) |
| NNTPGrabCore * | get_core (void) |
| void | emit_connection_lost (const char *errmsg) |
| NNTPGrabGlue * | nntpgrab_glue_init (int glue_version, char **err) |
| Initialize the NNTPGrab Glue library. |
|
| NNTPGrabCore * | nntpgrab_core_init (int version, char **err, char **warnings) |
| Initialize the NNTPGrab Core library. |
|
| ngboolean | nntpgrab_glue_connect (NNTPGrabGlue *obj, const char *hostname, int port, const char *username, const char *password, ngboolean use_ssl, char **err, char **warnings) |
| Connect to an already running NNTPGrab Server OR start the standalone version of NNTPGrab. |
|
| ngboolean | nntpgrab_glue_get_is_connected (NNTPGrabGlue *obj) |
| Find out is we are already connected to an NNTPGrab Server. |
|
| void | nntpgrab_glue_cleanup (NNTPGrabGlue *obj) |
| Cleanup the NNTPGrab Glue library. |
|
| void | nntpgrab_glue_kill_server (NNTPGrabGlue *obj) |
| Shutdown the NNTPGrab Server where we're connected to. |
|
| NGList * | nntpgrab_config_get_avail_servers (NNTPGrabGlue *obj) |
| Retrieve a list of the available usenet servers. |
|
| void | nntpgrab_config_free_avail_servers (NNTPGrabGlue *obj, NGList *servers) |
| Free the list of available usenet servers. |
|
| gboolean | nntpgrab_config_get_server_info (NNTPGrabGlue *obj, const char *servername, ConfigServer *ret) |
| Get the configuration details about a specific usenet server. |
|
| gboolean | nntpgrab_config_add_server (NNTPGrabGlue *obj, ConfigServer new_server, char **errmsg) |
| Add a new usenet server to the NNTPGrab configuration. |
|
| gboolean | nntpgrab_config_del_server (NNTPGrabGlue *obj, const char *servername, char **errmsg) |
| Remove a usenet server from the NNTPGrab configuration. |
|
| gboolean | nntpgrab_config_edit_server (NNTPGrabGlue *obj, const char *servername, ConfigServer new_server, char **errmsg) |
| Adjust the configuration details of an usenet server. |
|
| ConfigOpts | nntpgrab_config_get_opts (NNTPGrabGlue *obj) |
| Retrieve the general configuration options. |
|
| void | nntpgrab_config_set_opts (NNTPGrabGlue *obj, ConfigOpts opts) |
| Adjust the general configuration options. |
|
| ngboolean | nntpgrab_config_get_folder_listing (NNTPGrabGlue *obj, const char *parent, NGList **folders) |
| Retrieves a list containing all the sub-folders which are in the given folder. |
|
| void | nntpgrab_config_free_folder_listing (NNTPGrabGlue *obj, NGList *folders) |
| Free a list of sub-folders. |
|
| gboolean | nntpgrab_schedular_start (NNTPGrabGlue *obj) |
| Start the NNTPGrab schedular. |
|
| gboolean | nntpgrab_schedular_stop (NNTPGrabGlue *obj, gboolean wait) |
| SchedularState | nntpgrab_schedular_get_state (NNTPGrabGlue *obj) |
| Retrieve the current state of the schedular. |
|
| ngboolean | nntpgrab_schedular_add_task_to_queue (NNTPGrabGlue *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_schedular_del_task_from_queue (NNTPGrabGlue *obj, const char *collection_name, const char *subject, char **errmsg) |
| Remove a task from the download queue. |
|
| ngboolean | nntpgrab_schedular_restart_task (NNTPGrabGlue *obj, const char *collection_name, const char *subject, char **errmsg) |
| Restart a task in the download queue. |
|
| ngboolean | nntpgrab_schedular_save_queue (NNTPGrabGlue *obj, char **errmsg) |
| Save any recent changes in the download queue to the disk. |
|
| void | nntpgrab_schedular_foreach_task (NNTPGrabGlue *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_schedular_move_task (NNTPGrabGlue *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_schedular_move_collection (NNTPGrabGlue *obj, const char *collection_name, int new_position) |
| Move the position of a collection in the download queue. |
|
| ngboolean | nntpgrab_glue_get_is_standalone (NNTPGrabGlue *core) |
| Find out if we are running the standalone version of NNTPGrab. |
|
| #define CLOSE | ( | x | ) | close(x) |
| #define DEBUG | ( | x | ) |
Value:
g_print(x); \
nntpgrab_core_emit_debug_message(FALSE, x);
| #define EXT ".so.0" |
| #define IS_NNTPGRAB_GLUE | ( | object | ) | (G_TYPE_CHECK_INSTANCE_TYPE ((object), NNTPGRAB_TYPE_GLUE)) |
| #define IS_NNTPGRAB_GLUE_CLASS | ( | klass | ) | (G_TYPE_CHECK_CLASS_TYPE ((klass), NNTPGRAB_TYPE_GLUE)) |
| #define NNTPGRAB_GLUE | ( | object | ) | (G_TYPE_CHECK_INSTANCE_CAST ((object), NNTPGRAB_TYPE_GLUE, NNTPGrabGlue)) |
| #define NNTPGRAB_GLUE_CLASS | ( | klass | ) | (G_TYPE_CHECK_CLASS_CAST ((klass), NNTPGRAB_TYPE_GLUE, NNTPGrabGlueClass)) |
| #define NNTPGRAB_GLUE_GET_CLASS | ( | obj | ) | (G_TYPE_INSTANCE_GET_CLASS ((obj), NNTPGRAB_TYPE_GLUE, NNTPGrabGlueClass)) |
| #define NNTPGRAB_TYPE_GLUE (glue_get_type ()) |
| #define READ_TIMEOUT_VALUE 30 |
| typedef struct _connection Connection |
| anonymous enum |
| void connect_signal_handlers | ( | NNTPGrabCore * | core | ) |
| void disconnect_signal_handlers | ( | NNTPGrabCore * | core | ) |
| void emit_config_changed | ( | NNTPGrabCore * | core | ) |
| void emit_connection_lost | ( | const char * | errmsg | ) |
| NNTPGrabCore* get_core | ( | void | ) |
| gboolean nntpgrab_config_add_server | ( | NNTPGrabGlue * | obj, | |
| ConfigServer | new_server, | |||
| char ** | errmsg | |||
| ) |
Add a new usenet server to the NNTPGrab configuration.
| obj | An instance of the NNTPGrabGlue | |
| 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 |
| gboolean nntpgrab_config_del_server | ( | NNTPGrabGlue * | obj, | |
| const char * | servername, | |||
| char ** | errmsg | |||
| ) |
Remove a usenet server from the NNTPGrab configuration.
| obj | An instance of the NNTPGrabGlue | |
| 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 |
| gboolean nntpgrab_config_edit_server | ( | NNTPGrabGlue * | obj, | |
| const char * | servername, | |||
| ConfigServer | server, | |||
| char ** | errmsg | |||
| ) |
Adjust the configuration details of an usenet server.
| obj | An instance of the NNTPGrabGlue | |
| 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_config_free_avail_servers | ( | NNTPGrabGlue * | obj, | |
| NGList * | servers | |||
| ) |
Free the list of available usenet servers.
| obj | An instance of the NNTPGrabGlue | |
| servers | A list of the available usenet servers as returned from the function nntpgrab_config_get_avail_servers() |
| void nntpgrab_config_free_folder_listing | ( | NNTPGrabGlue * | obj, | |
| NGList * | folders | |||
| ) |
Free a list of sub-folders.
| obj | An instance of the NNTPGrabGlue | |
| folders | A list containing subfolders as returned by the function nntpgrab_config_get_folder_listing() |
| NGList* nntpgrab_config_get_avail_servers | ( | NNTPGrabGlue * | obj | ) |
Retrieve a list of the available usenet servers.
| obj | An instance of the NNTPGrabGlue |
| ngboolean nntpgrab_config_get_folder_listing | ( | NNTPGrabGlue * | 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 NNTPGrabGlue | |
| 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_config_get_opts | ( | NNTPGrabGlue * | obj | ) |
Retrieve the general configuration options.
| obj | An instance of the NNTPGrabGlue |
| gboolean nntpgrab_config_get_server_info | ( | NNTPGrabGlue * | obj, | |
| const char * | servername, | |||
| ConfigServer * | server | |||
| ) |
Get the configuration details about a specific usenet server.
| obj | An instance of the NNTPGrabGlue | |
| 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_config_set_opts | ( | NNTPGrabGlue * | 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 |
| void nntpgrab_glue_cleanup | ( | NNTPGrabGlue * | obj | ) |
Cleanup the NNTPGrab Glue library.
After this function is called, the NNTPGrabGlue instance can't be used anymore
| obj | An instance of the NNTPGrabGlue |
| ngboolean nntpgrab_glue_connect | ( | NNTPGrabGlue * | obj, | |
| const char * | hostname, | |||
| int | port, | |||
| const char * | username, | |||
| const char * | password, | |||
| ngboolean | use_ssl, | |||
| char ** | err, | |||
| char ** | warnings | |||
| ) |
Connect to an already running NNTPGrab Server OR start the standalone version of NNTPGrab.
| obj | An instance of the NNTPGrabGlue | |
| hostname | The hostname where the NNTPGrab Server is running. If this is NULL, the standalone version of NNTPGrab will be started. In that case, the contents of the fields port, username, password and use_ssl are ignored | |
| port | The port where the NNTPGrab Server is running | |
| username | The username of an user who is allowed to connect to the NNTPGrab Server. This feature isn't implemented yet, so keep it NULL for now | |
| password | The password of an user who is allowed to connect to the NNTPGrab Server. This feature isn't implemented yet, so keep it NULL for now | |
| use_ssl | Do we want to have an encrypted connection to the NNTPGrab Server. This feature isn't implemented yet, so keep it FALSE for now | |
| 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_glue_get_is_connected | ( | NNTPGrabGlue * | obj | ) |
Find out is we are already connected to an NNTPGrab Server.
| obj | An instance of the NNTPGrabGlue |
| ngboolean nntpgrab_glue_get_is_standalone | ( | NNTPGrabGlue * | core | ) |
Find out if we are running the standalone version of NNTPGrab.
| core | An instance of the NNTPGrabGlue |
| NNTPGrabGlue* nntpgrab_glue_init | ( | int | glue_version, | |
| char ** | err | |||
| ) |
Initialize the NNTPGrab Glue library.
This function needs to be called before any other NNTPGrab function can be called
| glue_version | Needs to be NNTPGRAB_GLUE_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 |
| void nntpgrab_glue_kill_server | ( | NNTPGrabGlue * | obj | ) |
Shutdown the NNTPGrab Server where we're connected to.
| obj | An instance of the NNTPGrabGlue |
| ngboolean nntpgrab_schedular_add_task_to_queue | ( | NNTPGrabGlue * | 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 NNTPGrabGlue | |
| 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_schedular_del_task_from_queue | ( | NNTPGrabGlue * | obj, | |
| const char * | collection_name, | |||
| const char * | subject, | |||
| char ** | errmsg | |||
| ) |
Remove a task from the download queue.
| obj | An instance of the NNTPGrabGlue | |
| 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_schedular_foreach_task | ( | NNTPGrabGlue * | 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 NNTPGrabGlue | |
| 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_schedular_get_state | ( | NNTPGrabGlue * | obj | ) |
Retrieve the current state of the schedular.
| obj | An instance of the NNTPGrabGlue |
| ngboolean nntpgrab_schedular_move_collection | ( | NNTPGrabGlue * | obj, | |
| const char * | collection_name, | |||
| int | new_position | |||
| ) |
Move the position of a collection in the download queue.
| obj | An instance of the NNTPGrabGlue | |
| 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_schedular_move_task | ( | NNTPGrabGlue * | 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 NNTPGrabGlue | |
| 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_schedular_restart_task | ( | NNTPGrabGlue * | obj, | |
| const char * | collection_name, | |||
| const char * | subject, | |||
| char ** | errmsg | |||
| ) |
Restart a task in the download queue.
| obj | An instance of the NNTPGrabGlue | |
| 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_schedular_save_queue | ( | NNTPGrabGlue * | obj, | |
| char ** | errmsg | |||
| ) |
Save any recent changes in the download queue to the disk.
| obj | An instance of the NNTPGrabGlue | |
| 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_schedular_start | ( | NNTPGrabGlue * | obj | ) |
Start the NNTPGrab schedular.
| obj | An instance of the NNTPGrabGlue |
| gboolean nntpgrab_schedular_stop | ( | NNTPGrabGlue * | obj, | |
| gboolean | wait | |||
| ) |