if (k == Folks.PersonaStore.detail_key (
PersonaDetail.FULL_NAME))
{
- contact.set (E.Contact.field_id ("full_name"),
- v.get_string ());
+ var full_name = v.get_string ();
+ if (full_name == "")
+ {
+ full_name = null;
+ }
+
+ contact.set (E.Contact.field_id ("full_name"), full_name);
}
else if (k == Folks.PersonaStore.detail_key (
PersonaDetail.EMAIL_ADDRESSES))
internal async void _set_full_name (Edsf.Persona persona,
string full_name) throws PropertyError
{
+ if (full_name == "")
+ {
+ full_name = null;
+ }
+
if (persona.full_name == full_name)
return;
internal async void _set_nickname (Edsf.Persona persona, string nickname)
throws PropertyError
{
+ if (nickname == "")
+ {
+ nickname = null;
+ }
+
if (persona.nickname == nickname)
return;
private void _update_names ()
{
string full_name = (string) this._get_property ("full_name");
+
+ if (full_name == null)
+ {
+ full_name = "";
+ }
+
if (this._full_name != full_name)
{
this._full_name = full_name;
}
string nickname = (string) this._get_property ("nickname");
- if (this.nickname != nickname)
+
+ if (nickname == null)
+ {
+ nickname = "";
+ }
+
+ if (this._nickname != nickname)
{
this._nickname = nickname;
this.notify_property ("nickname");
private unowned GLib.KeyFile _key_file;
private HashMultiMap<string, ImFieldDetails> _im_addresses;
private HashMultiMap<string, WebServiceFieldDetails> _web_service_addresses;
- private string _alias;
+ private string _alias = ""; /* must not be null */
private const string[] _linkable_properties =
{
"im-addresses",
*/
public async void change_alias (string alias) throws PropertyError
{
+ /* Deal with badly-behaved callers. */
+ if (alias == null)
+ {
+ alias = "";
+ }
+
if (this._alias == alias)
{
return;
{
this._alias = this._key_file.get_string (this.display_id,
key);
+
+ if (this._alias == null)
+ {
+ this._alias = "";
+ }
+
debug (" Loaded alias '%s'.", this._alias);
continue;
}
public void update (Contact contact)
{
var nickname = contact.get_value ("name");
- if (nickname != null && this._nickname != nickname)
+
+ if (nickname == null)
+ {
+ nickname = "";
+ }
+
+ if (this._nickname != nickname)
{
this._nickname = nickname;
this.notify_property ("nickname");
}
var full_name = contact.get_value ("fn");
+
+ if (full_name == null)
+ {
+ full_name = "";
+ }
+
if (this._full_name != full_name)
{
this._full_name = full_name;
internal async void change_alias (Tpf.Persona persona, string alias)
{
+ /* Deal with badly-behaved callers */
+ if (alias == null)
+ {
+ alias = "";
+ }
+
debug ("Changing alias of persona %u to '%s'.", persona.contact.handle,
alias);
FolksTpLowlevel.connection_set_contact_alias (this._conn,
private HashSet<string> _groups;
private Set<string> _groups_ro;
private bool _is_favourite;
- private string _alias;
+ private string _alias; /* must never be null */
private HashMultiMap<string, ImFieldDetails> _im_addresses;
private const string[] _linkable_properties = { "im-addresses" };
private const string[] _writeable_properties =
contact.notify["alias"].connect ((s, p) =>
{
+ /* Tp guarantees that aliases are always non-null. */
+ assert (this.contact.alias != null);
+
if (this._alias != this.contact.alias)
{
this._alias = this.contact.alias;
this._groups_ro = this._groups.read_only_view;
// Other properties
+ if (alias == null)
+ {
+ /* Deal with badly-behaved callers */
+ alias = "";
+ }
+
this._alias = alias;
this._is_favourite = is_favourite;
this.is_in_contact_list = is_in_contact_list;
UrlDetails,
WebServiceDetails
{
- private string _nickname;
+ private string _nickname; /* must never be null */
private bool _is_favourite;
private const string[] _linkable_properties =
{"im-addresses", "local-ids", "web-service-addresses"};
if (cursor != null)
{
fullname = cursor.get_string (Trf.Fields.FULL_NAME).dup ();
+ if (fullname == null)
+ {
+ fullname = "";
+ }
+
var contact_urn = cursor.get_string (Trf.Fields.CONTACT_URN);
if (contact_urn == Trf.OntologyDefs.DEFAULT_CONTACT_URN)
{
internal void _update_full_name (string? fn)
{
- if (fn != null && this.full_name != fn)
+ if (fn == null)
+ {
+ fn = "";
+ }
+
+ if (this._full_name != fn)
{
this._full_name = fn;
this.notify_property ("full-name");
internal void _update_nickname (string? nickname)
{
- if (nickname != null && this._nickname != nickname)
+ if (nickname == null)
+ {
+ nickname = "";
+ }
+
+ if (this._nickname != nickname)
{
this._nickname = nickname;
this.notify_property ("nickname");
*
* An alias is a user-given name, to be used in UIs as the sole way to
* represent the contact to the user.
+ *
+ * This may not be `null`: an empty string represents an unset alias.
*/
public abstract string alias { get; set; }
* The full name could or could not contain additional names (like a
* middle name), prefixes or suffixes.
*
+ * The full name must not be `null`: the empty string represents an unset full
+ * name.
+ *
* @since 0.3.5
*/
public abstract string full_name { get; set; }
* address book when updating the information a contact has specified about
* themselves.
*
+ * The nickname must not be `null`: the empty string represents an unset
+ * nickname.
+ *
* @since 0.3.5
*/
public abstract string nickname { get; set; }