当前位置: 首页>>代码示例>>C++>>正文


C++ e_contact_get函数代码示例

本文整理汇总了C++中e_contact_get函数的典型用法代码示例。如果您正苦于以下问题:C++ e_contact_get函数的具体用法?C++ e_contact_get怎么用?C++ e_contact_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了e_contact_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: e_book_backend_db_cache_add_contact

/**
 * e_book_backend_db_cache_add_contact:
 * @db: DB Handle
 * @contact: an #EContact
 *
 * Adds @contact to @cache.
 *
 * Returns: %TRUE if the contact was cached successfully, %FALSE otherwise.
 **/
gboolean
e_book_backend_db_cache_add_contact (DB *db,
				     EContact *contact)
{
	DBT	uid_dbt, vcard_dbt;
	gint	db_error;
	gchar	*vcard_str;
	const gchar *uid;

	uid = e_contact_get_const (contact, E_CONTACT_UID);
	if (!uid) {
		printf ("no uid\n");
		printf("name:%s, email:%s\n",
			(gchar *)e_contact_get (contact, E_CONTACT_GIVEN_NAME),
			(gchar *)e_contact_get (contact, E_CONTACT_EMAIL_1));
		return FALSE;
	}
	string_to_dbt (uid, &uid_dbt);

	vcard_str = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
	string_to_dbt (vcard_str, &vcard_dbt);

	/* db_error = db->del (db, NULL, &uid_dbt, 0); */
	db_error = db->put (db, NULL, &uid_dbt, &vcard_dbt, 0);

	g_free (vcard_str);

	if (db_error != 0) {
		g_warning ("db->put failed with %d", db_error);
		return FALSE;
	}
	else
		return TRUE;
}
开发者ID:nobled,项目名称:evolution-data-server,代码行数:43,代码来源:e-book-backend-db-cache.c

示例2: fill_book_client

static gboolean
fill_book_client (EBookClient *book_client,
                  GSList **uids)
{
	EContact *contact;

	g_return_val_if_fail (book_client != NULL, FALSE);
	g_return_val_if_fail (uids != NULL, FALSE);

	*uids = NULL;

	if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact))
		return FALSE;

	*uids = g_slist_append (*uids, e_contact_get (contact, E_CONTACT_UID));
	g_object_unref (contact);

	if (!add_contact_from_test_case_verify (book_client, "simple-2", &contact))
		return FALSE;

	*uids = g_slist_append (*uids, e_contact_get (contact, E_CONTACT_UID));
	g_object_unref (contact);

	return TRUE;
}
开发者ID:jdapena,项目名称:evolution-data-server,代码行数:25,代码来源:test-client-remove-contacts.c

示例3: eds_receive_contacts_cb

static void
eds_receive_contacts_cb (EBook         *book,
			 EBookStatus    status,
			 GList         *contacts,
			 gpointer       user_data)
{
	GtkTreeIter        iter;
	GList             *l;
	GtkListStore      *model;
	PlannerPlugin     *plugin;
	PlannerPluginPriv *priv;
	GdkPixbuf         *pixbuf;
	AsyncQuery        *async_query;
	const gchar       *uid;
	gchar             *filename;

	async_query = (AsyncQuery *) user_data;

	uid = async_query->uid;
	plugin = async_query->plugin;
	priv = plugin->priv;
	model = GTK_LIST_STORE (priv->resources_model);

	g_free (async_query);

	if (eds_query_cancelled (plugin, uid)) {
		g_message ("Answer for query cancelled: %s", uid);
		return;
	}

	g_message ("Book status response: %d", status);
	g_message ("Answer for the query: %s", uid);

	/* Exceed limit is E_BOOK_ERROR_OTHER_ERROR :( */
	if (status == E_BOOK_ERROR_OK || status == E_BOOK_ERROR_OTHER_ERROR) {
		filename = mrp_paths_get_image_dir ("/resources.png");
		pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
		g_free (filename);
		for (l = contacts; l; l = l->next) {
			gchar *name, *email;
			name = e_contact_get (l->data, E_CONTACT_FULL_NAME);
			g_message ("Resource name: %s\n", name);
			email = e_contact_get (l->data, E_CONTACT_EMAIL_1);
			gtk_list_store_append (model, &iter);
			gtk_list_store_set (model, &iter,
					    COL_RESOURCE_NAME, name,
					    COL_RESOURCE_EMAIL, email,
					    COL_RESOURCE_SELECTED, FALSE,
					    COL_RESOURCE_PHOTO, pixbuf,
					    COL_RESOURCE_OBJECT, l->data, -1);
		}
	} else {
		g_warning ("Problem getting contacts ...");
	}

	eds_plugin_busy (plugin, FALSE);
}
开发者ID:00willo,项目名称:planner,代码行数:57,代码来源:planner-eds-plugin.c

