Macros | Enumerations | Functions | Variables
core.c File Reference

Newsreader core (for handling RFC 5536 conformant messages) More...

Go to the source code of this file.

Macros

#define MAIN_ERR_PREFIX   "CORE: "
 Message prefix for CORE module.
 
#define CORE_NEXUS_RETRIES   1U
 Number of retries for nexus operations. More...
 
#define CORE_HEADER_LINE_LENGTH   (size_t) 1024
 Sufficient for any RFC 5536 conformant header line. More...
 
#define CORE_CL_SECRET_FILE   ".cancelsecret"
 
#define CORE_UAGENT_RAW   0
 Do not parse for content in "User-Agent" header field. More...
 
#define CORE_GET_EMPTY_STRING(p)
 
#define CORE_GET_ERROR_STRING(p)
 
#define CORE_PID_MAXLEN   (size_t) 32 /* Lower Limit: 15 */
 
Control flags for header parser (for internal use only)

The flags can be bitwise ORed together.

#define CORE_CFLAG_COMMENT   0x01U
 
#define CORE_CFLAG_QSTRING   0x02U
 
#define CORE_CFLAG_EWORD   0x04U
 

Enumerations

enum  core_nexus_state { CORE_NEXUS_CLOSED, CORE_NEXUS_ESTABLISHED }
 
enum  core_command {
  CORE_CMD_INVALID, CORE_CMD_GET_MOTD, CORE_CMD_GET_DISTRIB_PATS, CORE_CMD_GET_SUBSCRIPTIONS,
  CORE_CMD_RESET_GROUPSTATES, CORE_CMD_GET_GROUPLIST, CORE_CMD_GET_GROUPLABELS, CORE_CMD_GET_GROUPINFO,
  CORE_CMD_SET_GROUP, CORE_CMD_GET_OVERVIEW, CORE_CMD_GET_ARTICLE_BY_MID, CORE_CMD_GET_ARTICLE,
  CORE_CMD_GET_ARTICLE_HEADER, CORE_CMD_GET_ARTICLE_BODY, CORE_CMD_POST_ARTICLE, CORE_TERMINATE_NEXUS
}
 
enum  core_header_type { CORE_HT_UNSTRUCT, CORE_HT_STRUCT }
 
enum  core_header_id {
  CORE_HDR_EOH, CORE_HDR_MSGID, CORE_HDR_GROUPS, CORE_HDR_FROM,
  CORE_HDR_SUBJECT, CORE_HDR_DATE, CORE_HDR_OPT, CORE_HDR_SUPERS,
  CORE_HDR_FUP2, CORE_HDR_REPLY2, CORE_HDR_UAGENT, CORE_HDR_ORG,
  CORE_HDR_REFS, CORE_HDR_DIST, CORE_HDR_MIME, CORE_HDR_CT,
  CORE_HDR_CTE, CORE_HDR_CD, CORE_HDR_X_NEWSR, CORE_HDR_X_MAILER,
  CORE_HDR_X_PAGENT, CORE_HDR_LINES
}
 

Functions

const char ** core_extract_groups (const char *body)
 Extract groups from 'Newsgroups' header field (exported for UI) More...
 
int core_get_group_list (unsigned int cookie)
 Get list of available newsgroups (exported for UI) More...
 
int core_get_group_labels (unsigned int cookie)
 Get list of newsgroup labels (exported for UI) More...
 
int core_sort_group_list (void)
 Alphabetically sort group list (exported for UI) More...
 
int core_subscribe_group (const char *name)
 Store group subscription (exported for UI) More...
 
int core_unsubscribe_group (size_t *num, struct core_groupstate **list, size_t *index)
 Remove group from list (exported for UI) More...
 
int core_reset_group_states (unsigned int cookie)
 Reset states of subscribed groups (exported for UI) More...
 
int core_export_group_states (size_t num, struct core_groupstate *list)
 Store states of subscribed groups (exported for UI) More...
 
int core_update_subscribed_group_states (size_t *num, struct core_groupstate **list, size_t *index)
 Get states of subscribed groups (exported for UI) More...
 
void core_destroy_subscribed_group_states (size_t *num, struct core_groupstate **list)
 Destructor for subscribed group states (exported for UI) More...
 
int core_get_subscribed_group_info (const size_t *num, struct core_groupstate **list, unsigned int cookie)
 Get information about subscribed groups (exported for UI) More...
 
void core_destroy_subscribed_group_info (struct core_groupdesc **list)
 Destructor for subscribed group information (exported for UI) More...
 
int core_set_group (const char *name, unsigned int cookie)
 Set current group (exported for UI) More...
 
int core_get_motd (unsigned int cookie)
 Get message of the day (exported for UI) More...
 
