* First bits to fallback to serverwinde gettext if we don't have uselocale on that system.
dnl Here is the check for libintl etc.
dnl Here is the check for libintl etc.
+AC_CHECK_FUNCS(strftime_l uselocale gettext)
AC_ARG_ENABLE(nls,
[ --disable-nls do not use Native Language Support],
AC_ARG_ENABLE(nls,
[ --disable-nls do not use Native Language Support],
PROFILE_ARGS= --with-gprof
endif
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
PROFILE_ARGS= --with-gprof
endif
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0 -ggdb -rdynamic -MD -MP
+ CFLAGS += -O0 -ggdb -rdynamic -MD -MP -D TECH_PREVIEW
LDFLAGS += -pg
EXTRA_ARGS = --with-backtrace
else
LDFLAGS += -pg
EXTRA_ARGS = --with-backtrace
else
* \brief Activate the selected language for this session.
*/
void go_selected_language(void) {
* \brief Activate the selected language for this session.
*/
void go_selected_language(void) {
if (WC->selected_language < 0) return;
uselocale(wc_locales[WC->selected_language]); /** switch locales */
textdomain(textdomain(NULL)); /** clear the cache */
if (WC->selected_language < 0) return;
uselocale(wc_locales[WC->selected_language]); /** switch locales */
textdomain(textdomain(NULL)); /** clear the cache */
}
/**
* \brief Deactivate the selected language for this session.
*/
void stop_selected_language(void) {
}
/**
* \brief Deactivate the selected language for this session.
*/
void stop_selected_language(void) {
uselocale(LC_GLOBAL_LOCALE); /** switch locales */
textdomain(textdomain(NULL)); /** clear the cache */
uselocale(LC_GLOBAL_LOCALE); /** switch locales */
textdomain(textdomain(NULL)); /** clear the cache */
+void preset_locale(void)
+{
+#ifndef HAVE_USELOCALE
+#ifdef HAVE_GETTEXT
+ char *language;
+
+ language = getenv("LANG");
+ setlocale(LC_MESSAGES, language);
+#endif
+#endif
+}
/**
* \brief Create a locale_t for each available language
*/
/**
* \brief Create a locale_t for each available language
*/
void stop_selected_language(void) {
}
void stop_selected_language(void) {
}
+void preset_locale(void)
+{
+}
/**
* \brief Output a piece of content to the web browser
*/
/**
* \brief Output a piece of content to the web browser
*/
-void http_transmit_thing(char *thing, size_t length, char *content_type,
+void http_transmit_thing(char *thing, size_t length, const char *content_type,
int is_static) {
output_headers(0, 0, 0, 0, 0, is_static);
int is_static) {
output_headers(0, 0, 0, 0, 0, is_static);
+
+typedef struct _MimeGuess {
+ const char *Pattern;
+ size_t PatternLen;
+ long PatternOffset;
+ const char *MimeString;
+} MimeGuess;
+
+MimeGuess MyMimes [] = {
+ {
+ "GIF",
+ 3,
+ 0,
+ "image/gif"
+ },
+ {
+ "\xff\xd8",
+ 2,
+ 0,
+ "image/jpeg"
+ },
+ {
+ "\x89PNG",
+ 4,
+ 0,
+ "image/png"
+ },
+ { // last...
+ "",
+ 0,
+ 0,
+ ""
+ }
+};
+
+
+
/**
* \brief When the browser requests an image file from the Citadel server,
* this function is called to transmit it.
/**
* \brief When the browser requests an image file from the Citadel server,
* this function is called to transmit it.
char buf[SIZ];
char *xferbuf = NULL;
off_t bytes;
char buf[SIZ];
char *xferbuf = NULL;
off_t bytes;
serv_printf("OIMG %s|%s", bstr("name"), bstr("parm"));
serv_getln(buf, sizeof buf);
serv_printf("OIMG %s|%s", bstr("name"), bstr("parm"));
serv_getln(buf, sizeof buf);
serv_puts("CLOS");
serv_getln(buf, sizeof buf);
serv_puts("CLOS");
serv_getln(buf, sizeof buf);
+ while (MyMimes[MimeIndex].PatternLen != 0)
+ {
+ if (strncmp(MyMimes[MimeIndex].Pattern,
+ &xferbuf[MyMimes[MimeIndex].PatternOffset],
+ MyMimes[MimeIndex].PatternLen) == 0)
+ break;
+ MimeIndex ++;
+ }
+
/** Write it to the browser */
/** Write it to the browser */
- http_transmit_thing(xferbuf, (size_t)bytes, "image/gif", 0);
+ if (MyMimes[MimeIndex].PatternLen != 0)
+ {
+ http_transmit_thing(xferbuf,
+ (size_t)bytes,
+ MyMimes[MimeIndex].MimeString,
+ 0);
+ free(xferbuf);
+ return;
+ }
+ /* hm... unknown mimetype? fallback to blank gif */
- } else {
- /**
- * Instead of an ugly 404, send a 1x1 transparent GIF
- * when there's no such image on the server.
- */
- char blank_gif[SIZ];
- snprintf (blank_gif, SIZ, "%s%s", static_dirs[0], "/blank.gif");
- output_static(blank_gif);
- }
-
-
-
+
+ /**
+ * Instead of an ugly 404, send a 1x1 transparent GIF
+ * when there's no such image on the server.
+ */
+ char blank_gif[SIZ];
+ snprintf (blank_gif, SIZ, "%s%s", static_dirs[0], "/blank.gif");
+ output_static(blank_gif);
int goto_config_room(void);
long locate_user_vcard(char *username, long usernum);
void sleeeeeeeeeep(int);
int goto_config_room(void);
long locate_user_vcard(char *username, long usernum);
void sleeeeeeeeeep(int);
-void http_transmit_thing(char *thing, size_t length, char *content_type,
+void http_transmit_thing(char *thing, size_t length, const char *content_type,
int is_static);
void unescape_input(char *buf);
void do_iconbar(void);
int is_static);
void unescape_input(char *buf);
void do_iconbar(void);
void set_selected_language(char *);
void go_selected_language(void);
void stop_selected_language(void);
void set_selected_language(char *);
void go_selected_language(void);
void stop_selected_language(void);
+void preset_locale(void);
void httplang_to_locale(char *LocaleString);
void tabbed_dialog(int num_tabs, char *tabnames[]);
void begin_tab(int tabnum, int num_tabs);
void httplang_to_locale(char *LocaleString);
void tabbed_dialog(int num_tabs, char *tabnames[]);
void begin_tab(int tabnum, int num_tabs);
free(mo);
lprintf(9, "Text domain: %s\n", textdomain("webcit"));
lprintf(9, "Text domain Charset: %s\n", bind_textdomain_codeset("webcit","UTF8"));
free(mo);
lprintf(9, "Text domain: %s\n", textdomain("webcit"));
lprintf(9, "Text domain Charset: %s\n", bind_textdomain_codeset("webcit","UTF8"));