summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2014-09-21Lay the ground for IPv6 supportsin
2014-09-21Update nodelistsin
2014-09-21Only close file descriptors when they are not -1sin
2014-09-21Add shutdown() for clean exit...This also sends a broadcast to all friends you went offline, leading to an immediate event-feedback. FRIGN
2014-09-20fiforead() should accept a void * instead of char *...Remove ugly casts. sin
2014-09-20Fix off-by-one bugs when calling fiforead()...dirfd should be the first arg to be consistent with other functions. sin
2014-09-20Refactor sendfriendreq()...Put the error-strings in one single data-structure and flush the err-file every time before a new incoming request, so it's empty when the request succeeds. FRIGN
2014-09-20Implement fiforead()...fiforead() automatically reopens a file-descriptor in case it returns EOF (return 0). It returns -1 on error. FRIGN
2014-09-19Initialize fdmaxsin
2014-09-19Factor out fifoflush() in a separate func...Also flush the fifo for stalled transfers sin
2014-09-19Clear up the enums and fix implicit condition-bug...The OUT_F-type was not clear. Make it easier to see the out-file has no state (=NONE) and is defined for each slot individually. Moreover, in the initial creation, the err-file fell through just because STATIC = 0 and .outfile wasn't defined for it. It was only coincidence this worked and now we have a much more bulletproof implementation. FRIGN
2014-09-19Handle rejected transferssin
2014-09-19Fix PAUSE/RESUME in file transfers...The doc lies, if the receiver resumes a transfer you get a control packet with send_receive == 1 and control_type == TOX_FILECONTROL_ACCEPT. We keep state locally and move from PAUSED to INPROGRESS when the above happens. sin
2014-09-19Add TRANSFER_PAUSED state...Doesn't quite work yet though. sin
2014-09-19Inform the user when a transfer is in progresssin
2014-09-19Fix file transfers + texting to use O_RDONLY for FIFOs...Just re-open them to clear EOF. sin
2014-09-19Change global in-fifos from O_RDWR to O_RDONLY...O_RDWR is a dirty hack to get around the issue of infinite EOFs while reading an in-FIFO. Instead, stop breaking POSIX and set the FIFOs to O_RDONLY. In case a read returns EOF (r == 0), we reopen the fd. Same will be applied to the friend-fifos (especially file_in), helping us get rid of strange timeouts and heuristics and rather solve the problem the POSIX-way. The only downside to this is that we are blind for writes to the in-FIFOs between catching read == 0 and close(), but this is not an issue. To make reopening as easy as possible, I added a dirfd to all slots. While at it, I changed the initial setup and removed the chdir() in favor of the POSIX-2008-compliant *at-functions. This lets us do stuff without having to use snprintf to build paths and is more bulletproof even in case the directory is renamed. FRIGN
2014-09-18Missed some moresin
2014-09-18No need to specify modes, default to 0644 and 0777sin
2014-09-18OUT_F is reserved for the edge-case where we don't know if OUT is a STATIC or......So use STATIC here. sin
2014-09-18Print a message when we reject a friend requestsin
2014-09-18Allow the user to reject a friend requestsin
2014-09-18We need O_WRONLY for text_out as wellsin
2014-09-18Remember to ftruncate() before updating the filessin
2014-09-18Remove writeline()sin
2014-09-18We can't use TAILQ_REMOVE inside TAILQ_FOREACHsin
2014-09-18Add fifos for incoming requests and remove cmd-parserFRIGN
2014-09-18Rework file-transfers...For aborted transfers, we will have to move the transfer to the TRANSFER_KILLED state. Then we'll have to wait until the input FIFO stops being readable (the user ^C the transfer). Only then can we move to TRANSFER_NONE. If we move to TRANSFER_NONE immediately then we will initiate a new transfer which we don't want to do. The basic idea is: If we move into the TRANSFER_KILLED state and timeout has expired (50ms?) without the fd being readable (the user did a ^C on cat file > file_in) then move the transfer to TRANSFER_NONE state. sin
2014-09-17Fix wall of gcc-warningsFRIGN
2014-09-17Rename ratatox to ratoxsin
2014-09-17Save state to `.ratatox.data'...Makes it a bit more difficult to accidentally delete it and the user can't really interact with it so make it hidden. sin
2014-09-17Fix FIFO crazinesssin
2014-09-17Fix select() spinsin
2014-09-17Ensure proper permissions on request/outsin
2014-09-17Remember to ftruncate() before dprintf()sin
2014-09-17Rework data-structuresFRIGN
2014-09-17It is text_out not textoutsin
2014-09-17Use upper-case when printing IDssin
2014-09-16Catch TOX_FAERR_{BADCHECKSUM,SETNEWNOSPAM}sin
2014-09-16Add FIFO for sending a friend requestsin
2014-09-16Rename functions to keep style consistentsin
2014-09-16Add comment like we do for the name and idsin
2014-09-16Add support for changing the status messagesin
2014-09-16Make writeline() more genericsin
2014-09-16Make callbacks more genericsin
2014-09-16Start using callbacks to make the main loop less uglysin
2014-09-16Name setting and printing the ID are now exposed via the fs...We will gradually expose the other commands as well. sin
2014-09-16When initiating a transfer, print the nickname of the friendsin
2014-09-16Print message when transfers startsin
2014-09-16Detect and cleanup stale transferssin