diff libpurple/protocols/oscar/family_oservice.c @ 25975:3f3d21ae1825

Create two helper functions for setting the available message and iTunes Music Store url. I guess this might be slightly more ineffecient, but this code is only called when your status changes, and it's much cleaner this way.
author Mark Doliner <mark@kingant.net>
date Thu, 05 Mar 2009 23:17:01 +0000
parents f6ef3a9534db
children cef8479194c0
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_oservice.c	Thu Mar 05 21:39:09 2009 +0000
+++ b/libpurple/protocols/oscar/family_oservice.c	Thu Mar 05 23:17:01 2009 +0000
@@ -853,28 +853,15 @@
 
 	if (setavailmsg)
 	{
-		int availmsglen, itmsurllen;
+		size_t availmsglen, itmsurllen;
 		ByteStream tmpbs;
 
 		availmsglen = (availmsg != NULL) ? strlen(availmsg) : 0;
 		itmsurllen = (itmsurl != NULL) ? strlen(itmsurl) : 0;
 
 		byte_stream_new(&tmpbs, availmsglen + 8 + itmsurllen + 8);
-		byte_stream_put16(&tmpbs, 0x0002);
-		byte_stream_put8(&tmpbs, 0x04); /* Flags */
-		byte_stream_put8(&tmpbs, availmsglen + 4);
-		byte_stream_put16(&tmpbs, availmsglen);
-		if (availmsglen > 0)
-			byte_stream_putstr(&tmpbs, availmsg);
-		byte_stream_put16(&tmpbs, 0x0000);
-
-		byte_stream_put16(&tmpbs, 0x0009);
-		byte_stream_put8(&tmpbs, 0x04); /* Flags */
-		byte_stream_put8(&tmpbs, itmsurllen + 4);
-		byte_stream_put16(&tmpbs, itmsurllen);
-		if (itmsurllen > 0)
-			byte_stream_putstr(&tmpbs, itmsurl);
-		byte_stream_put16(&tmpbs, 0x0000);
+		byte_stream_put_bart_asset_str(&tmpbs, 0x0002, availmsg);
+		byte_stream_put_bart_asset_str(&tmpbs, 0x0009, itmsurl);
 
 		aim_tlvlist_add_raw(&tlvlist, 0x001d,
 				byte_stream_curpos(&tmpbs), tmpbs.data);