diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-06-15 21:53:49 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-06-15 21:53:49 +0000 |
commit | 790bdf2e2afc06c9e511ad2557232a3b8c9fd71a (patch) | |
tree | 615da70bfdf02fd3d52ecb5e0ceccc4f9eaf7a3c /amiga/filetype.c | |
parent | 26101a1af6d784bc533fb21526e6e43b98a4d394 (diff) | |
download | netsurf-790bdf2e2afc06c9e511ad2557232a3b8c9fd71a.tar.gz netsurf-790bdf2e2afc06c9e511ad2557232a3b8c9fd71a.tar.bz2 |
convert from mimetype to filetype rather than simple content type to filetype, where
available
svn path=/trunk/netsurf/; revision=12484
Diffstat (limited to 'amiga/filetype.c')
-rw-r--r-- | amiga/filetype.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/amiga/filetype.c b/amiga/filetype.c index e99a0fb33..ceff1c8a4 100644 --- a/amiga/filetype.c +++ b/amiga/filetype.c @@ -148,8 +148,6 @@ char *fetch_mimetype(const char *ro_path) const char *ami_content_type_to_file_type(content_type type) { - /* TODO: Can we pass MIME types to this function instead? */ - switch(type) { case CONTENT_HTML: @@ -164,6 +162,10 @@ const char *ami_content_type_to_file_type(content_type type) return "css"; break; + case CONTENT_IMAGE: + return "picture"; + break; + default: return "project"; break; @@ -252,6 +254,7 @@ nserror ami_mime_init(const char *mimefile) void ami_mime_free(void) { + ami_mime_dump(); FreeObjList(ami_mime_list); } @@ -508,6 +511,22 @@ struct Node *ami_mime_to_filetype(lwc_string *mimetype, } } +const char *ami_mime_content_to_filetype(struct hlcache_handle *c) +{ + struct Node *node; + lwc_string *filetype; + lwc_string *mimetype; + + mimetype = content_get_mime_type(c); + + node = ami_mime_to_filetype(mimetype, &filetype, NULL); + + if(node && (filetype != NULL)) + return lwc_string_data(filetype); + else + return ami_content_type_to_file_type(content_get_type(c)); +} + /** * Return all MIME types containing a plugincmd * |