1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-26 19:36:45 +02:00

Compare commits

...

16 Commits

Author SHA1 Message Date
ff669be8d1 detach group names from global name
Group names are now set on a per-group basis and are not affected
by the global /nick command.
2023-04-04 16:16:57 -04:00
5d757e1230 Update help dialog height to fit the new commands
Made the "global" and "chat" help pages fit properly in the dialog again.
I also made the logic for deciding height for the chat page consistent with the other pages.
2023-03-04 17:07:15 -05:00
70ab422acc Update static build script 2023-03-04 10:11:37 -05:00
2a052edb9e Bump version to 0.12.0 & Update man pages
We no longer use libera as they were found to be spying on their
users' private conversations, so we've replaced it with a
public tox group via the new groupchat implementation
2023-03-04 09:52:15 -05:00
efbfa2c95c Remove toxme.io from nameservers list as it no longer exists 2023-01-11 13:16:13 -05:00
3f3e848b6f Show connection status in groupchat peerlist 2023-01-05 12:33:04 -05:00
8d125d5e6b Change conference invite, accept, Add NGC join, invite, accept 2023-01-05 19:12:00 +02:00
fbdc20dfa5 fix: git clone toxcore recursive 2022-11-30 12:36:05 +01:00
e8388bf20c Show toxcore TRACE logging messages
I'm not sure why this was disabled. It shouldn't be.
2022-10-13 23:27:31 -04:00
398aecdd92 Fix group whispering for duplicate nicks
If a group has numerous peers with the same nick we now require
their public key in order to send a private message. Previously
we would greedily send the message to the first peer
in the list.
2022-10-06 14:16:16 -04:00
57a439c9b4 Remove testnet specific code
Preparing for ngc merge
2022-09-22 14:05:23 -04:00
0aea5d7fbe Remove testnet specific code
Preparing for ngc merge
2022-09-22 13:51:00 -04:00
e56edd556f Remove error code that no longer exists 2022-07-14 00:17:39 -04:00
7ed031b9bf Fix static build script 2022-06-28 10:54:19 -04:00
6ef2c784c5 Fix tab alert bug on peer exit 2022-06-28 17:31:27 +03:00
058057c64d Fix style issues 2022-06-27 19:42:38 -04:00
19 changed files with 209 additions and 149 deletions

View File

@ -28,7 +28,7 @@ jobs:
libx11-dev
python3-dev
pkg-config &&
git clone --depth=1 https://github.com/TokTok/c-toxcore &&
git clone --depth=1 --recursive https://github.com/TokTok/c-toxcore &&
cd c-toxcore &&
cmake . -B_build -DBOOTSTRAP_DAEMON=OFF &&
cd _build &&
@ -85,7 +85,7 @@ jobs:
make
python3-dev
pkg-config &&
git clone --depth=1 https://github.com/TokTok/c-toxcore &&
git clone --depth=1 --recursive https://github.com/TokTok/c-toxcore &&
cd c-toxcore &&
cmake . -B_build -DBOOTSTRAP_DAEMON=OFF &&
cd _build &&

View File

@ -55,9 +55,9 @@ author = 'Jakob Kreuze'
# built documents.
#
# The short X.Y version.
version = '0.11.3'
version = '0.12.0'
# The full version, including alpha/beta/rc tags.
release = '0.11.3'
release = '0.12.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -1,5 +1,5 @@
# Version
TOXIC_VERSION = 0.11.3
TOXIC_VERSION = 0.12.0
REV = $(shell git rev-list HEAD --count 2>/dev/null || echo -n "error")
ifneq (, $(findstring error, $(REV)))
VERSION = $(TOXIC_VERSION)

View File