示例4: addrbook_libebook_retrieve

/* retrieve a list of contacts from the address book */
static int
addrbook_libebook_retrieve(ship_list_t *list)
{
	int ret = -1;
	contact_t *ct = 0;
	GError *error = 0;
	GList *contacts = 0, *loop;
	EBookQuery *query = 0;

	ship_lock(addrbook_lock);
	ASSERT_TRUE(query = e_book_query_any_field_contains(""), err);
	ASSERT_TRUE(e_book_get_contacts(book, query, &contacts, &error), err);
	ASSERT_ZERO(error, err);

	for (loop = contacts; loop; loop = g_list_next(loop)) {
		EContact *c = loop->data;
		char *name = 0;
		
		name = e_contact_get(c, E_CONTACT_OSSO_CONTACT_STATE);
		if (!name || strcmp(name, "DELETED")) {
			char **arrs = 0;

			ASSERT_TRUE(ct = ident_contact_new(), cerr);
			ASSERT_TRUE(ct->name = e_contact_get(c, E_CONTACT_FULL_NAME), cerr);
			
			ASSERT_TRUE(arrs = e_contact_get(c, E_CONTACT_SIP), cerr);
			ASSERT_TRUE(ct->sip_aor = addrbook_normalize_aor(arrs[0]), cerr);
			
			/* apparently arrs doesn't need to be free'd afterwards */
			g_list_foreach((GList*)arrs, (GFunc)g_free, NULL);
			ship_list_add(list, ct);
			ct = 0;
		cerr:
			ident_contact_free(ct);
		}
		if (name)
			g_free(name);
	}
	ret = 0;
 err:
	if (contacts) {
		g_list_free(contacts);
	}
	
	if (query) {
		e_book_query_unref(query);
	}

	if (error) {
		LOG_ERROR("Error getting contacts: %s\n", error->message);
		g_error_free(error);
	}
	ship_unlock(addrbook_lock);

	return ret;
}
开发者ID:sksushilkumar,项目名称:p2pship,代码行数:57,代码来源:addrbook.c

示例5: bbdb_merge_buddy_to_contact

static gboolean
bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c)
{
	EContactField field;
	GList *ims, *l;
	gboolean dirty = FALSE;

	EContactPhoto *photo = NULL;

	GError *error = NULL;

	/* Set the IM account */
	field = proto_to_contact_field (b->proto);
	ims = e_contact_get (c, field);
	if (! im_list_contains_buddy (ims, b)) {
		ims = g_list_append (ims, (gpointer) b->account_name);
		e_contact_set (c, field, (gpointer) ims);
		dirty = TRUE;
	}

        /* Set the photo if it's not set */
	if (b->icon != NULL) {
		photo = e_contact_get (c, E_CONTACT_PHOTO);
		if (photo == NULL) {
			gchar *contents = NULL;

			photo = g_new0 (EContactPhoto, 1);
			photo->type = E_CONTACT_PHOTO_TYPE_INLINED;

			if (! g_file_get_contents (b->icon, &contents, &photo->data.inlined.length, &error)) {
				g_warning ("bbdb: Could not read buddy icon: %s\n", error->message);
				g_error_free (error);
				for (l = ims; l != NULL; l = l->next)
					g_free ((char *) l->data);
				g_list_free (ims);
				return dirty;
			}

			photo->data.inlined.data = (unsigned char *)contents;
			e_contact_set (c, E_CONTACT_PHOTO, (gpointer) photo);
			dirty = TRUE;
		}
	}

	/* Clean up */
	if (photo != NULL)
		e_contact_photo_free (photo);

	for (l = ims; l != NULL; l = l->next)
		g_free ((char *) l->data);
	g_list_free (ims);

	return dirty;
}
开发者ID:ebbywiselyn,项目名称:evolution,代码行数:54,代码来源:gaimbuddies.c

