/soc/2013/ankitkv/gobjectification: 2d423b459d4b: Declared funct...

Ankit Vani a at nevitus.org
Mon Aug 19 14:06:50 EDT 2013


Changeset: 2d423b459d4b9d3b9732059905a11e17aa88b374
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-19 23:36 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/2d423b459d4b

Description:

Declared functions to call interface methods from PurpleProtocol * objects

diffstat:

 libpurple/protocol.h |  330 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 306 insertions(+), 24 deletions(-)

diffs (truncated from 431 to 300 lines):

diff --git a/libpurple/protocol.h b/libpurple/protocol.h
--- a/libpurple/protocol.h
+++ b/libpurple/protocol.h
@@ -74,6 +74,8 @@ struct _PurpleProtocolClass
 
 	PurpleBuddyIconSpec icon_spec;  /**< The icon spec. */
 
+	PurpleWhiteboardPrplOps *whiteboard_protocol_ops;
+
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
 	void (*_purple_reserved3)(void);
@@ -123,7 +125,8 @@ struct _PurpleProtocolInterface
 	/**
 	 * Allows the protocol to add text to a buddy's tooltip.
 	 */
-	void (*tooltip_text)(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full);
+	void (*tooltip_text)(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info,
+						 gboolean full);
 
 	/**
 	 * Returns a list of #PurpleStatusType which exist for this account;
@@ -159,7 +162,8 @@ struct _PurpleProtocolInterface
 	 * @param chat_name The chat name to be turned into components
 	 * @return Hashtable containing the information extracted from chat_name
 	 */
-	GHashTable *(*chat_info_defaults)(PurpleConnection *, const char *chat_name);
+	GHashTable *(*chat_info_defaults)(PurpleConnection *,
+									  const char *chat_name);
 
 	/* All the server-related functions */
 
@@ -191,7 +195,8 @@ struct _PurpleProtocolInterface
 	 *         seconds to wait before sending a subsequent notification.
 	 *         Otherwise the protocol should return 0.
 	 */
-	unsigned int (*send_typing)(PurpleConnection *, const char *name, PurpleIMTypingState state);
+	unsigned int (*send_typing)(PurpleConnection *, const char *name,
+								PurpleIMTypingState state);
 
 	/**
 	 * Should arrange for purple_notify_userinfo() to be called with
@@ -214,14 +219,17 @@ struct _PurpleProtocolInterface
 	 *
 	 * If authorization is required, then use the supplied invite message.
 	 */
-	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 *, PurpleBuddy *buddy, PurpleGroup *group);
+	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 *, PurpleBuddy *buddy,
+						 PurpleGroup *group);
 	void (*remove_buddies)(PurpleConnection *, GList *buddies, GList *groups);
 	void (*add_permit)(PurpleConnection *, const char *name);
 	void (*add_deny)(PurpleConnection *, const char *name);
-	void (*rem_permit)(PurpleConnection *, const char *name);
-	void (*rem_deny)(PurpleConnection *, const char *name);
+	void (*rem_permit)(PurpleConnection *, const char *name); /* TODO rename */
+	void (*rem_deny)(PurpleConnection *, const char *name); /* TODO rename */
 	void (*set_permit_deny)(PurpleConnection *);
 
 	/**
@@ -296,7 +304,8 @@ struct _PurpleProtocolInterface
 	 * @return 	  A positive number or 0 in case of success,
 	 *                a negative error number in case of failure.
 	 */
-	int  (*chat_send)(PurpleConnection *, int id, const char *message, PurpleMessageFlags flags);
+	int  (*chat_send)(PurpleConnection *, int id, const char *message,
+					  PurpleMessageFlags flags);
 
 	/** If implemented, this will be called regularly for this protocol's
 	 *  active connections.  You'd want to do this if you need to repeatedly
@@ -309,6 +318,13 @@ struct _PurpleProtocolInterface
 	/** new user registration */
 	void (*register_user)(PurpleAccount *);
 
+	/** 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!
+	 */
+	void (*unregister_user)(PurpleAccount *, PurpleAccountUnregistrationCb cb,
+							void *user_data);
+
 	/**
 	 * @deprecated Use #PurpleProtocol.get_info instead.
 	 */
@@ -373,11 +389,13 @@ struct _PurpleProtocolInterface
 	/* room listing protocol callbacks */
 	PurpleRoomlist *(*roomlist_get_list)(PurpleConnection *gc);
 	void (*roomlist_cancel)(PurpleRoomlist *list);
-	void (*roomlist_expand_category)(PurpleRoomlist *list, PurpleRoomlistRoom *category);
+	void (*roomlist_expand_category)(PurpleRoomlist *list,
+									 PurpleRoomlistRoom *category);
 
 	/* file transfer callbacks */
 	gboolean (*can_receive_file)(PurpleConnection *, const char *who);
