/soc/2013/ankitkv/gobjectification: 029a5f652427: Moved all of p...

Ankit Vani a at nevitus.org
Mon Aug 19 17:05:47 EDT 2013


Changeset: 029a5f6524273389fd78d7367de4f160f3a11225
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-20 02:21 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/029a5f652427

Description:

Moved all of protocol API to protocol.h

diffstat:

 libpurple/protocol.h  |  216 +++++++++++++++++++++++++++++++++++++++++++++++++-
 libpurple/protocols.h |  200 ----------------------------------------------
 2 files changed, 214 insertions(+), 202 deletions(-)

diffs (truncated from 445 to 300 lines):

diff --git a/libpurple/protocol.h b/libpurple/protocol.h
--- a/libpurple/protocol.h
+++ b/libpurple/protocol.h
@@ -497,17 +497,229 @@ struct _PurpleProtocolInterface
 
 G_BEGIN_DECLS
 
-/* TODO */
 /**************************************************************************/
 /** @name Protocol API                                                    */
 /**************************************************************************/
 /*@{*/
 
-/**
+/** TODO
  * Returns the GType for #PurpleProtocol.
  */
 GType purple_protocol_get_type(void);
 
+/**
+ * Notifies Purple that our account's idle state and time have changed.
+ *
+ * This is meant to be called from protocols.
+ *
+ * @param account   The account.
+ * @param idle      The user's idle state.
+ * @param idle_time The user's idle time.
+ */
+void purple_protocol_got_account_idle(PurpleAccount *account, gboolean idle,
+                                      time_t idle_time);
+
+/**
+ * Notifies Purple of our account's log-in time.
+ *
+ * This is meant to be called from protocols.
+ *
+ * @param account    The account the user is on.
+ * @param login_time The user's log-in time.
+ */
+void purple_protocol_got_account_login_time(PurpleAccount *account,
+                                            time_t login_time);
+
+/**
+ * Notifies Purple that our account's status has changed.
+ *
+ * This is meant to be called from protocols.
+ *
+ * @param account   The account the user is on.
+ * @param status_id The status ID.
+ * @param ...       A NULL-terminated list of attribute IDs and values,
+ *                  beginning with the value for @a attr_id.
+ */
+void purple_protocol_got_account_status(PurpleAccount *account,
+                                        const char *status_id, ...)
+                                        G_GNUC_NULL_TERMINATED;
+
+/**
+ * Notifies Purple that our account's actions have changed. This is only
+ * called after the initial connection. Emits the account-actions-changed
+ * signal.
+ *
+ * This is meant to be called from protocols.
+ *
+ * @param account   The account.
+ *
+ * @see account-actions-changed
+ */
+void purple_protocol_got_account_actions(PurpleAccount *account);
+
+/**
+ * Notifies Purple that a buddy's idle state and time have changed.
+ *
+ * This is meant to be called from protocols.
+ *
+ * @param account   The account the user is on.
+ * @param name      The name of the buddy.
+ * @param idle      The user's idle state.
+ * @param idle_time The user's idle time.  This is the time at
+ *                  which the user became idle, in seconds since
+ *                  the epoch.  If the protocol does not know this value
+ *                  then it should pass 0.
+ */
+void purple_protocol_got_user_idle(PurpleAccount *account, const char *name,
+                                   gboolean idle, time_t idle_time);
+
+/**
+ * Notifies Purple of a buddy's log-in time.
+ *
+ * This is meant to be called from protocols.
+ *
+ * @param account    The account the user is on.
+ * @param name       The name of the buddy.
+ * @param login_time The user's log-in time.
+ */
+void purple_protocol_got_user_login_time(PurpleAccount *account,
+                                         const char *name, time_t login_time);
+
+/**
+ * Notifies Purple that a buddy's status has been activated.
+ *
+ * This is meant to be called from protocols.
+ *
+ * @param account   The account the user is on.
+ * @param name      The name of the buddy.
+ * @param status_id The status ID.
+ * @param ...       A NULL-terminated list of attribute IDs and values,
+ *                  beginning with the value for @a attr_id.
+ */
+void purple_protocol_got_user_status(PurpleAccount *account, const char *name,
+                                     const char *status_id, ...)
+                                     G_GNUC_NULL_TERMINATED;
+
+/**
+ * Notifies libpurple that a buddy's status has been deactivated
+ *
+ * This is meant to be called from protocols.
+ *
+ * @param account   The account the user is on.
+ * @param name      The name of the buddy.
+ * @param status_id The status ID.
+ */
+void purple_protocol_got_user_status_deactive(PurpleAccount *account,
+                                              const char *name,
+                                              const char *status_id);
+
+/**
+ * Informs the server that our account's status changed.
+ *
+ * @param account    The account the user is on.
+ * @param old_status The previous status.
+ * @param new_status The status that was activated, or deactivated
+ *                   (in the case of independent statuses).
+ */
+void purple_protocol_change_account_status(PurpleAccount *account,
+                                           PurpleStatus *old_status,
+                                           PurpleStatus *new_status);
+
+/**
+ * Retrieves the list of stock status types from a protocol.
+ *
+ * @param account The account the user is on.
+ * @param presence The presence for which we're going to get statuses
+ *
+ * @return List of statuses
+ */
+GList *purple_protocol_get_statuses(PurpleAccount *account,
+                                    PurplePresence *presence);
+
+/**
+ * Send an attention request message.
+ *
+ * @param gc The connection to send the message on.
+ * @param who Whose attention to request.
+ * @param type_code An index into the protocol's attention_types list
+ *                  determining the type of the attention request command to
+ *                  send. 0 if protocol only defines one (for example, Yahoo and
+ *                  MSN), but some protocols define more (MySpaceIM).
+ *
+ * Note that you can't send arbitrary PurpleAttentionType's, because there is
+ * only a fixed set of attention commands.
+ */
+void purple_protocol_send_attention(PurpleConnection *gc, const char *who,
+                                    guint type_code);
+
+/**
+ * Process an incoming attention message.
+ *
+ * @param gc The connection that received the attention message.
+ * @param who Who requested your attention.
+ * @param type_code An index into the protocol's attention_types list
+ *                  determining the type of the attention request command to
+ *                  send.
+ */
+void purple_protocol_got_attention(PurpleConnection *gc, const char *who,
+                                   guint type_code);
+
+/**
+ * Process an incoming attention message in a chat.
+ *
+ * @param gc The connection that received the attention message.
+ * @param id The chat id.
+ * @param who Who requested your attention.
+ * @param type_code An index into the protocol's attention_types list
+ *                  determining the type of the attention request command to
+ *                  send.
+ */
+void purple_protocol_got_attention_in_chat(PurpleConnection *gc, int id,
+                                           const char *who, guint type_code);
+
+/**
+ * Determines if the contact supports the given media session type.
+ *
+ * @param account The account the user is on.
+ * @param who The name of the contact to check capabilities for.
+ *
+ * @return The media caps the contact supports.
+ */
+PurpleMediaCaps purple_protocol_get_media_caps(PurpleAccount *account,
+                                               const char *who);
+
+/**
+ * Initiates a media session with the given contact.
+ *
+ * @param account The account the user is on.
+ * @param who The name of the contact to start a session with.
+ * @param type The type of media session to start.
+ *
+ * @return TRUE if the call succeeded else FALSE. (Doesn't imply the media
+ *         session or stream will be successfully created)
+ */
+gboolean purple_protocol_initiate_media(PurpleAccount *account,
+                                        const char *who,
+                                        PurpleMediaSessionType type);
+
+/**
+ * Signals that the protocol received capabilities for the given contact.
+ *
+ * This function is intended to be used only by protocols.
+ *
+ * @param account The account the user is on.
+ * @param who The name of the contact for which capabilities have been received.
+ */
+void purple_protocol_got_media_caps(PurpleAccount *account, const char *who);
+
+/*@}*/
+
+/* TODO */
+/**************************************************************************/
+/** @name Protocol Interface API                                          */
+/**************************************************************************/
+/*@{*/
+
 /** @copydoc  _PurpleProtocolInterface::get_actions */
 GList *purple_protocol_get_actions(PurpleProtocol *, PurpleConnection *);
 
