Read/parse/write an NNTP config file of subscribed newsgroups. More...
#include "config.h"#include <dirent.h>#include <errno.h>#include <limits.h>#include <stdbool.h>#include <stdio.h>#include <string.h>#include <sys/stat.h>#include <time.h>#include <unistd.h>#include "private.h"#include "mutt/lib.h"#include "config/lib.h"#include "email/lib.h"#include "core/lib.h"#include "conn/lib.h"#include "mutt.h"#include "lib.h"#include "bcache/lib.h"#include "expando/lib.h"#include "adata.h"#include "edata.h"#include "expando_newsrc.h"#include "mdata.h"#include "mutt_logging.h"#include "mutt_socket.h"#include "muttlib.h"#include "hcache/lib.h"
Include dependency graph for newsrc.c:Go to the source code of this file.
Functions | |
| static struct NntpMboxData * | mdata_find (struct NntpAccountData *adata, const char *group) |
| Find NntpMboxData for given newsgroup or add it. | |
| void | nntp_acache_free (struct NntpMboxData *mdata) |
| Remove all temporarily cache files. | |
| void | nntp_newsrc_close (struct NntpAccountData *adata) |
| Unlock and close .newsrc file. | |
| void | nntp_group_unread_stat (struct NntpMboxData *mdata) |
| Count number of unread articles using .newsrc data. | |
| int | nntp_newsrc_parse (struct NntpAccountData *adata) |
| Parse .newsrc file. | |
| void | nntp_newsrc_gen_entries (struct Mailbox *m) |
| Generate array of .newsrc entries. | |
| static int | update_file (char *filename, char *buf) |
| Update file with new contents. | |
| int | nntp_newsrc_update (struct NntpAccountData *adata) |
| Update .newsrc file. | |
| static void | cache_expand (char *dst, size_t dstlen, struct ConnAccount *cac, const char *src) |
| Make fully qualified cache file name. | |
| void | nntp_expand_path (char *buf, size_t buflen, struct ConnAccount *cac) |
| Make fully qualified url from newsgroup name. | |
| int | nntp_add_group (char *line, void *data) |
| Parse newsgroup. | |
| static int | active_get_cache (struct NntpAccountData *adata) |
| Load list of all newsgroups from cache. | |
| int | nntp_active_save_cache (struct NntpAccountData *adata) |
| Save list of all newsgroups to cache. | |
| static void | nntp_hcache_namer (const char *path, struct Buffer *dest) |
| Compose hcache file names - Implements hcache_namer_t -. | |
| struct HeaderCache * | nntp_hcache_open (struct NntpMboxData *mdata) |
| Open newsgroup hcache. | |
| void | nntp_hcache_update (struct NntpMboxData *mdata, struct HeaderCache *hc) |
| Remove stale cached headers. | |
| static int | nntp_bcache_delete (const char *id, struct BodyCache *bcache, void *data) |
| Delete an entry from the message cache - Implements bcache_list_t -. | |
| void | nntp_bcache_update (struct NntpMboxData *mdata) |
| Remove stale cached messages. | |
| void | nntp_delete_group_cache (struct NntpMboxData *mdata) |
| Remove hcache and bcache of newsgroup. | |
| void | nntp_clear_cache (struct NntpAccountData *adata) |
| Clear the NNTP cache. | |
| static const char * | nntp_get_field (enum ConnAccountField field, void *gf_data) |
| Get connection login credentials - Implements ConnAccount::get_field() -. | |
| struct NntpAccountData * | nntp_select_server (struct Mailbox *m, const char *server, bool leave_lock) |
| Open a connection to an NNTP server. | |
| void | nntp_article_status (struct Mailbox *m, struct Email *e, char *group, anum_t anum) |
| Get status of articles from .newsrc. | |
| struct NntpMboxData * | mutt_newsgroup_subscribe (struct NntpAccountData *adata, char *group) |
| Subscribe newsgroup. | |
| struct NntpMboxData * | mutt_newsgroup_unsubscribe (struct NntpAccountData *adata, char *group) |
| Unsubscribe newsgroup. | |
| struct NntpMboxData * | mutt_newsgroup_catchup (struct Mailbox *m, struct NntpAccountData *adata, char *group) |
| Catchup newsgroup. | |
| struct NntpMboxData * | mutt_newsgroup_uncatchup (struct Mailbox *m, struct NntpAccountData *adata, char *group) |
| Uncatchup newsgroup. | |
| void | nntp_mailbox (struct Mailbox *m, char *buf, size_t buflen) |
| Get first newsgroup with new messages. | |
Read/parse/write an NNTP config file of subscribed newsgroups.
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, see http://www.gnu.org/licenses/.
Definition in file newsrc.c.
|
static |
Find NntpMboxData for given newsgroup or add it.
| adata | NNTP server |
| group | Newsgroup |
| ptr | NNTP data |
| NULL | Error |
Definition at line 73 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nntp_acache_free | ( | struct NntpMboxData * | mdata | ) |
| void nntp_newsrc_close | ( | struct NntpAccountData * | adata | ) |
Unlock and close .newsrc file.
| adata | NNTP server |
Definition at line 119 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nntp_group_unread_stat | ( | struct NntpMboxData * | mdata | ) |
Count number of unread articles using .newsrc data.
| mdata | NNTP Mailbox data |
Definition at line 133 of file newsrc.c.
Here is the caller graph for this function:| int nntp_newsrc_parse | ( | struct NntpAccountData * | adata | ) |
Parse .newsrc file.
| adata | NNTP server |
| 0 | Not changed |
| 1 | Parsed |
| -1 | Error |
Definition at line 163 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nntp_newsrc_gen_entries | ( | struct Mailbox * | m | ) |
Generate array of .newsrc entries.
| m | Mailbox |
Definition at line 300 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Update file with new contents.
| filename | File to update |
| buf | New context |
| 0 | Success |
| -1 | Failure |
Definition at line 392 of file newsrc.c.
Here is the caller graph for this function:| int nntp_newsrc_update | ( | struct NntpAccountData * | adata | ) |
Update .newsrc file.
| adata | NNTP server |
| 0 | Success |
| -1 | Failure |
Definition at line 442 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Make fully qualified cache file name.
Definition at line 523 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nntp_expand_path | ( | char * | buf, |
| size_t | buflen, | ||
| struct ConnAccount * | cac ) |
Make fully qualified url from newsgroup name.
Definition at line 555 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int nntp_add_group | ( | char * | line, |
| void * | data ) |
Parse newsgroup.
| line | String to parse |
| data | NNTP data |
| 0 | Always |
Definition at line 571 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Load list of all newsgroups from cache.
| adata | NNTP server |
| 0 | Success |
| -1 | Failure |
Definition at line 612 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int nntp_active_save_cache | ( | struct NntpAccountData * | adata | ) |
Save list of all newsgroups to cache.
| adata | NNTP server |
| 0 | Success |
| -1 | Failure |
Definition at line 646 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct HeaderCache * nntp_hcache_open | ( | struct NntpMboxData * | mdata | ) |
Open newsgroup hcache.
| mdata | NNTP Mailbox data |
| ptr | Header cache |
| NULL | Error |
Definition at line 706 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nntp_hcache_update | ( | struct NntpMboxData * | mdata, |
| struct HeaderCache * | hc ) |
Remove stale cached headers.
| mdata | NNTP Mailbox data |
| hc | Header cache |
Definition at line 730 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nntp_bcache_update | ( | struct NntpMboxData * | mdata | ) |
Remove stale cached messages.
| mdata | NNTP Mailbox data |
Definition at line 798 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nntp_delete_group_cache | ( | struct NntpMboxData * | mdata | ) |
Remove hcache and bcache of newsgroup.
| mdata | NNTP Mailbox data |
Definition at line 807 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nntp_clear_cache | ( | struct NntpAccountData * | adata | ) |
Clear the NNTP cache.
| adata | NNTP server |
Remove hcache and bcache of all unexistent and unsubscribed newsgroups
Definition at line 840 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct NntpAccountData * nntp_select_server | ( | struct Mailbox * | m, |
| const char * | server, | ||
| bool | leave_lock ) |
Open a connection to an NNTP server.
| m | Mailbox |
| server | Server URL |
| leave_lock | Leave the server locked? |
| ptr | NNTP server |
| NULL | Error |
Automatically loads a newsrc into memory, if necessary. Checks the size/mtime of a newsrc file, if it doesn't match, load again. Hmm, if a system has broken mtimes, this might mean the file is reloaded every time, which we'd have to fix.
Definition at line 944 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:Get status of articles from .newsrc.
Full status flags are not supported by nntp, but we can fake some of them: Read = a read message number is in the .newsrc New = not read and not cached Old = not read but cached
Definition at line 1137 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct NntpMboxData * mutt_newsgroup_subscribe | ( | struct NntpAccountData * | adata, |
| char * | group ) |
Subscribe newsgroup.
| adata | NNTP server |
| group | Newsgroup |
| ptr | NNTP data |
| NULL | Error |
Definition at line 1174 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct NntpMboxData * mutt_newsgroup_unsubscribe | ( | struct NntpAccountData * | adata, |
| char * | group ) |
Unsubscribe newsgroup.
| adata | NNTP server |
| group | Newsgroup |
| ptr | NNTP data |
| NULL | Error |
Definition at line 1198 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct NntpMboxData * mutt_newsgroup_catchup | ( | struct Mailbox * | m, |
| struct NntpAccountData * | adata, | ||
| char * | group ) |
Catchup newsgroup.
| m | Mailbox |
| adata | NNTP server |
| group | Newsgroup |
| ptr | NNTP data |
| NULL | Error |
Definition at line 1225 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct NntpMboxData * mutt_newsgroup_uncatchup | ( | struct Mailbox * | m, |
| struct NntpAccountData * | adata, | ||
| char * | group ) |
Uncatchup newsgroup.
| m | Mailbox |
| adata | NNTP server |
| group | Newsgroup |
| ptr | NNTP data |
| NULL | Error |
Definition at line 1264 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nntp_mailbox | ( | struct Mailbox * | m, |
| char * | buf, | ||
| size_t | buflen ) |
Get first newsgroup with new messages.
Definition at line 1307 of file newsrc.c.
Here is the call graph for this function:
Here is the caller graph for this function: