mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 01:43:01 +01:00
.
This commit is contained in:
commit
92c0f737ac
@ -521,7 +521,7 @@ void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
on_error:
|
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);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,6 +550,31 @@ on_error:
|
|||||||
print_err (self, error_str);
|
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])
|
void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||||
{
|
{
|
||||||
uint8_t* error_str;
|
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; }
|
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 != ErrorNone ) {
|
||||||
if ( error == ErrorNoCall ) error_str = "No call!";
|
if ( error == ErrorNoCall ) error_str = "No call!";
|
||||||
|
@ -48,7 +48,7 @@ extern ToxicFriend friends[MAX_FRIENDS_NUM];
|
|||||||
extern struct _Winthread Winthread;
|
extern struct _Winthread Winthread;
|
||||||
|
|
||||||
#ifdef _SUPPORT_AUDIO
|
#ifdef _SUPPORT_AUDIO
|
||||||
#define AC_NUM_CHAT_COMMANDS 22
|
#define AC_NUM_CHAT_COMMANDS 23
|
||||||
#else
|
#else
|
||||||
#define AC_NUM_CHAT_COMMANDS 18
|
#define AC_NUM_CHAT_COMMANDS 18
|
||||||
#endif /* _SUPPORT_AUDIO */
|
#endif /* _SUPPORT_AUDIO */
|
||||||
@ -79,6 +79,7 @@ static const uint8_t chat_cmd_list[AC_NUM_CHAT_COMMANDS][MAX_CMDNAME_SIZE] = {
|
|||||||
{ "/call" },
|
{ "/call" },
|
||||||
{ "/cancel" },
|
{ "/cancel" },
|
||||||
{ "/answer" },
|
{ "/answer" },
|
||||||
|
{ "/reject" },
|
||||||
{ "/hangup" },
|
{ "/hangup" },
|
||||||
|
|
||||||
#endif /* _SUPPORT_AUDIO */
|
#endif /* _SUPPORT_AUDIO */
|
||||||
@ -342,7 +343,7 @@ void chat_onInvite (ToxWindow *self, ToxAv *av)
|
|||||||
if (self->num != toxav_get_peer_id(av, 0))
|
if (self->num != toxav_get_peer_id(av, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t *msg = "Incoming audio call!\nType: \"/answer\" or \"/cancel\"";
|
uint8_t *msg = "Incoming audio call!\nType: \"/answer\" or \"/reject\"";
|
||||||
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);
|
||||||
|
|
||||||
alert_window(self, WINDOW_ALERT_0, true);
|
alert_window(self, WINDOW_ALERT_0, true);
|
||||||
@ -353,7 +354,7 @@ void chat_onRinging (ToxWindow *self, ToxAv *av)
|
|||||||
if (self->num != toxav_get_peer_id(av, 0))
|
if (self->num != toxav_get_peer_id(av, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t *msg = "Ringing...\n\"/cancel\" ?";
|
uint8_t *msg = "Ringing...\n\"cancel\" ?";
|
||||||
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ void cmd_chat_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
|
|||||||
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
||||||
|
|
||||||
#ifdef _SUPPORT_AUDIO
|
#ifdef _SUPPORT_AUDIO
|
||||||
#define NUMLINES 12
|
#define NUMLINES 13
|
||||||
#else
|
#else
|
||||||
#define NUMLINES 8
|
#define NUMLINES 9
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t lines[NUMLINES][MAX_STR_SIZE] = {
|
uint8_t lines[NUMLINES][MAX_STR_SIZE] = {
|
||||||
@ -64,6 +64,7 @@ void cmd_chat_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
|
|||||||
{ " /call : Audio call" },
|
{ " /call : Audio call" },
|
||||||
{ " /cancel : Cancel call" },
|
{ " /cancel : Cancel call" },
|
||||||
{ " /answer : Answer incomming call" },
|
{ " /answer : Answer incomming call" },
|
||||||
|
{ " /reject : Reject incoming call" },
|
||||||
{ " /hangup : Hangup active call" },
|
{ " /hangup : Hangup active call" },
|
||||||
#endif /* _SUPPORT_AUDIO */
|
#endif /* _SUPPORT_AUDIO */
|
||||||
{ " /invite <n> : Invite friend to a group chat" },
|
{ " /invite <n> : Invite friend to a group chat" },
|
||||||
|
@ -30,6 +30,7 @@ void cmd_sendfile(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_S
|
|||||||
#ifdef _SUPPORT_AUDIO
|
#ifdef _SUPPORT_AUDIO
|
||||||
void cmd_call(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
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_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_hangup(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
||||||
void cmd_cancel(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 */
|
#endif /* _SUPPORT_AUDIO */
|
||||||
|
@ -71,6 +71,7 @@ static struct cmd_func chat_commands[] = {
|
|||||||
{ "/call", cmd_call },
|
{ "/call", cmd_call },
|
||||||
{ "/cancel", cmd_cancel },
|
{ "/cancel", cmd_cancel },
|
||||||
{ "/answer", cmd_answer },
|
{ "/answer", cmd_answer },
|
||||||
|
{ "/reject", cmd_reject },
|
||||||
{ "/hangup", cmd_hangup },
|
{ "/hangup", cmd_hangup },
|
||||||
#endif /* _SUPPORT_AUDIO */
|
#endif /* _SUPPORT_AUDIO */
|
||||||
};
|
};
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#ifdef _SUPPORT_AUDIO
|
#ifdef _SUPPORT_AUDIO
|
||||||
#define GLOBAL_NUM_COMMANDS 16
|
#define GLOBAL_NUM_COMMANDS 16
|
||||||
#define CHAT_NUM_COMMANDS 9
|
#define CHAT_NUM_COMMANDS 10
|
||||||
#else
|
#else
|
||||||
#define GLOBAL_NUM_COMMANDS 14
|
#define GLOBAL_NUM_COMMANDS 14
|
||||||
#define CHAT_NUM_COMMANDS 5
|
#define CHAT_NUM_COMMANDS 5
|
||||||
|
Loading…
Reference in New Issue
Block a user