2 * $Id: remote.h 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2016 Eduardo Chappa
6 * Copyright 2006-2008 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #ifndef PITH_REMOTE_INCLUDED
18 #define PITH_REMOTE_INCLUDED
21 #include "../pith/remtype.h"
22 #include "../pith/conftype.h"
25 #define REMOTE_DATA_TYPE TYPETEXT
26 #define REMOTE_DATA_VERS_NUM 1
27 #define REMOTE_ABOOK_SUBTYPE "x-pine-addrbook"
28 #define REMOTE_PINERC_SUBTYPE "x-pine-pinerc"
29 #define REMOTE_SIG_SUBTYPE "x-pine-sig"
30 #define REMOTE_SMIME_SUBTYPE "x-pine-smime"
32 #define PMAGIC "P#*E@"
33 #define METAFILE_VERSION_NUM "01"
34 #define SIZEOF_PMAGIC (5)
35 #define SIZEOF_SPACE (1)
36 #define SIZEOF_VERSION_NUM (2)
37 #define TO_FIND_HDR_PMAGIC (0)
38 #define TO_FIND_VERSION_NUM (TO_FIND_HDR_PMAGIC + SIZEOF_PMAGIC + SIZEOF_SPACE)
42 * For flags below. Also for address book flags in struct adrbk. Some of
43 * these flags are shared so they need to be in the same namespace.
45 #define DEL_FILE 0x00001 /* remove addrbook file in adrbk_close */
46 #define DO_REMTRIM 0x00004 /* trim remote data if needed and possible */
47 #define USE_OLD_CACHE 0x00008 /* using cache copy, couldn't check if old */
48 #define REM_OUTOFDATE 0x00010 /* remote data changed since cached */
49 #define NO_STATUSCMD 0x00020 /* imap server doesn't have status command */
50 #define NO_META_UPDATE 0x00040 /* don't try to update metafile */
51 #define NO_PERM_CACHE 0x00080 /* remove temp cache files when done */
52 #define NO_FILE 0x00100 /* use memory (sonofile) instead of a file */
53 #define FILE_OUTOFDATE 0x00400 /* addrbook file discovered out of date */
54 #define COOKIE_ONE_OK 0x02000 /* cookie with old value of one is ok */
55 #define USER_SAID_NO 0x04000 /* user said no when asked about cookie */
56 #define USER_SAID_YES 0x08000 /* user said yes when asked about cookie */
57 #define BELIEVE_CACHE 0x10000 /* user said yes when asked about cookie */
60 extern char meta_prefix
[];
63 /* exported protoypes */
64 char *read_remote_pinerc(PINERC_S
*, ParsePinerc
);
65 REMDATA_S
*rd_create_remote(RemType
, char *, char *, unsigned *, char *, char *);
66 REMDATA_S
*rd_new_remdata(RemType
, char *, char *);
67 void rd_free_remdata(REMDATA_S
**);
68 void rd_trim_remdata(REMDATA_S
**);
69 void rd_close_remdata(REMDATA_S
**);
70 int rd_read_metadata(REMDATA_S
*);
71 void rd_write_metadata(REMDATA_S
*, int);
72 void rd_update_metadata(REMDATA_S
*, char *);
73 void rd_open_remote(REMDATA_S
*);
74 void rd_close_remote(REMDATA_S
*);
75 int rd_stream_exists(REMDATA_S
*);
76 int rd_ping_stream(REMDATA_S
*);
77 void rd_check_readonly_access(REMDATA_S
*);
78 int rd_init_remote(REMDATA_S
*, int);
79 int rd_update_local(REMDATA_S
*);
80 int rd_update_remote(REMDATA_S
*, char *);
81 void rd_check_remvalid(REMDATA_S
*, long);
82 int rd_remote_is_readonly(REMDATA_S
*);
83 int rd_chk_for_hdr_msg(MAILSTREAM
**, REMDATA_S
*, char **);
85 /* currently mandatory to implement stubs */
88 * This is used when we try to copy remote config data and find that
89 * the remote folder looks fishy. We ask the user what they want to
92 int rd_prompt_about_forged_remote_data(int,REMDATA_S
*, char *);
95 #endif /* PITH_REMOTE_INCLUDED */