* Cleaned up a couple of FIXME's sitting around in the code
[citadel.git] / webcit / webcit.h
index e799bc4178a7587e167e5c86e9e5d53a058caefb..dec7db575ce953a8beac4723cc3a86db26123b78 100644 (file)
 #include <ical.h>
 #endif
 
+#ifdef HAVE_OPENSSL
+/* Work around RedHat's b0rken OpenSSL includes */
+#define OPENSSL_NO_KRB5
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+#include <openssl/rand.h>
+#endif
+
 #define CALENDAR_ROOM_NAME     "Calendar"
 #define PRODID "-//Citadel//NONSGML Citadel Calendar//EN"
 
 #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.04"  /* who's in da house */
+#define SERVER                 "WebCit v5.21"  /* who's in da house */
 #define DEVELOPER_ID           0
 #define CLIENT_ID              4
-#define CLIENT_VERSION         504             /* This version of WebCit */
+#define CLIENT_VERSION         521             /* This version of WebCit */
 #define MINIMUM_CIT_VERSION    611             /* min required Citadel vers */
 #define DEFAULT_HOST           "localhost"     /* Default Citadel server */
 #define DEFAULT_PORT           "504"
@@ -114,7 +122,7 @@ struct serv_info {
  */
 struct march {
        struct march *next;
-       char march_name[32];
+       char march_name[128];
        int march_floor;
        int march_order;
 };
@@ -126,7 +134,7 @@ struct march {
 struct roomlisting {
        struct roomlisting *lnext;
        struct roomlisting *rnext;
-       char rlname[64];
+       char rlname[128];
        unsigned rlflags;
        int rlfloor;
        int rlorder;
@@ -163,7 +171,6 @@ struct wc_attachment {
        char *data;
 };
 
-
 /*
  * One of these is kept for each active Citadel session.
  * HTTP transactions are bound to one at a time.
@@ -181,6 +188,7 @@ struct wcsession {
        int is_room_aide;
        int http_sock;
        int serv_sock;
+       int chat_sock;
        unsigned room_flags;
        int wc_view;
        int wc_default_view;
@@ -218,19 +226,28 @@ struct wcsession {
        char ImportantMessage[SIZ];
        int outside_frameset_allowed;   /* nonzero if current req is allowed
                                         * outside of the main frameset */
+       char last_chat_user[SIZ];
 };
 
 #define extract(dest,source,parmnum)   extract_token(dest,source,parmnum,'|')
 #define num_parms(source)              num_tokens(source, '|')
 
+/* Per-session data */
 #define WC ((struct wcsession *)pthread_getspecific(MyConKey))
 extern pthread_key_t MyConKey;
 
+/* Per-thread SSL context */
+#ifdef HAVE_OPENSSL
+#define THREADSSL ((SSL *)pthread_getspecific(ThreadSSL))
+extern pthread_key_t ThreadSSL;
+#endif
+
 struct serv_info serv_info;
 extern char floorlist[128][SIZ];
 extern char *axdefs[];
 extern char *ctdlhost, *ctdlport;
 extern char *server_cookie;
+extern int is_https;
 
 extern struct wcsubst *global_subst;
 
@@ -262,13 +279,17 @@ void serv_printf(const char *format,...);
 char *bstr(char *key);
 void urlesc(char *, char *);
 void urlescputs(char *);
+void jsesc(char *, char *);
+void jsescputs(char *);
 void output_headers(int);
 void wprintf(const char *format,...);
 void output_static(char *what);
-void stresc(char *target, char *strbuf, int nbsp);
+void stresc(char *target, char *strbuf, int nbsp, int nolinebreaks);
 void escputs(char *strbuf);
 void url(char *buf);
-void escputs1(char *strbuf, int nbsp);
+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);
 void stripout(char *str, char leftboundary, char rightboundary);
@@ -343,6 +364,8 @@ void fmt_time(char *buf, time_t thetime);
 void httpdate(char *buf, time_t thetime);
 void end_webcit_session(void);
 void page_popup(void);
+void chat_recv(void);
+void chat_send(void);
 void http_redirect(char *);
 void clear_local_substs(void);
 void svprintf(char *keyname, int keytype, const char *format,...);
@@ -360,9 +383,10 @@ void edit_vcard(void);
 void submit_vcard(void);
 void striplt(char *);
 void select_user_to_edit(char *message, char *preselect);
-void display_edituser(char *who);
+void display_edituser(char *who, int is_new);
 void create_user(void);
 void edituser(void);
+void do_change_view(int);
 void change_view(void);
 void folders(void);
 void do_stuff_to_msgs(void);
@@ -431,3 +455,24 @@ void display_customize_iconbar(void);
 void commit_iconbar(void);
 int CtdlDecodeQuotedPrintable(char *decoded, char *encoded, int sourcelen);
 void spawn_another_worker_thread(void);
+
+
+
+#ifdef HAVE_OPENSSL
+void init_ssl(void);
+void endtls(void);
+void ssl_lock(int mode, int n, const char *file, int line);
+int starttls(int sock);
+extern SSL_CTX *ssl_ctx;  
+int client_read_ssl(char *buf, int bytes, int timeout);
+void client_write_ssl(char *buf, int nbytes);
+#endif
+
+
+
+/* Views (from citadel.h) */
+#define        VIEW_BBS                0       /* Traditional Citadel BBS view */
+#define VIEW_MAILBOX           1       /* Mailbox summary */
+#define VIEW_ADDRESSBOOK       2       /* Address book view */
+#define VIEW_CALENDAR          3       /* Calendar view */
+#define VIEW_TASKS             4       /* Tasks view */