Commit 73647bc6 authored by Raul Gutierrez Segales's avatar Raul Gutierrez Segales
Browse files

e-d-s: use UID instead of relative URI to track ESources

Some e-d-s backends (i.e.: the Exchange one) might not have
a relative URI so we can't rely on it as an address book
identifier. So from now on we use the ESource's UID.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=659732
parent 700c6523
......@@ -175,9 +175,8 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
continue;
}
var source_uri = s.peek_relative_uri ();
if (!this._persona_stores.has_key (source_uri))
var uid = s.peek_uid ();
if (!this._persona_stores.has_key (uid))
{
added_sources.add (s);
}
......@@ -197,12 +196,11 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
*/
private void _add_address_book (E.Source s)
{
string relative_uri = s.peek_relative_uri ();
if (this._persona_stores.has_key (relative_uri))
string uid = s.peek_uid ();
if (this._persona_stores.has_key (uid))
return;
debug ("Adding address book '%s'.", relative_uri);
debug ("Adding address book '%s'.", uid);
var store = new Edsf.PersonaStore (s);
......
......@@ -40,7 +40,6 @@ public class Edsf.PersonaStore : Folks.PersonaStore
private bool _is_quiescent = false;
private E.BookClient _addressbook;
private E.BookClientView _ebookview;
private string _addressbook_uri = null;
private E.SourceList? _source_list = null;
private E.Source _source;
private string _query_str;
......@@ -202,10 +201,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
*/
public PersonaStore (E.Source s)
{
string uri = s.peek_relative_uri ();
Object (id: uri, display_name: uri);
string eds_uid = s.peek_uid ();
Object (id: eds_uid, display_name: eds_uid);
this._source = s;
this._addressbook_uri = uri;
this._personas = new HashMap<string, Persona> ();
this._personas_ro = this._personas.read_only_view;
this._query_str = "(contains \"x-evolution-any-field\" \"\")";
......@@ -1878,8 +1876,7 @@ public class Edsf.PersonaStore : Folks.PersonaStore
{
foreach (var s in g.peek_sources ())
{
if (s.peek_relative_uri () == this.id &&
s.peek_uid () == this._addressbook.get_source ().peek_uid ())
if (s.peek_uid () == this.id)
{
/* We've found ourself. */
return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment