StrBuf *Buf;
StrBuf *Data = NULL;
const char *bptr;
- int Done = 0;
char from[128] = "";
char mime_partnum[256];
char mime_filename[256];
FreeStrBuf (&Buf);
return;
}
- while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
+ while ((StrBuf_ServGetln(Buf)>=0)) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
- Done = 1;
break;
}
bptr = ChrPtr(Buf);
*/
void init_ssl(void)
{
- SSL_METHOD *ssl_method;
+ const SSL_METHOD *ssl_method;
RSA *rsa=NULL;
X509_REQ *req = NULL;
X509 *cer = NULL;
char buf[SIZ];
int organizer_is_me = 0;
int i, j = 0;
+#ifdef DEBUG_UID_CALENDAR
int sequence = 0;
+#endif
char weekday_labels[7][32];
char month_labels[12][32];
long weekstart = 0;
/* Learn the sequence */
p = icalcomponent_get_first_property(vevent, ICAL_SEQUENCE_PROPERTY);
+#ifdef DEBUG_UID_CALENDAR
if (p != NULL) {
sequence = icalproperty_get_sequence(p);
}
+#endif
/* Begin output */
output_headers(1, 1, 2, 0, 0, 0);
wc_printf("<div class=\"fix_scrollbar_bug\">");
+#ifdef DEBUG_UID_CALENDAR
/************************************************************
* Uncomment this to see the UID in calendar events for debugging
+ *************************************************************/
wc_printf("UID == ");
p = icalcomponent_get_first_property(vevent, ICAL_UID_PROPERTY);
if (p != NULL) {
}
wc_printf("<br />\n");
wc_printf("SEQUENCE == %d<br />\n", sequence);
- *************************************************************/
+#endif
wc_printf("<form name=\"EventForm\" method=\"POST\" action=\"save_event\">\n");
wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
if (YESBSTR(buf)) recur.by_day[j++] =
icalrecurrencetype_day_day_of_week(i+1);
}
- recur.by_day[j++] = ICAL_RECURRENCE_ARRAY_MAX;
+ recur.by_day[j] = ICAL_RECURRENCE_ARRAY_MAX;
break;
case ICAL_MONTHLY_RECURRENCE:
char *pop_march(int desired_floor)
{
static char TheRoom[128];
- int TheFloor = 0;
- int TheOrder = 32767;
int TheWeight = 0;
int weight;
struct march *mptr = NULL;
if (weight > TheWeight) {
TheWeight = weight;
strcpy(TheRoom, mptr->march_name);
- TheFloor = mptr->march_floor;
- TheOrder = mptr->march_order;
}
}
return (TheRoom);
headereval *Hdr;
void *vHdr;
char buf[SIZ];
- int Done = 0;
int state=0;
Buf = NewStrBuf();
/* begin everythingamundo table */
HdrToken = NewStrBuf();
- while (!Done && StrBuf_ServGetln(Buf)>=0) {
- if ( (StrLength(Buf)==3) &&
+ while (StrBuf_ServGetln(Buf) >= 0) {
+ if ( (StrLength(Buf) ==3 ) &&
!strcmp(ChrPtr(Buf), "000"))
{
- Done = 1;
if (state < 2) {
if (Msg->MsgBody->Data == NULL)
Msg->MsgBody->Data = NewStrBuf();
}
-void
+long
HttpStatus(long CitadelStatus)
{
+ /* TODO: this doesn't realy work currently, the HTTP status isn't printed to the browser! */
long httpstatus = 502;
switch (MAJORCODE(CitadelStatus))
break;
}
-
+ return httpstatus;
}
/*
*/
void handle_one_message(void)
{
- long CitStatus;
+ long CitStatus = ERROR;
int CopyMessage = 0;
const StrBuf *Destination;
void *vLine;
void *vViewMsg;
void *vMsg;
message_summary *Msg;
- char cmd[256] = "";
+ char cmd[256];
int i, r;
wcsession *WCC = WC;
HashPos *at;
SharedMessageStatus Stat;
void *ViewSpecific;
+ cmd[0] = '\0';
+
if (havebstr("is_summary") && (1 == (ibstr("is_summary")))) {
WCC->CurRoom.view = VIEW_MAILBOX;
}
*/
void confirm_move_msg(void)
{
- long msgid;
char buf[SIZ];
char targ[SIZ];
- msgid = lbstr("msgid");
-
-
output_headers(1, 1, 2, 0, 0, 0);
wc_printf("<div id=\"banner\">\n");
wc_printf("<h1>");
Hash = NewHash(1, NULL);
Buf = NewStrBuf();
- while ((len = StrBuf_ServGetln(Buf),
- strcmp(ChrPtr(Buf), "000"))) {
+ while ((len = StrBuf_ServGetln(Buf), (len >= 0) &&
+ ((len != 3) || !strcmp(ChrPtr(Buf), "000")))) {
Node = NewNode(Buf);
if (Node == NULL)
continue;
StrBuf *Buf;
StrBuf *Data = NULL;
const char *bptr;
- int Done = 0;
char uid_from_headers[256];
char mime_partnum[256];
char mime_filename[256];
struct vnote *vnote_from_body = NULL;
int vnote_inline = 0; /* 1 = MSG4 gave us a text/x-vnote top level */
+ uid_from_headers[0] = '\0';
relevant_partnum[0] = '\0';
serv_printf("MSG4 %ld", msgnum); /* we need the mime headers */
Buf = NewStrBuf();
FreeStrBuf (&Buf);
return NULL;
}
- while ((StrBuf_ServGetln(Buf)>=0) && !Done) {
+ while ((StrBuf_ServGetln(Buf)>=0)) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
- Done = 1;
break;
}
bptr = ChrPtr(Buf);
void display_pushemail(void)
{
folder Room;
- int Done = 0;
StrBuf *Buf;
long vector[8] = {8, 0, 0, 1, 2, 3, 4, 5};
WCTemplputParams SubTP;
if (GetServerStatus(Buf, NULL) == 8) {
serv_puts("subj|__ Push email settings __");
serv_puts("000");
- while (!Done &&
- StrBuf_ServGetln(Buf) >= 0) {
+ while (StrBuf_ServGetln(Buf) >= 0) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
- Done = 1;
break;
}
msgnum = StrTol(Buf);
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 1) {
int i =0;
- Done = 0;
- while (!Done &&
- StrBuf_ServGetln(Buf) >= 0) {
+ while (StrBuf_ServGetln(Buf) >= 0) {
if (( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000"))||
((StrLength(Buf)==4) &&
!strcmp(ChrPtr(Buf), "text")))
{
- Done = 1;
break;
}
}
if (!strcmp(ChrPtr(Buf), "text")) {
- Done = 0;
- while (!Done &&
- StrBuf_ServGetln(Buf) >= 0) {
+ while (StrBuf_ServGetln(Buf) >= 0) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
- Done = 1;
break;
}
if (strncasecmp(ChrPtr(Buf), "none", 4) == 0) {
void save_pushemail(void)
{
folder Room;
- int Done = 0;
StrBuf *Buf;
char buf[SIZ];
int msgnum = 0;
return;
}
- while (!Done &&
- StrBuf_ServGetln(Buf) >= 0) {
+ while (StrBuf_ServGetln(Buf) >= 0) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
- Done = 1;
break;
}
msgnum = StrTol(Buf);
void load_floorlist(StrBuf *Buf)
{
int a;
- int Done = 0;
for (a = 0; a < MAX_FLOORS; ++a)
floorlist[a][0] = 0;
strcpy(floorlist[0], "Main Floor");
return;
}
- while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
+ while (StrBuf_ServGetln(Buf) >= 0) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
- Done = 1;
break;
}
extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
output_len += 2;
}
buf[output_len++] = '=';
- buf[output_len++] = 0;
+ buf[output_len] = '\0';
serv_puts((char *)buf);
output_len = 0;
}
sprintf((char *)&buf[output_len-1], "=%02X", buf[output_len-1]);
output_len += 2;
}
- buf[output_len++] = 0;
+ buf[output_len] = '\0';
serv_puts((char *)buf);
- output_len = 0;
}
}
int fd;
struct stat statbuf;
off_t bytes;
- off_t count = 0;
const char *content_type;
int len;
const char *Err;
return;
}
- count = 0;
bytes = statbuf.st_size;
if (StrBufReadBLOB(WC->WBuf, &fd, 1, bytes, &Err) < 0)
struct dirent *filedir_entry;
int d_type = 0;
int d_namelen;
- int d_without_ext;
int istoplevel;
filedir = opendir (DirName);
while ((readdir_r(filedir, d, &filedir_entry) == 0) &&
(filedir_entry != NULL))
{
- char *PStart;
#ifdef _DIRENT_HAVE_D_NAMELEN
d_namelen = filedir_entry->d_namelen;
d_type = filedir_entry->d_type;
d_namelen = strlen(filedir_entry->d_name);
d_type = DT_UNKNOWN;
#endif
- d_without_ext = d_namelen;
-
if ((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~')
continue; /* Ignore backup files... */
break;
case DT_LNK: /* TODO: check whether its a file or a directory */
case DT_REG:
- PStart = filedir_entry->d_name;
FileName = NewStrBufDup(Dir);
if (ChrPtr(FileName) [ StrLength(FileName) - 1] != '/')
StrBufAppendBufPlain(FileName, "/", 1, 0);
(vFile != NULL))
{
File = (StrBuf*) vFile;
- output_static(ChrPtr(vFile));
+ output_static(ChrPtr(File));
}
}
(vFile != NULL))
{
File = (StrBuf*) vFile;
- output_static(ChrPtr(vFile));
+ output_static(ChrPtr(File));
}
else {
lprintf(1, "output_static_safe() file %s not found. \n",
Type,
ChrPtr(Error));
*/
- StrBufPrintf(Info, "%s [%s] %s; [%s]",
- Type,
- Err,
- ChrPtr(Error),
- ChrPtr(TP->Tokens->FlatToken));
+ FlushStrBuf(Info);
+ StrBufAppendBufPlain(Info, Type, -1, 0);
+ StrBufAppendBufPlain(Info, HKEY(" ["), 0);
+ StrBufAppendBufPlain(Info, Err, -1, 0);
+ StrBufAppendBufPlain(Info, HKEY("] "), 0);
+ StrBufAppendBuf(Info, Error, 0);
+ StrBufAppendBufPlain(Info, HKEY("; ["), 0);
+ if (TP->Tokens != NULL)
+ StrBufAppendBuf(Info, TP->Tokens->FlatToken, 0);
+ StrBufAppendBufPlain(Info, HKEY("]"), 0);
SerializeJson(WCC->WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
}
FreeStrBuf(&Info);
case WCS_STRING:
lprintf(1, " -> %s\n", ChrPtr(ptr->wcs_value));
break;
- case WCS_SERVCMD:
- lprintf(1, " -> Server [%s]\n", ChrPtr(ptr->wcs_value));
- break;
case WCS_FUNCTION:
lprintf(1, " -> function at [%0xd]\n", ptr->wcs_function);
break;
{
switch(type) {
case WCS_STRING:
- case WCS_SERVCMD:
case WCS_STRBUF:
return 1;
case WCS_FUNCTION:
int NeedNew = NeedNewBuf(type);
switch(ptr->wcs_type) {
case WCS_STRING:
- case WCS_SERVCMD:
case WCS_STRBUF:
if (reusestrbuf && NeedNew) {
FlushStrBuf(ptr->wcs_value);
switch(ptr->wcs_type) {
case WCS_STRING:
- case WCS_SERVCMD:
- ptr->wcs_value = NewStrBuf();
- break;
case WCS_STRBUF:
case WCS_FUNCTION:
case WCS_STRBUF_REF:
ptr->wcs_value = (StrBuf*)Buf;
}
-/**
- * \brief back end for print_value_of() ... does a server command
- * \param servcmd server command to execute on the citadel server
- */
-void pvo_do_cmd(StrBuf *Target, StrBuf *servcmd) {
- char buf[SIZ];
- int len;
-
- serv_puts(ChrPtr(servcmd));
- len = serv_getln(buf, sizeof buf);
-
- switch(buf[0]) {
- case '2':
- case '3':
- case '5':
- StrBufAppendPrintf(Target, "%s\n", &buf[4]);
- break;
- case '1':
- _fmout(Target, "CENTER");
- break;
- case '4':
- StrBufAppendPrintf(Target, "%s\n", &buf[4]);
- serv_puts("000");
- break;
- }
-}
-
int HaveTemplateTokenString(StrBuf *Target,
WCTemplputParams *TP,
int N,
case WCS_STRING:
StrBufAppendBuf(Target, ptr->wcs_value, 0);
break;
- case WCS_SERVCMD:
- pvo_do_cmd(Target, ptr->wcs_value);
- break;
case WCS_FUNCTION:
(*ptr->wcs_function) (Target, TP);
break;
else
return ParamToCompare->lvalue == StrTol(ptr->wcs_value);
break;
- case WCS_SERVCMD:
- return 1;
- break;
case WCS_FUNCTION:
return 1;
case WCS_LONG:
case WCS_STRBUF_REF:
return ((StrLength(Compare) == StrLength(ptr->wcs_value)) &&
(strcmp(ChrPtr(Compare), ChrPtr(ptr->wcs_value)) == 0));
- case WCS_SERVCMD:
- return 1;
- break;
case WCS_FUNCTION:
return 1;
case WCS_LONG:
WCTemplputParams *TP,
const StrBuf *Source, int FormatTypeIndex)
{
- wcsession *WCC;
char EscapeAs = ' ';
if ((FormatTypeIndex < TP->Tokens->nParameters) &&
switch(EscapeAs)
{
case 'H':
- WCC = WC;
StrEscAppend(Target, Source, NULL, 0, 2);
break;
case 'X':
struct stat statbuf;
const char *pS, *pE, *pch, *Err;
long Line;
- int pos;
fd = open(ChrPtr(NewTemplate->FileName), O_RDONLY);
if (fd <= 0) {
int InDoubleQuotes = 0;
/** Find one <? > */
- pos = (-1);
for (; pch < pE; pch ++) {
if ((*pch=='<')&&(*(pch + 1)=='?') &&
!((pch == pS) && /* we must ommit a <?xml */
(filedir_entry != NULL))
{
char *MinorPtr;
- char *PStart;
#ifdef _DIRENT_HAVE_D_NAMELEN
d_namelen = filedir_entry->d_namelen;
d_type = filedir_entry->d_type;
if (d_without_ext > 2)
IsMobile = (filedir_entry->d_name[d_without_ext - 1] == 'm') &&
(filedir_entry->d_name[d_without_ext - 2] == '.');
- PStart = filedir_entry->d_name;
StrBufPrintf(FileName, "%s/%s", ChrPtr(DirName), filedir_entry->d_name);
MinorPtr = strchr(filedir_entry->d_name, '.');
if (MinorPtr != NULL)
switch(subst->wcs_type) {
case WCS_FUNCTION:
return (subst->wcs_function!=NULL);
- case WCS_SERVCMD:
- lprintf(1, " -> Server [%s]\n", subst->wcs_value);/* TODO */
- return 1;
case WCS_STRING:
case WCS_STRBUF:
case WCS_STRBUF_REF:
const char *OtherPrefix, long OtherPrefixLen,
const char *Default, long ldefault, long DefaultDirection)
{
- int isdefault = 0;
const StrBuf *BSort = NULL;
SortStruct *SortBy;
void *vSortBy;
if (!GetHash(SortHash, SKEY(BSort), &vSortBy) ||
(vSortBy == NULL)) {
- isdefault = 1;
if (!GetHash(SortHash, Default, ldefault, &vSortBy) ||
(vSortBy == NULL)) {
LogTemplateError(
SortOrder = StrTol(Buf);
}
else {
+ /* TODO: this is never used??? */
BSort = get_X_PREFS(HKEY("SortOrder"), OtherPrefix, OtherPrefixLen);
}
enum {
WCS_STRING, /* its a string */
WCS_FUNCTION, /* its a function callback */
- WCS_SERVCMD, /* its a command to send to the citadel server */
WCS_STRBUF, /* its a strbuf we own */
WCS_STRBUF_REF, /* its a strbuf we mustn't free */
WCS_LONG /* its an integer */
waitpid(current_child, &status, 0);
}
- do_restart = 0;
-
/* Did the main process exit with an actual exit code? */
if (WIFEXITED(status)) {
icalcomponent *vtodo;
icalproperty *p;
struct icaltimetype IcalTime;
- time_t now;
int created_new_vtodo = 0;
icalproperty_status todoStatus;
- now = time(NULL);
-
if (supplied_vtodo != NULL) {
vtodo = supplied_vtodo;
if (GetServerStatus(Buf, NULL) == 1) {
Hash = NewHash(1, NULL);
- while (!Done) {
+ while (1) {
len = StrBuf_ServGetln(Buf);
- if ((len <0) ||
+ if ((len < 0) ||
((len == 3) &&
!strcmp(ChrPtr(Buf), "000")))
{
- Done = 1;
break;
}
ul = NewUserListEntry(Buf);
void *vMsg;
message_summary *Msg;
wc_mime_attachment *Att;
- int Done;
StrBuf *Buf;
long vcard_msgnum = (-1L);
int already_tried_creating_one = 0;
Stat.maxload = 10000;
Stat.lowest_found = (-1);
Stat.highest_found = (-1);
- Done = 0;
/* Search for the user's vCard */
if (load_msg_ptrs("MSGS ALL||||1", &Stat, NULL) > 0) {
at = GetNewHashPos(WCC->summ, 0);
*/
void session_loop(void)
{
- int Flags = 0;
int xhttp;
StrBuf *Buf;
WCC->upload = NULL;
WCC->is_mobile = 0;
WCC->Hdr->nWildfireHeaders = 0;
- if (WCC->Hdr->HR.Handler != NULL)
- Flags = WCC->Hdr->HR.Handler->Flags; /* so we can temporarily add our own... */
if (WCC->Hdr->HR.ContentLength > 0) {
if (ReadPostData() < 0) {
extern char static_icon_dir[PATH_MAX]; /* where should we find our mime icons */
int is_https = 0; /* Nonzero if I am an HTTPS service */
int follow_xff = 0; /* Follow X-Forwarded-For: header */
-int home_specified = 0; /* did the user specify a homedir? */
int DisableGzip = 0;
extern pthread_mutex_t SessionListMutex;
extern pthread_key_t MyConKey;
char ip_addr[256]="0.0.0.0";
int relh=0;
int home=0;
- int home_specified=0;
char relhome[PATH_MAX]="";
char webcitdir[PATH_MAX] = DATADIR;
char *pidfile = NULL;
safestrncpy(relhome, relhome, sizeof relhome);
}
/* free(hdir); TODO: SHOULD WE DO THIS? */
- home_specified = 1;
home=1;
break;
case 'd':