#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <sys/un.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <string.h>
#define INADDR_NONE 0xffffffff
#endif
+
+int uds_sock_connect(char *sockpath)
+{
+ struct sockaddr_un addr;
+ int s;
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+ safestrncpy(addr.sun_path, sockpath, sizeof addr.sun_path);
+
+ s = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (s < 0) {
+ return(-1);
+ }
+
+ if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ close(s);
+ return(-1);
+ }
+
+ return s;
+}
+
+
int sock_connect(char *host, char *service, char *protocol)
{
struct hostent *phe;
if ((host == NULL) || IsEmptyStr(host))
return(-1);
+
+ if (host[0] == '/') {
+ return uds_sock_connect(host);
+ }
+
if ((service == NULL) || IsEmptyStr(service))
return(-1);
if ((protocol == NULL) || IsEmptyStr(protocol))
pField++, sField++)
{
if ((*sField=='\r') || (*sField=='\n')) {
- while (isspace(*sField))
- sField++;
- *pField = *sField;
+ sField++;
+ if (*sField == '\n')
+ sField++;
+ *pField = *sField;
}
else {
if (*sField=='\"') quote = 1 - quote;
const XML_Char *systemId, const XML_Char *publicId,
const XML_Char *notationName
) {
- syslog(LOG_WARNING, "Illegal entity declaration encountered; stopping parser.");
+ syslog(CTDL_WARNING, "Illegal entity declaration encountered; stopping parser.");
XML_StopParser(XMPP->xp, XML_FALSE);
}
#endif
* Function to remove a buddy subscription and delete from the roster
* (used in several places)
*/
-void xmpp_destroy_buddy(char *presence_jid) {
+void xmpp_destroy_buddy(char *presence_jid, int aggressively) {
static int unsolicited_id = 1;
char xmlbuf1[256];
char xmlbuf2[256];
xmlesc(xmlbuf1, presence_jid, sizeof xmlbuf1),
xmlesc(xmlbuf2, XMPP->client_jid, sizeof xmlbuf2)
);
- cprintf("<presence type=\"unsubscribed\" from=\"%s\" to=\"%s\"></presence>",
- xmlesc(xmlbuf1, presence_jid, sizeof xmlbuf1),
- xmlesc(xmlbuf2, XMPP->client_jid, sizeof xmlbuf2)
- );
+
+ /*
+ * Setting the "aggressively" flag also sends an "unsubscribed" presence update.
+ * We only ask for this when flushing the client side roster, because if we do it
+ * in the middle of a session when another user logs off, some clients (Jitsi) interpret
+ * it as a rejection of a subscription request.
+ */
+ if (aggressively) {
+ cprintf("<presence type=\"unsubscribed\" from=\"%s\" to=\"%s\"></presence>",
+ xmlesc(xmlbuf1, presence_jid, sizeof xmlbuf1),
+ xmlesc(xmlbuf2, XMPP->client_jid, sizeof xmlbuf2)
+ );
+ }
+
// FIXME ... we should implement xmpp_indicate_nonpresence so we can use it elsewhere
/* Do an unsolicited roster update that deletes the contact. */
if (visible_sessions == 0) {
CtdlLogPrintf(CTDL_DEBUG, "Telling session %d that <%s> logged out\n",
CC->cs_pid, presence_jid);
- xmpp_destroy_buddy(presence_jid);
+ xmpp_destroy_buddy(presence_jid, 0); /* non aggressive presence update */
}
free(cptr);
}
if (!online_now) {
- xmpp_destroy_buddy((char *)Value);
+ xmpp_destroy_buddy((char *)Value, 1); /* aggressive presence update */
}
}
if (((unsigned char)*aptr) >= 0x20)
{
IsUtf8Sequence = Ctdl_GetUtf8SequenceLength(aptr, eiptr);
-
+
*bptr = *aptr;
Target->BufUsed ++;
- while (IsUtf8Sequence > 1){
- if(bptr + IsUtf8Sequence >= eptr) {
- IncreaseBuf(Target, 1, -1);
- eptr = Target->buf + Target->BufSize - 11; /* our biggest unit to put in... */
- bptr = Target->buf + Target->BufUsed - 1;
- }
+ if (IsUtf8Sequence > 1) while (IsUtf8Sequence > 0){
+ if(bptr + IsUtf8Sequence >= eptr) {
+ IncreaseBuf(Target, 1, -1);
+ eptr = Target->buf + Target->BufSize - 11; /* our biggest unit to put in... */
+ bptr = Target->buf + Target->BufUsed - 1;
+ }
bptr++; aptr++;
- IsUtf8Sequence --;
- *bptr = *aptr;
- Target->BufUsed ++;
- }
+ IsUtf8Sequence --;
+ *bptr = *aptr;
+ Target->BufUsed ++;
+ }
bptr++;
}
int haveChar = 0;
int haveNum = 0;
int haveOther = 0;
- int count = 0;
+ int haveLong = 0;
pch = buf;
while (!IsEmptyStr(pch))
{
haveOther = 1;
pch ++;
}
- count = pch - buf;
- if (count > 7)
- count = 0;
- switch (count){
+ if (pch - buf > 7)
+ haveLong = 1;
+ switch (haveLong +
+ haveChar +
+ haveNum +
+ haveOther)
+ {
case 0:
pch = _("very weak");
break;
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);
* overlap with this one take place at least partially in this day.
*/
memset(&starting_tm, 0, sizeof(struct tm));
+ memset(&event_te, 0, sizeof(struct tm));
starting_tm.tm_year = year - 1900;
starting_tm.tm_mon = month - 1;
starting_tm.tm_mday = day;
StrBufExtract_token(HeaderName, Line, 0, ':');
pchs = ChrPtr(Line);
- pche = pchs + StrLength(Line);
pch = pchs + StrLength(HeaderName) + 1;
pche = pchs + StrLength(Line);
while ((pch < pche) && isspace(*pch))
do_404();
+ /* How long did this transaction take? */
+ gettimeofday(&tx_finish, NULL);
+
lprintf(9, "HTTP: 404 [%ld.%06ld] %s %s \n",
((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) / 1000000,
((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) % 1000000,
*/
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:
""
};
-const char **AvailLangLoaded;
+const char **AvailLangLoaded = NULL;
long nLocalesLoaded = 0;
#ifdef HAVE_USELOCALE
#endif
}
-
-void
-ServerShutdownModule_GETTEXT
-(void)
-{
-#ifdef HAVE_USELOCALE
- int i;
- for (i = 0; i < nLocalesLoaded; ++i) {
- if (Empty_Locale != wc_locales[i])
- freelocale(wc_locales[i]);
- }
- free(wc_locales);
-#endif
- free(AvailLangLoaded);
-}
-
#else /* ENABLE_NLS */
const char *AvailLang[] = {
"C", ""};
stop_selected_language(); /* unset locale */
#endif
}
+
+void
+ServerShutdownModule_GETTEXT
+(void)
+{
+#ifdef ENABLE_NLS
+ int i;
+ for (i = 0; i < nLocalesLoaded; ++i) {
+ if (Empty_Locale != wc_locales[i])
+ freelocale(wc_locales[i]);
+ }
+ free(wc_locales);
+ if (!AvailLangLoaded) free(AvailLangLoaded);
+#endif
+}
* 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) == '<')) {
+ if ((ptr != NULL) && (ptr > msg) && (*(ptr-1) == '<')) {
++brak;
}
- if ((ptr > msg) && (*(ptr-1) == '>')) {
+ if ((ptr != NULL) && (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 ((ptr != NULL) &&
+ !strncasecmp(ptr, "</A>", 3))
+ --alevel;
}
}
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 ParsePref(HashList **List, StrBuf *ReadBuf)
{
- int Done = 0;
Preference *Data = NULL;
Preference *LastData = NULL;
- while (!Done) {
+ while (1) {
if (StrBuf_ServGetln(ReadBuf) < 0)
break;
if ( (StrLength(ReadBuf)==3) &&
!strcmp(ChrPtr(ReadBuf), "000")) {
- Done = 1;
break;
}
{
folder Room;
wcsession *WCC = WC;
- int Done = 0;
StrBuf *ReadBuf;
long msgnum = 0L;
serv_puts("subj|__ WebCit Preferences __");
serv_puts("000");
}
- while (!Done &&
- (StrBuf_ServGetln(ReadBuf) >= 0)) {
+ while (StrBuf_ServGetln(ReadBuf) >= 0) {
if ( (StrLength(ReadBuf)==3) &&
!strcmp(ChrPtr(ReadBuf), "000")) {
- Done = 1;
break;
}
msgnum = StrTol(ReadBuf);
{
folder Room;
wcsession *WCC = WC;
- int Done = 0;
StrBuf *ReadBuf;
long msgnum = 0L;
serv_puts("subj|__ WebCit Preferences __");
serv_puts("000");
}
- while (!Done &&
- (StrBuf_ServGetln(ReadBuf) >= 0)) {
+ while (StrBuf_ServGetln(ReadBuf) >= 0) {
if ( (StrLength(ReadBuf)==3) &&
!strcmp(ChrPtr(ReadBuf), "000")) {
- Done = 1;
break;
}
msgnum = StrTol(ReadBuf);
if (Pref->Type == NULL) {
StrBufAppendTemplate(Target, TP, Pref->Val, 1);
}
- switch (Pref->Type->eType)
+ else switch (Pref->Type->eType)
{
case PRF_UNSET: /* default to string... */
case PRF_STRING:
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;
return -1;
}
- serv_printf("READ %d|%d", bytes_read, total_len-bytes_read);
+ serv_printf("READ "SIZE_T_FMT"|"SIZE_T_FMT, bytes_read, total_len-bytes_read);
if ( (rc = StrBuf_ServGetln(Buf) > 0) && (GetServerStatus(Buf, NULL) == 6) )
{
if (rc < 0)
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':