Changeset d28fe1c4 for otr.c


Ignore:
Timestamp:
2016-05-26T02:48:08Z (8 years ago)
Author:
jgeboski <jgeboski@…>
Branches:
master
Children:
808825e
Parents:
0e48e54
git-author:
jgeboski <jgeboski@…> (15-05-16 18:17:34)
git-committer:
jgeboski <jgeboski@…> (26-05-16 02:48:08)
Message:

Implemented plugin information for external plugins

As of now, bitlbee will load any plugin regardless of the ABI it was
built against. This is really problematic when structures or symbols
are changed within bitlbee. This often leads to the plugin not loading
or the plugin acting in an undefined way. Typically a simple rebuild of
the plugin will resolve such issues, but many users have no idea that
this is required after they have updated bitlbee.

Furthermore, it is often times impossible to determine the version of
a plugin, without relying on the package manager of the system. This is
quite a problem when users are reporting bugs for external plugins, and
they have no idea what version of the plugin they are running. This is
also an opportunity to provide additional metadata for each plugin that
can then be displayed to the user.

Solving these issues is done by adding a new required function to each
plugin. The init_plugin_info() function must now be implemented along
with the init_plugin() function. This function then returns a static
structure, which retains all of the metadata for the plugin. Then this
is used by bitlbee to check the ABI version and provide information to
the user.

The introduction of the new function is required as bitlbee needs to
obtain the ABI version before calling init_plugin().

The boiler-plate implementation of init_plugin_info():

#ifdef BITLBEE_ABI_VERSION_CODE
struct plugin_info *init_plugin_info(void)
{

static struct plugin_info info = {

BITLBEE_ABI_VERSION_CODE, /* Required */
"plugin-name", /* Required */
"1.3.3.7", /* Required */
"A short description of the plugin", /* Optional */
"First Last <alias@…>", /* Optional */
"http://www.domain.tld" /* Optional */

};

return &info;

}
#endif

The example wraps the function declaration in an if block for backwards
compatibility with older bitlbee versions.

Displaying the plugin metadata is done via the newly added "plugins"
command, which simply dumps formatted data to the root channel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • otr.c

    r0e48e54 rd28fe1c4  
    267267        register_irc_plugin(&otr_plugin);
    268268}
     269
     270#ifndef OTR_BI
     271struct plugin_info *init_plugin_info(void)
     272{
     273        static struct plugin_info info = {
     274                BITLBEE_ABI_VERSION_CODE,
     275                "otr",
     276                BITLBEE_VERSION,
     277                "Off-the-Record communication",
     278                NULL,
     279                NULL
     280        };
     281
     282        return &info;
     283}
     284#endif
    269285
    270286gboolean otr_irc_new(irc_t *irc)
Note: See TracChangeset for help on using the changeset viewer.