+set_content_hash_type_from_classes (EmpathyFTHandler *handler,
+ GList *classes)
+{
+ GValueArray *class;
+ GValue *v;
+ GList *l;
+ GArray *possible_values;
+ guint value;
+ GHashTable *fprops;
+ gboolean valid;
+ EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
+
+ possible_values = g_array_new (TRUE, TRUE, sizeof (guint));
+
+ for (l = classes; l != NULL; l = l->next)
+ {
+ class = l->data;
+ v = g_value_array_get_nth (class, 0);
+ fprops = g_value_get_boxed (v);
+
+ value = tp_asv_get_uint32
+ (fprops, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentHashType",
+ &valid);
+
+ if (valid)
+ g_array_append_val (possible_values, value);
+ }
+
+ if (possible_values->len == 1)
+ {
+ priv->content_hash_type = g_array_index (possible_values, guint, 0);
+ }
+ else
+ {
+ /* order the array and pick the first non zero, so that MD5
+ * is the preferred value.
+ */
+ g_array_sort (possible_values, empathy_uint_compare);
+
+ if (g_array_index (possible_values, guint, 0) == 0)
+ priv->content_hash_type = g_array_index (possible_values, guint, 1);
+ else
+ priv->content_hash_type = g_array_index (possible_values, guint, 0);
+ }
+
+ DEBUG ("Setting content hash type as %u", priv->content_hash_type);
+}
+
+static void
+find_ft_channel_class_cb (GList *channel_classes,