Mercurial > pidgin.yaz
diff libpurple/protocols/bonjour/bonjour_ft.c @ 32827:4a34689eeb33 default tip
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 19 Nov 2011 14:42:54 +0900 |
parents | 1ffa35da9a7b |
children |
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour_ft.c Mon Sep 26 14:57:21 2011 +0900 +++ b/libpurple/protocols/bonjour/bonjour_ft.c Sat Nov 19 14:42:54 2011 +0900 @@ -38,7 +38,7 @@ bonjour_xfer_init(PurpleXfer *xfer); static void bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option); + const goffset filesize, const char *filename, int option); static void bonjour_free_xfer(PurpleXfer *xfer); /* Look for specific xfer handle */ @@ -136,8 +136,8 @@ * otherwise there is a RST resulting in an error on the client side */ if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && purple_xfer_is_completed(xfer)) { struct socket_cleanup *sc = g_new0(struct socket_cleanup, 1); - sc->fd = xfer->fd; - xfer->fd = -1; + sc->fd = purple_xfer_get_fd(xfer); + purple_xfer_set_fd(xfer, -1); sc->handle = purple_input_add(sc->fd, PURPLE_INPUT_READ, _wait_for_socket_close, sc); } @@ -211,7 +211,7 @@ file = xmlnode_new_child(si_node, "file"); xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); + g_snprintf(buf, sizeof(buf), "%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); xmlnode_set_attrib(file, "size", buf); feature = xmlnode_new_child(si_node, "feature"); @@ -333,7 +333,7 @@ return NULL; /* Build the file transfer handle */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); xep_xfer = g_new0(XepXfer, 1); purple_xfer_set_protocol_data(xfer, xep_xfer); xep_xfer->data = bd; @@ -439,7 +439,7 @@ if (si && (profile = xmlnode_get_attrib(si, "profile")) && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { const char *filename = NULL, *filesize_str = NULL; - int filesize = 0; + goffset filesize = 0; xmlnode *file; const char *sid = xmlnode_get_attrib(si, "id"); @@ -447,7 +447,7 @@ if ((file = xmlnode_get_child(si, "file"))) { filename = xmlnode_get_attrib(file, "name"); if((filesize_str = xmlnode_get_attrib(file, "size"))) - filesize = atoi(filesize_str); + filesize = g_ascii_strtoll(filesize_str, NULL, 10); } /* TODO: Make sure that it is advertising a bytestreams transfer */ @@ -576,7 +576,7 @@ static void bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option) + const goffset filesize, const char *filename, int option) { PurpleXfer *xfer; XepXfer *xf; @@ -592,7 +592,7 @@ purple_debug_info("bonjour", "bonjour-xfer-receive.\n"); /* Build the file transfer handle */ - xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(pc), PURPLE_XFER_RECEIVE, from); xf = g_new0(XepXfer, 1); purple_xfer_set_protocol_data(xfer, xf); xf->data = bd; @@ -648,16 +648,16 @@ fcntl(acceptfd, F_SETFD, FD_CLOEXEC); #endif - purple_input_remove(xfer->watcher); + purple_input_remove(purple_xfer_get_watcher(xfer)); close(source); - xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(acceptfd, PURPLE_INPUT_READ, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; } break; case 0x01: - xfer->fd = source; + purple_xfer_set_fd(xfer, source); len = read(source, xf->rx_buf + xf->rxlen, 3); if(len < 0 && errno == EAGAIN) return; @@ -665,9 +665,9 @@ purple_xfer_cancel_remote(xfer); return; } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); @@ -684,9 +684,9 @@ purple_xfer_cancel_remote(xfer); return; } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_READ, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; } @@ -695,9 +695,9 @@ len = read(source, xf->rx_buf + xf->rxlen, 20); if(len<=0){ } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); @@ -720,8 +720,8 @@ purple_xfer_cancel_remote(xfer); return; } else { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); xf->rxlen = 0; /*close(source);*/ purple_xfer_start(xfer, source, NULL, -1); @@ -750,8 +750,8 @@ return; } - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(sock, PURPLE_INPUT_READ, + bonjour_sock5_request_cb, xfer)); xf = purple_xfer_get_protocol_data(xfer); xf->listen_data = NULL; @@ -764,7 +764,7 @@ xmlnode_set_attrib(query, "sid", xf->sid); xmlnode_set_attrib(query, "mode", "tcp"); - xfer->local_port = purple_network_get_port_from_fd(sock); + purple_xfer_set_local_port(xfer, purple_network_get_port_from_fd(sock)); local_ips = bonjour_jabber_get_local_ips(sock);