Re: [Ekiga-devel-list] Ekiga address book searching by URI



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) : eugen dedu org
    E-mail (this is an uri) : eugen dedu dedu org
    E-mail (this is an uri) : eugen dedu ekiga net
    E-mail (this is an uri) : eugen dedu hotmail com
    E-mail (this is an uri) : dedu gmail com
    SIP (this is an uri)    : eugen dedu ekiga net
    SIP (this is an uri)    : eugen dedu dedu org
    SIP (this is an uri)    : eugen dedu org
    XMPP (this is an uri)   : eugen dedu org
    XMPP (this is an uri)   : dedu jabber org
    XMPP (this is an uri)   : dedu 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 fish bowl com

- Fourth contact : (shared uri)
   Name : James Fish
   SIP  : family fish 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.

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),

Snark


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]