empathy r1774 - trunk/libempathy
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r1774 - trunk/libempathy
- Date: Fri, 21 Nov 2008 16:16:10 +0000 (UTC)
Author: xclaesse
Date: Fri Nov 21 16:16:10 2008
New Revision: 1774
URL: http://svn.gnome.org/viewvc/empathy?rev=1774&view=rev
Log:
Added ability to get an md5sum of the file being sent using GChecksum. (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>
Modified:
trunk/libempathy/empathy-utils.c
Modified: trunk/libempathy/empathy-utils.c
==============================================================================
--- trunk/libempathy/empathy-utils.c (original)
+++ trunk/libempathy/empathy-utils.c Fri Nov 21 16:16:10 2008
@@ -795,6 +795,11 @@
GValue value = { 0 };
gchar *filename;
+ /* for getting ContentMD5 */
+ gsize checksum_length;
+ gchar *checksum_data;
+ gchar *checksum_hex;
+
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
g_return_val_if_fail (G_IS_FILE (gfile), NULL);
@@ -847,7 +852,24 @@
&value, NULL, NULL);
g_value_reset (&value);
- g_value_set_string (&value, "foobar");
+
+ if (g_file_get_contents (g_file_get_path (gfile),
+ &checksum_data, &checksum_length, &error)) {
+
+ checksum_hex = g_compute_checksum_for_data (G_CHECKSUM_MD5,
+ (guchar *) checksum_data,
+ (gssize) checksum_length);
+ g_free (checksum_data);
+ DEBUG ("Got a checksum: %s", checksum_hex);
+ } else {
+ DEBUG ("Couldn't get file contents for checksum: %s",
+ error ? error->message : "No error given");
+ g_clear_error (&error);
+ checksum_hex = "";
+ }
+
+ g_value_set_string (&value, checksum_hex);
+ g_free (checksum_hex);
tp_cli_dbus_properties_run_set (TP_PROXY (channel),
-1, EMP_IFACE_CHANNEL_TYPE_FILE, "ContentMD5",
&value, NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]