/*
* Copyright (c) 1987-2011 by the citadel.org team
*
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
+ * This program is open source software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdep.h"
#include <stdarg.h>
#include <pthread.h>
#include <signal.h>
+#include <syslog.h>
#include <sys/utsname.h>
#include <libcitadel.h>
#define SIZ 4096 /* generic buffer size */
-#define TRACE fprintf(stderr, "\033[7mCheckpoint: %s, %d\033[0m\n", __FILE__, __LINE__)
+#define TRACE syslog(LOG_DEBUG, "CHECKPOINT: %s, %d", __FILE__, __LINE__)
#define SLEEPING 180 /* TCP connection timeout */
#define WEBCIT_TIMEOUT 900 /* WebCit session timeout */
#define NO_SUCH_SYSTEM 73
#define ALREADY_EXISTS 74
#define MESSAGE_NOT_FOUND 75
+
/*
* NLI is the string that shows up in a who's online listing for sessions
- * that are active, but for which no user has yet authenticated.
+ * that are active but do not (yet) have a user logged in.
*/
#define NLI "(not logged in)"
StrBuf *c_language;
StrBuf *this_page; /* URL of current page */
StrBuf *PlainArgs;
+ StrBuf *HostHeader;
HashList *urlstrings; /* variables passed to webcit in a URL */
HashList *HTTPHeaders; /* the headers the client sent us */
pthread_mutex_t SessionMutex; /* mutex for exclusive access */
int wc_session; /* WebCit session ID */
int killthis; /* Nonzero == purge this session */
- int is_mobile; /* Client is a handheld browser */
int ctdl_pid; /* Session ID on the Citadel server */
int nonce; /* session nonce (to prevent session riding) */
int SessionKey;
int cache_num_floors;
long *IBSettingsVec; /* which icons should be shown / not shown? */
const StrBuf *floordiv_expanded; /* which floordiv currently expanded */
+ int ib_wholist_expanded;
+ int ib_roomlist_expanded;
/* Transcoding cache buffers; used to avoid to frequent realloc */
StrBuf *ConvertBuf1;
#define num_parms(source) num_tokens(source, '|')
#endif
+#define site_prefix (WC ? (WC->Hdr->HostHeader) : NULL)
+
/* Per-session data */
#define WC ((struct wcsession *)pthread_getspecific(MyConKey))
extern pthread_key_t MyConKey;
extern int follow_xff;
extern int num_threads_existing;
extern int num_threads_executing;
-extern StrBuf *site_prefix;
void InitialiseSemaphores(void);
void begin_critical_section(int which_one);
void display_default_landing_page(void);
void do_welcome(void);
void do_logout(void);
+void display_reg(int during_login);
void display_main_menu(void);
void display_aide_menu(void);
void slrp_highest(void);
int GetServerStatus(StrBuf *Line, long* FullState);
void serv_puts(const char *string);
void who(void);
+void push_destination(void);
+void pop_destination(void);
+void robots_txt(void);
+extern void do_404(void);
void ajax_mini_calendar(void);
void fmout(char *align);
int suppress_check,
int cache);
void output_custom_content_header(const char *ctype);
+void cdataout(char *rawdata);
#ifdef UBER_VERBOSE_DEBUGGING
#define wc_printf(...) wcc_printf(__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
void webcit_fmt_date(char *buf, size_t siz, time_t thetime, int Format);
void summary(void);
-int is_mobile_ua(char *user_agent);
-
/* actual supported locales */
void TmplGettext(StrBuf *Target, WCTemplputParams *TP);
void offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType);
#define WC_TIMEFORMAT_24 2
extern int time_to_die; /* Nonzero if server is shutting down */
+
+/* a nice consistent place to define how we turn a message id into a thread id hash */
+#define ThreadIdHash(Buf) abs(HashLittle(ChrPtr(Buf), StrLength(Buf)))
+
+/*
+ * Array type for a blog post. The first message is the post; the rest are comments
+ */
+struct blogpost {
+ int top_level_id;
+ long *msgs; /* Array of msgnums for messages we are displaying */
+ int num_msgs; /* Number of msgnums stored in 'msgs' */
+ int alloc_msgs; /* Currently allocated size of array */
+};
+
+
+/*
+ * Data which gets returned from a call to blogview_learn_thread_references()
+ */
+struct bltr {
+ int id;
+ int refs;
+};
+
+
+struct bltr blogview_learn_thread_references(long msgnum);