mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 21:00:40 +02:00
added "message own_public" and "message own_private" events that are
sent when /msg command is used. this way we don't need to parse the /msg's options everywhere. also efnet @#channels support works now better. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1041 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
219c83ae6a
commit
2ae679be08
15 changed files with 210 additions and 141 deletions
|
|
@ -14,6 +14,7 @@ INCLUDES = \
|
|||
libfe_common_irc_a_SOURCES = \
|
||||
fe-irc-channels.c \
|
||||
fe-irc-commands.c \
|
||||
fe-irc-messages.c \
|
||||
fe-irc-queries.c \
|
||||
fe-irc-server.c \
|
||||
fe-ircnet.c \
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ void fe_irc_channels_deinit(void);
|
|||
void fe_irc_queries_init(void);
|
||||
void fe_irc_queries_deinit(void);
|
||||
|
||||
void fe_irc_messages_init(void);
|
||||
void fe_irc_messages_deinit(void);
|
||||
|
||||
void fe_irc_commands_init(void);
|
||||
void fe_irc_commands_deinit(void);
|
||||
|
||||
|
|
@ -99,6 +102,7 @@ void fe_common_irc_init(void)
|
|||
|
||||
fe_irc_channels_init();
|
||||
fe_irc_queries_init();
|
||||
fe_irc_messages_init();
|
||||
fe_irc_commands_init();
|
||||
fe_ircnet_init();
|
||||
fe_irc_server_init();
|
||||
|
|
@ -119,6 +123,7 @@ void fe_common_irc_deinit(void)
|
|||
|
||||
fe_irc_channels_deinit();
|
||||
fe_irc_queries_deinit();
|
||||
fe_irc_messages_deinit();
|
||||
fe_irc_commands_deinit();
|
||||
fe_ircnet_deinit();
|
||||
fe_irc_server_deinit();
|
||||
|
|
|
|||
|
|
@ -51,9 +51,15 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data,
|
|||
if (nick == NULL) nick = server->real_address;
|
||||
if (addr == NULL) addr = "";
|
||||
|
||||
signal_emit(ischannel(*target) ?
|
||||
"message public" : "message private", 5,
|
||||
server, msg, nick, addr, target);
|
||||
if (*target == '@' && ischannel(target[1])) {
|
||||
/* Hybrid 6 feature, send msg to all ops in channel */
|
||||
signal_emit("message irc op_public", 5,
|
||||
server, msg, nick, addr, target+1);
|
||||
} else {
|
||||
signal_emit(ischannel(*target) ?
|
||||
"message public" : "message private", 5,
|
||||
server, msg, nick, addr, target);
|
||||
}
|
||||
|
||||
g_free(params);
|
||||
}
|
||||
|
|
|
|||
81
src/fe-common/irc/fe-irc-messages.c
Normal file
81
src/fe-common/irc/fe-irc-messages.c
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
fe-irc-messages.c : irssi
|
||||
|
||||
Copyright (C) 2001 Timo Sirainen
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "signals.h"
|
||||
#include "levels.h"
|
||||
#include "channels.h"
|
||||
|
||||
#include "irc.h"
|
||||
|
||||
/* FIXME: hmm. there's should be some better way to use other module's
|
||||
formats than this since now we can't use this module's formats.. */
|
||||
#include "../core/module-formats.h"
|
||||
#include "printtext.h"
|
||||
#include "fe-messages.h"
|
||||
|
||||
static void sig_message_own_public(SERVER_REC *server, const char *msg,
|
||||
const char *target, const char *origtarget)
|
||||
{
|
||||
char *nickmode;
|
||||
|
||||
if (IS_IRC_SERVER(server) && target != NULL &&
|
||||
*target == '@' && ischannel(target[1])) {
|
||||
/* Hybrid 6 feature, send msg to all ops in channel */
|
||||
nickmode = channel_get_nickmode(channel_find(server, target+1),
|
||||
server->nick);
|
||||
|
||||
printformat_module("fe-common/core", server, target+1,
|
||||
MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT |
|
||||
MSGLEVEL_NO_ACT,
|
||||
IRCTXT_OWN_MSG_CHANNEL,
|
||||
server->nick, target, msg, nickmode);
|
||||
signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
static void sig_message_irc_op_public(SERVER_REC *server, const char *msg,
|
||||
const char *nick, const char *address,
|
||||
const char *target)
|
||||
{
|
||||
char *nickmode, *optarget;
|
||||
|
||||
nickmode = channel_get_nickmode(channel_find(server, target),
|
||||
server->nick);
|
||||
|
||||
optarget = g_strconcat("@", target, NULL);
|
||||
printformat_module("fe-common/core", server, target,
|
||||
MSGLEVEL_PUBLIC | MSGLEVEL_HILIGHT,
|
||||
IRCTXT_PUBMSG_ME_CHANNEL,
|
||||
nick, optarget, msg, nickmode);
|
||||
g_free(optarget);
|
||||
}
|
||||
|
||||
void fe_irc_messages_init(void)
|
||||
{
|
||||
signal_add("message own_public", (SIGNAL_FUNC) sig_message_own_public);
|
||||
signal_add("message irc op_public", (SIGNAL_FUNC) sig_message_irc_op_public);
|
||||
}
|
||||
|
||||
void fe_irc_messages_deinit(void)
|
||||
{
|
||||
signal_remove("message own_public", (SIGNAL_FUNC) sig_message_own_public);
|
||||
signal_remove("message irc op_public", (SIGNAL_FUNC) sig_message_irc_op_public);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue