# HG changeset patch # User Mark Doliner # Date 1121745114 0 # Node ID 2a3568cbd8a6f68eb99b88b97bfc97343b0f629b # Parent 072d80ba330d0d80fe0145d3d7f812786f1f9cab [gaim-migrate @ 13182] Whitespace committer: Tailor Script diff -r 072d80ba330d -r 2a3568cbd8a6 src/protocols/oscar/ft.c --- a/src/protocols/oscar/ft.c Tue Jul 19 00:29:59 2005 +0000 +++ b/src/protocols/oscar/ft.c Tue Jul 19 03:51:54 2005 +0000 @@ -2,40 +2,40 @@ * Oscar File transfer (OFT) and Oscar Direct Connect (ODC). * (ODC is also referred to as DirectIM and IM Image.) * - * There are a few static helper functions at the top, then + * There are a few static helper functions at the top, then * ODC stuff, then ft stuff. * - * I feel like this is a good place to explain OFT, so I'm going to - * do just that. Each OFT packet has a header type. I guess this - * is pretty similar to the subtype of a SNAC packet. The type - * basically tells the other client the meaning of the OFT packet. - * There are two distinct types of file transfer, which I usually - * call "sendfile" and "getfile." Sendfile is when you send a file - * to another AIM user. Getfile is when you share a group of files, + * I feel like this is a good place to explain OFT, so I'm going to + * do just that. Each OFT packet has a header type. I guess this + * is pretty similar to the subtype of a SNAC packet. The type + * basically tells the other client the meaning of the OFT packet. + * There are two distinct types of file transfer, which I usually + * call "sendfile" and "getfile." Sendfile is when you send a file + * to another AIM user. Getfile is when you share a group of files, * and other users request that you send them the files. * * A typical sendfile file transfer goes like this: - * 1) Sender sends a channel 2 ICBM telling the other user that - * we want to send them a file. At the same time, we open a - * listener socket (this should be done before sending the - * ICBM) on some port, and wait for them to connect to us. - * The ICBM we sent should contain our IP address and the port + * 1) Sender sends a channel 2 ICBM telling the other user that + * we want to send them a file. At the same time, we open a + * listener socket (this should be done before sending the + * ICBM) on some port, and wait for them to connect to us. + * The ICBM we sent should contain our IP address and the port * number that we're listening on. - * 2) The receiver connects to the sender on the given IP address - * and port. After the connection is established, the receiver + * 2) The receiver connects to the sender on the given IP address + * and port. After the connection is established, the receiver * sends an ICBM signifying that we are ready and waiting. - * 3) The sender sends an OFT PROMPT message over the OFT + * 3) The sender sends an OFT PROMPT message over the OFT * connection. - * 4) The receiver of the file sends back an exact copy of this - * OFT packet, except the cookie is filled in with the cookie - * from the ICBM. I think this might be an attempt to verify - * that the user that is connected is actually the guy that + * 4) The receiver of the file sends back an exact copy of this + * OFT packet, except the cookie is filled in with the cookie + * from the ICBM. I think this might be an attempt to verify + * that the user that is connected is actually the guy that * we sent the ICBM to. Oh, I've been calling this the ACK. - * 5) The sender starts sending raw data across the connection + * 5) The sender starts sending raw data across the connection * until the entire file has been sent. - * 6) The receiver knows the file is finished because the sender - * sent the file size in an earlier OFT packet. So then the - * receiver sends the DONE thingy (after filling in the + * 6) The receiver knows the file is finished because the sender + * sent the file size in an earlier OFT packet. So then the + * receiver sends the DONE thingy (after filling in the * "received" checksum and size) and closes the connection. */ @@ -112,18 +112,18 @@ /** * Calculate oft checksum of buffer * - * Prevcheck should be 0xFFFF0000 when starting a checksum of a file. The - * checksum is kind of a rolling checksum thing, so each time you get bytes - * of a file you just call this puppy and it updates the checksum. You can - * calculate the checksum of an entire file by calling this in a while or a + * Prevcheck should be 0xFFFF0000 when starting a checksum of a file. The + * checksum is kind of a rolling checksum thing, so each time you get bytes + * of a file you just call this puppy and it updates the checksum. You can + * calculate the checksum of an entire file by calling this in a while or a * for loop, or something. * - * Thanks to Graham Booker for providing this improved checksum routine, - * which is simpler and should be more accurate than Josh Myer's original + * Thanks to Graham Booker for providing this improved checksum routine, + * which is simpler and should be more accurate than Josh Myer's original * code. -- wtm * - * This algorithm works every time I have tried it. The other fails - * sometimes. So, AOL who thought this up? It has got to be the weirdest + * This algorithm works every time I have tried it. The other fails + * sometimes. So, AOL who thought this up? It has got to be the weirdest * checksum I have ever seen. * * @param buffer Buffer of data to checksum. Man I'd like to buff her... @@ -144,7 +144,7 @@ val = buffer[i] << 8; check -= val; /* - * The following appears to be necessary.... It happens + * The following appears to be necessary.... It happens * every once in a while and the checksum doesn't fail. */ if (check > oldcheck) @@ -244,7 +244,7 @@ * * @param sess The session. * @param conn The already-connected ODC connection. - * @param typing If 0x0002, sends a "typing" message, 0x0001 sends "typed," and + * @param typing If 0x0002, sends a "typing" message, 0x0001 sends "typed," and * 0x0000 sends "stopped." * @return Return 0 if no errors, otherwise return the error number. */ @@ -317,7 +317,7 @@ /** * Send client-to-client IM over an established direct connection. * Call this just like you would aim_send_im, to send a directim. - * + * * @param sess The session. * @param conn The already-connected ODC connection. * @param msg Null-terminated string to send. @@ -446,7 +446,7 @@ * * @param sess The session. * @param sn The screen name of the buddy whose direct connection you want to find. - * @return The conn for the direct connection with the given buddy, or NULL if no + * @return The conn for the direct connection with the given buddy, or NULL if no * connection was found. */ faim_export aim_conn_t *aim_odc_getconn(aim_session_t *sess, const char *sn) @@ -534,7 +534,7 @@ * * This is a wrapper for aim_newconn. * - * If addr is NULL, the socket is not created, but the connection is + * If addr is NULL, the socket is not created, but the connection is * allocated and setup to connect. * * @param sess The Godly session. @@ -631,7 +631,7 @@ while (payloadlength - recvd) { if (payloadlength - recvd >= 1024) i = aim_recv(conn->fd, &msg[recvd], 1024); - else + else i = aim_recv(conn->fd, &msg[recvd], payloadlength - recvd); if (i <= 0) { free(msg); @@ -642,7 +642,7 @@ if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER))) ret = userfunc(sess, &fr, snptr, (double)recvd / payloadlength); } - + if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING))) ret = userfunc(sess, &fr, snptr, msg, payloadlength, encoding, isawaymsg); @@ -696,7 +696,7 @@ } /** - * Remove the given oft_info struct from the oft_info linked list, and + * Remove the given oft_info struct from the oft_info linked list, and * then free its memory. * * @param sess The session. @@ -731,13 +731,13 @@ /** * Creates a listener socket so the other dude can connect to us. * - * You'll want to set up some kind of watcher on this socket. - * When the state changes, call aim_handlerendconnection with - * the connection returned by this. aim_handlerendconnection + * You'll want to set up some kind of watcher on this socket. + * When the state changes, call aim_handlerendconnection with + * the connection returned by this. aim_handlerendconnection * will accept the pending connection and stop listening. * * @param sess The session. - * @param oft_info File transfer information associated with this + * @param oft_info File transfer information associated with this * connection. * @return Return 0 if no errors, otherwise return the error number. */ @@ -801,7 +801,7 @@ fh->name[63] = '\0'; return fh; -} +} /** * Fills a buffer with network-order fh data @@ -811,7 +811,7 @@ * @return Return non-zero on error. */ static int aim_oft_buildheader(aim_bstream_t *bs, struct aim_fileheader_t *fh) -{ +{ fu8_t *hdr; if (!bs || !fh) @@ -856,7 +856,7 @@ * * @param sess The session. * @param type The subtype of the OFT packet we're sending. - * @param oft_info The aim_oft_info struct with the connection and OFT + * @param oft_info The aim_oft_info struct with the connection and OFT * info we're sending. * @return Return 0 if no errors, otherwise return the error number. */ @@ -869,8 +869,8 @@ #if 0 /* - * If you are receiving a file, the cookie should be null, if you are sending a - * file, the cookie should be the same as the one used in the ICBM negotiation + * If you are receiving a file, the cookie should be null, if you are sending a + * file, the cookie should be the same as the one used in the ICBM negotiation * SNACs. */ fh->lnameoffset = 0x1a; @@ -900,13 +900,13 @@ } /** - * Handle incoming data on a rendezvous connection. This is analogous to the - * consumesnac function in rxhandlers.c, and I really think this should probably + * Handle incoming data on a rendezvous connection. This is analogous to the + * consumesnac function in rxhandlers.c, and I really think this should probably * be in rxhandlers.c as well, but I haven't finished cleaning everything up yet. * * @param sess The session. * @param fr The frame allocated for the incoming data. - * @return Return 0 if the packet was handled correctly, otherwise return the + * @return Return 0 if the packet was handled correctly, otherwise return the * error number. */ faim_internal int aim_rxdispatch_rendezvous(aim_session_t *sess, aim_frame_t *fr)