changeset 30789:2c3d7104ef1e

Since we can create a SlpMessage without a SlpLink, add a function to relate them post-creation.
author masca@cpw.pidgin.im
date Thu, 10 Jun 2010 22:17:26 +0000
parents be70da54f563
children 545fa069c531
files libpurple/protocols/msn/slpmsg.c libpurple/protocols/msn/slpmsg.h
diffstat 2 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slpmsg.c	Wed Jun 09 23:03:34 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg.c	Thu Jun 10 22:17:26 2010 +0000
@@ -42,12 +42,9 @@
 	if (purple_debug_is_verbose())
 		purple_debug_info("msn", "slpmsg new (%p)\n", slpmsg);
 
-	if (slplink) {
-		slpmsg->slplink = slplink;
-
-		slplink->slp_msgs =
-			g_list_append(slplink->slp_msgs, slpmsg);
-	} else
+	if (slplink) 
+		msn_slpmsg_set_slplink(slpmsg, slplink);
+	else
 		slpmsg->slplink = NULL;
 
 	slpmsg->header = NULL;
@@ -134,6 +131,18 @@
 }
 
 void
+msn_slpmsg_set_slplink(MsnSlpMessage *slpmsg, MsnSlpLink *slplink)
+{
+	g_return_if_fail(slplink != NULL);
+
+	slpmsg->slplink = slplink;
+
+	slplink->slp_msgs =
+		g_list_append(slplink->slp_msgs, slpmsg);
+
+}
+
+void
 msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body,
 						 long long size)
 {
--- a/libpurple/protocols/msn/slpmsg.h	Wed Jun 09 23:03:34 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg.h	Thu Jun 10 22:17:26 2010 +0000
@@ -111,6 +111,13 @@
  */
 void msn_slpmsg_destroy(MsnSlpMessage *slpmsg);
 
+/**
+ * Relate this SlpMessage with an existing SlpLink
+ *
+ * @param slplink 	The SlpLink that will send this message.
+ */
+void msn_slpmsg_set_slplink(MsnSlpMessage *slpmsg, MsnSlpLink *slplink);
+
 void msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body,
 						 long long size);
 void msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img);