1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-04 23:56:45 +02:00
This commit is contained in:
Jfreegman
2014-03-25 22:02:48 -04:00
6 changed files with 37 additions and 8 deletions

View File

@ -521,7 +521,7 @@ void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
return;
on_error:
snprintf(msg ,sizeof(msg), "%s %d", error_str, argc);
snprintf(msg, sizeof(msg), "%s", error_str);
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);
}
@ -550,6 +550,31 @@ on_error:
print_err (self, error_str);
}
void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
uint8_t* 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:
print_err (self, error_str);
}
void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
uint8_t* error_str;
@ -581,7 +606,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!";