aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_common.c')
-rw-r--r--src/fs/gnunet-fs-gtk_common.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/fs/gnunet-fs-gtk_common.c b/src/fs/gnunet-fs-gtk_common.c
index 52ad1595..af9284bc 100644
--- a/src/fs/gnunet-fs-gtk_common.c
+++ b/src/fs/gnunet-fs-gtk_common.c
@@ -231,4 +231,45 @@ GNUNET_FS_GTK_mmap_and_scan (const char *filename,
231 GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fh)); 231 GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fh));
232} 232}
233 233
234
235/**
236 * Obtain the string we will use to describe a search result from
237 * the respective meta data.
238 *
239 * @param meta meta data to inspect
240 * @return description of the result in utf-8, never NULL
241 */
242char *
243GNUNET_FS_GTK_get_description_from_metadata (const struct GNUNET_CONTAINER_MetaData *meta)
244{
245 char *desc;
246 char *utf8_desc;
247
248 desc =
249 GNUNET_CONTAINER_meta_data_get_first_by_types (meta,
250 EXTRACTOR_METATYPE_PACKAGE_NAME,
251 EXTRACTOR_METATYPE_TITLE,
252 EXTRACTOR_METATYPE_BOOK_TITLE,
253 EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
254 EXTRACTOR_METATYPE_FILENAME,
255 EXTRACTOR_METATYPE_DESCRIPTION,
256 EXTRACTOR_METATYPE_SUMMARY,
257 EXTRACTOR_METATYPE_ALBUM,
258 EXTRACTOR_METATYPE_COMMENT,
259 EXTRACTOR_METATYPE_SUBJECT,
260 EXTRACTOR_METATYPE_KEYWORDS,
261 -1);
262 if (desc == NULL)
263 return GNUNET_strdup (_("no description supplied"));
264 utf8_desc =
265 GNUNET_FS_GTK_dubious_meta_to_utf8 (EXTRACTOR_METAFORMAT_UTF8, desc,
266 strlen (desc) + 1);
267 GNUNET_free (desc);
268 if (utf8_desc == NULL)
269 return GNUNET_strdup (_("no description supplied"));
270 return utf8_desc;
271}
272
273
274
234/* end of gnunet-fs-gtk-common.c */ 275/* end of gnunet-fs-gtk-common.c */