Mercurial > pidgin.yaz
comparison libpurple/protocols/bonjour/bonjour_ft.c @ 32753:df7fb85b11ba
Update Bonjour for 64-bit file transfers.
Refs #8477.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 16 Oct 2011 06:12:25 +0000 |
parents | d2ef8926b960 |
children | 2ec94166be43 |
comparison
equal
deleted
inserted
replaced
32752:5525312cf589 | 32753:df7fb85b11ba |
---|---|
36 bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb); | 36 bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb); |
37 static void | 37 static void |
38 bonjour_xfer_init(PurpleXfer *xfer); | 38 bonjour_xfer_init(PurpleXfer *xfer); |
39 static void | 39 static void |
40 bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, | 40 bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, |
41 const int filesize, const char *filename, int option); | 41 const goffset filesize, const char *filename, int option); |
42 static void bonjour_free_xfer(PurpleXfer *xfer); | 42 static void bonjour_free_xfer(PurpleXfer *xfer); |
43 | 43 |
44 /* Look for specific xfer handle */ | 44 /* Look for specific xfer handle */ |
45 static unsigned int next_id = 0; | 45 static unsigned int next_id = 0; |
46 | 46 |
209 xmlnode_set_attrib(si_node, "id", xf->sid); | 209 xmlnode_set_attrib(si_node, "id", xf->sid); |
210 | 210 |
211 file = xmlnode_new_child(si_node, "file"); | 211 file = xmlnode_new_child(si_node, "file"); |
212 xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); | 212 xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); |
213 xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); | 213 xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); |
214 g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); | 214 g_snprintf(buf, sizeof(buf), "%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); |
215 xmlnode_set_attrib(file, "size", buf); | 215 xmlnode_set_attrib(file, "size", buf); |
216 | 216 |
217 feature = xmlnode_new_child(si_node, "feature"); | 217 feature = xmlnode_new_child(si_node, "feature"); |
218 xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); | 218 xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); |
219 | 219 |
437 | 437 |
438 purple_debug_info("bonjour", "si offer Message type - SET.\n"); | 438 purple_debug_info("bonjour", "si offer Message type - SET.\n"); |
439 if (si && (profile = xmlnode_get_attrib(si, "profile")) | 439 if (si && (profile = xmlnode_get_attrib(si, "profile")) |
440 && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { | 440 && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { |
441 const char *filename = NULL, *filesize_str = NULL; | 441 const char *filename = NULL, *filesize_str = NULL; |
442 int filesize = 0; | 442 goffset filesize = 0; |
443 xmlnode *file; | 443 xmlnode *file; |
444 | 444 |
445 const char *sid = xmlnode_get_attrib(si, "id"); | 445 const char *sid = xmlnode_get_attrib(si, "id"); |
446 | 446 |
447 if ((file = xmlnode_get_child(si, "file"))) { | 447 if ((file = xmlnode_get_child(si, "file"))) { |
448 filename = xmlnode_get_attrib(file, "name"); | 448 filename = xmlnode_get_attrib(file, "name"); |
449 if((filesize_str = xmlnode_get_attrib(file, "size"))) | 449 if((filesize_str = xmlnode_get_attrib(file, "size"))) |
450 filesize = atoi(filesize_str); | 450 filesize = g_ascii_strtoll(filesize_str, NULL, 10); |
451 } | 451 } |
452 | 452 |
453 /* TODO: Make sure that it is advertising a bytestreams transfer */ | 453 /* TODO: Make sure that it is advertising a bytestreams transfer */ |
454 | 454 |
455 if (filename) { | 455 if (filename) { |
574 } | 574 } |
575 } | 575 } |
576 | 576 |
577 static void | 577 static void |
578 bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, | 578 bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, |
579 const int filesize, const char *filename, int option) | 579 const goffset filesize, const char *filename, int option) |
580 { | 580 { |
581 PurpleXfer *xfer; | 581 PurpleXfer *xfer; |
582 XepXfer *xf; | 582 XepXfer *xf; |
583 BonjourData *bd; | 583 BonjourData *bd; |
584 | 584 |