示例6: eds_ok_button_clicked

static void
eds_ok_button_clicked (GtkButton     *button,
		       PlannerPlugin *plugin)
{
	GtkTreeIter        iter;
	PlannerPluginPriv *priv = plugin->priv;
	GList             *resources_orig;

	/* We are going to modify the resources. Work with a copy */
	resources_orig = mrp_project_get_resources (plugin->priv->project);

	if (!priv->resources_model) {
		eds_dialog_close (plugin);
		return;
	}

	gtk_tree_model_get_iter_first (priv->resources_model, &iter);

	if (!gtk_list_store_iter_is_valid (GTK_LIST_STORE (priv->resources_model),
					   &iter)) {
		eds_dialog_close (plugin);
		return;
	}

	/* Custom property for e-d-s resource UID */
	if (!mrp_project_has_property (plugin->priv->project,
				       MRP_TYPE_RESOURCE, "eds-uid")) {
		eds_create_uid_property (plugin);
	}

	do {
		EContact *contact;
		gboolean  selected;

		gtk_tree_model_get (priv->resources_model, &iter,
				    COL_RESOURCE_SELECTED, &selected,
				    COL_RESOURCE_OBJECT, &contact,
				    -1);

		if (selected) {
			gchar *name = e_contact_get (contact, E_CONTACT_FULL_NAME);
			gchar *email = e_contact_get (contact, E_CONTACT_EMAIL_1);
			gchar *eds_uid = e_contact_get (contact, E_CONTACT_UID);
			eds_import_resource (name, email, eds_uid, plugin, resources_orig);
			g_free (name);
			g_free (email);
			g_free (eds_uid);
		}
	} while (gtk_tree_model_iter_next (priv->resources_model, &iter));

	eds_dialog_close (plugin);
}
开发者ID:00willo,项目名称:planner,代码行数:52,代码来源:planner-eds-plugin.c

示例7: compare_im

static gboolean
compare_im (EContact *contact,
            const gchar *str,
            gchar * (*compare) (const gchar *,
                                const gchar *),
            EContactField im_field)
{
	GList    *aims, *l;
	gboolean  found_it = FALSE;

	aims = e_contact_get (contact, im_field);

	for (l = aims; l != NULL; l = l->next) {
		gchar *im = (gchar *) l->data;

		if (im && compare (im, str)) {
			found_it = TRUE;
			break;
		}
	}

	g_list_foreach (aims, (GFunc) g_free, NULL);
	g_list_free (aims);

	return found_it;
}
开发者ID:gcampax,项目名称:evolution-data-server,代码行数:26,代码来源:e-book-backend-sexp.c

示例8: eds_contacts_added_cb

