mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #295 from dequis/fix-bug-291
Fix #291, "/msg +#channel incorrectly shows up as Nick:@#channel"
This commit is contained in:
commit
5ced71e1ac
@ -56,11 +56,13 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data,
|
|||||||
|
|
||||||
if (fe_channel_is_opchannel(server, target)) {
|
if (fe_channel_is_opchannel(server, target)) {
|
||||||
/* Hybrid 6 feature, send msg to all ops in channel */
|
/* Hybrid 6 feature, send msg to all ops in channel */
|
||||||
target = (char *)fe_channel_skip_prefix(server, target);
|
const char *cleantarget = fe_channel_skip_prefix(server, target);
|
||||||
recoded = recode_in(SERVER(server), msg, target);
|
recoded = recode_in(SERVER(server), msg, cleantarget);
|
||||||
|
|
||||||
|
/* pass the original target to the signal, with the @+ here
|
||||||
|
* the other one is only needed for recode_in*/
|
||||||
signal_emit("message irc op_public", 5,
|
signal_emit("message irc op_public", 5,
|
||||||
server, recoded, nick, addr,
|
server, recoded, nick, addr, target);
|
||||||
get_visible_target(server, target));
|
|
||||||
} else {
|
} else {
|
||||||
recoded = recode_in(SERVER(server), msg, server_ischannel(SERVER(server), target) ? target : nick);
|
recoded = recode_in(SERVER(server), msg, server_ischannel(SERVER(server), target) ? target : nick);
|
||||||
signal_emit(server_ischannel(SERVER(server), target) ?
|
signal_emit(server_ischannel(SERVER(server), target) ?
|
||||||
|
@ -56,7 +56,7 @@ const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target)
|
|||||||
|
|
||||||
/* Exit early if target doesn't name a channel */
|
/* Exit early if target doesn't name a channel */
|
||||||
if (server_ischannel(SERVER(server), target) == FALSE)
|
if (server_ischannel(SERVER(server), target) == FALSE)
|
||||||
return FALSE;
|
return target;
|
||||||
|
|
||||||
statusmsg = g_hash_table_lookup(server->isupport, "statusmsg");
|
statusmsg = g_hash_table_lookup(server->isupport, "statusmsg");
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "fe-queries.h"
|
#include "fe-queries.h"
|
||||||
#include "window-items.h"
|
#include "window-items.h"
|
||||||
#include "fe-irc-channels.h"
|
#include "fe-irc-channels.h"
|
||||||
|
#include "fe-irc-server.h"
|
||||||
|
|
||||||
static void sig_message_own_public(SERVER_REC *server, const char *msg,
|
static void sig_message_own_public(SERVER_REC *server, const char *msg,
|
||||||
const char *target, const char *origtarget)
|
const char *target, const char *origtarget)
|
||||||
@ -70,18 +71,28 @@ static void sig_message_irc_op_public(SERVER_REC *server, const char *msg,
|
|||||||
const char *nick, const char *address,
|
const char *nick, const char *address,
|
||||||
const char *target)
|
const char *target)
|
||||||
{
|
{
|
||||||
char *nickmode, *optarget;
|
char *nickmode, *optarget, *prefix;
|
||||||
|
const char *cleantarget;
|
||||||
|
|
||||||
|
/* only skip here so the difference can be stored in prefix */
|
||||||
|
cleantarget = fe_channel_skip_prefix(IRC_SERVER(server), target);
|
||||||
|
prefix = g_strndup(target, cleantarget - target);
|
||||||
|
|
||||||
|
/* and clean the rest here */
|
||||||
|
cleantarget = get_visible_target(IRC_SERVER(server), cleantarget);
|
||||||
|
|
||||||
nickmode = channel_get_nickmode(channel_find(server, target),
|
nickmode = channel_get_nickmode(channel_find(server, target),
|
||||||
nick);
|
nick);
|
||||||
|
|
||||||
optarget = g_strconcat("@", target, NULL);
|
optarget = g_strconcat(prefix, cleantarget, NULL);
|
||||||
printformat_module("fe-common/core", server, target,
|
|
||||||
|
printformat_module("fe-common/core", server, cleantarget,
|
||||||
MSGLEVEL_PUBLIC,
|
MSGLEVEL_PUBLIC,
|
||||||
TXT_PUBMSG_CHANNEL,
|
TXT_PUBMSG_CHANNEL,
|
||||||
nick, optarget, msg, nickmode);
|
nick, optarget, msg, nickmode);
|
||||||
g_free(nickmode);
|
g_free(nickmode);
|
||||||
g_free(optarget);
|
g_free(optarget);
|
||||||
|
g_free(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_message_own_wall(SERVER_REC *server, const char *msg,
|
static void sig_message_own_wall(SERVER_REC *server, const char *msg,
|
||||||
@ -92,7 +103,8 @@ static void sig_message_own_wall(SERVER_REC *server, const char *msg,
|
|||||||
nickmode = channel_get_nickmode(channel_find(server, target),
|
nickmode = channel_get_nickmode(channel_find(server, target),
|
||||||
server->nick);
|
server->nick);
|
||||||
|
|
||||||
optarget = g_strconcat("@", target, NULL);
|
/* this is always @, skip_prefix is not needed here */
|
||||||
|
optarget = g_strconcat("@", target, NULL);
|
||||||
printformat_module("fe-common/core", server, target,
|
printformat_module("fe-common/core", server, target,
|
||||||
MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT |
|
MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT |
|
||||||
MSGLEVEL_NO_ACT,
|
MSGLEVEL_NO_ACT,
|
||||||
|
Loading…
Reference in New Issue
Block a user