-	void (*send_file)(PurpleConnection *, const char *who, const char *filename);
+	void (*send_file)(PurpleConnection *, const char *who,
+					  const char *filename);
 	PurpleXfer *(*new_xfer)(PurpleConnection *, const char *who);
 
 	/** Checks whether offline messages to @a buddy are supported.
@@ -394,17 +412,9 @@ struct _PurpleProtocolInterface
 	/* room list serialize */
 	char *(*roomlist_room_serialize)(PurpleRoomlistRoom *room);
 
-	/** 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!
-	 */
-	/* This is here rather than next to register_user for API compatibility
-	 * reasons.
-	 */
-	void (*unregister_user)(PurpleAccount *, PurpleAccountUnregistrationCb cb, void *user_data);
-
 	/* Attention API for sending & receiving zaps/nudges/buzzes etc. */
-	gboolean (*send_attention)(PurpleConnection *gc, const char *username, guint type);
+	gboolean (*send_attention)(PurpleConnection *gc, const char *username,
+							   guint type);
 	GList *(*get_attention_types)(PurpleAccount *acct);
 
 	/** This allows protocols to specify additional strings to be used for
@@ -424,13 +434,15 @@ struct _PurpleProtocolInterface
 	 * @param account The account to initiate the media session on.
 	 * @param who The remote user to initiate the session with.
 	 * @param type The type of media session to initiate.
-	 * @return TRUE if the call succeeded else FALSE. (Doesn't imply the media session or stream will be successfully created)
+	 * @return TRUE if the call succeeded else FALSE. (Doesn't imply the media
+	 *         session or stream will be successfully created)
 	 */
 	gboolean (*initiate_media)(PurpleAccount *account, const char *who,
 					PurpleMediaSessionType type);
 
 	/**
-	 * Checks to see if the given contact supports the given type of media session.
+	 * Checks to see if the given contact supports the given type of media
+	 * session.
 	 *
 	 * @param account The account the contact is on.
 	 * @param who The remote user to check for media capability with.
@@ -485,16 +497,286 @@ struct _PurpleProtocolInterface
 
 G_BEGIN_DECLS
 
+/* TODO */
 /**************************************************************************/
 /** @name Protocol API                                                    */
 /**************************************************************************/
 /*@{*/
 
-/** TODO
+/**
  * Returns the GType for #PurpleProtocol.
  */
 GType purple_protocol_get_type(void);
 
