diff options
Diffstat (limited to 'libpurple/protocols/bonjour/bonjour_ft.c')
-rw-r--r-- | libpurple/protocols/bonjour/bonjour_ft.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index 43f65a3fd2..cd6bb9b872 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -452,33 +452,37 @@ xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) return; if(purple_strequal(type, "set")) { - const char *profile; xmlnode *si; gboolean parsed_receive = FALSE; si = xmlnode_get_child(packet, "si"); purple_debug_info("bonjour", "si offer Message type - SET.\n"); - if (si && (profile = xmlnode_get_attrib(si, "profile")) - && purple_strequal(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { - const char *filename = NULL, *filesize_str = NULL; - goffset filesize = 0; - xmlnode *file; - - const char *sid = xmlnode_get_attrib(si, "id"); - - if ((file = xmlnode_get_child(si, "file"))) { - filename = xmlnode_get_attrib(file, "name"); - if((filesize_str = xmlnode_get_attrib(file, "size"))) - filesize = g_ascii_strtoll(filesize_str, NULL, 10); - } + if (si) { + const char *profile; + + profile = xmlnode_get_attrib(si, "profile"); + + if (purple_strequal(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { + const char *filename = NULL, *filesize_str = NULL; + goffset filesize = 0; + xmlnode *file; + + const char *sid = xmlnode_get_attrib(si, "id"); + + if ((file = xmlnode_get_child(si, "file"))) { + filename = xmlnode_get_attrib(file, "name"); + if((filesize_str = xmlnode_get_attrib(file, "size"))) + filesize = g_ascii_strtoll(filesize_str, NULL, 10); + } - /* TODO: Make sure that it is advertising a bytestreams transfer */ + /* TODO: Make sure that it is advertising a bytestreams transfer */ - if (filename) { - bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS); + if (filename) { + bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS); - parsed_receive = TRUE; + parsed_receive = TRUE; + } } } |