summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpranomostro <pranomostro@posteo.net>2017-05-15 11:43:21 +0200
committerpranomostro <pranomostro@posteo.net>2017-05-15 11:43:21 +0200
commited084d2111166998cd9b9ef7d64c4f62ceb5549c (patch)
tree736a57093e7461fd6d6ed56c702f6ec83bc59942
parent96ac996477712ca79adb31e715328c9b3e727ca6 (diff)
Update API so that conf/in accepts flags for the conference type.
-rw-r--r--README2
-rw-r--r--ratox.111
-rw-r--r--ratox.c18
3 files changed, 22 insertions, 9 deletions
diff --git a/README b/README
index 101a7b0..dbb8bda 100644
--- 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
index 70e98e4..9e5149b 100644
--- 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
index 2130916..2f303dd 100644
--- 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");