X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=nntp.h;h=09472c53375eb5447ba0294dac9252509c8b49fd;hp=7acfa9e16aa9067beb0d568a777dc97a7e53de37;hb=8ab1ab66eb1c4b95f9b2a5ed9c2b2cf1dfa74544;hpb=379745fa8336fe94c44cdbd20876a3dc94798b72 diff --git a/nntp.h b/nntp.h index 7acfa9e..09472c5 100644 --- a/nntp.h +++ b/nntp.h @@ -21,82 +21,88 @@ extern mx_t const nntp_mx; #define NNTP_CACHE_LEN 10 enum { - NNTP_NONE = 0, - NNTP_OK, - NNTP_BYE + NNTP_NONE = 0, + NNTP_OK, + NNTP_BYE }; -typedef struct { - unsigned feat_known : 1; - unsigned hasXPAT : 1; - unsigned hasXGTITLE : 1; - unsigned hasXOVER : 1; - unsigned hasLISTGROUP : 1; - unsigned status : 3; - char *newsrc; - char *cache; - int stat; - off_t size; - time_t mtime; - time_t newgroups_time; - time_t check_time; - hash_t *newsgroups; - string_list_t *list; /* list of newsgroups */ - string_list_t **tail; /* last entry of list */ - CONNECTION *conn; -} NNTP_SERVER; +typedef struct nntp_data_t nntp_data_t; + +typedef struct nntp_server_t { + unsigned feat_known : 1; + unsigned hasXPAT : 1; + unsigned hasXGTITLE : 1; + unsigned hasXOVER : 1; + unsigned hasLISTGROUP : 1; + unsigned status : 3; + char *newsrc; + char *cache; + int stat; + off_t size; + time_t mtime; + time_t newgroups_time; + time_t check_time; + hash_t *newsgroups; + nntp_data_t *list; /* list of newsgroups */ + nntp_data_t **tail; + CONNECTION *conn; +} nntp_server_t; typedef struct { - int index; - char *path; + int index; + char *path; } NNTP_CACHE; typedef struct { - int first; - int last; + int first; + int last; } NEWSRC_ENTRY; -typedef struct { - NEWSRC_ENTRY *entries; - int num; /* number of used entries */ - int max; /* number of allocated entries */ - int unread; - int firstMessage; - int lastMessage; - int lastLoaded; - int lastCached; - unsigned subscribed:1; - unsigned rc:1; - unsigned new:1; - unsigned allowed:1; - unsigned deleted:1; - char *group; - char *desc; - char *cache; - NNTP_SERVER *nserv; - NNTP_CACHE acache[NNTP_CACHE_LEN]; -} NNTP_DATA; +struct nntp_data_t { + struct nntp_data_t *next; + + NEWSRC_ENTRY *entries; + int num; /* number of used entries */ + int max; /* number of allocated entries */ + int unread; + int first, last; + int lastLoaded; + int lastCached; + unsigned subscribed:1; + unsigned rc:1; + unsigned new:1; + unsigned allowed:1; + unsigned deleted:1; + char *group; + char *desc; + char *cache; + nntp_server_t *nserv; + NNTP_CACHE acache[NNTP_CACHE_LEN]; +}; + +DO_INIT(nntp_data_t, nntp_data); +void nntp_data_wipe(nntp_data_t *); +DO_NEW(nntp_data_t, nntp_data); +DO_DELETE(nntp_data_t, nntp_data); +DO_SLIST(nntp_data_t, nntp_data, nntp_data_delete); -NNTP_SERVER *mutt_select_newsserver (char *); -NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *, char *); -NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *, char *); -NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *, char *); -NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *, char *); -void nntp_clear_cacheindex (NNTP_SERVER *); -int mutt_newsrc_update (NNTP_SERVER *); +nntp_server_t *mutt_select_newsserver (char *); +nntp_data_t *mutt_newsgroup_subscribe (nntp_server_t *, char *); +nntp_data_t *mutt_newsgroup_unsubscribe (nntp_server_t *, char *); +nntp_data_t *mutt_newsgroup_catchup (nntp_server_t *, char *); +nntp_data_t *mutt_newsgroup_uncatchup (nntp_server_t *, char *); +int mutt_newsrc_update (nntp_server_t *); int nntp_close_mailbox (CONTEXT *); int nntp_fetch_message (MESSAGE *, CONTEXT *, int); int nntp_post (const char *); int nntp_check_msgid (CONTEXT *, const char *); int nntp_check_children (CONTEXT *, const char *); -int nntp_get_active (NNTP_SERVER *); +int nntp_get_active (nntp_server_t *); void nntp_buffy (char* dst, ssize_t dstlen); void nntp_expand_path (char *, ssize_t, ACCOUNT *); void nntp_logout_all(void); -const char *nntp_format_str(char *, ssize_t, char, const char *, const char *, - const char *, const char *, anytype, format_flag); -void nntp_sync_sidebar (NNTP_DATA*); +void nntp_sync_sidebar (nntp_data_t*); -WHERE NNTP_SERVER *CurrentNewsSrv INITVAL (NULL); +WHERE nntp_server_t *CurrentNewsSrv INITVAL (NULL); #endif /* _NNTP_H_ */