* add icon directory
authorWilfried Göesgens <willi@citadel.org>
Sat, 23 Feb 2008 18:43:41 +0000 (18:43 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 23 Feb 2008 18:43:41 +0000 (18:43 +0000)
* 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
webcit/preferences.c
webcit/webcit.h
webcit/webserver.c

index 6571591cc15c835dcce5cea15d4293fa686c6959..2ed8e247c51da2d559fd3cf6578d087a41ef461f 100644 (file)
@@ -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);
 
 }
 
index 543c97ae367a6867f8846327b7e24d034bdaf288..ea5e3c6a05314a3456fcee64dd2139d93f312b45 100644 (file)
@@ -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;
        
index 327f76850cae21d232690df053eb20181a0df2d0..cad424573548bac308cb55b5a4322cd8b94f8341 100644 (file)
@@ -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 */
index c5f30c2ad7c0e4122e9ffec14b26195cf0d29e0e..46c8097696f0c8187c9c31b598015817d5c341a9 100644 (file)
@@ -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();