About the command handling of MSN protocol

Ka-Hing Cheung khc at pidgin.im
Mon Jun 22 12:40:14 EDT 2009


On Mon, Jun 22, 2009 at 09:17:40PM +0800, Peng Jing wrote:
> Here are my questions:
> 1).
> I have read part of Pidgin's source code, but I'm still no so clear about the implementation of the command processing mechanism. Could anyone tell me how command processing is implemented in Pidgin?

Basically there's a hashtable that registers callbacks, and when we receive
a command we tokenize it and then look up the handler, then we just call
the handler.

> 2).
> I plan to employ some multi-threading: one thread keeps listenning to the incoming commands from the server, put them in a cache, and the other thread scans the cache and pick out those complete commands and enqueue them. But this may involve some thread synchronization problems which are a little difficult and tedious to deal with.
> Does anyone have some good ideas?

Yes, don't use threads.

-khc




More information about the Support mailing list