#include "nntpgrab_types.h"Go to the source code of this file.
Data Structures |
|
| struct | _nntpgrab_folder |
| struct | _nzb |
| struct | _nzb_file |
| struct | _nzbcreator_group |
| struct | _nzbcreator_search_opts |
| struct | _nzbcreator_file |
| struct | _nzbcreator_collection |
| struct | _nzbcreator_search_result |
Defines |
|
| #define | ng_list_previous(list) ((list) ? (((NGList *)(list))->prev) : NULL) |
| #define | ng_list_next(list) ((list) ? (((NGList *)(list))->next) : NULL) |
Typedefs |
|
| typedef void | NGFileMonitor |
| typedef struct _nntpgrab_folder | NNTPGrabFolder |
| typedef struct _nzb | NZB |
| typedef struct _nzb_file | NZBFile |
| typedef struct _nzbcreator_group | NZBCreatorGroup |
| typedef enum _nzbcreator_search_only_in |
NZBCreatorSearchOnlyIn |
| typedef struct _nzbcreator_search_opts |
NZBCreatorSearchOpts |
| typedef struct _nzbcreator_file | NZBCreatorFile |
| typedef struct _nzbcreator_collection |
NZBCreatorCollection |
| typedef struct _nzbcreator_search_result |
NZBCreatorSearchResult |
Enumerations |
|
| enum | _nzbcreator_search_only_in { NZBCREATOR_SEARCH_ONLY_IN_SUBJECTS, NZBCREATOR_SEARCH_ONLY_IN_FILENAMES, NZBCREATOR_SEARCH_ONLY_IN_POSTERS } |
Functions |
|
| void | ng_free (void *data) |
| Free data allocated by NNTPGrab functions. |
|
| NGList * | ng_list_append (NGList *list, void *data) |
| Append an item to a list. |
|
| NGList * | ng_list_prepend (NGList *list, void *data) |
| Insert an item to the beginning of a list. |
|
| NGList * | ng_list_remove (NGList *list, void *data) |
| Remove an item from a list. |
|
| unsigned int | ng_list_length (NGList *list) |
| Retrieve the length of a list. |
|
| void | ng_list_free (NGList *list) |
| Free a list. |
|
| void | ng_signal_connect (void *instance, const char *signal_name, NGCallback cb_handler, void *data) |
| Register a signal handler. |
|
| void | ng_signal_handlers_disconnect_by_func (void *instance, NGCallback cb_handler, void *data) |
| Un-register a signal handler. |
|
| void | ng_signal_handlers_block_by_func (void *instance, NGCallback cb_handler, void *data) |
| Temporary disable a signal handler for a given callback function. |
|
| void | ng_signal_handlers_unblock_by_func (void *instance, NGCallback cb_handler, void *data) |
| Re-enable a signal handler for a given callback function. |
|
| void | ng_event_handler_loop_run (void) |
| Start the event handler loop. |
|
| void | ng_event_handler_loop_quit (void) |
| Stop the event handler loop. |
|
| NGRegex * | nntpgrab_utils_regex_compile (const char *regex) |
| Compile a regular expression. |
|
| void | nntpgrab_utils_regex_free (NGRegex *re) |
| Free a compiled regular expression. |
|
| const char ** | nntpgrab_utils_regex_match (NGRegex *re, const char *line) |
| Perform a match against a compiled regular expression. |
|
| void | nntpgrab_utils_regex_matches_free (const char **matches) |
| Free an array of matched items. |
|
| ngboolean | nntpgrab_utils_strip_subject (const char *subject, char **subject_without_partnum, int *file_num, int *total_files, char **filename, char **extension, NNTPFileType *file_type, int *par2_startnum, int *num_par2_blocks, int *part_num, int *total_parts) |
| Strip a subject into useable pieces of data. |
|
| NNTPFileType | nntpgrab_utils_get_file_type_of_filename (const char *filename) |
| Find out the file type of a given filename. |
|
| char * | nntpgrab_utils_calculate_file_size (nguint64 file_size) |
| Transform a file size into a human readable notation. |
|
| int | nntpgrab_utils_calculate_estimated_time_remaining (int bytes_received1, int bytes_received2, int bytes_received3, int bytes_received4, int bytes_received5, int bytes_received6, int bytes_received7, int bytes_received8, int bytes_received9, int bytes_received10, nguint64 file_size) |
| Calculate the estimated time remaining to complete the given file size. |
|
| char * | nntpgrab_utils_get_readable_time_remaining (int estimated_time_remaining) |
| Transform a estimated time remaining into a human readable value for the time remaining. |
|
| char * | nntpgrab_utils_get_readable_finished_time (int estimated_time_remaining) |
| Transform a estimated time remaining into a human readable value for the expected time to finish. |
|
| void | nntpgrab_utils_sanitize_text (char *text, int length) |
| Check whether the given text contains invalid UTF-8 characters and if they're found, replace them with something more sane. |
|
| void | nntpgrab_utils_strip_nzb_extension (char *filename) |
| Remove the extension from a filename. |
|
| void | nntpgrab_utils_sanitize_collection_name (char *collection_name) |
| Remove forbidden characters from the collection name. |
|
| ngboolean | nntpgrab_utils_get_folder_listing (const char *parent, NGList **folders) |
| Retrieves a list containing all the sub-folders which are in the given folder. |
|
| void | nntpgrab_utils_free_folder_listing (NGList *folders) |
| Free a list of sub-folders. |
|
| NZB * | nntpgrab_utils_parse_nzb_file (const char *contents, char **errmsg) |
| Parse the contents of a NZB file and put the information in a structure. |
|
| void | nntpgrab_utils_nzb_file_free (NZB *nzbfile) |
| Free a structure containing details about a NZB file. |
|
| NGList * | nntpgrab_utils_nzbcreator_get_all_groups (char **errmsg) |
| Retrieve a list of all the usenet groups which are indexed by the NZBCreator service. |
|
| void | nntpgrab_utils_nzbcreator_free_groups (NGList *groups) |
| Free the list of usenet groups which are indexed by the NZBCreator service. |
|
| NZBCreatorSearchResult * | nntpgrab_utils_nzbcreator_perform_search (NZBCreatorSearchOpts opts, char **errmsg) |
| Perform a search using the NZBCreator service. |
|
| void | nntpgrab_utils_nzbcreator_free_result (NZBCreatorSearchResult *result) |
| Free the NZBCreator search results. |
|
| char * | nntpgrab_utils_nzbcreator_generate_NZB (NGList *file_ids, char **errmsg) |
| Generate a NZB file based on a list of file ID's. |
|
| NGFileMonitor * | nntpgrab_utils_monitor_directory (const char *path, char **errmsg) |
| Start the monitoring of a directory. |
|
| void | nntpgrab_utils_cancel_directory_monitor (NGFileMonitor *monitor) |
| Cancel the monitoring of a directory. |
|
| #define ng_list_next | ( | list | ) | ((list) ? (((NGList *)(list))->next) : NULL) |
| #define ng_list_previous | ( | list | ) | ((list) ? (((NGList *)(list))->prev) : NULL) |
| typedef void NGFileMonitor |
| typedef struct _nntpgrab_folder NNTPGrabFolder |
| typedef struct _nzb NZB |
| typedef struct _nzbcreator_collection NZBCreatorCollection |
| typedef struct _nzbcreator_file NZBCreatorFile |
| typedef struct _nzbcreator_group NZBCreatorGroup |
| typedef enum _nzbcreator_search_only_in NZBCreatorSearchOnlyIn |
| typedef struct _nzbcreator_search_opts NZBCreatorSearchOpts |
| typedef struct _nzbcreator_search_result NZBCreatorSearchResult |
| typedef struct _nzb_file NZBFile |
| void ng_event_handler_loop_quit | ( | void | ) |
Stop the event handler loop.
| void ng_event_handler_loop_run | ( | void | ) |
Start the event handler loop.
This function waits for incoming events and passes these on to all the registered event handlers
This function doesn't need to be used for the GTK+ frontend as it is equivalent to gtk_main()
| void ng_free | ( | void * | data | ) |
Free data allocated by NNTPGrab functions.
| data | The data which needs to be free'd |
| NGList* ng_list_append | ( | NGList * | list, | |
| void * | data | |||
| ) |
Append an item to a list.
| list | The list where the item needs to be added to (can be NULL to create a new list) | |
| data | The item which needs to be added |
| void ng_list_free | ( | NGList * | list | ) |
Free a list.
| list | The list which needs to be free'd |
| unsigned int ng_list_length | ( | NGList * | list | ) |
Retrieve the length of a list.
| list | The list of which the length must be returned |
| NGList* ng_list_prepend | ( | NGList * | list, | |
| void * | data | |||
| ) |
Insert an item to the beginning of a list.
| list | The list where the item needs to be added to (can be NULL to create a new list) | |
| data | The item which needs to be added |
| NGList* ng_list_remove | ( | NGList * | list, | |
| void * | data | |||
| ) |
Remove an item from a list.
| list | The list where the item needs to be removed from | |
| data | The item which needs to be removed |
| void ng_signal_connect | ( | void * | instance, | |
| const char * | signal_name, | |||
| NGCallback | cb_handler, | |||
| void * | data | |||
| ) |
Register a signal handler.
| instance | The instance of an GObject, for example NNTPGrabCore or NNTPGrabAutoImport | |
| signal_name | The name of the signal for which a signaler handler needs to be registered | |
| cb_handler | The function which need to be called every time the given signal is emit | |
| data | Data used as extra argument in the callback functions |
| void ng_signal_handlers_block_by_func | ( | void * | instance, | |
| NGCallback | cb_handler, | |||
| void * | data | |||
| ) |
Temporary disable a signal handler for a given callback function.
| instance | The instance of an GObject, for example NNTPGrabCore or NNTPGrabAutoImport | |
| cb_handler | The callback function which need to be temporary blocked | |
| data | The callback data used for the given cb_handler |
| void ng_signal_handlers_disconnect_by_func | ( | void * | instance, | |
| NGCallback | cb_handler, | |||
| void * | data | |||
| ) |
Un-register a signal handler.
| instance | The instance of an GObject, for example NNTPGrabCore or NNTPGrabAutoImport | |
| cb_handler | The callback function which need to be unregistered | |
| data | The callback data used for the given cb_handler |
| void ng_signal_handlers_unblock_by_func | ( | void * | instance, | |
| NGCallback | cb_handler, | |||
| void * | data | |||
| ) |
Re-enable a signal handler for a given callback function.
| instance | The instance of an GObject, for example NNTPGrabCore or NNTPGrabAutoImport | |
| cb_handler | The callback function which need to be un-blocked | |
| data | The callback data used for the given cb_handler |
| int nntpgrab_utils_calculate_estimated_time_remaining | ( | int | bytes_received1, | |
| int | bytes_received2, | |||
| int | bytes_received3, | |||
| int | bytes_received4, | |||
| int | bytes_received5, | |||
| int | bytes_received6, | |||
| int | bytes_received7, | |||
| int | bytes_received8, | |||
| int | bytes_received9, | |||
| int | bytes_received10, | |||
| nguint64 | file_size | |||
| ) |
Calculate the estimated time remaining to complete the given file size.
| bytes_received1 | The number of bytes received in now() - 10 | |
| bytes_received2 | The number of bytes received in now() - 9 | |
| bytes_received3 | The number of bytes received in now() - 8 | |
| bytes_received4 | The number of bytes received in now() - 7 | |
| bytes_received5 | The number of bytes received in now() - 6 | |
| bytes_received6 | The number of bytes received in now() - 5 | |
| bytes_received7 | The number of bytes received in now() - 4 | |
| bytes_received8 | The number of bytes received in now() - 3 | |
| bytes_received9 | The number of bytes received in now() - 2 | |
| bytes_received10 | The number of bytes received in now() - 1 | |
| file_size | The file size |
| char* nntpgrab_utils_calculate_file_size | ( | nguint64 | file_size | ) |
Transform a file size into a human readable notation.
| file_size | The file size which needs to be transformed |
| void nntpgrab_utils_cancel_directory_monitor | ( | NGFileMonitor * | monitor | ) |
Cancel the monitoring of a directory.
| monitor | The instance of the NGFileMonitor which needs to be stopped |
| void nntpgrab_utils_free_folder_listing | ( | NGList * | folders | ) |
Free a list of sub-folders.
| folders | A list containing subfolders as returned by the function nntpgrab_config_get_folder_listing() |
| NNTPFileType nntpgrab_utils_get_file_type_of_filename | ( | const char * | filename | ) |
Find out the file type of a given filename.
| filename | The filename whose file type needs to be found out |
| ngboolean nntpgrab_utils_get_folder_listing | ( | const char * | parent, | |
| NGList ** | folders | |||
| ) |
Retrieves a list containing all the sub-folders which are in the given folder.
| 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() |
| parent | The path whose belonging folders should be looked up. If NULL, all the drive letters will be returned (on Win32) or "/" is returned (*nix/osx) | |
| folders | Return address for a list containing g_slice_new'ed ConfigFolder structures containing the requested info |
| char* nntpgrab_utils_get_readable_finished_time | ( | int | estimated_time_remaining | ) |
Transform a estimated time remaining into a human readable value for the expected time to finish.
| estimated_time_remaining | The estimated time remaining (in seconds) |
| char* nntpgrab_utils_get_readable_time_remaining | ( | int | estimated_time_remaining | ) |
Transform a estimated time remaining into a human readable value for the time remaining.
| estimated_time_remaining | The estimated time remaining (in seconds) |
| NGFileMonitor* nntpgrab_utils_monitor_directory | ( | const char * | path, | |
| char ** | errmsg | |||
| ) |
Start the monitoring of a directory.
| path | The directory which needs to be monitored for changes | |
| 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_utils_nzb_file_free | ( | NZB * | nzbfile | ) |
Free a structure containing details about a NZB file.
| nzbfile | The structure containing information about the NZB file |
| void nntpgrab_utils_nzbcreator_free_groups | ( | NGList * | groups | ) |
Free the list of usenet groups which are indexed by the NZBCreator service.
| groups | A list of all the indexed usenet groups |
| void nntpgrab_utils_nzbcreator_free_result | ( | NZBCreatorSearchResult * | result | ) |
Free the NZBCreator search results.
| result | The NZBCreator search results |
| char* nntpgrab_utils_nzbcreator_generate_NZB | ( | NGList * | file_ids, | |
| char ** | errmsg | |||
| ) |
Generate a NZB file based on a list of file ID's.
| file_ids | A list containing file ID's of all the files which needs to be retrieved | |
| 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 |
| NGList* nntpgrab_utils_nzbcreator_get_all_groups | ( | char ** | errmsg | ) |
Retrieve a list of all the usenet groups which are indexed by the NZBCreator service.
| 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 |
| NZBCreatorSearchResult* nntpgrab_utils_nzbcreator_perform_search | ( | NZBCreatorSearchOpts | opts, | |
| char ** | errmsg | |||
| ) |
Perform a search using the NZBCreator service.
| opts | A structure containing information about the requested search | |
| 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 |
| NZB* nntpgrab_utils_parse_nzb_file | ( | const char * | contents, | |
| char ** | errmsg | |||
| ) |
Parse the contents of a NZB file and put the information in a structure.
| contents | The contents of the NZB 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 |
| NGRegex* nntpgrab_utils_regex_compile | ( | const char * | regex | ) |
Compile a regular expression.
| regex | The (perl-compatible) regular expression which needs to be compiled |
| void nntpgrab_utils_regex_free | ( | NGRegex * | re | ) |
Free a compiled regular expression.
| re | The compiled regular expression |
| const char** nntpgrab_utils_regex_match | ( | NGRegex * | re, | |
| const char * | line | |||
| ) |
Perform a match against a compiled regular expression.
| re | The compiled regular expression | |
| line | The data which need to be matched against the compiled regular expression |
| void nntpgrab_utils_regex_matches_free | ( | const char ** | matches | ) |
Free an array of matched items.
| matches | The NULL-terminated array of matches as returned by the function nntpgrab_utils_regex_match() |
| void nntpgrab_utils_sanitize_collection_name | ( | char * | collection_name | ) |
Remove forbidden characters from the collection name.
| collection_name | The collection name which need to be sanitized |
| void nntpgrab_utils_sanitize_text | ( | char * | text, | |
| int | length | |||
| ) |
Check whether the given text contains invalid UTF-8 characters and if they're found, replace them with something more sane.
| text | The text which need to be sanitized | |
| length | The length of the text |
| void nntpgrab_utils_strip_nzb_extension | ( | char * | filename | ) |
Remove the extension from a filename.
| filename | The filename whose extension need to be stripped |
| ngboolean nntpgrab_utils_strip_subject | ( | const char * | subject, | |
| char ** | subject_without_partnum, | |||
| int * | file_num, | |||
| int * | total_files, | |||
| char ** | filename, | |||
| char ** | extension, | |||
| NNTPFileType * | file_type, | |||
| int * | par2_startnum, | |||
| int * | num_par2_blocks, | |||
| int * | part_num, | |||
| int * | total_parts | |||
| ) |
Strip a subject into useable pieces of data.
| subject | The subject which need to be stripped | |
| subject_without_partnum | Location for the subject without any part numbers | |
| file_num | Location for the number of the file in the set | |
| total_files | Location for the total number of files in the set | |
| filename | Location for the filename | |
| extension | Location for the extension of the filename (as an string) | |
| file_type | Location for the extension of the filename (as an enumeration) | |
| par2_startnum | Location for the start number of the PAR2 recovery file | |
| num_par2_blocks | Location for the number blocks in the PAR2 recovery file | |
| part_num | Location for the part number for this subject | |
| total_parts | Location for the number of parts for this subject |
All the char* parameters need to be free'd using ng_free()