* Replaced serv_gets() with serv_getln() - which now requires the caller
[citadel.git] / webcit / webcit.h
index 254f305d4a8f3290441c83748e36bfd90ccd2b9a..b4cb23bebe33761f560f96e29b9108e48f925498 100644 (file)
 #define SLEEPING               180             /* TCP connection timeout */
 #define WEBCIT_TIMEOUT         900             /* WebCit session timeout */
 #define PORT_NUM               2000            /* port number to listen on */
-#define SERVER                 "WebCit v5.28"  /* who's in da house */
+#define SERVER                 "WebCit v6.10"  /* who's in da house */
 #define DEVELOPER_ID           0
 #define CLIENT_ID              4
-#define CLIENT_VERSION         528             /* This version of WebCit */
-#define MINIMUM_CIT_VERSION    626             /* min required Citadel vers */
+#define CLIENT_VERSION         610             /* This version of WebCit */
+#define MINIMUM_CIT_VERSION    640             /* min required Citadel vers */
 #define DEFAULT_HOST           "localhost"     /* Default Citadel server */
 #define DEFAULT_PORT           "504"
 #define LB                     (1)             /* Internal escape chars */
@@ -212,7 +212,7 @@ struct wcsession {
        long msgarr[4096];              /* for read operations */
        int is_wap;                     /* Client is a WAP gateway */
        struct urlcontent *urlstrings;
-       int HaveExpressMessages;        /* Nonzero if incoming msgs exist */
+       int HaveInstantMessages;        /* Nonzero if incoming msgs exist */
        struct wcsubst *vars;
        char this_page[SIZ];            /* address of current page */
        char http_host[SIZ];            /* HTTP Host: header */
@@ -228,9 +228,14 @@ struct wcsession {
        char ImportantMessage[SIZ];
        char last_chat_user[SIZ];
        int ctdl_pid;                   /* Session ID on the Citadel server */
+       char httpauth_user[SIZ];        /* only for GroupDAV sessions */
+       char httpauth_pass[SIZ];        /* only for GroupDAV sessions */
+
+       size_t burst_len;
+       char *burst;
+       int gzip_ok;                    /* Nonzero if Accept-encoding: gzip */
 };
 
-#define extract(dest,source,parmnum)   extract_token(dest,source,parmnum,'|')
 #define num_parms(source)              num_tokens(source, '|')
 
 /* Per-session data */
@@ -249,12 +254,16 @@ extern char *axdefs[];
 extern char *ctdlhost, *ctdlport;
 extern char *server_cookie;
 extern int is_https;
-
+extern int setup_wizard;
+extern char wizard_filename[];
+void do_setup_wizard(void);
 
 void stuff_to_cookie(char *cookie, int session,
                        char *user, char *pass, char *room);
 void cookie_to_stuff(char *cookie, int *session,
-                       char *user, char *pass, char *room);
+                char *user, size_t user_len,
+                char *pass, size_t pass_len,
+                char *room, size_t room_len);
 void locate_host(char *, int);
 void become_logged_in(char *, char *, char *);
 void do_login(void);
@@ -262,6 +271,7 @@ void display_login(char *mesg);
 void do_welcome(void);
 void do_logout(void);
 void display_main_menu(void);
+void display_aide_menu(void);
 void display_advanced_menu(void);
 void slrp_highest(void);
 void gotonext(void);
@@ -269,7 +279,7 @@ void ungoto(void);
 void get_serv_info(char *, char *);
 int uds_connectsock(char *);
 int tcp_connectsock(char *, char *);
-void serv_gets(char *strbuf);
+void serv_getln(char *strbuf, int bufsize);
 void serv_puts(char *string);
 void whobbs(void);
 void fmout(FILE *fp, char *align);
@@ -295,8 +305,8 @@ void url(char *buf);
 void escputs1(char *strbuf, int nbsp, int nolinebreaks);
 void msgesc(char *target, char *strbuf);
 void msgescputs(char *strbuf);
-long extract_long(char *source, long int parmnum);
-int extract_int(char *source, int parmnum);
+int extract_int(const char *source, int parmnum);
+long extract_long(const char *source, int parmnum);
 void stripout(char *str, char leftboundary, char rightboundary);
 void dump_vars(void);
 void embed_main_menu(void);
@@ -308,7 +318,6 @@ void display_enter(void);
 void post_message(void);
 void confirm_delete_msg(void);
 void delete_msg(void);
-void do_stuff_to_one_msg(void);
 void confirm_move_msg(void);
 void move_msg(void);
 void userlist(void);
@@ -328,6 +337,7 @@ void display_editroom(void);
 void netedit(void);
 void editroom(void);
 void display_whok(void);
+void do_invt_kick(void);
 void server_to_text(void);
 void save_edit(char *description, char *enter_cmd, int regoto);
 void display_edit(char *description, char *check_cmd,
@@ -379,7 +389,7 @@ void do_template(void *templatename);
 int lingering_close(int fd);
 char *memreadline(char *start, char *buf, int maxlen);
 int num_tokens (char *source, char tok);
-void extract_token(char *dest, char *source, int parmnum, char separator);
+void extract_token(char *dest, const char *source, int parmnum, char separator, int maxlen);
 void remove_token(char *source, int parmnum, char separator);
 char *load_mimepart(long msgnum, char *partnum);
 int pattern2(char *search, char *patn);
@@ -388,6 +398,7 @@ void edit_vcard(void);
 void submit_vcard(void);
 void striplt(char *);
 void select_user_to_edit(char *message, char *preselect);
+void delete_user(char *);
 void display_edituser(char *who, int is_new);
 void create_user(void);
 void edituser(void);
@@ -397,13 +408,14 @@ void folders(void);
 void do_stuff_to_msgs(void);
 void load_preferences(void);
 void save_preferences(void);
-void get_preference(char *key, char *value);
+void get_preference(char *key, char *value, size_t value_len);
 void set_preference(char *key, char *value);
 void knrooms(void);
 int is_msg_in_mset(char *mset, long msgnum);
 char *safestrncpy(char *dest, const char *src, size_t n);
 void display_addressbook(long msgnum, char alpha);
 void offer_start_page(void);
+void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext);
 void change_start_page(void);
 void output_html(void);
 void display_floorconfig(char *);
@@ -484,7 +496,18 @@ int client_read_ssl(char *buf, int bytes, int timeout);
 void client_write_ssl(char *buf, int nbytes);
 #endif
 
+#ifdef HAVE_ZLIB
+#include <zlib.h>
+int ZEXPORT compress_gzip(Bytef * dest, uLongf * destLen,
+                          const Bytef * source, uLong sourceLen, int level);
+#endif
+
+
+void begin_burst(void);
+void end_burst(void);
+
 extern char *ascmonths[];
+void http_datestring(char *buf, size_t n, time_t xtime);
 
 
 /* Views (from citadel.h) */
@@ -494,3 +517,8 @@ extern char *ascmonths[];
 #define VIEW_CALENDAR          3       /* Calendar view */
 #define VIEW_TASKS             4       /* Tasks view */
 #define VIEW_NOTES             5       /* Notes view */
+
+
+/* These should be empty, but we have them for testing */
+#define DEFAULT_HTTPAUTH_USER  ""
+#define DEFAULT_HTTPAUTH_PASS  ""