+/** @copydoc  _PurpleProtocolInterface::get_actions */
+GList *purple_protocol_get_actions(PurpleProtocol *, PurpleConnection *);
+
+/** @copydoc  _PurpleProtocolInterface::list_icon */
+const char *purple_protocol_list_icon(PurpleProtocol *, PurpleAccount *account,
+                                      PurpleBuddy *buddy);
+
+/** @copydoc  _PurpleProtocolInterface::list_emblem */
+const char *purple_protocol_list_emblem(PurpleProtocol *, PurpleBuddy *buddy);
+
+/** @copydoc  _PurpleProtocolInterface::status_text */
+char *purple_protocol_status_text(PurpleProtocol *, PurpleBuddy *buddy);
+
+/** @copydoc  _PurpleProtocolInterface::tooltip_text */
+void purple_protocol_tooltip_text(PurpleProtocol *, PurpleBuddy *buddy,
+                                  PurpleNotifyUserInfo *user_info,
+                                  gboolean full);
+
+/** @copydoc  _PurpleProtocolInterface::status_types */
+GList *purple_protocol_status_types(PurpleProtocol *, PurpleAccount *account);
+
+/** @copydoc  _PurpleProtocolInterface::blist_node_menu */
+GList *purple_protocol_blist_node_menu(PurpleProtocol *, PurpleBlistNode *node);
+
+/** @copydoc  _PurpleProtocolInterface::chat_info */
+GList *purple_protocol_chat_info(PurpleProtocol *, PurpleConnection *);
+
+/** @copydoc  _PurpleProtocolInterface::chat_info_defaults */
+GHashTable *purple_protocol_chat_info_defaults(PurpleProtocol *,
+                                               PurpleConnection *,
+                                               const char *chat_name);
+
+/** @copydoc  _PurpleProtocolInterface::login */
+void purple_protocol_login(PurpleProtocol *, PurpleAccount *);
+
+/** @copydoc  _PurpleProtocolInterface::close */
+void purple_protocol_close(PurpleProtocol *, PurpleConnection *);
+
+/** @copydoc  _PurpleProtocolInterface::send_im */
+int  purple_protocol_send_im(PurpleProtocol *, PurpleConnection *, 
+                             const char *who, const char *message,
+                             PurpleMessageFlags flags);
+
+/** @copydoc  _PurpleProtocolInterface::set_info */
+void purple_protocol_set_info(PurpleProtocol *, PurpleConnection *,
+                              const char *info);
+
+/** @copydoc  _PurpleProtocolInterface::send_typing */
+unsigned int purple_protocol_send_typing(PurpleProtocol *, PurpleConnection *,
+                                         const char *name,
+                                         PurpleIMTypingState state);
+
+/** @copydoc  _PurpleProtocolInterface::get_info */
+void purple_protocol_get_info(PurpleProtocol *, PurpleConnection *,
+                              const char *who);
+
+/** @copydoc  _PurpleProtocolInterface::set_status */
+void purple_protocol_set_status(PurpleProtocol *, PurpleAccount *account,
+                                PurpleStatus *status);
+
+/** @copydoc  _PurpleProtocolInterface::set_idle */
+void purple_protocol_set_idle(PurpleProtocol *, PurpleConnection *,
+                              int idletime);
+
+/** @copydoc  _PurpleProtocolInterface::change_passwd */
+void purple_protocol_change_passwd(PurpleProtocol *, PurpleConnection *,
+                                   const char *old_pass, const char *new_pass);
+
+/** @copydoc  _PurpleProtocolInterface::add_buddy */
+void purple_protocol_add_buddy(PurpleProtocol *, PurpleConnection *pc,
+                               PurpleBuddy *buddy, PurpleGroup *group,
+                               const char *message);
+
+/** @copydoc  _PurpleProtocolInterface::add_buddies */
+void purple_protocol_add_buddies(PurpleProtocol *, PurpleConnection *pc,
+                                 GList *buddies, GList *groups,
+                                 const char *message);
+
+/** @copydoc  _PurpleProtocolInterface::remove_buddy */
+void purple_protocol_remove_buddy(PurpleProtocol *, PurpleConnection *,
+                                  PurpleBuddy *buddy, PurpleGroup *group);
+
+/** @copydoc  _PurpleProtocolInterface::remove_buddies */
+void purple_protocol_remove_buddies(PurpleProtocol *, PurpleConnection *,
+                                    GList *buddies, GList *groups);
+
+/** @copydoc  _PurpleProtocolInterface::add_permit */
+void purple_protocol_add_permit(PurpleProtocol *, PurpleConnection *,
+                                const char *name);
+
+/** @copydoc  _PurpleProtocolInterface::add_deny */
+void purple_protocol_add_deny(PurpleProtocol *, PurpleConnection *,
+                              const char *name);
+
+/* TODO rename */
+/** @copydoc  _PurpleProtocolInterface::rem_permit */
+void purple_protocol_rem_permit(PurpleProtocol *, PurpleConnection *,
+                                const char *name);
+
+/* TODO rename */
+/** @copydoc  _PurpleProtocolInterface::rem_deny */
+void purple_protocol_rem_deny(PurpleProtocol *, PurpleConnection *,
+                              const char *name);
+
+/** @copydoc  _PurpleProtocolInterface::set_permit_deny */
+void purple_protocol_set_permit_deny(PurpleProtocol *, PurpleConnection *);
+
+/** @copydoc  _PurpleProtocolInterface::join_chat */
+void purple_protocol_join_chat(PurpleProtocol *, PurpleConnection *,
+                               GHashTable *components);
+
+/** @copydoc  _PurpleProtocolInterface::reject_chat */
+void purple_protocol_reject_chat(PurpleProtocol *, PurpleConnection *,
+                                 GHashTable *components);
+
+/** @copydoc  _PurpleProtocolInterface::get_chat_name */
+char *purple_protocol_get_chat_name(PurpleProtocol *, GHashTable *components);
+
+/** @copydoc  _PurpleProtocolInterface::chat_invite */
+void purple_protocol_chat_invite(PurpleProtocol *, PurpleConnection *, int id,
+                                 const char *message, const char *who);
+
+/** @copydoc  _PurpleProtocolInterface::chat_leave */
+void purple_protocol_chat_leave(PurpleProtocol *, PurpleConnection *, int id);
+
+/** @copydoc  _PurpleProtocolInterface::chat_whisper */
+void purple_protocol_chat_whisper(PurpleProtocol *, PurpleConnection *, int id,
+                                  const char *who, const char *message);
+
+/** @copydoc  _PurpleProtocolInterface::chat_send */
+int  purple_protocol_chat_send(PurpleProtocol *, PurpleConnection *, int id,
+                               const char *message, PurpleMessageFlags flags);
+
+/** @copydoc  _PurpleProtocolInterface::keepalive */
+void purple_protocol_keepalive(PurpleProtocol *, PurpleConnection *);
+
+/** @copydoc  _PurpleProtocolInterface::register_user */
+void purple_protocol_register_user(PurpleProtocol *, PurpleAccount *);
+
+/** @copydoc  _PurpleProtocolInterface::unregister_user */
+void purple_protocol_unregister_user(PurpleProtocol *, PurpleAccount *,



More information about the Commits mailing list