mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 08:03:01 +01:00
commit
785d39d78f
@ -2,12 +2,12 @@
|
|||||||
.\" Title: toxic.conf
|
.\" Title: toxic.conf
|
||||||
.\" Author: [see the "AUTHORS" section]
|
.\" Author: [see the "AUTHORS" section]
|
||||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||||
.\" Date: 2014-10-08
|
.\" Date: 2015-02-08
|
||||||
.\" Manual: Toxic Manual
|
.\" Manual: Toxic Manual
|
||||||
.\" Source: toxic __VERSION__
|
.\" Source: toxic __VERSION__
|
||||||
.\" Language: English
|
.\" Language: English
|
||||||
.\"
|
.\"
|
||||||
.TH "TOXIC\&.CONF" "5" "2014\-10\-08" "toxic __VERSION__" "Toxic Manual"
|
.TH "TOXIC\&.CONF" "5" "2015\-02\-08" "toxic __VERSION__" "Toxic Manual"
|
||||||
.\" -----------------------------------------------------------------
|
.\" -----------------------------------------------------------------
|
||||||
.\" * Define some portability stuff
|
.\" * Define some portability stuff
|
||||||
.\" -----------------------------------------------------------------
|
.\" -----------------------------------------------------------------
|
||||||
@ -105,6 +105,26 @@ Show welcome message on startup\&. true or false
|
|||||||
.RS 4
|
.RS 4
|
||||||
Maximum lines for chat window history\&. Integer value\&. (for example: 700)
|
Maximum lines for chat window history\&. Integer value\&. (for example: 700)
|
||||||
.RE
|
.RE
|
||||||
|
.PP
|
||||||
|
\fBline_join\fR
|
||||||
|
.RS 4
|
||||||
|
Indicator for when someone connects or joins a group\&. Three characters max for line_ settings\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fBline_quit\fR
|
||||||
|
.RS 4
|
||||||
|
Indicator for when someone disconnects or leaves a group\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fBline_alert\fR
|
||||||
|
.RS 4
|
||||||
|
Indicator for alert messages\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fBline_normal\fR
|
||||||
|
.RS 4
|
||||||
|
Indicator for normal messages\&.
|
||||||
|
.RE
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
\fBaudio\fR
|
\fBaudio\fR
|
||||||
|
@ -66,6 +66,18 @@ OPTIONS
|
|||||||
*history_size*;;
|
*history_size*;;
|
||||||
Maximum lines for chat window history. Integer value. (for example: 700)
|
Maximum lines for chat window history. Integer value. (for example: 700)
|
||||||
|
|
||||||
|
*line_join*;;
|
||||||
|
Indicator for when someone connects or joins a group.
|
||||||
|
Three characters max for line_ settings.
|
||||||
|
|
||||||
|
*line_quit*;;
|
||||||
|
Indicator for when someone disconnects or leaves a group.
|
||||||
|
|
||||||
|
*line_alert*;;
|
||||||
|
Indicator for alert messages.
|
||||||
|
|
||||||
|
*line_normal*;;
|
||||||
|
Indicator for normal messages.
|
||||||
|
|
||||||
*audio*::
|
*audio*::
|
||||||
Configuration related to audio devices.
|
Configuration related to audio devices.
|
||||||
|
@ -28,6 +28,18 @@ ui = {
|
|||||||
|
|
||||||
// maximum lines for chat window history
|
// maximum lines for chat window history
|
||||||
history_size=700;
|
history_size=700;
|
||||||
|
|
||||||
|
// Indicator for display when someone connects or joins a group.
|
||||||
|
line_join="-->";
|
||||||
|
|
||||||
|
// Indicator for display when someone disconnects or leaves a group.
|
||||||
|
line_quit="<--";
|
||||||
|
|
||||||
|
// Indicator for alert messages.
|
||||||
|
line_alert="-!-";
|
||||||
|
|
||||||
|
// Indicator for normal messages.
|
||||||
|
line_normal="---";
|
||||||
};
|
};
|
||||||
|
|
||||||
audio = {
|
audio = {
|
||||||
|
@ -205,7 +205,7 @@ static void chat_onConnectionChange(ToxWindow *self, Tox *m, int32_t num, uint8_
|
|||||||
chat_stop_file_senders(num);
|
chat_stop_file_senders(num);
|
||||||
|
|
||||||
msg = "has gone offline";
|
msg = "has gone offline";
|
||||||
line_info_add(self, timefrmt, nick, NULL, CONNECTION, 0, RED, msg);
|
line_info_add(self, timefrmt, nick, NULL, DISCONNECTION, 0, RED, msg);
|
||||||
write_to_log(msg, nick, ctx->log, true);
|
write_to_log(msg, nick, ctx->log, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ static void groupchat_onGroupNamelistChange(ToxWindow *self, Tox *m, int groupnu
|
|||||||
|
|
||||||
case TOX_CHAT_CHANGE_PEER_DEL:
|
case TOX_CHAT_CHANGE_PEER_DEL:
|
||||||
event = "has left the room";
|
event = "has left the room";
|
||||||
line_info_add(self, timefrmt, (char *) oldpeername, NULL, CONNECTION, 0, RED, event);
|
line_info_add(self, timefrmt, (char *) oldpeername, NULL, DISCONNECTION, 0, RED, event);
|
||||||
|
|
||||||
if (groupchats[self->num].side_pos > 0)
|
if (groupchats[self->num].side_pos > 0)
|
||||||
--groupchats[self->num].side_pos;
|
--groupchats[self->num].side_pos;
|
||||||
|
@ -156,23 +156,27 @@ void line_info_add(ToxWindow *self, const char *timestr, const char *name1, cons
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case IN_ACTION:
|
case IN_ACTION:
|
||||||
case OUT_ACTION:
|
case OUT_ACTION:
|
||||||
len += 5;
|
len += strlen(user_settings->line_normal) + 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IN_MSG:
|
case IN_MSG:
|
||||||
case OUT_MSG:
|
case OUT_MSG:
|
||||||
len += 6;
|
len += strlen(user_settings->line_normal) + 3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONNECTION:
|
case CONNECTION:
|
||||||
len += 5;
|
len += strlen(user_settings->line_join) + 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DISCONNECTION:
|
||||||
|
len += strlen(user_settings->line_quit) + 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYS_MSG:
|
case SYS_MSG:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_CHANGE:
|
case NAME_CHANGE:
|
||||||
len += 4;
|
len += strlen(user_settings->line_alert) + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROMPT:
|
case PROMPT:
|
||||||
@ -309,7 +313,7 @@ void line_info_print(ToxWindow *self)
|
|||||||
nameclr = CYAN;
|
nameclr = CYAN;
|
||||||
|
|
||||||
wattron(win, COLOR_PAIR(nameclr));
|
wattron(win, COLOR_PAIR(nameclr));
|
||||||
wprintw(win, "--- %s: ", line->name1);
|
wprintw(win, "%s %s: ", user_settings->line_normal, line->name1);
|
||||||
wattroff(win, COLOR_PAIR(nameclr));
|
wattroff(win, COLOR_PAIR(nameclr));
|
||||||
|
|
||||||
if (line->msg[0] == '>')
|
if (line->msg[0] == '>')
|
||||||
@ -342,7 +346,7 @@ void line_info_print(ToxWindow *self)
|
|||||||
wattroff(win, COLOR_PAIR(BLUE));
|
wattroff(win, COLOR_PAIR(BLUE));
|
||||||
|
|
||||||
wattron(win, COLOR_PAIR(YELLOW));
|
wattron(win, COLOR_PAIR(YELLOW));
|
||||||
wprintw(win, "--- %s %s", line->name1, line->msg);
|
wprintw(win, "%s %s %s", user_settings->line_normal, line->name1, line->msg);
|
||||||
wattroff(win, COLOR_PAIR(YELLOW));
|
wattroff(win, COLOR_PAIR(YELLOW));
|
||||||
|
|
||||||
if (type == OUT_ACTION && timed_out(line->timestamp, get_unix_time(), NOREAD_FLAG_TIMEOUT)) {
|
if (type == OUT_ACTION && timed_out(line->timestamp, get_unix_time(), NOREAD_FLAG_TIMEOUT)) {
|
||||||
@ -399,7 +403,24 @@ void line_info_print(ToxWindow *self)
|
|||||||
wattroff(win, COLOR_PAIR(BLUE));
|
wattroff(win, COLOR_PAIR(BLUE));
|
||||||
|
|
||||||
wattron(win, COLOR_PAIR(line->colour));
|
wattron(win, COLOR_PAIR(line->colour));
|
||||||
wprintw(win, "%s ", line->colour == RED ? "<--" : "-->");
|
wprintw(win, "%s ", user_settings->line_join);
|
||||||
|
|
||||||
|
wattron(win, A_BOLD);
|
||||||
|
wprintw(win, "%s ", line->name1);
|
||||||
|
wattroff(win, A_BOLD);
|
||||||
|
|
||||||
|
wprintw(win, "%s\n", line->msg);
|
||||||
|
wattroff(win, COLOR_PAIR(line->colour));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DISCONNECTION:
|
||||||
|
wattron(win, COLOR_PAIR(BLUE));
|
||||||
|
wprintw(win, "%s", line->timestr);
|
||||||
|
wattroff(win, COLOR_PAIR(BLUE));
|
||||||
|
|
||||||
|
wattron(win, COLOR_PAIR(line->colour));
|
||||||
|
wprintw(win, "%s ", user_settings->line_quit);
|
||||||
|
|
||||||
wattron(win, A_BOLD);
|
wattron(win, A_BOLD);
|
||||||
wprintw(win, "%s ", line->name1);
|
wprintw(win, "%s ", line->name1);
|
||||||
@ -416,7 +437,7 @@ void line_info_print(ToxWindow *self)
|
|||||||
wattroff(win, COLOR_PAIR(BLUE));
|
wattroff(win, COLOR_PAIR(BLUE));
|
||||||
|
|
||||||
wattron(win, COLOR_PAIR(MAGENTA));
|
wattron(win, COLOR_PAIR(MAGENTA));
|
||||||
wprintw(win, "-!- ");
|
wprintw(win, "%s ", user_settings->line_alert);
|
||||||
wattron(win, A_BOLD);
|
wattron(win, A_BOLD);
|
||||||
wprintw(win, "%s", line->name1);
|
wprintw(win, "%s", line->name1);
|
||||||
wattroff(win, A_BOLD);
|
wattroff(win, A_BOLD);
|
||||||
|
@ -41,6 +41,7 @@ enum {
|
|||||||
OUT_ACTION_READ, /* same as OUT_MSG_READ but for actions */
|
OUT_ACTION_READ, /* same as OUT_MSG_READ but for actions */
|
||||||
PROMPT,
|
PROMPT,
|
||||||
CONNECTION,
|
CONNECTION,
|
||||||
|
DISCONNECTION,
|
||||||
NAME_CHANGE,
|
NAME_CHANGE,
|
||||||
} LINE_TYPE;
|
} LINE_TYPE;
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int32_t friendnum
|
|||||||
"Toxic", "%s has come online", nick );
|
"Toxic", "%s has come online", nick );
|
||||||
} else {
|
} else {
|
||||||
msg = "has gone offline";
|
msg = "has gone offline";
|
||||||
line_info_add(self, timefrmt, nick, NULL, CONNECTION, 0, RED, msg);
|
line_info_add(self, timefrmt, nick, NULL, DISCONNECTION, 0, RED, msg);
|
||||||
write_to_log(msg, nick, ctx->log, true);
|
write_to_log(msg, nick, ctx->log, true);
|
||||||
|
|
||||||
if (self->active_box != -1)
|
if (self->active_box != -1)
|
||||||
|
@ -55,6 +55,11 @@ static struct ui_strings {
|
|||||||
const char* show_typing_self;
|
const char* show_typing_self;
|
||||||
const char* show_typing_other;
|
const char* show_typing_other;
|
||||||
const char* show_welcome_msg;
|
const char* show_welcome_msg;
|
||||||
|
|
||||||
|
const char* line_join;
|
||||||
|
const char* line_quit;
|
||||||
|
const char* line_alert;
|
||||||
|
const char* line_normal;
|
||||||
} ui_strings = {
|
} ui_strings = {
|
||||||
"ui",
|
"ui",
|
||||||
"timestamps",
|
"timestamps",
|
||||||
@ -66,6 +71,10 @@ static struct ui_strings {
|
|||||||
"show_typing_self",
|
"show_typing_self",
|
||||||
"show_typing_other",
|
"show_typing_other",
|
||||||
"show_welcome_msg",
|
"show_welcome_msg",
|
||||||
|
"line_join",
|
||||||
|
"line_quit",
|
||||||
|
"line_alert",
|
||||||
|
"line_normal",
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ui_defaults(struct user_settings* settings)
|
static void ui_defaults(struct user_settings* settings)
|
||||||
@ -79,6 +88,11 @@ static void ui_defaults(struct user_settings* settings)
|
|||||||
settings->show_typing_self = SHOW_TYPING_ON;
|
settings->show_typing_self = SHOW_TYPING_ON;
|
||||||
settings->show_typing_other = SHOW_TYPING_ON;
|
settings->show_typing_other = SHOW_TYPING_ON;
|
||||||
settings->show_welcome_msg = SHOW_WELCOME_MSG_ON;
|
settings->show_welcome_msg = SHOW_WELCOME_MSG_ON;
|
||||||
|
|
||||||
|
snprintf(settings->line_join, LINE_HINT_MAX + 1, "%s", LINE_JOIN);
|
||||||
|
snprintf(settings->line_quit, LINE_HINT_MAX + 1, "%s", LINE_QUIT);
|
||||||
|
snprintf(settings->line_alert, LINE_HINT_MAX + 1, "%s", LINE_ALERT);
|
||||||
|
snprintf(settings->line_normal, LINE_HINT_MAX + 1, "%s", LINE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct keys_strings {
|
static const struct keys_strings {
|
||||||
@ -262,6 +276,19 @@ int settings_load(struct user_settings *s, const char *patharg)
|
|||||||
config_setting_lookup_bool(setting, ui_strings.show_welcome_msg, &s->show_welcome_msg);
|
config_setting_lookup_bool(setting, ui_strings.show_welcome_msg, &s->show_welcome_msg);
|
||||||
config_setting_lookup_int(setting, ui_strings.time_format, &s->time);
|
config_setting_lookup_int(setting, ui_strings.time_format, &s->time);
|
||||||
s->time = s->time == TIME_24 || s->time == TIME_12 ? s->time : TIME_24; /* Check defaults */
|
s->time = s->time == TIME_24 || s->time == TIME_12 ? s->time : TIME_24; /* Check defaults */
|
||||||
|
|
||||||
|
if ( config_setting_lookup_string(setting, ui_strings.line_join, &str) ) {
|
||||||
|
snprintf(s->line_join, sizeof(s->line_join), "%s", str);
|
||||||
|
}
|
||||||
|
if ( config_setting_lookup_string(setting, ui_strings.line_quit, &str) ) {
|
||||||
|
snprintf(s->line_quit, sizeof(s->line_quit), "%s", str);
|
||||||
|
}
|
||||||
|
if ( config_setting_lookup_string(setting, ui_strings.line_alert, &str) ) {
|
||||||
|
snprintf(s->line_alert, sizeof(s->line_alert), "%s", str);
|
||||||
|
}
|
||||||
|
if ( config_setting_lookup_string(setting, ui_strings.line_normal, &str) ) {
|
||||||
|
snprintf(s->line_normal, sizeof(s->line_normal), "%s", str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* paths */
|
/* paths */
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
/* Represents line_* hints max strlen */
|
||||||
|
#define LINE_HINT_MAX 3
|
||||||
|
|
||||||
/* holds user setting values */
|
/* holds user setting values */
|
||||||
struct user_settings {
|
struct user_settings {
|
||||||
int autolog; /* boolean */
|
int autolog; /* boolean */
|
||||||
@ -37,6 +40,11 @@ struct user_settings {
|
|||||||
int show_typing_other; /* boolean */
|
int show_typing_other; /* boolean */
|
||||||
int show_welcome_msg; /* boolean */
|
int show_welcome_msg; /* boolean */
|
||||||
|
|
||||||
|
char line_join[LINE_HINT_MAX + 1];
|
||||||
|
char line_quit[LINE_HINT_MAX + 1];
|
||||||
|
char line_alert[LINE_HINT_MAX + 1];
|
||||||
|
char line_normal[LINE_HINT_MAX + 1];
|
||||||
|
|
||||||
char download_path[PATH_MAX];
|
char download_path[PATH_MAX];
|
||||||
char chatlogs_path[PATH_MAX];
|
char chatlogs_path[PATH_MAX];
|
||||||
char avatar_path[PATH_MAX];
|
char avatar_path[PATH_MAX];
|
||||||
@ -84,5 +92,10 @@ enum {
|
|||||||
DFLT_HST_SIZE = 700,
|
DFLT_HST_SIZE = 700,
|
||||||
} settings_values;
|
} settings_values;
|
||||||
|
|
||||||
|
#define LINE_JOIN "-->"
|
||||||
|
#define LINE_QUIT "<--"
|
||||||
|
#define LINE_ALERT "-!-"
|
||||||
|
#define LINE_NORMAL "---"
|
||||||
|
|
||||||
int settings_load(struct user_settings *s, const char *patharg);
|
int settings_load(struct user_settings *s, const char *patharg);
|
||||||
#endif /* #define SETTINGS_H */
|
#endif /* #define SETTINGS_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user