From b6f8c3d1bf44933ed4fcdc8741f669e168842edc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 23 Feb 2008 18:43:41 +0000 Subject: [PATCH] * add icon directory * increment libcitadel required version * modified hash debug printf; so we need to modify uses. * display icons using our brand new mime to icon lookup facility --- webcit/downloads.c | 12 +++++++++--- webcit/preferences.c | 9 +++++++-- webcit/webcit.h | 2 +- webcit/webserver.c | 9 +++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/webcit/downloads.c b/webcit/downloads.c index 6571591cc..2ed8e247c 100644 --- a/webcit/downloads.c +++ b/webcit/downloads.c @@ -156,10 +156,16 @@ void display_pictureview(void) extern char* static_dirs[]; void display_mime_icon(void) { - char diskette[SIZ]; + char FileBuf[SIZ]; + const char *FileName; - snprintf (diskette, SIZ, "%s%s", static_dirs[0], "/diskette_24x.gif"); - output_static(diskette); + FileName = GetIconFilename(bstr("type"), strlen(bstr("type"))); + + if (FileName == NULL) + snprintf (FileBuf, SIZ, "%s%s", static_dirs[0], "/diskette_24x.gif"); + else + snprintf (FileBuf, SIZ, "%s%s", static_dirs[3], FileName); + output_static(FileBuf); } diff --git a/webcit/preferences.c b/webcit/preferences.c index 543c97ae3..ea5e3c6a0 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -9,6 +9,11 @@ #include "webserver.h" #include "groupdav.h" +inline const char *PrintPref(void *Prefstr) +{ + return Prefstr; +} + /* * display preferences dialog */ @@ -106,7 +111,7 @@ void save_preferences(void) { char *Key; Hash = WC->hash_prefs; - PrintHash(Hash); + PrintHash(Hash, PrintPref, NULL); HashPos = GetNewHashPos(); while (GetNextHashPos(Hash, HashPos, &len, &Key, (void**)&Value)!=0) { @@ -132,7 +137,7 @@ void get_preference(char *key, char *value, size_t value_len) { void *hash_value = NULL; strcpy(value, ""); - PrintHash(WC->hash_prefs); + PrintHash(WC->hash_prefs, PrintPref, NULL); if (GetHash(WC->hash_prefs, key, strlen(key), &hash_value) == 0) return; diff --git a/webcit/webcit.h b/webcit/webcit.h index 327f76850..cad424573 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -124,7 +124,7 @@ extern locale_t wc_locales[]; #define CLIENT_ID 4 #define CLIENT_VERSION 730 /* This version of WebCit */ #define MINIMUM_CIT_VERSION 730 /* min required Citadel ver */ -#define LIBCITADEL_MIN 105 /* min required libcitadel ver */ +#define LIBCITADEL_MIN 106 /* min required libcitadel ver */ #define DEFAULT_HOST "localhost" /* Default Citadel server */ #define DEFAULT_PORT "504" #define LB (1) /* Internal escape chars */ diff --git a/webcit/webserver.c b/webcit/webserver.c index c5f30c2ad..46c809769 100644 --- a/webcit/webserver.c +++ b/webcit/webserver.c @@ -39,10 +39,12 @@ char socket_dir[PATH_MAX]; /* where to talk to our citadel server */ static const char editor_absolut_dir[PATH_MAX]=EDITORDIR; /* nailed to what configure gives us. */ static char static_dir[PATH_MAX]; /* calculated on startup */ static char static_local_dir[PATH_MAX]; /* calculated on startup */ +static char static_icon_dir[PATH_MAX]; /* where should we find our mime icons? */ char *static_dirs[]={ /* needs same sort order as the web mapping */ (char*)static_dir, /* our templates on disk */ (char*)static_local_dir, /* user provided templates disk */ - (char*)editor_absolut_dir /* the editor on disk */ + (char*)editor_absolut_dir, /* the editor on disk */ + (char*)static_icon_dir /* our icons... */ }; /* @@ -826,6 +828,8 @@ int main(int argc, char **argv) COMPUTE_DIRECTORY(socket_dir); basedir=WWWDIR "/static"; COMPUTE_DIRECTORY(static_dir); + basedir=WWWDIR "/static/icons"; + COMPUTE_DIRECTORY(static_icon_dir); basedir=WWWDIR "/static.local"; COMPUTE_DIRECTORY(static_local_dir); @@ -846,7 +850,8 @@ int main(int argc, char **argv) lprintf(9, "Changing directory to %s\n", socket_dir); if (chdir(webcitdir) != 0) { perror("chdir"); - } + } + LoadIconDir(static_icon_dir); initialize_viewdefs(); initialize_axdefs(); -- 2.30.2