New plugin API

Richard Laager rlaager at wiktel.com
Fri Aug 9 10:14:49 EDT 2013


On Fri, 2013-08-09 at 17:35 +0530, Ankit Vani wrote:
> PURPLE_ABI_VERSION is a convenience macro that returns an ABI version using
> PURPLE_MAJOR_VERSION and PURPLE_MINOR_VERSION. If you want to support ABI 3.0.0
> onwards, you would use PURPLE_PLUGIN_ABI_VERSION(3, 0)

Is there some compelling advantage to using one integer with all the bit
shifting for this instead of two integers (major, minor)?

> Instead of using the
> negative, and introducing confusion between unload-able and un-loadable, I have
> chosen plugins to be 'loadable', unless they are not.

Thank you for clarifying this wording in your changes. :)

> In the plugin's load function, you could get the dependency plugin by
> purple_plugins_find_plugin(dependency-id), and then check its version by
> purple_plugin_info_get_version(). If the version is incorrect, return FALSE, and
> the load will fail.

Maybe on load, plugins should be able to return an error message instead
of just a boolean. For example: a string is an error message and NULL is
success. Or do it some other way.

On Fri, 2013-08-09 at 17:35 +0530, Ankit Vani wrote:
> GPlugin refs everything before returning it to us. So basically you
> would need to do things like:
> 
> GPluginPluginInfo *info = gplugin_plugin_get_info(plugin);
> 
> if (!gplugin_plugin_info_get_name()) {
>     g_object_unref(info);
>     return FALSE;
> }
> 
> g_object_unref(info);
> return TRUE;

Yes, do things like that. Don't use things after unref()ing them. Even
if it works now, it's not guaranteed to stay working. And it sets a bad
example for others that might read that code and copy the pattern
elsewhere with other types of objects.

-- 
Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://pidgin.im/pipermail/devel/attachments/20130809/5caf45dd/attachment-0001.sig>


More information about the Devel mailing list