* Implement PhoneDetails on Tpf.Persona
* Implement NameDetails on Tpf.Persona
* Implement EmailDetails on Tpf.Persona
+* Implement UrlDetails on Tpf.Persona
Overview of changes from libfolks 0.6.3.1 to libfolks 0.6.3.2
=============================================================
ImDetails,
NameDetails,
PhoneDetails,
- PresenceDetails
+ PresenceDetails,
+ UrlDetails
{
private HashSet<string> _groups;
private Set<string> _groups_ro;
this._phone_numbers, "tel");
}
+ private HashSet<UrlFieldDetails> _urls;
+ private Set<UrlFieldDetails> _urls_ro;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @since UNRELEASED
+ */
+ [CCode (notify = false)]
+ public Set<UrlFieldDetails> urls
+ {
+ get { return this._urls_ro; }
+ set { this.change_urls.begin (value); }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @since UNRELEASED
+ */
+ public async void change_urls (Set<UrlFieldDetails> urls) throws PropertyError
+ {
+ yield this._change_details<UrlFieldDetails> (urls,
+ this._urls, "url");
+ }
+
private async void _change_details<T> (
Set<AbstractFieldDetails<string>> details,
Set<AbstractFieldDetails<string>> member_set,
(GLib.HashFunc) PhoneFieldDetails.hash,
(GLib.EqualFunc) PhoneFieldDetails.equal);
this._phone_numbers_ro = this._phone_numbers.read_only_view;
+ this._urls = new HashSet<UrlFieldDetails> (
+ (GLib.HashFunc) UrlFieldDetails.hash,
+ (GLib.EqualFunc) UrlFieldDetails.equal);
+ this._urls_ro = this._urls.read_only_view;
contact.notify["avatar-file"].connect ((s, p) =>
{
this._writeable_properties += "full-name";
if ("tel" in tpf_store.supported_fields)
this._writeable_properties += "phone-numbers";
+ if ("url" in tpf_store.supported_fields)
+ this._writeable_properties += "urls";
}
private void _contact_notify_contact_info ()
var new_phone_numbers = new HashSet<PhoneFieldDetails> (
(GLib.HashFunc) PhoneFieldDetails.hash,
(GLib.EqualFunc) PhoneFieldDetails.equal);
+ var new_urls = new HashSet<UrlFieldDetails> (
+ (GLib.HashFunc) UrlFieldDetails.hash,
+ (GLib.EqualFunc) UrlFieldDetails.equal);
var contact_info = this.contact.get_contact_info ();
foreach (var info in contact_info)
new_phone_numbers.add (phone_fd);
}
}
+ else if (info.field_name == "url")
+ {
+ foreach (var url in info.field_value)
+ {
+ var parameters = this._afd_params_from_strv (info.parameters);
+ var url_fd = new UrlFieldDetails (url, parameters);
+ new_urls.add (url_fd);
+ }
+ }
}
if (!Folks.Internal.equal_sets<EmailFieldDetails> (new_email_addresses,
this._phone_numbers_ro = new_phone_numbers.read_only_view;
this.notify_property ("phone-numbers");
}
+
+ if (!Folks.Internal.equal_sets<UrlFieldDetails> (new_urls, this._urls))
+ {
+ this._urls = new_urls;
+ this._urls_ro = new_urls.read_only_view;
+ this.notify_property ("urls");
+ }
}
private MultiMap<string, string> _afd_params_from_strv (string[] parameters)
G_TYPE_UINT, 0,
G_TYPE_UINT, G_MAXUINT32,
G_TYPE_INVALID));
+
+ g_ptr_array_add (supported_fields, tp_value_array_build (4,
+ G_TYPE_STRING, "url",
+ G_TYPE_STRV, NULL,
+ G_TYPE_UINT, 0,
+ G_TYPE_UINT, G_MAXUINT32,
+ G_TYPE_INVALID));
}
g_value_set_boxed (value, supported_fields);
}
_insert_contact_field (d->contact_info, "email", NULL,
(const gchar * const *) values);
}
+ {
+ const gchar * values[] = { "ocrete.example.com", NULL };
+ _insert_contact_field (d->contact_info, "url", NULL,
+ (const gchar * const *) values);
+ }
tp_handle_unref (self->priv->contact_repo, handle);
id = "travis@example.com";
assert (("full-name" in tpf_persona.writeable_properties));
assert (
("phone-numbers" in tpf_persona.writeable_properties));
+ assert ("urls" in tpf_persona.writeable_properties);
/* Check ContactInfo-provided properties */
assert (i.full_name == "");
assert (!("full-name" in tpf_persona.writeable_properties));
assert (
!("phone-numbers" in tpf_persona.writeable_properties));
+ assert (!("urls" in tpf_persona.writeable_properties));
/* Check ContactInfo-provided properties */
assert (new PhoneFieldDetails ("+15142345678")
assert (i.full_name == "Olivier Crete");
assert (new EmailFieldDetails ("olivier@example.com")
in i.email_addresses);
+ assert (new UrlFieldDetails ("ocrete.example.com") in i.urls);
}
}
this._changes_pending.add ("email-addresses");
this._changes_pending.add ("phone-numbers");
this._changes_pending.add ("full-name");
+ this._changes_pending.add ("urls");
/* Set up the aggregator */
var aggregator = new IndividualAggregator ();
var new_phone_fd = new PhoneFieldDetails ("+112233445566");
new_phone_fd.set_parameter (AbstractFieldDetails.PARAM_TYPE,
AbstractFieldDetails.PARAM_TYPE_HOME);
+ var new_url_fd = new UrlFieldDetails ("aperturescience.com/cave");
+ new_url_fd.set_parameter (AbstractFieldDetails.PARAM_TYPE,
+ AbstractFieldDetails.PARAM_TYPE_WORK);
var new_full_name = "Cave Johnson";
foreach (Individual i in added)
assert (!(new_email_fd in i.email_addresses));
assert (new_full_name != i.full_name);
assert (!(new_phone_fd in i.phone_numbers));
+ assert (!(new_url_fd in i.urls));
i.notify["email-addresses"].connect ((s, p) =>
{
}
});
+ i.notify["urls"].connect ((s, p) =>
+ {
+ /* we can't re-use i here due to Vala's implementation */
+ var ind = (Individual) s;
+
+ if (new_url_fd in ind.urls)
+ {
+ this._changes_pending.remove ("urls");
+ }
+ });
+
/* the contact list this aggregator is based upon has exactly 1
* Tpf.Persona per Individual */
Folks.Persona persona = null;
(GLib.HashFunc) PhoneFieldDetails.hash,
(GLib.EqualFunc) PhoneFieldDetails.equal);
phones.add (new_phone_fd);
+ var urls = new HashSet<UrlFieldDetails> (
+ (GLib.HashFunc) UrlFieldDetails.hash,
+ (GLib.EqualFunc) UrlFieldDetails.equal);
+ urls.add (new_url_fd);
/* set the extended info through Telepathy's ContactInfo interface and
* wait for it to hit our notification callback above */
}
if (!i.is_user)
+ uncaught_errors++;
+ try
+ {
+ yield ((Tpf.Persona) persona).change_urls (urls);
+ }
+ catch (PropertyError e3)
+ {
+ /* setting the extended info on a non-user is invalid for the
+ * Telepathy backend */
+ if (!i.is_user)
+ uncaught_errors--;
+ }
+
+ if (!i.is_user)
{
assert (uncaught_errors == 0);
}