summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-11-19 22:08:46 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-11-19 22:08:46 +0000
commitd5affecc23554c886d81c4b735dca42ac2fd0bd2 (patch)
treea8c1ec8a4a0c800e06ae1d930e5c8373d091fc93 /src
parent967d436a1d85edd2e92d2fc72499b4a7c57de65f (diff)
downloadweechat-d5affecc23554c886d81c4b735dca42ac2fd0bd2.zip
Added read marker (indicator for first unread line), added quotes and spaces in config files
Diffstat (limited to 'src')
-rw-r--r--src/common/command.c27
-rw-r--r--src/common/completion.c9
-rw-r--r--src/common/weeconfig.c231
-rw-r--r--src/common/weeconfig.h4
-rw-r--r--src/gui/curses/gui-display.c33
-rw-r--r--src/gui/gui-common.c82
-rw-r--r--src/gui/gui.h2
-rw-r--r--src/irc/irc-display.c12
-rw-r--r--src/irc/irc-recv.c19
-rw-r--r--src/irc/irc-send.c15
-rw-r--r--src/plugins/plugins-config.c40
11 files changed, 343 insertions, 131 deletions
diff --git a/src/common/command.c b/src/common/command.c
index ba870c751..ac3d2fa03 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -2351,9 +2351,11 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val
gui_printf (NULL, _("%s(password hidden) "),
GUI_COLOR(COLOR_WIN_CHAT));
}
- gui_printf (NULL, "%s%s",
+ gui_printf (NULL, "%s\"%s%s%s\"",
+ GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
- value2);
+ value2,
+ GUI_COLOR(COLOR_WIN_CHAT_DARK));
free (value2);
}
gui_printf (NULL, "\n");
@@ -2400,6 +2402,27 @@ weechat_cmd_set (char *arguments)
{
value++;
}
+
+ /* remove simple or double quotes
+ and spaces at the end */
+ if (strlen(value) > 1)
+ {
+ pos = value + strlen (value) - 1;
+ while ((pos > value) && (pos[0] == ' '))
+ {
+ pos[0] = '\0';
+ pos--;
+ }
+ pos = value + strlen (value) - 1;
+ if (((value[0] == '\'') &&
+ (pos[0] == '\'')) ||
+ ((value[0] == '"') &&
+ (pos[0] == '"')))
+ {
+ pos[0] = '\0';
+ value++;
+ }
+ }
}
}
diff --git a/src/common/completion.c b/src/common/completion.c
index f798643b5..e7f1dc624 100644
--- a/src/common/completion.c
+++ b/src/common/completion.c
@@ -444,11 +444,14 @@ completion_build_list (t_completion *completion, void *channel)
option->default_string);
break;
case OPTION_TYPE_STRING:
+ snprintf (option_string, sizeof (option_string) - 1,
+ "\"%s\"",
+ (option_value) ?
+ *((char **)(option_value)) :
+ option->default_string);
weelist_add (&completion->completion_list,
&completion->last_completion,
- (option_value) ?
- *((char **)(option_value)) :
- option->default_string);
+ option_string);
break;
}
}
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index d5a977b90..8722b7d17 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -97,6 +97,7 @@ int cfg_look_hotlist_names_level;
int cfg_look_hotlist_names_length;
int cfg_look_day_change;
char *cfg_look_day_change_timestamp;
+char *cfg_look_read_marker;
t_config_option weechat_options_look[] =
{ { "look_set_title", N_("set title for window (terminal for Curses GUI) with name & version"),
@@ -229,6 +230,10 @@ t_config_option weechat_options_look[] =
N_("timestamp for date displayed when day changed"),
OPTION_TYPE_STRING, 0, 0, 0,
"%a, %d %b %Y", NULL, NULL, &cfg_look_day_change_timestamp, config_change_noop },
+ { "look_read_marker", N_("use a marker on servers/channels to show first unread line"),
+ N_("use a marker on servers/channels to show first unread line"),
+ OPTION_TYPE_STRING, 0, 0, 0,
+ " ", NULL, NULL, &cfg_look_read_marker, config_change_read_marker},
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -251,6 +256,8 @@ int cfg_col_chat_channel;
int cfg_col_chat_dark;
int cfg_col_chat_highlight;
int cfg_col_chat_bg;
+int cfg_col_chat_marker;
+int cfg_col_chat_marker_bg;
int cfg_col_status;
int cfg_col_status_delimiters;
int cfg_col_status_channel;
@@ -365,6 +372,14 @@ t_config_option weechat_options_colors[] =
N_("background for chat window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"default", NULL, &cfg_col_chat_bg, NULL, &config_change_color },
+ { "col_chat_marker", N_("color for unread data marker"),
+ N_("color for unread data marker"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "yellow", NULL, &cfg_col_chat_marker, NULL, &config_change_color },
+ { "col_chat_marker_bg", N_("background for unread data marker"),
+ N_("background for unread data marker"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "magenta", NULL, &cfg_col_chat_marker_bg, NULL, &config_change_color },
/* status window */
{ "col_status", N_("color for status bar"),
@@ -1033,6 +1048,19 @@ config_change_buffer_content ()
}
/*
+ * config_change_read_marker: called when read marker is changed
+ */
+
+void
+config_change_read_marker ()
+{
+ t_gui_window *ptr_win;
+
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+ gui_redraw_buffer (ptr_win->buffer);
+}
+
+/*
* config_change_charset: called when charset changes
*/
@@ -1680,6 +1708,22 @@ config_read ()
{
pos[0] = '\0';
pos++;
+
+ /* remove spaces before '=' */
+ pos2 = pos - 2;
+ while ((pos2 > line) && (pos2[0] == ' '))
+ {
+ pos2[0] = '\0';
+ pos2--;
+ }
+
+ /* skip spaces after '=' */
+ while (pos[0] && (pos[0] == ' '))
+ {
+ pos++;
+ }
+
+ /* remove CR/LF */
pos2 = strchr (pos, '\r');
if (pos2 != NULL)
pos2[0] = '\0';
@@ -1687,6 +1731,27 @@ config_read ()
if (pos2 != NULL)
pos2[0] = '\0';
+ /* remove simple or double quotes
+ and spaces at the end */
+ if (strlen(pos) > 1)
+ {
+ pos2 = pos + strlen (pos) - 1;
+ while ((pos2 > pos) && (pos2[0] == ' '))
+ {
+ pos2[0] = '\0';
+ pos2--;
+ }
+ pos2 = pos + strlen (pos) - 1;
+ if (((pos[0] == '\'') &&
+ (pos2[0] == '\'')) ||
+ ((pos[0] == '"') &&
+ (pos2[0] == '"')))
+ {
+ pos2[0] = '\0';
+ pos++;
+ }
+ }
+
if (section == CONFIG_SECTION_KEYS)
{
if (pos[0])
@@ -1875,20 +1940,24 @@ config_create_default ()
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = %s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].default_int) ?
"on" : "off");
break;
case OPTION_TYPE_INT:
- fprintf (file, "%s=%d\n",
+ fprintf (file, "%s = %d\n",
weechat_options[i][j].option_name,
weechat_options[i][j].default_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
case OPTION_TYPE_COLOR:
+ fprintf (file, "%s = %s\n",
+ weechat_options[i][j].option_name,
+ weechat_options[i][j].default_string);
+ break;
case OPTION_TYPE_STRING:
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = \"%s\"\n",
weechat_options[i][j].option_name,
weechat_options[i][j].default_string);
break;
@@ -1906,12 +1975,12 @@ config_create_default ()
{
function_name = gui_key_function_search_by_ptr (ptr_key->function);
if (function_name)
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = \"%s\"\n",
(expanded_name) ? expanded_name : ptr_key->key,
function_name);
}
else
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = \"%s\"\n",
(expanded_name) ? expanded_name : ptr_key->key,
ptr_key->command);
if (expanded_name)
@@ -1920,64 +1989,64 @@ config_create_default ()
/* default aliases */
fprintf (file, "\n[alias]\n");
- fprintf (file, "SAY=msg *\n");
- fprintf (file, "BYE=quit\n");
- fprintf (file, "EXIT=quit\n");
- fprintf (file, "SIGNOFF=quit\n");
- fprintf (file, "C=clear\n");
- fprintf (file, "CL=clear\n");
- fprintf (file, "CLOSE=buffer close\n");
- fprintf (file, "CHAT=dcc chat\n");
- fprintf (file, "IG=ignore\n");
- fprintf (file, "J=join\n");
- fprintf (file, "K=kick\n");
- fprintf (file, "KB=kickban\n");
- fprintf (file, "LEAVE=part\n");
- fprintf (file, "M=msg\n");
- fprintf (file, "MUB=unban *\n");
- fprintf (file, "N=names\n");
- fprintf (file, "Q=query\n");
- fprintf (file, "T=topic\n");
- fprintf (file, "UB=unban\n");
- fprintf (file, "UNIG=unignore\n");
- fprintf (file, "W=who\n");
- fprintf (file, "WC=part\n");
- fprintf (file, "WI=whois\n");
- fprintf (file, "WW=whowas\n");
+ fprintf (file, "SAY = \"msg *\"\n");
+ fprintf (file, "BYE = \"quit\"\n");
+ fprintf (file, "EXIT = \"quit\"\n");
+ fprintf (file, "SIGNOFF = \"quit\"\n");
+ fprintf (file, "C = \"clear\"\n");
+ fprintf (file, "CL = \"clear\"\n");
+ fprintf (file, "CLOSE = \"buffer close\"\n");
+ fprintf (file, "CHAT = \"dcc chat\"\n");
+ fprintf (file, "IG = \"ignore\"\n");
+ fprintf (file, "J = \"join\"\n");
+ fprintf (file, "K = \"kick\"\n");
+ fprintf (file, "KB = \"kickban\"\n");
+ fprintf (file, "LEAVE = \"part\"\n");
+ fprintf (file, "M = \"msg\"\n");
+ fprintf (file, "MUB = \"unban *\"\n");
+ fprintf (file, "N = \"names\"\n");
+ fprintf (file, "Q = \"query\"\n");
+ fprintf (file, "T = \"topic\"\n");
+ fprintf (file, "UB = \"unban\"\n");
+ fprintf (file, "UNIG = \"unignore\"\n");
+ fprintf (file, "W = \"who\"\n");
+ fprintf (file, "WC = \"part\"\n");
+ fprintf (file, "WI = \"whois\"\n");
+ fprintf (file, "WW = \"whowas\"\n");
/* no ignore by default */
/* default server is freenode */
fprintf (file, "\n[server]\n");
- fprintf (file, "server_name=freenode\n");
- fprintf (file, "server_autoconnect=on\n");
- fprintf (file, "server_autoreconnect=on\n");
- fprintf (file, "server_autoreconnect_delay=30\n");
- fprintf (file, "server_address=irc.freenode.net\n");
- fprintf (file, "server_port=6667\n");
- fprintf (file, "server_ipv6=off\n");
- fprintf (file, "server_ssl=off\n");
- fprintf (file, "server_password=\n");
+ fprintf (file, "server_name = \"freenode\"\n");
+ fprintf (file, "server_autoconnect = on\n");
+ fprintf (file, "server_autoreconnect = on\n");
+ fprintf (file, "server_autoreconnect_delay = 30\n");
+ fprintf (file, "server_address = \"irc.freenode.net\"\n");
+ fprintf (file, "server_port = 6667\n");
+ fprintf (file, "server_ipv6 = off\n");
+ fprintf (file, "server_ssl = off\n");
+ fprintf (file, "server_password = \"\"\n");
/* Get the user's name from /etc/passwd */
if ((my_passwd = getpwuid (geteuid ())) != NULL)
{
- fprintf (file, "server_nick1=%s\n", my_passwd->pw_name);
- fprintf (file, "server_nick2=%s1\n", my_passwd->pw_name);
- fprintf (file, "server_nick3=%s2\n", my_passwd->pw_name);
- fprintf (file, "server_username=%s\n", my_passwd->pw_name);
+ fprintf (file, "server_nick1 = \"%s\"\n", my_passwd->pw_name);
+ fprintf (file, "server_nick2 = \"%s1\"\n", my_passwd->pw_name);
+ fprintf (file, "server_nick3 = \"%s2\"\n", my_passwd->pw_name);
+ fprintf (file, "server_username = \"%s\"\n", my_passwd->pw_name);
if ((!my_passwd->pw_gecos)
|| (my_passwd->pw_gecos[0] == '\0')
|| (my_passwd->pw_gecos[0] == ',')
|| (my_passwd->pw_gecos[0] == ' '))
- fprintf (file, "server_realname=%s\n", my_passwd->pw_name);
+ fprintf (file, "server_realname = \"%s\"\n", my_passwd->pw_name);
else
{
realname = strdup (my_passwd->pw_gecos);
pos = strchr (realname, ',');
if (pos)
pos[0] = '\0';
- fprintf (file, "server_realname=%s\n",
+ fprintf (file, "server_realname = \"%s\"\n",
realname);
if (pos)
pos[0] = ',';
@@ -1991,17 +2060,17 @@ config_create_default ()
WEECHAT_WARNING,
_("Unable to get user's name"),
strerror (errno));
- fprintf (file, "server_nick1=weechat1\n");
- fprintf (file, "server_nick2=weechat2\n");
- fprintf (file, "server_nick3=weechat3\n");
- fprintf (file, "server_username=weechat\n");
- fprintf (file, "server_realname=WeeChat default realname\n");
+ fprintf (file, "server_nick1 = \"weechat1\"\n");
+ fprintf (file, "server_nick2 = \"weechat2\"\n");
+ fprintf (file, "server_nick3 = \"weechat3\"\n");
+ fprintf (file, "server_username = \"weechat\"\n");
+ fprintf (file, "server_realname = \"WeeChat default realname\"\n");
}
- fprintf (file, "server_command=\n");
- fprintf (file, "server_command_delay=0\n");
- fprintf (file, "server_autojoin=\n");
- fprintf (file, "server_autorejoin=on\n");
+ fprintf (file, "server_command = \"\"\n");
+ fprintf (file, "server_command_delay = 0\n");
+ fprintf (file, "server_autojoin = \"\"\n");
+ fprintf (file, "server_autorejoin = on\n");
fclose (file);
chmod (filename, 0600);
@@ -2072,35 +2141,35 @@ config_write (char *config_name)
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = %s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int &&
*weechat_options[i][j].ptr_int) ?
"on" : "off");
break;
case OPTION_TYPE_INT:
- fprintf (file, "%s=%d\n",
+ fprintf (file, "%s = %d\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
*weechat_options[i][j].ptr_int :
weechat_options[i][j].default_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = %s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int] :
weechat_options[i][j].array_values[weechat_options[i][j].default_int]);
break;
case OPTION_TYPE_COLOR:
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = %s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
gui_get_color_name (*weechat_options[i][j].ptr_int) :
weechat_options[i][j].default_string);
break;
case OPTION_TYPE_STRING:
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = \"%s\"\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_string) ?
*weechat_options[i][j].ptr_string :
@@ -2120,12 +2189,12 @@ config_write (char *config_name)
{
function_name = gui_key_function_search_by_ptr (ptr_key->function);
if (function_name)
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = \"%s\"\n",
(expanded_name) ? expanded_name : ptr_key->key,
function_name);
}
else
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = \"%s\"\n",
(expanded_name) ? expanded_name : ptr_key->key,
ptr_key->command);
if (expanded_name)
@@ -2137,7 +2206,7 @@ config_write (char *config_name)
for (ptr_alias = weechat_alias; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = \"%s\"\n",
ptr_alias->alias_name, ptr_alias->alias_command + 1);
}
@@ -2146,7 +2215,7 @@ config_write (char *config_name)
for (ptr_ignore = irc_ignore; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
- fprintf (file, "ignore=%s,%s,%s,%s\n",
+ fprintf (file, "ignore = \"%s,%s,%s,%s\"\n",
ptr_ignore->mask,
ptr_ignore->type,
ptr_ignore->channel_name,
@@ -2160,34 +2229,34 @@ config_write (char *config_name)
if (!ptr_server->command_line)
{
fprintf (file, "\n[server]\n");
- fprintf (file, "server_name=%s\n", ptr_server->name);
- fprintf (file, "server_autoconnect=%s\n",
+ fprintf (file, "server_name = \"%s\"\n", ptr_server->name);
+ fprintf (file, "server_autoconnect = %s\n",
(ptr_server->autoconnect) ? "on" : "off");
- fprintf (file, "server_autoreconnect=%s\n",
+ fprintf (file, "server_autoreconnect = %s\n",
(ptr_server->autoreconnect) ? "on" : "off");
- fprintf (file, "server_autoreconnect_delay=%d\n",
+ fprintf (file, "server_autoreconnect_delay = %d\n",
ptr_server->autoreconnect_delay);
- fprintf (file, "server_address=%s\n", ptr_server->address);
- fprintf (file, "server_port=%d\n", ptr_server->port);
- fprintf (file, "server_ipv6=%s\n",
+ fprintf (file, "server_address = \"%s\"\n", ptr_server->address);
+ fprintf (file, "server_port = %d\n", ptr_server->port);
+ fprintf (file, "server_ipv6 = %s\n",
(ptr_server->ipv6) ? "on" : "off");
- fprintf (file, "server_ssl=%s\n",
+ fprintf (file, "server_ssl = %s\n",
(ptr_server->ssl) ? "on" : "off");
- fprintf (file, "server_password=%s\n",
+ fprintf (file, "server_password = \"%s\"\n",
(ptr_server->password) ? ptr_server->password : "");
- fprintf (file, "server_nick1=%s\n", ptr_server->nick1);
- fprintf (file, "server_nick2=%s\n", ptr_server->nick2);
- fprintf (file, "server_nick3=%s\n", ptr_server->nick3);
- fprintf (file, "server_username=%s\n", ptr_server->username);
- fprintf (file, "server_realname=%s\n", ptr_server->realname);
- fprintf (file, "server_command=%s\n",
+ fprintf (file, "server_nick1 = \"%s\"\n", ptr_server->nick1);
+ fprintf (file, "server_nick2 = \"%s\"\n", ptr_server->nick2);
+ fprintf (file, "server_nick3 = \"%s\"\n", ptr_server->nick3);
+ fprintf (file, "server_username = \"%s\"\n", ptr_server->username);
+ fprintf (file, "server_realname = \"%s\"\n", ptr_server->realname);
+ fprintf (file, "server_command = \"%s\"\n",
(ptr_server->command) ? ptr_server->command : "");
- fprintf (file, "server_command_delay=%d\n", ptr_server->command_delay);
- fprintf (file, "server_autojoin=%s\n",
+ fprintf (file, "server_command_delay = %d\n", ptr_server->command_delay);
+ fprintf (file, "server_autojoin = \"%s\"\n",
(ptr_server->autojoin) ? ptr_server->autojoin : "");
- fprintf (file, "server_autorejoin=%s\n",
+ fprintf (file, "server_autorejoin = %s\n",
(ptr_server->autorejoin) ? "on" : "off");
- fprintf (file, "server_notify_levels=%s\n",
+ fprintf (file, "server_notify_levels = \"%s\"\n",
(ptr_server->notify_levels) ? ptr_server->notify_levels : "");
}
}
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index b0413c3e1..e74d2db51 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -110,6 +110,7 @@ extern int cfg_look_hotlist_names_level;
extern int cfg_look_hotlist_names_length;
extern int cfg_look_day_change;
extern char *cfg_look_day_change_timestamp;
+extern char *cfg_look_read_marker;
extern int cfg_col_real_white;
extern int cfg_col_title;
@@ -128,6 +129,8 @@ extern int cfg_col_chat_channel;
extern int cfg_col_chat_dark;
extern int cfg_col_chat_highlight;
extern int cfg_col_chat_bg;
+extern int cfg_col_chat_marker;
+extern int cfg_col_chat_marker_bg;
extern int cfg_col_status;
extern int cfg_col_status_delimiters;
extern int cfg_col_status_channel;
@@ -226,6 +229,7 @@ extern void config_change_noop ();
extern void config_change_title ();
extern void config_change_buffers ();
extern void config_change_buffer_content ();
+extern void config_change_read_marker ();
extern void config_change_charset ();
extern void config_change_one_server_buffer ();
extern void config_change_color ();
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index b8572a85b..4080e6bb1 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -1228,6 +1228,7 @@ int
gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulate)
{
int num_lines, x, y, lines_displayed;
+ int read_marker_x, read_marker_y;
int word_start_offset, word_end_offset;
int word_length_with_spaces, word_length;
int skip_spaces;
@@ -1253,6 +1254,18 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
window->win_chat_cursor_y = y;
}
+ /* calculate marker position (maybe not used for this line!) */
+ if (line->ofs_after_date > 0)
+ {
+ saved_char = line->data[line->ofs_after_date - 1];
+ line->data[line->ofs_after_date - 1] = '\0';
+ read_marker_x = x + gui_word_strlen (NULL, line->data);
+ line->data[line->ofs_after_date - 1] = saved_char;
+ }
+ else
+ read_marker_x = x;
+ read_marker_y = y;
+
/* reset color & style for a new line */
gui_window_chat_reset_style (window);
@@ -1342,6 +1355,18 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
window->win_chat_cursor_x = x;
window->win_chat_cursor_y = y;
}
+ else
+ {
+ /* display read marker if needed */
+ if (cfg_look_read_marker && cfg_look_read_marker[0] &&
+ window->buffer->last_read_line &&
+ (window->buffer->last_read_line == line->prev_line))
+ {
+ gui_window_chat_set_weechat_color (window, COLOR_WIN_CHAT_MARKER);
+ mvwprintw (window->win_chat, read_marker_y, read_marker_x,
+ "%c", cfg_look_read_marker[0]);
+ }
+ }
return lines_displayed;
}
@@ -2503,6 +2528,13 @@ gui_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
if (window->buffer->num_displayed > 0)
window->buffer->num_displayed--;
+ if (window->buffer != buffer)
+ {
+ window->buffer->last_read_line = window->buffer->last_line;
+ if (buffer->last_read_line == buffer->last_line)
+ buffer->last_read_line = NULL;
+ }
+
window->buffer = buffer;
window->win_nick_start = 0;
gui_calculate_pos_size (window);
@@ -3129,6 +3161,7 @@ gui_init_weechat_colors ()
gui_color[COLOR_WIN_CHAT_CHANNEL] = gui_color_build (COLOR_WIN_CHAT_CHANNEL, cfg_col_chat_channel, cfg_col_chat_bg);
gui_color[COLOR_WIN_CHAT_DARK] = gui_color_build (COLOR_WIN_CHAT_DARK, cfg_col_chat_dark, cfg_col_chat_bg);
gui_color[COLOR_WIN_CHAT_HIGHLIGHT] = gui_color_build (COLOR_WIN_CHAT_HIGHLIGHT, cfg_col_chat_highlight, cfg_col_chat_bg);
+ gui_color[COLOR_WIN_CHAT_MARKER] = gui_color_build (COLOR_WIN_CHAT_MARKER, cfg_col_chat_marker, cfg_col_chat_marker_bg);
gui_color[COLOR_WIN_STATUS] = gui_color_build (COLOR_WIN_STATUS, cfg_col_status, cfg_col_status_bg);
gui_color[COLOR_WIN_STATUS_DELIMITERS] = gui_color_build (COLOR_WIN_STATUS_DELIMITERS, cfg_col_status_delimiters, cfg_col_status_bg);
gui_color[COLOR_WIN_STATUS_CHANNEL] = gui_color_build (COLOR_WIN_STATUS_CHANNEL, cfg_col_status_channel, cfg_col_status_bg);
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index c52cf4728..6932173c2 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -362,6 +362,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
/* init lines */
new_buffer->lines = NULL;
new_buffer->last_line = NULL;
+ new_buffer->last_read_line = NULL;
new_buffer->num_lines = 0;
new_buffer->line_complete = 1;
@@ -857,66 +858,68 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes
pos = buf2 - 1;
while (pos)
{
- if (display_time
- && cfg_look_buffer_timestamp && cfg_look_buffer_timestamp[0]
- && ((!buffer->last_line) || (buffer->line_complete)))
+ if ((!buffer->last_line) || (buffer->line_complete))
{
- time_seconds = time (NULL);
- local_time = localtime (&time_seconds);
- strftime (text_time, sizeof (text_time), cfg_look_buffer_timestamp, local_time);
-
- time_first_digit = -1;
- time_last_digit = -1;
- i = 0;
- while (text_time[i])
+ if (display_time && cfg_look_buffer_timestamp &&
+ cfg_look_buffer_timestamp[0])
{
- if (isdigit (text_time[i]))
+ time_seconds = time (NULL);
+ local_time = localtime (&time_seconds);
+ strftime (text_time, sizeof (text_time), cfg_look_buffer_timestamp, local_time);
+
+ time_first_digit = -1;
+ time_last_digit = -1;
+ i = 0;
+ while (text_time[i])
{
- if (time_first_digit == -1)
- time_first_digit = i;
- time_last_digit = i;
- }
- i++;
- }
-
- text_time_char[1] = '\0';
- i = 0;
- while (text_time[i])
- {
- text_time_char[0] = text_time[i];
- if (time_first_digit < 0)
- {
- gui_add_to_line (buffer, MSG_TYPE_TIME,
- GUI_COLOR(COLOR_WIN_CHAT_TIME));
- gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
+ if (isdigit (text_time[i]))
+ {
+ if (time_first_digit == -1)
+ time_first_digit = i;
+ time_last_digit = i;
+ }
+ i++;
}
- else
+
+ text_time_char[1] = '\0';
+ i = 0;
+ while (text_time[i])
{
- if ((i < time_first_digit) || (i > time_last_digit))
+ text_time_char[0] = text_time[i];
+ if (time_first_digit < 0)
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
- GUI_COLOR(COLOR_WIN_CHAT_DARK));
+ GUI_COLOR(COLOR_WIN_CHAT_TIME));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
- if (isdigit (text_time[i]))
+ if ((i < time_first_digit) || (i > time_last_digit))
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
- GUI_COLOR(COLOR_WIN_CHAT_TIME));
+ GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
- gui_add_to_line (buffer, MSG_TYPE_TIME,
- GUI_COLOR(COLOR_WIN_CHAT_TIME_SEP));
- gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
+ if (isdigit (text_time[i]))
+ {
+ gui_add_to_line (buffer, MSG_TYPE_TIME,
+ GUI_COLOR(COLOR_WIN_CHAT_TIME));
+ gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
+ }
+ else
+ {
+ gui_add_to_line (buffer, MSG_TYPE_TIME,
+ GUI_COLOR(COLOR_WIN_CHAT_TIME_SEP));
+ gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
+ }
}
}
+ i++;
}
- i++;
+ gui_add_to_line (buffer, MSG_TYPE_TIME, GUI_COLOR(COLOR_WIN_CHAT));
}
- gui_add_to_line (buffer, MSG_TYPE_TIME, GUI_COLOR(COLOR_WIN_CHAT));
gui_add_to_line (buffer, MSG_TYPE_TIME, " ");
}
gui_add_to_line (buffer, type, pos + 1);
@@ -1611,6 +1614,7 @@ gui_buffer_print_log (t_gui_buffer *buffer)
wee_log_printf (" dcc. . . . . . . . . : %d\n", buffer->dcc);
wee_log_printf (" lines. . . . . . . . : 0x%X\n", buffer->lines);
wee_log_printf (" last_line. . . . . . : 0x%X\n", buffer->last_line);
+ wee_log_printf (" last_read_line . . . : 0x%X\n", buffer->last_read_line);
wee_log_printf (" num_lines. . . . . . : %d\n", buffer->num_lines);
wee_log_printf (" line_complete. . . . : %d\n", buffer->line_complete);
wee_log_printf (" notify_level . . . . : %d\n", buffer->notify_level);
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 54e1d6975..72c54960a 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -58,6 +58,7 @@ enum t_weechat_color
COLOR_WIN_CHAT_CHANNEL,
COLOR_WIN_CHAT_DARK,
COLOR_WIN_CHAT_HIGHLIGHT,
+ COLOR_WIN_CHAT_MARKER,
COLOR_WIN_STATUS,
COLOR_WIN_STATUS_DELIMITERS,
COLOR_WIN_STATUS_CHANNEL,
@@ -228,6 +229,7 @@ struct t_gui_buffer
/* chat content (lines, line is composed by many messages) */
t_gui_line *lines; /* lines of chat window */
t_gui_line *last_line; /* last line of chat window */
+ t_gui_line *last_read_line; /* last read line before jump */
int num_lines; /* number of lines in the window */
int line_complete; /* current line complete ? (\n ending) */
diff --git a/src/irc/irc-display.c b/src/irc/irc-display.c
index 6c60eaa4f..da1e9aae8 100644
--- a/src/irc/irc-display.c
+++ b/src/irc/irc-display.c
@@ -179,7 +179,7 @@ irc_display_server (t_irc_server *server)
gui_printf (NULL, "\n");
gui_printf (NULL, _("%sServer: %s%s %s[%s%s%s]\n"),
GUI_COLOR(COLOR_WIN_CHAT),
- GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
+ GUI_COLOR(COLOR_WIN_CHAT_SERVER),
server->name,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
@@ -193,8 +193,9 @@ irc_display_server (t_irc_server *server)
_(" (temporary server, will not be saved)") : "");
gui_printf (NULL, " server_autoreconnect . . .: %s\n",
(server->autoreconnect) ? _("on") : _("off"));
- gui_printf (NULL, " server_autoreconnect_delay: %d seconds\n",
- server->autoreconnect_delay);
+ gui_printf (NULL, " server_autoreconnect_delay: %d %s\n",
+ server->autoreconnect_delay,
+ _("seconds"));
gui_printf (NULL, " server_address . . . . . .: %s\n",
server->address);
gui_printf (NULL, " server_port . . . . . . .: %d\n",
@@ -221,8 +222,9 @@ irc_display_server (t_irc_server *server)
gui_printf (NULL, " server_command . . . . . .: %s\n",
(server->command && server->command[0]) ?
server->command : "");
- gui_printf (NULL, " server_command_delay . . .: %d seconds\n",
- server->command_delay);
+ gui_printf (NULL, " server_command_delay . . .: %d %s\n",
+ server->command_delay,
+ _("seconds"));
gui_printf (NULL, " server_autojoin . . . . .: %s\n",
(server->autojoin && server->autojoin[0]) ?
server->autojoin : "");
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index 68e2ff493..55c203194 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -2680,6 +2680,8 @@ irc_cmd_recv_303 (t_irc_server *server, char *host, char *nick, char *arguments)
int
irc_cmd_recv_305 (t_irc_server *server, char *host, char *nick, char *arguments)
{
+ t_gui_window *ptr_window;
+
/* make gcc happy */
(void) host;
(void) nick;
@@ -2699,6 +2701,12 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *nick, char *arguments)
}
server->is_away = 0;
server->away_time = 0;
+ for (ptr_window = gui_windows; ptr_window;
+ ptr_window = ptr_window->next_window)
+ {
+ if (SERVER(ptr_window->buffer) == server)
+ gui_draw_buffer_status (ptr_window->buffer, 1);
+ }
return 0;
}
@@ -2709,6 +2717,8 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *nick, char *arguments)
int
irc_cmd_recv_306 (t_irc_server *server, char *host, char *nick, char *arguments)
{
+ t_gui_window *ptr_window;
+
/* make gcc happy */
(void) host;
(void) nick;
@@ -2728,6 +2738,15 @@ irc_cmd_recv_306 (t_irc_server *server, char *host, char *nick, char *arguments)
}
server->is_away = 1;
server->away_time = time (NULL);
+ for (ptr_window = gui_windows; ptr_window;
+ ptr_window = ptr_window->next_window)
+ {
+ if (SERVER(ptr_window->buffer) == server)
+ gui_draw_buffer_status (ptr_window->buffer, 1);
+ if (SERVER(ptr_window->buffer) == server)
+ ptr_window->buffer->last_read_line =
+ ptr_window->buffer->last_line;
+ }
return 0;
}
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index 5802fcd34..bd03d9126 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -196,6 +196,7 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
char *pos, *ptr_away_msg;
char *ptr_away_default_msg = "away";
t_irc_server *ptr_server;
+ t_gui_window *ptr_window;
time_t elapsed;
char buffer[4096];
char *string;
@@ -251,6 +252,13 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
free (string);
}
server_set_away (ptr_server, ptr_server->nick, 1);
+ for (ptr_window = gui_windows; ptr_window;
+ ptr_window = ptr_window->next_window)
+ {
+ if (SERVER(ptr_window->buffer) == ptr_server)
+ ptr_window->buffer->last_read_line =
+ ptr_window->buffer->last_line;
+ }
}
}
}
@@ -291,6 +299,13 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
irc_send_me_all_channels (server, buffer);
}
server_set_away (server, server->nick, 1);
+ for (ptr_window = gui_windows; ptr_window;
+ ptr_window = ptr_window->next_window)
+ {
+ if (SERVER(ptr_window->buffer) == server)
+ ptr_window->buffer->last_read_line =
+ ptr_window->buffer->last_line;
+ }
}
}
gui_draw_buffer_status (gui_current_window->buffer, 1);
diff --git a/src/plugins/plugins-config.c b/src/plugins/plugins-config.c
index 830719db0..431c51cb7 100644
--- a/src/plugins/plugins-config.c
+++ b/src/plugins/plugins-config.c
@@ -219,12 +219,50 @@ plugin_config_read ()
{
pos[0] = '\0';
pos++;
+
+ /* remove spaces before '=' */
+ pos2 = pos - 2;
+ while ((pos2 > line) && (pos2[0] == ' '))
+ {
+ pos2[0] = '\0';
+ pos2--;
+ }
+
+ /* skip spaces after '=' */
+ while (pos[0] && (pos[0] == ' '))
+ {
+ pos++;
+ }
+
+ /* remove CR/LF */
pos2 = strchr (pos, '\r');
if (pos2 != NULL)
pos2[0] = '\0';
pos2 = strchr (pos, '\n');
if (pos2 != NULL)
pos2[0] = '\0';
+
+ /* remove simple or double quotes
+ and spaces at the end */
+ if (strlen(pos) > 1)
+ {
+ pos2 = pos + strlen (pos) - 1;
+ while ((pos2 > pos) && (pos2[0] == ' '))
+ {
+ pos2[0] = '\0';
+ pos2--;
+ }
+ pos2 = pos + strlen (pos) - 1;
+ if (((pos[0] == '\'') &&
+ (pos2[0] == '\'')) ||
+ ((pos[0] == '"') &&
+ (pos2[0] == '"')))
+ {
+ pos2[0] = '\0';
+ pos++;
+ }
+ }
+
plugin_config_set_internal (ptr_line, pos);
}
}
@@ -279,7 +317,7 @@ plugin_config_write ()
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
ptr_plugin_option = ptr_plugin_option->next_option)
{
- fprintf (file, "%s=%s\n",
+ fprintf (file, "%s = \"%s\"\n",
ptr_plugin_option->option_name,
ptr_plugin_option->value);
}