mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 15:03:27 +01:00
Merge branch 'master' of https://github.com/mannol1/toxic
This commit is contained in:
commit
5956c6acaf
@ -498,7 +498,7 @@ void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
||||
|
||||
return;
|
||||
on_error:
|
||||
wprintw(window, "%s %d\n", error_str, argc);
|
||||
wprintw(window, "%s\n", error_str);
|
||||
}
|
||||
|
||||
void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
@ -526,6 +526,31 @@ on_error:
|
||||
wprintw(window, "%s\n", error_str);
|
||||
}
|
||||
|
||||
void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
const char* error_str;
|
||||
|
||||
if (argc != 0) { error_str = "Invalid syntax!"; goto on_error; }
|
||||
|
||||
if ( !ASettins.av ) { error_str = "Audio not supported!"; goto on_error; }
|
||||
|
||||
ToxAvError error = toxav_reject(ASettins.av, "Why not?");
|
||||
|
||||
if ( error != ErrorNone ) {
|
||||
if ( error == ErrorInvalidState ) error_str = "Cannot reject in invalid state!";
|
||||
else if ( error == ErrorNoCall ) error_str = "No incomming call!";
|
||||
else error_str = "Internal error!";
|
||||
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
/* Callback will print status... */
|
||||
|
||||
return;
|
||||
on_error:
|
||||
wprintw(window, "%s\n", error_str);
|
||||
}
|
||||
|
||||
void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
const char* error_str;
|
||||
@ -557,7 +582,7 @@ void cmd_cancel(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
|
||||
if ( !ASettins.av ) { error_str = "Audio not supported!"; goto on_error; }
|
||||
|
||||
ToxAvError error = toxav_hangup(ASettins.av);
|
||||
ToxAvError error = toxav_cancel(ASettins.av, self->num, "Only those who appreciate small things know the beauty of life");
|
||||
|
||||
if ( error != ErrorNone ) {
|
||||
if ( error == ErrorNoCall ) error_str = "No call!";
|
||||
|
@ -47,7 +47,7 @@ extern ToxicFriend friends[MAX_FRIENDS_NUM];
|
||||
extern struct _Winthread Winthread;
|
||||
|
||||
#ifdef _SUPPORT_AUDIO
|
||||
#define AC_NUM_CHAT_COMMANDS 22
|
||||
#define AC_NUM_CHAT_COMMANDS 23
|
||||
#else
|
||||
#define AC_NUM_CHAT_COMMANDS 18
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
@ -78,6 +78,7 @@ static const uint8_t chat_cmd_list[AC_NUM_CHAT_COMMANDS][MAX_CMDNAME_SIZE] = {
|
||||
{ "/call" },
|
||||
{ "/cancel" },
|
||||
{ "/answer" },
|
||||
{ "/reject" },
|
||||
{ "/hangup" },
|
||||
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
@ -349,7 +350,7 @@ void chat_onInvite (ToxWindow *self, ToxAv *av)
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
wprintw(ctx->history, "Incoming audio call!\n"
|
||||
"Answer: \"/answer\" \"/cancel\"\n");
|
||||
"Answer: \"/answer\" \"/reject\"\n");
|
||||
|
||||
alert_window(self, WINDOW_ALERT_0, true);
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ void cmd_chat_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
|
||||
wprintw(window, " /call : Audio call\n");
|
||||
wprintw(window, " /cancel : Cancel call\n");
|
||||
wprintw(window, " /answer : Answer incomming call\n");
|
||||
wprintw(window, " /reject : Reject incomming call\n");
|
||||
wprintw(window, " /hangup : Hangup active call\n");
|
||||
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
|
@ -30,6 +30,7 @@ void cmd_sendfile(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_S
|
||||
#ifdef _SUPPORT_AUDIO
|
||||
void cmd_call(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
||||
void cmd_answer(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
||||
void cmd_reject(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
||||
void cmd_hangup(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
||||
void cmd_cancel(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
|
@ -70,6 +70,7 @@ static struct cmd_func chat_commands[] = {
|
||||
{ "/call", cmd_call },
|
||||
{ "/cancel", cmd_cancel },
|
||||
{ "/answer", cmd_answer },
|
||||
{ "/reject", cmd_reject },
|
||||
{ "/hangup", cmd_hangup },
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user