X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=nntp.h;h=6d10aecada9984f774c2fa925a855bfcab9468ac;hp=335f094bf919cf36b7eaeb4686ae1fdec8f2fe8e;hb=6a7c1f87b97c733b63c177d41a5aca3427e9521a;hpb=5b4a22b1ca2870e26906d208d830624f297d40f4 diff --git a/nntp.h b/nntp.h index 335f094..6d10aec 100644 --- a/nntp.h +++ b/nntp.h @@ -1,136 +1,109 @@ /* + * Copyright notice from original mutt: * Copyright (C) 1998 Brandon Long * Copyright (C) 1999 Andrej Gritsenko * Copyright (C) 2000-2002 Vsevolod Volkov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ + * + * This file is part of mutt-ng, see http://www.muttng.org/. + * It's licensed under the GNU General Public License, + * please see the file GPL in the top level source directory. + */ #ifndef _NNTP_H_ #define _NNTP_H_ 1 -#include "mutt_socket.h" -#include "mailbox.h" +#include +#include -#include - -#define NNTP_PORT 119 -#define NNTP_SSL_PORT 563 +extern mx_t const nntp_mx; /* number of entries in the hash table */ #define NNTP_CACHE_LEN 10 -enum -{ - NNTP_NONE = 0, - NNTP_OK, - NNTP_BYE +enum { + NNTP_NONE = 0, + NNTP_OK, + NNTP_BYE }; -typedef struct -{ - int first; - int last; -} NEWSRC_ENTRY; +typedef struct nntp_data_t nntp_data_t; -typedef struct -{ - unsigned int hasXPAT : 1; - unsigned int hasXGTITLE : 1; - unsigned int hasXOVER : 1; - unsigned int hasLISTGROUP : 1; - unsigned int status : 3; - char *newsrc; - char *cache; - int stat; - off_t size; - time_t mtime; - time_t newgroups_time; - time_t check_time; - HASH *newsgroups; - LIST *list; /* list of newsgroups */ - LIST *tail; /* last entry of list */ - CONNECTION *conn; -} NNTP_SERVER; +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 */ + CONNECTION *conn; +} nntp_server_t; -typedef struct -{ - unsigned int index; - char *path; +typedef struct { + int index; + char *path; } NNTP_CACHE; -typedef struct -{ - NEWSRC_ENTRY *entries; - unsigned int num; /* number of used entries */ - unsigned int max; /* number of allocated entries */ - unsigned int unread; - unsigned int firstMessage; - unsigned int lastMessage; - unsigned int lastLoaded; - unsigned int lastCached; - unsigned int subscribed : 1; - unsigned int rc : 1; - unsigned int new : 1; - unsigned int allowed : 1; - unsigned int deleted : 1; - char *group; - char *desc; - char *cache; - NNTP_SERVER *nserv; - NNTP_CACHE acache[NNTP_CACHE_LEN]; -} NNTP_DATA; +typedef struct { + int first; + int last; +} NEWSRC_ENTRY; + +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 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_t *nserv; + NNTP_CACHE acache[NNTP_CACHE_LEN]; +}; -/* internal functions */ -int nntp_get_active (NNTP_SERVER *); -int nntp_get_cache_all (NNTP_SERVER *); -int nntp_save_cache_index (NNTP_SERVER *); -int nntp_check_newgroups (NNTP_SERVER *, int); -int nntp_save_cache_group (CONTEXT *); -int nntp_parse_url (const char *, ACCOUNT *, char *, size_t); -void newsrc_gen_entries (CONTEXT *); -void nntp_get_status (CONTEXT *, HEADER *, char *, int); -void mutt_newsgroup_stat (NNTP_DATA *); -void nntp_delete_cache (NNTP_DATA *); -void nntp_add_to_list (NNTP_SERVER *, NNTP_DATA *); -void nntp_cache_expand (char *, const char *); -void nntp_delete_data (void *); +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); -/* exposed interface */ -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 *); -int nntp_open_mailbox (CONTEXT *); -int nntp_sync_mailbox (CONTEXT *); -int nntp_check_mailbox (CONTEXT *); +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 *); +void nntp_clear_cacheindex (nntp_server_t *); +int mutt_newsrc_update (nntp_server_t *); int nntp_close_mailbox (CONTEXT *); -void nntp_fastclose_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 *); -void nntp_buffy (char *); -void nntp_expand_path (char *, size_t, ACCOUNT *); -void nntp_logout_all (); -const char *nntp_format_str (char *, size_t, char, const char *, const char *, - const char *, const char *, unsigned long, format_flag); +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); +void nntp_sync_sidebar (nntp_data_t*); -NNTP_SERVER *CurrentNewsSrv INITVAL (NULL); +WHERE nntp_server_t *CurrentNewsSrv INITVAL (NULL); #endif /* _NNTP_H_ */