static void eds_contacts_added_cb(EBookView *view, const GList *contacts, gpointer data)
{
  const GList *walk;
  GList **address_list = (GList**) data;

  for(walk = contacts; walk; walk = walk->next) {
    const char *name;
    GList *email_list, *email_entry;
    EContact *contact = walk->data;

    if(!E_IS_CONTACT(contact))
      continue;

    name = e_contact_get_const(contact, E_CONTACT_FULL_NAME);
    email_list = e_contact_get(contact, E_CONTACT_EMAIL);
    for(email_entry = email_list; email_entry; email_entry = email_entry->next) {
      address_entry *ae;
      const char *email_address = email_entry->data;

      ae = g_new0(address_entry, 1);
      ae->name = g_strdup(name);
      ae->address = g_strdup(email_address);
      ae->grp_emails = NULL;
      *address_list = g_list_prepend(*address_list, ae);

      addr_compl_add_address1(name, ae);
      if(email_address && *email_address != '\0')
        addr_compl_add_address1(email_address, ae);
    }
  }
}
开发者ID:twolife,项目名称:claws_mail_gnome_plugin,代码行数:31,代码来源:gnome_plugin.c

示例9: make_string_from_list

static gchar *
make_string_from_list (EContact *contact,
                       EContactField field)
{
	GList *values, *l;
	GString *string;

	string = g_string_new ("<span size=\"x-small\">");
	values = e_contact_get (contact, field);

	for (l = values; l; l = l->next) {
		gchar *value = (gchar *) l->data;

		if (l->prev != NULL)
			g_string_append (string, ", ");

		g_string_append (string, value);
	}

	if (!values)
		g_string_append (string, " - none - ");

	e_contact_attr_list_free (values);
	g_string_append (string, "</span>");

	return g_string_free (string, FALSE);
}
开发者ID:Distrotech,项目名称:evolution-data-server,代码行数:27,代码来源:cursor-slot.c

示例10: gevo_get_email_for_buddy

char *
gevo_get_email_for_buddy(PurpleBuddy *buddy)
{
	EContact *contact;
	char *mail = NULL;

	contact = gevo_search_buddy_in_contacts(buddy, NULL);

	if (contact != NULL)
	{
		mail = g_strdup(e_contact_get(contact, E_CONTACT_EMAIL_1));
		g_object_unref(contact);
	}

	if (mail == NULL)
	{
		PurpleAccount *account = purple_buddy_get_account(buddy);
		const char *prpl_id = purple_account_get_protocol_id(account);

		if (!strcmp(prpl_id, "prpl-msn"))
		{
			mail = g_strdup(purple_normalize(account,
										   purple_buddy_get_name(buddy)));
		}
		else if (!strcmp(prpl_id, "prpl-yahoo"))
		{
			mail = g_strdup_printf("%[email protected]",
								   purple_normalize(account,
												  purple_buddy_get_name(buddy)));
		}
	}

	return mail;
}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:34,代码来源:gevo-util.c

示例11: give_james_brown_micheal_jacksons_face

/* This provokes the backend to handle a cross-referenced photo
 * between contacts, how the backend handles this is it's choice,
 * we should test that when deleting one of the contacts, the other
 * contact does not lose it's photo on disk as a result.
 */
static void
give_james_brown_micheal_jacksons_face (EBookClient *book)
{
	EContact       *micheal = NULL, *james = NULL;
	EContactPhoto  *micheal_face;
	EContactPhoto  *james_face;
	GError         *error = NULL;

	if (!e_book_client_get_contact_sync (book, micheal_jackson_uid, &micheal, NULL, &error))
	  g_error ("Unable to get micheal jackson's contact information: %s", error->message);

	if (!e_book_client_get_contact_sync (book, james_brown_uid, &james, NULL, &error))
	  g_error ("Unable to get james brown's contact information: %s", error->message);

	g_assert (micheal);
	g_assert (james);

	micheal_face = e_contact_get (micheal, E_CONTACT_PHOTO);
	g_assert (micheal_face->type == E_CONTACT_PHOTO_TYPE_URI);

	james_face  = g_new (EContactPhoto, 1);
	james_face->type     = E_CONTACT_PHOTO_TYPE_URI;
	james_face->data.uri = g_strdup (micheal_face->data.uri);

	e_contact_set (james, E_CONTACT_PHOTO, james_face);

	g_print ("Giving james brown micheal jacksons face: %s\n", micheal_face->data.uri);

	if (!e_book_client_modify_contact_sync (book, james, NULL, &error))
		g_error ("Failed to modify contact with cross referenced photo: %s", error->message);
}
开发者ID:gcampax,项目名称:evolution-data-server,代码行数:36,代码来源:test-client-photo-is-uri.c