@ -1,13 +1,13 @@
'\" t
.\" Title: toxic
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 2021-05-24
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 2021-12-05
.\" Manual: Toxic Manual
.\" Source: toxic __VERSION__
.\" Language: English
.\"
.TH "TOXIC" "1" "2021\-05\-24" "toxic __VERSION__" "Toxic Manual"
.TH "TOXIC" "1" "2021\-12\-05" "toxic __VERSION__" "Toxic Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@ -156,14 +156,14 @@ Configuration example\&.
\-Screen flickering sometimes occurs on certain terminals\&.
.sp
\-Resizing the terminal window when a game window is open will break things\&.
.SH "LINKS"
.sp
Project page: https://github\&.com/JFreegman/toxic
.sp
Tox development group public key: 360497DA684BCE2A500C1AF9B3A5CE949BBB9F6FB1F91589806FB04CA039E313
.SH "AUTHORS"
.sp
JFreegman <JFreegman@gmail\&.com>
.SH "SEE ALSO"
.sp
\fBtoxic\&.conf\fR(5)
.SH "LINKS"
.sp
Project page: https://github\&.com/JFreegman/toxic
.sp
IRC channel: irc\&.libera\&.chat#tox

View File

@ -93,6 +93,12 @@ behaviour.
-Resizing the terminal window when a game window is open will break things.
LINKS
-----
Project page: <https://github.com/JFreegman/toxic>
Tox development group public key: 360497DA684BCE2A500C1AF9B3A5CE949BBB9F6FB1F91589806FB04CA039E313
AUTHORS
-------
JFreegman <JFreegman@gmail.com>
@ -100,9 +106,3 @@ JFreegman <JFreegman@gmail.com>
SEE ALSO
--------
*toxic.conf*(5)
LINKS
-----
Project page: <https://github.com/JFreegman/toxic>
IRC channel: irc.libera.chat#tox

View File

@ -1,13 +1,13 @@
'\" t
.\" Title: toxic.conf
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 2020-11-12
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 2022-06-27
.\" Manual: Toxic Manual
.\" Source: toxic __VERSION__
.\" Language: English
.\"
.TH "TOXIC\&.CONF" "5" "2020\-11\-12" "toxic __VERSION__" "Toxic Manual"
.TH "TOXIC\&.CONF" "5" "2022\-06\-27" "toxic __VERSION__" "Toxic Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@ -417,14 +417,14 @@ __DATADIR__/toxic\&.conf\&.example
.RS 4
Configuration example\&.
.RE
.SH "SEE ALSO"
.sp
\fBtoxic\fR(1)
.SH "RESOURCES"
.sp
Project page: https://github\&.com/JFreegman/toxic
.sp
IRC channel: irc\&.libera\&.chat#tox
Tox development group public key: 360497DA684BCE2A500C1AF9B3A5CE949BBB9F6FB1F91589806FB04CA039E313
.SH "AUTHORS"
.sp
JFreegman <JFreegman@gmail\&.com>
.SH "SEE ALSO"
.sp
\fBtoxic\fR(1)

View File

@ -263,19 +263,19 @@ FILES
{datadir}/toxic.conf.example::
Configuration example.
RESOURCES
---------
Project page: <https://github.com/JFreegman/toxic>
Tox development group public key: 360497DA684BCE2A500C1AF9B3A5CE949BBB9F6FB1F91589806FB04CA039E313
AUTHORS
-------
JFreegman <JFreegman@gmail.com>
SEE ALSO
--------
*toxic*(1)
RESOURCES
---------
Project page: <https://github.com/JFreegman/toxic>
IRC channel: irc.libera.chat#tox
AUTHORS
-------
JFreegman <JFreegman@gmail.com>

View File

@ -1 +0,0 @@
toxme.io 1A39E7A5D5FA9CF155C751570A32E625698A60A55F6D88028F949F66144F4F25

View File

