diff --git a/doc/toxic.conf.5 b/doc/toxic.conf.5
index 3fb2aee..fa30e86 100644
--- a/doc/toxic.conf.5
+++ b/doc/toxic.conf.5
@@ -2,12 +2,12 @@
.\" Title: toxic.conf
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1
-.\" Date: 2014-10-08
+.\" Date: 2015-02-08
.\" Manual: Toxic Manual
.\" Source: toxic __VERSION__
.\" 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
.\" -----------------------------------------------------------------
@@ -105,6 +105,26 @@ Show welcome message on startup\&. true or false
.RS 4
Maximum lines for chat window history\&. Integer value\&. (for example: 700)
.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
.PP
\fBaudio\fR
diff --git a/doc/toxic.conf.5.asc b/doc/toxic.conf.5.asc
index 05ae202..4643405 100644
--- a/doc/toxic.conf.5.asc
+++ b/doc/toxic.conf.5.asc
@@ -66,6 +66,18 @@ OPTIONS
*history_size*;;
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*::
Configuration related to audio devices.
diff --git a/misc/toxic.conf.example b/misc/toxic.conf.example
index 29d6abf..7b8e352 100644
--- a/misc/toxic.conf.example
+++ b/misc/toxic.conf.example
@@ -28,6 +28,18 @@ ui = {
// maximum lines for chat window history
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 = {
diff --git a/src/chat.c b/src/chat.c
index 88ae56a..e44546d 100644
--- a/src/chat.c
+++ b/src/chat.c
@@ -205,7 +205,7 @@ static void chat_onConnectionChange(ToxWindow *self, Tox *m, int32_t num, uint8_
chat_stop_file_senders(num);
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);
}
}
diff --git a/src/groupchat.c b/src/groupchat.c
index e568947..5360bc9 100644
--- a/src/groupchat.c
+++ b/src/groupchat.c
@@ -505,7 +505,7 @@ static void groupchat_onGroupNamelistChange(ToxWindow *self, Tox *m, int groupnu
case TOX_CHAT_CHANGE_PEER_DEL:
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)
--groupchats[self->num].side_pos;
diff --git a/src/line_info.c b/src/line_info.c
index 8ee0a9f..d3be1ae 100644
--- a/src/line_info.c
+++ b/src/line_info.c
@@ -156,23 +156,27 @@ void line_info_add(ToxWindow *self, const char *timestr, const char *name1, cons
switch (type) {
case IN_ACTION:
case OUT_ACTION:
- len += 5;
+ len += strlen(user_settings->line_normal) + 2;
break;
case IN_MSG:
case OUT_MSG:
- len += 6;
+ len += strlen(user_settings->line_normal) + 3;
break;
case CONNECTION:
- len += 5;
+ len += strlen(user_settings->line_join) + 2;
+ break;
+
+ case DISCONNECTION:
+ len += strlen(user_settings->line_quit) + 2;
break;
case SYS_MSG:
break;
case NAME_CHANGE:
- len += 4;
+ len += strlen(user_settings->line_alert) + 1;
break;
case PROMPT:
@@ -309,7 +313,7 @@ void line_info_print(ToxWindow *self)
nameclr = CYAN;
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));
if (line->msg[0] == '>')
@@ -342,7 +346,7 @@ void line_info_print(ToxWindow *self)
wattroff(win, COLOR_PAIR(BLUE));
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));
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));
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);
wprintw(win, "%s ", line->name1);
@@ -416,7 +437,7 @@ void line_info_print(ToxWindow *self)
wattroff(win, COLOR_PAIR(BLUE));
wattron(win, COLOR_PAIR(MAGENTA));
- wprintw(win, "-!- ");
+ wprintw(win, "%s ", user_settings->line_alert);
wattron(win, A_BOLD);
wprintw(win, "%s", line->name1);
wattroff(win, A_BOLD);
diff --git a/src/line_info.h b/src/line_info.h
index cb91365..7bd1aa8 100644
--- a/src/line_info.h
+++ b/src/line_info.h
@@ -41,6 +41,7 @@ enum {
OUT_ACTION_READ, /* same as OUT_MSG_READ but for actions */
PROMPT,
CONNECTION,
+ DISCONNECTION,
NAME_CHANGE,
} LINE_TYPE;
diff --git a/src/prompt.c b/src/prompt.c
index a580c1f..10af01e 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -357,7 +357,7 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int32_t friendnum
"Toxic", "%s has come online", nick );
} else {
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);
if (self->active_box != -1)
diff --git a/src/settings.c b/src/settings.c
index 9d3c7c2..cd8385f 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -55,6 +55,11 @@ static struct ui_strings {
const char* show_typing_self;
const char* show_typing_other;
const char* show_welcome_msg;
+
+ const char* line_join;
+ const char* line_quit;
+ const char* line_alert;
+ const char* line_normal;
} ui_strings = {
"ui",
"timestamps",
@@ -66,6 +71,10 @@ static struct ui_strings {
"show_typing_self",
"show_typing_other",
"show_welcome_msg",
+ "line_join",
+ "line_quit",
+ "line_alert",
+ "line_normal",
};
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_other = SHOW_TYPING_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 {
@@ -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_int(setting, ui_strings.time_format, &s->time);
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 */
diff --git a/src/settings.h b/src/settings.h
index 6328382..1cc9e13 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -25,6 +25,9 @@
#include
+/* Represents line_* hints max strlen */
+#define LINE_HINT_MAX 3
+
/* holds user setting values */
struct user_settings {
int autolog; /* boolean */
@@ -37,6 +40,11 @@ struct user_settings {
int show_typing_other; /* 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 chatlogs_path[PATH_MAX];
char avatar_path[PATH_MAX];
@@ -84,5 +92,10 @@ enum {
DFLT_HST_SIZE = 700,
} settings_values;
+#define LINE_JOIN "-->"
+#define LINE_QUIT "<--"
+#define LINE_ALERT "-!-"
+#define LINE_NORMAL "---"
+
int settings_load(struct user_settings *s, const char *patharg);
#endif /* #define SETTINGS_H */