diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk_event-handler.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c index cab95366..030f5e88 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.c +++ b/src/fs/gnunet-fs-gtk_event-handler.c | |||
@@ -978,23 +978,33 @@ struct sks_scanner_callback_context | |||
978 | void *cls; | 978 | void *cls; |
979 | }; | 979 | }; |
980 | 980 | ||
981 | /* Metadata callback. Checks metadata item for being an SKS URI, | 981 | |
982 | /** | ||
983 | * Metadata callback. Checks metadata item for being an SKS URI, | ||
982 | * invokes the callback if so. | 984 | * invokes the callback if so. |
985 | * | ||
986 | * @return GNUNET_OK if we did not invoke the callback, otherwise | ||
987 | * whatever the callback returned | ||
983 | */ | 988 | */ |
984 | static int | 989 | static int |
985 | check_for_embedded_sks (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type, | 990 | check_for_embedded_sks (void *cls, |
986 | enum EXTRACTOR_MetaFormat format, const char *data_mime_type, | 991 | const char *plugin_name, |
987 | const char *data, size_t data_size) | 992 | enum EXTRACTOR_MetaType type, |
993 | enum EXTRACTOR_MetaFormat format, | ||
994 | const char *data_mime_type, | ||
995 | const char *data, size_t data_size) | ||
988 | { | 996 | { |
989 | struct sks_scanner_callback_context *ctx = cls; | 997 | struct sks_scanner_callback_context *ctx = cls; |
990 | int result; | 998 | int result; |
991 | 999 | ||
1000 | result = GNUNET_OK; | ||
992 | if ((EXTRACTOR_METATYPE_URI == type) && | 1001 | if ((EXTRACTOR_METATYPE_URI == type) && |
993 | (EXTRACTOR_METAFORMAT_UTF8 == format) && | 1002 | (EXTRACTOR_METAFORMAT_UTF8 == format) && |
994 | (data_mime_type && (0 == strcmp ("text/plain", data_mime_type)))) | 1003 | (data_mime_type && (0 == strcmp ("text/plain", data_mime_type)))) |
995 | { | 1004 | { |
996 | struct GNUNET_FS_Uri *sks_uri; | 1005 | struct GNUNET_FS_Uri *sks_uri; |
997 | char *emsg; | 1006 | char *emsg; |
1007 | |||
998 | emsg = NULL; | 1008 | emsg = NULL; |
999 | sks_uri = GNUNET_FS_uri_parse (data, &emsg); | 1009 | sks_uri = GNUNET_FS_uri_parse (data, &emsg); |
1000 | if (NULL != sks_uri) | 1010 | if (NULL != sks_uri) |
@@ -1018,16 +1028,23 @@ check_for_embedded_sks (void *cls, const char *plugin_name, enum EXTRACTOR_MetaT | |||
1018 | return result; | 1028 | return result; |
1019 | } | 1029 | } |
1020 | 1030 | ||
1021 | /* Search metadata for SKS URIs, invoke the callback for each one. */ | 1031 | |
1032 | /** | ||
1033 | * Search metadata for SKS URIs, invoke the callback for each one. | ||
1034 | */ | ||
1022 | static void | 1035 | static void |
1023 | find_embedded_sks (const struct GNUNET_CONTAINER_MetaData *meta, embedded_sks_callback cb, void *cls) | 1036 | find_embedded_sks (const struct GNUNET_CONTAINER_MetaData *meta, |
1037 | embedded_sks_callback cb, void *cls) | ||
1024 | { | 1038 | { |
1025 | struct sks_scanner_callback_context ctx; | 1039 | struct sks_scanner_callback_context ctx; |
1040 | |||
1026 | ctx.cb = cb; | 1041 | ctx.cb = cb; |
1027 | ctx.cls = cls; | 1042 | ctx.cls = cls; |
1028 | GNUNET_CONTAINER_meta_data_iterate (meta, check_for_embedded_sks, &ctx); | 1043 | GNUNET_CONTAINER_meta_data_iterate (meta, |
1044 | &check_for_embedded_sks, &ctx); | ||
1029 | } | 1045 | } |
1030 | 1046 | ||
1047 | |||
1031 | struct sks_population_context | 1048 | struct sks_population_context |
1032 | { | 1049 | { |
1033 | GtkMenu *menu; | 1050 | GtkMenu *menu; |
@@ -2143,11 +2160,16 @@ update_search_result (struct SearchResult *sr, | |||
2143 | gtk_tree_path_free (tp); | 2160 | gtk_tree_path_free (tp); |
2144 | } | 2161 | } |
2145 | 2162 | ||
2163 | |||
2146 | static int | 2164 | static int |
2147 | see_if_there_are_any_sks_uris (void *cls, const struct GNUNET_FS_Uri *sks_uri, | 2165 | see_if_there_are_any_sks_uris (void *cls, |
2148 | const char *sks_uri_string, struct GNUNET_FS_PseudonymIdentifier *nsid) | 2166 | const struct GNUNET_FS_Uri *sks_uri, |
2167 | const char *sks_uri_string, | ||
2168 | struct GNUNET_FS_PseudonymIdentifier *nsid) | ||
2149 | { | 2169 | { |
2150 | * ((gboolean *) cls) = TRUE; | 2170 | gboolean *gb = cls; |
2171 | |||
2172 | *gb = TRUE; | ||
2151 | return GNUNET_SYSERR; | 2173 | return GNUNET_SYSERR; |
2152 | } | 2174 | } |
2153 | 2175 | ||
@@ -2231,7 +2253,9 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab, | |||
2231 | desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup); | 2253 | desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup); |
2232 | pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta); | 2254 | pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta); |
2233 | 2255 | ||
2234 | find_embedded_sks (meta, see_if_there_are_any_sks_uris, &show_ns_association); | 2256 | find_embedded_sks (meta, |
2257 | &see_if_there_are_any_sks_uris, | ||
2258 | &show_ns_association); | ||
2235 | 2259 | ||
2236 | sr = GNUNET_new (struct SearchResult); | 2260 | sr = GNUNET_new (struct SearchResult); |
2237 | sr->result = result; | 2261 | sr->result = result; |
@@ -3695,7 +3719,8 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
3695 | const struct GNUNET_FS_ProgressInfo *info) | 3719 | const struct GNUNET_FS_ProgressInfo *info) |
3696 | { | 3720 | { |
3697 | void *ret; | 3721 | void *ret; |
3698 | 3722 | ||
3723 | GNUNET_FS_GTK_set_fs_handle (info->fsh); | ||
3699 | switch (info->status) | 3724 | switch (info->status) |
3700 | { | 3725 | { |
3701 | case GNUNET_FS_STATUS_PUBLISH_START: | 3726 | case GNUNET_FS_STATUS_PUBLISH_START: |