Macros | Functions
GROUP: Usenet group handling

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...
 

Detailed Description

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.

Function Documentation

◆ group_add()

int group_add ( struct core_groupstate group)

Add subscribed group.

Parameters
[in]groupPointer to group information
Returns
  • 0 on success
  • Negative value on error

Definition at line 1091 of file group.c.

Referenced by core_subscribe_group().

◆ group_article_range_constructor()

int group_article_range_constructor ( struct core_range **  range,
core_anum_t  start,
core_anum_t  end,
struct core_range next 
)

Article range constructor.

Parameters
[out]rangePointer to article range structure
[in]startFirst article in range
[in]endLast article in range
[in]nextPointer 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.

Returns
  • 0 on success
  • Negative value on error

Definition at line 741 of file group.c.

References core_range::next.

Referenced by core_mark_as_read(), and core_mark_as_unread().

◆ group_article_range_destructor()

void group_article_range_destructor ( struct core_range **  list)

Destructor for linked list of article ranges.

Parameters
[in]listPointer 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().

◆ group_destroy_list()

void group_destroy_list ( size_t *  num,
struct core_groupstate **  grouplist 
)

Destroy list of subscribed groups.

Parameters
[in]numPointer to number of groups in list
[in]grouplistPointer 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().

◆ group_exit()

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.

◆ group_get_list()

int group_get_list ( size_t *  num,
struct core_groupstate **  grouplist 
)

Get list with subscribed groups.

Parameters
[out]numPointer to number of groups in list
[out]grouplistPointer 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.

Returns
  • 0 on success
  • Negative value on error

Definition at line 824 of file group.c.

Referenced by core_update_subscribed_group_states(), and group_reset_states().

◆ group_init()

void group_init ( void  )

Initialize group handling.

This function prepares the groupfile using the following algorithm:

  • Check whether CONF_NEWSRC is configured
  • If not configured abort and return, otherwise continue
  • Check whether pathname configured with CONF_NEWSRC is valid
  • If not valid abort and return
  • Rename current groupfile to groupfile.old
  • Copy pathname configured with 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.

◆ group_reset_states()

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).

Returns
  • 0 on success
  • Negative value on error

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.

◆ group_set_list()

int group_set_list ( size_t  num,
struct core_groupstate grouplist 
)

Store list with subscribed groups.

Parameters
[in]numNumber of elements in group information array
[in]grouplistArray 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.

Returns
  • 0 on success
  • Negative value on error

Definition at line 869 of file group.c.

Referenced by core_export_group_states(), and group_reset_states().

◆ group_sort_list()

int group_sort_list ( void  )

Alphabetically sort list with subscribed groups.

Returns
  • 0 on success
  • Negative value on error

Definition at line 944 of file group.c.

Referenced by core_sort_group_list().


Generated at 2024-04-27 using  doxygen