示例12: includes_contact

static gboolean
includes_contact (HitoGroup *group, EContact *contact)
{
  HitoCategoryGroupPrivate *priv;
  GList *categories, *l;
  gboolean visible = FALSE;

  g_return_val_if_fail (HITO_IS_CATEGORY_GROUP (group), FALSE);
  g_return_val_if_fail (E_IS_CONTACT (contact), FALSE);

  priv = GET_PRIVATE (group);

  categories = e_contact_get (contact, E_CONTACT_CATEGORY_LIST);
  for (l = categories; l ; l = l->next) {
    /* TODO: strmp? or funky decomposition compare? */
    if (strcmp (priv->name, l->data) == 0) {
      visible = TRUE;
      break;
    }
  }
  g_list_foreach (categories, (GFunc)g_free, NULL);
  g_list_free (categories);

  return visible;
}
开发者ID:shr-project,项目名称:shr,代码行数:25,代码来源:hito-category-group.c

示例13: add_contact_inline

static void
add_contact_inline (EBookClient *book)
{
	EContact *contact;
	EContactPhoto *photo;
	guchar *data;
	gsize length = 0;

	contact = e_contact_new ();

	data = g_base64_decode (photo_data, &length);

	photo = g_new (EContactPhoto, 1);
	photo->type = E_CONTACT_PHOTO_TYPE_INLINED;
	photo->data.inlined.mime_type = NULL;
	photo->data.inlined.data = data;
	photo->data.inlined.length = length;

	/* set the photo */
	e_contact_set (contact, E_CONTACT_PHOTO, photo);
	e_contact_set (contact, E_CONTACT_FULL_NAME, "Micheal Jackson");

	if (!add_contact_verify  (book, contact))
		g_error ("Failed to add contact");

	micheal_jackson_uid = e_contact_get (contact, E_CONTACT_UID);
}
开发者ID:gcampax,项目名称:evolution-data-server,代码行数:27,代码来源:test-client-photo-is-uri.c

示例14: test_remove_contact_sync

static void
test_remove_contact_sync (ETestServerFixture *fixture,
                          gconstpointer user_data)
{
	EBookClient *book_client;
	GError *error = NULL;
	EContact *contact = NULL;
	gchar *uid;

	book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);

	if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact))
		g_error ("Failed to add contact");

	uid = e_contact_get (contact, E_CONTACT_UID);

	if (!e_book_client_remove_contact_sync (book_client, contact, NULL, &error))
		g_error ("remove contact sync: %s", error->message);

	g_object_unref (contact);

	check_removed_contact (book_client, uid);

	g_free (uid);
}
开发者ID:jdapena,项目名称:evolution-data-server,代码行数:25,代码来源:test-client-remove-contact.c

示例15: add_record

static gint
add_record (GnomePilotConduitSyncAbs *conduit,
	    GnomePilotRecord *remote,
	    EAddrConduitContext *ctxt)
{
	EContact *contact;
	int retval = 0;

	g_return_val_if_fail (remote != NULL, -1);

	LOG (g_message ( "add_record: adding %s to desktop\n", print_remote (remote) ));

	contact = ecard_from_remote_record (ctxt, remote, NULL);

	/* add the ecard to the server */
	if (!e_book_add_contact (ctxt->ebook, contact, NULL)) {
		WARN ("add_record: failed to add card to ebook\n");
		g_object_unref (contact);

		return -1;
	}

	e_pilot_map_insert (ctxt->map, remote->ID, e_contact_get (contact, E_CONTACT_UID), FALSE);

	g_object_unref (contact);

	return retval;
}
开发者ID:ebbywiselyn,项目名称:evolution,代码行数:28,代码来源:address-conduit.c


注:本文中的e_contact_get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。