Confused by libpurple/server.h

Mark Doliner mark at kingant.net
Fri Jun 11 13:44:08 EDT 2010


On Thu, Jun 10, 2010 at 11:41 AM, Marty <martyspamtrap at comcast.net> wrote:
> I'm a bit confused by who should or should not be using some of the functions in
> server.h.  I'm writing my own GUI around libpurple and I want to make sure that I'm
> calling the correct functions for various actions.
>
> The functions in server.h seem to be fairly low-level functions in many cases, yet I
> see the Pidgin GUI using them directly for some user-initiated actions.
>
> For example, if the user initiates a file transfer, Pidgin calls serv_send_file.  My
> initial instinct was that this should be accomplished by the purple_xfer_* API.
>
> When a user initiates an IM, I'm using purple_conversation_new and purple_conv_write
> which seems to be working well, but I see there's a serv_send_im function.
>
> I see in the typing notification code in Pidgin (got_typing_keypress) you call
> coversation APIs as well as serv APIs.
>
> Can someone offer me a little insight about when to use these APIs?

Basically if it's in a header file in libpurple then you can use it.
We're pretty good about not removing any publicly accessible functions
(until 3.0.0).  Looking at the Pidgin source code when trying to
figure out how to do something is always a safe bet.

We've been slowly removing functions from server.c/server.h and moving
them to better namespaced files.  For example, it would make more
sense to call a purple_xfer_* function to send a file instead of
serv_send_file.

The libpurple source code has evolved over ten years from supporting a
single IM protocol and a single user interface to allowing for
multiple IM protocols and multiple user interfaces.  And parts of our
API are somewhat old and not as clean as they good be.  Suggestions
and patches on how to improve things are welcome.

--Mark




More information about the Devel mailing list