On 16/11/10 08:13, Julien Puydt wrote:
Le 15/11/2010 21:33, Eugen Dedu a écrit :
On 15/11/10 21:32, Julien Puydt wrote:
Le 15/11/2010 21:25, Eugen Dedu a écrit :
On 15/11/10 21:15, Julien Puydt wrote:
What about only the has_uri... and the UI code does the looping [and
hence may stop at any point] ?

Hmm, I would rather say let's have a function get_contact_by_uri which
does the loop; the has_uri is optional (it can be or not).

What do you do in your loop without the has_uri ?

Well, check if it has an URI directly, without using a has_uri function.
But maybe this cannot be done, you know better than me.

Let's create an imaginary but realistic addressbook.

- First contact : (that one has many uris)
Name : Eugen Dedu
E-mail (this is an uri) : eu...@dedu.org
E-mail (this is an uri) : eugen.d...@dedu.org
E-mail (this is an uri) : eugen.d...@ekiga.net
E-mail (this is an uri) : eugen.d...@hotmail.com
E-mail (this is an uri) : d...@gmail.com
SIP (this is an uri) : eugen.d...@ekiga.net
SIP (this is an uri) : eugen.d...@dedu.org
SIP (this is an uri) : eu...@dedu.org
XMPP (this is an uri) : eu...@dedu.org
XMPP (this is an uri) : d...@jabber.org
XMPP (this is an uri) : d...@jabber.fr
Adress : somewhere in France

- Second contact (she's 107 years old, never seen a computer, but reads
her snail mail just fine -- not a single uri) :
Name : Cassandra North
Address : somewhere in Canada -- of course in the north!

- Third contact : (shared uri)
Name : Felicia Fish
SIP : family.f...@bowl.com

- Fourth contact : (shared uri)
Name : James Fish
SIP : family.f...@bowl.com

Now we see something like :
const std::string get_uri () const;
doesn't fly : sometimes we have many to return, and sometimes none.

Only this one seems the best for me, since it so simple... If no match, return "", elsewhere return the contact (if only 1) or one of them (the first found for ex.) There is no problem if Felicia Fish and James Fish cannot be distinguished.

I would also call the function get_name for ex.

We also see that a method like :
Ekiga::ContactPtr get_contact_for_uri (const std::string) const;
doesn't work either : sometimes there are several contacts with the same
uri. But it handles the case where there is no matching contact just fine.

We also see that with a simple :
bool has_uri (const std::string) const;
then we will be able to detect both failures : the loop will give
nothing ; and if it gives several matches, we will have them too. In
that last case, we can decide which to show (or : all of them...).

I hope it makes my point clear (again),
_______________________________________________
ekiga-devel-list mailing list
ekiga-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/ekiga-devel-list

Reply via email to