1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 09:33:01 +01:00
toxic/src/conference.h

119 lines
4.0 KiB
C
Raw Permalink Normal View History

/* conference.h
2014-02-25 08:28:24 +01:00
*
*
* Copyright (C) 2014 Toxic All Rights Reserved.
*
* This file is part of Toxic.
*
* Toxic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Toxic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Toxic. If not, see <http://www.gnu.org/licenses/>.
*
2013-09-15 22:38:38 +02:00
*/
#ifndef CONFERENCE_H
#define CONFERENCE_H
#include "toxic.h"
#include "windows.h"
#define CONFERENCE_MAX_TITLE_LENGTH TOX_MAX_NAME_LENGTH
#define SIDEBAR_WIDTH 16
typedef struct ConferencePeer {
bool active;
2020-05-07 02:00:00 +02:00
uint8_t pubkey[TOX_PUBLIC_KEY_SIZE];
2020-05-07 02:00:00 +02:00
uint32_t peernum; /* index in chat->peer_list */
2020-05-07 02:00:00 +02:00
char name[TOX_MAX_NAME_LENGTH];
size_t name_length;
2020-05-07 02:00:00 +02:00
bool sending_audio;
uint32_t audio_out_idx;
time_t last_audio_time;
} ConferencePeer;
2020-05-07 02:00:00 +02:00
typedef struct AudioInputCallbackData {
Tox *tox;
uint32_t conferencenum;
} AudioInputCallbackData;
#define PUBKEY_STRING_SIZE (2 * TOX_PUBLIC_KEY_SIZE + 1)
typedef struct NameListEntry {
char name[TOX_MAX_NAME_LENGTH];
char pubkey_str[PUBKEY_STRING_SIZE];
uint32_t peernum;
} NameListEntry;
typedef struct {
int chatwin;
bool active;
2014-11-12 02:49:05 +01:00
uint8_t type;
2013-12-03 09:44:02 +01:00
int side_pos; /* current position of the sidebar - used for scrolling up and down */
time_t start_time;
char title[CONFERENCE_MAX_TITLE_LENGTH + 1];
size_t title_length;
ConferencePeer *peer_list;
uint32_t max_idx;
2020-05-07 02:00:00 +02:00
NameListEntry *name_list;
uint32_t num_peers;
2020-05-07 02:00:00 +02:00
bool push_to_talk_enabled;
time_t ptt_last_pushed;
2020-05-07 02:00:00 +02:00
bool audio_enabled;
time_t last_sent_audio;
uint32_t audio_in_idx;
AudioInputCallbackData audio_input_callback_data;
} ConferenceChat;
/* Frees all Toxic associated data structures for a conference (does not call tox_conference_delete() ) */
void free_conference(ToxWindow *self, uint32_t conferencenum);
int init_conference_win(Tox *m, uint32_t conferencenum, uint8_t type, const char *title, size_t length);
/* destroys and re-creates conference window with or without the peerlist */
void redraw_conference_win(ToxWindow *self);
void conference_set_title(ToxWindow *self, uint32_t conferencesnum, const char *title, size_t length);
void conference_rename_log_path(Tox *m, uint32_t conferencenum, const char *new_title);
int conference_enable_logging(ToxWindow *self, Tox *m, uint32_t conferencenum, struct chatlog *log);
2020-05-07 02:00:00 +02:00
/* Puts `(NameListEntry *)`s in `entries` for each matched peer, up to a maximum
* of `maxpeers`.
* Maches each peer whose name or pubkey begins with `prefix`.
* If `prefix` is exactly the pubkey of a peer, matches only that peer.
* return number of entries placed in `entries`.
*/
uint32_t get_name_list_entries_by_prefix(uint32_t conferencenum, const char *prefix, NameListEntry **entries,
uint32_t maxpeers);
bool init_conference_audio_input(Tox *tox, uint32_t conferencenum);
bool enable_conference_audio(ToxWindow *self, Tox *tox, uint32_t conferencenum);
bool disable_conference_audio(ToxWindow *self, Tox *tox, uint32_t conferencenum);
bool toggle_conference_push_to_talk(uint32_t conferencenum, bool enabled);
2020-05-07 02:00:00 +02:00
void audio_conference_callback(void *tox, uint32_t conferencenum, uint32_t peernum,
2020-11-14 01:00:00 +01:00
const int16_t *pcm, unsigned int samples, uint8_t channels, uint32_t
sample_rate, void *userdata);
2020-05-07 02:00:00 +02:00
bool conference_mute_self(uint32_t conferencenum);
bool conference_mute_peer(const Tox *m, uint32_t conferencenum, uint32_t peernum);
2020-05-07 02:00:00 +02:00
bool conference_set_VAD_threshold(uint32_t conferencenum, float threshold);
float conference_get_VAD_threshold(uint32_t conferencenum);
2020-05-07 02:00:00 +02:00
#endif /* CONFERENCE_H */