| 28 * this file, they should get glib, proxy, purple_connection, prpl, etc. */ |
28 * this file, they should get glib, proxy, purple_connection, prpl, etc. */ |
| 29 |
29 |
| 30 #ifndef _PURPLE_PRPL_H_ |
30 #ifndef _PURPLE_PRPL_H_ |
| 31 #define _PURPLE_PRPL_H_ |
31 #define _PURPLE_PRPL_H_ |
| 32 |
32 |
| 33 typedef struct _PurplePluginProtocolInfo PurplePluginProtocolInfo; |
33 typedef struct _PurpleProtocol PurpleProtocol; |
| 34 |
34 |
| 35 typedef struct _PurpleProtocolAction PurpleProtocolAction; |
35 typedef struct _PurpleProtocolAction PurpleProtocolAction; |
| 36 |
36 |
| 37 typedef void (*PurpleProtocolActionCallback)(PurpleProtocolAction *); |
37 typedef void (*PurpleProtocolActionCallback)(PurpleProtocolAction *); |
| 38 |
38 |
| 228 * |
228 * |
| 229 * Every protocol plugin initializes this structure. It is the gateway |
229 * Every protocol plugin initializes this structure. It is the gateway |
| 230 * between purple and the protocol plugin. Many of these callbacks can be |
230 * between purple and the protocol plugin. Many of these callbacks can be |
| 231 * NULL. If a callback must be implemented, it has a comment indicating so. |
231 * NULL. If a callback must be implemented, it has a comment indicating so. |
| 232 */ |
232 */ |
| 233 struct _PurplePluginProtocolInfo |
233 struct _PurpleProtocol |
| 234 { |
234 { |
| 235 const char *id; |
235 const char *id; |
| 236 const char *name; |
236 const char *name; |
| 237 |
237 |
| 238 /** |
238 /** |
| 239 * The size of the PurplePluginProtocolInfo. This should always be sizeof(PurplePluginProtocolInfo). |
239 * The size of the PurpleProtocol. This should always be sizeof(PurpleProtocol). |
| 240 * This allows adding more functions to this struct without requiring a major version bump. |
240 * This allows adding more functions to this struct without requiring a major version bump. |
| 241 */ |
241 */ |
| 242 unsigned long struct_size; |
242 unsigned long struct_size; |
| 243 |
243 |
| 244 /* NOTE: |
244 /* NOTE: |
| 477 |
477 |
| 478 /** new user registration */ |
478 /** new user registration */ |
| 479 void (*register_user)(PurpleAccount *); |
479 void (*register_user)(PurpleAccount *); |
| 480 |
480 |
| 481 /** |
481 /** |
| 482 * @deprecated Use #PurplePluginProtocolInfo.get_info instead. |
482 * @deprecated Use #PurpleProtocol.get_info instead. |
| 483 */ |
483 */ |
| 484 void (*get_cb_info)(PurpleConnection *, int, const char *who); |
484 void (*get_cb_info)(PurpleConnection *, int, const char *who); |
| 485 |
485 |
| 486 /** save/store buddy's alias on server list/roster */ |
486 /** save/store buddy's alias on server list/roster */ |
| 487 void (*alias_buddy)(PurpleConnection *, const char *who, |
487 void (*alias_buddy)(PurpleConnection *, const char *who, |
| 651 PurpleGetPublicAliasSuccessCallback success_cb, |
651 PurpleGetPublicAliasSuccessCallback success_cb, |
| 652 PurpleGetPublicAliasFailureCallback failure_cb); |
652 PurpleGetPublicAliasFailureCallback failure_cb); |
| 653 }; |
653 }; |
| 654 |
654 |
| 655 #define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \ |
655 #define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \ |
| 656 (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size && \ |
656 (G_STRUCT_OFFSET(PurpleProtocol, member) < prpl->struct_size && \ |
| 657 prpl->member != NULL) |
657 prpl->member != NULL) |
| 658 |
658 |
| 659 G_BEGIN_DECLS |
659 G_BEGIN_DECLS |
| 660 |
660 |
| 661 /**************************************************************************/ |
661 /**************************************************************************/ |
| 993 /** |
993 /** |
| 994 * Finds a protocol plugin info structure by ID. |
994 * Finds a protocol plugin info structure by ID. |
| 995 * |
995 * |
| 996 * @param id The protocol's ID. |
996 * @param id The protocol's ID. |
| 997 */ |
997 */ |
| 998 PurplePluginProtocolInfo *purple_find_protocol_info(const char *id); |
998 PurpleProtocol *purple_find_protocol_info(const char *id); |
| 999 |
999 |
| 1000 /** TODO A sanity check is needed |
1000 /** TODO A sanity check is needed |
| 1001 * Adds a protocol to the list of protocols. |
1001 * Adds a protocol to the list of protocols. |
| 1002 * |
1002 * |
| 1003 * @param prpl_info The protocol to add. |
1003 * @param protocol The protocol to add. |
| 1004 * |
1004 * |
| 1005 * @return TRUE if the protocol was added, else FALSE. |
1005 * @return TRUE if the protocol was added, else FALSE. |
| 1006 */ |
1006 */ |
| 1007 gboolean purple_protocols_add(PurplePluginProtocolInfo *prpl_info); |
1007 gboolean purple_protocols_add(PurpleProtocol *protocol); |
| 1008 |
1008 |
| 1009 /** TODO A sanity check is needed |
1009 /** TODO A sanity check is needed |
| 1010 * Removes a protocol from the list of protocols. This will disconnect all |
1010 * Removes a protocol from the list of protocols. This will disconnect all |
| 1011 * connected accounts using this protocol, and free the protocol's user splits |
1011 * connected accounts using this protocol, and free the protocol's user splits |
| 1012 * and protocol options. |
1012 * and protocol options. |
| 1013 * |
1013 * |
| 1014 * @param prpl_info The protocol to remove. |
1014 * @param protocol The protocol to remove. |
| 1015 * |
1015 * |
| 1016 * @return TRUE if the protocol was removed, else FALSE. |
1016 * @return TRUE if the protocol was removed, else FALSE. |
| 1017 */ |
1017 */ |
| 1018 gboolean purple_protocols_remove(PurplePluginProtocolInfo *prpl_info); |
1018 gboolean purple_protocols_remove(PurpleProtocol *protocol); |
| 1019 |
1019 |
| 1020 /** TODO A sanity check is needed |
1020 /** TODO A sanity check is needed |
| 1021 * Returns a list of all loaded protocols. |
1021 * Returns a list of all loaded protocols. |
| 1022 * |
1022 * |
| 1023 * @constreturn A list of all loaded protocols. |
1023 * @constreturn A list of all loaded protocols. |