Version 2 (modified by 17 years ago) (diff) | ,
---|
Request API How-To
The Request API is a way by which libpurple plugins can request information or input from the user. It is typically one of the harder areas of the API for first-time plugin authors to understand. Here, by using plugin actions in conjunction with the Request API, we will try to demistify it. We're going to create a new plugin in the process, too.
About the Request API
The request API is a fairly capable API provided within libpurple. This API is particularly useful because it allows you to write a plugin that can be used by any libpurple UI which provides a UI implementation for the API without changing the plugin's source. This means that a plugin using the request API will work with at least Pidgin and Finch, and possibly other libpurple applications. It is for this reason that many plugins choose to remain libpurple plugins and use the Request API instead of becoming UI-specific plugins.
Writing the Example Plugin
This plugin will eventually be included as an example plugin in the libpurple source, but it is not part of Pidgin 2.0.2, which the rest of the How-To documents assume you are using. We are going to continue this assumption here. In fact, we're going to continue all the assumptions set forth in the [CHowTo/BasicPluginHowto Basic C Plugin How-To].
Go back to ~/development/pidgin-2.0.2/libpurple/plugins and fire up your favorite editor on a new file called request-example.c. The contents of the file will be this:
This document is incomplete. It has been saved to the wiki to ensure the current work is not lost. It should be finished soon.