/soc/2013/ankitkv/gobjectification: 16a60fe59d22: Backed out cha...

Ankit Vani a at nevitus.org
Fri Sep 13 09:44:38 EDT 2013


Changeset: 16a60fe59d22c92fc29bcc8cb8d63bed0abc474d
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-13 19:07 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/16a60fe59d22

Description:

Backed out changeset 7cf0bf5b9a40

diffstat:

 libpurple/connection.c |  23 +++++++++++++++++++++++
 libpurple/connection.h |  17 +++++++++++++++++
 libpurple/roomlist.c   |  21 +++++++++++++++++++++
 libpurple/roomlist.h   |  19 +++++++++++++++++++
 libpurple/whiteboard.c |  21 +++++++++++++++++++++
 libpurple/whiteboard.h |  17 +++++++++++++++++
 libpurple/xfer.c       |  24 ++++++++++++++++++++++++
 libpurple/xfer.h       |  17 +++++++++++++++++
 8 files changed, 159 insertions(+), 0 deletions(-)

diffs (281 lines):

diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -63,6 +63,9 @@ struct _PurpleConnectionPrivate
 
 	GSList *active_chats;         /**< A list of active chats
 	                                  (#PurpleChatConversation structs). */
+	void *proto_data;             /**< Protocol-specific data.            
+	                                  TODO Remove this, and use
+	                                       protocol-specific subclasses  */
 
 	char *display_name;           /**< How you appear to other people.   */
 	guint keepalive;              /**< Keep-alive.                       */
@@ -272,6 +275,16 @@ purple_connection_set_display_name(Purpl
 	priv->display_name = g_strdup(name);
 }
 
+void
+purple_connection_set_protocol_data(PurpleConnection *gc, void *proto_data)
+{
+	PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc);
+
+	g_return_if_fail(priv != NULL);
+
+	priv->proto_data = proto_data;
+}
+
 PurpleConnectionState
 purple_connection_get_state(const PurpleConnection *gc)
 {
@@ -342,6 +355,16 @@ purple_connection_get_display_name(const
 	return priv->display_name;
 }
 
+void *
+purple_connection_get_protocol_data(const PurpleConnection *gc)
+{
+	PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc);
+
+	g_return_val_if_fail(priv != NULL, NULL);
+
+	return priv->proto_data;
+}
+
 void
 _purple_connection_add_active_chat(PurpleConnection *gc, PurpleChatConversation *chat)
 {
diff --git a/libpurple/connection.h b/libpurple/connection.h
--- a/libpurple/connection.h
+++ b/libpurple/connection.h
@@ -309,6 +309,14 @@ void purple_connection_set_account(Purpl
 void purple_connection_set_display_name(PurpleConnection *gc, const char *name);
 
 /**
+ * Sets the protocol data for a connection.
+ *
+ * @param connection The PurpleConnection.
+ * @param proto_data The protocol data to set for the connection.
+ */
+void purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data);
+
+/**
  * Returns the connection state.
  *
  * @param gc The connection.
@@ -380,6 +388,15 @@ GSList *purple_connection_get_active_cha
 const char *purple_connection_get_display_name(const PurpleConnection *gc);
 
 /**
+ * Gets the protocol data from a connection.
+ *
+ * @param connection The PurpleConnection.
+ *
+ * @return The protocol data for the connection.
+ */
+void *purple_connection_get_protocol_data(const PurpleConnection *connection);
+
+/**
  * Updates the connection progress.
  *
  * @param gc    The connection.
diff --git a/libpurple/roomlist.c b/libpurple/roomlist.c
--- a/libpurple/roomlist.c
+++ b/libpurple/roomlist.c
@@ -45,6 +45,9 @@ struct _PurpleRoomlistPrivate {
 	GList *fields;           /**< The fields.                       */
 	GList *rooms;            /**< The list of rooms.                */
 	gboolean in_progress;    /**< The listing is in progress.       */
+	gpointer proto_data;     /** Protocol private data.
+	                             TODO Remove this, and use
+	                                  protocol-specific subclasses  */
 };
 
 /**
@@ -213,6 +216,24 @@ GList * purple_roomlist_get_fields(Purpl
 	return priv->fields;
 }
 
+gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list)
+{
+	PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list);
+
+	g_return_val_if_fail(priv != NULL, NULL);
+
+	return priv->proto_data;
+}
+
+void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data)
+{
+	PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list);
+
+	g_return_if_fail(priv != NULL);
+
+	priv->proto_data = proto_data;
+}
+
 gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list)
 {
 	g_return_val_if_fail(list != NULL, NULL);
diff --git a/libpurple/roomlist.h b/libpurple/roomlist.h
--- a/libpurple/roomlist.h
+++ b/libpurple/roomlist.h
@@ -245,6 +245,25 @@ void purple_roomlist_expand_category(Pur
 GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist);
 
 /**
+ * Get the protocol data associated with this room list.
+ *
+ * @param list The roomlist, which must not be @c NULL.
+ *
+ * @return The protocol data associated with this room list.  This is a
+ *         convenience field provided to the protocol -- it is not
+ *         used the libpurple core.
+ */
+gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list);
+
+/**
+ * Set the protocol data associated with this room list.
+ *
+ * @param list The roomlist, which must not be @c NULL.
+ * @param proto_data A pointer to associate with this room list.
+ */
+void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data);
+
+/**
  * Get the UI data associated with this room list.
  *
  * @param list The roomlist, which must not be @c NULL.
diff --git a/libpurple/whiteboard.c b/libpurple/whiteboard.c
--- a/libpurple/whiteboard.c
+++ b/libpurple/whiteboard.c
@@ -39,6 +39,9 @@ struct _PurpleWhiteboardPrivate
 	PurpleAccount *account;         /**< Account associated with this session */
 	char *who;                      /**< Name of the remote user              */
 
