From 8ffdf2da8a54c95737cdf4f9fbb4908d4b31ff14 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sat, 23 Jul 2011 22:16:32 +0000 Subject: [PATCH] cleanup webcit.h; utils.c, remove unneeded stuff --- webcit/calendar.h | 19 ++++ webcit/calendar_tools.c | 1 + webcit/context_loop.c | 4 + webcit/cookie_conversion.c | 1 + webcit/downloads.c | 2 + webcit/graphics.c | 2 + webcit/marchlist.c | 3 - webcit/paramhandling.c | 6 +- webcit/roomops.c | 5 + webcit/roomops.h | 8 ++ webcit/serv_func.c | 42 ------- webcit/sieve.c | 1 + webcit/summary.c | 3 +- webcit/sysdep.c | 1 + webcit/tcp_sockets.h | 19 ++++ webcit/useredit.c | 36 +++--- webcit/utils.c | 126 +-------------------- webcit/utils.h | 7 ++ webcit/webcit.c | 6 +- webcit/webcit.h | 217 +++++++++++++------------------------ webcit/webserver.c | 2 +- 21 files changed, 173 insertions(+), 338 deletions(-) create mode 100644 webcit/tcp_sockets.h create mode 100644 webcit/utils.h diff --git a/webcit/calendar.h b/webcit/calendar.h index ad358d23c..755d93101 100644 --- a/webcit/calendar.h +++ b/webcit/calendar.h @@ -79,4 +79,23 @@ int tasks_LoadMsgFromServer(SharedMessageStatus *Stat, message_summary* Msg, int is_new, int i); + +void display_edit_task(void); +void display_edit_event(void); + +icaltimezone *get_default_icaltimezone(void); +void display_icaltimetype_as_webform(struct icaltimetype *, char *, int); +void icaltime_from_webform(struct icaltimetype *result, char *prefix); +void icaltime_from_webform_dateonly(struct icaltimetype *result, char *prefix); +void partstat_as_string(char *buf, icalproperty *attendee); +icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp); +void check_attendee_availability(icalcomponent *supplied_vevent); +int ical_ctdl_is_overlap( + struct icaltimetype t1start, + struct icaltimetype t1end, + struct icaltimetype t2start, + struct icaltimetype t2end +); + + #endif diff --git a/webcit/calendar_tools.c b/webcit/calendar_tools.c index 4a8b9160b..b2c12afc7 100644 --- a/webcit/calendar_tools.c +++ b/webcit/calendar_tools.c @@ -21,6 +21,7 @@ #include "webcit.h" #include "webserver.h" #include "time.h" +#include "calendar.h" /* Hour strings */ char *hourname[] = { diff --git a/webcit/context_loop.c b/webcit/context_loop.c index 6c449c554..032606708 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -39,6 +39,10 @@ extern HashList *HandlerHash; int num_threads_existing = 1; /* Number of worker threads which exist. */ int num_threads_executing = 1; /* Number of worker threads currently executing. */ +extern void session_loop(void); +void spawn_another_worker_thread(void); + + void DestroyHttpHeaderHandler(void *V) { OneHttpHeader *pHdr; diff --git a/webcit/cookie_conversion.c b/webcit/cookie_conversion.c index 0e66c905d..b0dffbe58 100644 --- a/webcit/cookie_conversion.c +++ b/webcit/cookie_conversion.c @@ -25,6 +25,7 @@ */ static char *unset = "; expires=28-May-1971 18:10:00 GMT"; typedef unsigned char byte; /* Byte type used by cookie_to_stuff() */ +extern const char *get_selected_language(void); /* * Pack all session info into one easy-to-digest cookie. Healthy and delicious! diff --git a/webcit/downloads.c b/webcit/downloads.c index 1a5789c25..fc06c379b 100644 --- a/webcit/downloads.c +++ b/webcit/downloads.c @@ -19,6 +19,8 @@ #include "webcit.h" #include "webserver.h" +extern void output_static(const char* What); + extern char* static_dirs[]; typedef struct _FileListStruct { diff --git a/webcit/graphics.c b/webcit/graphics.c index f798cc3e5..2a2a856a5 100644 --- a/webcit/graphics.c +++ b/webcit/graphics.c @@ -20,6 +20,8 @@ #include "webcit.h" +extern void output_static(const char* What); + void display_graphics_upload(char *filename) { char buf[SIZ]; diff --git a/webcit/marchlist.c b/webcit/marchlist.c index bcfbb4872..175f780e7 100644 --- a/webcit/marchlist.c +++ b/webcit/marchlist.c @@ -230,9 +230,6 @@ void _gotonext(void) { } -void dotskip(void) { - smart_goto(sbstr("room")); -} int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP) diff --git a/webcit/paramhandling.c b/webcit/paramhandling.c index ed1a1a587..aadadab9f 100644 --- a/webcit/paramhandling.c +++ b/webcit/paramhandling.c @@ -437,11 +437,11 @@ void diagnostics(void) wc_printf("Session: %d
\n", WC->wc_session); wc_printf("Command:
\n");
 /*	
-StrEscPuts(WC->UrlFragment1);
+StrEscAppend(WC->WBuf, NULL, WC->UrlFragment1, 0, 0);
 	wc_printf("
\n"); - StrEscPuts(WC->UrlFragment2); +StrEscAppend(WC->WBuf, NULL, WC->UrlFragment12 0, 0); wc_printf("
\n"); - StrEscPuts(WC->UrlFragment3); +StrEscAppend(WC->WBuf, NULL, WC->UrlFragment3, 0, 0); */ wc_printf("

\n"); wc_printf("Variables:
\n");
diff --git a/webcit/roomops.c b/webcit/roomops.c
index bcbbe24cb..5029030bb 100644
--- a/webcit/roomops.c
+++ b/webcit/roomops.c
@@ -113,6 +113,11 @@ void _DBG_QR2(long QR2)
 /*******************************************************************************
  ***************************** Goto Commands ***********************************
  ******************************************************************************/
+
+void dotskip(void) {
+	smart_goto(sbstr("room"));
+}
+
 void dotgoto(void) {
 	if (!havebstr("room")) {
 		readloop(readnew, eUseDefault);
diff --git a/webcit/roomops.h b/webcit/roomops.h
index b0f9caa0e..516c00d78 100644
--- a/webcit/roomops.h
+++ b/webcit/roomops.h
@@ -127,6 +127,14 @@ void LoadXRoomPic(void);
 void LoadXRoomInfoText(void);
 void LoadXRoomXCountFiles(void);
 
+long gotoroom(const StrBuf *gname);
+
+void slrp_highest(void);
+void remove_march(const StrBuf *aaa);
+void dotskip(void);
+void smart_goto(const StrBuf *next_room);
+void free_march_list(wcsession *wcf);
+
 /*
  * wrapper around usual sort-comparator; private rooms will allways be prefered, -1 if one of them NULL
  */
diff --git a/webcit/serv_func.c b/webcit/serv_func.c
index 105bf9a48..14a4d6559 100644
--- a/webcit/serv_func.c
+++ b/webcit/serv_func.c
@@ -379,48 +379,6 @@ void FmOut(StrBuf *Target, char *align, StrBuf *Source)
 }
 
 
-/*
- * Read Citadel variformat text and spit it out as HTML in a form
- * suitable for embedding in another message (forward/quote).
- * (NO LINEBREAKS ALLOWED HERE!)
- */
-void pullquote_fmout(void) {
-	int intext = 0;
-	int bq = 0;
-	char buf[SIZ];
-
-	while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
-
-		if ((intext == 1) && (isspace(buf[0]))) {
-			wc_printf("
"); - } - intext = 1; - - /* - * Quoted text should be displayed in italics and in a - * different colour. This code understands Citadel-style - * " >" quotes and will convert to
tags. - */ - if ((bq == 0) && (!strncmp(buf, " >", 2))) { - wc_printf("
"); - bq = 1; - } else if ((bq == 1) && (strncmp(buf, " >", 2))) { - wc_printf("
"); - bq = 0; - } - if ((bq == 1) && (!strncmp(buf, " >", 2))) { - strcpy(buf, &buf[2]); - } - - msgescputs(buf); - } - if (bq == 1) { - wc_printf(""); - } -} - - - /* * Transmit message text (in memory) to the server. diff --git a/webcit/sieve.c b/webcit/sieve.c index aaf4b1d7a..38d7b8c6b 100644 --- a/webcit/sieve.c +++ b/webcit/sieve.c @@ -42,6 +42,7 @@ void osr_sanitize(char *str) { } void display_add_remove_scripts(char *message); +void display_rules_editor_inner_div(void); diff --git a/webcit/summary.c b/webcit/summary.c index 6372245a0..ecb90c0b1 100644 --- a/webcit/summary.c +++ b/webcit/summary.c @@ -21,6 +21,8 @@ #include "webcit.h" #include "calendar.h" +extern int calendar_summary_view(void); + /* * Display today's date in a friendly format */ @@ -209,7 +211,6 @@ InitModule_SUMMARY WebcitAddUrlHandler(HKEY("new_messages_html"), "", 0, new_messages_section, AJAX); WebcitAddUrlHandler(HKEY("tasks_inner_html"), "", 0, tasks_section, AJAX); WebcitAddUrlHandler(HKEY("calendar_inner_html"), "", 0, calendar_section, AJAX); - WebcitAddUrlHandler(HKEY("mini_calendar"), "", 0, ajax_mini_calendar, AJAX); } diff --git a/webcit/sysdep.c b/webcit/sysdep.c index 442c83283..16c8e4f61 100644 --- a/webcit/sysdep.c +++ b/webcit/sysdep.c @@ -83,6 +83,7 @@ int verbosity = 9; /* Logging level */ extern void *context_loop(ParsedHttpHdrs *Hdr); extern void *housekeeping_loop(void); +extern void do_housekeeping(void); char ctdl_key_dir[PATH_MAX]=SSL_DIR; char file_crpt_file_key[PATH_MAX]=""; diff --git a/webcit/tcp_sockets.h b/webcit/tcp_sockets.h new file mode 100644 index 000000000..4219fe8bd --- /dev/null +++ b/webcit/tcp_sockets.h @@ -0,0 +1,19 @@ +int uds_connectsock(char *); +int tcp_connectsock(char *, char *); +int serv_getln(char *strbuf, int bufsize); +int StrBuf_ServGetln(StrBuf *buf); +int GetServerStatus(StrBuf *Line, long* FullState); +int serv_puts(const char *string); + +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); +int read_server_text(StrBuf *Buf, long *nLines); + +void text_to_server(char *ptr); +void text_to_server_qp(char *ptr); +void server_to_text(void); +int lingering_close(int fd); diff --git a/webcit/useredit.c b/webcit/useredit.c index c6dee8107..57aaae864 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -643,6 +643,24 @@ void display_edit_address_book_entry(const char *username, long usernum) { FreeStrBuf(&roomname); } +/* + * burge a user + * username the name of the user to remove + */ +void delete_user(char *username) { + wcsession *WCC = WC; + StrBuf *Buf; + + Buf = NewStrBuf(); + serv_printf("ASUP %s|0|0|0|0|0|", username); + StrBuf_ServGetln(Buf); + if (GetServerStatus(Buf, NULL) != 2) + StrBufAppendBuf(WCC->ImportantMsg, Buf, 4); + + select_user_to_edit( bstr("username")); + FreeStrBuf(&Buf); +} + void display_edituser(const char *supplied_username, int is_new) { const char *Pos; @@ -760,24 +778,6 @@ void edituser(void) { } } -/* - * burge a user - * username the name of the user to remove - */ -void delete_user(char *username) { - wcsession *WCC = WC; - StrBuf *Buf; - - Buf = NewStrBuf(); - serv_printf("ASUP %s|0|0|0|0|0|", username); - StrBuf_ServGetln(Buf); - if (GetServerStatus(Buf, NULL) != 2) - StrBufAppendBuf(WCC->ImportantMsg, Buf, 4); - - select_user_to_edit( bstr("username")); - FreeStrBuf(&Buf); -} - /* diff --git a/webcit/utils.c b/webcit/utils.c index 3e465e20b..4a8228146 100644 --- a/webcit/utils.c +++ b/webcit/utils.c @@ -127,35 +127,14 @@ long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks) return (bptr - target); } - -void escputs1(const char *strbuf, int nbsp, int nolinebreaks) -{ - StrEscAppend(WC->WBuf, NULL, strbuf, nbsp, nolinebreaks); -} - -void StrEscputs1(const StrBuf *strbuf, int nbsp, int nolinebreaks) -{ - StrEscAppend(WC->WBuf, strbuf, NULL, nbsp, nolinebreaks); -} - /* * static wrapper for ecsputs1 */ void escputs(const char *strbuf) { - escputs1(strbuf, 0, 0); + StrEscAppend(WC->WBuf, NULL, strbuf, 0, 0); } - -/* - * static wrapper for ecsputs1 - */ -void StrEscPuts(const StrBuf *strbuf) -{ - StrEscputs1(strbuf, 0, 0); -} - - /* * urlescape buffer and print it to the client */ @@ -164,13 +143,6 @@ void urlescputs(const char *strbuf) StrBufUrlescAppend(WC->WBuf, NULL, strbuf); } -/* - * urlescape buffer and print it to the client - */ -void UrlescPutStrBuf(const StrBuf *strbuf) -{ - StrBufUrlescAppend(WC->WBuf, strbuf, NULL); -} /** * urlescape buffer and print it as header @@ -181,102 +153,6 @@ void hurlescputs(const char *strbuf) } -/* - * Copy a string, escaping characters for JavaScript strings. - */ -void jsesc(char *target, size_t tlen, char *strbuf) -{ - int len; - char *tend; - char *send; - char *tptr; - char *sptr; - - target[0]='\0'; - len = strlen (strbuf); - send = strbuf + len; - tend = target + tlen; - sptr = strbuf; - tptr = target; - - while (!IsEmptyStr(sptr) && - (sptr < send) && - (tptr < tend)) { - - if (*sptr == '<') - *tptr = '['; - else if (*sptr == '>') - *tptr = ']'; - else if (*sptr == '\'') { - if (tend - tptr < 3) - return; - *(tptr++) = '\\'; - *tptr = '\''; - } - else if (*sptr == '"') { - if (tend - tptr < 8) - return; - *(tptr++) = '&'; - *(tptr++) = 'q'; - *(tptr++) = 'u'; - *(tptr++) = 'o'; - *(tptr++) = 't'; - *tptr = ';'; - } - else if (*sptr == '&') { - if (tend - tptr < 7) - return; - *(tptr++) = '&'; - *(tptr++) = 'a'; - *(tptr++) = 'm'; - *(tptr++) = 'p'; - *tptr = ';'; - } else { - *tptr = *sptr; - } - tptr++; sptr++; - } - *tptr = '\0'; -} - -/* - * escape and print javascript - */ -void jsescputs(char *strbuf) -{ - char outbuf[SIZ]; - - jsesc(outbuf, SIZ, strbuf); - wc_printf("%s", outbuf); -} - -/* - * print a string to the client after cleaning it with msgesc() and stresc() - */ -void msgescputs1( char *strbuf) -{ - StrBuf *OutBuf; - - if ((strbuf == NULL) || IsEmptyStr(strbuf)) - return; - OutBuf = NewStrBuf(); - StrMsgEscAppend(OutBuf, NULL, strbuf); - StrEscAppend(WC->WBuf, OutBuf, NULL, 0, 0); - FreeStrBuf(&OutBuf); -} - -/* - * print a string to the client after cleaning it with msgesc() - */ -void msgescputs(char *strbuf) { - if ((strbuf != NULL) && !IsEmptyStr(strbuf)) - StrMsgEscAppend(WC->WBuf, NULL, strbuf); -} - - - - - /* * Output a string to the client as a CDATA block */ diff --git a/webcit/utils.h b/webcit/utils.h new file mode 100644 index 000000000..57cf13b9f --- /dev/null +++ b/webcit/utils.h @@ -0,0 +1,7 @@ +void StrEscPuts(const StrBuf *strbuf); +void StrEscputs1(const StrBuf *strbuf, int nbsp, int nolinebreaks); + +void urlescputs(const char *); +void hurlescputs(const char *); +long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks); +void escputs(const char *strbuf); diff --git a/webcit/webcit.c b/webcit/webcit.c index ac44ac1fd..6d9373edb 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -30,6 +30,10 @@ StrBuf *csslocal = NULL; HashList *HandlerHash = NULL; +void stuff_to_cookie(int unset_cookie); +int GetConnected(void); + + void PutRequestLocalMem(void *Data, DeleteHashDataFunc DeleteIt) { wcsession *WCC = WC; @@ -456,7 +460,7 @@ void ajax_servcmd(void) * This is kind of an ugly hack, but this is the only place it can go. * If the command was GEXP, then the instant messenger window must be * running, so reset the "last_pager_check" watchdog timer so - * that page_popup() doesn't try to open it a second time. + * that page_popup() doesn't try to open it a second time. TODO: page_popup isn't with us anymore. */ if (!strncasecmp(bstr("g_cmd"), "GEXP", 4)) { WCC->last_pager_check = time(NULL); diff --git a/webcit/webcit.h b/webcit/webcit.h index c4891d3e1..567dc5d4e 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -97,6 +97,9 @@ #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #undef PACKAGE_BUGREPORT + +typedef struct wcsession wcsession; + #include "sysdep.h" #include "subst.h" @@ -105,6 +108,8 @@ #include "roomops.h" #include "preferences.h" +#include "tcp_sockets.h" +#include "utils.h" #ifdef HAVE_OPENSSL /* Work around RedHat's b0rken OpenSSL includes */ #define OPENSSL_NO_KRB5 @@ -360,6 +365,14 @@ typedef struct _addrbookent { #define PARSE_REST_URL (1<<9) #define PROHIBIT_STARTPAGE (1<<10) + +#define DATEFMT_FULL 0 +#define DATEFMT_BRIEF 1 +#define DATEFMT_RAWDATE 2 +#define DATEFMT_LOCALEDATE 3 +void webcit_fmt_date(char *buf, size_t siz, time_t thetime, int Format); + + typedef enum _RESTDispatchID { ExistsID, PutID, @@ -469,7 +482,6 @@ typedef struct _ParsedHttpHdrs { * One of these is kept for each active Citadel session. * HTTP transactions are bound to one at a time. */ -typedef struct wcsession wcsession; struct wcsession { /* infrastructural members */ wcsession *next; /* Linked list */ @@ -617,25 +629,61 @@ extern char ctdl_key_dir[PATH_MAX]; extern char file_crpt_file_key[PATH_MAX]; extern char file_crpt_file_csr[PATH_MAX]; extern char file_crpt_file_cer[PATH_MAX]; + +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_sslbuffer(StrBuf *buf, int timeout); +void client_write_ssl(const StrBuf *Buf); #endif -extern char floorlist[128][SIZ]; -extern char *axdefs[]; -extern char *ctdlhost, *ctdlport; -extern int http_port; -extern char *server_cookie; extern int is_https; -extern int setup_wizard; -extern char wizard_filename[]; extern int follow_xff; +extern char *server_cookie; +extern char *ctdlhost, *ctdlport; +extern char *axdefs[]; extern int num_threads_existing; extern int num_threads_executing; +extern int setup_wizard; +extern char wizard_filename[]; void InitialiseSemaphores(void); void begin_critical_section(int which_one); void end_critical_section(int which_one); -void stuff_to_cookie(int unset_cookie); + +extern void do_404(void); +void http_redirect(const char *); + + +#ifdef UBER_VERBOSE_DEBUGGING +#define wc_printf(...) wcc_printf(__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) +void wcc_printf(const char *FILE, const char *FUNCTION, long LINE, const char *format, ...); +#else +void wc_printf(const char *format,...)__attribute__((__format__(__printf__,1,2))); +#endif + +void hprintf(const char *format,...)__attribute__((__format__(__printf__,1,2))); + +void CheckAuthBasic(ParsedHttpHdrs *hdr); +void GetAuthBasic(ParsedHttpHdrs *hdr); + +void sleeeeeeeeeep(int); + +size_t wc_strftime(char *s, size_t max, const char *format, const struct tm *tm); +void fmt_time(char *buf, size_t siz, time_t thetime); +void httpdate(char *buf, time_t thetime); +time_t httpdate_to_timestamp(StrBuf *buf); + + + + +void end_webcit_session(void); + + + void cookie_to_stuff(StrBuf *cookie, int *session, @@ -646,51 +694,30 @@ void cookie_to_stuff(StrBuf *cookie, ); void locate_host(StrBuf *TBuf, int); void become_logged_in(const StrBuf *user, const StrBuf *pass, StrBuf *serv_response); -void openid_manual_create(void); + void display_login(void); void display_openids(void); void display_default_landing_page(void); void do_welcome(void); -void do_logout(void); + void display_reg(int during_login); void display_main_menu(void); void display_aide_menu(void); -void slrp_highest(void); -ServInfo *get_serv_info(StrBuf *, StrBuf *); + void RegisterEmbeddableMimeType(const char *MimeType, long MTLen, int Priority); void CreateMimeStr(void); -int GetConnected(void); -void DeleteServInfo(ServInfo **FreeMe); -int uds_connectsock(char *); -int tcp_connectsock(char *, char *); -int serv_getln(char *strbuf, int bufsize); -int StrBuf_ServGetln(StrBuf *buf); -int GetServerStatus(StrBuf *Line, long* FullState); -int serv_puts(const char *string); -void who(void); -void push_destination(void); + + void pop_destination(void); -void robots_txt(void); -extern void do_404(void); -void ajax_mini_calendar(void); void fmout(char *align); void _fmout(StrBuf *Targt, char *align); void FmOut(StrBuf *Target, char *align, StrBuf *Source); -void pullquote_fmout(void); void wDumpContent(int); void PutRequestLocalMem(void *Data, DeleteHashDataFunc DeleteIt); -void UrlescPutStrBuf(const StrBuf *strbuf); -void StrEscPuts(const StrBuf *strbuf); -void StrEscputs1(const StrBuf *strbuf, int nbsp, int nolinebreaks); - -void urlescputs(const char *); -void hurlescputs(const char *); -void jsesc(char *, size_t, char *); -void jsescputs(char *); void output_headers( int do_httpheaders, int do_htmlhead, int do_room_banner, @@ -700,64 +727,19 @@ void output_headers( int do_httpheaders, 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__) -void wcc_printf(const char *FILE, const char *FUNCTION, long LINE, const char *format, ...); -#else -void wc_printf(const char *format,...)__attribute__((__format__(__printf__,1,2))); -#endif - -void hprintf(const char *format,...)__attribute__((__format__(__printf__,1,2))); -void output_static(const char* What); -long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks); -void escputs(const char *strbuf); void url(char *buf, size_t bufsize); void UrlizeText(StrBuf* Target, StrBuf *Source, StrBuf *WrkBuf); -void escputs1(const char *strbuf, int nbsp, int nolinebreaks); -void msgesc(char *target, size_t tlen, char *strbuf); -void msgescputs(char *strbuf); -void msgescputs1(char *strbuf); -void dump_vars(void); - -void do_addrbook_view(addrbookent *addrbook, int num_ab); -void fetch_ab_name(message_summary *Msg, char **namebuf); + + void display_vcard(StrBuf *Target, wc_mime_attachment *Mime, char alpha, int full, char **storename, long msgnum); -void jsonMessageList(void); -void new_summary_view(void); -void text_to_server(char *ptr); -void text_to_server_qp(char *ptr); + void display_success(char *); -void CheckAuthBasic(ParsedHttpHdrs *hdr); -void GetAuthBasic(ParsedHttpHdrs *hdr); -void server_to_text(void); -void save_edit(char *description, char *enter_cmd, int regoto); -void display_edit(char *description, char *check_cmd, - char *read_cmd, char *save_cmd, int with_room_banner); -long gotoroom(const StrBuf *gname); -void remove_march(const StrBuf *aaa); -void dotskip(void); -void validate(void); + void shutdown_sessions(void); -void do_housekeeping(void); -void smart_goto(const StrBuf *); -void worker_entry(void); -void session_loop(void); -size_t wc_strftime(char *s, size_t max, const char *format, const struct tm *tm); -void fmt_time(char *buf, size_t siz, time_t thetime); -void httpdate(char *buf, time_t thetime); -time_t httpdate_to_timestamp(StrBuf *buf); -void end_webcit_session(void); -void page_popup(void); -void http_redirect(const char *); -void clear_substs(struct wcsession *wc); -void clear_local_substs(void); -int lingering_close(int fd); -long extract_token(char *dest, const char *source, int parmnum, char separator, int maxlen); -void remove_token(char *source, int parmnum, char separator); StrBuf *load_mimepart(long msgnum, char *partnum); void MimeLoadData(wc_mime_attachment *Mime); void do_edit_vcard(long msgnum, char *partnum, @@ -767,97 +749,46 @@ void do_edit_vcard(long msgnum, char *partnum, const char *force_room); void select_user_to_edit(const char *preselect); -void delete_user(char *); -void do_change_view(int); -void folders(void); - - -void offer_start_page(StrBuf *Target, WCTemplputParams *TP); void convenience_page(const char *titlebarcolor, const char *titlebarmsg, const char *messagetext); void output_html(const char *, int, int, StrBuf *, StrBuf *); -void do_listsub(void); + ssize_t write(int fd, const void *buf, size_t count); void cal_process_attachment(wc_mime_attachment *Mime); -void do_tasks_view(void); -int calendar_summary_view(void); -void free_march_list(wcsession *wcf); -void display_rules_editor_inner_div(void); + void generate_uuid(char *); -void CtdlMakeTempFileName(char *, int); + void address_book_popup(void); void begin_ajax_response(void); void end_ajax_response(void); -void display_edit_task(void); -void display_edit_event(void); -icaltimezone *get_default_icaltimezone(void); -void display_icaltimetype_as_webform(struct icaltimetype *, char *, int); -void icaltime_from_webform(struct icaltimetype *result, char *prefix); -void icaltime_from_webform_dateonly(struct icaltimetype *result, char *prefix); -void partstat_as_string(char *buf, icalproperty *attendee); -icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp); -void check_attendee_availability(icalcomponent *supplied_vevent); -int ical_ctdl_is_overlap( - struct icaltimetype t1start, - struct icaltimetype t1end, - struct icaltimetype t2start, - struct icaltimetype t2end -); - 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); -int read_server_text(StrBuf *Buf, long *nLines); long locate_user_vcard_in_this_room(message_summary **VCMsg, wc_mime_attachment **VCAtt); -void sleeeeeeeeeep(int); void http_transmit_thing(const char *content_type, int is_static); long unescape_input(char *buf); void check_thread_pool_size(void); -void spawn_another_worker_thread(void); void StrEndTab(StrBuf *Target, int tabnum, int num_tabs); void StrBeginTab(StrBuf *Target, int tabnum, int num_tabs, StrBuf **Names); void StrTabbedDialog(StrBuf *Target, int num_tabs, StrBuf *tabnames[]); void tabbed_dialog(int num_tabs, char *tabnames[]); void begin_tab(int tabnum, int num_tabs); void end_tab(int tabnum, int num_tabs); -void str_wiki_index(char *s); -long guess_calhourformat(void); + + int get_time_format_cached (void); -const char *get_selected_language(void); void display_wiki_pagelist(void); HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP); -#define DATEFMT_FULL 0 -#define DATEFMT_BRIEF 1 -#define DATEFMT_RAWDATE 2 -#define DATEFMT_LOCALEDATE 3 -void webcit_fmt_date(char *buf, size_t siz, time_t thetime, int Format); -void summary(void); - /* actual supported locales */ void TmplGettext(StrBuf *Target, WCTemplputParams *TP); -void offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType); + void set_selected_language(const char *); void go_selected_language(void); void stop_selected_language(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_sslbuffer(StrBuf *buf, int timeout); -void client_write_ssl(const StrBuf *Buf); -#endif +const char *get_selected_language(void); void utf8ify_rfc822_string(char **buf); @@ -866,8 +797,6 @@ long end_burst(void); void AppendImportantMessage(const char *pch, long len); -extern char *hourname[]; /* Names of hours (12am, 1am, etc.) */ - void http_datestring(char *buf, size_t n, time_t xtime); diff --git a/webcit/webserver.c b/webcit/webserver.c index e0887b586..cdb8367cd 100644 --- a/webcit/webserver.c +++ b/webcit/webserver.c @@ -37,7 +37,7 @@ extern void graceful_shutdown_watcher(int signum); extern void graceful_shutdown(int signum); extern void start_daemon(char *pid_file); extern void webcit_calc_dirs_n_files(int relh, const char *basedir, int home, char *webcitdir, char *relhome); - +extern void worker_entry(void); extern void drop_root(uid_t UID); char socket_dir[PATH_MAX]; /* where to talk to our citadel server */ -- 2.30.2