示例#1
0
/**
 * Initiates a browse host request to the currently selected host.
 */
void
on_popup_nodes_browse_host_activate(GtkMenuItem *unused_menuitem,
	gpointer unused_udata)
{
    GtkCList *clist = GTK_CLIST(gui_main_window_lookup("clist_nodes"));
    GSList *sl, *node_list;

    g_assert(clist != NULL);

	(void) unused_menuitem;
	(void) unused_udata;

    node_list = clist_collect_data(clist, TRUE, NULL);

	for (sl = node_list; sl != NULL; sl = g_slist_next(sl)) {
		const struct nid *handle = sl->data;
		gnet_node_info_t *info = guc_node_get_info(handle);

		if (!info)
			continue;

		if (!info->is_pseudo) {
			search_gui_new_browse_host(NULL, info->gnet_addr, info->gnet_port,
				&info->gnet_guid, NULL, info->is_g2 ? SOCK_F_G2 : 0);
		}
		guc_node_free_info(info);
	}
}
示例#2
0
/**
 * Request host browsing for the selected entries.
 */
void
search_gui_browse_selected(void)
{
    search_t *search;
	GtkCTree *ctree;
	GList *selected;
	GList *l;;

    search = search_gui_get_current_search();
    g_assert(search != NULL);

    ctree = GTK_CTREE(search->tree);
	selected = GTK_CLIST(ctree)->selection;

	if (selected == NULL) {
        statusbar_gui_message(15, "*** No search result selected! ***");
		return;
	}

	search_gui_option_menu_searches_freeze();
	for (l = selected; l != NULL; l = g_list_next(l)) {
		GtkCTreeNode *node = l->data;
		gui_record_t *grc;
		results_set_t *rs;
		record_t *rc;
		guint32 flags = 0;

		if (node == NULL)
			break;

		grc = gtk_ctree_node_get_row_data(ctree, node);
		rc = grc->shared_record;

		if (!rc)
			continue;

		rs = rc->results_set;
		flags |= 0 != (rs->status & ST_FIREWALL) ? SOCK_F_PUSH : 0;
		flags |= 0 != (rs->status & ST_TLS) ? SOCK_F_TLS : 0;
		flags |= ((rs->status & ST_G2) && T_GTKG != rs->vendor) ? SOCK_F_G2 : 0;

		(void) search_gui_new_browse_host(
				rs->hostname, rs->addr, rs->port,
				rs->guid, rs->proxies, flags);
	}
	search_gui_option_menu_searches_thaw();
}
示例#3
0
static inline void
nodes_gui_browse_selected_helper(GtkTreeModel *model,
		GtkTreePath *unused_path, GtkTreeIter *iter, gpointer unused_data)
{
	gnet_node_info_t *info;
	struct node_data *data;

	(void) unused_path;
	(void) unused_data;
	
	gtk_tree_model_get(model, iter, 0, &data, (-1));
	info = guc_node_get_info(data->node_id);
	if (!info->is_pseudo) {
		search_gui_new_browse_host(NULL, info->gnet_addr, info->gnet_port,
			&info->gnet_guid, NULL, info->is_g2 ? SOCK_F_G2 : 0);
	}
	guc_node_free_info(info);
}
示例#4
0
/**
 * Initiate a browse host of the uploading host.
 */
void
uploads_gui_browse_host(host_addr_t addr, guint16 port)
{
	if (host_addr_is_routable(addr) && port != 0)
		search_gui_new_browse_host(NULL, addr, port, NULL, NULL, 0);
}