diff --git a/libpurple/protocols.h b/libpurple/protocols.h
--- a/libpurple/protocols.h
+++ b/libpurple/protocols.h
@@ -331,206 +331,6 @@ const char *purple_attention_type_get_un
 /*@}*/
 
 /**************************************************************************/
-/** @name Protocol API                                                    */
-/**************************************************************************/
-/*@{*/
-
-/**
- * Notifies Purple that our account's idle state and time have changed.
- *
- * This is meant to be called from protocols.
- *
- * @param account   The account.
- * @param idle      The user's idle state.
- * @param idle_time The user's idle time.
- */
-void purple_protocol_got_account_idle(PurpleAccount *account, gboolean idle,
-								time_t idle_time);
-
-/**
- * Notifies Purple of our account's log-in time.
- *
- * This is meant to be called from protocols.
- *
- * @param account    The account the user is on.
- * @param login_time The user's log-in time.
- */
-void purple_protocol_got_account_login_time(PurpleAccount *account, time_t login_time);
-
-/**
- * Notifies Purple that our account's status has changed.
- *
- * This is meant to be called from protocols.
- *
- * @param account   The account the user is on.
- * @param status_id The status ID.
- * @param ...       A NULL-terminated list of attribute IDs and values,
- *                  beginning with the value for @a attr_id.
- */
-void purple_protocol_got_account_status(PurpleAccount *account,
-								  const char *status_id, ...) G_GNUC_NULL_TERMINATED;
-
-/**
- * Notifies Purple that our account's actions have changed. This is only
- * called after the initial connection. Emits the account-actions-changed
- * signal.
- *
- * This is meant to be called from protocols.
- *
- * @param account   The account.
- *
- * @see account-actions-changed
- */
-void purple_protocol_got_account_actions(PurpleAccount *account);
-
-/**
- * Notifies Purple that a buddy's idle state and time have changed.
- *
- * This is meant to be called from protocols.
- *
- * @param account   The account the user is on.



More information about the Commits mailing list