1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 05:46:38 +02:00

Add IRC command /wallchops, fix bug with display of notice for ops (task #10021, bug #29932)

This commit is contained in:
Sebastien Helleu
2010-05-23 10:01:38 +02:00
parent 3c17e9e272
commit 7bb9892e86
17 changed files with 351 additions and 20 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
FlashCode <flashcode@flashtux.org>
v0.3.3-dev, 2010-05-22
v0.3.3-dev, 2010-05-23
Version 0.3.3 (under dev!)
@@ -13,6 +13,8 @@ Version 0.3.3 (under dev!)
process)
* api: add function "string_expand_home", fix bug with replacement of home in
paths
* irc: add command /wallchops, fix bug with display of notice for ops
(task #10021, bug #29932)
* irc: add isupport value in servers (content of IRC message 005), with new
infos: irc_server_isupport and irc_server_isupport_value
* irc: add message in private buffer when nick is back on server after a /quit
+9
View File
@@ -646,6 +646,15 @@
give voice to nickname(s)
........................................
&bull; *`/wallchops`* `[channel] text`::
........................................
send a notice to channel ops
channel: channel name
test: text to send
........................................
&bull; *`/wallops`* `text`::
........................................
+9
View File
@@ -646,6 +646,15 @@
donne la voix à/aux pseudo(s)
........................................
&bull; *`/wallchops`* `[canal] texte`::
........................................
envoyer une notice aux opérateurs du canal
canal: nom du canal
texte: texte à envoyer
........................................
&bull; *`/wallops`* `texte`::
........................................
+9
View File
@@ -646,6 +646,15 @@
concede il voice ad uno (o più) utenti
........................................
&bull; *`/wallchops`* `[channel] text`::
........................................
send a notice to channel ops
channel: channel name
test: text to send
........................................
&bull; *`/wallops`* `testo`::
........................................
+21 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-05-22 09:52+0200\n"
"POT-Creation-Date: 2010-05-23 09:58+0200\n"
"PO-Revision-Date: 2010-05-20 12:20+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3206,6 +3206,10 @@ msgstr ""
msgid "%s%s: wrong argument count for \"%s\" command"
msgstr "%s%s: špatný počet parametrů pro příkaz \"%s\""
#, fuzzy, c-format
msgid "%s%s: you are not on channel \"%s\""
msgstr "%s%s: nemohu vytvořit nový kanál \"%s\""
msgid "find information about the administrator of the server"
msgstr "najít informace o administrátorovi serveru"
@@ -4131,6 +4135,22 @@ msgstr ""
msgid "give voice to nickname(s)"
msgstr "dá hlas přezdívce (přezdívkám)"
#, fuzzy
msgid "send a notice to channel ops"
msgstr "poslat zprávu přezdívce nebo kanálu"
#, fuzzy
msgid "[channel] text"
msgstr "[kanál] [téma]"
#, fuzzy
msgid ""
"channel: channel name\n"
" test: text to send"
msgstr ""
"kanál: jméno kanálu\n"
" mód: mód pro kanál"
msgid ""
"send a message to all currently connected users who have set the 'w' user "
"mode for themselves"
+21 -1
View File
@@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-05-22 09:52+0200\n"
"POT-Creation-Date: 2010-05-23 09:58+0200\n"
"PO-Revision-Date: 2010-05-22 22:28+0200\n"
"Last-Translator: Nils G <weechatter@arcor.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3338,6 +3338,10 @@ msgstr ""
msgid "%s%s: wrong argument count for \"%s\" command"
msgstr "%s%s: Fehlerhafte Anzahl von Argumenten für den Befehl \"%s\""
#, fuzzy, c-format
msgid "%s%s: you are not on channel \"%s\""
msgstr "%s%s: Konnte den neuen Channel \"%s\" nicht erzeugen"
msgid "find information about the administrator of the server"
msgstr "Information über den Server-Administrator abfragen"
@@ -4284,6 +4288,22 @@ msgstr ""
msgid "give voice to nickname(s)"
msgstr "Voice an Nickname(n) vergeben"
#, fuzzy
msgid "send a notice to channel ops"
msgstr "Nachricht an Nick/Channel verschicken"
#, fuzzy
msgid "[channel] text"
msgstr "[Channel] [Topic]"
#, fuzzy
msgid ""
"channel: channel name\n"
" test: text to send"
msgstr ""
"Channel: Name des Channel\n"
" Mode: neuer Modus für Channel"
msgid ""
"send a message to all currently connected users who have set the 'w' user "
"mode for themselves"
+21 -1
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-05-22 09:52+0200\n"
"POT-Creation-Date: 2010-05-23 09:58+0200\n"
"PO-Revision-Date: 2010-05-20 12:31+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3255,6 +3255,10 @@ msgstr ""
msgid "%s%s: wrong argument count for \"%s\" command"
msgstr "%s%s: número de argumentos incorrecto para el comando \"%s\""
#, fuzzy, c-format
msgid "%s%s: you are not on channel \"%s\""
msgstr "%s%s: no es posible crear el nuevo canal \"%s\""
msgid "find information about the administrator of the server"
msgstr "busca información sobre el administrador del servidor"
@@ -4186,6 +4190,22 @@ msgstr ""
msgid "give voice to nickname(s)"
msgstr "da voz a el/los apodo(s)"
#, fuzzy
msgid "send a notice to channel ops"
msgstr "envía mensaje a un usuario o canal"
#, fuzzy
msgid "[channel] text"
msgstr "[canal] [tema]"
#, fuzzy
msgid ""
"channel: channel name\n"
" test: text to send"
msgstr ""
"canal: nombre del canal\n"
" modo: modo para el canal"
msgid ""
"send a message to all currently connected users who have set the 'w' user "
"mode for themselves"
+19 -2
View File
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-05-22 09:52+0200\n"
"PO-Revision-Date: 2010-05-22 09:53+0200\n"
"POT-Creation-Date: 2010-05-23 09:58+0200\n"
"PO-Revision-Date: 2010-05-23 09:44+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -3285,6 +3285,10 @@ msgstr ""
msgid "%s%s: wrong argument count for \"%s\" command"
msgstr "%s%s: nombre de paramètres erroné pour la commande \"%s\""
#, c-format
msgid "%s%s: you are not on channel \"%s\""
msgstr "%s%s: vous n'êtes pas sur le canal \"%s\""
msgid "find information about the administrator of the server"
msgstr "trouver les informations sur l'administrateur du serveur"
@@ -4225,6 +4229,19 @@ msgstr ""
msgid "give voice to nickname(s)"
msgstr "donne la voix à/aux pseudo(s)"
msgid "send a notice to channel ops"
msgstr "envoyer une notice aux opérateurs du canal"
msgid "[channel] text"
msgstr "[canal] texte"
msgid ""
"channel: channel name\n"
" test: text to send"
msgstr ""
"canal: nom du canal\n"
"texte: texte à envoyer"
msgid ""
"send a message to all currently connected users who have set the 'w' user "
"mode for themselves"
+21 -1
View File
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-05-22 09:52+0200\n"
"POT-Creation-Date: 2010-05-23 09:58+0200\n"
"PO-Revision-Date: 2010-05-20 12:20+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3051,6 +3051,10 @@ msgstr ""
msgid "%s%s: wrong argument count for \"%s\" command"
msgstr "%s rossz argumentum szám a \"%s\" parancsnak\n"
#, fuzzy, c-format
msgid "%s%s: you are not on channel \"%s\""
msgstr "%s nem sikerült új szobát nyitni \"%s\"\n"
msgid "find information about the administrator of the server"
msgstr "információ lekérdezése a szerver adminisztrátorról"
@@ -3935,6 +3939,22 @@ msgstr ""
msgid "give voice to nickname(s)"
msgstr "voice jog biztosítása a felhasználó(k)nak"
#, fuzzy
msgid "send a notice to channel ops"
msgstr "üzenet küldése egy felhasználónak vagy szobának"
#, fuzzy
msgid "[channel] text"
msgstr "[szoba] [téma]"
#, fuzzy
msgid ""
"channel: channel name\n"
" test: text to send"
msgstr ""
"szoba: a szoba neve, ahová csatlakozni szeretnénk\n"
"kulcs: a csatlakozáshoz szükséges kulcs"
msgid ""
"send a message to all currently connected users who have set the 'w' user "
"mode for themselves"
+21 -1
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Weechat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-05-22 09:52+0200\n"
"POT-Creation-Date: 2010-05-23 09:58+0200\n"
"PO-Revision-Date: 2010-05-20 12:26+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3261,6 +3261,10 @@ msgstr ""
msgid "%s%s: wrong argument count for \"%s\" command"
msgstr "%s%s: argomento contatore errato per il comando \"%s\""
#, fuzzy, c-format
msgid "%s%s: you are not on channel \"%s\""
msgstr "%s%s: impossibile creare il nuovo canale \"%s\""
msgid "find information about the administrator of the server"
msgstr "informazioni sull'amministratore del server"
@@ -4193,6 +4197,22 @@ msgstr ""
msgid "give voice to nickname(s)"
msgstr "concede il voice ad uno (o più) utenti"
#, fuzzy
msgid "send a notice to channel ops"
msgstr "invia un messaggio ad un nick o a un canale"
#, fuzzy
msgid "[channel] text"
msgstr "[canale] [argomento]"
#, fuzzy
msgid ""
"channel: channel name\n"
" test: text to send"
msgstr ""
"canale: nome del canale\n"
"modalità: modalità per il canale"
msgid ""
"send a message to all currently connected users who have set the 'w' user "
"mode for themselves"
+21 -1
View File
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-05-22 09:52+0200\n"
"POT-Creation-Date: 2010-05-23 09:58+0200\n"
"PO-Revision-Date: 2010-05-20 12:22+0200\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3246,6 +3246,10 @@ msgstr ""
msgid "%s%s: wrong argument count for \"%s\" command"
msgstr "%s%s: niewłaściwa ilość argumentów dla komędy \"%s\" "
#, fuzzy, c-format
msgid "%s%s: you are not on channel \"%s\""
msgstr "%s%s: nie można utworzyć nowego kanału \"%s\""
msgid "find information about the administrator of the server"
msgstr "wyszukuje informacje o administratorze serwera"
@@ -4172,6 +4176,22 @@ msgstr ""
msgid "give voice to nickname(s)"
msgstr "daje głos (voice) nickowi"
#, fuzzy
msgid "send a notice to channel ops"
msgstr "wysyła wiadomość do użytkownika albo kanału"
#, fuzzy
msgid "[channel] text"
msgstr "[kanał] [temat]"
#, fuzzy
msgid ""
"channel: channel name\n"
" test: text to send"
msgstr ""
"kanał: nazwa kanału\n"
" atrybuty: atrybuty kanału"
msgid ""
"send a message to all currently connected users who have set the 'w' user "
"mode for themselves"
+21 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-05-22 09:52+0200\n"
"POT-Creation-Date: 2010-05-23 09:58+0200\n"
"PO-Revision-Date: 2010-05-20 12:22+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3062,6 +3062,10 @@ msgstr ""
msgid "%s%s: wrong argument count for \"%s\" command"
msgstr "%s некорректное количество аргументов команды \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: you are not on channel \"%s\""
msgstr "%s не могу создать новый канал \"%s\"\n"
msgid "find information about the administrator of the server"
msgstr "найти информацию об администрации сервера"
@@ -3938,6 +3942,22 @@ msgstr ""
msgid "give voice to nickname(s)"
msgstr "даёт право голоса нику(-ам)"
#, fuzzy
msgid "send a notice to channel ops"
msgstr "отправить сообщение нику или на канал"
#, fuzzy
msgid "[channel] text"
msgstr "[канал] [тема]"
#, fuzzy
msgid ""
"channel: channel name\n"
" test: text to send"
msgstr ""
"канал: название канала\n"
" ключ: ключ для входа на канал"
msgid ""
"send a message to all currently connected users who have set the 'w' user "
"mode for themselves"
+16 -1
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-05-22 09:52+0200\n"
"POT-Creation-Date: 2010-05-23 09:58+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -2671,6 +2671,10 @@ msgstr ""
msgid "%s%s: wrong argument count for \"%s\" command"
msgstr ""
#, c-format
msgid "%s%s: you are not on channel \"%s\""
msgstr ""
msgid "find information about the administrator of the server"
msgstr ""
@@ -3371,6 +3375,17 @@ msgstr ""
msgid "give voice to nickname(s)"
msgstr ""
msgid "send a notice to channel ops"
msgstr ""
msgid "[channel] text"
msgstr ""
msgid ""
"channel: channel name\n"
" test: text to send"
msgstr ""
msgid ""
"send a message to all currently connected users who have set the 'w' user "
"mode for themselves"
+120 -3
View File
@@ -1233,7 +1233,7 @@ irc_command_devoice (void *data, struct t_gui_buffer *buffer, int argc,
}
/*
* irc_command_die: shotdown the server
* irc_command_die: shutdown the server
*/
int
@@ -3992,7 +3992,8 @@ irc_command_users (void *data, struct t_gui_buffer *buffer, int argc,
}
/*
* irc_command_version: gives the version info of nick or server (current or specified)
* irc_command_version: gives the version info of nick or server (current or
* specified)
*/
int
@@ -4069,9 +4070,119 @@ irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
/*
* irc_command_wallchops: send a notice to channel ops
*/
int
irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *pos_channel;
int pos_args;
const char *support_wallchops, *support_statusmsg;
struct t_irc_nick *ptr_nick;
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("wallchops", 1);
/* make C compiler happy */
(void) data;
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
{
pos_channel = argv[1];
pos_args = 2;
}
else
{
pos_channel = NULL;
pos_args = 1;
}
/* channel not given, use default buffer */
if (!pos_channel)
{
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
pos_channel = ptr_channel->name;
else
{
weechat_printf (ptr_server->buffer,
_("%s%s: \"%s\" command can only be "
"executed in a channel buffer"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"wallchops");
return WEECHAT_RC_OK;
}
}
ptr_channel = irc_channel_search (ptr_server, pos_channel);
if (!ptr_channel)
{
weechat_printf (ptr_server->buffer,
_("%s%s: you are not on channel \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
pos_channel);
return WEECHAT_RC_OK;
}
weechat_printf (ptr_channel->buffer,
"%s%sNoticeOp%s -> %s%s%s: %s",
weechat_prefix ("network"),
IRC_COLOR_NOTICE,
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_CHANNEL,
ptr_channel->name,
IRC_COLOR_CHAT,
argv_eol[pos_args]);
support_wallchops = irc_server_get_isupport_value (ptr_server,
"WALLCHOPS");
support_statusmsg = irc_server_get_isupport_value (ptr_server,
"STATUSMSG");
if (support_wallchops
|| (support_statusmsg && strchr (support_statusmsg, '@')))
{
/*
* if WALLCHOPS is supported, or if STATUSMSG includes '@',
* then send a notice to @#channel
*/
irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH,
"NOTICE @%s :%s",
ptr_channel->name, argv_eol[pos_args]);
}
else
{
/*
* if WALLCHOPS is not supported and '@' not in STATUSMSG,
* then send a notice to each op of channel
*/
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
if (IRC_NICK_IS_OP(ptr_nick)
&& (strcmp (ptr_nick->name, ptr_server->nick) != 0))
{
irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_LOW,
"NOTICE %s :%s",
ptr_nick->name, argv_eol[pos_args]);
}
}
}
}
else
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "wallchops");
}
return WEECHAT_RC_OK;
}
/*
* irc_command_wallops: send a message to all currently connected users who
* have set the 'w' user mode for themselves
* have set the 'w' user mode for themselves
*/
int
@@ -4771,6 +4882,12 @@ irc_command_init ()
N_("[nickname [nickname]]"),
"",
"%(nicks)|%*", &irc_command_voice, NULL);
weechat_hook_command ("wallchops",
N_("send a notice to channel ops"),
N_("[channel] text"),
N_("channel: channel name\n"
" test: text to send"),
NULL, &irc_command_wallchops, NULL);
weechat_hook_command ("wallops",
N_("send a message to all currently connected users "
"who have set the 'w' user mode for themselves"),
+1 -4
View File
@@ -517,10 +517,7 @@ irc_nick_count (struct t_irc_channel *channel, int *total, int *count_op,
ptr_nick = ptr_nick->next_nick)
{
(*total)++;
if ((ptr_nick->flags & IRC_NICK_CHANOWNER) ||
(ptr_nick->flags & IRC_NICK_CHANADMIN) ||
(ptr_nick->flags & IRC_NICK_CHANADMIN2) ||
(ptr_nick->flags & IRC_NICK_OP))
if (IRC_NICK_IS_OP(ptr_nick))
(*count_op)++;
else
{
+6
View File
@@ -38,6 +38,12 @@
else \
nick->flags &= 0xFFFF - flag;
#define IRC_NICK_IS_OP(__nick) \
((__nick->flags & IRC_NICK_CHANOWNER) || \
(__nick->flags & IRC_NICK_CHANADMIN) || \
(__nick->flags & IRC_NICK_CHANADMIN2) || \
(__nick->flags & IRC_NICK_OP))
#define IRC_NICK_GROUP_CHANOWNER "01|chanowner"
#define IRC_NICK_GROUP_CHANADMIN "02|chanadmin"
#define IRC_NICK_GROUP_CHANADMIN2 "03|chanadmin2"
+12 -2
View File
@@ -994,7 +994,7 @@ IRC_PROTOCOL_CALLBACK(notice)
char *pos_target, *pos_args;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
int notify_private;
int notify_private, notice_op;
struct t_gui_buffer *ptr_buffer;
/*
@@ -1009,10 +1009,19 @@ IRC_PROTOCOL_CALLBACK(notice)
if (ignored)
return WEECHAT_RC_OK;
notice_op = 0;
if (argv[0][0] == ':')
{
pos_target = argv[2];
if ((pos_target[0] == '@') && (irc_channel_is_channel (pos_target + 1)))
{
pos_target++;
notice_op = 1;
}
pos_args = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
if (notice_op && (pos_args[0] == '@') && (pos_args[1] == ' '))
pos_args += 2;
}
else
{
@@ -1034,9 +1043,10 @@ IRC_PROTOCOL_CALLBACK(notice)
ptr_nick = irc_nick_search (ptr_channel, nick);
weechat_printf_tags ((ptr_channel) ? ptr_channel->buffer : server->buffer,
irc_protocol_tags (command, "notify_message"),
"%s%sNotice%s(%s%s%s)%s: %s",
"%s%sNotice%s%s(%s%s%s)%s: %s",
weechat_prefix ("network"),
IRC_COLOR_NOTICE,
(notice_op) ? "Op" : "",
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick),
(nick && nick[0]) ? nick : "?",