aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-02-27 06:51:31 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-02-27 23:59:55 +0800
commita36a3f418155be6b30a5cb9c92426473d04c100b (patch)
tree586b60265989f8974ea2db12812227096e2e5d25 /libemail-engine
parentd509f21104b58e7e255807c40cb19c1831e81cbd (diff)
downloadgsoc2013-evolution-a36a3f418155be6b30a5cb9c92426473d04c100b.tar
gsoc2013-evolution-a36a3f418155be6b30a5cb9c92426473d04c100b.tar.gz
gsoc2013-evolution-a36a3f418155be6b30a5cb9c92426473d04c100b.tar.bz2
gsoc2013-evolution-a36a3f418155be6b30a5cb9c92426473d04c100b.tar.lz
gsoc2013-evolution-a36a3f418155be6b30a5cb9c92426473d04c100b.tar.xz
gsoc2013-evolution-a36a3f418155be6b30a5cb9c92426473d04c100b.tar.zst
gsoc2013-evolution-a36a3f418155be6b30a5cb9c92426473d04c100b.zip
Remove em_utils_contact_photo().
No longer used.
Diffstat (limited to 'libemail-engine')
-rw-r--r--libemail-engine/e-mail-utils.c99
-rw-r--r--libemail-engine/e-mail-utils.h4
2 files changed, 0 insertions, 103 deletions
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index ba18f8a3b4..f385067caf 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -608,22 +608,6 @@ em_utils_in_addressbook (ESourceRegistry *registry,
registry, addr, local_only, NULL, NULL, cancellable);
}
-static gboolean
-extract_photo_data (EContact *contact,
- gpointer user_data)
-{
- EContactPhoto **photo = user_data;
-
- g_return_val_if_fail (contact != NULL, FALSE);
- g_return_val_if_fail (user_data != NULL, FALSE);
-
- *photo = e_contact_get (contact, E_CONTACT_PHOTO);
- if (!*photo)
- *photo = e_contact_get (contact, E_CONTACT_LOGO);
-
- return *photo != NULL;
-}
-
typedef struct _PhotoInfo {
gchar *address;
EContactPhoto *photo;
@@ -645,89 +629,6 @@ emu_free_photo_info (PhotoInfo *pi)
static ECancellableMutex photos_cache_lock;
static GSList *photos_cache = NULL; /* list of PhotoInfo-s */
-CamelMimePart *
-em_utils_contact_photo (ESourceRegistry *registry,
- CamelInternetAddress *cia,
- gboolean local_only,
- GCancellable *cancellable)
-{
- const gchar *addr = NULL;
- CamelMimePart *part = NULL;
- EContactPhoto *photo = NULL;
- GSList *p, *last = NULL;
- gint cache_len;
-
- g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
-
- if (cia == NULL || !camel_internet_address_get (cia, 0, NULL, &addr) || !addr) {
- return NULL;
- }
-
- if (!e_cancellable_mutex_lock (&photos_cache_lock, cancellable))
- return NULL;
-
- /* search a cache first */
- cache_len = 0;
- last = NULL;
- for (p = photos_cache; p; p = p->next) {
- PhotoInfo *pi = p->data;
-
- if (!pi)
- continue;
-
- if (g_ascii_strcasecmp (addr, pi->address) == 0) {
- photo = pi->photo;
- break;
- }
-
- cache_len++;
- last = p;
- }
-
- /* !p means the address had not been found in the cache */
- if (!p && search_address_in_addressbooks (
- registry, addr, local_only, extract_photo_data, &photo, cancellable)) {
-
- PhotoInfo *pi;
-
- /* keep only up to 10 photos in memory */
- if (last && (cache_len >= 10)) {
- pi = last->data;
- photos_cache = g_slist_remove (photos_cache, pi);
-
- if (pi)
- emu_free_photo_info (pi);
- }
-
- pi = g_new0 (PhotoInfo, 1);
- pi->address = g_strdup (addr);
- pi->photo = photo;
-
- photos_cache = g_slist_prepend (photos_cache, pi);
- }
-
- /* some photo found, use it */
- if (photo) {
- /* Form a mime part out of the photo */
- part = camel_mime_part_new ();
-
- if (photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
- camel_mime_part_set_content (
- part,
- (const gchar *) photo->data.inlined.data,
- photo->data.inlined.length, "image/jpeg");
- } else {
- gchar *s = g_filename_from_uri (photo->data.uri, NULL, NULL);
- camel_mime_part_set_filename (part, s);
- g_free (s);
- }
- }
-
- e_cancellable_mutex_unlock (&photos_cache_lock);
-
- return part;
-}
-
/* list of email addresses (strings) to remove from local cache of photos and
* contacts, but only if the photo doesn't exist or is an not-found contact */
void
diff --git a/libemail-engine/e-mail-utils.h b/libemail-engine/e-mail-utils.h
index 1844b49e36..9cde9ec276 100644
--- a/libemail-engine/e-mail-utils.h
+++ b/libemail-engine/e-mail-utils.h
@@ -37,10 +37,6 @@ gboolean em_utils_in_addressbook (ESourceRegistry *registry,
CamelInternetAddress *addr,
gboolean local_only,
GCancellable *cancellable);
-CamelMimePart * em_utils_contact_photo (ESourceRegistry *registry,
- CamelInternetAddress *addr,
- gboolean local,
- GCancellable *cancellable);
ESource * em_utils_guess_mail_account (ESourceRegistry *registry,
CamelMimeMessage *message,
CamelFolder *folder,