summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-06-01 22:09:12 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-06-01 22:09:12 +0200
commitbd436db2bc061efc9821e7a5e1443ff32bd0b0d0 (patch)
tree8a152a36cc735c57434df043ec8d587d7c00f8ce /src/plugins
parent4fa856c77316eadd36c65a197f68422d4a8dae68 (diff)
downloadweechat-bd436db2bc061efc9821e7a5e1443ff32bd0b0d0.zip
Reintroduce highlight (move code from irc plugin to core)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-channel.c9
-rw-r--r--src/plugins/irc/irc-config.c15
-rw-r--r--src/plugins/irc/irc-config.h2
-rw-r--r--src/plugins/irc/irc-debug.c2
-rw-r--r--src/plugins/irc/irc-protocol.c755
-rw-r--r--src/plugins/irc/irc-protocol.h3
-rw-r--r--src/plugins/irc/irc-server.c14
-rw-r--r--src/plugins/plugin-api.c15
-rw-r--r--src/plugins/plugin.c1
-rw-r--r--src/plugins/weechat-plugin.h3
10 files changed, 167 insertions, 652 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index ecca71e8d..e70d329cc 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -81,6 +81,15 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
"nicklist_group", 1);
}
+ /* set highlights settings on channel buffer */
+ weechat_buffer_set (new_buffer, "highlight_words", server->nick);
+ if (weechat_config_string (irc_config_look_highlight_tags)
+ && weechat_config_string (irc_config_look_highlight_tags)[0])
+ {
+ weechat_buffer_set (new_buffer, "highlight_tags",
+ weechat_config_string (irc_config_look_highlight_tags));
+ }
+
/* initialize new channel */
new_channel->type = channel_type;
new_channel->name = strdup (channel_name);
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 104d648a3..bd30bec2f 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -54,9 +54,9 @@ struct t_config_option *irc_config_look_nick_prefix;
struct t_config_option *irc_config_look_nick_suffix;
struct t_config_option *irc_config_look_nick_completion_smart;
struct t_config_option *irc_config_look_display_away;
+struct t_config_option *irc_config_look_highlight_tags;
struct t_config_option *irc_config_look_show_away_once;
struct t_config_option *irc_config_look_notice_as_pv;
-struct t_config_option *irc_config_look_highlight;
/* IRC config, network section */
@@ -905,6 +905,13 @@ irc_config_init ()
"display_away", "integer",
N_("display message when (un)marking as away"),
"off|local|channel", 0, 0, "local", NULL, NULL, NULL, NULL, NULL, NULL);
+ irc_config_look_highlight_tags = weechat_config_new_option (
+ irc_config_file, ptr_section,
+ "highlight_tags", "string",
+ N_("comma separated list of tags for messages that may produce "
+ "highlight (usually any message from another user, not server "
+ "messages,..)"),
+ NULL, 0, 0, "irc_privmsg,irc_notice", NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_show_away_once = weechat_config_new_option (
irc_config_file, ptr_section,
"show_away_once", "boolean",
@@ -915,12 +922,6 @@ irc_config_init ()
"notice_as_pv", "boolean",
N_("display notices as private messages"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
- irc_config_look_highlight = weechat_config_new_option (
- irc_config_file, ptr_section,
- "highlight", "string",
- N_("comma separated list of words to highlight (case insensitive "
- "comparison, words may begin or end with \"*\" for partial match)"),
- NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (irc_config_file, "network",
0, 0,
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 2610749af..615a3b0b6 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -66,9 +66,9 @@ extern struct t_config_option *irc_config_look_nick_prefix;
extern struct t_config_option *irc_config_look_nick_suffix;
extern struct t_config_option *irc_config_look_nick_completion_smart;
extern struct t_config_option *irc_config_look_display_away;
+extern struct t_config_option *irc_config_look_highlight_tags;
extern struct t_config_option *irc_config_look_show_away_once;
extern struct t_config_option *irc_config_look_notice_as_pv;
-extern struct t_config_option *irc_config_look_highlight;
extern struct t_config_option *irc_config_network_default_msg_part;
extern struct t_config_option *irc_config_network_default_msg_quit;
diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c
index 91fdf4ee4..eb3c123a3 100644
--- a/src/plugins/irc/irc-debug.c
+++ b/src/plugins/irc/irc-debug.c
@@ -73,6 +73,8 @@ irc_debug_printf (struct t_irc_server *server, int send, int modified,
weechat_buffer_set (irc_debug_buffer,
"title", _("IRC debug messages"));
+ /* disabled all highlights on this debug buffer */
+ weechat_buffer_set (irc_debug_buffer, "highlight_words", "-");
}
buf = weechat_iconv_to_internal (NULL, message);
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 41632e099..fad80f891 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -24,17 +24,10 @@
#define __USE_XOPEN
#endif
-#if defined(__OpenBSD__)
-#include <utf8/wchar.h>
-#else
-#include <wchar.h>
-#endif
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#include <wctype.h>
#include <sys/time.h>
#include <time.h>
@@ -174,208 +167,12 @@ irc_protocol_replace_vars (struct t_irc_server *server,
}
/*
- * irc_protocol_get_wide_char: get wide char from string (first char)
- */
-
-wint_t
-irc_protocol_get_wide_char (char *string)
-{
- int char_size;
- wint_t result;
-
- if (!string || !string[0])
- return WEOF;
-
- char_size = weechat_utf8_char_size (string);
- switch (char_size)
- {
- case 1:
- result = (wint_t)string[0];
- break;
- case 2:
- result = ((wint_t)((unsigned char)string[0])) << 8
- | ((wint_t)((unsigned char)string[1]));
- break;
- case 3:
- result = ((wint_t)((unsigned char)string[0])) << 16
- | ((wint_t)((unsigned char)string[1])) << 8
- | ((wint_t)((unsigned char)string[2]));
- break;
- case 4:
- result = ((wint_t)((unsigned char)string[0])) << 24
- | ((wint_t)((unsigned char)string[1])) << 16
- | ((wint_t)((unsigned char)string[2])) << 8
- | ((wint_t)((unsigned char)string[3]));
- break;
- default:
- result = WEOF;
- }
- return result;
-}
-
-/*
- * irc_protocol_is_word_char: return 1 if given character is a "word character"
- */
-
-int
-irc_protocol_is_word_char (char *str)
-{
- wint_t c = irc_protocol_get_wide_char (str);
-
- if (c == WEOF)
- return 0;
-
- if (iswalnum (c))
- return 1;
-
- switch (c)
- {
- case '-':
- case '_':
- case '|':
- return 1;
- }
-
- /* not a 'word char' */
- return 0;
-}
-
-/*
- * irc_protocol_is_highlight: return 1 if given message contains highlight (with given nick
- * or at least one of string in "irc_higlight" setting)
- */
-
-int
-irc_protocol_is_highlight (char *message, char *nick)
-{
- char *msg, *highlight, *match, *match_pre, *match_post, *msg_pos, *pos, *pos_end;
- int end, length, startswith, endswith, wildcard_start, wildcard_end;
-
- /* empty message ? */
- if (!message || !message[0])
- return 0;
-
- /* highlight by nickname */
- match = strstr (message, nick);
- if (match)
- {
- match_pre = weechat_utf8_prev_char (message, match);
- if (!match_pre)
- match_pre = match - 1;
- match_post = match + strlen(nick);
- startswith = ((match == message) || (!irc_protocol_is_word_char (match_pre)));
- endswith = ((!match_post[0]) || (!irc_protocol_is_word_char (match_post)));
- if (startswith && endswith)
- return 1;
- }
-
- /* no highlight by nickname and "irc_highlight" is empty */
- if (!weechat_config_string (irc_config_look_highlight)
- || !weechat_config_string (irc_config_look_highlight)[0])
- return 0;
-
- /* convert both strings to lower case */
- if ((msg = strdup (message)) == NULL)
- return 0;
- highlight = strdup (weechat_config_string (irc_config_look_highlight));
- if (!highlight)
- {
- free (msg);
- return 0;
- }
- pos = msg;
- while (pos[0])
- {
- pos[0] = tolower (pos[0]);
- pos++;
- }
- pos = highlight;
- while (pos[0])
- {
- pos[0] = tolower (pos[0]);
- pos++;
- }
-
- /* look in "irc_highlight" for highlight */
- pos = highlight;
- end = 0;
- while (!end)
- {
- pos_end = strchr (pos, ',');
- if (!pos_end)
- {
- pos_end = strchr (pos, '\0');
- end = 1;
- }
- /* error parsing string! */
- if (!pos_end)
- {
- free (msg);
- free (highlight);
- return 0;
- }
-
- length = pos_end - pos;
- pos_end[0] = '\0';
- if (length > 0)
- {
- if ((wildcard_start = (pos[0] == '*')))
- {
- pos++;
- length--;
- }
- if ((wildcard_end = (*(pos_end - 1) == '*')))
- {
- *(pos_end - 1) = '\0';
- length--;
- }
- }
-
- if (length > 0)
- {
- msg_pos = msg;
- /* highlight found! */
- while ((match = strstr (msg_pos, pos)) != NULL)
- {
- match_pre = match - 1;
- match_pre = weechat_utf8_prev_char (msg, match);
- if (!match_pre)
- match_pre = match - 1;
- match_post = match + length;
- startswith = ((match == msg) || (!irc_protocol_is_word_char (match_pre)));
- endswith = ((!match_post[0]) || (!irc_protocol_is_word_char (match_post)));
- if ((wildcard_start && wildcard_end) ||
- (!wildcard_start && !wildcard_end &&
- startswith && endswith) ||
- (wildcard_start && endswith) ||
- (wildcard_end && startswith))
- {
- free (msg);
- free (highlight);
- return 1;
- }
- msg_pos = match_post;
- }
- }
-
- if (!end)
- pos = pos_end + 1;
- }
-
- /* no highlight found with "irc_highlight" list */
- free (msg);
- free (highlight);
- return 0;
-}
-
-/*
* irc_protocol_cmd_error: error received from server
*/
int
irc_protocol_cmd_error (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
int first_arg;
char *chan_nick, *args;
@@ -384,7 +181,6 @@ irc_protocol_cmd_error (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argc;
- (void) highlight;
first_arg = (strcmp (argv[2], server->nick) == 0) ? 3 : 2;
@@ -421,8 +217,7 @@ irc_protocol_cmd_error (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_invite (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* INVITE message looks like:
:nick!user@host INVITE mynick :#channel
@@ -433,7 +228,6 @@ irc_protocol_cmd_invite (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
weechat_printf_tags (server->buffer,
"irc_invite",
@@ -458,8 +252,7 @@ irc_protocol_cmd_invite (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_join (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
@@ -474,7 +267,6 @@ irc_protocol_cmd_join (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
pos_channel = (argv[2][0] == ':') ? argv[2] + 1 : argv[2];
@@ -534,8 +326,7 @@ irc_protocol_cmd_join (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_kick (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_comment;
struct t_irc_channel *ptr_channel;
@@ -548,9 +339,6 @@ irc_protocol_cmd_kick (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
- /* make C compiler happy */
- (void) highlight;
-
pos_comment = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
@@ -627,8 +415,7 @@ irc_protocol_cmd_kick (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_kill (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_comment;
struct t_irc_channel *ptr_channel;
@@ -641,9 +428,6 @@ irc_protocol_cmd_kill (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
- /* make C compiler happy */
- (void) highlight;
-
pos_comment = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
@@ -698,8 +482,7 @@ irc_protocol_cmd_kill (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_mode (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_modes;
struct t_irc_channel *ptr_channel;
@@ -711,9 +494,6 @@ irc_protocol_cmd_mode (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
- /* make C compiler happy */
- (void) highlight;
-
pos_modes = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
if (irc_channel_is_channel (argv[2]))
@@ -764,8 +544,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_nick (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
@@ -781,7 +560,6 @@ irc_protocol_cmd_nick (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
old_nick = irc_protocol_get_nick_from_host (argv[0]);
new_nick = (argv[2][0] == ':') ? argv[2] + 1 : argv[2];
@@ -855,14 +633,12 @@ irc_protocol_cmd_nick (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_args, *pos_end, *pos_usec;
struct timeval tv;
long sec1, usec1, sec2, usec2, difftime;
struct t_irc_channel *ptr_channel;
- int highlight_displayed, look_infobar_delay_highlight;
/* NOTICE message looks like:
NOTICE AUTH :*** Looking up your hostname...
@@ -884,9 +660,6 @@ irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2];
}
- look_infobar_delay_highlight = weechat_config_integer (
- weechat_config_get ("weechat.look.infobar_delay_highlight"));
-
if (nick && strncmp (pos_args, "\01VERSION", 8) == 0)
{
pos_args += 9;
@@ -979,44 +752,13 @@ irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
weechat_buffer_set (ptr_channel->buffer,
"title", ptr_channel->topic);
}
-
- if (highlight
- || irc_protocol_is_highlight (pos_args, server->nick))
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_notice",
- "%s%s",
- irc_nick_as_prefix (NULL, nick,
- IRC_COLOR_CHAT_HIGHLIGHT),
- pos_args);
- if ((look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != weechat_current_buffer))
- {
- weechat_infobar_printf (look_infobar_delay_highlight,
- IRC_COLOR_INFOBAR_HIGHLIGHT,
- _("Private %s> %s"),
- nick, pos_args);
- }
- highlight_displayed = 1;
- }
- else
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_notice",
- "%s%s",
- irc_nick_as_prefix (NULL, nick,
- IRC_COLOR_CHAT_NICK_OTHER),
- pos_args);
- highlight_displayed = 0;
- }
-
- /* send "irc_highlight" signal */
- if (highlight_displayed)
- {
- weechat_hook_signal_send ("irc_highlight",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- }
+
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_notice",
+ "%s%s",
+ irc_nick_as_prefix (NULL, nick,
+ IRC_COLOR_CHAT_NICK_OTHER),
+ pos_args);
}
else
{
@@ -1079,8 +821,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_part (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_comment, *join_string;
int join_length;
@@ -1094,9 +835,6 @@ irc_protocol_cmd_part (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
- /* make C compiler happy */
- (void) highlight;
-
nick = irc_protocol_get_nick_from_host (argv[0]);
host = irc_protocol_get_address_from_host (argv[0]);
@@ -1192,8 +930,7 @@ irc_protocol_cmd_part (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_ping (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* PING message looks like:
PING :server
@@ -1203,7 +940,6 @@ irc_protocol_cmd_ping (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
irc_server_sendf (server, "PONG :%s",
(argv[1][0] == ':') ? argv[1] + 1 : argv[1]);
@@ -1217,8 +953,7 @@ irc_protocol_cmd_ping (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_pong (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct timeval tv;
int old_lag;
@@ -1228,7 +963,6 @@ irc_protocol_cmd_pong (struct t_irc_server *server, char *command,
(void) argc;
(void) argv;
(void) argv_eol;
- (void) highlight;
if (server->lag_check_time.tv_sec != 0)
{
@@ -1318,8 +1052,7 @@ irc_protocol_reply_version (struct t_irc_server *server,
int
irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_args, *pos_end_01, *pos, *pos_message;
char *dcc_args, *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */
@@ -1328,8 +1061,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
char plugin_id[128];
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
- int highlight_displayed, look_infobar_delay_highlight;
-
+
/* PRIVMSG message looks like:
:nick!user@host PRIVMSG #channel :message for channel here
:nick!user@host PRIVMSG mynick :message for private here
@@ -1341,9 +1073,6 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
- look_infobar_delay_highlight = weechat_config_integer (
- weechat_config_get ("weechat.look.infobar_delay_highlight"));
-
nick = irc_protocol_get_nick_from_host (argv[0]);
host = irc_protocol_get_address_from_host (argv[0]);
@@ -1362,40 +1091,15 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
if (pos_end_01)
pos_end_01[0] = '\0';
- if (highlight
- || irc_protocol_is_highlight (pos_args, server->nick))
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_action",
- "%s%s%s %s%s",
- weechat_prefix ("action"),
- IRC_COLOR_CHAT_HIGHLIGHT,
- nick,
- IRC_COLOR_CHAT,
- pos_args);
- if ((look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != weechat_current_buffer))
- weechat_infobar_printf (look_infobar_delay_highlight,
- "infobar_highlight",
- _("Channel %s: * %s %s"),
- ptr_channel->name,
- nick,
- pos_args);
- weechat_hook_signal_send ("irc_highlight",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- }
- else
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_action",
- "%s%s%s %s%s",
- weechat_prefix ("action"),
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT,
- pos_args);
- }
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,irc_action",
+ "%s%s%s %s%s",
+ weechat_prefix ("action"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ pos_args);
+
irc_channel_add_nick_speaking (ptr_channel, nick);
if (pos_end_01)
@@ -1529,42 +1233,17 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
/* other message */
ptr_nick = irc_nick_search (ptr_channel, nick);
- if (highlight
- || irc_protocol_is_highlight (pos_args, server->nick))
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg",
- "%s%s",
- irc_nick_as_prefix (ptr_nick,
- (ptr_nick) ? NULL : nick,
- IRC_COLOR_CHAT_HIGHLIGHT),
- pos_args);
- if ((look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != weechat_current_buffer))
- weechat_infobar_printf (look_infobar_delay_highlight,
- "infobar_highlight",
- _("Channel %s: %s> %s"),
- ptr_channel->name,
- nick,
- pos_args);
- weechat_buffer_set (ptr_channel->buffer, "hotlist",
- WEECHAT_HOTLIST_HIGHLIGHT);
- weechat_hook_signal_send ("irc_highlight",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- }
- else
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg",
- "%s%s",
- irc_nick_as_prefix (ptr_nick,
- (ptr_nick) ? NULL : nick,
- NULL),
- pos_args);
- weechat_buffer_set (ptr_channel->buffer, "hotlist",
- WEECHAT_HOTLIST_MESSAGE);
- }
+
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg",
+ "%s%s",
+ irc_nick_as_prefix (ptr_nick,
+ (ptr_nick) ? NULL : nick,
+ NULL),
+ pos_args);
+ weechat_buffer_set (ptr_channel->buffer, "hotlist",
+ WEECHAT_HOTLIST_MESSAGE);
+
irc_channel_add_nick_speaking (ptr_channel, nick);
}
else
@@ -2101,48 +1780,21 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
pos_end_01 = strchr (pos, '\01');
if (pos_end_01)
pos_end_01[0] = '\0';
- if (highlight
- || irc_protocol_is_highlight (pos_args, server->nick))
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_action",
- "%s%s%s %s%s",
- weechat_prefix ("action"),
- IRC_COLOR_CHAT_HIGHLIGHT,
- nick,
- IRC_COLOR_CHAT,
- pos_args);
- if ((look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != weechat_current_buffer))
- {
- weechat_infobar_printf (look_infobar_delay_highlight,
- "look_infobar_highlight",
- _("Channel %s: * %s %s"),
- ptr_channel->name,
- nick, pos);
- }
- weechat_hook_signal_send ("irc_highlight",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- weechat_buffer_set (ptr_channel->buffer, "hotlist",
- WEECHAT_HOTLIST_HIGHLIGHT);
- }
- else
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_action",
- "%s%s%s %s%s",
- weechat_prefix ("action"),
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT,
- pos_args);
- weechat_hook_signal_send ("irc_pv",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- weechat_buffer_set (ptr_channel->buffer, "hotlist",
- WEECHAT_HOTLIST_MESSAGE);
- }
+
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,irc_action",
+ "%s%s%s %s%s",
+ weechat_prefix ("action"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ pos_args);
+ weechat_hook_signal_send ("irc_pv",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
+ weechat_buffer_set (ptr_channel->buffer, "hotlist",
+ WEECHAT_HOTLIST_MESSAGE);
+
if (pos_end_01)
pos_end_01[0] = '\01';
}
@@ -2232,48 +1884,19 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
ptr_channel->topic = strdup (host);
weechat_buffer_set (ptr_channel->buffer, "title",
ptr_channel->topic);
-
- if (highlight
- || irc_protocol_is_highlight (pos_args, server->nick))
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg",
- "%s%s",
- irc_nick_as_prefix (NULL,
- nick,
- IRC_COLOR_CHAT_HIGHLIGHT),
- pos_args);
- if ((look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != weechat_current_buffer))
- weechat_infobar_printf (look_infobar_delay_highlight,
- "infobar_highlight",
- _("Private %s> %s"),
- nick, pos_args);
- highlight_displayed = 1;
- }
- else
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg",
- "%s%s",
- irc_nick_as_prefix (NULL,
- nick,
- IRC_COLOR_CHAT_NICK_OTHER),
- pos_args);
- highlight_displayed = 0;
- }
-
+
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg",
+ "%s%s",
+ irc_nick_as_prefix (NULL,
+ nick,
+ IRC_COLOR_CHAT_NICK_OTHER),
+ pos_args);
+
weechat_hook_signal_send ("irc_pv",
WEECHAT_HOOK_SIGNAL_STRING,
argv_eol[0]);
-
- if (highlight_displayed)
- {
- weechat_hook_signal_send ("irc_highlight",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- }
-
+
weechat_buffer_set (ptr_channel->buffer,
"hotlist", WEECHAT_HOTLIST_PRIVATE);
}
@@ -2289,8 +1912,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_quit (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_comment;
struct t_irc_channel *ptr_channel;
@@ -2303,9 +1925,6 @@ irc_protocol_cmd_quit (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(2);
IRC_PROTOCOL_CHECK_HOST;
- /* make C compiler happy */
- (void) highlight;
-
nick = irc_protocol_get_nick_from_host (argv[0]);
host = irc_protocol_get_address_from_host (argv[0]);
@@ -2370,16 +1989,12 @@ irc_protocol_cmd_quit (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_mode, *pos_args;
IRC_PROTOCOL_MIN_ARGS(3);
- /* make C compiler happy */
- (void) highlight;
-
/* skip nickname if at beginning of server message */
if (strcmp (server->nick, argv[2]) == 0)
{
@@ -2408,8 +2023,7 @@ irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_numeric (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -2417,7 +2031,6 @@ irc_protocol_cmd_numeric (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv;
- (void) highlight;
if (weechat_strcasecmp (server->nick, argv[2]) == 0)
{
@@ -2444,8 +2057,7 @@ irc_protocol_cmd_numeric (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_topic (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_topic, *topic_color;
struct t_irc_channel *ptr_channel;
@@ -2457,9 +2069,6 @@ irc_protocol_cmd_topic (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(3);
- /* make C compiler happy */
- (void) highlight;
-
if (!irc_channel_is_channel (argv[2]))
{
weechat_printf (server->buffer,
@@ -2527,8 +2136,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_wallops (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* WALLOPS message looks like:
:nick!user@host WALLOPS :message from admin
@@ -2536,9 +2144,6 @@ irc_protocol_cmd_wallops (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(3);
- /* make C compiler happy */
- (void) highlight;
-
weechat_printf_tags (server->buffer,
"irc_wallops",
_("%sWallops from %s%s %s(%s%s%s)%s: %s"),
@@ -2561,8 +2166,7 @@ irc_protocol_cmd_wallops (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_001 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char **commands, **ptr_cmd, *vars_replaced;
char *away_msg;
@@ -2576,8 +2180,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, char *command,
if (strcmp (server->nick, argv[2]) != 0)
irc_server_set_nick (server, argv[2]);
- irc_protocol_cmd_numeric (server, command, argc, argv, argv_eol,
- highlight);
+ irc_protocol_cmd_numeric (server, command, argc, argv, argv_eol);
/* connection to IRC server is ok! */
server->is_connected = 1;
@@ -2631,8 +2234,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_005 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos, *pos2;
@@ -2645,8 +2247,7 @@ irc_protocol_cmd_005 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(4);
- irc_protocol_cmd_numeric (server, command, argc, argv, argv_eol,
- highlight);
+ irc_protocol_cmd_numeric (server, command, argc, argv, argv_eol);
pos = strstr (argv_eol[3], "PREFIX=");
if (pos)
@@ -2678,8 +2279,7 @@ irc_protocol_cmd_005 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_221 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 221 message looks like:
:server 221 nick :+s
@@ -2687,9 +2287,6 @@ irc_protocol_cmd_221 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(4);
- /* make C compiler happy */
- (void) highlight;
-
weechat_printf_tags (server->buffer,
irc_protocol_tags (command, "irc_numeric"),
_("%sUser mode for %s%s%s is %s[%s%s%s]"),
@@ -2713,8 +2310,7 @@ irc_protocol_cmd_221 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_301 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_away_msg;
struct t_irc_channel *ptr_channel;
@@ -2726,9 +2322,6 @@ irc_protocol_cmd_301 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(3);
- /* make C compiler happy */
- (void) highlight;
-
if (argc > 4)
{
pos_away_msg = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
@@ -2769,8 +2362,7 @@ irc_protocol_cmd_301 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_303 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 301 message looks like:
:server 303 mynick :nick1 nick2
@@ -2780,7 +2372,6 @@ irc_protocol_cmd_303 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv;
- (void) highlight;
weechat_printf_tags (server->buffer,
irc_protocol_tags (command, "irc_numeric"),
@@ -2798,8 +2389,7 @@ irc_protocol_cmd_303 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_305 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 305 message looks like:
:server 305 mynick :Does this mean you're really back?
@@ -2809,7 +2399,6 @@ irc_protocol_cmd_305 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv;
- (void) highlight;
if (argc > 3)
{
@@ -2842,8 +2431,7 @@ irc_protocol_cmd_305 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_306 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 306 message looks like:
:server 306 mynick :We'll miss you
@@ -2853,7 +2441,6 @@ irc_protocol_cmd_306 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv;
- (void) highlight;
if (argc > 3)
{
@@ -2892,8 +2479,7 @@ irc_protocol_cmd_306 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* messages look like:
:server 319 flashy FlashCode :some text here
@@ -2901,9 +2487,6 @@ irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(5);
- /* make C compiler happy */
- (void) highlight;
-
weechat_printf_tags (server->buffer,
irc_protocol_tags (command, "irc_numeric"),
"%s%s[%s%s%s] %s%s",
@@ -2924,8 +2507,7 @@ irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_311 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 311 message looks like:
:server 311 mynick nick user host * :realname here
@@ -2933,9 +2515,6 @@ irc_protocol_cmd_311 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(8);
- /* make C compiler happy */
- (void) highlight;
-
weechat_printf_tags (server->buffer,
irc_protocol_tags (command, "irc_numeric"),
"%s%s[%s%s%s] (%s%s@%s%s)%s: %s",
@@ -2960,8 +2539,7 @@ irc_protocol_cmd_311 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_312 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 312 message looks like:
:server 312 mynick nick irc.freenode.net :http://freenode.net/
@@ -2969,9 +2547,6 @@ irc_protocol_cmd_312 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(6);
- /* make C compiler happy */
- (void) highlight;
-
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
"%s%s[%s%s%s] %s%s %s(%s%s%s)",
@@ -2996,8 +2571,7 @@ irc_protocol_cmd_312 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_314 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 314 message looks like:
:server 314 mynick nick user host * :realname here
@@ -3005,9 +2579,6 @@ irc_protocol_cmd_314 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(8);
- /* make C compiler happy */
- (void) highlight;
-
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
_("%s%s%s %s(%s%s@%s%s)%s was %s"),
@@ -3031,8 +2602,7 @@ irc_protocol_cmd_314 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_315 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 315 message looks like:
:server 315 mynick #channel :End of /WHO list.
@@ -3042,9 +2612,6 @@ irc_protocol_cmd_315 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(5);
- /* make C compiler happy */
- (void) highlight;
-
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel && (ptr_channel->checking_away > 0))
{
@@ -3073,8 +2640,7 @@ irc_protocol_cmd_315 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_317 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
int idle_time, day, hour, min, sec;
time_t datetime;
@@ -3087,7 +2653,6 @@ irc_protocol_cmd_317 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
idle_time = atoi (argv[4]);
day = idle_time / (60 * 60 * 24);
@@ -3167,8 +2732,7 @@ irc_protocol_cmd_317 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_321 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -3181,9 +2745,6 @@ irc_protocol_cmd_321 (struct t_irc_server *server, char *command,
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
- /* make C compiler happy */
- (void) highlight;
-
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
"%s%s%s%s",
@@ -3201,8 +2762,7 @@ irc_protocol_cmd_321 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_322 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_topic;
@@ -3212,9 +2772,6 @@ irc_protocol_cmd_322 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(5);
- /* make C compiler happy */
- (void) highlight;
-
pos_topic = (argc > 5) ?
((argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5]) : NULL;
@@ -3245,8 +2802,7 @@ irc_protocol_cmd_322 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_323 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -3258,7 +2814,6 @@ irc_protocol_cmd_323 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv;
- (void) highlight;
pos_args = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
@@ -3278,8 +2833,7 @@ irc_protocol_cmd_323 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_324 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3291,7 +2845,6 @@ irc_protocol_cmd_324 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel)
@@ -3323,8 +2876,7 @@ irc_protocol_cmd_324 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_327 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_realname;
@@ -3334,9 +2886,6 @@ irc_protocol_cmd_327 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(6);
- /* make C compiler happy */
- (void) highlight;
-
pos_realname = (argc > 6) ?
((argv_eol[6][0] == ':') ? argv_eol[6] + 1 : argv_eol[6]) : NULL;
@@ -3382,8 +2931,7 @@ irc_protocol_cmd_327 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_329 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
time_t datetime;
@@ -3394,9 +2942,6 @@ irc_protocol_cmd_329 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(5);
- /* make C compiler happy */
- (void) highlight;
-
ptr_channel = irc_channel_search (server, argv[3]);
datetime = (time_t)(atol ((argv_eol[4][0] == ':') ?
@@ -3435,8 +2980,7 @@ irc_protocol_cmd_329 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_331 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3448,7 +2992,6 @@ irc_protocol_cmd_331 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
ptr_channel = irc_channel_search (server, argv[3]);
weechat_printf_tags ((ptr_channel) ?
@@ -3468,8 +3011,7 @@ irc_protocol_cmd_331 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_332 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_topic;
struct t_irc_channel *ptr_channel;
@@ -3480,9 +3022,6 @@ irc_protocol_cmd_332 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(5);
- /* make C compiler happy */
- (void) highlight;
-
pos_topic = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
ptr_channel = irc_channel_search (server, argv[3]);
@@ -3515,8 +3054,7 @@ irc_protocol_cmd_332 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_333 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
time_t datetime;
@@ -3527,9 +3065,6 @@ irc_protocol_cmd_333 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(6);
- /* make C compiler happy */
- (void) highlight;
-
ptr_channel = irc_channel_search (server, argv[3]);
datetime = (time_t)(atol ((argv_eol[5][0] == ':') ?
argv_eol[5] + 1 : argv_eol[5]));
@@ -3568,8 +3103,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_338 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 338 message looks like:
:server 338 mynick nick host :actually using host
@@ -3577,9 +3111,6 @@ irc_protocol_cmd_338 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(6);
- /* make C compiler happy */
- (void) highlight;
-
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
"%s%s[%s%s%s]%s %s %s%s",
@@ -3602,8 +3133,7 @@ irc_protocol_cmd_338 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_341 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 341 message looks like:
:server 341 mynick nick #channel
@@ -3613,7 +3143,6 @@ irc_protocol_cmd_341 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
@@ -3637,8 +3166,7 @@ irc_protocol_cmd_341 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_344 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 344 message looks like:
:server 344 mynick #channel nick!user@host
@@ -3646,9 +3174,6 @@ irc_protocol_cmd_344 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(5);
- /* make C compiler happy */
- (void) highlight;
-
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
_("%sChannel reop %s%s%s: %s%s"),
@@ -3668,16 +3193,12 @@ irc_protocol_cmd_344 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_345 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 345 message looks like:
:server 345 mynick #channel :End of Channel Reop List
*/
- /* make C compiler happy */
- (void) highlight;
-
IRC_PROTOCOL_MIN_ARGS(5);
weechat_printf_tags (server->buffer,
@@ -3698,8 +3219,7 @@ irc_protocol_cmd_345 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_348 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
time_t datetime;
@@ -3713,7 +3233,6 @@ irc_protocol_cmd_348 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
ptr_channel = irc_channel_search (server, argv[3]);
if (argc >= 7)
@@ -3767,8 +3286,7 @@ irc_protocol_cmd_348 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_349 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_args;
struct t_irc_channel *ptr_channel;
@@ -3782,9 +3300,6 @@ irc_protocol_cmd_349 (struct t_irc_server *server, char *command,
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
- /* make C compiler happy */
- (void) highlight;
-
ptr_channel = irc_channel_search (server, argv[3]);
weechat_printf_tags ((ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer,
@@ -3808,8 +3323,7 @@ irc_protocol_cmd_349 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_351 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 351 message looks like:
:server 351 mynick dancer-ircd-1.0.36(2006/07/23_13:11:50). server :iMZ dncrTS/v4
@@ -3817,9 +3331,6 @@ irc_protocol_cmd_351 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(5);
- /* make C compiler happy */
- (void) highlight;
-
if (argc > 5)
{
weechat_printf_tags (server->buffer,
@@ -3849,8 +3360,7 @@ irc_protocol_cmd_351 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_352 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_attr, *pos_hopcount, *pos_realname;
int arg_start, length;
@@ -3863,9 +3373,6 @@ irc_protocol_cmd_352 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(9);
- /* make C compiler happy */
- (void) highlight;
-
arg_start = (strcmp (argv[8], "*") == 0) ? 9 : 8;
if (argv[arg_start][0] == ':')
{
@@ -3935,8 +3442,7 @@ irc_protocol_cmd_352 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_353 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_channel, *pos_nick, *color;
int args, i, prefix_found;
@@ -3950,9 +3456,6 @@ irc_protocol_cmd_353 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(5);
- /* make C compiler happy */
- (void) highlight;
-
if (irc_channel_is_channel (argv[3]))
{
pos_channel = argv[3];
@@ -4066,8 +3569,7 @@ irc_protocol_cmd_353 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_366 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
struct t_plugin_infolist *infolist;
@@ -4080,9 +3582,6 @@ irc_protocol_cmd_366 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(5);
- /* make C compiler happy */
- (void) highlight;
-
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel && ptr_channel->nicks)
{
@@ -4201,8 +3700,7 @@ irc_protocol_cmd_366 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_367 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
time_t datetime;
@@ -4215,7 +3713,6 @@ irc_protocol_cmd_367 (struct t_irc_server *server, char *command,
/* make C compiler happy */
(void) argv_eol;
- (void) highlight;
ptr_channel = irc_channel_search (server, argv[3]);
if (argc >= 7)
@@ -4275,8 +3772,7 @@ irc_protocol_cmd_367 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_368 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
char *pos_args;
struct t_irc_channel *ptr_channel;
@@ -4287,9 +3783,6 @@ irc_protocol_cmd_368 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(4);
- /* make C compiler happy */
- (void) highlight;
-
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
@@ -4316,13 +3809,11 @@ irc_protocol_cmd_368 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_432 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
int i, nick_found, nick_to_use;
- irc_protocol_cmd_error (server, command, argc, argv, argv_eol,
- highlight);
+ irc_protocol_cmd_error (server, command, argc, argv, argv_eol);
if (!server->is_connected)
{
@@ -4374,8 +3865,7 @@ irc_protocol_cmd_432 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_433 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
int i, nick_found, nick_to_use;
@@ -4421,8 +3911,7 @@ irc_protocol_cmd_433 (struct t_irc_server *server, char *command,
}
else
{
- return irc_protocol_cmd_error (server, command, argc, argv, argv_eol,
- highlight);
+ return irc_protocol_cmd_error (server, command, argc, argv, argv_eol);
}
return WEECHAT_RC_OK;
@@ -4434,8 +3923,7 @@ irc_protocol_cmd_433 (struct t_irc_server *server, char *command,
int
irc_protocol_cmd_438 (struct t_irc_server *server, char *command,
- int argc, char **argv, char **argv_eol,
- int highlight)
+ int argc, char **argv, char **argv_eol)
{
/* 438 message looks like:
:server 438 mynick newnick :Nick change too fast. Please wait 30 seconds.
@@ -4443,9 +3931,6 @@ irc_protocol_cmd_438 (struct t_irc_server *server, char *command,
IRC_PROTOCOL_MIN_ARGS(4);
- /* make C compiler happy */
- (void) highlight;
-
if (argc >= 5)
{
weechat_printf_tags (server->buffer,
@@ -4497,7 +3982,7 @@ void
irc_protocol_recv_command (struct t_irc_server *server, char *entire_line,
char *host, char *command, char *arguments)
{
- int i, cmd_found, return_code, highlight, argc, decode_color;
+ int i, cmd_found, return_code, argc, decode_color;
char *pos, *nick;
char *dup_entire_line, *dup_host, *dup_arguments, *irc_message;
t_irc_recv_func *cmd_recv_func;
@@ -4681,19 +4166,6 @@ irc_protocol_recv_command (struct t_irc_server *server, char *entire_line,
dup_host = (host) ? strdup (host) : NULL;
dup_arguments = (arguments) ? strdup (arguments) : NULL;
- highlight = 0;
-
- //return_code = plugin_msg_handler_exec (server->name,
- // cmd_name,
- // dup_entire_line);
- /* plugin handler choosed to discard message for WeeChat,
- so we ignore this message in standard handler */
- //if (return_code & PLUGIN_RC_OK_IGNORE_WEECHAT)
- // ignore = 1;
- /* plugin asked for highlight ? */
- //if (return_code & PLUGIN_RC_OK_WITH_HIGHLIGHT)
- // highlight = 1;
-
pos = (dup_host) ? strchr (dup_host, '!') : NULL;
if (pos)
pos[0] = '\0';
@@ -4703,8 +4175,7 @@ irc_protocol_recv_command (struct t_irc_server *server, char *entire_line,
irc_message = strdup (dup_entire_line);
return_code = (int) (cmd_recv_func) (server, cmd_name,
- argc, argv, argv_eol,
- highlight);
+ argc, argv, argv_eol);
if (return_code == WEECHAT_RC_ERROR)
{
diff --git a/src/plugins/irc/irc-protocol.h b/src/plugins/irc/irc-protocol.h
index 93b1ae35b..4c56ef5dc 100644
--- a/src/plugins/irc/irc-protocol.h
+++ b/src/plugins/irc/irc-protocol.h
@@ -45,8 +45,7 @@
struct t_irc_server;
typedef int (t_irc_recv_func)(struct t_irc_server *server, char *comand,
- int argc, char **argv, char **argv_eol,
- int highlight);
+ int argc, char **argv, char **argv_eol);
struct t_irc_protocol_msg
{
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 651b05fc8..9a727bac2 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -233,6 +233,8 @@ irc_server_set_nick (struct t_irc_server *server, char *nick)
weechat_buffer_set (server->buffer, "nick", nick);
+ weechat_buffer_set (server->buffer, "highlight_words", nick);
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -1847,9 +1849,21 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin)
&irc_buffer_close_cb, NULL);
if (!server->buffer)
return 0;
+
weechat_buffer_set (server->buffer, "display", "1");
+
weechat_hook_signal_send ("logger_backlog",
WEECHAT_HOOK_SIGNAL_POINTER, server->buffer);
+
+ /* set highlights settings on server buffer */
+ if (server->nick)
+ weechat_buffer_set (server->buffer, "highlight_words", server->nick);
+ if (weechat_config_string (irc_config_look_highlight_tags)
+ && weechat_config_string (irc_config_look_highlight_tags)[0])
+ {
+ weechat_buffer_set (server->buffer, "highlight_tags",
+ weechat_config_string (irc_config_look_highlight_tags));
+ }
}
#ifndef HAVE_GNUTLS
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index a24f16937..5c16cf095 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -526,6 +526,8 @@ plugin_api_infolist_get_add_buffer_line (struct t_plugin_infolist *infolist,
struct t_gui_line *line)
{
struct t_plugin_infolist_item *ptr_item;
+ int i;
+ char option_name[64];
if (!infolist || !line)
return 0;
@@ -540,6 +542,19 @@ plugin_api_infolist_get_add_buffer_line (struct t_plugin_infolist *infolist,
return 0;
if (!plugin_infolist_new_var_string (ptr_item, "str_time", line->str_time))
return 0;
+ if (!plugin_infolist_new_var_integer (ptr_item, "tags_count", line->tags_count))
+ return 0;
+ for (i = 0; i < line->tags_count; i++)
+ {
+ snprintf (option_name, sizeof (option_name), "tag_%05d", i + 1);
+ if (!plugin_infolist_new_var_string (ptr_item, option_name,
+ line->tags_array[i]))
+ return 0;
+ }
+ if (!plugin_infolist_new_var_integer (ptr_item, "displayed", line->displayed))
+ return 0;
+ if (!plugin_infolist_new_var_integer (ptr_item, "highlight", line->highlight))
+ return 0;
if (!plugin_infolist_new_var_string (ptr_item, "prefix", line->prefix))
return 0;
if (!plugin_infolist_new_var_string (ptr_item, "message", line->message))
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 33633a9ce..b3bdf8055 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -292,6 +292,7 @@ plugin_load (char *filename)
new_plugin->string_replace = &string_replace;
new_plugin->string_remove_quotes = &string_remove_quotes;
new_plugin->string_strip = &string_strip;
+ new_plugin->string_has_highlight = &string_has_highlight;
new_plugin->string_explode = &string_explode;
new_plugin->string_free_exploded = &string_free_exploded;
new_plugin->string_split_command = &string_split_command;
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 68e89b3ce..33d62c851 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -113,6 +113,7 @@ struct t_weechat_plugin
char *(*string_replace) (char *string, char *search, char *replace);
char *(*string_remove_quotes) (char *string, char *quotes);
char *(*string_strip) (char *string, int left, int right, char *chars);
+ int (*string_has_highlight) (char *string, char *highlight_words);
char **(*string_explode) (char *string, char *separators, int keep_eol,
int num_items_max, int *num_items);
void (*string_free_exploded) (char **exploded_string);
@@ -492,6 +493,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->string_remove_quotes(__string, __quotes)
#define weechat_string_strip(__string, __left, __right, __chars) \
weechat_plugin->string_strip(__string, __left, __right, __chars)
+#define weechat_string_has_highlight(__string, __highlight_words) \
+ weechat_plugin->string_has_highlight(__string, __highlight_words)
#define weechat_string_explode(__string, __separator, __eol, __max, \
__num_items) \
weechat_plugin->string_explode(__string, __separator, __eol, \