]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.h
* add defines for our errorcodes
[citadel.git] / webcit / webcit.h
index a2bc143358a66e1109af76dec8733448eda25433..2d204cd6bdbe1ae085dc68a73874c668bea5fc36 100644 (file)
                        US_NOPROMPT | US_DISAPPEAR | US_PAGINATOR | \
                        US_FLOORS | US_COLOR | US_PROMPTCTL )
 
+
+#define MAJORCODE(a) (((int)(a / 100) ) * 100)
+
+#define LISTING_FOLLOWS        100
+#define CIT_OK                 200     
+#define MORE_DATA      300
+#define SEND_LISTING   400
+#define ERROR          500
+#define BINARY_FOLLOWS         600
+#define SEND_BINARY    700
+#define START_CHAT_MODE        800
+#define ASYNC_MSG      900
+
+#define MINORCODE(a) (a % 100)
+#define ASYNC_GEXP                     02      
+#define INTERNAL_ERROR                         10      
+#define TOO_BIG                        11      
+#define ILLEGAL_VALUE                  12      
+#define NOT_LOGGED_IN                  20      
+#define CMD_NOT_SUPPORTED              30      
+#define SERVER_SHUTTING_DOWN           31      
+#define PASSWORD_REQUIRED              40      
+#define ALREADY_LOGGED_IN              41      
+#define USERNAME_REQUIRED              42      
+#define HIGHER_ACCESS_REQUIRED                 50      
+#define MAX_SESSIONS_EXCEEDED          51      
+#define RESOURCE_BUSY                  52      
+#define RESOURCE_NOT_OPEN              53      
+#define NOT_HERE                       60      
+#define INVALID_FLOOR_OPERATION        61      
+#define NO_SUCH_USER                   70      
+#define FILE_NOT_FOUND                         71      
+#define ROOM_NOT_FOUND                         72      
+#define NO_SUCH_SYSTEM                         73      
+#define ALREADY_EXISTS                         74      
+#define MESSAGE_NOT_FOUND              75
 /*
  * NLI is the string that shows up in a who's online listing for sessions
  * that are active, but for which no user has yet authenticated.
@@ -328,6 +364,19 @@ enum {
        eNone
 };
 
+enum {
+       eGET,
+       ePOST,
+       eOPTIONS,
+       ePROPFIND,
+       ePUT,
+       eDELETE,
+       eHEAD,
+       eMOVE,
+       eCOPY,
+       eNONE
+};
+const char *ReqStrs[eNONE];
 /*
  * One of these is kept for each active Citadel session.
  * HTTP transactions are bound to one at a time.
@@ -353,7 +402,9 @@ struct wcsession {
        time_t lastreq;                         /**< Timestamp of most recent HTTP */
        time_t last_pager_check;                /**< last time we polled for instant msgs */
        ServInfo *serv_info;                   /**< Iformation about the citserver we're connected to */
+
 /* Request local Members */
+       long eReqType;                          /**< eGET, ePOST.... */
        StrBuf *CLineBuf;                       /**< linebuffering client stuff */
        StrBuf *UrlFragment1;                   /**< first urlfragment, if NEED_URL is specified by the handler*/
        StrBuf *UrlFragment2;                   /**< second urlfragment, if NEED_URL is specified by the handler*/
@@ -364,6 +415,7 @@ struct wcsession {
        StrBuf *this_page;                      /**< URL of current page */
        HashList *urlstrings;                   /**< variables passed to webcit in a URL */
        HashList *vars;                         /**< HTTP variable substitutions for this page */
+       HashList *headers;                      /**< the headers the client sent us */
        StrBuf *http_host;                      /**< HTTP Host: header */
        int is_ajax;                            /** < are we doing an ajax request? */
        int gzip_ok;                            /**< Nonzero if Accept-encoding: gzip */
@@ -510,10 +562,6 @@ extern int setup_wizard;
 extern char wizard_filename[];
 extern time_t if_modified_since;
 extern int follow_xff;
-extern HashList *HandlerHash;
-extern HashList *PreferenceHooks;
-extern HashList *ZoneHash;
-extern HashList *SortHash;
 
 void InitialiseSemaphores(void);
 void begin_critical_section(int which_one);
@@ -543,7 +591,6 @@ int uds_connectsock(char *);
 int tcp_connectsock(char *, char *);
 int serv_getln(char *strbuf, int bufsize);
 int StrBuf_ServGetln(StrBuf *buf);
-int StrBuf_ServGetlnBuffered(StrBuf *buf);
 int GetServerStatus(StrBuf *Line, long* FullState);
 void serv_puts(const char *string);
 void who(void);
@@ -617,14 +664,12 @@ void serv_gets(char *strbuf);
 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 load_floorlist(void);
+void load_floorlist(StrBuf *Buf);
 void shutdown_sessions(void);
 void do_housekeeping(void);
 void smart_goto(const StrBuf *);
 void worker_entry(void);
-void session_loop(HashList *HTTPHeaders, 
-                 StrBuf *ReqLine, 
-                 StrBuf *ReqType, 
+void session_loop(StrBuf *ReqLine, 
                  StrBuf *ReadBuf, 
                  const char **Pos);
 size_t wc_strftime(char *s, size_t max, const char *format, const struct tm *tm);
@@ -718,7 +763,7 @@ int read_server_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf);
 int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize);
 int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize);
 int read_server_text(StrBuf *Buf, long *nLines);
-int goto_config_room(void);
+int goto_config_room(StrBuf *Buf);
 long locate_user_vcard_in_this_room(message_summary **VCMsg,
                                    wc_mime_attachment **VCAtt);
 void sleeeeeeeeeep(int);
@@ -726,7 +771,7 @@ void http_transmit_thing(const char *content_type, int is_static);
 long unescape_input(char *buf);
 void do_selected_iconbar(void);
 void spawn_another_worker_thread(void);
-void display_rss(const StrBuf *roomname, StrBuf *request_method);
+void display_rss(const StrBuf *roomname);
 void StrEndTab(StrBuf *Target, int tabnum, int num_tabs);
 void StrBeginTab(StrBuf *Target, int tabnum, int num_tabs);
 void StrTabbedDialog(StrBuf *Target, int num_tabs, StrBuf *tabnames[]);
@@ -800,6 +845,7 @@ void WebcitAddUrlHandler(const char * UrlString, long UrlSLen, WebcitHandlerFunc
 #define AJAX (1<<0)
 #define ANONYMOUS (1<<1)
 #define NEED_URL (1<<2)
+#define XHTTP_COMMANDS (1<<3)
 
 
 /* These should be empty, but we have them for testing */