ratox

FIFO based tox client
git clone git://git.2f30.org/ratox.git
Log | Files | Refs | README | LICENSE

commit ed084d2111166998cd9b9ef7d64c4f62ceb5549c
parent 96ac996477712ca79adb31e715328c9b3e727ca6
Author: pranomostro <pranomostro@posteo.net>
Date:   Mon May 15 11:43:21 +0200

Update API so that conf/in accepts flags for the conference type.

Diffstat:
README | 2+-
ratox.1 | 11+++++++----
ratox.c | 18++++++++++++++----
3 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/README b/README @@ -66,7 +66,7 @@ to help explain the semantics of the individual files. | |-- conf # managing conferences | |-- err # conference related errors -| |-- in # 'echo "group title" >in' for creating a new group +| |-- in # 'echo 't group title' >in' for creating a new text group | |-- out # 'echo 1 >out/ID_COOKIE' for joining a conference | |-- name # changing your nick diff --git a/ratox.1 b/ratox.1 @@ -62,9 +62,12 @@ Request slot. Send a friend request by piping the Tox ID to \fBin\fR. Incoming requests are listed as FIFOs in \fBout/\fR. Echo \fB1\fR | \fB0\fR to accept | reject them. .It Ar conf/ -Conference management slot. A conference is created by writing its title to \fBin\fR. Invites -to conferences are FIFOs in \fBout/\fR. Their name is id_cookie (the cookie is random data). -They behave like request FIFOs. +Conference management slot. A conference is created by writing and flag +and its title to \fBin\fR. The flag is \fBt\fR | \fBa\fR | \fBv\fR for an +text, audio and video conference, followed by a space character. Only +text conferences work at the moment. Invites to conferences are FIFOs +in \fBout/\fR. Their name is id_cookie (the cookie is random data). They +behave like request FIFOs. .El .Ss Friend slots Each friend is represented with a directory in the base-directory named after @@ -126,7 +129,7 @@ Write here to change the title of the conference. .It Ar title_out Contains the title of the conference. .It Ar text_in -Echo \fBmessage\fR to send a text message to the conference. +Echo message to send a text message to the conference. .It Ar text_out Contains the messages send in the conference so far. .El diff --git a/ratox.c b/ratox.c @@ -1884,15 +1884,25 @@ newconf(void *data) { uint32_t cnum; size_t n; - char title[TOX_MAX_NAME_LENGTH + 1]; + char *title, input[TOX_MAX_NAME_LENGTH + 2 + 1]; n = fiforead(gslots[CONF].dirfd, &gslots[CONF].fd[IN], gfiles[IN], - title, sizeof(title) - 1); + input, sizeof(input) - 1); if (n <= 0) return; - if (title[n - 1] == '\n') + if (input[n - 1] == '\n') n--; - title[n] = '\0'; + input[n] = '\0'; + if(!((input[0] == 't' || input[0] == 'a' || input[0] == 'v') && input[1] == ' ')) { + weprintf("No flag found in input\n"); + return; + } + if(input[0] == 'a' || input[0] == 'v') { + weprintf("Conferences other than text not supported yet\n"); + return; + } + title = input + 2; + n -= 2; cnum = tox_conference_new(tox, NULL); if (cnum == UINT32_MAX) { weprintf("Failed to create new conference\n");