Callback inside *_close function

Will Hawkins hawkinsw at
Tue Feb 19 14:57:49 EST 2008

Good afternoon!

I am stuck. Here is the situation: When the SIMPLE protocol is sent a 
close message (via simple_close), I need to unregister from the server. 
This would be easy (and is currently implemented) except that the server 
may send back a message and ask for that unregistration to be 

Currently in libpurple it looks like prpl_info->close() gets called and 
the disconnection process continues merrily along assuming that nothing 
else needs to be done (I am reading that from connection.c:253).

Ideally for SIMPLE, the close process would be two fold. First I would 
get called with a start_close(). libpurple would wait for me to say 
"continue closing" which I would do after I have sent my unregistration 
message to the server and received a good response. Second I would get a 
finish_close() that would operate similar to purple_connection_destroy 
in that everything continues merrily along and all resources are 

I have looked through other protocol code to see if such an overloading 
of the disconnection process is possible. However, I haven't been able 
to figure out how to do it. I don't want to bastardize the api too much 
in order to accomplish this. So, I am asking for your help!

What would be the best way to go about this? Am I missing something 

Thanks in advance for your feedback!

More information about the Devel mailing list