This commit is contained in:
emdee@spm.plastiras.org 2024-03-08 04:02:20 +00:00
parent d200a55938
commit 3a3d8ab5e4
3 changed files with 56 additions and 10 deletions

View file

@ -231,6 +231,16 @@ twc_cmd_bootstrap(const void *pointer, void *data, struct t_gui_buffer *buffer,
} else if (argc > 2 && strlen(argv[2]) > 0) {
if (weechat_strcasecmp(argv[2], "0") == 0) {
TOX_CONNECTION status;
if (!(profile)) {
weechat_printf(profile->buffer, "%sInvalid profile.",
weechat_prefix("error"));
return WEECHAT_RC_OK;
}
if (!(profile->tox)) {
weechat_printf(profile->buffer, "%sInvalid tox in profile.",
weechat_prefix("error"));
return WEECHAT_RC_OK;
}
status = tox_self_get_connection_status(profile->tox);
if ( status == TOX_CONNECTION_NONE) {
weechat_printf(profile->buffer,
@ -285,6 +295,18 @@ twc_cmd_bootstrap(const void *pointer, void *data, struct t_gui_buffer *buffer,
} else if (argc > 2 && strlen(argv[2]) > 0) {
if (weechat_strcasecmp(argv[2], "0") == 0) {
TOX_CONNECTION status;
if (!(profile)) {
weechat_printf(profile->buffer,
"%sNo profile.",
weechat_prefix("network"));
return WEECHAT_RC_OK;
}
if (!(profile->tox)) {
weechat_printf(profile->buffer,
"%sNo tox in profile.",
weechat_prefix("network"));
return WEECHAT_RC_OK;
}
status = tox_self_get_connection_status(profile->tox);
if ( status == TOX_CONNECTION_NONE) {
weechat_printf(profile->buffer,
@ -557,8 +579,19 @@ twc_cmd_friend(const void *pointer, void *data, struct t_gui_buffer *buffer,
{
char *endptr;
unsigned long num = strtoul(argv[2], &endptr, 10);
if (endptr == argv[2] ||
(request = twc_friend_request_with_index(profile, num)) == NULL)
if (endptr == argv[2])
{
weechat_printf(profile->buffer, "%sInvalid friend request ID.",
weechat_prefix("error"));
return WEECHAT_RC_OK;
}
if (!(profile))
{
weechat_printf(profile->buffer, "%sInvalid profile.",
weechat_prefix("error"));
return WEECHAT_RC_OK;
}
if ((request = twc_friend_request_with_index(profile, num)) == NULL)
{
weechat_printf(profile->buffer, "%sInvalid friend request ID.",
weechat_prefix("error"));

View file

@ -796,12 +796,17 @@ twc_tox_log_callback(Tox *tox, TOX_LOG_LEVEL level, const char *file,
{
case TOX_LOG_LEVEL_TRACE:
color = weechat_color("gray");
if (weechat_strcasecmp(file, "network.c") == 0)
return;
if (weechat_strcasecmp(file, "onion_client.c") == 0 &&
weechat_strcasecmp(file, "onion_isconnected") != 0)
return;
break;
case TOX_LOG_LEVEL_DEBUG:
color = weechat_color("white");
break;
case TOX_LOG_LEVEL_INFO:
color = weechat_color("lightblue");
color = weechat_color("lightgreen");
break;
case TOX_LOG_LEVEL_WARNING:
color = weechat_color("yellow");