mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
You can specify the format of the /WALL text with /SET wall_format,
default is "[Wall/#channel] text". The WALL is also printed to screen. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@303 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
f4d7561660
commit
41ff80bb3e
@ -248,6 +248,26 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server)
|
|||||||
g_free(params);
|
g_free(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item)
|
||||||
|
{
|
||||||
|
char *params, *channame, *msg;
|
||||||
|
CHANNEL_REC *chanrec;
|
||||||
|
|
||||||
|
g_return_if_fail(data != NULL);
|
||||||
|
if (server == NULL || !server->connected || !irc_server_check(server))
|
||||||
|
cmd_return_error(CMDERR_NOT_CONNECTED);
|
||||||
|
|
||||||
|
params = cmd_get_params(data, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST, item, &channame, &msg);
|
||||||
|
if (*msg == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||||
|
|
||||||
|
chanrec = channel_find(server, channame);
|
||||||
|
if (chanrec == NULL) cmd_param_error(CMDERR_CHAN_NOT_FOUND);
|
||||||
|
|
||||||
|
printformat(server, chanrec->name, MSGLEVEL_NOTICES, IRCTXT_OWN_WALL, chanrec->name, msg);
|
||||||
|
|
||||||
|
g_free(params);
|
||||||
|
}
|
||||||
|
|
||||||
static void cmd_ban(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item)
|
static void cmd_ban(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item)
|
||||||
{
|
{
|
||||||
CHANNEL_REC *cur_channel, *channel;
|
CHANNEL_REC *cur_channel, *channel;
|
||||||
@ -393,6 +413,7 @@ void fe_irc_commands_init(void)
|
|||||||
command_bind("notice", NULL, (SIGNAL_FUNC) cmd_notice);
|
command_bind("notice", NULL, (SIGNAL_FUNC) cmd_notice);
|
||||||
command_bind("ctcp", NULL, (SIGNAL_FUNC) cmd_ctcp);
|
command_bind("ctcp", NULL, (SIGNAL_FUNC) cmd_ctcp);
|
||||||
command_bind("nctcp", NULL, (SIGNAL_FUNC) cmd_nctcp);
|
command_bind("nctcp", NULL, (SIGNAL_FUNC) cmd_nctcp);
|
||||||
|
command_bind("wall", NULL, (SIGNAL_FUNC) cmd_wall);
|
||||||
command_bind("ban", NULL, (SIGNAL_FUNC) cmd_ban);
|
command_bind("ban", NULL, (SIGNAL_FUNC) cmd_ban);
|
||||||
command_bind("invitelist", NULL, (SIGNAL_FUNC) cmd_invitelist);
|
command_bind("invitelist", NULL, (SIGNAL_FUNC) cmd_invitelist);
|
||||||
command_bind("join", NULL, (SIGNAL_FUNC) cmd_join);
|
command_bind("join", NULL, (SIGNAL_FUNC) cmd_join);
|
||||||
@ -411,6 +432,7 @@ void fe_irc_commands_deinit(void)
|
|||||||
command_unbind("notice", (SIGNAL_FUNC) cmd_notice);
|
command_unbind("notice", (SIGNAL_FUNC) cmd_notice);
|
||||||
command_unbind("ctcp", (SIGNAL_FUNC) cmd_ctcp);
|
command_unbind("ctcp", (SIGNAL_FUNC) cmd_ctcp);
|
||||||
command_unbind("nctcp", (SIGNAL_FUNC) cmd_nctcp);
|
command_unbind("nctcp", (SIGNAL_FUNC) cmd_nctcp);
|
||||||
|
command_unbind("wall", (SIGNAL_FUNC) cmd_wall);
|
||||||
command_unbind("ban", (SIGNAL_FUNC) cmd_ban);
|
command_unbind("ban", (SIGNAL_FUNC) cmd_ban);
|
||||||
command_unbind("invitelist", (SIGNAL_FUNC) cmd_invitelist);
|
command_unbind("invitelist", (SIGNAL_FUNC) cmd_invitelist);
|
||||||
command_unbind("join", (SIGNAL_FUNC) cmd_join);
|
command_unbind("join", (SIGNAL_FUNC) cmd_join);
|
||||||
|
@ -142,6 +142,7 @@ FORMAT_REC fecommon_irc_formats[] = {
|
|||||||
{ "own_notice", "%K[%rnotice%K(%R$0%K)]%n $1", 2, { 0, 0 } },
|
{ "own_notice", "%K[%rnotice%K(%R$0%K)]%n $1", 2, { 0, 0 } },
|
||||||
{ "own_me", "%W * $0%n $1", 2, { 0, 0 } },
|
{ "own_me", "%W * $0%n $1", 2, { 0, 0 } },
|
||||||
{ "own_ctcp", "%K[%rctcp%K(%R$0%K)]%n $1 $2", 3, { 0, 0, 0 } },
|
{ "own_ctcp", "%K[%rctcp%K(%R$0%K)]%n $1 $2", 3, { 0, 0, 0 } },
|
||||||
|
{ "own_wall", "%K[%WWall%K/%c$0%K]%n $1", 2, { 0, 0 } },
|
||||||
|
|
||||||
/* ---- */
|
/* ---- */
|
||||||
{ NULL, "Received messages", 0 },
|
{ NULL, "Received messages", 0 },
|
||||||
|
@ -116,6 +116,7 @@ enum {
|
|||||||
IRCTXT_OWN_NOTICE,
|
IRCTXT_OWN_NOTICE,
|
||||||
IRCTXT_OWN_ME,
|
IRCTXT_OWN_ME,
|
||||||
IRCTXT_OWN_CTCP,
|
IRCTXT_OWN_CTCP,
|
||||||
|
IRCTXT_OWN_WALL,
|
||||||
|
|
||||||
IRCTXT_FILL_7,
|
IRCTXT_FILL_7,
|
||||||
|
|
||||||
|
@ -547,7 +547,7 @@ static void cmd_wall_hash(gpointer key, NICK_REC *nick, GSList **nicks)
|
|||||||
|
|
||||||
static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item)
|
static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item)
|
||||||
{
|
{
|
||||||
char *params, *channame, *msg;
|
char *params, *channame, *msg, *args;
|
||||||
CHANNEL_REC *chanrec;
|
CHANNEL_REC *chanrec;
|
||||||
GSList *tmp, *nicks;
|
GSList *tmp, *nicks;
|
||||||
|
|
||||||
@ -565,11 +565,17 @@ static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item)
|
|||||||
nicks = NULL;
|
nicks = NULL;
|
||||||
g_hash_table_foreach(chanrec->nicks, (GHFunc) cmd_wall_hash, &nicks);
|
g_hash_table_foreach(chanrec->nicks, (GHFunc) cmd_wall_hash, &nicks);
|
||||||
|
|
||||||
|
args = g_strconcat(chanrec->name, " ", msg, NULL);
|
||||||
|
msg = parse_special_string(settings_get_str("wall_format"), server, item, args, NULL);
|
||||||
|
g_free(args);
|
||||||
|
|
||||||
for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
|
for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
|
||||||
NICK_REC *rec = tmp->data;
|
NICK_REC *rec = tmp->data;
|
||||||
|
|
||||||
|
if (g_strcasecmp(rec->nick, server->nick) != 0)
|
||||||
irc_send_cmdv(server, "NOTICE %s :%s", rec->nick, msg);
|
irc_send_cmdv(server, "NOTICE %s :%s", rec->nick, msg);
|
||||||
}
|
}
|
||||||
|
g_free(msg);
|
||||||
g_slist_free(nicks);
|
g_slist_free(nicks);
|
||||||
|
|
||||||
g_free(params);
|
g_free(params);
|
||||||
@ -772,6 +778,7 @@ void irc_commands_init(void)
|
|||||||
|
|
||||||
settings_add_str("misc", "quit_message", "leaving");
|
settings_add_str("misc", "quit_message", "leaving");
|
||||||
settings_add_int("misc", "knockout_time", 300);
|
settings_add_int("misc", "knockout_time", 300);
|
||||||
|
settings_add_str("misc", "wall_format", "[Wall/$0] $1");
|
||||||
|
|
||||||
knockout_tag = g_timeout_add(KNOCKOUT_TIMECHECK, (GSourceFunc) knockout_timeout, NULL);
|
knockout_tag = g_timeout_add(KNOCKOUT_TIMECHECK, (GSourceFunc) knockout_timeout, NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user