int core_get_distribution (const char **dist, const char **groups)
 Get distribution suggestions (exported for UI) More...
 
int core_get_subscription_proposals (unsigned int cookie)
 Get subscription proposals (exported for UI) More...
 
int core_get_overview (struct core_range *range, unsigned int cookie)
 Get article header overview (exported for UI) More...
 
int core_get_article_by_mid (const char *mid, unsigned int cookie)
 Get complete article by Message-ID (exported for UI) More...
 
int core_get_article (const core_anum_t *id, unsigned int cookie)
 Get complete article (exported for UI) More...
 
int core_get_article_header (const core_anum_t *id, unsigned int cookie)
 Get article header (exported for UI) More...
 
int core_get_article_body (const core_anum_t *id, unsigned int cookie)
 Get article body (exported for UI) More...
 
int core_post_article (const char *article, unsigned int cookie)
 Post article (exported for UI) More...
 
int core_check_already_read (struct core_groupstate *group, struct core_hierarchy_element *article)
 Check whether article was alread read (exported for UI) More...
 
void core_mark_as_read (struct core_groupstate *group, core_anum_t article)
 Mark article as read (exported for UI) More...
 
void core_mark_as_unread (struct core_groupstate *group, core_anum_t article)
 Mark article as unread (exported for UI) More...
 
const char * core_convert_canonical_to_posix (const char *s, int rcr, int rlf)
 Convert from canonical (RFC 822) to local (POSIX) form. More...
 
const char * core_convert_posix_to_canonical (const char *s)
 Convert from local (POSIX) to canonical (RFC 822) form. More...
 
int core_hierarchy_manager (struct core_hierarchy_element **hier, enum core_hierarchy_action action, core_anum_t anum,...)
 Manage article hierarchy in memory (exported for UI) More...
 
void core_create_hierarchy_from_overview (struct core_groupstate *group, struct core_range *range, const char *overview)
 Create article hierarchy from header overview (exported for UI) More...
 
const char * core_entity_parser (const char *entity, size_t len, struct core_article_header **e_h, size_t *e_len)
 Parse header of MIME multipart entity (exported for UI) More...
 
void core_destroy_entity_header (struct core_article_header **ehp)
 Destructor for MIME multipart entity header object (exported for UI) More...
 
const char * core_get_homedir (void)
 Get home directory of user (exported for UI) More...
 
const char * core_suggest_pathname (void)
 Suggest pathname to save something to a file (exported for UI) More...
 
const char * core_get_datetime (int force_utc)
 Get current date and time in RFC 5322 format (exported for UI) More...
 
const char * core_get_msgid (const char *fqdn)
 Get globally unique Message-ID (exported for UI) More...
 
const char * core_get_cancel_key (unsigned int scheme, const char *msgid)
 Create Cancel-Key for Message-ID (exported for UI) More...
 
const char * core_get_cancel_lock (unsigned int scheme, const char *mid)
 Create Cancel-Lock for Message-ID (exported for UI) More...
 
const char * core_get_signature (unsigned int *warnings)
 Get signature for outgoing messages (exported for UI) More...
 
const char * core_get_introduction (const char *ca, const char *ngl)
 Get introduction line for citation (exported for UI) More...
 
const char * core_convert_pathname_to_locale (const char *pathname)
 Convert pathname to codeset of locale (exported for UI) More...
 
int core_check_file_exist (const char *pathname)
 Check wheter file exists (exported for UI) More...
 
int core_save_to_file (const char *pathname, const char *s)
 Save string to text file (exported for UI) More...
 
const char * core_tmpfile_create (void)
 Create temporary file (exported for UI) More...
 
void core_tmpfile_delete (const char *pathname)
 Delete temporary file (exported for UI) More...
 
void core_disconnect (void)
 Close nexus (exported for UI)
 
void core_mutex_lock (void)
 Lock mutex for data object (exported for UI) More...
 
void core_mutex_unlock (void)
 Unlock mutex for data object (exported for UI) More...
 
int core_check_thread_ui (void)
 Check whether code is running in UI thread (exported for UI) More...
 
void core_free (void *p)
 Free an object allocated by core (exported for UI) More...
 
int core_init (void)
 Initialize core (exported for UI) More...
 
void core_exit (void)
 Shutdown core (exported for UI) More...
 

Variables

struct core_data data
 Global data object (shared by all threads)
 

Detailed Description

Newsreader core (for handling RFC 5536 conformant messages)

Copyright (c) 2012-2024 by the developers. See the LICENSE file for details.

All newsreader functions (but nothing generic like file handling) that are not related to the transport or the user interface (UI) should be implemented here.

If nothing else is specified, functions return zero to indicate success and a negative value to indicate an error.

Definition in file core.c.


Generated at 2024-04-27 using  doxygen