00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _gtk_search_common_h_
00027 #define _gtk_search_common_h_
00028
00029 #include "if/core/search.h"
00030 #include "if/ui/gtk/search.h"
00031
00032 void search_add_got_results_listener(search_got_results_listener_t l);
00033 void search_remove_got_results_listener(search_got_results_listener_t l);
00034
00035 #define TAB_UPDATE_TIME 5
00051 typedef struct results_set {
00052 gint refcount;
00054 gchar *guid;
00055 host_addr_t addr;
00056 guint16 port;
00057 guint16 status;
00058 guint16 speed;
00059 time_t stamp;
00060 union vendor_code vcode;
00061 gchar *version;
00062 gint country;
00063 gnet_host_vec_t *proxies;
00064 gchar *hostname;
00065 host_addr_t udp_addr;
00066 host_addr_t last_hop;
00068 guint32 num_recs;
00069 GSList *records;
00070 GSList *schl;
00071 } results_set_t;
00072
00076 typedef struct host_vec {
00077 gnet_host_t *hvec;
00078 gint hvcnt;
00079 } host_vec_t;
00080
00081 typedef enum {
00082 RECORD_MAGIC = 0x3fb9c04e
00083 } record_magic_t;
00084
00094 typedef struct record {
00095 results_set_t *results_set;
00096 gint refcount;
00097 record_magic_t magic;
00099 gchar *name;
00100 gchar *ext;
00101 gchar *utf8_name;
00102 const gchar *charset;
00103 filesize_t size;
00104 guint32 index;
00105 gchar *sha1;
00106 gchar *xml;
00107 gchar *tag;
00108 gchar *info;
00109 gnet_host_vec_t *alt_locs;
00110 flag_t flags;
00111 } record_t;
00112
00113 #include "search.h"
00114
00115
00116
00117
00118
00119 void search_matched(search_t *sch, results_set_t *rs);
00120
00121 void search_gui_common_init(void);
00122 void search_gui_common_shutdown(void);
00123
00124 search_t *search_gui_get_current_search(void);
00125 void search_gui_set_current_search(search_t *sch);
00126 void search_gui_forget_current_search(void);
00127 void search_gui_current_search(search_t *sch);
00128
00129 void search_gui_free_alt_locs(record_t *rc);
00130 void search_gui_host_vec_free(gnet_host_vec_t *v);
00131 gnet_host_vec_t *search_gui_proxies_clone(gnet_host_vec_t *v);
00132 void search_gui_free_proxies(results_set_t *rs);
00133 void search_gui_clean_r_set(results_set_t *rs);
00134 void search_gui_free_r_set(results_set_t *rs);
00135 void search_gui_dispose_results(results_set_t *rs);
00136 void search_gui_ref_record(record_t *rc);
00137 void search_gui_unref_record(record_t *rc);
00138 void search_gui_free_r_sets(search_t *sch);
00139 guint search_gui_hash_func(gconstpointer key);
00140 gint search_gui_hash_key_compare(gconstpointer a, gconstpointer b);
00141 void search_gui_remove_r_set(search_t *sch, results_set_t *rs);
00142 gboolean search_gui_result_is_dup(search_t *sch, record_t *rc);
00143 search_t *search_gui_find(gnet_search_t sh);
00144 gchar *search_gui_get_filename_extension(const gchar *filename_utf8);
00145 record_t *search_gui_create_record(results_set_t *rs, gnet_record_t *r) ;
00146 void search_gui_check_alt_locs(results_set_t *rs, record_t *rc);
00147 void search_gui_set_sort_defaults(void);
00148 void search_gui_store_searches(void);
00149 void search_gui_retrieve_searches(void);
00150 void search_gui_restart_search(search_t *sch);
00151 void search_gui_got_results(GSList *schl, const gnet_results_set_t *r_set);
00152 void search_gui_flush(time_t);
00153 const gchar *search_gui_parse_query(const gchar *querystr, GList **rules,
00154 const gchar **error);
00155 void search_gui_filter_new(search_t *sch, GList *rules);
00156
00157 gboolean search_gui_new_browse_host(
00158 const gchar *hostname, host_addr_t addr, guint16 port,
00159 const gchar *guid, gboolean push, const gnet_host_vec_t *proxies);
00160
00161 struct filter;
00162 void search_gui_add_targetted_search(gpointer data, gpointer unused_udata);
00163 void search_gui_update_items(const struct search *);
00164 gboolean search_gui_update_expiry(const struct search *sch);
00165 gboolean search_gui_is_expired(const struct search *sch);
00166 void search_gui_new_search_entered(void);
00167 void search_gui_option_menu_searches_update(void);
00168 void search_gui_option_menu_searches_select(const search_t *sch);
00169
00170 void search_gui_browse_selected(void);
00171
00172 gchar *search_xml_indent(const gchar *s);
00173
00174 void on_option_menu_search_changed(GtkOptionMenu *option_menu, gpointer unused_udata);
00175
00176 #endif
00177
00178