<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -466,76 +466,14 @@ pecan_contact_set_buddy_icon (PecanContact *contact,
                               PecanBuffer *image)
 {
 #if defined(PECAN_CVR)
+#ifdef HAVE_LIBPURPLE
     MsnObject *msnobj;
 
     g_return_if_fail (contact);
 
-    msnobj = pecan_contact_get_object (contact);
-
-    if (!image)
-    {
-        pecan_contact_set_object (contact, NULL);
-        return;
-    }
-
-#ifdef HAVE_LIBPURPLE
-    {
-        PurpleCipherContext *ctx;
-        char *base64;
-        unsigned char digest[20];
-
-        if (!msnobj)
-        {
-            msnobj = msn_object_new ();
-            msn_object_set_local (msnobj);
-            msn_object_set_type (msnobj, MSN_OBJECT_USERTILE);
-            msn_object_set_location (msnobj, &quot;TFR2C2.tmp&quot;);
-            msn_object_set_creator (msnobj, pecan_contact_get_passport (contact));
-
-            pecan_contact_set_object (contact, msnobj);
-        }
-
-        msn_object_set_image (msnobj, image);
-
-        /* Compute the SHA1D field. */
-        memset (digest, 0, sizeof (digest));
-
-        ctx = purple_cipher_context_new_by_name (&quot;sha1&quot;, NULL);
-        purple_cipher_context_append (ctx, (const guchar *) image-&gt;data, image-&gt;size);
-        purple_cipher_context_digest (ctx, sizeof (digest), digest, NULL);
-
-        base64 = purple_base64_encode (digest, sizeof (digest));
-        msn_object_set_sha1d (msnobj, base64);
-        g_free (base64);
-
-        msn_object_set_size (msnobj, image-&gt;size);
-
-        {
-            gchar *buf;
-
-            /* Compute the SHA1C field. */
-            buf = pecan_strdup_printf (&quot;Creator%sSize%dType%dLocation%sFriendly%sSHA1D%s&quot;,
-                                       msn_object_get_creator (msnobj),
-                                       msn_object_get_size (msnobj),
-                                       msn_object_get_type (msnobj),
-                                       msn_object_get_location (msnobj),
-                                       msn_object_get_friendly (msnobj),
-                                       msn_object_get_sha1d (msnobj));
-
-            memset (digest, 0, sizeof (digest));
-
-            purple_cipher_context_reset (ctx, NULL);
-            purple_cipher_context_append (ctx, (const guchar *) buf, strlen (buf));
-            purple_cipher_context_digest (ctx, sizeof (digest), digest, NULL);
-            purple_cipher_context_destroy (ctx);
-
-            g_free (buf);
-        }
-
-        base64 = purple_base64_encode (digest, sizeof (digest));
-        msn_object_set_sha1c (msnobj, base64);
-        g_free (base64);
-    }
+    msnobj = msn_object_new_from_image (image, &quot;TFR2C2.tmp&quot;, pecan_contact_get_passport (contact),
+                                        MSN_OBJECT_USERTILE);
+    pecan_contact_set_object (contact, msnobj);
 #endif /* HAVE_LIBPURPLE */
 #endif /* defined(PECAN_CVR) */
 }</diff>
      <filename>ab/pecan_contact.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>144ccb0a585c8d3f15678d1c4721250880cc7573</id>
    </parent>
  </parents>
  <author>
    <name>Devid Antonio Filoni</name>
    <email>devidfil@gmail.com</email>
  </author>
  <url>http://github.com/felipec/msn-pecan/commit/3f40aebc1ab29801352866c187ebc081f7479d61</url>
  <id>3f40aebc1ab29801352866c187ebc081f7479d61</id>
  <committed-date>2009-05-30T07:30:47-07:00</committed-date>
  <authored-date>2009-05-30T06:05:40-07:00</authored-date>
  <message>ab/pecan_contact.c: cleanup.</message>
  <tree>d42a89281c588372ee9f9ca17021291ceaf50d3e</tree>
  <committer>
    <name>Felipe Contreras</name>
    <email>felipe.contreras@gmail.com</email>
  </committer>
</commit>
