Functions | |
void | unescape_input (char *buf) |
remove escaped strings from i.e. the url string (like 20 for blanks) | |
void | addurls (char *url) |
Extract variables from the URL. | |
void | free_urls (void) |
free urlstring memory | |
void | dump_vars (void) |
Diagnostic function to display the contents of all variables. | |
char * | bstr (char *key) |
Return the value of a variable supplied to the current web page (from the url or a form). | |
void | wprintf (const char *format,...) |
web-printing funcion. uses our vsnprintf wrapper | |
void | wDumpContent (int print_standard_html_footer) |
wrap up an HTTP session, closes tags, etc. | |
void | stresc (char *target, char *strbuf, int nbsp, int nolinebreaks) |
Copy a string, escaping characters which have meaning in HTML. | |
void | escputs1 (char *strbuf, int nbsp, int nolinebreaks) |
WHAT??? | |
void | escputs (char *strbuf) |
static wrapper for ecsputs1 | |
void | urlesc (char *outbuf, char *strbuf) |
Escape a string for feeding out as a URL. | |
void | urlescputs (char *strbuf) |
urlescape buffer and print it to the client | |
void | jsesc (char *target, char *strbuf) |
Copy a string, escaping characters for JavaScript strings. | |
void | jsescputs (char *strbuf) |
escape and print java script | |
void | msgesc (char *target, char *strbuf) |
Copy a string, escaping characters for message text hold. | |
void | msgescputs (char *strbuf) |
print a string to the client after cleaning it with msgesc() | |
void | output_headers (int do_httpheaders, int do_htmlhead, int do_room_banner, int unset_cookies, int suppress_check, int cache) |
Output all that important stuff that the browser will want to see. | |
void | http_redirect (char *whichpage) |
Generic function to do an HTTP redirect. Easy and fun. | |
void | http_transmit_thing (char *thing, size_t length, char *content_type, int is_static) |
Output a piece of content to the web browser. | |
void | output_static (char *what) |
dump out static pages from disk | |
void | output_image () |
When the browser requests an image file from the Citadel server, this function is called to transmit it. | |
void | mimepart (char *msgnum, char *partnum, int force_download) |
Generic function to output an arbitrary MIME part from an arbitrary message number on the server. | |
char * | load_mimepart (long msgnum, char *partnum) |
Read any MIME part of a message, from the server, into memory. | |
void | convenience_page (char *titlebarcolor, char *titlebarmsg, char *messagetext) |
Convenience functions to display a page containing only a string. | |
void | blank_page (void) |
Display a blank page. | |
void | url_do_template (void) |
A template has been requested. | |
void | offer_start_page (void) |
Offer to make any page the user's "start page.". | |
void | change_start_page (void) |
Change the user's start page. | |
void | display_success (char *successmessage) |
convenience function to indicate success | |
void | authorization_required (const char *message) |
Authorization required page This is probably temporary and should be revisited. | |
void | upload_handler (char *name, char *filename, char *partnum, char *disp, void *content, char *cbtype, char *cbcharset, size_t length, char *encoding, void *userdata) |
This function is called by the MIME parser to handle data uploaded by the browser. Form data, uploaded files, and the data from HTTP PUT operations (such as those found in GroupDAV) all arrive this way. | |
void | begin_ajax_response (void) |
Convenience functions to wrap around asynchronous ajax responses. | |
void | end_ajax_response (void) |
print ajax response footer | |
void | ajax_servcmd (void) |
Wraps a Citadel server command in an AJAX transaction. | |
void | seconds_since_last_gexp (void) |
Helper function for the asynchronous check to see if we need to open the instant messenger window. | |
void | session_loop (struct httprequest *req) |
Entry point for WebCit transaction. |
void unescape_input | ( | char * | buf | ) |
remove escaped strings from i.e. the url string (like 20 for blanks)
buf | the buffer to examine |
Definition at line 27 of file webcit.c.
Referenced by addurls(), and do_freebusy().
void addurls | ( | char * | url | ) |
Extract variables from the URL.
url | URL supplied by the HTTP parser |
locate the = sign
now chop that part off
locate "&" and "?" delimiters
Definition at line 55 of file webcit.c.
References urlcontent::next, safestrncpy(), unescape_input(), urlcontent::url_data, and urlcontent::url_key.
Referenced by session_loop().
char* bstr | ( | char * | key | ) |
Return the value of a variable supplied to the current web page (from the url or a form).
key | The name of the variable we want |
Definition at line 141 of file webcit.c.
References urlcontent::next, urlcontent::url_data, and urlcontent::url_key.
Referenced by add_node(), ajax_servcmd(), calendar_month_view_brief_events(), calendar_month_view_display_events(), change_start_page(), change_view(), changepw(), chat_send(), commit_iconbar(), confirm_move_msg(), create_floor(), create_script(), create_user(), delete_floor(), delete_msg(), delete_node(), delete_script(), delete_user(), display_confirm_delete_node(), display_edit_event(), display_edit_individual_event(), display_edit_node(), display_edit_task(), display_editroom(), display_edituser(), display_enter(), display_page(), display_wiki_page(), do_addrbook_view(), do_calendar_view(), do_generic(), do_invt_kick(), do_listsub(), do_login(), edit_me(), edit_node(), edit_vcard(), editroom(), edituser(), embed_room_banner(), entroom(), goto_private(), handle_rsvp(), icaltime_from_webform(), icaltime_from_webform_dateonly(), knrooms(), move_msg(), netedit(), output_image(), output_static(), page_user(), parse_fields_from_rule_editor(), post_message(), post_mime_to_server(), readloop(), rename_floor(), respond_to_request(), save_edit(), save_event(), save_individual_event(), save_individual_task(), save_inetconf(), save_sieve(), save_task(), session_loop(), set_preferences(), set_room_policy(), showuser(), siteconfig(), submit_vcard(), terminate_session(), toggle_self_service(), updatenote(), url_do_template(), validate(), and zap().
void wprintf | ( | const char * | format, | |
... | ||||
) |
web-printing funcion. uses our vsnprintf wrapper
format | printf format string | |
... | the varargs to put into formatstring |
Definition at line 157 of file webcit.c.
References client_write(), and vsnprintf().
Referenced by add_node(), ajax_servcmd(), authorization_required(), begin_ajax_response(), begin_tab(), cal_process_attachment(), cal_process_object(), calendar_brief_month_view(), calendar_day_view(), calendar_day_view_display_events(), calendar_month_view(), calendar_month_view_brief_events(), calendar_month_view_display_events(), calendar_section(), calendar_summary_view(), calendar_week_view(), chat_recv(), chat_send(), commit_iconbar(), confirm_move_msg(), convenience_page(), display_add_node(), display_add_remove_scripts(), display_addressbook(), display_aide_menu(), display_changepw(), display_confirm_delete_node(), display_customize_iconbar(), display_edit(), display_edit_individual_event(), display_edit_individual_task(), display_edit_node(), display_editroom(), display_edituser(), display_enter(), display_entroom(), display_floorconfig(), display_generic(), display_headers(), display_icaltimetype_as_webform(), display_inetconf(), display_login(), display_main_menu(), display_menubar(), display_netconf(), display_note(), display_page(), display_parsed_vcard(), display_preferences(), display_private(), display_queue_msg(), display_rss(), display_rss_control(), display_rules_editor_inner_div(), display_sieve(), display_siteconfig(), display_smtpqueue(), display_smtpqueue_inner_div(), display_summarized(), display_whok(), display_wiki_page(), display_zap(), do_addrbook_view(), do_edit_vcard(), do_folder_view(), do_freebusy(), do_generic(), do_iconbar(), do_iconbar_roomlist(), do_iconbar_view(), do_listsub(), do_logout(), do_rooms_view(), do_tasks_view(), do_template(), dummy_section(), dump_vars(), edit_me(), embed_room_banner(), embed_room_graphic(), embed_search_o_matic(), embed_view_o_matic(), end_ajax_response(), end_burst(), end_tab(), escputs1(), fmout(), goto_private(), handle_rsvp(), http_redirect(), http_transmit_thing(), jsescputs(), knrooms(), list_all_rooms_by_floor(), listrms(), mimepart(), msgescputs(), new_messages_section(), offer_languages(), offer_start_page(), output_date(), output_headers(), output_html(), output_static(), page_popup(), print_message(), print_value_of(), pullquote_fmout(), pullquote_message(), pvo_do_cmd(), read_message(), readinfo(), readloop(), recp_autocomplete(), respond_to_request(), room_tree_list(), seconds_since_last_gexp(), select_user_to_edit(), server_to_text(), session_loop(), showuser(), summary(), summary_inner_div(), tabbed_dialog(), tasks_section(), updatenote(), urlescputs(), userlist(), validate(), wDumpContent(), who(), who_inner_div(), wholist_section(), and zapped_list().
void wDumpContent | ( | int | print_standard_html_footer | ) |
wrap up an HTTP session, closes tags, etc.
print_standard_html_footer | should be set to 0 to transmit only, 1 to append the main menu and closing tags, or 2 to append the closing tags only. |
Definition at line 177 of file webcit.c.
References do_template(), end_burst(), and wprintf().
Referenced by add_node(), authorization_required(), blank_page(), change_start_page(), chat_recv(), chat_send(), commit_iconbar(), confirm_move_msg(), convenience_page(), display_add_node(), display_add_remove_scripts(), display_aide_menu(), display_changepw(), display_confirm_delete_node(), display_customize_iconbar(), display_edit(), display_edit_individual_event(), display_edit_individual_task(), display_edit_node(), display_editroom(), display_edituser(), display_enter(), display_entroom(), display_floorconfig(), display_generic(), display_headers(), display_inetconf(), display_login(), display_main_menu(), display_menubar(), display_netconf(), display_page(), display_preferences(), display_private(), display_rss(), display_sieve(), display_siteconfig(), display_smtpqueue(), display_whok(), display_wiki_page(), display_zap(), do_edit_vcard(), do_generic(), do_listsub(), do_logout(), edit_me(), end_ajax_response(), goto_private(), knrooms(), print_message(), recp_autocomplete(), select_user_to_edit(), session_loop(), showuser(), summary(), userlist(), validate(), who(), and zapped_list().
void stresc | ( | char * | target, | |
char * | strbuf, | |||
int | nbsp, | |||
int | nolinebreaks | |||
) |
Copy a string, escaping characters which have meaning in HTML.
target | target buffer | |
strbuf | source buffer | |
nbsp | If nonzero, spaces are converted to non-breaking spaces. | |
nolinebreaks | if set, linebreaks are removed from the string. |
Definition at line 198 of file webcit.c.
Referenced by display_login(), display_note(), display_parsed_vcard(), display_queue_msg(), do_iconbar_view(), do_listsub(), do_rooms_view(), escputs1(), nametab(), page_user(), and updatenote().
void escputs1 | ( | char * | strbuf, | |
int | nbsp, | |||
int | nolinebreaks | |||
) |
void escputs | ( | char * | strbuf | ) |
static wrapper for ecsputs1
strbuf | buffer to print escaped to client |
Definition at line 252 of file webcit.c.
References escputs1().
Referenced by cal_process_object(), calendar_day_view_display_events(), calendar_month_view_brief_events(), calendar_month_view_display_events(), calendar_summary_view(), confirm_move_msg(), convenience_page(), display_add_remove_scripts(), display_confirm_delete_node(), display_edit_individual_event(), display_edit_individual_task(), display_edit_node(), display_editroom(), display_edituser(), display_enter(), display_entroom(), display_inetconf(), display_netconf(), display_page(), display_parsed_vcard(), display_preferences(), display_queue_msg(), display_rss(), display_rules_editor_inner_div(), display_summarized(), display_whok(), do_addrbook_view(), do_edit_vcard(), do_folder_view(), do_generic(), do_iconbar_view(), do_invt_kick(), do_listsub(), do_rooms_view(), do_tasks_view(), embed_view_o_matic(), fmout(), list_all_rooms_by_floor(), new_messages_section(), print_value_of(), read_message(), readinfo(), recp_autocomplete(), select_user_to_edit(), server_info_section(), session_loop(), showuser(), summary(), userlist(), who(), who_inner_div(), and wholist_section().
void urlesc | ( | char * | outbuf, | |
char * | strbuf | |||
) |
Escape a string for feeding out as a URL.
outbuf | the output buffer | |
strbuf | the input buffer |
Definition at line 262 of file webcit.c.
Referenced by display_parsed_vcard(), and urlescputs().
void urlescputs | ( | char * | strbuf | ) |
urlescape buffer and print it to the client
strbuf | buffer to urlescape |
Definition at line 287 of file webcit.c.
References urlesc(), and wprintf().
Referenced by display_confirm_delete_node(), display_editroom(), display_enter(), display_netconf(), display_rss_control(), do_edit_vcard(), do_folder_view(), do_iconbar_view(), do_rooms_view(), do_tasks_view(), embed_room_graphic(), new_messages_section(), offer_start_page(), read_message(), room_tree_list(), showuser(), userlist(), validate(), who_inner_div(), and wholist_section().
void jsesc | ( | char * | target, | |
char * | strbuf | |||
) |
Copy a string, escaping characters for JavaScript strings.
target | output string | |
strbuf | input string |
Definition at line 301 of file webcit.c.
Referenced by jsescputs().
void jsescputs | ( | char * | strbuf | ) |
escape and print java script
strbuf | the js code |
Definition at line 327 of file webcit.c.
References jsesc(), and wprintf().
Referenced by chat_recv(), and do_iconbar_view().
void msgesc | ( | char * | target, | |
char * | strbuf | |||
) |
Copy a string, escaping characters for message text hold.
target | target buffer | |
strbuf | source buffer |
Definition at line 340 of file webcit.c.
Referenced by msgescputs().
void msgescputs | ( | char * | strbuf | ) |
print a string to the client after cleaning it with msgesc()
strbuf | string to be printed |
Definition at line 362 of file webcit.c.
References msgesc(), and wprintf().
Referenced by display_enter(), pullquote_fmout(), and pullquote_message().
void output_headers | ( | int | do_httpheaders, | |
int | do_htmlhead, | |||
int | do_room_banner, | |||
int | unset_cookies, | |||
int | suppress_check, | |||
int | cache | |||
) |
Output all that important stuff that the browser will want to see.
ICONBAR
check for ImportantMessages (these display in a div overlaying the main screen)
check for instant messages (these display in a new window)
do_httpheaders | 1 = output HTTP headers |
do_htmlhead | 1 = output HTML <head> section and <body> opener |
do_room_banner |
0=no, 1=yes, 2 = I'm going to embed my own, so don't open the either. |
unset_cookies | 1 = session is terminating, so unset the cookies |
suppress_check | 1 = suppress check for instant messages |
cache | 1 = allow browser to cache this page |
Definition at line 378 of file webcit.c.
References begin_burst(), do_selected_iconbar(), do_template(), embed_room_banner(), http_datestring(), page_popup(), safestrncpy(), server_cookie, stuff_to_cookie(), svprintf(), and wprintf().
Referenced by add_node(), begin_ajax_response(), blank_page(), change_start_page(), chat_recv(), chat_send(), commit_iconbar(), confirm_move_msg(), convenience_page(), display_add_node(), display_add_remove_scripts(), display_aide_menu(), display_changepw(), display_confirm_delete_node(), display_customize_iconbar(), display_edit(), display_edit_individual_event(), display_edit_individual_task(), display_edit_node(), display_editroom(), display_edituser(), display_enter(), display_entroom(), display_floorconfig(), display_generic(), display_headers(), display_inetconf(), display_login(), display_main_menu(), display_menubar(), display_netconf(), display_page(), display_preferences(), display_private(), display_sieve(), display_siteconfig(), display_smtpqueue(), display_wiki_page(), display_zap(), do_edit_vcard(), do_freebusy(), do_generic(), do_listsub(), do_logout(), edit_me(), goto_private(), http_transmit_thing(), knrooms(), mimepart(), print_message(), readloop(), recp_autocomplete(), select_user_to_edit(), session_loop(), showuser(), summary(), userlist(), validate(), who(), and zapped_list().
void http_redirect | ( | char * | whichpage | ) |
Generic function to do an HTTP redirect. Easy and fun.
whichpage | target url to 302 to |
Definition at line 480 of file webcit.c.
References wprintf().
Referenced by do_welcome(), edit_me(), post_message(), and readloop().
void http_transmit_thing | ( | char * | thing, | |
size_t | length, | |||
char * | content_type, | |||
int | is_static | |||
) |
Output a piece of content to the web browser.
If we can send the data out compressed, please do so.
No compression ... just send it out as-is
Definition at line 495 of file webcit.c.
References client_write(), compress_gzip(), output_headers(), and wprintf().
Referenced by do_freebusy(), mimepart(), output_image(), and output_static().
void output_static | ( | char * | what | ) |
dump out static pages from disk
what | the file urs to print |
Definition at line 545 of file webcit.c.
References bstr(), end_webcit_session(), http_transmit_thing(), lprintf(), safestrncpy(), and wprintf().
Referenced by output_image(), and session_loop().
void output_image | ( | ) |
When the browser requests an image file from the Citadel server, this function is called to transmit it.
Read it from the server
Write it to the browser
Instead of an ugly 404, send a 1x1 transparent GIF when there's no such image on the server.
Definition at line 612 of file webcit.c.
References bstr(), extract_long(), http_transmit_thing(), output_static(), read_server_binary(), serv_getln(), serv_printf(), and serv_puts().
Referenced by session_loop().
void mimepart | ( | char * | msgnum, | |
char * | partnum, | |||
int | force_download | |||
) |
Generic function to output an arbitrary MIME part from an arbitrary message number on the server.
msgnum | Number of the item on the citadel server | |
partnum | The MIME part to be output | |
force_download | Nonzero to force set the Content-Type: header to "application/octet-stream" |
Definition at line 654 of file webcit.c.
References extract_long(), extract_token(), http_transmit_thing(), output_headers(), read_server_binary(), serv_getln(), serv_printf(), serv_puts(), and wprintf().
Referenced by session_loop().
char* load_mimepart | ( | long | msgnum, | |
char * | partnum | |||
) |
Read any MIME part of a message, from the server, into memory.
msgnum | number of the message on the citadel server | |
partnum | the MIME part to be loaded |
Definition at line 694 of file webcit.c.
References extract_long(), extract_token(), serv_getln(), serv_printf(), and serv_read().
Referenced by display_addressbook(), display_using_handler(), fetch_ab_name(), pullquote_message(), and read_message().
void convenience_page | ( | char * | titlebarcolor, | |
char * | titlebarmsg, | |||
char * | messagetext | |||
) |
Convenience functions to display a page containing only a string.
titlebarcolor | color of the titlebar of the frame | |
titlebarmsg | text to display in the title bar | |
messagetext | body of the box |
Definition at line 726 of file webcit.c.
References escputs(), output_headers(), wDumpContent(), and wprintf().
Referenced by display_success(), display_wiki_page(), and do_edit_vcard().
void display_success | ( | char * | successmessage | ) |
convenience function to indicate success
successmessage | the mesage itself |
Definition at line 805 of file webcit.c.
References convenience_page().
void authorization_required | ( | const char * | message | ) |
Authorization required page This is probably temporary and should be revisited.
message | message to put in header |
Definition at line 816 of file webcit.c.
References wDumpContent(), and wprintf().
Referenced by display_rss(), and session_loop().
void upload_handler | ( | char * | name, | |
char * | filename, | |||
char * | partnum, | |||
char * | disp, | |||
void * | content, | |||
char * | cbtype, | |||
char * | cbcharset, | |||
size_t | length, | |||
char * | encoding, | |||
void * | userdata | |||
) |
This function is called by the MIME parser to handle data uploaded by the browser. Form data, uploaded files, and the data from HTTP PUT operations (such as those found in GroupDAV) all arrive this way.
name | Name of the item being uploaded | |
filename | Filename of the item being uploaded | |
partnum | MIME part identifier (not needed) | |
disp | MIME content disposition (not needed) | |
content | The actual data | |
cbtype | MIME content-type | |
cbcharset | Character set | |
length | Content length | |
encoding | MIME encoding type (not needed) | |
userdata | Not used here |
Uploaded files
Definition at line 845 of file webcit.c.
References lprintf(), urlcontent::next, safestrncpy(), urlcontent::url_data, and urlcontent::url_key.
Referenced by session_loop().
void ajax_servcmd | ( | void | ) |
Wraps a Citadel server command in an AJAX transaction.
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.
Definition at line 909 of file webcit.c.
References begin_ajax_response(), bstr(), end_ajax_response(), serv_getln(), serv_printf(), serv_puts(), serv_read(), serv_write(), text_to_server(), and wprintf().
Referenced by session_loop().
void session_loop | ( | struct httprequest * | req | ) |
Entry point for WebCit transaction.
We stuff these with the values coming from the client cookies, so we can use them to reconnect a timed out session if we have to.
Figure out the action
Only WAP gateways explicitly name this content-type
Read the entire input data at once.
make a note of where we are in case the user wants to save it
If there are variables in the URL, we must grab them now
If it's a "force 404" situation then display the error and bail.
Static content can be sent without connecting to Citadel.
If we're not connected to a Citadel server, try to hook up the connection now.
get the server welcome message
From what host is our user connecting? Go with the host at the other end of the HTTP socket, unless we are following X-Forwarded-For: headers and such a header has already turned up something.
Functions which can be performed without logging in
If we're not logged in, but we have HTTP Authentication data, try logging in to Citadel using that.
Should only display when password is wrong
This needs to run early
The GroupDAV stuff relies on HTTP authentication instead of our session's authentication.
Automatically send requests with any method other than GET or POST to the GroupDAV code as well.
do GroupDAV methods
If not logged in, don't
keep the session active
If we're not logged in, but we have username and password cookies supplied by the browser, try using them to log in.
If we don't have a current room, but a cookie specifying the current room is supplied, make an effort to go there.
All functions handled below this point ... make sure we log in before doing anything else!
Various commands...
When all else fais, display the main menu.
Definition at line 994 of file webcit.c.
References add_node(), addurls(), ajax_servcmd(), authorization_required(), become_logged_in(), begin_ajax_response(), blank_page(), bstr(), calendar_section(), change_start_page(), change_view(), changepw(), chat_recv(), chat_send(), client_read(), commit_iconbar(), confirm_move_msg(), cookie_to_stuff(), create_floor(), create_script(), create_user(), CtdlDecodeBase64(), ctdlhost, ctdlport, delete_floor(), delete_msg(), delete_node(), delete_room(), delete_script(), display_add_node(), display_add_remove_scripts(), display_aide_menu(), display_changepw(), display_confirm_delete_node(), display_customize_iconbar(), display_edit(), display_edit_event(), display_edit_node(), display_edit_task(), display_editroom(), display_edituser(), display_enter(), display_entroom(), display_floorconfig(), display_generic(), display_headers(), display_inetconf(), display_login(), display_main_menu(), display_menubar(), display_netconf(), display_page(), display_preferences(), display_private(), display_reg(), display_rss(), display_sieve(), display_siteconfig(), display_smtpqueue(), display_smtpqueue_inner_div(), display_whok(), display_wiki_page(), display_zap(), do_chat(), do_freebusy(), do_generic(), do_iconbar(), do_iconbar_roomlist(), do_invt_kick(), do_listsub(), do_login(), do_logout(), do_welcome(), dump_vars(), edit_me(), edit_node(), edit_vcard(), editroom(), edituser(), embed_message(), end_ajax_response(), end_webcit_session(), entroom(), escputs(), extract_token(), follow_xff, free_urls(), get_serv_info(), goto_private(), gotonext(), handle_rsvp(), knrooms(), httprequest::line, locate_host(), lprintf(), mime_parser(), mimepart(), move_msg(), ndirs, netedit(), new_messages_section(), httprequest::next, num_tokens(), output_headers(), output_image(), output_static(), page_user(), post_message(), print_message(), readloop(), recp_autocomplete(), remove_token(), rename_floor(), respond_to_request(), safestrncpy(), save_edit(), save_event(), save_inetconf(), save_sieve(), save_task(), seconds_since_last_gexp(), select_user_to_edit(), serv_getln(), serv_printf(), set_floordiv_expanded(), set_preferences(), set_room_policy(), showuser(), siteconfig(), slrp_highest(), smart_goto(), snprintf(), static_content_dirs, static_dirs, striplt(), submit_vcard(), summary(), summary_inner_div(), tasks_section(), tcp_connectsock(), terminate_session(), toggle_self_service(), uds_connectsock(), ungoto(), updatenote(), upload_handler(), url_do_template(), userlist(), validate(), wDumpContent(), who(), who_inner_div(), wholist_section(), wprintf(), zap(), and zapped_list().