mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-14 05:23:01 +01:00
Significantly reduce time before trying to re-send a message with no read receipt
(also some formatting cleanup)
This commit is contained in:
parent
3917f664bf
commit
815c29ee31
@ -133,7 +133,8 @@ DeviceError terminate_devices()
|
||||
return (DeviceError) de_None;
|
||||
}
|
||||
|
||||
void get_devices_names() {
|
||||
void get_devices_names()
|
||||
{
|
||||
|
||||
const char *stringed_device_list;
|
||||
|
||||
@ -487,7 +488,8 @@ void print_devices(ToxWindow *self, DeviceType type)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size[type]; ++i) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, i == primary_device[type] ? 1 : 0, 0, "%d: %s", i, devices_names[type][i]);
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, i == primary_device[type] ? 1 : 0, 0, "%d: %s", i,
|
||||
devices_names[type][i]);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -289,7 +289,7 @@ int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd)
|
||||
if (dp == NULL)
|
||||
return -1;
|
||||
|
||||
char dirnames[MAX_DIRS][NAME_MAX+1];
|
||||
char dirnames[MAX_DIRS][NAME_MAX + 1];
|
||||
struct dirent *entry;
|
||||
int dircount = 0;
|
||||
|
||||
|
@ -402,7 +402,7 @@ static void groupchat_onGroupNameListChange(ToxWindow *self, Tox *m, uint32_t gr
|
||||
}
|
||||
|
||||
static void groupchat_onGroupPeerNameChange(ToxWindow *self, Tox *m, uint32_t groupnum, uint32_t peernum,
|
||||
const char *name, size_t length)
|
||||
const char *name, size_t length)
|
||||
{
|
||||
if (self->num != groupnum) {
|
||||
return;
|
||||
|
@ -133,7 +133,7 @@ void cqueue_remove(ToxWindow *self, Tox *m, uint32_t receipt)
|
||||
}
|
||||
}
|
||||
|
||||
#define CQUEUE_TRY_SEND_INTERVAL 60
|
||||
#define CQUEUE_TRY_SEND_INTERVAL 10
|
||||
|
||||
/* Tries to send the oldest unsent message in queue. */
|
||||
void cqueue_try_send(ToxWindow *self, Tox *m)
|
||||
@ -141,18 +141,15 @@ void cqueue_try_send(ToxWindow *self, Tox *m)
|
||||
struct chat_queue *q = self->chatwin->cqueue;
|
||||
struct cqueue_msg *msg = q->root;
|
||||
|
||||
if (!msg)
|
||||
if (!msg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg->receipt != 0 && !timed_out(msg->last_send_try, CQUEUE_TRY_SEND_INTERVAL))
|
||||
if (msg->receipt != 0 && !timed_out(msg->last_send_try, CQUEUE_TRY_SEND_INTERVAL)) {
|
||||
return;
|
||||
|
||||
uint32_t receipt = 0;
|
||||
}
|
||||
|
||||
TOX_MESSAGE_TYPE type = msg->type == OUT_MSG ? TOX_MESSAGE_TYPE_NORMAL : TOX_MESSAGE_TYPE_ACTION;
|
||||
receipt = tox_friend_send_message(m, self->num, type, (uint8_t *) msg->message, msg->len, NULL);
|
||||
|
||||
msg->receipt = tox_friend_send_message(m, self->num, type, (uint8_t *) msg->message, msg->len, NULL);
|
||||
msg->last_send_try = get_unix_time();
|
||||
msg->receipt = receipt;
|
||||
return;
|
||||
}
|
||||
|
@ -767,8 +767,10 @@ static Tox *load_toxic(char *data_path)
|
||||
{
|
||||
TOX_ERR_OPTIONS_NEW options_new_err;
|
||||
struct Tox_Options *tox_opts = tox_options_new(&options_new_err);
|
||||
|
||||
if (!tox_opts)
|
||||
exit_toxic_err("tox_options_new returned fatal error", options_new_err);
|
||||
|
||||
init_tox_options(tox_opts);
|
||||
|
||||
TOX_ERR_NEW new_err;
|
||||
|
@ -186,8 +186,10 @@ VideoDeviceError init_video_devices()
|
||||
size[vdt_input] = 0;
|
||||
|
||||
#if defined(__OSX__)
|
||||
if( osx_video_init((char**)video_devices_names[vdt_input], &size[vdt_input]) != 0 )
|
||||
|
||||
if ( osx_video_init((char **)video_devices_names[vdt_input], &size[vdt_input]) != 0 )
|
||||
return vde_InternalError;
|
||||
|
||||
#else /* not __OSX__*/
|
||||
|
||||
for (; size[vdt_input] <= MAX_DEVICES; ++size[vdt_input]) {
|
||||
@ -358,11 +360,13 @@ VideoDeviceError open_video_device(VideoDeviceType type, int32_t selection, uint
|
||||
video_thread_paused = true;
|
||||
|
||||
#if defined(__OSX__)
|
||||
|
||||
if ( osx_video_open_device(selection, &device->video_width, &device->video_height) != 0 ) {
|
||||
free(device);
|
||||
unlock;
|
||||
return vde_FailedStart;
|
||||
}
|
||||
|
||||
#else /* not __OSX__*/
|
||||
/* Open selected device */
|
||||
char device_address[] = "/dev/videoXX";
|
||||
@ -667,10 +671,12 @@ void *video_thread_poll (void *arg) // TODO: maybe use thread for every input so
|
||||
uint8_t *v = device->input.planes[2];
|
||||
|
||||
#if defined(__OSX__)
|
||||
|
||||
if ( osx_video_read_device(y, u, v, &video_width, &video_height) != 0 ) {
|
||||
unlock;
|
||||
continue;
|
||||
}
|
||||
|
||||
#else /* not __OSX__*/
|
||||
struct v4l2_buffer buf;
|
||||
memset(&(buf), 0, sizeof(buf));
|
||||
|
Loading…
Reference in New Issue
Block a user