changeset 25790:9ded0fb57e1c

Added purple_connection_set_protocol_data and purple_connection_get_protocol_data Also update libpurple/connection.c to actually compile with the structs hidden
author Gary Kramlich <grim@reaperworld.com>
date Fri, 31 Oct 2008 01:05:33 +0000
parents ea7eb09389dc
children 252e26edb7a9
files ChangeLog.API libpurple/connection.c libpurple/connection.h
diffstat 3 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Thu Oct 30 20:10:26 2008 +0000
+++ b/ChangeLog.API	Fri Oct 31 01:05:33 2008 +0000
@@ -5,6 +5,8 @@
 		Added:
 		* purple_buddy_get_protocol_data
 		* purple_buddy_set_protocol_data
+		* purple_connection_get_protocol_data
+		* purple_connection_set_protocol_data
 
 version 2.5.0 (08/18/2008):
 	libpurple:
--- a/libpurple/connection.c	Thu Oct 30 20:10:26 2008 +0000
+++ b/libpurple/connection.c	Fri Oct 31 01:05:33 2008 +0000
@@ -266,7 +266,7 @@
 	buddies = purple_find_buddies(account, NULL);
 	while (buddies != NULL) {
 		PurpleBuddy *buddy = buddies->data;
-		buddy->proto_data = NULL;
+		purple_buddy_set_protocol_data(buddy, NULL);
 		buddies = g_slist_delete_link(buddies, buddies);
 	}
 
@@ -408,6 +408,13 @@
 	gc->display_name = g_strdup(name);
 }
 
+void
+purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data) {
+	g_return_if_fail(connection != NULL);
+
+	connection->proto_data = proto_data;
+}
+
 PurpleConnectionState
 purple_connection_get_state(const PurpleConnection *gc)
 {
@@ -448,6 +455,13 @@
 	return gc->display_name;
 }
 
+void *
+purple_connection_get_protocol_data(const PurpleConnection *connection) {
+	g_return_val_if_fail(connection != NULL, NULL);
+
+	return connection->proto_data;
+}
+
 void
 purple_connection_update_progress(PurpleConnection *gc, const char *text,
 								size_t step, size_t count)
--- a/libpurple/connection.h	Thu Oct 30 20:10:26 2008 +0000
+++ b/libpurple/connection.h	Fri Oct 31 01:05:33 2008 +0000
@@ -354,6 +354,14 @@
 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.
@@ -408,6 +416,15 @@
 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.