Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/si.c @ 32754:e164f7815b52
Update XMPP for 64-bit transfers.
Refs #8477.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 16 Oct 2011 06:52:12 +0000 |
parents | d2ef8926b960 |
children | 2ec94166be43 |
comparison
equal
deleted
inserted
replaced
32753:df7fb85b11ba | 32754:e164f7815b52 |
---|---|
1097 | 1097 |
1098 static void | 1098 static void |
1099 jabber_si_xfer_ibb_sent_cb(JabberIBBSession *sess) | 1099 jabber_si_xfer_ibb_sent_cb(JabberIBBSession *sess) |
1100 { | 1100 { |
1101 PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); | 1101 PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); |
1102 gsize remaining = purple_xfer_get_bytes_remaining(xfer); | 1102 goffset remaining = purple_xfer_get_bytes_remaining(xfer); |
1103 | 1103 |
1104 if (remaining == 0) { | 1104 if (remaining == 0) { |
1105 /* close the session */ | 1105 /* close the session */ |
1106 jabber_ibb_session_close(sess); | 1106 jabber_ibb_session_close(sess); |
1107 purple_xfer_set_completed(xfer, TRUE); | 1107 purple_xfer_set_completed(xfer, TRUE); |
1238 xmlnode_set_attrib(si, "profile", NS_SI_FILE_TRANSFER); | 1238 xmlnode_set_attrib(si, "profile", NS_SI_FILE_TRANSFER); |
1239 | 1239 |
1240 file = xmlnode_new_child(si, "file"); | 1240 file = xmlnode_new_child(si, "file"); |
1241 xmlnode_set_namespace(file, NS_SI_FILE_TRANSFER); | 1241 xmlnode_set_namespace(file, NS_SI_FILE_TRANSFER); |
1242 xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); | 1242 xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); |
1243 g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); | 1243 g_snprintf(buf, sizeof(buf), "%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); |
1244 xmlnode_set_attrib(file, "size", buf); | 1244 xmlnode_set_attrib(file, "size", buf); |
1245 /* maybe later we'll do hash and date attribs */ | 1245 /* maybe later we'll do hash and date attribs */ |
1246 | 1246 |
1247 #if ENABLE_FT_THUMBNAILS | 1247 #if ENABLE_FT_THUMBNAILS |
1248 /* add thumbnail, if appropriate */ | 1248 /* add thumbnail, if appropriate */ |
1674 xmlnode *file, *feature, *x, *field, *option, *value; | 1674 xmlnode *file, *feature, *x, *field, *option, *value; |
1675 #if ENABLE_FT_THUMBNAILS | 1675 #if ENABLE_FT_THUMBNAILS |
1676 xmlnode *thumbnail; | 1676 xmlnode *thumbnail; |
1677 #endif | 1677 #endif |
1678 const char *stream_id, *filename, *filesize_c, *profile; | 1678 const char *stream_id, *filename, *filesize_c, *profile; |
1679 guint64 filesize_64 = 0; | 1679 goffset filesize = 0; |
1680 size_t filesize = 0; | |
1681 | 1680 |
1682 if(!(profile = xmlnode_get_attrib(si, "profile")) || | 1681 if(!(profile = xmlnode_get_attrib(si, "profile")) || |
1683 strcmp(profile, NS_SI_FILE_TRANSFER)) | 1682 strcmp(profile, NS_SI_FILE_TRANSFER)) |
1684 return; | 1683 return; |
1685 | 1684 |
1691 | 1690 |
1692 if(!(filename = xmlnode_get_attrib(file, "name"))) | 1691 if(!(filename = xmlnode_get_attrib(file, "name"))) |
1693 return; | 1692 return; |
1694 | 1693 |
1695 if((filesize_c = xmlnode_get_attrib(file, "size"))) | 1694 if((filesize_c = xmlnode_get_attrib(file, "size"))) |
1696 filesize_64 = g_ascii_strtoull(filesize_c, NULL, 10); | 1695 filesize = g_ascii_strtoull(filesize_c, NULL, 10); |
1697 /* TODO 3.0.0: When the core uses a guint64, this is redundant. | |
1698 * See #8477. | |
1699 */ | |
1700 if (filesize_64 > G_MAXSIZE) { | |
1701 /* Should this pop up a warning? */ | |
1702 purple_debug_warning("jabber", "Unable to transfer file (too large)" | |
1703 " -- see #8477 for more details."); | |
1704 return; | |
1705 } | |
1706 filesize = filesize_64; | |
1707 | 1696 |
1708 if(!(feature = xmlnode_get_child(si, "feature"))) | 1697 if(!(feature = xmlnode_get_child(si, "feature"))) |
1709 return; | 1698 return; |
1710 | 1699 |
1711 if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) | 1700 if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) |