diff options
author | Evan Schoenberg <evands@pidgin.im> | 2008-05-12 02:19:06 +0000 |
---|---|---|
committer | Evan Schoenberg <evands@pidgin.im> | 2008-05-12 02:19:06 +0000 |
commit | 7206f62fe3e0c99cfa09b4a3490dc041249390e8 (patch) | |
tree | 52313207e55055e91f9336e0a327ff34b14fa361 /libpurple/prpl.h | |
parent | b21d80a5aecbd293790debb50f8f7172a7baf5c7 (diff) | |
parent | 2a615fe4995ded4590d477d56649f68511e0eba5 (diff) | |
download | pidgin-7206f62fe3e0c99cfa09b4a3490dc041249390e8.tar.gz |
propagate from branch 'im.pidgin.pidgin' (head c199efbb0c02bdc16c158257bcc8e371674b06ee)
to branch 'im.pidgin.pidgin.next.minor' (head 25b08448e1e9d709f6b39968ca20da7febaa2e4f)
Diffstat (limited to 'libpurple/prpl.h')
-rw-r--r-- | libpurple/prpl.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/libpurple/prpl.h b/libpurple/prpl.h index 7bd8542291..33a07ebdb3 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -399,9 +399,45 @@ struct _PurplePluginProtocolInfo gboolean (*send_attention)(PurpleConnection *gc, const char *username, guint type); GList *(*get_attention_types)(PurpleAccount *acct); - void (*_purple_reserved4)(void); + /** + * The size of the PurplePluginProtocolInfo. This should always be sizeof(PurplePluginProtocolInfo). + * This allows adding more functions to this struct without requiring a major version bump. + */ + unsigned long struct_size; + + /* NOTE: + * If more functions are added, they should accessed using the following syntax: + * + * if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, new_function)) + * prpl->new_function(...); + * + * instead of + * + * if (prpl->new_function != NULL) + * prpl->new_function(...); + * + * The PURPLE_PROTOCOL_PLUGIN_HAS_FUNC macro can be used for the older member + * functions (e.g. login, send_im etc.) too. + */ + + /** This allows protocols to specify additional strings to be used for + * various purposes. The idea is to stuff a bunch of strings in this hash + * table instead of expanding the struct for every addition. This hash + * table is allocated every call and MUST be unrefed by the caller. + * + * @param account The account to specify. This can be NULL. + * @return The protocol's string hash table. The hash table should be + * destroyed by the caller when it's no longer needed. + */ + GHashTable *(*get_account_text_table)(PurpleAccount *account); }; +#define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \ + (((G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < G_STRUCT_OFFSET(PurplePluginProtocolInfo, struct_size)) \ + || (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size)) && \ + prpl->member != NULL) + + #define PURPLE_IS_PROTOCOL_PLUGIN(plugin) \ ((plugin)->info->type == PURPLE_PLUGIN_PROTOCOL) |