1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 22:45:42 +02:00

irc: use statusmsg from message 005 to check prefix char in status notices/messages

This commit is contained in:
Sebastien Helleu
2014-01-02 10:47:18 +01:00
parent 46e46ed763
commit 5668e2ab12
5 changed files with 65 additions and 45 deletions
+2
View File
@@ -69,6 +69,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* aspell: fix detection of nicks with non-alphanumeric chars
* guile: disable guile gmp allocator (fix crash on unload of relay plugin)
(bug #40628)
* irc: use statusmsg from message 005 to check prefix char in status
notices/messages
* irc: remove display of channel in channel notices, display "PvNotice" for
channel welcome notices
* irc: add option irc.look.smart_filter_mode (task #12499)
+8 -9
View File
@@ -2943,11 +2943,9 @@ int
irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char **targets;
int num_targets, i, j, arg_target, arg_text, is_channel, msg_op_voice;
char **targets, *msg_pwd_hidden, *string;
int num_targets, i, j, arg_target, arg_text, is_channel, status_msg;
int hide_password;
char *msg_pwd_hidden;
char *string;
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
@@ -3009,13 +3007,14 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
{
is_channel = 0;
ptr_channel = NULL;
msg_op_voice = 0;
if (((targets[i][0] == '@') || (targets[i][0] == '+'))
status_msg = 0;
if (irc_server_prefix_char_statusmsg (ptr_server,
targets[i][0])
&& irc_channel_is_channel (ptr_server, targets[i] + 1))
{
ptr_channel = irc_channel_search (ptr_server, targets[i] + 1);
is_channel = 1;
msg_op_voice = 1;
status_msg = 1;
}
else
{
@@ -3029,7 +3028,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
{
string = irc_color_decode (argv_eol[arg_text],
weechat_config_boolean (irc_config_network_colors_send));
if (msg_op_voice)
if (status_msg)
{
/*
* message to channel ops/voiced
@@ -3283,7 +3282,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("notice", 1);
is_channel = 0;
if (((argv[arg_target][0] == '@') || (argv[arg_target][0] == '+'))
if (irc_server_prefix_char_statusmsg (ptr_server, argv[arg_target][0])
&& irc_channel_is_channel (ptr_server, argv[arg_target] + 1))
{
ptr_channel = irc_channel_search (ptr_server, argv[arg_target] + 1);
File diff suppressed because it is too large Load Diff
+26
View File
@@ -875,6 +875,32 @@ irc_server_get_chanmodes (struct t_irc_server *server)
server->chanmodes : irc_server_chanmodes_default;
}
/*
* Checks if a prefix char is valid for a status message
* (message sent for example to ops/voiced).
*
* The prefix (for example '@' or '+') must be in STATUSMSG,
* or in "prefix_chars" if STATUSMSG is not defined.
*
* Returns:
* 1: prefix is valid for a status message
* 0: prefix is NOT valid for a status message
*/
int
irc_server_prefix_char_statusmsg (struct t_irc_server *server,
char prefix_char)
{
const char *support_statusmsg;
support_statusmsg = irc_server_get_isupport_value (server, "STATUSMSG");
if (support_statusmsg)
return (strchr (support_statusmsg, prefix_char)) ? 1 : 0;
return (irc_server_get_prefix_char_index (server, prefix_char) >= 0) ?
1 : 0;
}
/*
* Allocates a new server and adds it to the servers queue.
*
+2
View File
@@ -265,6 +265,8 @@ extern char irc_server_get_prefix_mode_for_char (struct t_irc_server *server,
extern char irc_server_get_prefix_char_for_mode (struct t_irc_server *server,
char mode);
extern const char *irc_server_get_chanmodes (struct t_irc_server *server);
extern int irc_server_prefix_char_statusmsg (struct t_irc_server *server,
char prefix_char);
extern struct t_irc_server *irc_server_alloc (const char *name);
extern struct t_irc_server *irc_server_alloc_with_url (const char *irc_url);
extern void irc_server_apply_command_line_options (struct t_irc_server *server,