Back to index

webcit  8.12-dfsg
Classes | Defines | Typedefs | Enumerations | Functions | Variables
webcit.h File Reference
#include "sysdep.h"
#include <sys/select.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/un.h>
#include <sys/poll.h>
#include <string.h>
#include <pwd.h>
#include <errno.h>
#include <stdarg.h>
#include <pthread.h>
#include <syslog.h>
#include <sys/utsname.h>
#include <expat.h>
#include <libcitadel.h>
#include <zlib.h>
#include <libical/ical.h>
#include "subst.h"
#include "messages.h"
#include "paramhandling.h"
#include "roomops.h"
#include "preferences.h"
#include "tcp_sockets.h"
#include "utils.h"

Go to the source code of this file.

Classes

struct  __ExpirePolicy
struct  urlcontent
struct  _serv_info
struct  _disp_cal
struct  _IcalEnumMap
struct  _addrbookent
struct  _WebcitHandler
struct  _headereval
struct  _HdrRefs
struct  _ParsedHttpHdrs
struct  wcsession
struct  _HttpHeader
struct  blogpost
struct  bltr

Defines

#define _(string)   (string)
#define IsEmptyStr(a)   ((a)[0] == '\0')
#define DO_DBG_QR   0
#define DBG_QR(x)   if(DO_DBG_QR) _DBG_QR(x)
#define DBG_QR2(x)   if(DO_DBG_QR) _DBG_QR2(x)
#define SIZE_T_FMT   "%d"
#define ULONG_FMT   "%d"
#define CALENDAR_ROOM_NAME   "Calendar"
#define PRODID   "-//Citadel//NONSGML Citadel Calendar//EN"
#define SIZ   4096 /* generic buffer size */
#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 */
#define PORT_NUM   2000 /* port number to listen on */
#define DEVELOPER_ID   0
#define CLIENT_ID   4
#define CLIENT_VERSION   812 /* This version of WebCit */
#define MINIMUM_CIT_VERSION   812 /* Minimum required version of Citadel server */
#define LIBCITADEL_MIN   812 /* Minimum required version of libcitadel */
#define DEFAULT_HOST   "localhost" /* Default Citadel server */
#define DEFAULT_PORT   "504"
#define TARGET   "webcit01" /* Window target for inline URL's */
#define HOUSEKEEPING   15 /* Housekeeping frequency */
#define MAX_WORKER_THREADS   250
#define LISTEN_QUEUE_LENGTH   100 /* listen() backlog queue */
#define USERCONFIGROOM   "My Citadel Config"
#define DEFAULT_MAXMSGS   20
#define QR_PERMANENT   1 /* Room does not purge */
#define QR_INUSE   2 /* Set if in use, clear if avail */
#define QR_PRIVATE   4 /* Set for any type of private room */
#define QR_PASSWORDED   8 /* Set if there's a password too */
#define QR_GUESSNAME   16 /* Set if it's a guessname room */
#define QR_DIRECTORY   32 /* Directory room */
#define QR_UPLOAD   64 /* Allowed to upload */
#define QR_DOWNLOAD   128 /* Allowed to download */
#define QR_VISDIR   256 /* Visible directory */
#define QR_ANONONLY   512 /* Anonymous-Only room */
#define QR_ANONOPT   1024 /* Anonymous-Option room */
#define QR_NETWORK   2048 /* Shared network room */
#define QR_PREFONLY   4096 /* Preferred status needed to enter */
#define QR_READONLY   8192 /* Aide status required to post */
#define QR_MAILBOX   16384 /* Set if this is a private mailbox */
#define QR2_SYSTEM   1 /* System room; hide by default */
#define QR2_SELFLIST   2 /* Self-service mailing list mgmt */
#define QR2_COLLABDEL   4 /* Anyone who can post can also delete */
#define QR2_SUBJECTREQ   8 /* Subject strongly recommended */
#define QR2_SMTP_PUBLIC   16 /* smtp public postable room */
#define QR2_MODERATED   32 /* Listservice aide has to permit posts */
#define UA_KNOWN   2
#define UA_GOTOALLOWED   4
#define UA_HASNEWMSGS   8
#define UA_ZAPPED   16
#define UA_POSTALLOWED   32
#define UA_ADMINALLOWED   64
#define UA_DELETEALLOWED   128
#define UA_ISTRASH   256 /* Only available in room view... */
#define US_NEEDVALID   1 /* User needs to be validated */
#define US_PERM   4 /* Permanent user */
#define US_LASTOLD   16 /* Print last old message with new */
#define US_EXPERT   32 /* Experienced user */
#define US_UNLISTED   64 /* Unlisted userlog entry */
#define US_NOPROMPT   128 /* Don't prompt after each message */
#define US_PROMPTCTL   256 /* <N>ext & <S>top work at prompt */
#define US_DISAPPEAR   512 /* Use "disappearing msg prompts" */
#define US_REGIS   1024 /* Registered user */
#define US_PAGINATOR   2048 /* Pause after each screen of text */
#define US_INTERNET   4096 /* Internet mail privileges */
#define US_FLOORS   8192 /* User wants to see floors */
#define US_COLOR   16384 /* User wants ANSI color support */
#define US_USER_SET
#define SRV_STATUS_MSG(ServerLineBuf)   (ChrPtr(ServerLineBuf) + 4), (StrLength(ServerLineBuf) - 4)
#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
#define NLI   "(not logged in)"
#define EXPIRE_NEXTLEVEL   0 /* Inherit expiration policy */
#define EXPIRE_MANUAL   1 /* Don't expire messages at all */
#define EXPIRE_NUMMSGS   2 /* Keep only latest n messages */
#define EXPIRE_AGE   3 /* Expire messages after n days */
#define AJAX   (1<<0)
#define ANONYMOUS   (1<<1)
#define NEED_URL   (1<<2)
#define XHTTP_COMMANDS   (1<<3)
#define BOGUS   (1<<4)
#define URLNAMESPACE   (1<<4)
#define LOGCHATTY   (1<<5)
#define COOKIEUNNEEDED   (1<<6)
#define ISSTATIC   (1<<7)
#define FORCE_SESSIONCLOSE   (1<<8)
#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
#define NO_AUTH   0
#define AUTH_COOKIE   1
#define AUTH_BASIC   2
#define num_parms(source)   num_tokens(source, '|')
#define site_prefix   (WC ? (WC->Hdr->HostHeader) : NULL)
#define WC   ((struct wcsession *)pthread_getspecific(MyConKey))
#define DEFAULT_HTTPAUTH_USER   ""
#define DEFAULT_HTTPAUTH_PASS   ""
#define WC_EXIT_BIND   101 /* Can't bind to the port */
#define WC_EXIT_SSL   102 /* Can't initialize SSL */
#define WC_TIMEFORMAT_NONE   0
#define WC_TIMEFORMAT_AMPM   1
#define WC_TIMEFORMAT_24   2

Typedefs

typedef struct wcsession
typedef struct __ExpirePolicy ExpirePolicy
typedef struct urlcontent
typedef struct _serv_info ServInfo
typedef struct _disp_cal disp_cal
typedef struct _IcalEnumMap IcalEnumMap
typedef struct _addrbookent addrbookent
typedef enum _RESTDispatchID RESTDispatchID
typedef int(* WebcitRESTDispatchID )(RESTDispatchID WhichAction, int IgnoreFloor)
typedef void(* WebcitHandlerFunc )(void)
typedef struct _WebcitHandler WebcitHandler
typedef struct _headereval headereval
typedef struct _HdrRefs HdrRefs
typedef struct _ParsedHttpHdrs ParsedHttpHdrs
typedef void(* Header_Evaluator )(StrBuf *Line, ParsedHttpHdrs *hdr)
typedef struct _HttpHeader OneHttpHeader

Enumerations

enum  _RESTDispatchID { ExistsID, PutID, DeleteID }
enum  { eUp, eDown, eNone }
enum  {
  eGET, ePOST, eOPTIONS, ePROPFIND,
  ePUT, eDELETE, eHEAD, eMOVE,
  eCOPY, eREPORT, eNONE
}
enum  { S_SHUTDOWN, S_SPAWNER, MAX_SEMAPHORES }

Functions

