mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-04 06:36:46 +02:00
Compare commits
4 Commits
line_break
...
cec96e1ea3
Author | SHA1 | Date | |
---|---|---|---|
cec96e1ea3 | |||
eb7e6151a2 | |||
22ca3704d2 | |||
fdfaaf953f |
@ -130,7 +130,7 @@ static void set_self_typingstatus(ToxWindow *self, Tox *m, bool is_typing)
|
|||||||
|
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
TOX_ERR_SET_TYPING err;
|
Tox_Err_Set_Typing err;
|
||||||
tox_self_set_typing(m, self->num, is_typing, &err);
|
tox_self_set_typing(m, self->num, is_typing, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_SET_TYPING_OK) {
|
if (err != TOX_ERR_SET_TYPING_OK) {
|
||||||
|
@ -1129,7 +1129,7 @@ int game_packet_send(const GameData *game, const uint8_t *data, size_t length, G
|
|||||||
memcpy(packet + 1 + GAME_PACKET_HEADER_SIZE, data, length);
|
memcpy(packet + 1 + GAME_PACKET_HEADER_SIZE, data, length);
|
||||||
packet_length += length;
|
packet_length += length;
|
||||||
|
|
||||||
TOX_ERR_FRIEND_CUSTOM_PACKET err;
|
Tox_Err_Friend_Custom_Packet err;
|
||||||
|
|
||||||
if (!tox_friend_send_lossless_packet(game->tox, game->friend_number, packet, packet_length, &err)) {
|
if (!tox_friend_send_lossless_packet(game->tox, game->friend_number, packet, packet_length, &err)) {
|
||||||
fprintf(stderr, "failed to send game packet: error %d\n", err);
|
fprintf(stderr, "failed to send game packet: error %d\n", err);
|
||||||
|
@ -143,11 +143,14 @@ static struct line_info *line_info_ret_queue(struct history *hst)
|
|||||||
*/
|
*/
|
||||||
static int print_n_chars(WINDOW *win, const wchar_t *s, size_t n, int max_y)
|
static int print_n_chars(WINDOW *win, const wchar_t *s, size_t n, int max_y)
|
||||||
{
|
{
|
||||||
|
// we use an array to represent a single wchar in order to get around an ncurses
|
||||||
|
// bug with waddnwstr() that overreads the memory address by one byte when
|
||||||
|
// supplied with a single wchar.
|
||||||
|
wchar_t ch[2] = {0};
|
||||||
bool newline = false;
|
bool newline = false;
|
||||||
wchar_t ch;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < n && (ch = s[i]); ++i) {
|
for (size_t i = 0; i < n && (ch[0] = s[i]); ++i) {
|
||||||
if (ch == L'\n') {
|
if (ch[0] == L'\n') {
|
||||||
newline = true;
|
newline = true;
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
@ -164,11 +167,11 @@ static int print_n_chars(WINDOW *win, const wchar_t *s, size_t n, int max_y)
|
|||||||
|
|
||||||
if (win) {
|
if (win) {
|
||||||
#ifdef HAVE_WIDECHAR
|
#ifdef HAVE_WIDECHAR
|
||||||
waddnwstr(win, &ch, 1);
|
waddnwstr(win, ch, 1);
|
||||||
#else
|
#else
|
||||||
char b;
|
char b;
|
||||||
|
|
||||||
if (wcstombs(&b, &ch, sizeof(char)) != 1) {
|
if (wcstombs(&b, ch, sizeof(char)) != 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void cqueue_add(struct chat_queue *q, const char *msg, size_t len, uint8_t type,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cqueue_msg *new_m = malloc(sizeof(struct cqueue_msg));
|
struct cqueue_msg *new_m = calloc(1, sizeof(struct cqueue_msg));
|
||||||
|
|
||||||
if (new_m == NULL) {
|
if (new_m == NULL) {
|
||||||
exit_toxic_err("failed in cqueue_message", FATALERR_MEMORY);
|
exit_toxic_err("failed in cqueue_message", FATALERR_MEMORY);
|
||||||
@ -62,6 +62,7 @@ void cqueue_add(struct chat_queue *q, const char *msg, size_t len, uint8_t type,
|
|||||||
new_m->time_added = get_unix_time();
|
new_m->time_added = get_unix_time();
|
||||||
new_m->receipt = -1;
|
new_m->receipt = -1;
|
||||||
new_m->next = NULL;
|
new_m->next = NULL;
|
||||||
|
new_m->noread_flag = false;
|
||||||
|
|
||||||
if (q->root == NULL) {
|
if (q->root == NULL) {
|
||||||
new_m->prev = NULL;
|
new_m->prev = NULL;
|
||||||
@ -203,7 +204,7 @@ void cqueue_try_send(ToxWindow *self, Tox *m)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_FRIEND_SEND_MESSAGE err;
|
Tox_Err_Friend_Send_Message err;
|
||||||
Tox_Message_Type type = msg->type == OUT_MSG ? TOX_MESSAGE_TYPE_NORMAL : TOX_MESSAGE_TYPE_ACTION;
|
Tox_Message_Type type = msg->type == OUT_MSG ? TOX_MESSAGE_TYPE_NORMAL : TOX_MESSAGE_TYPE_ACTION;
|
||||||
uint32_t receipt = tox_friend_send_message(m, self->num, type, (uint8_t *) msg->message, msg->len, &err);
|
uint32_t receipt = tox_friend_send_message(m, self->num, type, (uint8_t *) msg->message, msg->len, &err);
|
||||||
|
|
||||||
|
@ -20,9 +20,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "api.h"
|
||||||
|
|
||||||
#ifdef PYTHON
|
#ifdef PYTHON
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include "api.h"
|
|
||||||
|
|
||||||
#include "execute.h"
|
#include "execute.h"
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ void exit_toxic_err(const char *errmsg, int errcode)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_toxcore_logger(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t line, const char *func,
|
void cb_toxcore_logger(Tox *m, Tox_Log_Level level, const char *file, uint32_t line, const char *func,
|
||||||
const char *message, void *user_data)
|
const char *message, void *user_data)
|
||||||
{
|
{
|
||||||
UNUSED_VAR(user_data);
|
UNUSED_VAR(user_data);
|
||||||
|
Reference in New Issue
Block a user