mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 08:43:13 +02:00
Added nick alignment options
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-04-01
|
||||
ChangeLog - 2006-04-02
|
||||
|
||||
|
||||
Version 0.1.9 (under dev!):
|
||||
* added nick alignment options
|
||||
* fixed /names command: now displays result when not on a channel
|
||||
* fixed refresh bug (too many refresh) when terminal is resized
|
||||
* fixed nicklist display bugs when on top or bottom of chat window
|
||||
|
||||
@@ -152,6 +152,41 @@
|
||||
<entry>'off'</entry>
|
||||
<entry>Display space if nick mode is not (half)op/voice</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_prefix</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>'<'</entry>
|
||||
<entry>Text to display before nick in chat window</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_suffix</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>'>'</entry>
|
||||
<entry>Text to display after nick in chat window</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_nick</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>'none', 'left', 'right'</entry>
|
||||
<entry>'none'</entry>
|
||||
<entry>Nick alignment (fixed size for nicks in chat window (none, left, right))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_other</option></entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>'on' or 'off'</entry>
|
||||
<entry>'off'</entry>
|
||||
<entry>Alignment for other messages (not beginning with a nick)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_size</option></entry>
|
||||
<entry>integer</entry>
|
||||
<entry>between 8 and 64</entry>
|
||||
<entry>8</entry>
|
||||
<entry>Size for aligning nick and other messages</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_completor</option></entry>
|
||||
<entry>string</entry>
|
||||
|
||||
@@ -161,7 +161,7 @@ server_mask: list of servers must match this mask
|
||||
<programlisting>
|
||||
list channels and their topic
|
||||
|
||||
channel: channel to list
|
||||
channel: channel to list (a regexp is allowed)
|
||||
server: server name
|
||||
|
||||
</programlisting>
|
||||
|
||||
+10
-7
@@ -2264,20 +2264,23 @@ plugin->timer_handler_add (plugin, 60, &my_timer);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Le paramètre argc vaut 2 et les arguments suivants sont
|
||||
passés dans le tableau argv :
|
||||
Argument argc is set to 3, following values are set in
|
||||
argc array:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[0] = touche appuyée (nom d'une fonction interne
|
||||
ou bien '*' suivi du code d'une touche si la touche
|
||||
n'est pas associée à une fonction)
|
||||
argv[0] = key pressed (name of internal function or
|
||||
'*' followed by a key code)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[1] = "1" si la ligne de commande a changé suite
|
||||
à l'action de cette touche, "0" sinon
|
||||
argv[1] = command line before key action
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[2] = command line after key action
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
@@ -152,6 +152,41 @@
|
||||
<entry>'off'</entry>
|
||||
<entry>Afficher un espace si le mode utilisateur n'est pas (half)op/voice</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_prefix</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>'<'</entry>
|
||||
<entry>Texte à afficher avant le pseudo dans la fenêtre de discussion</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_suffix</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>'>'</entry>
|
||||
<entry>Texte à afficher après le pseudo dans la fenêtre de discussion</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_nick</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>'none', 'left', 'right'</entry>
|
||||
<entry>'none'</entry>
|
||||
<entry>Alignement des pseudos (taille fixe pour les pseudos dans la fenêtre de discussion (none, left, right))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_other</option></entry>
|
||||
<entry>booléen</entry>
|
||||
<entry>'on' ou 'off'</entry>
|
||||
<entry>'off'</entry>
|
||||
<entry>Alignement pour les autres messages (ne commençant pas par un pseudo)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_size</option></entry>
|
||||
<entry>entier</entry>
|
||||
<entry>entre 8 et 64</entry>
|
||||
<entry>8</entry>
|
||||
<entry>Taille pour l'alignement des pseudos et autres messages</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_completor</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
|
||||
@@ -161,7 +161,7 @@ masque_serveur: liste des serveurs correspondant au masque
|
||||
<programlisting>
|
||||
lister les canaux et leur sujet
|
||||
|
||||
canal: canal à lister
|
||||
canal: canal à lister (une expression régulière est acceptée)
|
||||
serveur: nom du serveur
|
||||
|
||||
</programlisting>
|
||||
|
||||
+10
-5
@@ -2310,20 +2310,25 @@ plugin->timer_handler_add (plugin, 60, &mon_timer);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Le paramètre argc vaut 2 et les arguments suivants sont
|
||||
Le paramètre argc vaut 3 et les arguments suivants sont
|
||||
passés dans le tableau argv :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[0] = touche appuyée (nom d'une fonction interne
|
||||
ou bien '*' suivi du code d'une touche si la touche
|
||||
n'est pas associée à une fonction)
|
||||
ou bien '*' suivi du code d'une touche)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[1] = "1" si la ligne de commande a changé suite
|
||||
à l'action de cette touche, "0" sinon
|
||||
argv[1] = la ligne de commande avant l'action de la
|
||||
touche
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[2] = la ligne de commande après l'action de la
|
||||
touche
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
+586
-551
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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
|
||||
|
||||
+29
-2
@@ -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,
|
||||
|
||||
+10
-1
@@ -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;
|
||||
|
||||
@@ -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, " ",
|
||||
|
||||
+43
-20
@@ -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)
|
||||
{
|
||||
|
||||
+10
-5
@@ -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 *);
|
||||
|
||||
@@ -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]]"),
|
||||
|
||||
+114
-18
@@ -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)
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
|
||||
(nick) ? nick->nick : nickname);
|
||||
else
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR((nick && color_nick) ?
|
||||
nick->color : COLOR_WIN_CHAT),
|
||||
(nick) ? nick->nick : nickname);
|
||||
|
||||
if (display_around)
|
||||
/* display nick */
|
||||
if (external_nick)
|
||||
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);
|
||||
"(");
|
||||
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(COLOR_WIN_CHAT_DARK),
|
||||
")");
|
||||
|
||||
/* 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),
|
||||
cfg_look_nick_suffix);
|
||||
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_NO_COLOR,
|
||||
(display_around) ? " " : "");
|
||||
free (ptr_nickname);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
+9
-9
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-3
@@ -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 */
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-04-01
|
||||
ChangeLog - 2006-04-02
|
||||
|
||||
|
||||
Version 0.1.9 (under dev!):
|
||||
* added nick alignment options
|
||||
* fixed /names command: now displays result when not on a channel
|
||||
* fixed refresh bug (too many refresh) when terminal is resized
|
||||
* fixed nicklist display bugs when on top or bottom of chat window
|
||||
|
||||
@@ -152,6 +152,41 @@
|
||||
<entry>'off'</entry>
|
||||
<entry>Display space if nick mode is not (half)op/voice</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_prefix</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>'<'</entry>
|
||||
<entry>Text to display before nick in chat window</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_suffix</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>'>'</entry>
|
||||
<entry>Text to display after nick in chat window</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_nick</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>'none', 'left', 'right'</entry>
|
||||
<entry>'none'</entry>
|
||||
<entry>Nick alignment (fixed size for nicks in chat window (none, left, right))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_other</option></entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>'on' or 'off'</entry>
|
||||
<entry>'off'</entry>
|
||||
<entry>Alignment for other messages (not beginning with a nick)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_size</option></entry>
|
||||
<entry>integer</entry>
|
||||
<entry>between 8 and 64</entry>
|
||||
<entry>8</entry>
|
||||
<entry>Size for aligning nick and other messages</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_completor</option></entry>
|
||||
<entry>string</entry>
|
||||
|
||||
@@ -161,7 +161,7 @@ server_mask: list of servers must match this mask
|
||||
<programlisting>
|
||||
list channels and their topic
|
||||
|
||||
channel: channel to list
|
||||
channel: channel to list (a regexp is allowed)
|
||||
server: server name
|
||||
|
||||
</programlisting>
|
||||
|
||||
@@ -2264,20 +2264,23 @@ plugin->timer_handler_add (plugin, 60, &my_timer);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Le paramètre argc vaut 2 et les arguments suivants sont
|
||||
passés dans le tableau argv :
|
||||
Argument argc is set to 3, following values are set in
|
||||
argc array:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[0] = touche appuyée (nom d'une fonction interne
|
||||
ou bien '*' suivi du code d'une touche si la touche
|
||||
n'est pas associée à une fonction)
|
||||
argv[0] = key pressed (name of internal function or
|
||||
'*' followed by a key code)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[1] = "1" si la ligne de commande a changé suite
|
||||
à l'action de cette touche, "0" sinon
|
||||
argv[1] = command line before key action
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[2] = command line after key action
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
@@ -152,6 +152,41 @@
|
||||
<entry>'off'</entry>
|
||||
<entry>Afficher un espace si le mode utilisateur n'est pas (half)op/voice</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_prefix</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>'<'</entry>
|
||||
<entry>Texte à afficher avant le pseudo dans la fenêtre de discussion</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_suffix</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>'>'</entry>
|
||||
<entry>Texte à afficher après le pseudo dans la fenêtre de discussion</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_nick</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>'none', 'left', 'right'</entry>
|
||||
<entry>'none'</entry>
|
||||
<entry>Alignement des pseudos (taille fixe pour les pseudos dans la fenêtre de discussion (none, left, right))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_other</option></entry>
|
||||
<entry>booléen</entry>
|
||||
<entry>'on' ou 'off'</entry>
|
||||
<entry>'off'</entry>
|
||||
<entry>Alignement pour les autres messages (ne commençant pas par un pseudo)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_align_size</option></entry>
|
||||
<entry>entier</entry>
|
||||
<entry>entre 8 et 64</entry>
|
||||
<entry>8</entry>
|
||||
<entry>Taille pour l'alignement des pseudos et autres messages</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nick_completor</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
|
||||
@@ -161,7 +161,7 @@ masque_serveur: liste des serveurs correspondant au masque
|
||||
<programlisting>
|
||||
lister les canaux et leur sujet
|
||||
|
||||
canal: canal à lister
|
||||
canal: canal à lister (une expression régulière est acceptée)
|
||||
serveur: nom du serveur
|
||||
|
||||
</programlisting>
|
||||
|
||||
@@ -2310,20 +2310,25 @@ plugin->timer_handler_add (plugin, 60, &mon_timer);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Le paramètre argc vaut 2 et les arguments suivants sont
|
||||
Le paramètre argc vaut 3 et les arguments suivants sont
|
||||
passés dans le tableau argv :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[0] = touche appuyée (nom d'une fonction interne
|
||||
ou bien '*' suivi du code d'une touche si la touche
|
||||
n'est pas associée à une fonction)
|
||||
ou bien '*' suivi du code d'une touche)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[1] = "1" si la ligne de commande a changé suite
|
||||
à l'action de cette touche, "0" sinon
|
||||
argv[1] = la ligne de commande avant l'action de la
|
||||
touche
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
argv[2] = la ligne de commande après l'action de la
|
||||
touche
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
+592
-551
File diff suppressed because it is too large
Load Diff
+594
-551
File diff suppressed because it is too large
Load Diff
+592
-553
File diff suppressed because it is too large
Load Diff
+592
-551
File diff suppressed because it is too large
Load Diff
+586
-551
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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, " ",
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
+10
-5
@@ -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 *);
|
||||
|
||||
@@ -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]]"),
|
||||
|
||||
+114
-18
@@ -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)
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
|
||||
(nick) ? nick->nick : nickname);
|
||||
else
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR((nick && color_nick) ?
|
||||
nick->color : COLOR_WIN_CHAT),
|
||||
(nick) ? nick->nick : nickname);
|
||||
|
||||
if (display_around)
|
||||
/* display nick */
|
||||
if (external_nick)
|
||||
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);
|
||||
"(");
|
||||
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(COLOR_WIN_CHAT_DARK),
|
||||
")");
|
||||
|
||||
/* 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),
|
||||
cfg_look_nick_suffix);
|
||||
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_NO_COLOR,
|
||||
(display_around) ? " " : "");
|
||||
free (ptr_nickname);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user