mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 22:03:02 +01:00
code cleanup, improve welcome message
This commit is contained in:
parent
91c4414889
commit
de1e61bd5a
@ -1,7 +1,7 @@
|
|||||||
# Toxic [![Build Status](https://travis-ci.org/Tox/toxic.png?branch=master)](https://travis-ci.org/Tox/toxic)
|
# Toxic [![Build Status](https://travis-ci.org/Tox/toxic.png?branch=master)](https://travis-ci.org/Tox/toxic)
|
||||||
Toxic is an ncurses-based instant messaging client for [Tox](https://tox.im) which formerly resided in the [Tox core repository](https://github.com/irungentoo/toxcore), and is now available as a standalone application.
|
Toxic is a [Tox](https://tox.im)-based instant messanging client which formerly resided in the [Tox core repository](https://github.com/irungentoo/toxcore), and is now available as a standalone application.
|
||||||
|
|
||||||
![Toxic Screenshot](https://i.imgur.com/LdXXM62.png "Main Screen").
|
![Toxic Screenshot](https://i.imgur.com/AOnp7oD.png "Main Screen").
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
@ -875,15 +875,12 @@ static void chat_onInit(ToxWindow *self, Tox *m)
|
|||||||
ctx->history = subwin(self->window, y2 - CHATBOX_HEIGHT + 1, x2, 0, 0);
|
ctx->history = subwin(self->window, y2 - CHATBOX_HEIGHT + 1, x2, 0, 0);
|
||||||
ctx->linewin = subwin(self->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
|
ctx->linewin = subwin(self->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
|
||||||
|
|
||||||
ctx->hst = malloc(sizeof(struct history));
|
ctx->hst = calloc(1, sizeof(struct history));
|
||||||
ctx->log = malloc(sizeof(struct chatlog));
|
ctx->log = calloc(1, sizeof(struct chatlog));
|
||||||
|
|
||||||
if (ctx->log == NULL || ctx->hst == NULL)
|
if (ctx->log == NULL || ctx->hst == NULL)
|
||||||
exit_toxic_err("failed in chat_onInit", FATALERR_MEMORY);
|
exit_toxic_err("failed in chat_onInit", FATALERR_MEMORY);
|
||||||
|
|
||||||
memset(ctx->hst, 0, sizeof(struct history));
|
|
||||||
memset(ctx->log, 0, sizeof(struct chatlog));
|
|
||||||
|
|
||||||
line_info_init(ctx->hst);
|
line_info_init(ctx->hst);
|
||||||
|
|
||||||
if (friends[self->num].logging_on)
|
if (friends[self->num].logging_on)
|
||||||
|
@ -503,15 +503,12 @@ static void groupchat_onInit(ToxWindow *self, Tox *m)
|
|||||||
ctx->linewin = subwin(self->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
|
ctx->linewin = subwin(self->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
|
||||||
ctx->sidebar = subwin(self->window, y2 - CHATBOX_HEIGHT + 1, SIDEBAR_WIDTH, 0, x2 - SIDEBAR_WIDTH);
|
ctx->sidebar = subwin(self->window, y2 - CHATBOX_HEIGHT + 1, SIDEBAR_WIDTH, 0, x2 - SIDEBAR_WIDTH);
|
||||||
|
|
||||||
ctx->hst = malloc(sizeof(struct history));
|
ctx->hst = calloc(1, sizeof(struct history));
|
||||||
ctx->log = malloc(sizeof(struct chatlog));
|
ctx->log = calloc(1, sizeof(struct chatlog));
|
||||||
|
|
||||||
if (ctx->log == NULL || ctx->hst == NULL)
|
if (ctx->log == NULL || ctx->hst == NULL)
|
||||||
exit_toxic_err("failed in groupchat_onInit", FATALERR_MEMORY);
|
exit_toxic_err("failed in groupchat_onInit", FATALERR_MEMORY);
|
||||||
|
|
||||||
memset(ctx->hst, 0, sizeof(struct history));
|
|
||||||
memset(ctx->log, 0, sizeof(struct chatlog));
|
|
||||||
|
|
||||||
line_info_init(ctx->hst);
|
line_info_init(ctx->hst);
|
||||||
|
|
||||||
if (user_settings->autolog == AUTOLOG_ON)
|
if (user_settings->autolog == AUTOLOG_ON)
|
||||||
@ -538,7 +535,7 @@ ToxWindow new_group_chat(Tox *m, int groupnum)
|
|||||||
ret.onGroupNamelistChange = &groupchat_onGroupNamelistChange;
|
ret.onGroupNamelistChange = &groupchat_onGroupNamelistChange;
|
||||||
ret.onGroupAction = &groupchat_onGroupAction;
|
ret.onGroupAction = &groupchat_onGroupAction;
|
||||||
|
|
||||||
snprintf(ret.name, sizeof(ret.name), "Room #%d", groupnum);
|
snprintf(ret.name, sizeof(ret.name), "Group %d", groupnum);
|
||||||
|
|
||||||
ChatContext *chatwin = calloc(1, sizeof(ChatContext));
|
ChatContext *chatwin = calloc(1, sizeof(ChatContext));
|
||||||
Help *help = calloc(1, sizeof(Help));
|
Help *help = calloc(1, sizeof(Help));
|
||||||
|
@ -233,7 +233,11 @@ void help_onKey(ToxWindow *self, wint_t key)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'g':
|
case 'g':
|
||||||
|
#ifdef _SUPPORT_AUDIO
|
||||||
help_init_window(self, 21, 80);
|
help_init_window(self, 21, 80);
|
||||||
|
#else
|
||||||
|
help_init_window(self, 17, 80);
|
||||||
|
#endif
|
||||||
self->help->type = HELP_GLOBAL;
|
self->help->type = HELP_GLOBAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "toxic.h"
|
#include "toxic.h"
|
||||||
|
|
||||||
#define MAX_HISTORY 10000
|
#define MAX_HISTORY 10000
|
||||||
#define MIN_HISTORY 20
|
#define MIN_HISTORY 40
|
||||||
#define MAX_QUEUE 128
|
#define MAX_QUEUE 128
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
26
src/prompt.c
26
src/prompt.c
@ -367,17 +367,18 @@ static void print_welcome_msg(ToxWindow *self)
|
|||||||
{
|
{
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
line_info_add(self, NULL, NULL, NULL, " |_ _|____ _(_) ___ ", SYS_MSG, 1, BLUE);
|
line_info_add(self, NULL, NULL, NULL, " _____ _____ _____ ____ ", SYS_MSG, 1, BLUE);
|
||||||
line_info_add(self, NULL, NULL, NULL, " | |/ _ \\ \\/ / |/ __|", SYS_MSG, 1, BLUE);
|
line_info_add(self, NULL, NULL, NULL, " |_ _/ _ \\ \\/ /_ _/ ___|", SYS_MSG, 1, BLUE);
|
||||||
line_info_add(self, NULL, NULL, NULL, " | | (_) > <| | (__ ", SYS_MSG, 1, BLUE);
|
line_info_add(self, NULL, NULL, NULL, " | || | | \\ / | | | ", SYS_MSG, 1, BLUE);
|
||||||
line_info_add(self, NULL, NULL, NULL, " |_|\\___/_/\\_\\_|\\___|", SYS_MSG, 1, BLUE);
|
line_info_add(self, NULL, NULL, NULL, " | || |_| / \\ | | |___ ", SYS_MSG, 1, BLUE);
|
||||||
|
line_info_add(self, NULL, NULL, NULL, " |_| \\___/_/\\_\\___\\____|", SYS_MSG, 1, BLUE);
|
||||||
line_info_add(self, NULL, NULL, NULL, "", SYS_MSG, 0, 0);
|
line_info_add(self, NULL, NULL, NULL, "", SYS_MSG, 0, 0);
|
||||||
|
|
||||||
uint8_t *msg = "Welcome to Toxic, a free open source messenger client for Tox. Type /help for a"\
|
uint8_t *msg = "Welcome to Toxic, a free, open source Tox-based instant messenging client.";
|
||||||
" list of commands and key bindings. Further help may be found via the man page.";
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
||||||
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, 0);
|
msg = "Type \"/help\" for assistance. Further help may be found via the man page.";
|
||||||
line_info_add(self, NULL, NULL, NULL, "", SYS_MSG, 1, 0);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
||||||
|
line_info_add(self, NULL, NULL, NULL, "", SYS_MSG, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prompt_onInit(ToxWindow *self, Tox *m)
|
static void prompt_onInit(ToxWindow *self, Tox *m)
|
||||||
@ -390,15 +391,12 @@ static void prompt_onInit(ToxWindow *self, Tox *m)
|
|||||||
ctx->history = subwin(self->window, y2 - CHATBOX_HEIGHT + 1, x2, 0, 0);
|
ctx->history = subwin(self->window, y2 - CHATBOX_HEIGHT + 1, x2, 0, 0);
|
||||||
ctx->linewin = subwin(self->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
|
ctx->linewin = subwin(self->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
|
||||||
|
|
||||||
ctx->log = malloc(sizeof(struct chatlog));
|
ctx->log = calloc(1, sizeof(struct chatlog));
|
||||||
ctx->hst = malloc(sizeof(struct history));
|
ctx->hst = calloc(1, sizeof(struct history));
|
||||||
|
|
||||||
if (ctx->log == NULL || ctx->hst == NULL)
|
if (ctx->log == NULL || ctx->hst == NULL)
|
||||||
exit_toxic_err("failed in prompt_onInit", FATALERR_MEMORY);
|
exit_toxic_err("failed in prompt_onInit", FATALERR_MEMORY);
|
||||||
|
|
||||||
memset(ctx->log, 0, sizeof(struct chatlog));
|
|
||||||
memset(ctx->hst, 0, sizeof(struct history));
|
|
||||||
|
|
||||||
line_info_init(ctx->hst);
|
line_info_init(ctx->hst);
|
||||||
|
|
||||||
if (user_settings->autolog == AUTOLOG_ON) {
|
if (user_settings->autolog == AUTOLOG_ON) {
|
||||||
|
Loading…
Reference in New Issue
Block a user