Exemplo n.º 1
0
static GntWidget*
create_string_field(PurpleRequestField *field, GntWidget **screenname)
{
	const char *hint = purple_request_field_get_type_hint(field);
	GntWidget *entry = gnt_entry_new(
			purple_request_field_string_get_default_value(field));
	gnt_entry_set_masked(GNT_ENTRY(entry),
			purple_request_field_string_is_masked(field));
	if (hint && purple_str_has_prefix(hint, "screenname")) {
		PurpleBlistNode *node = purple_blist_get_root();
		gboolean offline = purple_str_has_suffix(hint, "all");
		for (; node; node = purple_blist_node_next(node, offline)) {
			if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
				continue;
			gnt_entry_add_suggest(GNT_ENTRY(entry), purple_buddy_get_name((PurpleBuddy*)node));
		}
		gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE);
		if (screenname)
			*screenname = entry;
	} else if (hint && !strcmp(hint, "group")) {
		PurpleBlistNode *node;
		for (node = purple_blist_get_root(); node;
				node = purple_blist_node_get_sibling_next(node)) {
			if (PURPLE_BLIST_NODE_IS_GROUP(node))
				gnt_entry_add_suggest(GNT_ENTRY(entry), purple_group_get_name((PurpleGroup *)node));
		}
	}
	return entry;
}
Exemplo n.º 2
0
static void
setup_buddy_list_suggestion(GntEntry *entry, gboolean offline)
{
	PurpleBlistNode *node = purple_blist_get_root();
	for (; node; node = purple_blist_node_next(node, offline)) {
		if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
			continue;
		gnt_entry_add_suggest(entry, purple_buddy_get_name((PurpleBuddy*)node));
	}
}