diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-09-23 09:57:45 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-09-23 09:57:45 +0000 |
commit | 068284dd19b8a506d23694b6a5a46ff7f3ecc569 (patch) | |
tree | e24399ae7a6a38849df75f8a2c2472912c594cd8 /src/irc | |
parent | 38a8c321c0570fb7cc010697164b2d4f7208838c (diff) | |
download | weechat-068284dd19b8a506d23694b6a5a46ff7f3ecc569.zip |
Added /ame command (send CTCP action to all channels of all connected servers)
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/irc-commands.c | 6 | ||||
-rw-r--r-- | src/irc/irc-send.c | 41 | ||||
-rw-r--r-- | src/irc/irc.h | 1 |
3 files changed, 47 insertions, 1 deletions
diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c index 5cfc0e784..9f8ac9fe5 100644 --- a/src/irc/irc-commands.c +++ b/src/irc/irc-commands.c @@ -35,6 +35,10 @@ t_irc_command irc_commands[] = N_("[target]"), N_("target: server"), 0, 1, 1, NULL, irc_cmd_send_admin, NULL }, + { "ame", N_("send a CTCP action to all channels of all connected servers"), + N_("message"), + N_("message: message to send"), + 1, MAX_ARGS, 1, NULL, irc_cmd_send_ame, NULL }, { "amsg", N_("send message to all channels of all connected servers"), N_("text"), N_("text: text to send"), @@ -126,7 +130,7 @@ t_irc_command irc_commands[] = N_("mask: servers matching the mask only\n" "target: server for forwarding request"), 0, 2, 1, NULL, irc_cmd_send_lusers, NULL }, - { "me", N_("send a ctcp action to the current channel"), + { "me", N_("send a CTCP action to the current channel"), N_("message"), N_("message: message to send"), 0, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL }, diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c index 854e73311..9e8e2e0ab 100644 --- a/src/irc/irc-send.c +++ b/src/irc/irc-send.c @@ -83,6 +83,47 @@ irc_cmd_send_admin (t_irc_server *server, char *arguments) } /* + * irc_cmd_send_ame: send a ctcp action to all channels of all connected servers + */ + +int +irc_cmd_send_ame (t_irc_server *server, char *arguments) +{ + t_irc_server *ptr_server; + t_irc_channel *ptr_channel; + + /* make gcc happy */ + (void) server; + + gui_add_hotlist = 0; + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + if (ptr_server->is_connected) + { + for (ptr_channel = ptr_server->channels; ptr_channel; + ptr_channel = ptr_channel->next_channel) + { + if (ptr_channel->type == CHAT_CHANNEL) + { + server_sendf (ptr_server, "PRIVMSG %s :\01ACTION %s\01\r\n", + ptr_channel->name, + (arguments && arguments[0]) ? arguments : ""); + irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME); + gui_printf_color (ptr_channel->buffer, + COLOR_WIN_CHAT_NICK, "%s", ptr_server->nick); + gui_printf_color (ptr_channel->buffer, + COLOR_WIN_CHAT, " %s\n", + (arguments && arguments[0]) ? arguments : ""); + } + } + } + } + gui_add_hotlist = 1; + return 0; +} + +/* * irc_cmd_send_amsg: send message to all channels of all connected servers */ diff --git a/src/irc/irc.h b/src/irc/irc.h index 51696b5fd..2e3df2f70 100644 --- a/src/irc/irc.h +++ b/src/irc/irc.h @@ -384,6 +384,7 @@ extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *); extern void irc_login (t_irc_server *); /* IRC commands issued by user */ extern int irc_cmd_send_admin (t_irc_server *, char *); +extern int irc_cmd_send_ame (t_irc_server *, char *); extern int irc_cmd_send_amsg (t_irc_server *, char *); extern int irc_cmd_send_away (t_irc_server *, char *); extern int irc_cmd_send_ban (t_irc_server *, char *); |