[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kopete-devel
Subject:    Re: [Kopete-devel] [Long] next release
From:       Andres Krapf <dae () chez ! com>
Date:       2002-04-29 18:55:47
[Download RAW message or body]

On Monday 29 April 2002 20:14, Martijn Klingens wrote:
> I think QMap is one of the best approaches for a clean design (or QList, or
> QWhatever, at least maintaining the list internally to the plugin), but I
> agree that it is quite a lot of work to do that. I know from personal

no, whether to use a QMap internally or not is a plugin implementation detail, 
not a design decision. if by good OO you mean being able to m_contact[name], 
the same semantics could be achieved with another design. the real design 
decision is whether we want to make a service available to all plugins to do 
the mapping or let each plugin do it's own.

i think each plugin doing it's own is more bug prone.. and i usually think 
it's better to let the framework do work if possible...

> > now i want to introdutce KMM in the AIM plugin. so i need to do my
> > mapping right. if i go the QMap way, i'll have to track every place of
> > (creation|modification|deletion) of contacts inside the plugin, to also
> > update my QMap. that's what i mean by syncing.
>
> If the design of the code is already clean and object oriented that would
> be easy. Otherwise it will be a true pain.

i don't know enough about the plugins to go through that... i'll have to leave 
this to the plugin authors.

> AIMContact *ac = dynamic_cast<AIMContact *>( contact );
> if( !ac )
>   kdDebug() << "Not an AIM contact!" << endl;
> else
>   // search through list for the contact with aimId() == ac->aimId();

my problem is not how i access the list mapping, it's how the list gets 
created/updated. that's what the pain in the ass would be for aim/icq... at 
least for me, since i don't know the plugins well.

> Note that dynamic_cast is FORBIDDEN across dlopened code like plugins, you
> should use qt_cast there, but inside a plugin itself it's safe. Don't ever
> do it from libkopete to a plugin, though!

thanks for the tip !

> > i hadn't thought of that, but using UniqueId would allow you to do
> > something like KopeteContact->getUniqueId(), dynamic cast this and then
> > ->getProtocolId()
>
> MSNProtocol::protocol(), anyone? ;-)

nope, that's not it... i meant KopeteContact->getUniqueId(), dynamic cast this 
and then ->getProtocolSpecificIdAssociatedWithTheContact().
reverse mapping, that is.

cheers,

-- 
Andres
_______________________________________________
Kopete-devel mailing list
Kopete-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic