Tuesday, 23 December 2008

Crappy-code to Good-code transition

The current Kadu code is crappy in many places. Like the contact-management part. This is realized by some classes that really weren't written after deep consideration:

* UserListElement
* UserListElements
* UserGroup
* UserList
* ULEPrivate

UserListElement is really a wrapper on ULEPrivate (using QExplicitlySharedDataPointer allows us to have many copies of UserListElement object that points to the same data).

UserListElements is a list of UserListElement. UserGroup is a set of UserListElements. Why there are two classes - nobody knows (it is really old code...).

UserList is a global list of all known contacts.

ULEPrivate stores all data for one contact.

Problem is how it stores the data - in three big hashes (one of them is really a hash of hashes...). Unfortunately - almost no comments. Also, the main hashes key's are protocol names (with one used - Gadu) - subhashes have keys as names of properties.

For Kadu 0.7.0 we need more elegant design. I started to rewrite contact-management and the results seems to be very good (at least a lot better). Now there are more classes (but with better names and one-class-one-task approach).

Each contact is now stored in Contact class (UserListElement was a cryptic name). Like in previous version data is hidden with QExplicitlySharedDataPointer and stored in ContactData class. ContactData contains QMap that maps accounts into ContactAccountData object (as in Kadu you can have multiple accounts, you also can be connectect with each of your contacts on each of your accounts). There will be something like ContactModuleData - each module (plugin) will be allowed to add new data to each contact.

Also ContactData contains (or will contain...) fields for data that is not specific per account - first/last name and so on.

Classes UserListElements/UserGroup will be merged as ContactList (QList with few additional methods). Class UserList will be replaced ContactManager.

Now code is in mixed-state: half of it used old classes, half uses new. There are conversion methods that allows to move data from one type to another, so code does not have to be ported at once.

Three people are doing the transition: uzi18, Juzef (they are from jabber-module team, so it is really important to them to make Kadu more multiprotocol) and me. And the work is progressing very, very fast ;)

Saturday, 20 December 2008

About me and about Kadu

Kadu is a Polish open-source IM client. Currently (version 0.6.5) it supports only proprietary Gadu-Gadu protocol, but in next version the Jabber XMPP will be also supported. We (the Kadu Team) are planning to make the best IM on the world ;)

And we have the power to really do it - Kadu in Poland is most popular Linux Gadu-Gadu client, and many of our users will use it instead of Psi when it gains XMPP support. We will have QGraphicsView-based contact list, Phonon-based multimedia support. We have chat dialog with full HTML and CSS support (thanks to WebKit), Kadu is the most configurable IM client out here - and the configuration dialog is really very convienant. We have our own usability team that work on upcoming 0.6.6 and 0.7 user interface.

We have support for plugins (called modules) and a lot of users that write their own modules - it is one of the reason Kadu is so popular (imagine kadupanel module that turns the window into hideable panel just like Kicker in KDE 3.5, or screenshot module that allows sending images of part of the screen directly in chat).

Some words about myself: my name is Rafał Malinowski, I'm a programmer from Poland and I'm working on Kadu project. I'm also working for Cognifide Poland, where I'm writing ASP.NET internet pages (like Setanta).

I'm going to write more about Kadu in this blog, to promote it and to improve my english and general writing skills ;)

I hope you will enjoy reading this blog.