Mercurial > pidgin
diff libpurple/protocols/oscar/oft.c @ 15822:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 5fe8042783c1 |
children | 1927f4ead3ca |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oft.c Mon Mar 19 06:11:46 2007 +0000 +++ b/libpurple/protocols/oscar/oft.c Mon Mar 19 07:01:17 2007 +0000 @@ -1,5 +1,5 @@ /* - * Gaim's oscar protocol plugin + * Purple's oscar protocol plugin * This file is the legal property of its developers. * Please see the AUTHORS file distributed alongside this file. * @@ -63,7 +63,7 @@ struct _ChecksumData { PeerConnection *conn; - GaimXfer *xfer; + PurpleXfer *xfer; GSourceFunc callback; size_t size; guint32 checksum; @@ -79,7 +79,7 @@ checksum_data->conn->checksum_data = NULL; fclose(checksum_data->file); if (checksum_data->timer > 0) - gaim_timeout_remove(checksum_data->timer); + purple_timeout_remove(checksum_data->timer); g_free(checksum_data); } @@ -170,8 +170,8 @@ if (!repeat) { - gaim_debug_info("oscar", "Checksum of %s calculated\n", - gaim_xfer_get_local_filename(checksum_data->xfer)); + purple_debug_info("oscar", "Checksum of %s calculated\n", + purple_xfer_get_local_filename(checksum_data->xfer)); if (checksum_data->callback != NULL) checksum_data->callback(checksum_data); peer_oft_checksum_destroy(checksum_data); @@ -194,12 +194,12 @@ */ static void -peer_oft_checksum_file(PeerConnection *conn, GaimXfer *xfer, GSourceFunc callback, size_t size) +peer_oft_checksum_file(PeerConnection *conn, PurpleXfer *xfer, GSourceFunc callback, size_t size) { ChecksumData *checksum_data; - gaim_debug_info("oscar", "Calculating checksum of %s\n", - gaim_xfer_get_local_filename(xfer)); + purple_debug_info("oscar", "Calculating checksum of %s\n", + purple_xfer_get_local_filename(xfer)); checksum_data = g_malloc0(sizeof(ChecksumData)); checksum_data->conn = conn; @@ -207,18 +207,18 @@ checksum_data->callback = callback; checksum_data->size = size; checksum_data->checksum = 0xffff0000; - checksum_data->file = fopen(gaim_xfer_get_local_filename(xfer), "rb"); + checksum_data->file = fopen(purple_xfer_get_local_filename(xfer), "rb"); if (checksum_data->file == NULL) { - gaim_debug_error("oscar", "Unable to open %s for checksumming: %s\n", - gaim_xfer_get_local_filename(xfer), strerror(errno)); + purple_debug_error("oscar", "Unable to open %s for checksumming: %s\n", + purple_xfer_get_local_filename(xfer), strerror(errno)); callback(checksum_data); g_free(checksum_data); } else { - checksum_data->timer = gaim_timeout_add(10, + checksum_data->timer = purple_timeout_add(10, peer_oft_checksum_file_piece, checksum_data); conn->checksum_data = checksum_data; } @@ -243,7 +243,7 @@ * If canceled by local user, and we're receiving a file, and * we're not connected/ready then send an ICBM cancel message. */ - if ((gaim_xfer_get_status(conn->xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) && + if ((purple_xfer_get_status(conn->xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) && !conn->ready) { aim_im_sendch2_cancel(conn); @@ -251,7 +251,7 @@ if (conn->sending_data_timer != 0) { - gaim_timeout_remove(conn->sending_data_timer); + purple_timeout_remove(conn->sending_data_timer); conn->sending_data_timer = 0; } } @@ -342,7 +342,7 @@ conn->xferdata.type = PEER_TYPE_DONE; conn->xferdata.filesleft = 0; conn->xferdata.partsleft = 0; - conn->xferdata.nrecvd = gaim_xfer_get_bytes_sent(conn->xfer); + conn->xferdata.nrecvd = purple_xfer_get_bytes_sent(conn->xfer); peer_oft_send(conn, &conn->xferdata); } @@ -361,12 +361,12 @@ conn = data; - if (gaim_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) + if (purple_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) { conn->sending_data_timer = 0; conn->xfer->fd = conn->fd; conn->fd = -1; - gaim_xfer_start(conn->xfer, conn->xfer->fd, NULL, 0); + purple_xfer_start(conn->xfer, conn->xfer->fd, NULL, 0); return FALSE; } @@ -386,7 +386,7 @@ conn = data; - if (gaim_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) + if (purple_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) { conn->sending_data_timer = 0; peer_connection_destroy(conn, conn->disconnect_reason, NULL); @@ -410,9 +410,9 @@ peer_oft_send_ack(conn); /* Remove our watchers and use the file transfer watchers in the core */ - gaim_input_remove(conn->watcher_incoming); + purple_input_remove(conn->watcher_incoming); conn->watcher_incoming = 0; - conn->sending_data_timer = gaim_timeout_add(100, + conn->sending_data_timer = purple_timeout_add(100, start_transfer_when_done_sending_data, conn); } @@ -425,16 +425,16 @@ { if (memcmp(conn->cookie, frame->cookie, 8) != 0) { - gaim_debug_info("oscar", "Received an incorrect cookie. " + purple_debug_info("oscar", "Received an incorrect cookie. " "Closing connection.\n"); peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA, NULL); return; } /* Remove our watchers and use the file transfer watchers in the core */ - gaim_input_remove(conn->watcher_incoming); + purple_input_remove(conn->watcher_incoming); conn->watcher_incoming = 0; - conn->sending_data_timer = gaim_timeout_add(100, + conn->sending_data_timer = purple_timeout_add(100, start_transfer_when_done_sending_data, conn); } @@ -457,7 +457,7 @@ } else /* Accept the change */ - gaim_xfer_set_bytes_sent(checksum_data->xfer, conn->xferdata.nrecvd); + purple_xfer_set_bytes_sent(checksum_data->xfer, conn->xferdata.nrecvd); peer_oft_send_resume_accept(conn); @@ -474,7 +474,7 @@ { if (memcmp(conn->cookie, frame->cookie, 8) != 0) { - gaim_debug_info("oscar", "Received an incorrect cookie. " + purple_debug_info("oscar", "Received an incorrect cookie. " "Closing connection.\n"); peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA, NULL); return; @@ -497,7 +497,7 @@ static void peer_oft_recv_frame_done(PeerConnection *conn, OftFrame *frame) { - gaim_input_remove(conn->watcher_incoming); + purple_input_remove(conn->watcher_incoming); conn->watcher_incoming = 0; conn->xfer->fd = conn->fd; conn->fd = -1; @@ -544,7 +544,7 @@ frame.name_length = bs->len - 186; frame.name = byte_stream_getraw(bs, frame.name_length); - gaim_debug_info("oscar", "Incoming OFT frame from %s with " + purple_debug_info("oscar", "Incoming OFT frame from %s with " "type=0x%04x\n", conn->sn, frame.type); /* TODOFT: peer_oft_dirconvert_fromstupid(frame->name); */ @@ -572,11 +572,11 @@ } /*******************************************************************/ -/* Begin GaimXfer callbacks for use when receiving a file */ +/* Begin PurpleXfer callbacks for use when receiving a file */ /*******************************************************************/ void -peer_oft_recvcb_init(GaimXfer *xfer) +peer_oft_recvcb_init(PurpleXfer *xfer) { PeerConnection *conn; @@ -586,7 +586,7 @@ } void -peer_oft_recvcb_end(GaimXfer *xfer) +peer_oft_recvcb_end(PurpleXfer *xfer) { PeerConnection *conn; @@ -598,27 +598,27 @@ peer_oft_send_done(conn); conn->disconnect_reason = OSCAR_DISCONNECT_DONE; - conn->sending_data_timer = gaim_timeout_add(100, + conn->sending_data_timer = purple_timeout_add(100, destroy_connection_when_done_sending_data, conn); } void -peer_oft_recvcb_ack_recv(GaimXfer *xfer, const guchar *buffer, size_t size) +peer_oft_recvcb_ack_recv(PurpleXfer *xfer, const guchar *buffer, size_t size) { PeerConnection *conn; /* Update our rolling checksum. Like Walmart, yo. */ conn = xfer->data; conn->xferdata.recvcsum = peer_oft_checksum_chunk(buffer, - size, conn->xferdata.recvcsum, gaim_xfer_get_bytes_sent(xfer) & 1); + size, conn->xferdata.recvcsum, purple_xfer_get_bytes_sent(xfer) & 1); } /*******************************************************************/ -/* End GaimXfer callbacks for use when receiving a file */ +/* End PurpleXfer callbacks for use when receiving a file */ /*******************************************************************/ /*******************************************************************/ -/* Begin GaimXfer callbacks for use when sending a file */ +/* Begin PurpleXfer callbacks for use when sending a file */ /*******************************************************************/ static gboolean @@ -639,7 +639,7 @@ } void -peer_oft_sendcb_init(GaimXfer *xfer) +peer_oft_sendcb_init(PurpleXfer *xfer) { PeerConnection *conn; size_t size; @@ -648,17 +648,17 @@ conn->flags |= PEER_CONNECTION_FLAG_APPROVED; /* Make sure the file size can be represented in 32 bits */ - size = gaim_xfer_get_size(xfer); + size = purple_xfer_get_size(xfer); if (size > G_MAXUINT32) { gchar *tmp, *size1, *size2; - size1 = gaim_str_size_to_units(size); - size2 = gaim_str_size_to_units(G_MAXUINT32); + size1 = purple_str_size_to_units(size); + size2 = purple_str_size_to_units(G_MAXUINT32); tmp = g_strdup_printf(_("File %s is %s, which is larger than " "the maximum size of %s."), xfer->local_filename, size1, size2); - gaim_xfer_error(gaim_xfer_get_type(xfer), - gaim_xfer_get_account(xfer), xfer->who, tmp); + purple_xfer_error(purple_xfer_get_type(xfer), + purple_xfer_get_account(xfer), xfer->who, tmp); g_free(size1); g_free(size2); g_free(tmp); @@ -693,14 +693,14 @@ * of as a transferring just a single file. The rendezvous * establishes a connection between two computers, and then * those computers can use the same connection for transferring - * multiple files. So we don't want the Gaim core up and closing + * multiple files. So we don't want the Purple core up and closing * the socket all willy-nilly. We want to do that in the oscar * prpl, whenever one side or the other says they're finished * using the connection. There might be a better way to intercept * the socket from the core... */ void -peer_oft_sendcb_ack(GaimXfer *xfer, const guchar *buffer, size_t size) +peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size) { PeerConnection *conn; @@ -710,26 +710,26 @@ * If we're done sending, intercept the socket from the core ft code * and wait for the other guy to send the "done" OFT packet. */ - if (gaim_xfer_get_bytes_remaining(xfer) <= 0) + if (purple_xfer_get_bytes_remaining(xfer) <= 0) { - gaim_input_remove(xfer->watcher); + purple_input_remove(xfer->watcher); conn->fd = xfer->fd; xfer->fd = -1; - conn->watcher_incoming = gaim_input_add(conn->fd, - GAIM_INPUT_READ, peer_connection_recv_cb, conn); + conn->watcher_incoming = purple_input_add(conn->fd, + PURPLE_INPUT_READ, peer_connection_recv_cb, conn); } } /*******************************************************************/ -/* End GaimXfer callbacks for use when sending a file */ +/* End PurpleXfer callbacks for use when sending a file */ /*******************************************************************/ /*******************************************************************/ -/* Begin GaimXfer callbacks for use when sending and receiving */ +/* Begin PurpleXfer callbacks for use when sending and receiving */ /*******************************************************************/ void -peer_oft_cb_generic_cancel(GaimXfer *xfer) +peer_oft_cb_generic_cancel(PurpleXfer *xfer) { PeerConnection *conn; @@ -742,7 +742,7 @@ } /*******************************************************************/ -/* End GaimXfer callbacks for use when sending and receiving */ +/* End PurpleXfer callbacks for use when sending and receiving */ /*******************************************************************/ #ifdef TODOFT @@ -752,7 +752,7 @@ * ninja. * * The series of events for a file send is: - * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) + * -Create xfer and call purple_xfer_request (this happens in oscar_ask_sendfile) * -User chooses a file and oscar_xfer_init is called. It establishes a * listening socket, then asks the remote user to connect to us (and * gives them the file name, port, IP, etc.) @@ -764,8 +764,8 @@ * -We get drunk because file transfer kicks ass. * * The series of events for a file receive is: - * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) - * -Gaim user selects file to name and location to save file to and + * -Create xfer and call purple_xfer request (this happens in incomingim_chan2) + * -Purple user selects file to name and location to save file to and * oscar_xfer_init is called * -It connects to the remote user using the IP they gave us earlier * -After connecting, they send us an PEER_TYPE_PROMPT. In reply, we send