mirror of
https://github.com/Tha14/toxic.git
synced 2025-06-30 19:46:46 +02:00
re-implement avatar setting
This commit is contained in:
@ -33,8 +33,10 @@
|
||||
#include "chat.h"
|
||||
#include "line_info.h"
|
||||
#include "misc_tools.h"
|
||||
|
||||
#include "avatars.h"
|
||||
#include "settings.h"
|
||||
#include "file_transfers.h"
|
||||
|
||||
extern char *DATA_FILE;
|
||||
extern struct Winthread Winthread;
|
||||
static ToxWindow windows[MAX_WINDOWS_NUM];
|
||||
@ -215,6 +217,16 @@ void on_group_titlechange(Tox *m, int groupnumber, int peernumber, const uint8_t
|
||||
void on_file_chunk_request(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint64_t position,
|
||||
size_t length, void *userdata)
|
||||
{
|
||||
struct FileTransfer *ft = get_file_transfer_struct(friendnumber, filenumber);
|
||||
|
||||
if (!ft)
|
||||
return;
|
||||
|
||||
if (ft->file_type == TOX_FILE_KIND_AVATAR) {
|
||||
on_avatar_chunk_request(m, ft, position, length);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
@ -226,6 +238,11 @@ void on_file_chunk_request(Tox *m, uint32_t friendnumber, uint32_t filenumber, u
|
||||
void on_file_recv_chunk(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint64_t position,
|
||||
const uint8_t *data, size_t length, void *user_data)
|
||||
{
|
||||
struct FileTransfer *ft = get_file_transfer_struct(friendnumber, filenumber);
|
||||
|
||||
if (!ft)
|
||||
return;
|
||||
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
@ -237,6 +254,16 @@ void on_file_recv_chunk(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint
|
||||
void on_file_control(Tox *m, uint32_t friendnumber, uint32_t filenumber, TOX_FILE_CONTROL control,
|
||||
void *userdata)
|
||||
{
|
||||
struct FileTransfer *ft = get_file_transfer_struct(friendnumber, filenumber);
|
||||
|
||||
if (!ft)
|
||||
return;
|
||||
|
||||
if (ft->file_type == TOX_FILE_KIND_AVATAR) {
|
||||
on_avatar_file_control(m, ft, control);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
@ -272,20 +299,6 @@ void on_read_receipt(Tox *m, uint32_t friendnumber, uint32_t receipt, void *user
|
||||
windows[i].onReadReceipt(&windows[i], m, friendnumber, receipt);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AUDIO
|
||||
void write_device_callback_group(Tox *m, int groupnum, int peernum, const int16_t *pcm, unsigned int samples,
|
||||
uint8_t channels, unsigned int sample_rate, void *arg)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
if (windows[i].onWriteDevice != NULL)
|
||||
windows[i].onWriteDevice(&windows[i], m, groupnum, peernum, pcm, samples, channels, samples);
|
||||
}
|
||||
}
|
||||
#endif /* AUDIO */
|
||||
|
||||
/* CALLBACKS END */
|
||||
|
||||
int add_window(Tox *m, ToxWindow w)
|
||||
|
Reference in New Issue
Block a user