@ -114,7 +114,6 @@ apk add \
libsodium-dev \
libsodium-static \
linux-headers \
msgpack-c-dev \
ncurses-dev \
ncurses-static \
ncurses-terminfo \
@ -137,20 +136,32 @@ mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# The git hash of the c-toxcore version we're using
TOXCORE_VERSION="v0.2.16"
TOXCORE_VERSION="172f279dc0647a538b30e62c96bab8bb1b0c8960"
# The sha256sum of the c-toxcore tarball for TOXCORE_VERSION
TOXCORE_HASH="653aa42654b607f0940cecfac873e9ce55605119a90d1dc454d1090ff6ca29c0"
TOXCORE_HASH="9884d4ad9b80917e22495c2ebe7a76c509fb98c61031824562883225e66684ae"
TOXCORE_FILENAME="c-toxcore-$TOXCORE_VERSION.tar.gz"
wget --timeout=10 -O "$TOXCORE_FILENAME" "https://github.com/TokTok/c-toxcore/archive/$TOXCORE_VERSION.tar.gz"
check_sha256 "$TOXCORE_HASH" "$TOXCORE_FILENAME"
tar -o -xf "$TOXCORE_FILENAME"
rm "$TOXCORE_FILENAME"
cd c-toxcore*
mkdir -p "third_party" && cd "third_party"
CMP_VERSION="074e0df43e8a61ea938c4f77f65d1fbccc0c3bf9"
CMP_FILENAME="cmp-$CMP_VERSION.tar.gz"
wget --timeout=10 -O "$CMP_FILENAME" "https://github.com/TokTok/cmp/archive/$CMP_VERSION.tar.gz"
tar -o -xf "$CMP_FILENAME"
mv cmp\-*/* "cmp/"
cd ..
cmake -B_build -H. \
-DUSE_TEST_NETWORK=OFF \
-DENABLE_STATIC=ON \
-DENABLE_SHARED=OFF \
-DCMAKE_BUILD_TYPE=Release \
@ -169,8 +180,8 @@ cmake --build _build --target install
# location with SSL_CERT_FILE env variable.
cd "$BUILD_DIR"
CURL_VERSION="7.81.0"
CURL_HASH="ac8e1087711084548d788ef18b9b732c8de887457b81f616fc681d1044b32f98"
CURL_VERSION="7.88.1"
CURL_HASH="cdb38b72e36bc5d33d5b8810f8018ece1baa29a8f215b4495e495ded82bbf3c7"
CURL_FILENAME="curl-$CURL_VERSION.tar.gz"
wget --timeout=10 -O "$CURL_FILENAME" "https://curl.haxx.se/download/$CURL_FILENAME"

View File

@ -42,7 +42,7 @@
extern struct user_settings *user_settings;
/* URL that we get the JSON encoded nodes list from. */
#define NODES_LIST_URL 0 // This should be empty until NGC merges with mainnet
#define NODES_LIST_URL "https://nodes.tox.chat/json"
#define DEFAULT_NODES_FILENAME "DHTnodes.json"
@ -79,29 +79,6 @@ extern struct user_settings *user_settings;
/* Maximum allowable size of the nodes list */
#define MAX_NODELIST_SIZE (MAX_RECV_CURL_DATA_SIZE)
// TODO(Jfreegman): Remove this before production
static uint8_t const TESTNET_KEY[] = {
0x79, 0xCA, 0xDA, 0x49, 0x74, 0xB0, 0x92, 0x6F,
0x28, 0x6F, 0x02, 0x5C, 0xD5, 0xFF, 0xDF, 0x3E,
0x65, 0x4A, 0x37, 0x58, 0xC5, 0x3E, 0x02, 0x73,
0xEC, 0xFC, 0x4D, 0x12, 0xC2, 0x1D, 0xCA, 0x48,
};
// TODO(Jfreegman): Remove this before production
#define TESTNET_PORT 33445
#define TESTNET_IP "172.93.52.70"
static uint8_t const TESTNET_KEY2[] = {
0x5E, 0x47, 0xBA, 0x1D, 0xC3, 0x91, 0x3E, 0xB2,
0xCB, 0xF2, 0xD6, 0x4C, 0xE4, 0xF2, 0x3D, 0x8B,
0xFE, 0x53, 0x91, 0xBF, 0xAB, 0xE5, 0xC4, 0x3C,
0x5B, 0xAD, 0x13, 0xF0, 0xA4, 0x14, 0xCD, 0x77,
};
#define TESTNET_PORT2 38445
#define TESTNET_IP2 "tox.plastiras.org"
static struct Thread_Data {
pthread_t tid;
pthread_attr_t attr;
@ -298,11 +275,6 @@ on_exit:
*/
static int update_DHT_nodeslist(const char *nodes_path)
{
if (NODES_LIST_URL == 0) { // TODO: Remove this when NGC merges with mainnet
fprintf(stderr, "Skipping DHT Nodes list fetching (remove before production)\n");
return 0;
}
if (!nodeslist_needs_update(nodes_path)) {
return 0;
}
@ -583,24 +555,6 @@ on_exit:
*/
int load_DHT_nodeslist(void)
{
// TODO(Jfreegman): Remove this before production
fprintf(stderr, "Adding NGC testnet node - remove this before production\n");
struct Node *node = &Nodes.list[0];
node->have_ip4 = true;
node->port = TESTNET_PORT;
memcpy(node->key, TESTNET_KEY, sizeof(TESTNET_KEY));
memcpy(node->ip4, TESTNET_IP, sizeof(TESTNET_IP));
struct Node *node2 = &Nodes.list[1];
node2->have_ip4 = true;
node2->port = TESTNET_PORT2;
memcpy(node2->key, TESTNET_KEY2, sizeof(TESTNET_KEY2));
memcpy(node2->ip4, TESTNET_IP2, sizeof(TESTNET_IP2));
Nodes.count = 2;
#if 0
if (thread_data.active) {
return -1;
}
@ -623,7 +577,6 @@ int load_DHT_nodeslist(void)
thread_data.active = false;
return -5;
}
#endif
return 0;
}

View File

@ -130,6 +130,7 @@ static struct cmd_func groupchat_commands[] = {
{ "/list", cmd_list },
{ "/locktopic", cmd_set_topic_lock },
{ "/mod", cmd_mod },
{ "/nick", cmd_group_nick },
{ "/passwd", cmd_set_passwd },
{ "/peerlimit", cmd_set_peerlimit },
{ "/privacy", cmd_set_privacy },

View File

@ -777,7 +777,6 @@ void cmd_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
tox_self_set_name(m, (uint8_t *) nick, len, NULL);
prompt_update_nick(prompt, nick);
set_nick_all_groups(m, nick, len);
store_data(m, DATA_FILE);
}

View File

@ -76,6 +76,32 @@ void cmd_disconnect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar
}
}
void cmd_group_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
if (argc < 1) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Input required.");
return;
}
char nick[MAX_STR_SIZE];
snprintf(nick, sizeof(nick), "%s", argv[1]);
size_t len = strlen(nick);
if (!valid_nick(nick)) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Invalid name.");
return;
}
len = MIN(len, TOXIC_MAX_NAME_LENGTH - 1);
nick[len] = '\0';
set_nick_this_group(self, m, nick, len);
store_data(m, DATA_FILE);
}
void cmd_ignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
if (argc < 1) {

View File

@ -28,6 +28,7 @@
void cmd_chatid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_disconnect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_group_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_ignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_kick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_list(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);

View File

@ -363,21 +363,24 @@ int init_groupchat_win(Tox *m, uint32_t groupnumber, const char *groupname, size
return -1;
}
void set_nick_all_groups(Tox *m, const char *new_nick, size_t length)
void set_nick_this_group(ToxWindow *self, Tox *m, const char *new_nick, size_t length)
{
for (int i = 0; i < max_groupchat_index; ++i) {
if (groupchats[i].active) {
ToxWindow *self = get_window_ptr(groupchats[i].chatwin);
if (!self) {
continue;
if (self == NULL) {
return;
}
char old_nick[TOX_MAX_NAME_LENGTH + 1];
size_t old_length = get_group_self_nick_truncate(m, old_nick, self->num);
Tox_Err_Group_Self_Name_Set err;
tox_group_self_set_name(m, groupchats[i].groupnumber, (uint8_t *) new_nick, length, &err);
tox_group_self_set_name(m, self->num, (uint8_t *) new_nick, length, &err);
GroupChat *chat = get_groupchat(self->num);
if (chat == NULL) {
line_info_add(self, false, NULL, 0, SYS_MSG, 0, RED, "-!- Failed to set nick: invalid groupnumber");
return;
}
switch (err) {
case TOX_ERR_GROUP_SELF_NAME_SET_OK: {
@ -385,13 +388,8 @@ void set_nick_all_groups(Tox *m, const char *new_nick, size_t length)
break;
}
case TOX_ERR_GROUP_SELF_NAME_SET_TAKEN: {
line_info_add(self, false, NULL, 0, SYS_MSG, 0, RED, "-!- That nick is already in use.");
break;
}
default: {
if (groupchats[i].time_connected > 0) {
if (chat->time_connected > 0) {
line_info_add(self, false, NULL, 0, SYS_MSG, 0, RED, "-!- Failed to set nick (error %d).", err);
}
@ -399,8 +397,40 @@ void set_nick_all_groups(Tox *m, const char *new_nick, size_t length)
}
}
}
}
}
/* void set_nick_all_groups(Tox *m, const char *new_nick, size_t length) */
/* { */
/* for (int i = 0; i < max_groupchat_index; ++i) { */
/* if (groupchats[i].active) { */
/* ToxWindow *self = get_window_ptr(groupchats[i].chatwin); */
/* if (!self) { */
/* continue; */
/* } */
/* char old_nick[TOX_MAX_NAME_LENGTH + 1]; */
/* size_t old_length = get_group_self_nick_truncate(m, old_nick, self->num); */
/* Tox_Err_Group_Self_Name_Set err; */
/* tox_group_self_set_name(m, groupchats[i].groupnumber, (uint8_t *) new_nick, length, &err); */
/* switch (err) { */
/* case TOX_ERR_GROUP_SELF_NAME_SET_OK: { */
/* groupchat_onGroupSelfNickChange(self, m, self->num, old_nick, old_length, new_nick, length); */
/* break; */
/* } */
/* default: { */
/* if (groupchats[i].time_connected > 0) { */
/* line_info_add(self, false, NULL, 0, SYS_MSG, 0, RED, "-!- Failed to set nick (error %d).", err); */
/* } */
/* break; */
/* } */
/* } */
/* } */
/* } */
/* } */
void set_status_all_groups(Tox *m, uint8_t status)
{
@ -480,6 +510,10 @@ static int group_get_nick_peer_id(uint32_t groupnumber, const char *nick, uint32
return -1;
}
if (nick == NULL) {
return -1;
}
size_t count = 0;
for (uint32_t i = 0; i < chat->max_idx; ++i) {
@ -498,7 +532,7 @@ static int group_get_nick_peer_id(uint32_t groupnumber, const char *nick, uint32
}
}
return 0;
return count > 0 ? 0 : -1;
}
/* Gets the peer_id associated with `public_key`.
@ -514,9 +548,17 @@ int group_get_public_key_peer_id(uint32_t groupnumber, const char *public_key, u
return -1;
}
if (public_key == NULL) {
return -1;
}
if (strlen(public_key) < TOX_GROUP_PEER_PUBLIC_KEY_SIZE * 2) {
return -1;
}
char key_bin[TOX_GROUP_PEER_PUBLIC_KEY_SIZE];
if (tox_pk_string_to_bytes(public_key, strlen(public_key), key_bin, sizeof(key_bin)) == -1) {
if (tox_pk_string_to_bytes(public_key, TOX_GROUP_PEER_PUBLIC_KEY_SIZE * 2, key_bin, sizeof(key_bin)) == -1) {
return -1;
}
@ -991,7 +1033,9 @@ static void groupchat_onGroupPeerJoin(ToxWindow *self, Tox *m, uint32_t groupnum
++chat->max_idx;
}
if (timed_out(chat->time_connected, 60) && user_settings->show_group_connection_msg == SHOW_GROUP_CONNECTION_MSG_ON) { /* ignore join messages when we first connect to the group */
if (timed_out(chat->time_connected, 60)
&& user_settings->show_group_connection_msg ==
SHOW_GROUP_CONNECTION_MSG_ON) { /* ignore join messages when we first connect to the group */
line_info_add(self, true, peer->name, NULL, CONNECTION, 0, GREEN, "has joined the room");
write_to_log("has joined the room", peer->name, self->chatwin->log, true);
@ -1027,17 +1071,16 @@ void groupchat_onGroupPeerExit(ToxWindow *self, Tox *m, uint32_t groupnumber, ui
if (length > 0) {
line_info_add(self, true, name, NULL, DISCONNECTION, 0, RED, "[Quit]: %s", part_message);
snprintf(log_str, sizeof(log_str), "has left the room (%s)", part_message);
write_to_log(log_str, name, self->chatwin->log, true);
sound_notify(self, silent, NT_WNDALERT_2, NULL);
} else if (user_settings->show_group_connection_msg == SHOW_GROUP_CONNECTION_MSG_ON) {
const char *exit_string = get_group_exit_string(exit_type);
line_info_add(self, true, name, NULL, DISCONNECTION, 0, RED, "[%s]", exit_string);
snprintf(log_str, sizeof(log_str), "[%s]", exit_string);
}
if (user_settings->show_group_connection_msg == SHOW_GROUP_CONNECTION_MSG_ON) {
write_to_log(log_str, name, self->chatwin->log, true);
sound_notify(self, silent, NT_WNDALERT_2, NULL);
}
sound_notify(self, silent, NT_WNDALERT_2, NULL);
}
int peer_index = get_peer_index(groupnumber, peer_id);
@ -1419,7 +1462,6 @@ static void send_group_prvt_message(ToxWindow *self, Tox *m, uint32_t groupnumbe
return;
}
uint32_t peer_id = 0;
uint32_t name_length = 0;
const char *nick = NULL;
@ -1437,13 +1479,23 @@ static void send_group_prvt_message(ToxWindow *self, Tox *m, uint32_t groupnumbe
if (chat->peer_list[i].name_length > name_length) {
name_length = chat->peer_list[i].name_length;
nick = chat->peer_list[i].name;
peer_id = chat->peer_list[i].peer_id;
}
}
}
if (nick == NULL) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Invalid peer name.");
if (data_len < TOX_GROUP_PEER_PUBLIC_KEY_SIZE * 2) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Invalid nick.");
return;
}
nick = data;
name_length = TOX_GROUP_PEER_PUBLIC_KEY_SIZE * 2;
}
uint32_t peer_id;
if (group_get_peer_id_of_identifier(self, nick, &peer_id) != 0) {
return;
}
@ -1662,7 +1714,15 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
wattron(ctx->sidebar, A_BOLD);
pthread_mutex_lock(&Winthread.lock);
if (chat->num_peers > 1) {
wprintw(ctx->sidebar, "Peers: %d\n", chat->num_peers);
} else if (tox_group_is_connected(m, self->num, NULL)) {
wprintw(ctx->sidebar, "Connecting...\n");
} else {
wprintw(ctx->sidebar, "Disconnected\n");
}
pthread_mutex_unlock(&Winthread.lock);
wattroff(ctx->sidebar, A_BOLD);

View File

@ -68,7 +68,7 @@ typedef struct {
void exit_groupchat(ToxWindow *self, Tox *m, uint32_t groupnumber, const char *partmessage, size_t length);
int init_groupchat_win(Tox *m, uint32_t groupnumber, const char *groupname, size_t length, Group_Join_Type join_type);
void set_nick_all_groups(Tox *m, const char *new_nick, size_t length);
void set_nick_this_group(ToxWindow *self, Tox *m, const char *new_nick, size_t length);
void set_status_all_groups(Tox *m, uint8_t status);
int get_peer_index(uint32_t groupnumber, uint32_t peer_id);
void groupchat_onGroupPeerExit(ToxWindow *self, Tox *m, uint32_t groupnumber, uint32_t peer_id,

View File

@ -183,11 +183,12 @@ static void help_draw_global(ToxWindow *self)
wprintw(win, " /requests : List pending friend requests\n");
wprintw(win, " /status <type> : Set status (Online, Busy, Away)\n");
wprintw(win, " /note <msg> : Set a personal note\n");
wprintw(win, " /nick <nick> : Set your nickname\n");
wprintw(win, " /nick <name> : Set your global name (doesn't affect groups)\n");
wprintw(win, " /nospam <value> : Change part of your Tox ID to stop spam\n");
wprintw(win, " /log <on> or <off> : Enable/disable logging\n");
wprintw(win, " /myid : Print your Tox ID\n");
wprintw(win, " /group <name> : Create a new group chat\n");
wprintw(win, " /join <chatid> : Join a groupchat using a Chat ID\n");
#ifdef GAMES
wprintw(win, " /game : Play a game\n");
#endif /* GAMES */
@ -245,8 +246,10 @@ static void help_draw_chat(ToxWindow *self)
wprintw(win, "Chat Commands:\n");
wattroff(win, A_BOLD | COLOR_PAIR(RED));
wprintw(win, " /invite <n> : Invite contact to a conference \n");
wprintw(win, " /join : Join a pending conference\n");
wprintw(win, " /cinvite <n> : Invite contact to a conference \n");
wprintw(win, " /cjoin : Join a pending conference\n");
wprintw(win, " /invite <n> : Invite contact to a groupchat \n");
wprintw(win, " /gaccept <password> : Accept a pending groupchat invite\n");
wprintw(win, " /sendfile <path> : Send a file\n");
wprintw(win, " /savefile <id> : Receive a file\n");
wprintw(win, " /cancel <type> <id> : Cancel file transfer where type: in|out\n");
@ -304,6 +307,7 @@ static void help_draw_groupchats(ToxWindow *self)
wprintw(win, " /list : Print a list of peers currently in the group\n");
wprintw(win, " /locktopic : Set the topic lock: on | off\n");
wprintw(win, " /mod <name> : Promote a peer to moderator\n");
wprintw(win, " /nick <name> : Set your name for this group only\n");
wprintw(win, " /passwd <s> : Set a password needed to join the group\n");
wprintw(win, " /peerlimit <n> : Set the maximum number of peers that can join\n");
wprintw(win, " /privacy <state> : Set the privacy state: private | public\n");
@ -430,18 +434,21 @@ void help_onKey(ToxWindow *self, wint_t key)
break;
case L'c':
height = 12;
#ifdef VIDEO
help_init_window(self, 26, 80);
height += 15;
#elif AUDIO
help_init_window(self, 21, 80);
#else
help_init_window(self, 11, 80);
height += 5;
#endif
#ifdef GAMES
height += 1;
#endif
help_init_window(self, height, 80);
self->help->type = HELP_CHAT;
break;
case L'g':
height = 22;
height = 24;
#ifdef VIDEO
height += 8;
#elif AUDIO
@ -490,7 +497,7 @@ void help_onKey(ToxWindow *self, wint_t key)
break;
case L'r':
help_init_window(self, 26, 80);
help_init_window(self, 27, 80);
self->help->type = HELP_GROUP;
break;
}

View File

@ -365,7 +365,7 @@ on_exit:
void name_lookup(ToxWindow *self, Tox *m, const char *id_bin, const char *addr, const char *message)
{
if (t_data.disabled) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "name lookups are disabled.");
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "nameservers list is empty or does not exist.");
return;
}

View File

@ -258,10 +258,6 @@ void cb_toxcore_logger(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t l
{
UNUSED_VAR(m);
if (level == TOX_LOG_LEVEL_TRACE) {
return;
}
FILE *fp = (FILE *)user_data;
if (!fp) {
@ -269,13 +265,20 @@ void cb_toxcore_logger(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t l
}
struct timeval tv;
gettimeofday(&tv, NULL);
struct tm tmp;
gmtime_r(&tv.tv_sec, &tmp);
char timestamp[200];
strftime(timestamp, sizeof(timestamp), "%F %T", &tmp);
fprintf(fp, "%c %s.%06ld %s:%u(%s) - %s\n", tox_log_level_show(level)[0], timestamp, tv.tv_usec, file, line, func, message);
fprintf(fp, "%c %s.%06ld %s:%u(%s) - %s\n", tox_log_level_show(level)[0], timestamp, tv.tv_usec, file, line, func,
message);
fflush(fp);
}