--- a/libpurple/protocol.h Thu Jan 14 21:20:10 2021 -0600 +++ b/libpurple/protocol.h Thu Jan 14 22:33:49 2021 -0600 @@ -138,144 +138,6 @@ void (*_purple_reserved4)(void); }; -#define PURPLE_TYPE_PROTOCOL_SERVER (purple_protocol_server_iface_get_type()) - -typedef struct _PurpleProtocolServerInterface PurpleProtocolServerInterface; - -/** - * PurpleProtocolServerInterface: - * @register_user: New user registration - * @unregister_user: Remove the user from the server. The account can either be - * connected or disconnected. After the removal is finished, - * the connection will stay open and has to be closed! - * @get_info: Should arrange for purple_notify_userinfo() to be called - * with @who's user info. - * @add_buddy: Add a buddy to a group on the server. - * <sbr/>This protocol function may be called in situations in - * which the buddy is already in the specified group. If the - * protocol supports authorization and the user is not already - * authorized to see the status of @buddy, @add_buddy should - * request authorization. - * <sbr/>If authorization is required, then use the supplied - * invite message. - * @keepalive: If implemented, this will be called regularly for this - * protocol's active connections. You'd want to do this if you - * need to repeatedly send some kind of keepalive packet to - * the server to avoid being disconnected. ("Regularly" is - * defined to be 30 unless @get_keepalive_interval is - * implemented to override it). - * <filename>libpurple/connection.c</filename>.) - * @get_keepalive_interval: If implemented, this will override the default - * keepalive interval. - * @alias_buddy: Save/store buddy's alias on server list/roster - * @group_buddy: Change a buddy's group on a server list/roster - * @rename_group: Rename a group on a server list/roster - * @set_buddy_icon: Set the buddy icon for the given connection to @img. The - * protocol does <emphasis>NOT</emphasis> own a reference to - * @img; if it needs one, it must #g_object_ref(@img) - * itself. - * @send_raw: For use in plugins that may understand the underlying - * protocol - * @set_public_alias: Set the user's "friendly name" (or alias or nickname or - * whatever term you want to call it) on the server. The - * protocol should call @success_cb or @failure_cb - * <emphasis>asynchronously</emphasis> (if it knows - * immediately that the set will fail, call one of the - * callbacks from an idle/0-second timeout) depending on if - * the nickname is set successfully. See - * purple_account_set_public_alias(). - * <sbr/>@gc: The connection for which to set an alias - * <sbr/>@alias: The new server-side alias/nickname for this - * account, or %NULL to unset the - * alias/nickname (or return it to a - * protocol-specific "default"). - * <sbr/>@success_cb: Callback to be called if the public - * alias is set - * <sbr/>@failure_cb: Callback to be called if setting the - * public alias fails - * @get_public_alias: Retrieve the user's "friendly name" as set on the server. - * The protocol should call @success_cb or @failure_cb - * <emphasis>asynchronously</emphasis> (even if it knows - * immediately that the get will fail, call one of the - * callbacks from an idle/0-second timeout) depending on if - * the nickname is retrieved. See - * purple_account_get_public_alias(). - * <sbr/>@gc: The connection for which to retireve - * the alias - * <sbr/>@success_cb: Callback to be called with the - * retrieved alias - * <sbr/>@failure_cb: Callback to be called if the protocol - * is unable to retrieve the alias - * - * The protocol server interface. - * - * This interface provides a gateway between purple and the protocol's server. - */ -struct _PurpleProtocolServerInterface -{ - /*< private >*/ - GTypeInterface parent_iface; - - /*< public >*/ - void (*register_user)(PurpleAccount *account); - - void (*unregister_user)(PurpleAccount *account, PurpleAccountUnregistrationCb cb, - void *user_data); - - void (*set_info)(PurpleConnection *connection, const char *info); - - void (*get_info)(PurpleConnection *connection, const char *who); - - void (*set_status)(PurpleAccount *account, PurpleStatus *status); - - void (*set_idle)(PurpleConnection *connection, int idletime); - - void (*change_passwd)(PurpleConnection *connection, const char *old_pass, - const char *new_pass); - - void (*add_buddy)(PurpleConnection *pc, PurpleBuddy *buddy, - PurpleGroup *group, const char *message); - - void (*add_buddies)(PurpleConnection *pc, GList *buddies, GList *groups, - const char *message); - - void (*remove_buddy)(PurpleConnection *connection, PurpleBuddy *buddy, - PurpleGroup *group); - - void (*remove_buddies)(PurpleConnection *connection, GList *buddies, GList *groups); - - void (*keepalive)(PurpleConnection *connection); - - int (*get_keepalive_interval)(void); - - void (*alias_buddy)(PurpleConnection *connection, const char *who, - const char *alias); - - void (*group_buddy)(PurpleConnection *connection, const char *who, - const char *old_group, const char *new_group); - - void (*rename_group)(PurpleConnection *connection, const char *old_name, - PurpleGroup *group, GList *moved_buddies); - - void (*set_buddy_icon)(PurpleConnection *connection, PurpleImage *img); - - void (*remove_group)(PurpleConnection *gc, PurpleGroup *group); - - int (*send_raw)(PurpleConnection *gc, const char *buf, int len); - - void (*set_public_alias)(PurpleConnection *gc, const char *alias, - PurpleSetPublicAliasSuccessCallback success_cb, - PurpleSetPublicAliasFailureCallback failure_cb); - - void (*get_public_alias)(PurpleConnection *gc, - PurpleGetPublicAliasSuccessCallback success_cb, - PurpleGetPublicAliasFailureCallback failure_cb); -}; - -#define PURPLE_IS_PROTOCOL_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_PROTOCOL_SERVER)) -#define PURPLE_PROTOCOL_SERVER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), PURPLE_TYPE_PROTOCOL_SERVER, \ - PurpleProtocolServerInterface)) - /** * PURPLE_PROTOCOL_IMPLEMENTS: * @protocol: The protocol in which to check @@ -388,104 +250,6 @@ const char *purple_protocol_class_list_icon(PurpleProtocol *protocol, PurpleAccount *account, PurpleBuddy *buddy); -/**************************************************************************/ -/* Protocol Server Interface API */ -/**************************************************************************/ - -/** - * purple_protocol_server_iface_get_type: - * - * Returns: The #GType for the protocol server interface. - */ -GType purple_protocol_server_iface_get_type(void); - -void purple_protocol_server_iface_register_user(PurpleProtocol *protocol, - PurpleAccount *account); - -/** - * purple_protocol_server_iface_unregister_user: - * @cb: (scope call): - */ -void purple_protocol_server_iface_unregister_user(PurpleProtocol *protocol, - PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data); - -void purple_protocol_server_iface_set_info(PurpleProtocol *protocol, PurpleConnection *connection, - const char *info); - -void purple_protocol_server_iface_get_info(PurpleProtocol *protocol, PurpleConnection *connection, - const char *who); - -void purple_protocol_server_iface_set_status(PurpleProtocol *protocol, - PurpleAccount *account, PurpleStatus *status); - -void purple_protocol_server_iface_set_idle(PurpleProtocol *protocol, PurpleConnection *connection, - int idletime); - -void purple_protocol_server_iface_change_passwd(PurpleProtocol *protocol, - PurpleConnection *connection, const char *old_pass, const char *new_pass); - -void purple_protocol_server_iface_add_buddy(PurpleProtocol *protocol, - PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group, - const char *message); - -void purple_protocol_server_iface_add_buddies(PurpleProtocol *protocol, - PurpleConnection *pc, GList *buddies, GList *groups, - const char *message); - -void purple_protocol_server_iface_remove_buddy(PurpleProtocol *protocol, - PurpleConnection *connection, PurpleBuddy *buddy, PurpleGroup *group); - -void purple_protocol_server_iface_remove_buddies(PurpleProtocol *protocol, - PurpleConnection *connection, GList *buddies, GList *groups); - -void purple_protocol_server_iface_keepalive(PurpleProtocol *protocol, - PurpleConnection *connection); - -int purple_protocol_server_iface_get_keepalive_interval(PurpleProtocol *protocol); - -void purple_protocol_server_iface_alias_buddy(PurpleProtocol *protocol, - PurpleConnection *connection, const char *who, const char *alias); - -void purple_protocol_server_iface_group_buddy(PurpleProtocol *protocol, - PurpleConnection *connection, const char *who, const char *old_group, - const char *new_group); - -void purple_protocol_server_iface_rename_group(PurpleProtocol *protocol, - PurpleConnection *connection, const char *old_name, PurpleGroup *group, - GList *moved_buddies); - -void purple_protocol_server_iface_set_buddy_icon(PurpleProtocol *protocol, - PurpleConnection *connection, PurpleImage *img); - -void purple_protocol_server_iface_remove_group(PurpleProtocol *protocol, - PurpleConnection *gc, PurpleGroup *group); - -int purple_protocol_server_iface_send_raw(PurpleProtocol *protocol, - PurpleConnection *gc, const char *buf, int len); - -/** - * purple_protocol_server_iface_set_public_alias: - * @success_cb: (scope call): - * @failure_cb: (scope call): - */ -void purple_protocol_server_iface_set_public_alias(PurpleProtocol *protocol, - PurpleConnection *gc, const char *alias, - PurpleSetPublicAliasSuccessCallback success_cb, - PurpleSetPublicAliasFailureCallback failure_cb); - -/** - * purple_protocol_server_iface_get_public_alias: - * @success_cb: (scope call): - * @failure_cb: (scope call): - */ -void purple_protocol_server_iface_get_public_alias(PurpleProtocol *protocol, - PurpleConnection *gc, PurpleGetPublicAliasSuccessCallback success_cb, - PurpleGetPublicAliasFailureCallback failure_cb); - -/**************************************************************************/ -/* Protocol Chat Interface API */ -/**************************************************************************/ - G_END_DECLS #endif /* PURPLE_PROTOCOL_H */