+	void *proto_data;               /**< Protocol specific data
+	                                     TODO Remove this, and use
+	                                          protocol-specific subclasses    */
 	PurpleWhiteboardOps *protocol_ops; /**< Protocol operations */
 
 	GList *draw_list;               /**< List of drawing elements/deltas to
@@ -282,6 +285,24 @@ void purple_whiteboard_set_draw_list(Pur
 	priv->draw_list = draw_list;
 }
 
+void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data)
+{
+	PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb);
+
+	g_return_if_fail(priv != NULL);
+
+	priv->proto_data = proto_data;
+}
+
+gpointer purple_whiteboard_get_protocol_data(const PurpleWhiteboard *wb)
+{
+	PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb);
+
+	g_return_val_if_fail(priv != NULL, NULL);
+
+	return priv->proto_data;
+}
+
 void purple_whiteboard_set_ui_data(PurpleWhiteboard *wb, gpointer ui_data)
 {
 	g_return_if_fail(wb != NULL);
diff --git a/libpurple/whiteboard.h b/libpurple/whiteboard.h
--- a/libpurple/whiteboard.h
+++ b/libpurple/whiteboard.h
@@ -321,6 +321,23 @@ GList *purple_whiteboard_get_draw_list(c
 void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list);
 
 /**
+ * Sets the protocol data for a whiteboard.
+ *
+ * @param wb			The whiteboard.
+ * @param proto_data	The protocol data to set for the whiteboard.
+ */
+void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data);
+
+/**
+ * Gets the protocol data for a whiteboard.
+ *
+ * @param wb			The whiteboard.
+ *
+ * @return The protocol data for the whiteboard.
+ */
+gpointer purple_whiteboard_get_protocol_data(const PurpleWhiteboard *wb);
+
+/**
  * Set the UI data associated with this whiteboard.
  *
  * @param wb			The whiteboard.
diff --git a/libpurple/xfer.c b/libpurple/xfer.c
--- a/libpurple/xfer.c
+++ b/libpurple/xfer.c
@@ -98,6 +98,10 @@ struct _PurpleXferPrivate {
 
 	PurpleXferUiOps *ui_ops;     /**< UI-specific operations.             */
 
+	void *proto_data;            /**< prpl-specific data.
+	                                  TODO Remove this, and use
+	                                       protocol-specific subclasses   */
+
 	/*
 	 * Used to moderate the file transfer when either the read/write ui_ops are
 	 * set or fd is not set. In those cases, the UI/protocol call the respective
@@ -1876,6 +1880,26 @@ purple_xfer_prepare_thumbnail(PurpleXfer
 	}
 }
 
+void
+purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data)
+{
+	PurpleXferPrivate *priv = PURPLE_XFER_GET_PRIVATE(xfer);
+
+	g_return_if_fail(priv != NULL);
+
+	priv->proto_data = proto_data;
+}
+
+gpointer
+purple_xfer_get_protocol_data(const PurpleXfer *xfer)
+{
+	PurpleXferPrivate *priv = PURPLE_XFER_GET_PRIVATE(xfer);
+
+	g_return_val_if_fail(priv != NULL, NULL);
+
+	return priv->proto_data;
+}
+
 void purple_xfer_set_ui_data(PurpleXfer *xfer, gpointer ui_data)
 {
 	g_return_if_fail(xfer != NULL);
diff --git a/libpurple/xfer.h b/libpurple/xfer.h
--- a/libpurple/xfer.h
+++ b/libpurple/xfer.h
@@ -760,6 +760,23 @@ void purple_xfer_set_thumbnail(PurpleXfe
 void purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats);
 
 /**
+ * Sets the protocol data for a file transfer.
+ *
+ * @param xfer			The file transfer.
+ * @param proto_data	The protocol data to set for the file transfer.
+ */
+void purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data);
+ 
+/**
+ * Gets the protocol data for a file transfer.
+ *
+ * @param xfer			The file transfer.
+ *
+ * @return The protocol data for the file transfer.
+ */
+gpointer purple_xfer_get_protocol_data(const PurpleXfer *xfer);
+
+/**
  * Set the UI data associated with this file transfer.
  *
  * @param xfer			The file transfer.



More information about the Commits mailing list