Avoid re-using sessions that are already bound to an executing thread. This will...
[citadel.git] / webcit / webcit.h
index 75baddc9b36b5db613443cf73055b6455a7f9c49..c4891d3e10ac70e22223a36bf13c5508b7a92658 100644 (file)
@@ -132,7 +132,7 @@ extern char *ssl_cipher_list;
 
 #define SIZ                    4096            /* generic buffer size */
 
-#define TRACE fprintf(stderr, "\033[7mCheckpoint: %s, %d\033[0m\n", __FILE__, __LINE__)
+#define TRACE syslog(LOG_DEBUG, "\033[3%dmCHECKPOINT: %s:%d\033[0m", ((__LINE__%6)+1), __FILE__, __LINE__)
 
 #define SLEEPING               180             /* TCP connection timeout */
 #define WEBCIT_TIMEOUT         900             /* WebCit session timeout */
@@ -479,6 +479,7 @@ struct wcsession {
        int ctdl_pid;                           /* Session ID on the Citadel server */
        int nonce;                              /* session nonce (to prevent session riding) */
        int SessionKey;
+       int inuse;                              /* set to nonzero if bound to a running thread */
 
 /* Session local Members */
        int serv_sock;                          /* Client socket to Citadel server */
@@ -564,6 +565,9 @@ struct wcsession {
        int ib_wholist_expanded;
        int ib_roomlist_expanded;
 
+/* our known Sieve scripts; loaded by SIEVE:SCRIPTS iterator. */
+       HashList *KnownSieveScripts;
+
 /* Transcoding cache buffers; used to avoid to frequent realloc */
        StrBuf *ConvertBuf1;
        StrBuf *ConvertBuf2;
@@ -662,7 +666,7 @@ int tcp_connectsock(char *, char *);
 int serv_getln(char *strbuf, int bufsize);
 int StrBuf_ServGetln(StrBuf *buf);
 int GetServerStatus(StrBuf *Line, long* FullState);
-void serv_puts(const char *string);
+int serv_puts(const char *string);
 void who(void);
 void push_destination(void);
 void pop_destination(void);
@@ -694,6 +698,7 @@ void output_headers(    int do_httpheaders,
                        int suppress_check,
                        int cache);
 void output_custom_content_header(const char *ctype);
+void cdataout(char *rawdata);
 
 #ifdef UBER_VERBOSE_DEBUGGING
 #define wc_printf(...) wcc_printf(__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
@@ -733,11 +738,6 @@ long gotoroom(const StrBuf *gname);
 void remove_march(const StrBuf *aaa);
 void dotskip(void);
 void validate(void);
-void display_graphics_upload(char *, char *, char *);
-void do_graphics_upload(char *upl_cmd);
-void serv_write(const char *buf, int nbytes);
-void serv_putbuf(const StrBuf *string);
-void serv_printf(const char *format,...)__attribute__((__format__(__printf__,1,2)));
 void shutdown_sessions(void);
 void do_housekeeping(void);
 void smart_goto(const StrBuf *);
@@ -808,6 +808,9 @@ int ical_ctdl_is_overlap(
 
 extern char *months[];
 extern char *days[];
+int serv_write(const char *buf, int nbytes);
+int serv_putbuf(const StrBuf *string);
+int serv_printf(const char *format,...)__attribute__((__format__(__printf__,1,2)));
 int serv_read_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf);
 int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize);
 int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize);
@@ -885,3 +888,29 @@ void http_datestring(char *buf, size_t n, time_t xtime);
 #define WC_TIMEFORMAT_24 2
 
 extern int time_to_die;                        /* Nonzero if server is shutting down */
+
+/* a nice consistent place to define how we turn a message id into a thread id hash */
+#define ThreadIdHash(Buf) abs(HashLittle(ChrPtr(Buf), StrLength(Buf)))
+
+/* 
+ * Array type for a blog post.  The first message is the post; the rest are comments
+ */
+struct blogpost {
+       int top_level_id;
+       long *msgs;             /* Array of msgnums for messages we are displaying */
+       int num_msgs;           /* Number of msgnums stored in 'msgs' */
+       int alloc_msgs;         /* Currently allocated size of array */
+};
+
+
+/*
+ * Data which gets returned from a call to blogview_learn_thread_references()
+ */
+struct bltr {
+       int id;
+       int refs;
+};
+
+
+struct bltr blogview_learn_thread_references(long msgnum);
+void tmplput_blog_permalink(StrBuf *Target, WCTemplputParams *TP);