void LoadExpirePolicy (GPEXWhichPolicy which)
void SaveExpirePolicyFromHTTP (GPEXWhichPolicy which)
void webcit_fmt_date (char *buf, size_t siz, time_t thetime, int Format)
void WebcitAddUrlHandler (const char *UrlString, long UrlSLen, const char *DisplayName, long dslen, WebcitHandlerFunc F, long Flags)
void RegisterHeaderHandler (const char *Name, long Len, Header_Evaluator F)
void InitialiseSemaphores (void)
void begin_critical_section (int which_one)
void end_critical_section (int which_one)
void do_404 (void)
void http_redirect (const char *)
void wc_printf (const char *format,...) __attribute__((__format__(__printf__
void void hprintf (const char *format,...) __attribute__((__format__(__printf__
void void 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, StrBuf *user, StrBuf *pass, StrBuf *room, StrBuf *language)
void locate_host (StrBuf *TBuf, int)
void become_logged_in (const StrBuf *user, const StrBuf *pass, StrBuf *serv_response)
void display_login (void)
void display_openids (void)
void display_default_landing_page (void)
void do_welcome (void)
void display_reg (int during_login)
void display_main_menu (void)
void display_aide_menu (void)
void RegisterEmbeddableMimeType (const char *MimeType, long MTLen, int Priority)
void CreateMimeStr (void)
void pop_destination (void)
void FmOut (StrBuf *Target, const char *align, const StrBuf *Source)
void wDumpContent (int)
void PutRequestLocalMem (void *Data, DeleteHashDataFunc DeleteIt)
void output_headers (int do_httpheaders, int do_htmlhead, int do_room_banner, int unset_cookies, int suppress_check, int cache)
void output_custom_content_header (const char *ctype)
void cdataout (char *rawdata)
void url (char *buf, size_t bufsize)
void UrlizeText (StrBuf *Target, StrBuf *Source, StrBuf *WrkBuf)
void display_vcard (StrBuf *Target, wc_mime_attachment *Mime, char alpha, int full, char **storename, long msgnum)
void display_success (const char *successmessage)
void shutdown_sessions (void)
StrBuf * load_mimepart (long msgnum, char *partnum)
void MimeLoadData (wc_mime_attachment *Mime)
void do_edit_vcard (long msgnum, char *partnum, message_summary *VCMsg, wc_mime_attachment *VCAtt, const char *return_to, const char *force_room)
void select_user_to_edit (const char *preselect)
void convenience_page (const char *titlebarcolor, const char *titlebarmsg, const char *messagetext)
void output_html (const char *, int, int, StrBuf *, StrBuf *)
ssize_t write (int fd, const void *buf, size_t count)
void cal_process_attachment (wc_mime_attachment *Mime)
void address_book_popup (void)
void begin_ajax_response (void)
void end_ajax_response (void)
long locate_user_vcard_in_this_room (message_summary **VCMsg, wc_mime_attachment **VCAtt)
void http_transmit_thing (const char *content_type, int is_static)
long unescape_input (char *buf)
void check_thread_pool_size (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)
int get_time_format_cached (void)
void display_wiki_pagelist (void)
void str_wiki_index (char *)
HashList * GetRoomListHashLKRA (StrBuf *Target, WCTemplputParams *TP)
void TmplGettext (StrBuf *Target, WCTemplputParams *TP)
void set_selected_language (const char *)
void go_selected_language (void)
void stop_selected_language (void)
const char * get_selected_language (void)
void utf8ify_rfc822_string (char **buf)
void begin_burst (void)
long end_burst (void)
void AppendImportantMessage (const char *pch, long len)
void http_datestring (char *buf, size_t n, time_t xtime)
 Supplied with a unix timestamp, generate a textual time/date stamp.
struct bltr blogview_learn_thread_references (long msgnum)
void tmplput_blog_permalink (StrBuf *Target, WCTemplputParams *TP)
void display_summary_page (void)

Variables

const char * ReqStrs [eNONE]
pthread_key_t MyConKey
int is_https
int follow_xff
char * server_cookie
char * ctdlhost
char * ctdlport
char * axdefs []
int num_threads_existing
int num_threads_executing
int setup_wizard
char wizard_filename []
char * months []
char * days []
int time_to_die
int DisableGzip

Class Documentation

struct __ExpirePolicy

Definition at line 269 of file webcit.h.

Class Members
int expire_mode
int expire_value
struct urlcontent

Definition at line 280 of file webcit.h.

Class Members
StrBuf * url_data
char url_key
struct _serv_info

Definition at line 288 of file webcit.h.

Class Members
StrBuf * serv_bbs_city
StrBuf * serv_default_cal_zone
StrBuf * serv_fqdn
int serv_fulltext_enabled
StrBuf * serv_humannode
int serv_newuser_disabled
StrBuf * serv_nodename
int serv_pid
int serv_rev_level
StrBuf * serv_software
int serv_supports_guest
int serv_supports_ldap
int serv_supports_openid
int serv_supports_sieve
StrBuf * serv_svn_revision
StrBuf * serv_sysadm
struct _disp_cal

Definition at line 308 of file webcit.h.

Class Members
icalcomponent * cal
long cal_msgnum
time_t event_end
time_t event_start
char * from
int is_repeat
int multi_day_event
icalcomponent * SortBy
icalproperty_status Status
int unread
struct _IcalEnumMap

Definition at line 323 of file webcit.h.

Class Members
icalproperty_kind map
const char * Name
long NameLen
struct _addrbookent

Definition at line 333 of file webcit.h.

Class Members
long ab_msgnum
char ab_name
struct _WebcitHandler

Definition at line 368 of file webcit.h.

Class Members
StrBuf * DisplayName
WebcitHandlerFunc F
long Flags
StrBuf * Name
WebcitRESTDispatchID RID
struct _headereval

Definition at line 379 of file webcit.h.

Collaboration diagram for _headereval:
Class Members
ExamineMsgHeaderFunc evaluator
int Type
struct attach_link

Definition at line 385 of file webcit.h.

Class Members
char html
char partnum
struct _HdrRefs

Definition at line 418 of file webcit.h.

Collaboration diagram for _HdrRefs:
Class Members
StrBuf * browser_host
StrBuf * browser_language
long ContentLength
StrBuf * ContentType
int dav_depth
StrBuf * dav_ifmatch
int desired_session
int DontNeedAuth
long eReqType
int got_auth
int gzip_ok
const WebcitHandler * Handler
time_t if_modified_since
StrBuf * plainauth
int prohibit_caching
StrBuf * RawCookie
StrBuf * ReqLine
int SessionKey
int Static
StrBuf * user_agent
struct _ParsedHttpHdrs

Definition at line 445 of file webcit.h.

Collaboration diagram for _ParsedHttpHdrs:
Class Members
StrBuf * c_language
StrBuf * c_password
StrBuf * c_roomname
StrBuf * c_username
StrBuf * HostHeader
HdrRefs HR
int http_sock
HashList * HTTPHeaders
int nWildfireHeaders
StrBuf * PlainArgs
const char * Pos
StrBuf * ReadBuf
StrBuf * this_page
HashList * urlstrings
struct wcsession

Definition at line 470 of file webcit.h.

Collaboration diagram for wcsession:
Class Members
HashList * attachments
int axlevel
int bptlid
int cache_max_folders
int cache_num_floors
StrBuf * CLineBuf
int connected
StrBuf * ConvertBuf1
StrBuf * ConvertBuf2
StrBuf * cs_inet_email
int ctdl_pid
const Floor * CurrentFloor
folder CurRoom
StrBuf * DefaultCharset
HashList * Directory
HashList * disp_cal_items
int downloaded_prefs
const StrBuf * floordiv_expanded
HashList * Floors
HashList * FloorsByName
HashList * hash_prefs
StrBuf * HBuf
ParsedHttpHdrs * Hdr
StrBuf * httpauth_pass
int ib_roomlist_expanded
int ib_wholist_expanded
long * IBSettingsVec
StrBuf * ImportantMsg
HashList * InetCfg
int inuse
int is_aide
int killthis
HashList * KnownSieveScripts
int last_chat_seq
char last_chat_user
time_t last_pager_check
time_t lastreq
int logged_in
struct march * march
long maxmsgs
StrBuf * MigrateReadLineBuf
int need_regi
int need_vali
wcsession * next
int nonce
long num_displayed
ExpirePolicy Policy
StrBuf * PushedDestination
StrBuf * ReadBuf
const char * ReadPos
int remember_new_mail
HashList * Rooms
int SavePrefsToServer
int selected_language
ServInfo * serv_info
int serv_sock
HashList * ServCfg
pthread_mutex_t SessionMutex
long startmsg Perhaps these should be within a struct instead.
HashList * summ
const folder * ThisRoom
int time_format_cache
StrBuf * trailing_javascript
long uglsn
char ugname
StrBuf * upload
char upload_content_type
StrBuf * upload_filename
int upload_length
StrBuf * WBuf
StrBuf * wc_fullname
StrBuf * wc_password
int wc_session
StrBuf * wc_username
StrBuf * WFBuf
struct _HttpHeader

Definition at line 580 of file webcit.h.

Collaboration diagram for _HttpHeader:
Class Members
Header_Evaluator H
int HaveEvaluator
StrBuf * Val
struct blogpost

Definition at line 802 of file webcit.h.

Class Members
int alloc_msgs
long * msgs
int num_msgs
int top_level_id
struct bltr

Definition at line 813 of file webcit.h.

Class Members
int id
int refs

Define Documentation

#define _ (   string)    (string)

Definition at line 64 of file webcit.h.

#define AJAX   (1<<0)

Definition at line 339 of file webcit.h.

#define ALREADY_EXISTS   74

Definition at line 252 of file webcit.h.

#define ALREADY_LOGGED_IN   41

Definition at line 240 of file webcit.h.

#define ANONYMOUS   (1<<1)

Definition at line 340 of file webcit.h.

#define ASYNC_GEXP   02

Definition at line 232 of file webcit.h.

#define ASYNC_MSG   900

Definition at line 229 of file webcit.h.

#define AUTH_BASIC   2

Definition at line 414 of file webcit.h.

#define AUTH_COOKIE   1

Definition at line 413 of file webcit.h.

#define BINARY_FOLLOWS   600

Definition at line 226 of file webcit.h.

#define BOGUS   (1<<4)

Definition at line 343 of file webcit.h.

#define CALENDAR_ROOM_NAME   "Calendar"

Definition at line 119 of file webcit.h.

#define CIT_OK   200

Definition at line 222 of file webcit.h.

#define CLIENT_ID   4

Definition at line 130 of file webcit.h.

#define CLIENT_VERSION   812 /* This version of WebCit */

Definition at line 131 of file webcit.h.

#define CMD_NOT_SUPPORTED   30

Definition at line 237 of file webcit.h.

#define COOKIEUNNEEDED   (1<<6)

Definition at line 346 of file webcit.h.

#define DATEFMT_BRIEF   1

Definition at line 354 of file webcit.h.

#define DATEFMT_FULL   0

Definition at line 353 of file webcit.h.

#define DATEFMT_LOCALEDATE   3

Definition at line 356 of file webcit.h.

#define DATEFMT_RAWDATE   2

Definition at line 355 of file webcit.h.

#define DBG_QR (   x)    if(DO_DBG_QR) _DBG_QR(x)

Definition at line 70 of file webcit.h.

#define DBG_QR2 (   x)    if(DO_DBG_QR) _DBG_QR2(x)

Definition at line 71 of file webcit.h.

#define DEFAULT_HOST   "localhost" /* Default Citadel server */

Definition at line 134 of file webcit.h.

#define DEFAULT_HTTPAUTH_PASS   ""

Definition at line 782 of file webcit.h.

#define DEFAULT_HTTPAUTH_USER   ""

Definition at line 781 of file webcit.h.

#define DEFAULT_MAXMSGS   20

Definition at line 142 of file webcit.h.

#define DEFAULT_PORT   "504"

Definition at line 135 of file webcit.h.

#define DEVELOPER_ID   0

Definition at line 129 of file webcit.h.

#define DO_DBG_QR   0

Definition at line 69 of file webcit.h.

#define ERROR   500

Definition at line 225 of file webcit.h.

#define EXPIRE_AGE   3 /* Expire messages after n days */

Definition at line 267 of file webcit.h.

#define EXPIRE_MANUAL   1 /* Don't expire messages at all */

Definition at line 265 of file webcit.h.

#define EXPIRE_NEXTLEVEL   0 /* Inherit expiration policy */

Definition at line 264 of file webcit.h.

#define EXPIRE_NUMMSGS   2 /* Keep only latest n messages */

Definition at line 266 of file webcit.h.

#define FILE_NOT_FOUND   71

Definition at line 249 of file webcit.h.

#define FORCE_SESSIONCLOSE   (1<<8)

Definition at line 348 of file webcit.h.

#define HIGHER_ACCESS_REQUIRED   50

Definition at line 242 of file webcit.h.

#define HOUSEKEEPING   15 /* Housekeeping frequency */

Definition at line 137 of file webcit.h.

#define ILLEGAL_VALUE   12

Definition at line 235 of file webcit.h.

#define INTERNAL_ERROR   10

Definition at line 233 of file webcit.h.

#define INVALID_FLOOR_OPERATION   61

Definition at line 247 of file webcit.h.

#define IsEmptyStr (   a)    ((a)[0] == '\0')

Definition at line 67 of file webcit.h.

#define ISSTATIC   (1<<7)

Definition at line 347 of file webcit.h.

#define LIBCITADEL_MIN   812 /* Minimum required version of libcitadel */

Definition at line 133 of file webcit.h.

#define LISTEN_QUEUE_LENGTH   100 /* listen() backlog queue */

Definition at line 139 of file webcit.h.

#define LISTING_FOLLOWS   100

Definition at line 221 of file webcit.h.

#define LOGCHATTY   (1<<5)

Definition at line 345 of file webcit.h.

#define MAJORCODE (   a)    (((int)(a / 100) ) * 100)

Definition at line 219 of file webcit.h.

#define MAX_SESSIONS_EXCEEDED   51

Definition at line 243 of file webcit.h.

#define MAX_WORKER_THREADS   250

Definition at line 138 of file webcit.h.

#define MESSAGE_NOT_FOUND   75

Definition at line 253 of file webcit.h.

#define MINIMUM_CIT_VERSION   812 /* Minimum required version of Citadel server */

Definition at line 132 of file webcit.h.

#define MINORCODE (   a)    (a % 100)

Definition at line 231 of file webcit.h.

#define MORE_DATA   300

Definition at line 223 of file webcit.h.

#define NEED_URL   (1<<2)

Definition at line 341 of file webcit.h.

#define NLI   "(not logged in)"

Definition at line 259 of file webcit.h.

#define NO_AUTH   0

Definition at line 412 of file webcit.h.

#define NO_SUCH_SYSTEM   73

Definition at line 251 of file webcit.h.

#define NO_SUCH_USER   70

Definition at line 248 of file webcit.h.

#define NOT_HERE   60

Definition at line 246 of file webcit.h.

#define NOT_LOGGED_IN   20

Definition at line 236 of file webcit.h.

#define num_parms (   source)    num_tokens(source, '|')

Definition at line 596 of file webcit.h.

#define PARSE_REST_URL   (1<<9)

Definition at line 349 of file webcit.h.

#define PASSWORD_REQUIRED   40

Definition at line 239 of file webcit.h.

#define PORT_NUM   2000 /* port number to listen on */

Definition at line 128 of file webcit.h.

#define PRODID   "-//Citadel//NONSGML Citadel Calendar//EN"

Definition at line 120 of file webcit.h.

#define PROHIBIT_STARTPAGE   (1<<10)

Definition at line 350 of file webcit.h.

#define QR2_COLLABDEL   4 /* Anyone who can post can also delete */

Definition at line 178 of file webcit.h.

#define QR2_MODERATED   32 /* Listservice aide has to permit posts */

Definition at line 181 of file webcit.h.

#define QR2_SELFLIST   2 /* Self-service mailing list mgmt */

Definition at line 177 of file webcit.h.

#define QR2_SMTP_PUBLIC   16 /* smtp public postable room */

Definition at line 180 of file webcit.h.

#define QR2_SUBJECTREQ   8 /* Subject strongly recommended */

Definition at line 179 of file webcit.h.

#define QR2_SYSTEM   1 /* System room; hide by default */

Definition at line 176 of file webcit.h.

#define QR_ANONONLY   512 /* Anonymous-Only room */

Definition at line 166 of file webcit.h.

#define QR_ANONOPT   1024 /* Anonymous-Option room */

Definition at line 167 of file webcit.h.

#define QR_DIRECTORY   32 /* Directory room */

Definition at line 162 of file webcit.h.

#define QR_DOWNLOAD   128 /* Allowed to download */

Definition at line 164 of file webcit.h.

#define QR_GUESSNAME   16 /* Set if it's a guessname room */

Definition at line 161 of file webcit.h.

#define QR_INUSE   2 /* Set if in use, clear if avail */

Definition at line 158 of file webcit.h.

#define QR_MAILBOX   16384 /* Set if this is a private mailbox */

Definition at line 171 of file webcit.h.

#define QR_NETWORK   2048 /* Shared network room */

Definition at line 168 of file webcit.h.

#define QR_PASSWORDED   8 /* Set if there's a password too */

Definition at line 160 of file webcit.h.

#define QR_PERMANENT   1 /* Room does not purge */

Definition at line 157 of file webcit.h.

#define QR_PREFONLY   4096 /* Preferred status needed to enter */

Definition at line 169 of file webcit.h.

#define QR_PRIVATE   4 /* Set for any type of private room */

Definition at line 159 of file webcit.h.

#define QR_READONLY   8192 /* Aide status required to post */

Definition at line 170 of file webcit.h.

#define QR_UPLOAD   64 /* Allowed to upload */

Definition at line 163 of file webcit.h.

#define QR_VISDIR   256 /* Visible directory */

Definition at line 165 of file webcit.h.

#define RESOURCE_BUSY   52

Definition at line 244 of file webcit.h.

#define RESOURCE_NOT_OPEN   53

Definition at line 245 of file webcit.h.

#define ROOM_NOT_FOUND   72

Definition at line 250 of file webcit.h.

#define SEND_BINARY   700

Definition at line 227 of file webcit.h.

#define SEND_LISTING   400

Definition at line 224 of file webcit.h.

#define SERVER_SHUTTING_DOWN   31

Definition at line 238 of file webcit.h.

#define site_prefix   (WC ? (WC->Hdr->HostHeader) : NULL)

Definition at line 599 of file webcit.h.

#define SIZ   4096 /* generic buffer size */

Definition at line 122 of file webcit.h.

#define SIZE_T_FMT   "%d"

Definition at line 108 of file webcit.h.

#define SLEEPING   180 /* TCP connection timeout */

Definition at line 126 of file webcit.h.

#define SRV_STATUS_MSG (   ServerLineBuf)    (ChrPtr(ServerLineBuf) + 4), (StrLength(ServerLineBuf) - 4)

Definition at line 218 of file webcit.h.

#define START_CHAT_MODE   800

Definition at line 228 of file webcit.h.

#define TARGET   "webcit01" /* Window target for inline URL's */

Definition at line 136 of file webcit.h.

#define TOO_BIG   11

Definition at line 234 of file webcit.h.

#define TRACE   syslog(LOG_DEBUG, "\033[3%dmCHECKPOINT: %s:%d\033[0m", ((__LINE__%6)+1), __FILE__, __LINE__)

Definition at line 124 of file webcit.h.

#define UA_ADMINALLOWED   64

Definition at line 191 of file webcit.h.

#define UA_DELETEALLOWED   128

Definition at line 192 of file webcit.h.

#define UA_GOTOALLOWED   4

Definition at line 187 of file webcit.h.

#define UA_HASNEWMSGS   8

Definition at line 188 of file webcit.h.

#define UA_ISTRASH   256 /* Only available in room view... */

Definition at line 193 of file webcit.h.

#define UA_KNOWN   2

Definition at line 186 of file webcit.h.

#define UA_POSTALLOWED   32

Definition at line 190 of file webcit.h.

#define UA_ZAPPED   16

Definition at line 189 of file webcit.h.

#define ULONG_FMT   "%d"

Definition at line 114 of file webcit.h.

#define URLNAMESPACE   (1<<4)

Definition at line 344 of file webcit.h.

#define US_COLOR   16384 /* User wants ANSI color support */

Definition at line 211 of file webcit.h.

#define US_DISAPPEAR   512 /* Use "disappearing msg prompts" */

Definition at line 206 of file webcit.h.

#define US_EXPERT   32 /* Experienced user */

Definition at line 202 of file webcit.h.

#define US_FLOORS   8192 /* User wants to see floors */

Definition at line 210 of file webcit.h.

#define US_INTERNET   4096 /* Internet mail privileges */

Definition at line 209 of file webcit.h.

#define US_LASTOLD   16 /* Print last old message with new */

Definition at line 201 of file webcit.h.

#define US_NEEDVALID   1 /* User needs to be validated */

Definition at line 199 of file webcit.h.

#define US_NOPROMPT   128 /* Don't prompt after each message */

Definition at line 204 of file webcit.h.

#define US_PAGINATOR   2048 /* Pause after each screen of text */

Definition at line 208 of file webcit.h.

#define US_PERM   4 /* Permanent user */

Definition at line 200 of file webcit.h.

#define US_PROMPTCTL   256 /* <N>ext & <S>top work at prompt */

Definition at line 205 of file webcit.h.

#define US_REGIS   1024 /* Registered user */

Definition at line 207 of file webcit.h.

#define US_UNLISTED   64 /* Unlisted userlog entry */

Definition at line 203 of file webcit.h.

#define US_USER_SET
Value:
(US_LASTOLD | US_EXPERT | US_UNLISTED | \
                     US_NOPROMPT | US_DISAPPEAR | US_PAGINATOR | \
                     US_FLOORS | US_COLOR | US_PROMPTCTL )

Definition at line 212 of file webcit.h.

#define USERCONFIGROOM   "My Citadel Config"

Definition at line 141 of file webcit.h.

#define USERNAME_REQUIRED   42

Definition at line 241 of file webcit.h.

#define WC   ((struct wcsession *)pthread_getspecific(MyConKey))

Definition at line 602 of file webcit.h.

#define WC_EXIT_BIND   101 /* Can't bind to the port */

Definition at line 788 of file webcit.h.

#define WC_EXIT_SSL   102 /* Can't initialize SSL */

Definition at line 789 of file webcit.h.

#define WC_TIMEFORMAT_24   2

Definition at line 794 of file webcit.h.

#define WC_TIMEFORMAT_AMPM   1

Definition at line 793 of file webcit.h.

#define WC_TIMEFORMAT_NONE   0

Definition at line 792 of file webcit.h.

#define WEBCIT_TIMEOUT   900 /* WebCit session timeout */

Definition at line 127 of file webcit.h.

#define XHTTP_COMMANDS   (1<<3)

Definition at line 342 of file webcit.h.


Typedef Documentation

typedef struct _addrbookent addrbookent
typedef struct _disp_cal disp_cal
typedef struct __ExpirePolicy ExpirePolicy
typedef struct _HdrRefs HdrRefs
typedef void(* Header_Evaluator)(StrBuf *Line, ParsedHttpHdrs *hdr)

Definition at line 578 of file webcit.h.

typedef struct _headereval headereval
typedef struct _IcalEnumMap IcalEnumMap
typedef struct _HttpHeader OneHttpHeader
typedef struct _serv_info ServInfo
typedef struct urlcontent

Definition at line 279 of file webcit.h.

typedef struct wcsession

Definition at line 85 of file webcit.h.

typedef struct _WebcitHandler WebcitHandler
typedef void(* WebcitHandlerFunc)(void)

Definition at line 367 of file webcit.h.

typedef int(* WebcitRESTDispatchID)(RESTDispatchID WhichAction, int IgnoreFloor)

Definition at line 366 of file webcit.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
eUp 
eDown 
eNone 

Definition at line 391 of file webcit.h.

     {
       eUp,
       eDown,
       eNone
};
anonymous enum
Enumerator:
eGET 
ePOST 
eOPTIONS 
ePROPFIND 
ePUT 
eDELETE 
eHEAD 
eMOVE 
eCOPY 
eREPORT 
eNONE 

Definition at line 397 of file webcit.h.

anonymous enum
Enumerator:
S_SHUTDOWN 
S_SPAWNER 
MAX_SEMAPHORES 

Definition at line 589 of file webcit.h.

Enumerator:
ExistsID 
PutID 
DeleteID 

Definition at line 360 of file webcit.h.


Function Documentation

void address_book_popup ( void  )

Definition at line 21 of file addressbook_popup.c.

                              {
       /* Open a new div, hidden initially, for address book popups. */
       wc_printf("</div>\n");      /* End of 'content' div */
       wc_printf("<div id=\"address_book_popup\" style=\"display:none;\">");
       wc_printf("<div id=\"address_book_popup_container_div\">");
       wc_printf("<div id=\"address_book_popup_middle_div\"></div>");
       wc_printf("<div id=\"address_book_inner_div\"></div>");
       wc_printf("</div>");
       /* The 'address_book_popup' div will be closed by wDumpContent() */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AppendImportantMessage ( const char *  pch,
long  len 
)

Definition at line 839 of file webcit.c.

{
       wcsession *WCC = WC;

       if (StrLength(WCC->ImportantMsg) > 0) {
              StrBufAppendBufPlain(WCC->ImportantMsg, HKEY("\n"), 0);
       }
              
       StrBufAppendBufPlain(WCC->ImportantMsg, pch, len, 0);
}
void become_logged_in ( const StrBuf *  user,
const StrBuf *  pass,
StrBuf *  serv_response 
)

Definition at line 81 of file auth.c.

{
       wcsession *WCC = WC;
       StrBuf *Buf;
       StrBuf *FloorDiv;

       WCC->logged_in = 1;

       if (WCC->wc_fullname == NULL)
              WCC->wc_fullname = NewStrBufPlain(NULL, StrLength(serv_response));
       StrBufExtract_token(WCC->wc_fullname, serv_response, 0, '|');
       StrBufCutLeft(WCC->wc_fullname, 4 );
       
       if (WCC->wc_username == NULL)
              WCC->wc_username = NewStrBufDup(user);
       else {
              FlushStrBuf(WCC->wc_username);
              StrBufAppendBuf(WCC->wc_username, user, 0);
       }

       if (WCC->wc_password == NULL)
              WCC->wc_password = NewStrBufDup(pass);
       else {
              FlushStrBuf(WCC->wc_password);
              StrBufAppendBuf(WCC->wc_password, pass, 0);
       }

       WCC->axlevel = StrBufExtract_int(serv_response, 1, '|');
       if (WCC->axlevel >= 6) {
              WCC->is_aide = 1;
       }

       load_preferences();

       Buf = NewStrBuf();
       serv_puts("CHEK");
       StrBuf_ServGetln(Buf);
       if (GetServerStatus(Buf, NULL) == 2) {
              const char *pch;

              pch = ChrPtr(Buf) + 4;
              /*WCC->new_mail  =*/ StrBufExtractNext_long(Buf, &pch, '|');
              WCC->need_regi = StrBufExtractNext_long(Buf, &pch, '|');
              WCC->need_vali = StrBufExtractNext_long(Buf, &pch, '|');
              if (WCC->cs_inet_email == NULL)
                     WCC->cs_inet_email  = NewStrBuf();
              StrBufExtract_NextToken(WCC->cs_inet_email, Buf, &pch, '|');
       }
       get_preference("floordiv_expanded", &FloorDiv);
       WCC->floordiv_expanded = FloorDiv;
       FreeStrBuf(&Buf);
       FlushRoomlist();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void begin_ajax_response ( void  )

Definition at line 339 of file webcit.c.

                               {
       wcsession *WCC = WC;

       FlushStrBuf(WCC->HBuf);
       output_headers(0, 0, 0, 0, 0, 0);

       hprintf("Content-type: text/html; charset=UTF-8\r\n"
              "Server: %s\r\n"
              "Connection: close\r\n"
              ,
              PACKAGE_STRING);
       begin_burst();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void begin_burst ( void  )

Definition at line 727 of file tcp_sockets.c.

{
       if (WC->WBuf == NULL) {
              WC->WBuf = NewStrBufPlain(NULL, 32768);
       }
}
void begin_critical_section ( int  which_one)

Definition at line 121 of file sysdep.c.

{
       pthread_mutex_lock(&Critters[which_one]);
}

Here is the caller graph for this function:

void begin_tab ( int  tabnum,
int  num_tabs 
)

Definition at line 53 of file tabs.c.

                                         {

       if (tabnum == num_tabs) {
              wc_printf("<!-- begin tab-common epilogue -->\n");
              wc_printf("<div class=\"tabcontent_submit\">");
       }

       else {
              wc_printf("<!-- begin tab %d of %d -->\n", tabnum, num_tabs);
              wc_printf("<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
                     tabnum,
                     ( (tabnum == 0) ? "block" : "none" )
              );
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct bltr blogview_learn_thread_references ( long  msgnum) [read]

Definition at line 124 of file blogview_renderer.c.

{
       StrBuf *Buf;
       StrBuf *r;
       int len;
       struct bltr bltr = { 0, 0 } ;
       Buf = NewStrBuf();
       r = NewStrBuf();
       serv_printf("MSG0 %ld|1", msgnum);        /* top level citadel headers only */
       StrBuf_ServGetln(Buf);
       if (GetServerStatus(Buf, NULL) == 1) {
              while (len = StrBuf_ServGetln(Buf), 
                     ((len >= 0) && 
                     ((len != 3) || strcmp(ChrPtr(Buf), "000") )))
              {
                     if (!strncasecmp(ChrPtr(Buf), "msgn=", 5)) {
                            StrBufCutLeft(Buf, 5);
                            bltr.id = ThreadIdHash(Buf);
                     }
                     else if (!strncasecmp(ChrPtr(Buf), "wefw=", 5)) {
                            StrBufCutLeft(Buf, 5);             /* trim the field name */
                            StrBufExtract_token(r, Buf, 0, '|');
                            bltr.refs = ThreadIdHash(r);
                     }
              }
       }
       FreeStrBuf(&Buf);
       FreeStrBuf(&r);
       return(bltr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 288 of file calendar.c.

{
       icalcomponent *cal;

       cal = icalcomponent_new_from_string(ChrPtr(Mime->Data));
       FlushStrBuf(Mime->Data);
       if (cal == NULL) {
              StrBufAppendPrintf(Mime->Data, _("There was an error parsing this calendar item."));
              StrBufAppendPrintf(Mime->Data, "<br>\n");
              return;
       }

       cal_process_object(Mime->Data, cal, 0, Mime->msgnum, ChrPtr(Mime->PartNum));

       /* Free the memory we obtained from libical's constructor */
       icalcomponent_free(cal);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cdataout ( char *  rawdata)

Definition at line 159 of file utils.c.

{
       char *ptr = rawdata;
       wc_printf("<![CDATA[");

       while ((ptr != NULL) && (ptr[0] != 0))
       {
              if (!strncmp(ptr, "]]>", 3)) {
                     wc_printf("]]]]><![CDATA[>");
                     ++ptr; ++ptr; ++ptr;
              }
              else {
                     wc_printf("%c", ptr[0]);
                     ++ptr;
              }
       }

       wc_printf("]]>");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void check_thread_pool_size ( void  )

Definition at line 108 of file context_loop.c.

{
       if (time_to_die) return;           /* don't expand the thread pool during shutdown */

       begin_critical_section(S_SPAWNER); /* only one of these should run at a time */
       if (
              (num_threads_executing >= num_threads_existing)
              && (num_threads_existing < MAX_WORKER_THREADS)
       ) {
              syslog(3, "%d of %d threads are executing.  Adding another worker thread.",
                     num_threads_executing,
                     num_threads_existing
              );
              spawn_another_worker_thread();
       }
       end_critical_section(S_SPAWNER);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void void void CheckAuthBasic ( ParsedHttpHdrs hdr)

Definition at line 843 of file auth.c.

{
/*
  todo: enable this if we can have other sessions than authenticated ones.
       if (hdr->DontNeedAuth)
              return;
*/
       StrBufAppendBufPlain(hdr->HR.plainauth, HKEY(":"), 0);
       StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
}

Here is the caller graph for this function:

void convenience_page ( const char *  titlebarcolor,
const char *  titlebarmsg,
const char *  messagetext 
)

Definition at line 256 of file webcit.c.

{
       hprintf("HTTP/1.1 200 OK\n");
       output_headers(1, 1, 1, 0, 0, 0);
       wc_printf("<div id=\"room_banner_override\">\n");
       wc_printf("<table width=100%% border=0 bgcolor=\"#%s\"><tr><td>", titlebarcolor);
       wc_printf("<span class=\"titlebar\">%s</span>\n", titlebarmsg);
       wc_printf("</td></tr></table>\n");
       wc_printf("</div>\n<div id=\"content\">\n");
       escputs(messagetext);
       wc_printf("<hr />\n");
       wDumpContent(1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cookie_to_stuff ( StrBuf *  cookie,
int *  session,
StrBuf *  user,
StrBuf *  pass,
StrBuf *  room,
StrBuf *  language 
)

Definition at line 65 of file cookie_conversion.c.

{
       if (session != NULL) {
              *session = StrBufExtract_int(cookie, 0, '|');
       }
       if (user != NULL) {
              StrBufExtract_token(user, cookie, 1, '|');
       }
       if (pass != NULL) {
              StrBufExtract_token(pass, cookie, 2, '|');
       }
       if (room != NULL) {
              StrBufExtract_token(room, cookie, 3, '|');
       }
       if (language != NULL) {
              StrBufExtract_token(language, cookie, 4, '|');
       }
}

Here is the caller graph for this function:

void CreateMimeStr ( void  )

Definition at line 660 of file serv_func.c.

{
       HashPos  *it;
       void *vMime;
       long len = 0;
       const char *Key;

       it = GetNewHashPos(EmbeddableMimes, 0);
       while (GetNextHashPos(EmbeddableMimes, it, &len, &Key, &vMime) &&
               (vMime != NULL)) {
              if (StrLength(EmbeddableMimeStrs) > 0)
                     StrBufAppendBufPlain(EmbeddableMimeStrs, HKEY("|"), 0);
              else 
                     StrBufAppendBufPlain(EmbeddableMimeStrs, HKEY("MSGP "), 0);
              StrBufAppendBuf(EmbeddableMimeStrs, (StrBuf*) vMime, 0);
       }
       DeleteHashPos(&it);
}

Here is the caller graph for this function:

void display_aide_menu ( void  )

Definition at line 18 of file mainmenu.c.

{
       begin_burst();
       output_headers(1, 0, 0, 0, 1, 0);
       DoTemplate(HKEY("aide_display_menu"), NULL, &NoCtx);
       end_burst();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 795 of file webcit.c.

                                        {
       wcsession *WCC = WC;

       if (WCC && WCC->serv_info && WCC->serv_info->serv_supports_guest) {
              /* default action */

              if (havebstr("go")) {
                     syslog(9, "Explicit room selection: %s", bstr("go"));
                     StrBuf *teh_room = NewStrBufPlain(bstr("go"), strlen(bstr("go")));
                     smart_goto(teh_room);
                     FreeStrBuf(&teh_room);
              }
              else if (default_landing_page) {
                     http_redirect(default_landing_page);
              }
              else {
                     StrBuf *teh_lobby = NewStrBufPlain(HKEY("_BASEROOM_"));
                     smart_goto(teh_lobby);
                     FreeStrBuf(&teh_lobby);
              }
       }
       else {
              display_login();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void display_login ( void  )

Definition at line 57 of file auth.c.

{
       begin_burst();
       output_headers(1, 0, 0, 0, 1, 0);
       do_template("login");
       end_burst();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void display_main_menu ( void  )

Definition at line 6 of file mainmenu.c.

{
       begin_burst();
       output_headers(1, 0, 0, 0, 1, 0);
       DoTemplate(HKEY("display_main_menu"), NULL, &NoCtx);
       end_burst();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void display_openids ( void  )

Definition at line 19 of file openid.c.

{
       wcsession *WCC = WC;
       char buf[1024];
       int bg = 0;

       output_headers(1, 1, 1, 0, 0, 0);

       do_template("box_begin_1");
       StrBufAppendBufPlain(WCC->WBuf, _("Manage Account/OpenID Associations"), -1, 0);
       do_template("box_begin_2");

       if (WCC->serv_info->serv_supports_openid) {

              wc_printf("<table class=\"altern\">");
       
              serv_puts("OIDL");
              serv_getln(buf, sizeof buf);
              if (buf[0] == '1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
                     bg = 1 - bg;
                     wc_printf("<tr class=\"%s\">", (bg ? "even" : "odd"));
                     wc_printf("<td><img src=\"static/webcit_icons/openid-small.gif\"></td><td>");
                     escputs(buf);
                     wc_printf("</td><td>");
                     wc_printf("<a href=\"openid_detach?id_to_detach=");
                     urlescputs(buf);
                     wc_printf("\" onClick=\"return confirm('%s');\">",
                            _("Do you really want to delete this OpenID?"));
                     wc_printf("%s</a>", _("(delete)"));
                     wc_printf("</td></tr>\n");
              }
       
              wc_printf("</table><br>\n");
       
               wc_printf("<form method=\"POST\" action=\"openid_attach\">\n");
              wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WCC->nonce);
              wc_printf(_("Add an OpenID: "));
               wc_printf("<input type=\"text\" name=\"openid_url\" class=\"openid_urlarea\" size=\"40\">\n");
               wc_printf("<input type=\"submit\" name=\"attach_button\" value=\"%s\">"
                     "</form></center>\n", _("Attach"));
       }

       else {
              wc_printf(_("%s does not permit authentication via OpenID."), ChrPtr(WCC->serv_info->serv_humannode));
       }

       do_template("box_end");
       wDumpContent(2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void display_reg ( int  during_login)

Definition at line 676 of file auth.c.

{
       folder Room;
       StrBuf *Buf;
       message_summary *VCMsg = NULL;
       wc_mime_attachment *VCAtt = NULL;
       long vcard_msgnum;

       Buf = NewStrBuf();
       memset(&Room, 0, sizeof(folder));
       if (goto_config_room(Buf, &Room) != 0) {
              syslog(9, "display_reg() exiting because goto_config_room() failed\n");
              if (during_login) {
                     pop_destination();
              }
              else {
                     display_main_menu();
              }
              FreeStrBuf(&Buf);
              FlushFolder(&Room);         
              return;
       }
       FlushFolder(&Room);

       FreeStrBuf(&Buf);
       vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
       if (vcard_msgnum < 0L) {
              syslog(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
              if (during_login) {
                     pop_destination();
              }
              else {
                     display_main_menu();
              }
              return;
       }

       if (during_login) {
              do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "pop", USERCONFIGROOM);
       }
       else {
              StrBuf *ReturnTo;
              ReturnTo = NewStrBufPlain(HKEY("display_main_menu?go="));
              StrBufAppendBuf(ReturnTo, WC->CurRoom.name, 0);
              do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM);
              FreeStrBuf(&ReturnTo);
       }

}

Here is the call graph for this function:

Here is the caller graph for this function:

void display_success ( const char *  successmessage)

Definition at line 296 of file webcit.c.

{
       convenience_page("007700", "OK", successmessage);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void display_summary_page ( void  )

Definition at line 204 of file summary.c.

{
       output_headers(1, 1, 1, 0, 0, 0); 
       do_template("summary_page");
       wDumpContent(1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void display_vcard ( StrBuf *  Target,
wc_mime_attachment Mime,
char  alpha,
int  full,
char **  storename,
long  msgnum 
)

Definition at line 704 of file vcard_edit.c.

{
       struct vCard *v;
       char *name;
       StrBuf *Buf;
       StrBuf *Buf2;
       char this_alpha = 0;

       v = VCardLoad(Mime->Data);

       if (v == NULL) return;

       name = vcard_get_prop(v, "n", 1, 0, 0);
       if (name != NULL) {
              Buf = NewStrBufPlain(name, -1);
              Buf2 = NewStrBufPlain(NULL, StrLength(Buf));
              StrBuf_RFC822_to_Utf8(Buf2, Buf, WC->DefaultCharset, NULL);
              this_alpha = ChrPtr(Buf)[0];
              FreeStrBuf(&Buf);
              FreeStrBuf(&Buf2);
       }

       if (storename != NULL) {
              fetchname_parsed_vcard(v, storename);
       }
       else if ((alpha == 0) || 
               ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha))) || 
               ((!isalpha(alpha)) && (!isalpha(this_alpha)))
              ) 
       {
#ifdef XXX_XXX
              new_vcard (Target, v, full, Mime);
#else
              display_parsed_vcard(Target, v, full, Mime);
#endif        
       }

       vcard_free(v);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void display_wiki_pagelist ( void  )

Definition at line 271 of file wiki.c.

{
       output_headers(1, 1, 1, 0, 0, 0);
       do_template("wiki_pagelist");
       wDumpContent(1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_404 ( void  )

Definition at line 250 of file context_loop.c.

{
       hprintf("HTTP/1.1 404 Not found\r\n");
       hprintf("Content-Type: text/plain\r\n");
       wc_printf("Not found\r\n");
       end_burst();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_edit_vcard ( long  msgnum,
char *  partnum,
message_summary VCMsg,
wc_mime_attachment VCAtt,
const char *  return_to,
const char *  force_room 
)

TODO: important message

Definition at line 868 of file vcard_edit.c.

                                         {
       message_summary *Msg = NULL;
       wc_mime_attachment *VCMime = NULL;
       struct vCard *v;
       int i;
       char *key, *value;
       char whatuser[256];

       char lastname[256];
       char firstname[256];
       char middlename[256];
       char prefix[256];
       char suffix[256];
       char pobox[256];
       char extadr[256];
       char street[256];
       char city[256];
       char state[256];
       char zipcode[256];
       char country[256];
       char hometel[256];
       char worktel[256];
       char faxtel[256];
       char mobiletel[256];
       char primary_inetemail[256];
       char other_inetemail[SIZ];
       char extrafields[SIZ];
       char fullname[256];
       char title[256];
       char org[256];

       lastname[0] = 0;
       firstname[0] = 0;
       middlename[0] = 0;
       prefix[0] = 0;
       suffix[0] = 0;
       pobox[0] = 0;
       extadr[0] = 0;
       street[0] = 0;
       city[0] = 0;
       state[0] = 0;
       zipcode[0] = 0;
       country[0] = 0;
       hometel[0] = 0;
       worktel[0] = 0;
       faxtel[0] = 0;
       mobiletel[0] = 0;
       primary_inetemail[0] = 0;
       other_inetemail[0] = 0;
       title[0] = 0;
       org[0] = 0;
       extrafields[0] = 0;
       fullname[0] = 0;

       safestrncpy(whatuser, "", sizeof whatuser);

       if ((msgnum >= 0) || 
           ((VCMsg != NULL) && (VCAtt != NULL)))
       {
              if ((VCMsg == NULL) && (VCAtt == NULL)) {

                     Msg = (message_summary *) malloc(sizeof(message_summary));
                     memset(Msg, 0, sizeof(message_summary));
                     Msg->msgnum = msgnum;
                     VCMime = load_vcard(Msg);
                     if (VCMime == NULL) {
                            convenience_page("770000", _("Error"), "");
                            DestroyMessageSummary(Msg);
                            return;
                     }
              
                     v = VCardLoad(VCMime->Data);
              }
              else {
                     v = VCardLoad(VCAtt->Data);
              }
       
              /* Populate the variables for our form */
              i = 0;
              while (key = vcard_get_prop(v, "", 0, i, 1), key != NULL) {
                     char prp[256];       /* property name */
                     char prm[256];       /* parameters */

                     value = vcard_get_prop(v, "", 0, i++, 0);


                     extract_token(prp, key, 0, ';', sizeof prp);
                     safestrncpy(prm, key, sizeof prm);
                     remove_token(prm, 0, ';');

                     if (!strcasecmp(prp, "n")) {
                            extract_token(lastname, value, 0, ';', sizeof lastname);
                            extract_token(firstname, value, 1, ';', sizeof firstname);
                            extract_token(middlename, value, 2, ';', sizeof middlename);
                            extract_token(prefix, value, 3, ';', sizeof prefix);
                            extract_token(suffix, value, 4, ';', sizeof suffix);
                     }

                     else if (!strcasecmp(prp, "fn")) {
                            safestrncpy(fullname, value, sizeof fullname);
                     }

                     else if (!strcasecmp(prp, "title")) {
                            safestrncpy(title, value, sizeof title);
                     }
       
                     else if (!strcasecmp(prp, "org")) {
                            safestrncpy(org, value, sizeof org);
                     }
       
                     else if (!strcasecmp(prp, "adr")) {
                            extract_token(pobox, value, 0, ';', sizeof pobox);
                            extract_token(extadr, value, 1, ';', sizeof extadr);
                            extract_token(street, value, 2, ';', sizeof street);
                            extract_token(city, value, 3, ';', sizeof city);
                            extract_token(state, value, 4, ';', sizeof state);
                            extract_token(zipcode, value, 5, ';', sizeof zipcode);
                            extract_token(country, value, 6, ';', sizeof country);
                     }

                     else if (!strcasecmp(prp, "tel")) {

                            if (bmstrcasestr(prm, "home")) {
                                   extract_token(hometel, value, 0, ';', sizeof hometel);
                            }
                            else if (bmstrcasestr(prm, "work")) {
                                   extract_token(worktel, value, 0, ';', sizeof worktel);
                            }
                            else if (bmstrcasestr(prm, "fax")) {
                                   extract_token(faxtel, value, 0, ';', sizeof faxtel);
                            }
                            else if (bmstrcasestr(prm, "cell")) {
                                   extract_token(mobiletel, value, 0, ';', sizeof mobiletel);
                            }
                            else { /* Missing or unknown type; put it in the home phone */
                                   extract_token(hometel, value, 0, ';', sizeof hometel);
                            }
                     }
       
                     else if ( (!strcasecmp(prp, "email")) && (bmstrcasestr(prm, "internet")) ) {
                            if (primary_inetemail[0] == 0) {
                                   safestrncpy(primary_inetemail, value, sizeof primary_inetemail);
                            }
                            else {
                                   if (other_inetemail[0] != 0) {
                                          strcat(other_inetemail, "\n");
                                   }
                                   strcat(other_inetemail, value);
                            }
                     }

                     /* Unrecognized properties are preserved here so we don't discard them
                      * just because the vCard was edited with WebCit.
                      */
                     else {
                            strcat(extrafields, key);
                            strcat(extrafields, ":");
                            strcat(extrafields, value);
                            strcat(extrafields, "\n");
                     }
       
              }
       
              vcard_free(v);
       }

       /* Display the form */
       output_headers(1, 1, 1, 0, 0, 0);

       do_template("box_begin_1");
       StrBufAppendBufPlain(WC->WBuf, _("Edit contact information"), -1, 0);
       do_template("box_begin_2");

       wc_printf("<form method=\"POST\" action=\"submit_vcard\">\n");
       wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);

       if (force_room != NULL) {
              wc_printf("<input type=\"hidden\" name=\"force_room\" value=\"");
              escputs(force_room);
              wc_printf("\">\n");
       }

       wc_printf("<table class=\"vcard_edit_background\"><tr><td>\n");

       wc_printf("<table border=\"0\"><tr>"
              "<td>%s</td>"
              "<td>%s</td>"
              "<td>%s</td>"
              "<td>%s</td>"
              "<td>%s</td></tr>\n",
              _("Prefix"), _("First Name"), _("Middle Name"), _("Last Name"), _("Suffix")
       );
       wc_printf("<tr><td><input type=\"text\" name=\"prefix\" "
              "value=\"%s\" maxlength=\"5\" size=\"5\"></td>",
              prefix);
       wc_printf("<td><input type=\"text\" name=\"firstname\" "
              "value=\"%s\" maxlength=\"29\"></td>",
              firstname);
       wc_printf("<td><input type=\"text\" name=\"middlename\" "
              "value=\"%s\" maxlength=\"29\"></td>",
              middlename);
       wc_printf("<td><input type=\"text\" name=\"lastname\" "
              "value=\"%s\" maxlength=\"29\"></td>",
              lastname);
       wc_printf("<td><input type=\"text\" name=\"suffix\" "
              "value=\"%s\" maxlength=\"10\" size=\"10\"></td></tr></table>\n",
              suffix);

       wc_printf("<table  class=\"vcard_edit_background_alt\">");
       wc_printf("<tr><td>");

       wc_printf(_("Display name:"));
       wc_printf("<br>"
              "<input type=\"text\" name=\"fullname\" "
              "value=\"%s\" maxlength=\"40\"><br><br>\n",
              fullname
       );

       wc_printf(_("Title:"));
       wc_printf("<br>"
              "<input type=\"text\" name=\"title\" "
              "value=\"%s\" maxlength=\"40\"><br><br>\n",
              title
       );

       wc_printf(_("Organization:"));
       wc_printf("<br>"
              "<input type=\"text\" name=\"org\" "
              "value=\"%s\" maxlength=\"40\"><br><br>\n",
              org
       );

       wc_printf("</td><td>");

       wc_printf("<table border=\"0\">");
       wc_printf("<tr><td>");
       wc_printf(_("PO box:"));
       wc_printf("</td><td>"
              "<input type=\"text\" name=\"pobox\" "
              "value=\"%s\" maxlength=\"29\"></td></tr>\n",
              pobox);
       wc_printf("<tr><td>");
       wc_printf(_("Address:"));
       wc_printf("</td><td>"
              "<input type=\"text\" name=\"extadr\" "
              "value=\"%s\" maxlength=\"29\"></td></tr>\n",
              extadr);
       wc_printf("<tr><td> </td><td>"
              "<input type=\"text\" name=\"street\" "
              "value=\"%s\" maxlength=\"29\"></td></tr>\n",
              street);
       wc_printf("<tr><td>");
       wc_printf(_("City:"));
       wc_printf("</td><td>"
              "<input type=\"text\" name=\"city\" "
              "value=\"%s\" maxlength=\"29\"></td></tr>\n",
              city);
       wc_printf("<tr><td>");
       wc_printf(_("State:"));
       wc_printf("</td><td>"
              "<input type=\"text\" name=\"state\" "
              "value=\"%s\" maxlength=\"29\"></td></tr>\n",
              state);
       wc_printf("<tr><td>");
       wc_printf(_("ZIP code:"));
       wc_printf("</td><td>"
              "<input type=\"text\" name=\"zipcode\" "
              "value=\"%s\" maxlength=\"10\"></td></tr>\n",
              zipcode);
       wc_printf("<tr><td>");
       wc_printf(_("Country:"));
       wc_printf("</td><td>"
              "<input type=\"text\" name=\"country\" "
              "value=\"%s\" maxlength=\"29\" width=\"5\"></td></tr>\n",
              country);
       wc_printf("</table>\n");

       wc_printf("</table>\n");

       wc_printf("<table border=0><tr><td>");
       wc_printf(_("Home telephone:"));
       wc_printf("</td>"
              "<td><input type=\"text\" name=\"hometel\" "
              "value=\"%s\" maxlength=\"29\"></td>\n",
              hometel);
       wc_printf("<td>");
       wc_printf(_("Work telephone:"));
       wc_printf("</td>"
              "<td><input type=\"text\" name=\"worktel\" "
              "value=\"%s\" maxlength=\"29\"></td></tr>\n",
              worktel);
       wc_printf("<tr><td>");
       wc_printf(_("Mobile telephone:"));
       wc_printf("</td>"
              "<td><input type=\"text\" name=\"mobiletel\" "
              "value=\"%s\" maxlength=\"29\"></td>\n",
              mobiletel);
       wc_printf("<td>");
       wc_printf(_("Fax number:"));
       wc_printf("</td>"
              "<td><input type=\"text\" name=\"faxtel\" "
              "value=\"%s\" maxlength=\"29\"></td></tr></table>\n",
              faxtel);

       wc_printf("<table class=\"vcard_edit_background_alt\">");
       wc_printf("<tr><td>");

       wc_printf("<table border=0><TR>"
              "<td valign=top>");
       wc_printf(_("Primary Internet e-mail address"));
       wc_printf("<br>"
              "<input type=\"text\" name=\"primary_inetemail\" "
              "size=40 maxlength=60 value=\"");
       escputs(primary_inetemail);
       wc_printf("\"><br>"
              "</td><td valign=top>");
       wc_printf(_("Internet e-mail aliases"));
       wc_printf("<br>"
              "<textarea name=\"other_inetemail\" rows=5 cols=40 width=40>");
       escputs(other_inetemail);
       wc_printf("</textarea></td></tr></table>\n");

       wc_printf("</td></tr></table>\n");

       wc_printf("<input type=\"hidden\" name=\"extrafields\" value=\"");
       escputs(extrafields);
       wc_printf("\">\n");

       wc_printf("<input type=\"hidden\" name=\"return_to\" value=\"");
       escputs(return_to);
       wc_printf("\">\n");

       wc_printf("<div class=\"buttons\">\n"
              "<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
              "&nbsp;"
              "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">"
              "</div></form>\n",
              _("Save changes"),
              _("Cancel")
       );
       
       wc_printf("</td></tr></table>\n");
       do_template("box_end");
       wDumpContent(1);
       if (Msg != NULL) {
              DestroyMessageSummary(Msg);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_welcome ( void  )

Definition at line 416 of file auth.c.

{
       StrBuf *Buf;
#ifdef XXX_NOT_FINISHED_YET_XXX
       FILE *fp;
       int i;

       if (WC->is_aide) {
              if (!setup_wizard) {
                     int len;
                     sprintf(wizard_filename, "setupwiz.%s.%s",
                            abs(HashLittle(ctdlhost, strlen(ctdlhost))),
                            abs(HashLittle(ctdlport, strlen(ctdlport)))
                     );

                     fp = fopen(wizard_filename, "r");
                     if (fp != NULL) {
                            fgets(buf, sizeof buf, fp);
                            buf[strlen(buf)-1] = 0;
                            fclose(fp);
                            if (atoi(buf) == serv_info.serv_rev_level) {
                                   setup_wizard = 1;    /* already run */
                            }
                     }
              }

              if (!setup_wizard) {
                     http_redirect("setup_wizard");
              }
       }
#endif

       /*
        * Go to the user's preferred start page
        */
       if (!get_preference("startpage", &Buf)) {
              Buf = NewStrBuf ();
              StrBufPrintf(Buf, "dotskip?room=_BASEROOM_");
              set_preference("startpage", Buf, 1);
       }
       if (ChrPtr(Buf)[0] == '/') {
              StrBufCutLeft(Buf, 1);
       }
       if (StrLength(Buf) == 0) {
              StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0);
       }
       syslog(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
       http_redirect(ChrPtr(Buf));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void end_ajax_response ( void  )

Definition at line 357 of file webcit.c.

                             {
       wDumpContent(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

long end_burst ( void  )

Definition at line 738 of file tcp_sockets.c.

{
       wcsession *WCC = WC;
        const char *ptr, *eptr;
        long count;
       ssize_t res = 0;
        fd_set wset;
        int fdflags;

       if (!DisableGzip && (WCC->Hdr->HR.gzip_ok))
       {
              if (CompressBuffer(WCC->WBuf) > 0)
                     hprintf("Content-encoding: gzip\r\n");
              else {
                     syslog(LOG_ALERT, "Compression failed: %d [%s] sending uncompressed\n", errno, strerror(errno));
                     wc_backtrace();
              }
       }

       if (WCC->WFBuf != NULL) {
              WildFireSerializePayload(WCC->WFBuf, WCC->HBuf, &WCC->Hdr->nWildfireHeaders, NULL);
              FreeStrBuf(&WCC->WFBuf);
       }

       if (WCC->Hdr->HR.prohibit_caching)
              hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
       hprintf("Content-length: %d\r\n\r\n", StrLength(WCC->WBuf));

       ptr = ChrPtr(WCC->HBuf);
       count = StrLength(WCC->HBuf);
       eptr = ptr + count;

#ifdef HAVE_OPENSSL
       if (is_https) {
              client_write_ssl(WCC->HBuf);
              client_write_ssl(WCC->WBuf);
              return (count);
       }
#endif

       if (WCC->Hdr->http_sock == -1)
              return -1;
       fdflags = fcntl(WC->Hdr->http_sock, F_GETFL);

       while ((ptr < eptr) && (WCC->Hdr->http_sock != -1)){
                if ((fdflags & O_NONBLOCK) == O_NONBLOCK) {
                        FD_ZERO(&wset);
                        FD_SET(WCC->Hdr->http_sock, &wset);
                        if (select(WCC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) {
                                syslog(2, "client_write: Socket select failed (%s)\n", strerror(errno));
                                return -1;
                        }
                }

                if ((WCC->Hdr->http_sock == -1) || 
                  (res = write(WCC->Hdr->http_sock, 
                             ptr,
                             count)) == -1) {
                        syslog(2, "client_write: Socket write failed (%s)\n", strerror(errno));
                      wc_backtrace();
                        return res;
                }
                count -= res;
              ptr += res;
        }

       ptr = ChrPtr(WCC->WBuf);
       count = StrLength(WCC->WBuf);
       eptr = ptr + count;

        while ((ptr < eptr) && (WCC->Hdr->http_sock != -1)) {
                if ((fdflags & O_NONBLOCK) == O_NONBLOCK) {
                        FD_ZERO(&wset);
                        FD_SET(WCC->Hdr->http_sock, &wset);
                        if (select(WCC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) {
                                syslog(2, "client_write: Socket select failed (%s)\n", strerror(errno));
                                return -1;
                        }
                }

                if ((WCC->Hdr->http_sock == -1) || 
                  (res = write(WCC->Hdr->http_sock, 
                             ptr,
                             count)) == -1) {
                        syslog(2, "client_write: Socket write failed (%s)\n", strerror(errno));
                     wc_backtrace();
                        return res;
                }
                count -= res;
              ptr += res;
        }

       return StrLength(WCC->WBuf);
}

Here is the call graph for this function:

void end_critical_section ( int  which_one)

Definition at line 129 of file sysdep.c.

{
       pthread_mutex_unlock(&Critters[which_one]);
}

Here is the caller graph for this function:

void end_tab ( int  tabnum,
int  num_tabs 
)

Definition at line 75 of file tabs.c.

                                       {

       if (tabnum == num_tabs) {
              wc_printf("</div> <!-- end of 'tabcontent_submit' div -->\n");
              wc_printf("<!-- end tab-common epilogue -->\n");
       }

       else {
              wc_printf("</div>\n");
              wc_printf("<!-- end tab %d of %d -->\n", tabnum, num_tabs);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void end_webcit_session ( void  )

Definition at line 473 of file auth.c.

                              {
       serv_puts("QUIT");
       WC->killthis = 1;
       /* close() of citadel socket will be done by do_housekeeping() */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FmOut ( StrBuf *  Target,
const char *  align,
const StrBuf *  Source 
)

Definition at line 258 of file serv_func.c.

{
       const char *ptr, *pte;
       const char *BufPtr = NULL;
       StrBuf *Line = NewStrBufPlain(NULL, SIZ);
       StrBuf *Line1 = NewStrBufPlain(NULL, SIZ);
       StrBuf *Line2 = NewStrBufPlain(NULL, SIZ);
       int bn = 0;
       int bq = 0;
       int i;
       long len;
       int intext = 0;

       StrBufAppendPrintf(Target, "<div class=\"fmout-%s\">\n", align);

       if (StrLength(Source) > 0) 
              do 
              {
                     StrBufSipLine(Line, Source, &BufPtr);
                     bq = 0;
                     i = 0;
                     ptr = ChrPtr(Line);
                     len = StrLength(Line);
                     pte = ptr + len;

                     if ((intext == 1) && (isspace(*ptr))) {
                            StrBufAppendBufPlain(Target, HKEY("<br>"), 0);
                     }
                     intext = 1;
                     if (isspace(*ptr)) while ((ptr < pte) &&
                                            ((*ptr == '>') ||
                                             isspace(*ptr)))
                                      {
                                             if (*ptr == '>')
                                                    bq++;
                                             ptr ++;
                                             i++;
                                      }

                     /*
                      * Quoted text should be displayed in italics and in a
                      * different colour.  This code understands Citadel-style
                      * " >" quotes and will convert to <BLOCKQUOTE> tags.
                      */
                     if (i > 0) StrBufCutLeft(Line, i);
              

                     for (i = bn; i < bq; i++)                        
                            StrBufAppendBufPlain(Target, HKEY("<blockquote>"), 0);
                     for (i = bq; i < bn; i++)                        
                            StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
                     bn = bq;

                     if (StrLength(Line) == 0)
                            continue;

                     /* Activate embedded URL's */
                     UrlizeText(Line1, Line, Line2);

                     StrEscAppend(Target, Line1, NULL, 0, 0);

                     StrBufAppendBufPlain(Target, HKEY("\n"), 0);
              }
              while ((BufPtr != StrBufNOTNULL) &&
                     (BufPtr != NULL));

       for (i = 0; i < bn; i++) {
              StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
       }
       StrBufAppendBufPlain(Target, HKEY("</div><br>\n"), 0);
       FreeStrBuf(&Line);
       FreeStrBuf(&Line1);
       FreeStrBuf(&Line2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void fmt_time ( char *  buf,
size_t  siz,
time_t  thetime 
)

Definition at line 165 of file fmt_date.c.

{
       struct tm *tm;
       int hour;
       int time_format;
       
       time_format = get_time_format_cached ();
       buf[0] = 0;
       tm = localtime(&thetime);
       hour = tm->tm_hour;
       if (hour == 0)
              hour = 12;
       else if (hour > 12)
              hour = hour - 12;

       if (time_format == WC_TIMEFORMAT_24) {
              snprintf(buf, siz, "%d:%02d",
                     tm->tm_hour, tm->tm_min
              );
       }
       else {
              snprintf(buf, siz, "%d:%02d%s",
                     hour, tm->tm_min, ((tm->tm_hour > 12) ? "pm" : "am")
              );
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* get_selected_language ( void  )

Definition at line 440 of file gettext.c.

                                        {
#ifdef ENABLE_NLS
#ifdef HAVE_USELOCALE
       return AvailLang[WC->selected_language];
#else
       return "en";
#endif
#else
       return "en";
#endif
}
int get_time_format_cached ( void  )

Definition at line 135 of file fmt_date.c.

{
       long calhourformat;
       int *time_format_cache;
       time_format_cache = &(WC->time_format_cache);
       if (*time_format_cache == WC_TIMEFORMAT_NONE)
       {
              get_pref_long("calhourformat", &calhourformat, 99);

              /* If we don't know the user's time format preference yet,
               * make a guess based on the locale.
               */
              if (calhourformat == 99) {
                     calhourformat = guess_calhourformat();
              }

              /* Now set the preference */
              if (calhourformat == 24) 
                     *time_format_cache = WC_TIMEFORMAT_24;
              else
                     *time_format_cache = WC_TIMEFORMAT_AMPM;
       }
       return *time_format_cache;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GetAuthBasic ( ParsedHttpHdrs hdr)

Definition at line 855 of file auth.c.

{
       const char *Pos = NULL;
       if (hdr->c_username == NULL)
              hdr->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
       if (hdr->c_password == NULL)
              hdr->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
       StrBufExtract_NextToken(hdr->c_username, hdr->HR.plainauth, &Pos, ':');
       StrBufExtract_NextToken(hdr->c_password, hdr->HR.plainauth, &Pos, ':');
}

Here is the caller graph for this function:

HashList* GetRoomListHashLKRA ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 153 of file roomlist.c.

{
       wcsession *WCC = WC;

       if (WCC->Floors == NULL)
              GetFloorListHash(Target, TP);
       if (WCC->Rooms == NULL) 
       {
              serv_puts("LKRA");
              WCC->Rooms =  GetRoomListHash(Target, TP);
       }
       return WCC->Rooms;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void go_selected_language ( void  )

Definition at line 417 of file gettext.c.

                                {
}

Here is the caller graph for this function:

void void hprintf ( const char *  format,
  ... 
)
void http_datestring ( char *  buf,
size_t  n,
time_t  xtime 
)

Supplied with a unix timestamp, generate a textual time/date stamp.

Parameters:
bufthe return buffer
nthe size of the buffer
xtimethe time to format as string

Convert "seconds west of GMT" to "hours/minutes offset"

Definition at line 21 of file http_datestring.c.

                                                        {
       struct tm t;

       long offset;
       char offsign;

       localtime_r(&xtime, &t);

#ifdef HAVE_STRUCT_TM_TM_GMTOFF
       offset = t.tm_gmtoff;
#else
       offset = timezone;
#endif
       if (offset > 0) {
              offsign = '+';
       }
       else {
              offset = 0L - offset;
              offsign = '-';
       }
       offset = ( (offset / 3600) * 100 ) + ( offset % 60 );

       snprintf(buf, n, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld",
              httpdate_weekdays[t.tm_wday],
              t.tm_mday,
              httpdate_months[t.tm_mon],
              t.tm_year + 1900,
              t.tm_hour,
              t.tm_min,
              t.tm_sec,
              offsign, offset
       );
}

Here is the caller graph for this function:

void http_redirect ( const char *  )

Definition at line 211 of file webcit.c.

                                          {
       hprintf("HTTP/1.1 302 Moved Temporarily\n");
       hprintf("Location: %s\r\n", whichpage);
       hprintf("URI: %s\r\n", whichpage);
       hprintf("Content-type: text/html; charset=utf-8\r\n");
       stuff_to_cookie(0);
       begin_burst();
       wc_printf("<html><body>");
       wc_printf("Go <a href=\"%s\">here</A>.", whichpage);
       wc_printf("</body></html>\n");
       end_burst();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void http_transmit_thing ( const char *  content_type,
int  is_static 
)

Definition at line 234 of file webcit.c.

{
       syslog(9, "http_transmit_thing(%s)%s", content_type, ((is_static > 0) ? " (static)" : ""));
       output_headers(0, 0, 0, 0, 0, is_static);

       hprintf("Content-type: %s\r\n"
              "Server: %s\r\n"
              "Connection: close\r\n",
              content_type,
              PACKAGE_STRING);

       end_burst();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void httpdate ( char *  buf,
time_t  thetime 
)
time_t httpdate_to_timestamp ( StrBuf *  buf)

Skip day of week, to number

Definition at line 201 of file fmt_date.c.

{
       time_t t = 0;
       struct tm tt;
       const char *c;

       for (c = ChrPtr(buf); *c != ' '; c++)
              ;
       c++;
       
       memset(&tt, 0, sizeof(tt));

       /* Get day of month */
       tt.tm_mday = atoi(c);
       for (; *c != ' ' && *c != '-'; c++);
       c++;

       /* Get month */
       switch (*c) {
       case 'A':     /* April, August */
              tt.tm_mon = (c[1] == 'p') ? 3 : 7;
              break;
       case 'D':     /* December */
              tt.tm_mon = 11;
              break;
       case 'F':     /* February */
              tt.tm_mon = 1;
              break;
       case 'M':     /* March, May */
              tt.tm_mon = (c[2] == 'r') ? 2 : 4;
              break;
       case 'J':     /* January, June, July */
              tt.tm_mon = (c[2] == 'n') ? ((c[1] == 'a') ? 0 : 5) : 6;
              break;
       case 'N':     /* November */
              tt.tm_mon = 10;
              break;
       case 'O':     /* October */
              tt.tm_mon = 9;
              break;
       case 'S':     /* September */
              tt.tm_mon = 8;
              break;
       default:
              return 42;
              break; /* NOTREACHED */
       }
       c += 4;

       tt.tm_year = 0;
       /* Get year */
       tt.tm_year = atoi(c);
       for (; *c != ' '; c++);
       c++;
       if (tt.tm_year >= 1900)
              tt.tm_year -= 1900;

       /* Get hour */
       tt.tm_hour = atoi(c);
       for (; *c != ':'; c++);
       c++;

       /* Get minute */
       tt.tm_min = atoi(c);
       for (; *c != ':'; c++);
       c++;

       /* Get second */
       tt.tm_sec = atoi(c);
       for (; *c && *c != ' '; c++);

       /* Got everything; let's go.  The global 'timezone' variable contains the
        * local timezone's offset from UTC, in seconds, so we apply that to tm_sec.
        * This produces an illegal value for tm_sec, but mktime() will normalize
        * it for us.  This eliminates the need to temporarily switch the environment
        * variable TZ to UTC, which is good because it fails to switch back on
        * some systems.
        */
       tzset();
       tt.tm_sec = tt.tm_sec - (int)timezone;
       t = mktime(&tt);
       return t;
}

Here is the caller graph for this function:

void InitialiseSemaphores ( void  )

Definition at line 99 of file sysdep.c.

{
       int i;

       /* Set up a bunch of semaphores to be used for critical sections */
       for (i=0; i<MAX_SEMAPHORES; ++i) {
              pthread_mutex_init(&Critters[i], NULL);
       }

       if (pipe(ExitPipe))
       {
              syslog(2, "Failed to open exit pipe: %d [%s]\n", 
                     errno, 
                     strerror(errno));
              
              exit(-1);
       }
}

Here is the caller graph for this function:

StrBuf* load_mimepart ( long  msgnum,
char *  partnum 
)

Definition at line 1823 of file messages.c.

{
       off_t bytes;
       StrBuf *Buf;
       
       Buf = NewStrBuf();
       serv_printf("DLAT %ld|%s", msgnum, partnum);
       StrBuf_ServGetln(Buf);
       if (GetServerStatus(Buf, NULL) == 6) {
              StrBufCutLeft(Buf, 4);
              bytes = StrBufExtract_long(Buf, 0, '|');
              FreeStrBuf(&Buf);
              Buf = NewStrBuf();
              StrBuf_ServGetBLOBBuffered(Buf, bytes);
              return(Buf);
       }
       else {
              FreeStrBuf(&Buf);
              return(NULL);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void LoadExpirePolicy ( GPEXWhichPolicy  which)

Definition at line 29 of file siteconfig.c.

{
       StrBuf *Buf;
       wcsession *WCC = WC;
       long State;
       const char *Pos = NULL;

       serv_printf("GPEX %s", ExpirePolicyStrings[which][0].Key);
       Buf = NewStrBuf();
       StrBuf_ServGetln(Buf);
       if (GetServerStatus(Buf, &State) == 2) {
              Pos = ChrPtr(Buf) + 4;
              WCC->Policy[which].expire_mode = StrBufExtractNext_long(Buf, &Pos, '|');
              WCC->Policy[which].expire_value = StrBufExtractNext_long(Buf, &Pos, '|');
       }
       else if (State == 550)
              AppendImportantMessage(_("Higher access is required to access this function."), -1);
       FreeStrBuf(&Buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void locate_host ( StrBuf *  TBuf,
int   
)

Definition at line 21 of file locate_host.c.

{
       struct sockaddr_in6 clientaddr;
       unsigned int addrlen = sizeof(clientaddr);
       char clienthost[NI_MAXHOST] = "";

       getpeername(client_socket, (struct sockaddr *)&clientaddr, &addrlen);
       getnameinfo((struct sockaddr *)&clientaddr, addrlen, clienthost, sizeof(clienthost), NULL, 0, 0);
        StrBufAppendBufPlain(tbuf, clienthost, -1, 0);
       syslog(9, "Client is at %s\n", clienthost);
}

Here is the caller graph for this function:

Definition at line 503 of file useredit.c.

{
       wcsession *WCC = WC;
       HashPos *at;
       HashPos *att;
       const char *HashKey;
       long HKLen;
       void *vMsg;
       message_summary *Msg;
       wc_mime_attachment *Att;
       StrBuf *Buf;
       long vcard_msgnum = (-1L);
       int already_tried_creating_one = 0;
       StrBuf *FoundCharset = NewStrBuf();
       StrBuf *Error = NULL;
       SharedMessageStatus Stat;


       Buf = NewStrBuf();
TRYAGAIN:
       memset(&Stat, 0, sizeof(SharedMessageStatus));
       Stat.maxload = 10000;
       Stat.lowest_found = (-1);
       Stat.highest_found = (-1);
       /* Search for the user's vCard */
       if (load_msg_ptrs("MSGS ALL||||1", NULL, &Stat, NULL) > 0) {
              at = GetNewHashPos(WCC->summ, 0);
              while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
                     Msg = (message_summary*) vMsg;            
                     Msg->MsgBody =  (wc_mime_attachment*) malloc(sizeof(wc_mime_attachment));
                     memset(Msg->MsgBody, 0, sizeof(wc_mime_attachment));
                     Msg->MsgBody->msgnum = Msg->msgnum;

                     load_message(Msg, FoundCharset, &Error);
                     
                     if (Msg->AllAttach != NULL) {
                            att = GetNewHashPos(Msg->AllAttach, 0);
                            while (GetNextHashPos(Msg->AllAttach, att, &HKLen, &HashKey, &vMsg) && 
                                   (vcard_msgnum == -1)) {
                                   Att = (wc_mime_attachment*) vMsg;
                                   if (
                                          (strcasecmp(ChrPtr(Att->ContentType), "text/x-vcard") == 0)
                                          || (strcasecmp(ChrPtr(Att->ContentType), "text/vcard") == 0)
                                   ) {
                                          *VCAtt = Att;
                                          *VCMsg = Msg;
                                          vcard_msgnum = Msg->msgnum;
                                          if (Att->Data == NULL) {
                                                 MimeLoadData(Att);
                                          }
                                   }
                            }
                            DeleteHashPos(&att);
                     }
                     FreeStrBuf(&Error);  /* don't care... */
                     
              }
              DeleteHashPos(&at);         
       }

       /* If there's no vcard, create one */
       if ((*VCMsg == NULL) && (already_tried_creating_one == 0)) {
              FlushStrBuf(Buf);
              already_tried_creating_one = 1;
              serv_puts("ENT0 1|||4");
              StrBuf_ServGetln(Buf);
              if (GetServerStatus(Buf, NULL) == 4) {
                     serv_puts("Content-type: text/x-vcard");
                     serv_puts("");
                     serv_puts("begin:vcard");
                     serv_puts("end:vcard");
                     serv_puts("000");
              }
              else 
                     syslog(1, "Error while creating user vcard: %s\n", ChrPtr(Buf));
              goto TRYAGAIN;
       }
       FreeStrBuf(&Buf);
       FreeStrBuf(&FoundCharset);

       return(vcard_msgnum);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MimeLoadData ( wc_mime_attachment Mime)

Definition at line 1848 of file messages.c.

{
       StrBuf *Buf;
       const char *Ptr;
       off_t bytes;
       /* TODO: is there a chance the content type is different from the one we know? */

       serv_printf("DLAT %ld|%s", Mime->msgnum, ChrPtr(Mime->PartNum));
       Buf = NewStrBuf();
       StrBuf_ServGetln(Buf);
       if (GetServerStatus(Buf, NULL) == 6) {
              Ptr = &(ChrPtr(Buf)[4]);
              bytes = StrBufExtractNext_long(Buf, &Ptr, '|');
              StrBufSkip_NTokenS(Buf, &Ptr, '|', 3);  /* filename, cbtype, mimetype */
              if (Mime->Charset == NULL) Mime->Charset = NewStrBuf();
              StrBufExtract_NextToken(Mime->Charset, Buf, &Ptr, '|');
              
              if (Mime->Data == NULL)
                     Mime->Data = NewStrBufPlain(NULL, bytes);
              StrBuf_ServGetBLOBBuffered(Mime->Data, bytes);
       }
       else {
              FlushStrBuf(Mime->Data);
              /* TODO XImportant message */
       }
       FreeStrBuf(&Buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void output_custom_content_header ( const char *  ctype)

Definition at line 200 of file webcit.c.

                                                     {
       hprintf("HTTP/1.1 200 OK\r\n");
       hprintf("Content-type: %s; charset=utf-8\r\n",ctype);
       hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
       hprintf("Connection: close\r\n");
}

Here is the call graph for this function:

void output_headers ( int  do_httpheaders,
int  do_htmlhead,
int  do_room_banner,
int  unset_cookies,
int  suppress_check,
int  cache 
)

Definition at line 134 of file webcit.c.

  {
       wcsession *WCC = WC;
       char httpnow[128];

       hprintf("HTTP/1.1 200 OK\n");
       http_datestring(httpnow, sizeof httpnow, time(NULL));

       if (do_httpheaders) {
              if (WCC->serv_info != NULL)
                     hprintf("Content-type: text/html; charset=utf-8\r\n"
                            "Server: %s / %s\n"
                            "Connection: close\r\n",
                            PACKAGE_STRING, 
                            ChrPtr(WCC->serv_info->serv_software));
              else
                     hprintf("Content-type: text/html; charset=utf-8\r\n"
                            "Server: %s / [n/a]\n"
                            "Connection: close\r\n",
                            PACKAGE_STRING);
       }

       if (cache > 0) {
              char httpTomorow[128];

              http_datestring(httpTomorow, sizeof httpTomorow, 
                            time(NULL) + 60 * 60 * 24 * 2);

              hprintf("Pragma: public\r\n"
                     "Cache-Control: max-age=3600, must-revalidate\r\n"
                     "Last-modified: %s\r\n"
                     "Expires: %s\r\n",
                     httpnow,
                     httpTomorow
              );
       }
       else {
              hprintf("Pragma: no-cache\r\n"
                     "Cache-Control: no-store\r\n"
                     "Expires: -1\r\n"
              );
       }

       if (cache < 2) stuff_to_cookie(unset_cookies);

       if (do_htmlhead) {
              begin_burst();
              do_template("head");
              if ( (WCC->logged_in) && (!unset_cookies) ) {
                     DoTemplate(HKEY("paging"), NULL, &NoCtx);
              }
              if (do_room_banner) {
                     tmplput_roombanner(NULL, NULL);
              }
       }

       if (do_room_banner) {
              wc_printf("<div id=\"content\">\n");
       }
}

Here is the call graph for this function:

void output_html ( const char *  ,
int  ,
int  ,
StrBuf *  ,
StrBuf *   
)

flush

Do a first pass to isolate the message body

Advance to next tag

Convert foreign character sets to UTF-8 if necessary.

Try to sanitize the html of any rogue scripts

Change mailto: links to WebCit mail, by replacing the link with one that points back to our mail room. Due to the way we parse URL's, it'll even handle mailto: links that have "?subject=" in them.

Make external links open in a separate window

Fixup <img src="cid:... ...> to fetch the mime part

Turn anything that looks like a URL into a real link, as long as it's not inside a tag already

Find the end of the link

  uncomment these two lines to override conversion  
   memcpy(converted_msg, msg, content_length);              
   output_length = content_length;                          

Output our big pile of markup

A little trailing vertical whitespace...

Now give back the memory

Definition at line 91 of file html2html.c.

                                                                                                              {
       char buf[SIZ];
       char *msg;
       char *ptr;
       char *msgstart;
       char *msgend;
       StrBuf *converted_msg;
       int buffer_length = 1;
       int line_length = 0;
       int content_length = 0;
       char new_window[SIZ];
       int brak = 0;
       int alevel = 0;
       int scriptlevel = 0;
       int script_start_pos = (-1);
       int i;
       int linklen;
       char charset[128];
       StrBuf *BodyArea = NULL;
#ifdef HAVE_ICONV
       iconv_t ic = (iconv_t)(-1) ;
       char *ibuf;                   /* Buffer of characters to be converted */
       char *obuf;                   /* Buffer for converted characters      */
       size_t ibuflen;               /* Length of input buffer               */
       size_t obuflen;               /* Length of output buffer              */
       char *osav;                   /* Saved pointer to output buffer       */
#endif
       if (Target == NULL)
              Target = WC->WBuf;

       safestrncpy(charset, supplied_charset, sizeof charset);
       msg = strdup("");
       sprintf(new_window, "<a target=\"%s\" href=", TARGET);

       if (Source == NULL) while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
              line_length = strlen(buf);
              buffer_length = content_length + line_length + 2;
              ptr = realloc(msg, buffer_length);
              if (ptr == NULL) {
                     StrBufAppendPrintf(Target, "<b>");
                     StrBufAppendPrintf(Target, _("realloc() error! couldn't get %d bytes: %s"),
                                   buffer_length + 1,
                                   strerror(errno));
                     StrBufAppendPrintf(Target, "</b><br><br>\n");
                     while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
                     }
                     free(msg);
                     return;
              }
              msg = ptr;
              strcpy(&msg[content_length], buf);
              content_length += line_length;
              strcpy(&msg[content_length], "\n");
              content_length += 1;
       }
       else {
              content_length = StrLength(Source);
              free(msg);
              msg = (char*) ChrPtr(Source);/* TODO: remove cast */
              buffer_length = content_length;
       }

       ptr = msg + 1;
       msgstart = msg;
       msgend = &msg[content_length];

       while (ptr < msgend) {

              ptr = strchr(ptr, '<');
              if ((ptr == NULL) || (ptr >= msgend)) break;
              ++ptr;
              if ((ptr == NULL) || (ptr >= msgend)) break;

              /*
               *  Look for META tags.  Some messages (particularly in
               *  Asian locales) illegally declare a message's character
               *  set in the HTML instead of in the MIME headers.  This
               *  is wrong but we have to work around it anyway.
               */
              if (!strncasecmp(ptr, "META", 4)) {

                     char *meta_start;
                     char *meta_end;
                     int meta_length;
                     char *meta;
                     char *meta_http_equiv;
                     char *meta_content;
                     char *spaceptr;

                     meta_start = &ptr[4];
                     meta_end = strchr(ptr, '>');
                     if ((meta_end != NULL) && (meta_end <= msgend)) {
                            meta_length = meta_end - meta_start + 1;
                            meta = malloc(meta_length + 1);
                            safestrncpy(meta, meta_start, meta_length);
                            meta[meta_length] = 0;
                            striplt(meta);
                            if (!strncasecmp(meta, "HTTP-EQUIV=", 11)) {
                                   meta_http_equiv = strdup(&meta[11]);
                                   spaceptr = strchr(meta_http_equiv, ' ');
                                   if (spaceptr != NULL) {
                                          *spaceptr = 0;
                                          meta_content = strdup(++spaceptr);
                                          if (!strncasecmp(meta_content, "content=", 8)) {
                                                 strcpy(meta_content, &meta_content[8]);
                                                 stripquotes(meta_http_equiv);
                                                 stripquotes(meta_content);
                                                 extract_charset_from_meta(charset,
                                                               meta_http_equiv, meta_content);
                                          }
                                          free(meta_content);
                                   }
                                   free(meta_http_equiv);
                            }
                            free(meta);
                     }
              }

              /*
               * Any of these tags cause everything up to and including
               * the tag to be removed.
               */    
              if ( (!strncasecmp(ptr, "HTML", 4))
                            ||(!strncasecmp(ptr, "HEAD", 4))
                            ||(!strncasecmp(ptr, "/HEAD", 5))
                            ||(!strncasecmp(ptr, "BODY", 4)) ) {
                     char *pBody = NULL;

                     if (!strncasecmp(ptr, "BODY", 4)) {
                            pBody = ptr;
                     }
                     ptr = strchr(ptr, '>');
                     if ((ptr == NULL) || (ptr >= msgend)) break;
                     if ((pBody != NULL) && (ptr - pBody > 4)) {
                            char* src;
                            char *cid_start, *cid_end;

                            *ptr = '\0';
                            pBody += 4; 
                            while ((isspace(*pBody)) && (pBody < ptr))
                                   pBody ++;
                            BodyArea = NewStrBufPlain(NULL,  ptr - pBody);

                            if (pBody < ptr) {
                                   src = strstr(pBody, "cid:");
                                   if (src) {
                                          cid_start = src + 4;
                                          cid_end = cid_start;
                                          while ((*cid_end != '"') && 
                                                        !isspace(*cid_end) &&
                                                        (cid_end < ptr))
                                                 cid_end ++;

                                          /* copy tag and attributes up to src="cid: */
                                          StrBufAppendBufPlain(BodyArea, pBody, src - pBody, 0);

                                          /* add in /webcit/mimepart/<msgno>/CID/ 
                                             trailing / stops dumb URL filters getting excited */
                                          StrBufAppendPrintf(BodyArea,
                                                        "/webcit/mimepart/%d/",msgnum);
                                          StrBufAppendBufPlain(BodyArea, cid_start, cid_end - cid_start, 0);

                                          if (ptr - cid_end > 0)
                                                 StrBufAppendBufPlain(BodyArea, 
                                                               cid_end + 1, 
                                                               ptr - cid_end, 0);
                                   }
                                   else 
                                          StrBufAppendBufPlain(BodyArea, pBody, ptr - pBody, 0);
                            }
                            *ptr = '>';
                     }
                     ++ptr;
                     if ((ptr == NULL) || (ptr >= msgend)) break;
                     msgstart = ptr;
              }

              /*
               * Any of these tags cause everything including and following
               * the tag to be removed.
               */
              if ( (!strncasecmp(ptr, "/HTML", 5))
                            ||(!strncasecmp(ptr, "/BODY", 5)) ) {
                     --ptr;
                     msgend = ptr;
                     strcpy(ptr, "");

              }

              ++ptr;
       }
       if (msgstart > msg) {
              strcpy(msg, msgstart);
       }

       /* Now go through the message, parsing tags as necessary. */
       converted_msg = NewStrBufPlain(NULL, content_length + 8192);


#ifdef HAVE_ICONV
       if ( (strcasecmp(charset, "us-ascii"))
                     && (strcasecmp(charset, "UTF-8"))
                     && (strcasecmp(charset, ""))
          ) {
              syslog(9, "Converting %s to UTF-8\n", charset);
              ctdl_iconv_open("UTF-8", charset, &ic);
              if (ic == (iconv_t)(-1) ) {
                     syslog(5, "%s:%d iconv_open() failed: %s\n",
                                   __FILE__, __LINE__, strerror(errno));
              }
       }
       if  (Source == NULL) {
              if (ic != (iconv_t)(-1) ) {
                     ibuf = msg;
                     ibuflen = content_length;
                     obuflen = content_length + (content_length / 2) ;
                     obuf = (char *) malloc(obuflen);
                     osav = obuf;
                     iconv(ic, &ibuf, &ibuflen, &obuf, &obuflen);
                     content_length = content_length + (content_length / 2) - obuflen;
                     osav[content_length] = 0;
                     free(msg);
                     msg = osav;
                     iconv_close(ic);
              }
       }
       else {
              if (ic != (iconv_t)(-1) ) {
                     StrBuf *Buf = NewStrBufPlain(NULL, StrLength(Source) + 8096);;
                     StrBufConvert(Source, Buf, &ic);
                     FreeStrBuf(&Buf);
                     iconv_close(ic);
                     msg = (char*)ChrPtr(Source); /* TODO: get rid of this. */
              }
       }

#endif

       /*
        *     At this point, the message has been stripped down to
        *     only the content inside the <BODY></BODY> tags, and has
        *     been converted to UTF-8 if it was originally in a foreign
        *     character set.  The text is also guaranteed to be null
        *     terminated now.
        */

       if (converted_msg == NULL) {
              StrBufAppendPrintf(Target, "Error %d: %s<br>%s:%d", errno, strerror(errno), __FILE__, __LINE__);
              goto BAIL;
       }

       if (BodyArea != NULL) {
              StrBufAppendBufPlain(converted_msg, HKEY("<table "), 0);  
              StrBufAppendBuf(converted_msg, BodyArea, 0);
              StrBufAppendBufPlain(converted_msg, HKEY(" width=\"100%\"><tr><td>"), 0);
       }
       ptr = msg;
       msgend = strchr(msg, 0);
       while (ptr < msgend) {

              if (!strncasecmp(ptr, "<script", 7)) {
                     if (scriptlevel == 0) {
                            script_start_pos = StrLength(converted_msg);
                     }
                     ++scriptlevel;
              }
              if (!strncasecmp(ptr, "</script", 8)) {
                     --scriptlevel;
              }

              if (!strncasecmp(ptr, "<a href=\"mailto:", 16)) {
                     content_length += 64;
                     StrBufAppendPrintf(converted_msg,
                                   "<a href=\"display_enter?force_room=_MAIL_?recp=");
                     ptr = &ptr[16];
                     ++alevel;
                     ++brak;
              }
              else if (!strncasecmp(ptr, "<a href=\"", 9)) {
                     ++alevel;
                     ++brak;
                     if ( ((strchr(ptr, ':') < strchr(ptr, '/')))
                                   &&  ((strchr(ptr, '/') < strchr(ptr, '>'))) 
                        ) {
                            /* open external links to new window */
                            StrBufAppendPrintf(converted_msg, new_window);
                            ptr = &ptr[8];
                     }
                     else if (
                            (treat_as_wiki)
                            && (strncasecmp(ptr, "<a href=\"wiki?", 14))
                            && (strncasecmp(ptr, "<a href=\"dotgoto?", 17))
                            && (strncasecmp(ptr, "<a href=\"knrooms?", 17))
                     ) {
                            content_length += 64;
                            StrBufAppendPrintf(converted_msg, "<a href=\"wiki?go=");
                            StrBufUrlescAppend(converted_msg, WC->CurRoom.name, NULL);
                            StrBufAppendPrintf(converted_msg, "?page=");
                            ptr = &ptr[9];
                     }
                     else {
                            StrBufAppendPrintf(converted_msg, "<a href=\"");
                            ptr = &ptr[9];
                     }
              }
              else if (!strncasecmp(ptr, "<img ", 5)) {
                     char *cid_start, *cid_end;
                     char* tag_end=strchr(ptr,'>');
                     char* src;
                     /* FIXME - handle this situation (maybe someone opened an <img cid... 
                      * and then ended the message)
                      */
                     if (!tag_end) {
                            syslog(9, "tag_end is null and ptr is:\n");
                            syslog(9, "%s\n", ptr);
                            syslog(9, "Theoretical bytes remaining: %d\n", (int)(msgend - ptr));
                     }

                     src=strstr(ptr, "src=\"cid:");
                     ++brak;

                     if (src
                         && isspace(*(src-1))
                            && tag_end
                            && (cid_start=strchr(src,':'))
                            && (cid_end=strchr(cid_start,'"'))
                            && (cid_end < tag_end)
                     ) {
                            /* copy tag and attributes up to src="cid: */
                            StrBufAppendBufPlain(converted_msg, ptr, src - ptr, 0);
                            cid_start++;

                            /* add in /webcit/mimepart/<msgno>/CID/ 
                               trailing / stops dumb URL filters getting excited */
                            StrBufAppendPrintf(converted_msg,
                                          " src=\"/webcit/mimepart/%d/",msgnum);
                            StrBufAppendBufPlain(converted_msg, cid_start, cid_end - cid_start, 0);
                            StrBufAppendBufPlain(converted_msg, "/\"", -1, 0);

                            ptr = cid_end+1;
                     }
                     StrBufAppendBufPlain(converted_msg, ptr, tag_end - ptr, 0);
                     ptr = tag_end;
              }

              else if ( (brak == 0) && (alevel == 0)
                   && (!strncasecmp(ptr, "http://", 7))) {
                            int strlenptr;
                            linklen = 0;
                            
                            strlenptr = strlen(ptr);
                            for (i=0; i<=strlenptr; ++i) {
                                   if ((ptr[i]==0)
                                      ||(isspace(ptr[i]))
                                      ||(ptr[i]==10)
                                      ||(ptr[i]==13)
                                      ||(ptr[i]=='(')
                                      ||(ptr[i]==')')
                                      ||(ptr[i]=='<')
                                      ||(ptr[i]=='>')
                                      ||(ptr[i]=='[')
                                      ||(ptr[i]==']')
                                      ||(ptr[i]=='"')
                                      ||(ptr[i]=='\'')
                                   ) linklen = i;
                                   /* did s.b. send us an entity? */
                                   if (ptr[i] == '&') {
                                          if ((ptr[i+2] ==';') ||
                                              (ptr[i+3] ==';') ||
                                              (ptr[i+5] ==';') ||
                                              (ptr[i+6] ==';') ||
                                              (ptr[i+7] ==';'))
                                                 linklen = i;
                                   }
                                   if (linklen > 0) break;
                            }
                            if (linklen > 0) {
                                   char *ltreviewptr;
                                   char *nbspreviewptr;
                                   char linkedchar;
                                   int len;
                                   
                                   len = linklen;
                                   linkedchar = ptr[len];
                                   ptr[len] = '\0';
                                   /* spot for some subject strings tinymce tends to give us. */
                                   ltreviewptr = strchr(ptr, '<');
                                   if (ltreviewptr != NULL) {
                                          *ltreviewptr = '\0';
                                          linklen = ltreviewptr - ptr;
                                   }

                                   nbspreviewptr = strstr(ptr, "&nbsp;");
                                   if (nbspreviewptr != NULL) {
                                          /* nbspreviewptr = '\0'; */
                                          linklen = nbspreviewptr - ptr;
                                   }
                                   if (ltreviewptr != 0)
                                          *ltreviewptr = '<';

                                   ptr[len] = linkedchar;

                                   content_length += (32 + linklen);
                                        StrBufAppendPrintf(converted_msg, "%s\"", new_window);
                                   StrBufAppendBufPlain(converted_msg, ptr, linklen, 0);
                                   StrBufAppendPrintf(converted_msg, "\">");
                                   StrBufAppendBufPlain(converted_msg, ptr, linklen, 0);
                                   ptr += linklen;
                                   StrBufAppendPrintf(converted_msg, "</A>");
                            }
              }
              else {
                     StrBufAppendBufPlain(converted_msg, ptr, 1, 0);
                     ptr++;
              }


              if ((ptr >= msg) && (ptr <= msgend)) {
                     /*
                      * We need to know when we're inside a tag,
                      * so we don't turn things that look like URL's into
                      * links, when they're already links - or image sources.
                      */
                     if ((ptr > msg) && (*(ptr-1) == '<')) {
                            ++brak;
                     }
                     if ((ptr > msg) && (*(ptr-1) == '>')) {
                            --brak;
                            if ((scriptlevel == 0) && (script_start_pos >= 0)) {
                                   StrBufCutRight(converted_msg, StrLength(converted_msg) - script_start_pos);
                                   script_start_pos = (-1);
                            }
                     }
                     if (!strncasecmp(ptr, "</A>", 3)) --alevel;
              }
       }

       if (BodyArea != NULL) {
              StrBufAppendBufPlain(converted_msg, HKEY("</td></tr></table>"), 0);  
              FreeStrBuf(&BodyArea);
       }

       StrBufAppendBuf(Target, converted_msg, 0);

BAIL:  
       StrBufAppendPrintf(Target, "<br><br>\n");

       FreeStrBuf(&converted_msg);
       if ((msg != NULL) && (Source == NULL)) free(msg);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pop_destination ( void  )

Definition at line 478 of file webcit.c.

                           {
       wcsession *WCC = WC;

       /*
        * If we are in the middle of a new user signup, the server may request that
        * we first pass through a registration screen.
        */
       if ((WCC) && (WCC->need_regi)) {
              if ((WCC->PushedDestination != NULL) && (StrLength(WCC->PushedDestination) > 0)) {
                     /* Registering will take us to the My Citadel Config room, so save our place */
                     StrBufAppendBufPlain(WCC->PushedDestination, HKEY("?go="), 0);
                     StrBufUrlescAppend(WCC->PushedDestination, WCC->CurRoom.name, NULL);
              }
              WCC->need_regi = 0;
              display_reg(1);
              return;
       }

       /*
        * Do something reasonable if we somehow ended up requesting a pop without
        * having first done a push.
        */
       if ( (!WCC) || (WCC->PushedDestination == NULL) || (StrLength(WCC->PushedDestination) == 0) ) {
              do_welcome();
              return;
       }

       /*
        * All righty then!  We have a destination saved, so go there now.
        */
       syslog(9, "Pop: %s", ChrPtr(WCC->PushedDestination));
       http_redirect(ChrPtr(WCC->PushedDestination));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PutRequestLocalMem ( void *  Data,
DeleteHashDataFunc  DeleteIt 
)

Definition at line 26 of file webcit.c.

{
        wcsession *WCC = WC;
       int n;
       
       n = GetCount(WCC->Hdr->HTTPHeaders);
       Put(WCC->Hdr->HTTPHeaders, IKEY(n), Data, DeleteIt);
}

Here is the caller graph for this function:

void RegisterEmbeddableMimeType ( const char *  MimeType,
long  MTLen,
int  Priority 
)

Definition at line 653 of file serv_func.c.

{
       StrBuf *MT;
       MT = NewStrBufPlain(MimeType, MTLen);
       Put(EmbeddableMimes, IKEY(Priority), MT, HFreeStrBuf);
}

Here is the caller graph for this function:

void RegisterHeaderHandler ( const char *  Name,
long  Len,
Header_Evaluator  F 
)

Definition at line 779 of file context_loop.c.

{
       OneHttpHeader *pHdr;
       pHdr = (OneHttpHeader*) malloc(sizeof(OneHttpHeader));
       memset(pHdr, 0, sizeof(OneHttpHeader));
       pHdr->H = F;
       Put(HttpHeaderHandler, Name, Len, pHdr, DestroyHttpHeaderHandler);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SaveExpirePolicyFromHTTP ( GPEXWhichPolicy  which)

Definition at line 49 of file siteconfig.c.

{
       StrBuf *Buf;
       long State;

       serv_printf("SPEX %s|%d|%d", 
                          ExpirePolicyStrings[which][0].Key,
                  ibcstr( ExpirePolicyStrings[which][1] ),
                  ibcstr( ExpirePolicyStrings[which][1] )  );

       Buf = NewStrBuf();
       StrBuf_ServGetln(Buf);
       GetServerStatus(Buf, &State);
       if (State == 550)
              AppendImportantMessage(_("Higher access is required to access this function."), -1);
       FreeStrBuf(&Buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void select_user_to_edit ( const char *  preselect)

Definition at line 22 of file useredit.c.

{
       output_headers(1, 0, 0, 0, 1, 0);
       do_template("aide_edituser_select");
        end_burst();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void set_selected_language ( const char *  )

Definition at line 413 of file gettext.c.

                                             {
}

Here is the caller graph for this function:

void shutdown_sessions ( void  )

Definition at line 48 of file context_loop.c.

{
       wcsession *sptr;
       
       for (sptr = SessionList; sptr != NULL; sptr = sptr->next) {
              sptr->killthis = 1;
       }
}

Here is the caller graph for this function:

void sleeeeeeeeeep ( int  )

Definition at line 825 of file webcit.c.

{
       struct timeval tv;

       tv.tv_sec = seconds;
       tv.tv_usec = 0;
       select(0, NULL, NULL, NULL, &tv);
}

Here is the caller graph for this function:

void stop_selected_language ( void  )

Definition at line 421 of file gettext.c.

                                  {
}

Here is the caller graph for this function:

void str_wiki_index ( char *  )

Definition at line 21 of file wiki.c.

{
       int i;

       if (s == NULL) return;

       /* First remove all non-alphanumeric characters */
       for (i=0; i<strlen(s); ++i) {
              if (!isalnum(s[i])) {
                     strcpy(&s[i], &s[i+1]);
              }
       }

       /* Then make everything lower case */
       for (i=0; i<strlen(s); ++i) {
              s[i] = tolower(s[i]);
       }
}

Here is the caller graph for this function:

void StrBeginTab ( StrBuf *  Target,
int  tabnum,
int  num_tabs,
StrBuf **  Names 
)

Definition at line 150 of file tabs.c.

                                                                           {

       if (tabnum == num_tabs) {
              StrBufAppendBufPlain(
                     Target, 
                     HKEY("<!-- begin tab-common epilogue ["), 0);
              StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
              StrBufAppendBufPlain(
                     Target, 
                     HKEY("] -->\n<div class=\"tabcontent_submit\">"), 0);
       }

       else {
              StrBufAppendBufPlain(
                     Target, 
                     HKEY("<!-- begin tab "), 0);
              StrBufAppendPrintf(
                     Target,  "%d of %d [",
                     tabnum, num_tabs);
              
              StrEscAppend(Target, Names[tabnum], NULL, 0, 2);

              StrBufAppendPrintf(
                     Target, 
                     "] -->\n<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
                     tabnum,
                     ( (tabnum == 0) ? "block" : "none" )
                     );
       }
}

Here is the caller graph for this function:

void StrEndTab ( StrBuf *  Target,
int  tabnum,
int  num_tabs 
)

Definition at line 187 of file tabs.c.

                                                         {

       if (tabnum == num_tabs) {
              StrBufAppendBufPlain(
                     Target, 
                     HKEY(
                            "</div>\n"
                            "<!-- end tab-common epilogue -->\n"), 0);
       }

       else {
              StrBufAppendPrintf(
                     Target, 
                     "</div>\n",
                     "<!-- end tab %d of %d -->\n", tabnum, num_tabs
              );
       }
       if (HAVEBSTR("last_tabsel"))
       {
              StrBufAppendPrintf(Target, "<script type=\"text/javascript\">tabsel(%s);</script>", BSTR("last_tabsel"));
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void StrTabbedDialog ( StrBuf *  Target,
int  num_tabs,
StrBuf *  tabnames[] 
)

Definition at line 92 of file tabs.c.

                                                                       {
       int i;

       StrBufAppendBufPlain(
              Target, 
              HKEY(
                     "<script type=\"text/javascript\">                                    "
                     "var previously_selected_tab = '0';                                          "
                     "function tabsel(which_tab) {                                                "
                     "      if (which_tab == previously_selected_tab) {                           "
                     "             return;                                                        "
                     "      }                                                              "
                     "      $('tabdiv'+previously_selected_tab).style.display = 'none';           "
                     "      $('tabdiv'+which_tab).style.display = 'block';                        "
                     "      $('tabtd'+previously_selected_tab).className = 'tab_cell_edit';              "
                     "      $('tabtd'+which_tab).className = 'tab_cell_label';                    "
                     "      previously_selected_tab = which_tab;                                  "
                     "}                                                                    "
                     "</script>                                                            \n"
                     ), 0);

       StrBufAppendBufPlain(
              Target, 
              HKEY(
                     "<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
                     "<tr align=\"center\" style=\"cursor:pointer\"><td>&nbsp;</td>"
                     ), 0);

       for (i=0; i<num_tabs; ++i) {
              StrBufAppendPrintf(
                     Target, 
                     "<td id=\"tabtd%d\" class=\"%s\" "
                     "onClick='tabsel(\"%d\");'"
                     ">",
                     i,
                     ( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
                     i
                     );
              StrBufAppendBuf(Target, tabnames[i], 0);
              StrBufAppendBufPlain(
                     Target, 
                     HKEY(
                            "</td>"
                            "<td>&nbsp;</td>\n"), 0);
       }

       StrBufAppendBufPlain(
              Target, 
              HKEY("</tr></table>\n"), 0);
}

Here is the caller graph for this function:

void tabbed_dialog ( int  num_tabs,
char *  tabnames[] 
)

Definition at line 8 of file tabs.c.

                                                   {
       int i;

       StrBufAppendPrintf(WC->trailing_javascript,
              "var previously_selected_tab = '0';                                          \n"
              "function tabsel(which_tab) {                                                \n"
              "      if (which_tab == previously_selected_tab) {                           \n"
              "             return;                                                        \n"
              "      }                                                              \n"
              "      $('tabdiv'+previously_selected_tab).style.display = 'none';           \n"
              "      $('tabdiv'+which_tab).style.display = 'block';                        \n"
              "      $('tabtd'+previously_selected_tab).className = 'tab_cell_edit';              \n"
              "      $('tabtd'+which_tab).className = 'tab_cell_label';                    \n"
              "      previously_selected_tab = which_tab;                                  \n"
              "}                                                                    \n"
       );

       wc_printf("<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
              "<tr align=\"center\" style=\"cursor:pointer\"><td>&nbsp;</td>"
       );

       for (i=0; i<num_tabs; ++i) {
              wc_printf("<td id=\"tabtd%d\" class=\"%s\" "
                     "onClick='tabsel(\"%d\");'"
                     ">",
                     i,
                     ( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
                     i
                     );
              wc_printf("%s", tabnames[i]);
              wc_printf("</td>");

              wc_printf("<td>&nbsp;</td>\n");
       }

       wc_printf("</tr></table>\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TmplGettext ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 430 of file gettext.c.

{
       StrBufAppendBufPlain(Target, _(TP->Tokens->Params[0]->Start), -1, 0);
}

Here is the caller graph for this function:

void tmplput_blog_permalink ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 25 of file blogview_renderer.c.

                                                                  {
       char perma[SIZ];
       
       strcpy(perma, "/readfwd?go=");
       urlesc(&perma[strlen(perma)], sizeof(perma)-strlen(perma), (char *)ChrPtr(WC->CurRoom.name));
       snprintf(&perma[strlen(perma)], sizeof(perma)-strlen(perma), "?p=%d", WC->bptlid);
       if (!Target) {
              wc_printf("%s", perma);
       }
       else {
              StrBufAppendPrintf(Target, "%s", perma);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

long unescape_input ( char *  buf)

Definition at line 14 of file utils.c.

{
       unsigned int a, b;
       char hex[3];
       long buflen;
       long len;

       buflen = strlen(buf);

       while ((buflen > 0) && (isspace(buf[buflen - 1]))){
              buf[buflen - 1] = 0;
              buflen --;
       }

       a = 0; 
       while (a < buflen) {
              if (buf[a] == '+')
                     buf[a] = ' ';
              if (buf[a] == '%') {
                     /* don't let % chars through, rather truncate the input. */
                     if (a + 2 > buflen) {
                            buf[a] = '\0';
                            buflen = a;
                     }
                     else {               
                            hex[0] = buf[a + 1];
                            hex[1] = buf[a + 2];
                            hex[2] = 0;
                            b = 0;
                            b = decode_hex(hex);
                            buf[a] = (char) b;
                            len = buflen - a - 2;
                            if (len > 0)
                                   memmove(&buf[a + 1], &buf[a + 3], len);
                     
                            buflen -=2;
                     }
              }
              a++;
       }
       return a;
}

Here is the caller graph for this function:

void url ( char *  buf,
size_t  bufsize 
)

Definition at line 634 of file html2html.c.

{
       int len, UrlLen, Offset, TrailerLen, outpos;
       char *start, *end, *pos;
       char urlbuf[SIZ];
       char outbuf[SIZ];

       start = NULL;
       len = strlen(buf);
       if (len > bufsize) {
              syslog(1, "URL: content longer than buffer!");
              return;
       }
       end = buf + len;
       for (pos = buf; (pos < end) && (start == NULL); ++pos) {
              if (!strncasecmp(pos, "http://", 7))
                     start = pos;
              if (!strncasecmp(pos, "ftp://", 6))
                     start = pos;
       }

       if (start == NULL)
              return;

       for (pos = buf+len; pos > start; --pos) {
              if (  (!isprint(*pos))
                 || (isspace(*pos))
                 || (*pos == '{')
                 || (*pos == '}')
                 || (*pos == '|')
                 || (*pos == '\\')
                 || (*pos == '^')
                 || (*pos == '[')
                 || (*pos == ']')
                 || (*pos == '`')
                 || (*pos == '<')
                 || (*pos == '>')
                 || (*pos == '(')
                 || (*pos == ')')
              ) {
                     end = pos;
              }
       }
       
       UrlLen = end - start;
       if (UrlLen > sizeof(urlbuf)){
              syslog(1, "URL: content longer than buffer!");
              return;
       }
       memcpy(urlbuf, start, UrlLen);
       urlbuf[UrlLen] = '\0';

       Offset = start - buf;
       if ((Offset != 0) && (Offset < sizeof(outbuf)))
              memcpy(outbuf, buf, Offset);
       outpos = snprintf(&outbuf[Offset], sizeof(outbuf) - Offset,  
                       "%ca href=%c%s%c TARGET=%c%s%c%c%s%c/A%c",
                       LB, QU, urlbuf, QU, QU, TARGET, QU, RB, urlbuf, LB, RB);
       if (outpos >= sizeof(outbuf) - Offset) {
              syslog(1, "URL: content longer than buffer!");
              return;
       }

       TrailerLen = len - (end - start);
       if (TrailerLen > 0)
              memcpy(outbuf + Offset + outpos, end, TrailerLen);
       if (Offset + outpos + TrailerLen > bufsize) {
              syslog(1, "URL: content longer than buffer!");
              return;
       }
       memcpy (buf, outbuf, Offset + outpos + TrailerLen);
       *(buf + Offset + outpos + TrailerLen) = '\0';
}

Here is the caller graph for this function:

void UrlizeText ( StrBuf *  Target,
StrBuf *  Source,
StrBuf *  WrkBuf 
)

Definition at line 575 of file html2html.c.

{
       int len, UrlLen, Offset, TrailerLen;
       const char *start, *end, *pos;
       
       FlushStrBuf(Target);

       start = NULL;
       len = StrLength(Source);
       end = ChrPtr(Source) + len;
       for (pos = ChrPtr(Source); (pos < end) && (start == NULL); ++pos) {
              if (!strncasecmp(pos, "http://", 7))
                     start = pos;
              else if (!strncasecmp(pos, "ftp://", 6))
                     start = pos;
       }

       if (start == NULL) {
              StrBufAppendBuf(Target, Source, 0);
              return;
       }
       FlushStrBuf(WrkBuf);

       for (pos = ChrPtr(Source) + len; pos > start; --pos) {
              if (  (!isprint(*pos))
                 || (isspace(*pos))
                 || (*pos == '{')
                 || (*pos == '}')
                 || (*pos == '|')
                 || (*pos == '\\')
                 || (*pos == '^')
                 || (*pos == '[')
                 || (*pos == ']')
                 || (*pos == '`')
                 || (*pos == '<')
                 || (*pos == '>')
                 || (*pos == '(')
                 || (*pos == ')')
              ) {
                     end = pos;
              }
       }
       
       UrlLen = end - start;
       StrBufAppendBufPlain(WrkBuf, start, UrlLen, 0);

       Offset = start - ChrPtr(Source);
       if (Offset != 0)
              StrBufAppendBufPlain(Target, ChrPtr(Source), Offset, 0);
       StrBufAppendPrintf(Target, "%ca href=%c%s%c TARGET=%c%s%c%c%s%c/A%c",
                        LB, QU, ChrPtr(WrkBuf), QU, QU, TARGET, 
                        QU, RB, ChrPtr(WrkBuf), LB, RB);

       TrailerLen = StrLength(Source) - (end - ChrPtr(Source));
       if (TrailerLen > 0)
              StrBufAppendBufPlain(Target, end, TrailerLen, 0);
}

Here is the caller graph for this function:

void utf8ify_rfc822_string ( char **  buf) [inline]

Definition at line 250 of file decode.c.

{};

Here is the caller graph for this function:

void wc_printf ( const char *  format,
  ... 
)
size_t wc_strftime ( char *  s,
size_t  max,
const char *  format,
const struct tm *  tm 
)

Definition at line 34 of file fmt_date.c.

{

#ifdef ENABLE_NLS
#ifdef HAVE_USELOCALE
       if (wc_locales[WC->selected_language] == NULL) {
              return strftime(s, max, format, tm);
       }
       else {
              return strftime_l(s, max, format, tm, wc_locales[WC->selected_language]);
       }
#else
       return strftime(s, max, format, tm);
#endif
#else
       return strftime(s, max, format, tm);
#endif
}

Here is the caller graph for this function:

void wDumpContent ( int  )

Definition at line 115 of file webcit.c.

{
       if (print_standard_html_footer) {
              wc_printf("</div> <!-- end of 'content' div -->\n");
              do_template("trailing");
       }

       /* If we've been saving it all up for one big output burst,
        * go ahead and do that now.
        */
       end_burst();
}

Here is the call graph for this function:

void webcit_fmt_date ( char *  buf,
size_t  siz,
time_t  thetime,
int  Format 
)

Definition at line 58 of file fmt_date.c.

{
       struct tm tm;
       struct tm today_tm;
       time_t today_timet;
       int time_format;

       time_format = get_time_format_cached ();
       today_timet = time(NULL);
       localtime_r(&today_timet, &today_tm);

       localtime_r(&thetime, &tm);

       /*
        * DATEFMT_FULL:      full display 
        * DATEFMT_BRIEF:     if date == today, show only the time
        *                  otherwise, for messages up to 6 months old, 
        *                 show the month and day, and the time
        *                  older than 6 months, show only the date
        * DATEFMT_RAWDATE:   show full date, regardless of age 
        * DATEFMT_LOCALEDATE:   show full date as prefered for the locale
        */

       switch (Format) {
              case DATEFMT_BRIEF:
                     if ((tm.tm_year == today_tm.tm_year)
                       &&(tm.tm_mon == today_tm.tm_mon)
                       &&(tm.tm_mday == today_tm.tm_mday)) {
                            if (time_format == WC_TIMEFORMAT_24) 
                                   wc_strftime(buf, siz, "%k:%M", &tm);
                            else
                                   wc_strftime(buf, siz, "%l:%M%p", &tm);
                     }
                     else if (today_timet - thetime < 15552000) {
                            if (time_format == WC_TIMEFORMAT_24) 
                                   wc_strftime(buf, siz, "%b %d %k:%M", &tm);
                            else
                                   wc_strftime(buf, siz, "%b %d %l:%M%p", &tm);
                     }
                     else {
                            wc_strftime(buf, siz, "%b %d %Y", &tm);
                     }
                     break;
              case DATEFMT_FULL:
                     if (time_format == WC_TIMEFORMAT_24)
                            wc_strftime(buf, siz, "%a %b %d %Y %T %Z", &tm);
                     else
                            wc_strftime(buf, siz, "%a %b %d %Y %r %Z", &tm);
                     break;
              case DATEFMT_RAWDATE:
                     wc_strftime(buf, siz, "%a %b %d %Y", &tm);
                     break;
              case DATEFMT_LOCALEDATE:
                     wc_strftime(buf, siz, "%x", &tm);
                     break;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void WebcitAddUrlHandler ( const char *  UrlString,
long  UrlSLen,
const char *  DisplayName,
long  dslen,
WebcitHandlerFunc  F,
long  Flags 
)

Definition at line 43 of file webcit.c.

{
       WebcitHandler *NewHandler;  
       NewHandler = (WebcitHandler*) malloc(sizeof(WebcitHandler));
       NewHandler->F = F;
       NewHandler->Flags = Flags;
       NewHandler->Name = NewStrBufPlain(UrlString, UrlSLen);
       StrBufShrinkToFit(NewHandler->Name, 1);
       NewHandler->DisplayName = NewStrBufPlain(DisplayName, dslen);
       StrBufShrinkToFit(NewHandler->DisplayName, 1);
       Put(HandlerHash, UrlString, UrlSLen, NewHandler, DeleteWebcitHandler);
}

Here is the call graph for this function:

Here is the caller graph for this function:

ssize_t write ( int  fd,
const void *  buf,
size_t  count 
)

Here is the caller graph for this function:


Variable Documentation

char* axdefs[]

Definition at line 25 of file auth.c.

char* ctdlhost

Definition at line 45 of file test_main.c.

char * ctdlport

Definition at line 46 of file test_main.c.

char* days[]

Definition at line 31 of file test_main.c.

Definition at line 29 of file test_main.c.

int is_https

Definition at line 28 of file test_main.c.

char* months[]
pthread_key_t MyConKey

Definition at line 27 of file context_loop.c.

Definition at line 34 of file context_loop.c.

Definition at line 33 of file context_loop.c.

const char* ReqStrs[eNONE]

Definition at line 709 of file context_loop.c.

Definition at line 43 of file test_main.c.

Definition at line 45 of file webserver.c.

Definition at line 75 of file sysdep.c.

Definition at line 48 of file test_main.c.