From ed084d2111166998cd9b9ef7d64c4f62ceb5549c Mon Sep 17 00:00:00 2001 From: pranomostro Date: Mon, 15 May 2017 11:43:21 +0200 Subject: Update API so that conf/in accepts flags for the conference type. --- ratox.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ratox.c') 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"); -- cgit v1.2.3