Location of group information file: $XDG_CONFIG_HOME/$CFG_NAME/groupfile. More...
Macros | |
#define | MAIN_ERR_PREFIX "GROUP: " |
Message prefix for GROUPHANDLING module. | |
#define | GROUP_PERM (posix_mode_t) (POSIX_S_IRUSR | POSIX_S_IWUSR) |
Permissions for group file. | |
Functions | |
void | group_init (void) |
Initialize group handling. More... | |
void | group_exit (void) |
Shutdown group handling. More... | |
int | group_article_range_constructor (struct core_range **range, core_anum_t start, core_anum_t end, struct core_range *next) |
Article range constructor. More... | |
void | group_article_range_destructor (struct core_range **list) |
Destructor for linked list of article ranges. More... | |
void | group_destroy_list (size_t *num, struct core_groupstate **grouplist) |
Destroy list of subscribed groups. More... | |
int | group_get_list (size_t *num, struct core_groupstate **grouplist) |
Get list with subscribed groups. More... | |
int | group_set_list (size_t num, struct core_groupstate *grouplist) |
Store list with subscribed groups. More... | |
int | group_sort_list (void) |
Alphabetically sort list with subscribed groups. More... | |
int | group_add (struct core_groupstate *group) |
Add subscribed group. More... | |
int | group_reset_states (void) |
Delete group states. More... | |
Location of group information file: $XDG_CONFIG_HOME/$CFG_NAME/groupfile.
The content of the groupfile should be compatible with the de-facto standard of the '~/.newsrc' file used by other newsreaders so that the contained data can be shared with them if desired.
int group_add | ( | struct core_groupstate * | group | ) |
Add subscribed group.
[in] | group | Pointer to group information |
Definition at line 1091 of file group.c.
Referenced by core_subscribe_group().
int group_article_range_constructor | ( | struct core_range ** | range, |
core_anum_t | start, | ||
core_anum_t | end, | ||
struct core_range * | next | ||
) |
Article range constructor.
[out] | range | Pointer to article range structure |
[in] | start | First article in range |
[in] | end | Last article in range |
[in] | next | Pointer to next article range structure in linked list |
If success (zero) is returned, the caller is responsible for releasing the memory allocated for the article range object.
Definition at line 741 of file group.c.
References core_range::next.
Referenced by core_mark_as_read(), and core_mark_as_unread().
void group_article_range_destructor | ( | struct core_range ** | list | ) |
Destructor for linked list of article ranges.
[in] | list | Pointer to linked list of article ranges |
Definition at line 766 of file group.c.
References core_range::next.
Referenced by core_mark_as_unread(), core_unsubscribe_group(), group_destroy_list(), and group_reset_states().
void group_destroy_list | ( | size_t * | num, |
struct core_groupstate ** | grouplist | ||
) |
Destroy list of subscribed groups.
[in] | num | Pointer to number of groups in list |
[in] | grouplist | Pointer to array of group information structures |
If grouplist is NULL
, this function do nothing. On success, num is zero and grouplist is NULL
after return.
Definition at line 793 of file group.c.
References group_article_range_destructor().
Referenced by core_destroy_subscribed_group_states(), core_update_subscribed_group_states(), and group_reset_states().
void group_exit | ( | void | ) |
Shutdown group handling.
This function copy the groupfile back to the location configured by CONF_NEWSRC
.
Definition at line 643 of file group.c.
References CONF_NEWSRC, config, data, conf_entry_val::s, and conf::val.
int group_get_list | ( | size_t * | num, |
struct core_groupstate ** | grouplist | ||
) |
Get list with subscribed groups.
[out] | num | Pointer to number of groups in list |
[out] | grouplist | Pointer to array of group information structures |
If success (zero) is returned, the caller is responsible for releasing the memory allocated for the group list object. The destructor group_destroy_list() should be used for this purpose.
Definition at line 824 of file group.c.
Referenced by core_update_subscribed_group_states(), and group_reset_states().
void group_init | ( | void | ) |
Initialize group handling.
This function prepares the groupfile using the following algorithm:
CONF_NEWSRC
is configuredCONF_NEWSRC
is validgroupfile
to groupfile.old
CONF_NEWSRC
to groupfile
Definition at line 550 of file group.c.
References CONF_NEWSRC, config, data, main_debug, MAIN_ERR_PREFIX, PRINT_ERROR, conf_entry_val::s, and conf::val.
int group_reset_states | ( | void | ) |
Delete group states.
This is necessary after changing the server because every server use its own article numbers (on which our group states are based).
Definition at line 1232 of file group.c.
References group_article_range_destructor(), group_destroy_list(), group_get_list(), group_set_list(), and core_groupstate::info.
int group_set_list | ( | size_t | num, |
struct core_groupstate * | grouplist | ||
) |
Store list with subscribed groups.
[in] | num | Number of elements in group information array |
[in] | grouplist | Array of group information structures |
If num is zero, grouplist is ignored and the configuration is cleared. All group information elements in the array must be unique, that means it is not allowed to have multiple entries with the same group name.
Definition at line 869 of file group.c.
Referenced by core_export_group_states(), and group_reset_states().
int group_sort_list | ( | void | ) |
Alphabetically sort list with subscribed groups.
Definition at line 944 of file group.c.
Referenced by core_sort_group_list().