mirror of
https://github.com/Tha14/toxic.git
synced 2025-06-20 13:36:36 +02:00
wat
This commit is contained in:
@ -39,6 +39,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenAL/al.h>
|
||||
#include <OpenAL/alc.h>
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#endif
|
||||
|
||||
#define _cbend pthread_exit(NULL)
|
||||
|
||||
#define MAX_CALLS 10
|
||||
@ -403,7 +411,7 @@ void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
|
||||
if ( error != ErrorNone ) {
|
||||
if ( error == ErrorInvalidState ) error_str = "Cannot answer in invalid state!";
|
||||
else if ( error == ErrorNoCall ) error_str = "No incomming call!";
|
||||
else if ( error == ErrorNoCall ) error_str = "No incoming call!";
|
||||
else error_str = "Internal error!";
|
||||
|
||||
goto on_error;
|
||||
@ -434,7 +442,7 @@ void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
|
||||
if ( error != ErrorNone ) {
|
||||
if ( error == ErrorInvalidState ) error_str = "Cannot reject in invalid state!";
|
||||
else if ( error == ErrorNoCall ) error_str = "No incomming call!";
|
||||
else if ( error == ErrorNoCall ) error_str = "No incoming call!";
|
||||
else error_str = "Internal error!";
|
||||
|
||||
goto on_error;
|
||||
@ -725,4 +733,4 @@ void cmd_sense(WINDOW * window, ToxWindow * self, Tox *m, int argc, char (*argv)
|
||||
|
||||
on_error:
|
||||
print_err (self, error_str);
|
||||
}
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ void chat_onInvite (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
self->call_idx = call_index;
|
||||
|
||||
line_info_add(self, NULL, NULL, NULL, "Incoming audio call!\nType: \"/answer\" or \"/reject\"", SYS_MSG, 0, 0);
|
||||
line_info_add(self, NULL, NULL, NULL, "Incoming audio call! Type: \"/answer\" or \"/reject\"", SYS_MSG, 0, 0);
|
||||
|
||||
alert_window(self, WINDOW_ALERT_0, true);
|
||||
}
|
||||
@ -443,7 +443,7 @@ void chat_onRinging (ToxWindow *self, ToxAv *av, int call_index)
|
||||
if ( self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
line_info_add(self, NULL, NULL, NULL, "Ringing...\n\"cancel\" ?", SYS_MSG, 0, 0);
|
||||
line_info_add(self, NULL, NULL, NULL, "Ringing...\"cancel\" ?", SYS_MSG, 0, 0);
|
||||
}
|
||||
|
||||
void chat_onStarting (ToxWindow *self, ToxAv *av, int call_index)
|
||||
@ -451,7 +451,7 @@ void chat_onStarting (ToxWindow *self, ToxAv *av, int call_index)
|
||||
if ( self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
line_info_add(self, NULL, NULL, NULL, "Call started!\nType: \"/hangup\" to end it.", SYS_MSG, 0, 0);
|
||||
line_info_add(self, NULL, NULL, NULL, "Call started! Type: \"/hangup\" to end it.", SYS_MSG, 0, 0);
|
||||
}
|
||||
|
||||
void chat_onEnding (ToxWindow *self, ToxAv *av, int call_index)
|
||||
@ -477,7 +477,7 @@ void chat_onStart (ToxWindow *self, ToxAv *av, int call_index)
|
||||
if ( self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
line_info_add(self, NULL, NULL, NULL, "Call started!\nType: \"/hangup\" to end it.", SYS_MSG, 0, 0);
|
||||
line_info_add(self, NULL, NULL, NULL, "Call started! Type: \"/hangup\" to end it.", SYS_MSG, 0, 0);
|
||||
}
|
||||
|
||||
void chat_onCancel (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "toxic.h"
|
||||
#include "windows.h"
|
||||
@ -38,14 +39,9 @@ void add_char_to_buf(ChatContext *ctx, wint_t ch)
|
||||
if (ctx->pos < 0 || ctx->len >= MAX_STR_SIZE)
|
||||
return;
|
||||
|
||||
/* move all chars including null in front of pos one space forward and insert char in pos */
|
||||
int i;
|
||||
|
||||
for (i = ctx->len; i >= ctx->pos && i >= 0; --i)
|
||||
ctx->line[i + 1] = ctx->line[i];
|
||||
|
||||
wmemmove(&ctx->line[ctx->pos + 1], &ctx->line[ctx->pos], ctx->len - ctx->pos);
|
||||
ctx->line[ctx->pos++] = ch;
|
||||
++ctx->len;
|
||||
ctx->line[++ctx->len] = L'\0';
|
||||
}
|
||||
|
||||
/* Deletes the character before pos */
|
||||
@ -54,14 +50,9 @@ void del_char_buf_bck(ChatContext *ctx)
|
||||
if (ctx->pos <= 0)
|
||||
return;
|
||||
|
||||
int i;
|
||||
|
||||
/* similar to add_char_to_buf but deletes a char */
|
||||
for (i = ctx->pos - 1; i <= ctx->len; ++i)
|
||||
ctx->line[i] = ctx->line[i + 1];
|
||||
|
||||
wmemmove(&ctx->line[ctx->pos - 1], &ctx->line[ctx->pos], ctx->len - ctx->pos);
|
||||
--ctx->pos;
|
||||
--ctx->len;
|
||||
ctx->line[--ctx->len] = L'\0';
|
||||
}
|
||||
|
||||
/* Deletes the character at pos */
|
||||
@ -70,12 +61,8 @@ void del_char_buf_frnt(ChatContext *ctx)
|
||||
if (ctx->pos < 0 || ctx->pos >= ctx->len)
|
||||
return;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = ctx->pos; i < ctx->len; ++i)
|
||||
ctx->line[i] = ctx->line[i + 1];
|
||||
|
||||
--ctx->len;
|
||||
wmemmove(&ctx->line[ctx->pos], &ctx->line[ctx->pos + 1], ctx->len - ctx->pos - 1);
|
||||
ctx->line[--ctx->len] = L'\0';
|
||||
}
|
||||
|
||||
/* Deletes the line from beginning to pos */
|
||||
@ -84,15 +71,11 @@ void discard_buf(ChatContext *ctx)
|
||||
if (ctx->pos <= 0)
|
||||
return;
|
||||
|
||||
int i;
|
||||
int c = 0;
|
||||
|
||||
for (i = ctx->pos; i <= ctx->len; ++i)
|
||||
ctx->line[c++] = ctx->line[i];
|
||||
|
||||
wmemmove(ctx->line, &ctx->line[ctx->pos], ctx->len - ctx->pos);
|
||||
ctx->len -= ctx->pos;
|
||||
ctx->pos = 0;
|
||||
ctx->start = 0;
|
||||
ctx->len = c - 1;
|
||||
ctx->line[ctx->len] = L'\0';
|
||||
}
|
||||
|
||||
/* Deletes the line from pos to len */
|
||||
|
Reference in New Issue
Block a user