summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/log.c1
-rw-r--r--src/common/session.c10
-rw-r--r--src/common/session.h4
-rw-r--r--src/common/weeconfig.c31
-rw-r--r--src/common/weeconfig.h11
-rw-r--r--src/gui/gui-action.c8
-rw-r--r--src/gui/gui-common.c63
-rw-r--r--src/gui/gui.h15
-rw-r--r--src/irc/irc-commands.c2
-rw-r--r--src/irc/irc-display.c128
-rw-r--r--src/irc/irc-recv.c4
-rw-r--r--src/irc/irc-send.c18
-rw-r--r--src/irc/irc-server.c4
-rw-r--r--src/irc/irc.h4
14 files changed, 234 insertions, 69 deletions
diff --git a/src/common/log.c b/src/common/log.c
index 6738b0404..292fc1387 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -70,7 +70,6 @@ log_write_line (t_gui_buffer *buffer, char *message)
if (buffer->log_file)
{
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
- log_write_date (buffer);
fprintf (buffer->log_file, "%s\n",
(msg_no_color) ? msg_no_color : message);
fflush (buffer->log_file);
diff --git a/src/common/session.c b/src/common/session.c
index 5985448ca..ad3146204 100644
--- a/src/common/session.c
+++ b/src/common/session.c
@@ -365,7 +365,9 @@ session_save_line (FILE *file, t_gui_line *line)
rc = rc && (session_write_int (file, SESSION_LINE_WITH_MESSAGE, line->line_with_message));
rc = rc && (session_write_int (file, SESSION_LINE_WITH_HIGHLIGHT, line->line_with_highlight));
rc = rc && (session_write_str (file, SESSION_LINE_DATA, line->data));
- rc = rc && (session_write_int (file, SESSION_LINE_OFS_AFTER_DATE, line->ofs_after_date));
+ rc = rc && (session_write_int (file, SESSION_LINE_OFS_AFTER_DATE, line->ofs_start_message));
+ rc = rc && (session_write_int (file, SESSION_LINE_OFS_START_MESSAGE, line->ofs_start_message));
+ rc = rc && (session_write_str (file, SESSION_LINE_NICK, line->nick));
rc = rc && (session_write_id (file, SESSION_LINE_END));
return rc;
}
@@ -1501,6 +1503,12 @@ session_load_line (FILE *file)
case SESSION_LINE_OFS_AFTER_DATE:
rc = rc && (session_read_int (file, &(line->ofs_after_date)));
break;
+ case SESSION_LINE_OFS_START_MESSAGE:
+ rc = rc && (session_read_int (file, &(line->ofs_start_message)));
+ break;
+ case SESSION_LINE_NICK:
+ rc = rc && (session_read_str (file, &(line->nick)));
+ break;
default:
weechat_log_printf (_("session: warning: ignoring value from "
"line (object id: %d)\n"));
diff --git a/src/common/session.h b/src/common/session.h
index 9062bbb7a..7100e0bf0 100644
--- a/src/common/session.h
+++ b/src/common/session.h
@@ -169,7 +169,9 @@ enum t_session_line
SESSION_LINE_WITH_MESSAGE,
SESSION_LINE_WITH_HIGHLIGHT,
SESSION_LINE_DATA,
- SESSION_LINE_OFS_AFTER_DATE
+ SESSION_LINE_OFS_AFTER_DATE,
+ SESSION_LINE_OFS_START_MESSAGE,
+ SESSION_LINE_NICK
};
enum t_session_uptime
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index d346f4a28..29b7085a7 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -87,7 +87,14 @@ int cfg_look_nicklist_max_size;
int cfg_look_nickmode;
int cfg_look_nickmode_empty;
char *cfg_look_no_nickname;
-char *cfg_look_completor;
+char *cfg_look_nick_prefix;
+char *cfg_look_nick_suffix;
+int cfg_look_align_nick;
+char *cfg_look_align_nick_values[] =
+{ "none", "left", "right", NULL };
+int cfg_look_align_other;
+int cfg_look_align_size;
+char *cfg_look_nick_completor;
char *cfg_look_nick_completion_ignore;
int cfg_look_nick_complete_first;
int cfg_look_infobar;
@@ -190,10 +197,30 @@ t_config_option weechat_options_look[] =
N_("display space if nick mode is not (half)op/voice"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
NULL, NULL, &cfg_look_nickmode_empty, NULL, config_change_buffers },
+ { "look_nick_prefix", N_("text to display before nick in chat window"),
+ N_("text to display before nick in chat window"),
+ OPTION_TYPE_STRING, 0, 0, 0,
+ "<", NULL, NULL, &cfg_look_nick_prefix, config_change_noop },
+ { "look_nick_suffix", N_("text to display after nick in chat window"),
+ N_("text to display after nick in chat window"),
+ OPTION_TYPE_STRING, 0, 0, 0,
+ ">", NULL, NULL, &cfg_look_nick_suffix, config_change_noop },
+ { "look_align_nick", N_("nick alignment (fixed size for nicks in chat window)"),
+ N_("nick alignment (fixed size for nicks in chat window (none, left, right))"),
+ OPTION_TYPE_INT_WITH_STRING, 0, 0, 0,
+ "none", cfg_look_align_nick_values, &cfg_look_align_nick, NULL, config_change_noop },
+ { "look_align_other", N_("alignment for other messages (not beginning with a nick)"),
+ N_("alignment for other messages (not beginning with a nick)"),
+ OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
+ NULL, NULL, &cfg_look_align_other, NULL, config_change_noop },
+ { "look_align_size", N_("size for aligning nick and other messages"),
+ N_("size for aligning nick and other messages"),
+ OPTION_TYPE_INT, 8, 64, 8,
+ NULL, NULL, &cfg_look_align_size, NULL, config_change_noop },
{ "look_nick_completor", N_("the string inserted after nick completion"),
N_("the string inserted after nick completion"),
OPTION_TYPE_STRING, 0, 0, 0,
- ":", NULL, NULL, &cfg_look_completor, config_change_noop },
+ ":", NULL, NULL, &cfg_look_nick_completor, config_change_noop },
{ "look_nick_completion_ignore", N_("chars ignored for nick completion"),
N_("chars ignored for nick completion"),
OPTION_TYPE_STRING, 0, 0, 0,
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index e35bf4ed4..03e6377dc 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -54,6 +54,10 @@
#define CFG_LOOK_NICKLIST_TOP 2
#define CFG_LOOK_NICKLIST_BOTTOM 3
+#define CFG_LOOK_ALIGN_NICK_NONE 0
+#define CFG_LOOK_ALIGN_NICK_LEFT 1
+#define CFG_LOOK_ALIGN_NICK_RIGHT 2
+
#define CFG_IRC_DISPLAY_AWAY_OFF 0
#define CFG_IRC_DISPLAY_AWAY_LOCAL 1
#define CFG_IRC_DISPLAY_AWAY_CHANNEL 2
@@ -104,7 +108,12 @@ extern int cfg_look_nicklist_max_size;
extern int cfg_look_nickmode;
extern int cfg_look_nickmode_empty;
extern char *cfg_look_no_nickname;
-extern char *cfg_look_completor;
+extern char *cfg_look_nick_prefix;
+extern char *cfg_look_nick_suffix;
+extern int cfg_look_align_nick;
+extern int cfg_look_align_other;
+extern int cfg_look_align_size;
+extern char *cfg_look_nick_completor;
extern char *cfg_look_nick_completion_ignore;
extern int cfg_look_nick_complete_first;
extern int cfg_look_infobar;
diff --git a/src/gui/gui-action.c b/src/gui/gui-action.c
index 8d00f1ba1..3cedac744 100644
--- a/src/gui/gui-action.c
+++ b/src/gui/gui-action.c
@@ -216,12 +216,12 @@ gui_action_tab (t_gui_window *window)
{
if (strncmp (utf8_add_offset (window->buffer->input_buffer,
window->buffer->input_buffer_pos),
- cfg_look_completor, strlen (cfg_look_completor)) != 0)
- gui_insert_string_input (window, cfg_look_completor,
+ cfg_look_nick_completor, strlen (cfg_look_nick_completor)) != 0)
+ gui_insert_string_input (window, cfg_look_nick_completor,
window->buffer->input_buffer_pos);
if (window->buffer->completion.position >= 0)
- window->buffer->completion.position += strlen (cfg_look_completor);
- window->buffer->input_buffer_pos += utf8_strlen (cfg_look_completor);
+ window->buffer->completion.position += strlen (cfg_look_nick_completor);
+ window->buffer->input_buffer_pos += utf8_strlen (cfg_look_nick_completor);
if (window->buffer->input_buffer[utf8_real_pos (window->buffer->input_buffer,
window->buffer->input_buffer_pos)] != ' ')
gui_insert_string_input (window, " ",
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index 0ffe77ce8..4efb40587 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -645,6 +645,8 @@ gui_line_free (t_gui_line *line)
gui_draw_buffer_status (ptr_win->buffer, 0);
}
}
+ if (line->nick)
+ free (line->nick);
if (line->data)
free (line->data);
free (line);
@@ -762,8 +764,10 @@ gui_line_new (t_gui_buffer *buffer)
new_line->log_write = 1;
new_line->line_with_message = 0;
new_line->line_with_highlight = 0;
+ new_line->nick = NULL;
new_line->data = NULL;
new_line->ofs_after_date = -1;
+ new_line->ofs_start_message = -1;
if (!buffer->lines)
buffer->lines = new_line;
else
@@ -846,7 +850,7 @@ gui_word_real_pos (t_gui_window *window, char *string, int pos)
*/
void
-gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
+gui_add_to_line (t_gui_buffer *buffer, int type, char *nick, char *message)
{
char *pos;
int length;
@@ -865,19 +869,31 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
pos[0] = '\0';
buffer->line_complete = 1;
}
+
+ if (nick && (!buffer->last_line->nick))
+ buffer->last_line->nick = strdup (nick);
+
if (buffer->last_line->data)
{
+ length = strlen (buffer->last_line->data);
buffer->last_line->data = (char *) realloc (buffer->last_line->data,
- strlen (buffer->last_line->data) +
- strlen (message) + 1);
- if (((type & MSG_TYPE_TIME) == 0) && (buffer->last_line->ofs_after_date < 0))
- buffer->last_line->ofs_after_date = strlen (buffer->last_line->data);
+ length + strlen (message) + 1);
+ if (((type & MSG_TYPE_TIME) == 0)
+ && (buffer->last_line->ofs_after_date < 0))
+ buffer->last_line->ofs_after_date = length;
+ if (((type & (MSG_TYPE_TIME | MSG_TYPE_NICK)) == 0)
+ && (buffer->last_line->ofs_start_message < 0))
+ buffer->last_line->ofs_start_message = length;
strcat (buffer->last_line->data, message);
}
else
{
- if (((type & MSG_TYPE_TIME) == 0) && (buffer->last_line->ofs_after_date < 0))
+ if (((type & MSG_TYPE_TIME) == 0)
+ && (buffer->last_line->ofs_after_date < 0))
buffer->last_line->ofs_after_date = 0;
+ if (((type & (MSG_TYPE_TIME | MSG_TYPE_NICK)) == 0)
+ && (buffer->last_line->ofs_start_message < 0))
+ buffer->last_line->ofs_start_message = 0;
buffer->last_line->data = strdup (message);
}
@@ -919,9 +935,16 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
}
if (buffer->line_complete && buffer->log_file && buffer->last_line->log_write)
{
- if (buffer->last_line->ofs_after_date >= 0)
+ log_write_date (buffer);
+ if (buffer->last_line->nick)
+ {
+ log_write (buffer, "<");
+ log_write (buffer, buffer->last_line->nick);
+ log_write (buffer, "> ");
+ }
+ if (buffer->last_line->ofs_start_message >= 0)
log_write_line (buffer,
- buffer->last_line->data + buffer->last_line->ofs_after_date);
+ buffer->last_line->data + buffer->last_line->ofs_start_message);
else
log_write_line (buffer, buffer->last_line->data);
}
@@ -934,7 +957,7 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
*/
void
-gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *message, ...)
+gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nick, char *message, ...)
{
static char buf[8192];
char text_time[1024];
@@ -1026,41 +1049,41 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes
text_time_char[0] = text_time[i];
if (time_first_digit < 0)
{
- gui_add_to_line (buffer, MSG_TYPE_TIME,
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL,
GUI_COLOR(COLOR_WIN_CHAT_TIME));
- gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL, text_time_char);
}
else
{
if ((i < time_first_digit) || (i > time_last_digit))
{
- gui_add_to_line (buffer, MSG_TYPE_TIME,
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
- gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL, text_time_char);
}
else
{
if (isdigit (text_time[i]))
{
- gui_add_to_line (buffer, MSG_TYPE_TIME,
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL,
GUI_COLOR(COLOR_WIN_CHAT_TIME));
- gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL, text_time_char);
}
else
{
- gui_add_to_line (buffer, MSG_TYPE_TIME,
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL,
GUI_COLOR(COLOR_WIN_CHAT_TIME_SEP));
- gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL, text_time_char);
}
}
}
i++;
}
- gui_add_to_line (buffer, MSG_TYPE_TIME, GUI_COLOR(COLOR_WIN_CHAT));
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL, GUI_COLOR(COLOR_WIN_CHAT));
}
- gui_add_to_line (buffer, MSG_TYPE_TIME, " ");
+ gui_add_to_line (buffer, MSG_TYPE_TIME, NULL, " ");
}
- gui_add_to_line (buffer, type, pos);
+ gui_add_to_line (buffer, type, nick, pos);
pos = strchr (pos, '\n');
if (pos)
{
diff --git a/src/gui/gui.h b/src/gui/gui.h
index a479b2e5b..e943a100b 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -145,16 +145,19 @@ enum t_weechat_color
#define MSG_TYPE_NOLOG 64
#define gui_printf(buffer, fmt, argz...) \
- gui_printf_internal(buffer, 1, MSG_TYPE_INFO, fmt, ##argz)
+ gui_printf_internal(buffer, 1, MSG_TYPE_INFO, NULL, fmt, ##argz)
#define gui_printf_type(buffer, type, fmt, argz...) \
- gui_printf_internal(buffer, 1, type, fmt, ##argz)
+ gui_printf_internal(buffer, 1, type, NULL, fmt, ##argz)
+
+#define gui_printf_type_nick(buffer, type, nick, fmt, argz...) \
+ gui_printf_internal(buffer, 1, type, nick, fmt, ##argz)
#define gui_printf_nolog(buffer, fmt, argz...) \
- gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, fmt, ##argz)
+ gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, NULL, fmt, ##argz)
#define gui_printf_nolog_notime(buffer, fmt, argz...) \
- gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, fmt, ##argz)
+ gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, NULL, fmt, ##argz)
#define WINDOW_MIN_WIDTH 10
#define WINDOW_MIN_HEIGHT 5
@@ -201,8 +204,10 @@ struct t_gui_line
int log_write; /* = 1 if line will be written to log */
int line_with_message; /* line contains a message from a user? */
int line_with_highlight; /* line contains highlight */
+ char *nick; /* nickname for line (may be NULL) */
char *data; /* line content */
int ofs_after_date; /* offset to first char after date */
+ int ofs_start_message; /* offset to first char after date/nick */
t_gui_line *prev_line; /* link to previous line */
t_gui_line *next_line; /* link to next line */
};
@@ -417,7 +422,7 @@ extern void gui_buffer_free (t_gui_buffer *, int);
extern t_gui_line *gui_line_new (t_gui_buffer *);
extern int gui_word_strlen (t_gui_window *, char *);
extern int gui_word_real_pos (t_gui_window *, char *, int);
-extern void gui_printf_internal (t_gui_buffer *, int, int, char *, ...);
+extern void gui_printf_internal (t_gui_buffer *, int, int, char *, char *, ...);
extern void gui_printf_raw_data (void *, int, char *);
extern void gui_input_optimize_size (t_gui_buffer *);
extern void gui_input_init_color_mask (t_gui_buffer *);
diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c
index b17581bf1..2ec2bb313 100644
--- a/src/irc/irc-commands.c
+++ b/src/irc/irc-commands.c
@@ -128,7 +128,7 @@ t_irc_command irc_commands[] =
NULL, 0, 2, 1, NULL, irc_cmd_send_links, NULL },
{ "list", N_("list channels and their topic"),
N_("[channel[,channel] [server]]"),
- N_("channel: channel to list\nserver: server name"),
+ N_("channel: channel to list (a regexp is allowed)\nserver: server name"),
NULL, 0, MAX_ARGS, 1, NULL, irc_cmd_send_list, NULL },
{ "lusers", N_("get statistics about the size of the IRC network"),
N_("[mask [target]]"),
diff --git a/src/irc/irc-display.c b/src/irc/irc-display.c
index 5c0f35399..fd24754a8 100644
--- a/src/irc/irc-display.c
+++ b/src/irc/irc-display.c
@@ -92,12 +92,23 @@ void
irc_display_prefix (t_irc_server *server, t_gui_buffer *buffer, char *prefix)
{
int type;
+ char format[32];
type = MSG_TYPE_INFO | MSG_TYPE_PREFIX;
if (!cfg_log_plugin_msg && (prefix == PREFIX_PLUGIN))
type |= MSG_TYPE_NOLOG;
+ if (buffer)
+ {
+ if (cfg_look_align_other
+ && (BUFFER_IS_CHANNEL(buffer) || BUFFER_IS_PRIVATE(buffer)))
+ {
+ snprintf (format, 32, "%%-%ds", cfg_look_align_size - 2);
+ gui_printf_type (buffer, MSG_TYPE_NICK, format, " ");
+ }
+ }
+
if (prefix[0] == prefix[2])
{
gui_printf_type (buffer, type, "%s%c%s%c%s%c ",
@@ -139,10 +150,57 @@ void
irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
int type, int display_around, int color_nick, int no_nickmode)
{
- if (display_around)
+ char format[32], *ptr_nickname;
+ int i, nickname_length, external_nick, length, spaces, disable_prefix_suffix;
+
+ ptr_nickname = strdup ((nick) ? nick->nick : nickname);
+ if (!ptr_nickname)
+ return;
+ nickname_length = strlen (ptr_nickname);
+ external_nick = (!nick && !BUFFER_IS_PRIVATE(buffer));
+ disable_prefix_suffix = ((cfg_look_align_nick != CFG_LOOK_ALIGN_NICK_NONE)
+ && ((int)strlen (cfg_look_nick_prefix) +
+ (int)strlen (cfg_look_nick_suffix) > cfg_look_align_size - 4));
+
+ /* calculate length to display, to truncate it if too long */
+ length = nickname_length;
+ if (!disable_prefix_suffix && cfg_look_nick_prefix)
+ length += strlen (cfg_look_nick_prefix);
+ if (external_nick)
+ length += 2;
+ if (nick)
+ {
+ if (nick->flags & (NICK_CHANOWNER | NICK_CHANADMIN |
+ NICK_OP | NICK_HALFOP | NICK_VOICE))
+ length += 1;
+ else if (cfg_look_nickmode_empty && !no_nickmode)
+ length += 1;
+ }
+ if (!disable_prefix_suffix && cfg_look_nick_suffix)
+ length += strlen (cfg_look_nick_suffix);
+
+ /* calculate number of spaces to insert before or after nick */
+ spaces = 0;
+ if (cfg_look_align_nick != CFG_LOOK_ALIGN_NICK_NONE)
+ spaces = cfg_look_align_size - length;
+
+ /* display prefix */
+ if (display_around && !disable_prefix_suffix
+ && cfg_look_nick_prefix && cfg_look_nick_prefix[0])
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
- (nick || BUFFER_IS_PRIVATE(buffer)) ? "<" : ">");
+ cfg_look_nick_prefix);
+
+ /* display spaces before nick, if needed */
+ if (display_around
+ && (cfg_look_align_nick == CFG_LOOK_ALIGN_NICK_RIGHT)
+ && (spaces > 0))
+ {
+ snprintf (format, 32, "%%-%ds", spaces);
+ gui_printf_type (buffer, type, format, " ");
+ }
+
+ /* display nick mode */
if (nick && cfg_look_nickmode)
{
if (nick->flags & NICK_CHANOWNER)
@@ -160,26 +218,64 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
else if (nick->flags & NICK_VOICE)
gui_printf_type (buffer, type, "%s+",
GUI_COLOR(COLOR_WIN_NICK_VOICE));
- else
- if (cfg_look_nickmode_empty && !no_nickmode)
- gui_printf_type (buffer, type, "%s ",
- GUI_COLOR(COLOR_WIN_CHAT));
+ else if (cfg_look_nickmode_empty && !no_nickmode)
+ gui_printf_type (buffer, type, "%s ",
+ GUI_COLOR(COLOR_WIN_CHAT));
}
- if (color_nick < 0)
+
+ /* display nick */
+ if (external_nick)
gui_printf_type (buffer, type, "%s%s",
- GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
- (nick) ? nick->nick : nickname);
- else
+ GUI_COLOR(COLOR_WIN_CHAT_DARK),
+ "(");
+ if (display_around && (spaces < 0))
+ {
+ i = nickname_length + spaces - 1;
+ if (i < 3)
+ {
+ if (nickname_length < 3)
+ i = nickname_length;
+ else
+ i = 3;
+ }
+ ptr_nickname[i] = '\0';
+ }
+ gui_printf_type_nick (buffer, type,
+ (nick) ? nick->nick : nickname,
+ "%s%s",
+ (color_nick < 0) ?
+ GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT) :
+ GUI_COLOR((nick && color_nick) ?
+ nick->color : COLOR_WIN_CHAT),
+ ptr_nickname);
+ if (display_around && (spaces < 0))
+ gui_printf_type (buffer, type, "%s+",
+ GUI_COLOR(COLOR_WIN_NICK_MORE));
+ if (external_nick)
gui_printf_type (buffer, type, "%s%s",
- GUI_COLOR((nick && color_nick) ?
- nick->color : COLOR_WIN_CHAT),
- (nick) ? nick->nick : nickname);
+ GUI_COLOR(COLOR_WIN_CHAT_DARK),
+ ")");
- if (display_around)
+ /* display spaces after nick, if needed */
+ if (display_around
+ && (cfg_look_align_nick == CFG_LOOK_ALIGN_NICK_LEFT)
+ && (spaces > 0))
+ {
+ snprintf (format, 32, "%%-%ds", spaces);
+ gui_printf_type (buffer, type, format, " ");
+ }
+
+ /* display suffix */
+ if (display_around && !disable_prefix_suffix
+ && cfg_look_nick_suffix && cfg_look_nick_suffix[0])
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
- (nick || BUFFER_IS_PRIVATE(buffer)) ? "> " : "< ");
- gui_printf_type (buffer, type, GUI_NO_COLOR);
+ cfg_look_nick_suffix);
+
+ gui_printf_type (buffer, type, "%s%s",
+ GUI_NO_COLOR,
+ (display_around) ? " " : "");
+ free (ptr_nickname);
}
/*
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index a9bc88be4..3bb396fb8 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -3662,9 +3662,9 @@ irc_cmd_recv_322 (t_irc_server *server, char *host, char *nick, char *arguments)
else
pos = arguments;
- if (server->cmd_list_re)
+ if (server->cmd_list_regexp)
{
- if (regexec (server->cmd_list_re, pos, 0, NULL, 0) == 0) {
+ if (regexec (server->cmd_list_regexp, pos, 0, NULL, 0) == 0) {
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
gui_printf (server->buffer, "%s\n", pos);
}
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index f43fe18fb..c942e3d38 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -1121,21 +1121,21 @@ irc_cmd_send_list (t_irc_server *server, t_irc_channel *channel,
char buffer[512];
int ret;
- if (server->cmd_list_re)
+ if (server->cmd_list_regexp)
{
- regfree (server->cmd_list_re);
- free (server->cmd_list_re);
- server->cmd_list_re = NULL;
+ regfree (server->cmd_list_regexp);
+ free (server->cmd_list_regexp);
+ server->cmd_list_regexp = NULL;
}
if (arguments)
{
- server->cmd_list_re = (regex_t *) malloc (sizeof (regex_t));
- if (server->cmd_list_re)
+ server->cmd_list_regexp = (regex_t *) malloc (sizeof (regex_t));
+ if (server->cmd_list_regexp)
{
- if ((ret = regcomp (server->cmd_list_re, arguments, REG_NOSUB | REG_ICASE)) != 0)
+ if ((ret = regcomp (server->cmd_list_regexp, arguments, REG_NOSUB | REG_ICASE)) != 0)
{
- regerror (ret, server->cmd_list_re, buffer, sizeof(buffer));
+ regerror (ret, server->cmd_list_regexp, buffer, sizeof(buffer));
gui_printf (server->buffer,
_("%s \"%s\" is not a valid regular expression (%s)\n"),
WEECHAT_ERROR, arguments, buffer);
@@ -1146,7 +1146,7 @@ irc_cmd_send_list (t_irc_server *server, t_irc_channel *channel,
else
{
gui_printf (server->buffer,
- _("%s unable to alloc memory for regular expression\n"),
+ _("%s not enough memory for regular expression\n"),
WEECHAT_ERROR);
}
}
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index c5be5ef9b..9a28a39c2 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -106,13 +106,11 @@ server_init (t_irc_server *server)
server->lag_check_time.tv_sec = 0;
server->lag_check_time.tv_usec = 0;
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
+ server->cmd_list_regexp = NULL;
server->buffer = NULL;
server->saved_buffer = NULL;
server->channels = NULL;
server->last_channel = NULL;
-
- /* regexp vars */
- server->cmd_list_re = NULL;
}
/*
diff --git a/src/irc/irc.h b/src/irc/irc.h
index 715972758..b56227a40 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -172,15 +172,13 @@ struct t_irc_server
int lag; /* lag (in milliseconds) */
struct timeval lag_check_time; /* last time lag was checked (ping sent) */
time_t lag_next_check; /* time for next check */
+ regex_t *cmd_list_regexp; /* compiled Regular Expression for /list */
t_gui_buffer *buffer; /* GUI buffer allocated for server */
t_gui_buffer *saved_buffer; /* channel before jumping to next server */
t_irc_channel *channels; /* opened channels on server */
t_irc_channel *last_channel; /* last opened channal on server */
t_irc_server *prev_server; /* link to previous server */
t_irc_server *next_server; /* link to next server */
-
- /* regexp vars */
- regex_t *cmd_list_re; /* compiled Regular Expression for /list */
};
/* irc commands */