irc: display channel voice notices received in channel buffer (bug #34762), display channel/op notices sent in channel buffer
This commit is contained in:
parent
cdcd417774
commit
e8e5ad66cc
@ -1,7 +1,7 @@
|
||||
WeeChat ChangeLog
|
||||
=================
|
||||
Sébastien Helleu <flashcode@flashtux.org>
|
||||
v0.3.7-dev, 2011-11-06
|
||||
v0.3.7-dev, 2011-11-07
|
||||
|
||||
|
||||
Version 0.3.7 (under dev!)
|
||||
@ -19,6 +19,8 @@ Version 0.3.7 (under dev!)
|
||||
* core: fix compilation error with "pid_t" on Mac OS X (bug #34639)
|
||||
* core: enable background process under Cygwin to connect to servers, fix
|
||||
reconnection problem (bug #34626)
|
||||
* irc: display channel voice notices received in channel buffer (bug #34762),
|
||||
display channel/op notices sent in channel buffer
|
||||
* irc: add option irc.color.mirc_remap to remap mirc colors in messages to
|
||||
WeeChat colors
|
||||
* irc: allow URL "irc://" in command /connect
|
||||
|
@ -2740,7 +2740,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
char **argv, char **argv_eol)
|
||||
{
|
||||
char *string, hash_key[32], *str_args;
|
||||
int arg_nick, arg_text, number;
|
||||
int arg_target, arg_text, number, is_channel;
|
||||
struct t_irc_channel *ptr_channel;
|
||||
struct t_hashtable *hashtable;
|
||||
|
||||
@ -2751,22 +2751,34 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if (argc > 2)
|
||||
{
|
||||
arg_nick = 1;
|
||||
arg_target = 1;
|
||||
arg_text = 2;
|
||||
if ((argc >= 5) && (weechat_strcasecmp (argv[1], "-server") == 0))
|
||||
{
|
||||
ptr_server = irc_server_search (argv[2]);
|
||||
arg_nick = 3;
|
||||
arg_target = 3;
|
||||
arg_text = 4;
|
||||
}
|
||||
|
||||
IRC_COMMAND_CHECK_SERVER("notice", 1);
|
||||
ptr_channel = irc_channel_search (ptr_server, argv[arg_nick]);
|
||||
is_channel = 0;
|
||||
if (((argv[arg_target][0] == '@') || (argv[arg_target][0] == '+'))
|
||||
&& irc_channel_is_channel (argv[arg_target] + 1))
|
||||
{
|
||||
ptr_channel = irc_channel_search (ptr_server, argv[arg_target] + 1);
|
||||
is_channel = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_channel = irc_channel_search (ptr_server, argv[arg_target]);
|
||||
if (ptr_channel)
|
||||
is_channel = 1;
|
||||
}
|
||||
hashtable = irc_server_sendf (ptr_server,
|
||||
IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_HASHTABLE,
|
||||
NULL,
|
||||
"NOTICE %s :%s",
|
||||
argv[arg_nick], argv_eol[arg_text]);
|
||||
argv[arg_target], argv_eol[arg_text]);
|
||||
if (hashtable)
|
||||
{
|
||||
number = 1;
|
||||
@ -2786,9 +2798,8 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
/* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */
|
||||
_("Notice"),
|
||||
IRC_COLOR_RESET,
|
||||
(irc_channel_is_channel (argv[arg_nick])) ?
|
||||
IRC_COLOR_CHAT_CHANNEL : IRC_COLOR_CHAT_NICK,
|
||||
argv[arg_nick],
|
||||
(is_channel) ? IRC_COLOR_CHAT_CHANNEL : IRC_COLOR_CHAT_NICK,
|
||||
argv[arg_target],
|
||||
IRC_COLOR_RESET,
|
||||
(string) ? string : str_args);
|
||||
if (string)
|
||||
|
@ -942,7 +942,7 @@ IRC_PROTOCOL_CALLBACK(notice)
|
||||
char *pos_target, *pos_args;
|
||||
struct t_irc_channel *ptr_channel;
|
||||
struct t_irc_nick *ptr_nick;
|
||||
int notify_private, notice_op;
|
||||
int notify_private, is_channel, notice_op, notice_voice;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
|
||||
/*
|
||||
@ -958,20 +958,29 @@ IRC_PROTOCOL_CALLBACK(notice)
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
notice_op = 0;
|
||||
notice_voice = 0;
|
||||
|
||||
if (argv[0][0] == ':')
|
||||
{
|
||||
if (argc < 4)
|
||||
return WEECHAT_RC_ERROR;
|
||||
pos_target = argv[2];
|
||||
if ((pos_target[0] == '@') && (irc_channel_is_channel (pos_target + 1)))
|
||||
is_channel = irc_channel_is_channel (pos_target + 1);
|
||||
if ((pos_target[0] == '@') && is_channel)
|
||||
{
|
||||
pos_target++;
|
||||
notice_op = 1;
|
||||
}
|
||||
else if ((pos_target[0] == '+') && is_channel)
|
||||
{
|
||||
pos_target++;
|
||||
notice_voice = 1;
|
||||
}
|
||||
pos_args = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
|
||||
if (notice_op && (pos_args[0] == '@') && (pos_args[1] == ' '))
|
||||
pos_args += 2;
|
||||
else if (notice_voice && (pos_args[0] == '+') && (pos_args[1] == ' '))
|
||||
pos_args += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1000,7 +1009,7 @@ IRC_PROTOCOL_CALLBACK(notice)
|
||||
IRC_COLOR_NOTICE,
|
||||
/* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */
|
||||
_("Notice"),
|
||||
(notice_op) ? "Op" : "",
|
||||
(notice_op) ? "Op" : ((notice_voice) ? "Voice" : ""),
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick),
|
||||
(nick && nick[0]) ? nick : "?",
|
||||
|
Loading…
x
Reference in New Issue
Block a user