Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/bstream.c @ 25462: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 | 531922f4ea2a |
children | 7f43d6779764 |
comparison
equal
deleted
inserted
replaced
25461:cf75f0ca4b86 | 25462:3f3d21ae1825 |
---|---|
309 | 309 |
310 account = purple_connection_get_account(od->gc); | 310 account = purple_connection_get_account(od->gc); |
311 | 311 |
312 return byte_stream_putle32(bs, atoi(purple_account_get_username(account))); | 312 return byte_stream_putle32(bs, atoi(purple_account_get_username(account))); |
313 } | 313 } |
314 | |
315 void byte_stream_put_bart_asset(ByteStream *bs, guint16 type, ByteStream *data) | |
316 { | |
317 byte_stream_put16(bs, type); | |
318 | |
319 if (data != NULL && data->len > 0) { | |
320 /* Flags. 0x04 means "this asset has data attached to it" */ | |
321 byte_stream_put8(bs, 0x04); /* Flags */ | |
322 byte_stream_put8(bs, data->len); /* Length */ | |
323 byte_stream_rewind(data); | |
324 byte_stream_putbs(bs, data, data->len); /* Data */ | |
325 } else { | |
326 byte_stream_put8(bs, 0x00); /* No flags */ | |
327 byte_stream_put8(bs, 0x00); /* Length */ | |
328 /* No data */ | |
329 } | |
330 } | |
331 | |
332 void byte_stream_put_bart_asset_str(ByteStream *bs, guint16 type, const char *datastr) | |
333 { | |
334 ByteStream data; | |
335 size_t len = datastr != NULL ? strlen(datastr) : 0; | |
336 | |
337 if (len > 0) { | |
338 byte_stream_new(&data, 2 + len + 2); | |
339 byte_stream_put16(&data, len); /* Length */ | |
340 byte_stream_putstr(&data, datastr); /* String */ | |
341 byte_stream_put16(&data, 0x0000); /* Unknown */ | |
342 byte_stream_put_bart_asset(bs, type, &data); | |
343 byte_stream_destroy(&data); | |
344 } else { | |
345 byte_stream_put_bart_asset(bs, type, NULL); | |
346 } | |
347 } |