aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-publish.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-publish.c')
-rw-r--r--src/fs/gnunet-publish.c66
1 files changed, 40 insertions, 26 deletions
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index e3918f6fb..65f437f11 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -140,43 +140,57 @@ progress_cb (void *cls,
140 * @param cls closure 140 * @param cls closure
141 * @param type type of the meta data 141 * @param type type of the meta data
142 * @param data value of the meta data 142 * @param data value of the meta data
143 * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort 143 * @return always 0
144 */ 144 */
145static int 145static int
146meta_printer (void *cls, 146meta_printer (void *cls,
147 EXTRACTOR_KeywordType type, 147 const char *plugin_name,
148 const char *data) 148 enum EXTRACTOR_MetaType type,
149 enum EXTRACTOR_MetaFormat format,
150 const char *data_mime_type,
151 const char *data,
152 size_t data_size)
149{ 153{
150 if ( (type == EXTRACTOR_FILENAME) || 154 if ( (format != EXTRACTOR_METAFORMAT_UTF8) &&
151 (EXTRACTOR_isBinaryType (type)) ) 155 (format != EXTRACTOR_METAFORMAT_C_STRING) )
152 return GNUNET_OK; 156 return 0;
157 if (type == EXTRACTOR_METATYPE_FILENAME)
158 return 0;
153 fprintf (stdout, 159 fprintf (stdout,
154 "%s - %s", 160 "%s - %s",
155 EXTRACTOR_getKeywordTypeAsString (type), 161 EXTRACTOR_metatype_to_string (type),
156 data); 162 data);
157 return GNUNET_OK; 163 return 0;
158} 164}
159 165
160 166
161/** 167/**
162 * Merge metadata entries (except binary 168 * Merge metadata entries.
163 * metadata).
164 * 169 *
165 * @param cls closure, target metadata structure 170 * @param cls closure, target metadata structure
166 * @param type type of the meta data 171 * @param type type of the meta data
167 * @param data value of the meta data 172 * @param data value of the meta data
168 * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort 173 * @return always 0
169 */ 174 */
170static int 175static int
171meta_merger (void *cls, 176meta_merger (void *cls,
172 EXTRACTOR_KeywordType type, 177 const char *plugin_name,
173 const char *data) 178 enum EXTRACTOR_MetaType type,
179 enum EXTRACTOR_MetaFormat format,
180 const char *data_mime_type,
181 const char *data,
182 size_t data_size)
174{ 183{
175 struct GNUNET_CONTAINER_MetaData *m = cls; 184 struct GNUNET_CONTAINER_MetaData *m = cls;
185
176 GNUNET_CONTAINER_meta_data_insert (m, 186 GNUNET_CONTAINER_meta_data_insert (m,
187 plugin_name,
177 type, 188 type,
178 data); 189 format,
179 return GNUNET_OK; 190 data_mime_type,
191 data,
192 data_size);
193 return 0;
180} 194}
181 195
182 196
@@ -227,16 +241,16 @@ publish_inspector (void *cls,
227 } 241 }
228 if (NULL != meta) 242 if (NULL != meta)
229 { 243 {
230 GNUNET_CONTAINER_meta_data_get_contents (meta, 244 GNUNET_CONTAINER_meta_data_iterate (meta,
231 &meta_merger, 245 &meta_merger,
232 m); 246 m);
233 GNUNET_CONTAINER_meta_data_destroy (meta); 247 GNUNET_CONTAINER_meta_data_destroy (meta);
234 meta = NULL; 248 meta = NULL;
235 } 249 }
236 if (extract_only) 250 if (extract_only)
237 { 251 {
238 fn = GNUNET_CONTAINER_meta_data_get_by_type (meta, 252 fn = GNUNET_CONTAINER_meta_data_get_by_type (meta,
239 EXTRACTOR_FILENAME); 253 EXTRACTOR_METATYPE_FILENAME);
240 fs = GNUNET_STRINGS_byte_size_fancy (length); 254 fs = GNUNET_STRINGS_byte_size_fancy (length);
241 fprintf (stdout, 255 fprintf (stdout,
242 _("Keywords for file `%s' (%s)\n"), 256 _("Keywords for file `%s' (%s)\n"),
@@ -244,9 +258,9 @@ publish_inspector (void *cls,
244 fs); 258 fs);
245 GNUNET_free (fn); 259 GNUNET_free (fn);
246 GNUNET_free (fs); 260 GNUNET_free (fs);
247 GNUNET_CONTAINER_meta_data_get_contents (meta, 261 GNUNET_CONTAINER_meta_data_iterate (meta,
248 &meta_printer, 262 &meta_printer,
249 NULL); 263 NULL);
250 fprintf (stdout, "\n"); 264 fprintf (stdout, "\n");
251 } 265 }
252 if (GNUNET_FS_meta_data_test_for_directory (meta)) 266 if (GNUNET_FS_meta_data_test_for_directory (meta))
@@ -275,7 +289,7 @@ run (void *cls,
275{ 289{
276 struct GNUNET_FS_FileInformation *fi; 290 struct GNUNET_FS_FileInformation *fi;
277 struct GNUNET_FS_Namespace *namespace; 291 struct GNUNET_FS_Namespace *namespace;
278 EXTRACTOR_ExtractorList *l; 292 struct EXTRACTOR_PluginList *l;
279 char *ex; 293 char *ex;
280 char *emsg; 294 char *emsg;
281 295
@@ -377,13 +391,13 @@ run (void *cls,
377 l = NULL; 391 l = NULL;
378 if (! disable_extractor) 392 if (! disable_extractor)
379 { 393 {
380 l = EXTRACTOR_loadDefaultLibraries (); 394 l = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
381 if (GNUNET_OK == 395 if (GNUNET_OK ==
382 GNUNET_CONFIGURATION_get_value_string (cfg, "FS", "EXTRACTORS", 396 GNUNET_CONFIGURATION_get_value_string (cfg, "FS", "EXTRACTORS",
383 &ex)) 397 &ex))
384 { 398 {
385 if (strlen (ex) > 0) 399 if (strlen (ex) > 0)
386 l = EXTRACTOR_loadConfigLibraries (l, ex); 400 l = EXTRACTOR_plugin_add_config (l, ex, EXTRACTOR_OPTION_DEFAULT_POLICY);
387 GNUNET_free (ex); 401 GNUNET_free (ex);
388 } 402 }
389 } 403 }
@@ -396,7 +410,7 @@ run (void *cls,
396 priority, 410 priority,
397 GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION), 411 GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION),
398 &emsg); 412 &emsg);
399 EXTRACTOR_removeAll (l); 413 EXTRACTOR_plugin_remove_all (l);
400 if (fi == NULL) 414 if (fi == NULL)
401 { 415 {
402 fprintf (stderr, 416 fprintf (stderr,