summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-08-26 18:57:21 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-08-26 18:57:21 +0200
commitdd0c20f6b6e3c500fff7da78123f55bd871dc0fd (patch)
treea5e7e081f078e64adfd2ebc4d186f8217936ed0c
parent42c925b67287f59d1b8962aa34c2ee9313382049 (diff)
downloadweechat-dd0c20f6b6e3c500fff7da78123f55bd871dc0fd.zip
irc: add count for all nick modes in output of `/names` (closes #97)
-rw-r--r--ChangeLog.adoc1
-rw-r--r--po/cs.po19
-rw-r--r--po/de.po20
-rw-r--r--po/es.po17
-rw-r--r--po/fr.po19
-rw-r--r--po/hu.po19
-rw-r--r--po/it.po17
-rw-r--r--po/ja.po15
-rw-r--r--po/pl.po26
-rw-r--r--po/pt.po17
-rw-r--r--po/pt_BR.po17
-rw-r--r--po/ru.po21
-rw-r--r--po/sr.po22
-rw-r--r--po/tr.po24
-rw-r--r--po/weechat.pot17
-rw-r--r--src/plugins/irc/irc-command.c2
-rw-r--r--src/plugins/irc/irc-nick.c81
-rw-r--r--src/plugins/irc/irc-nick.h10
-rw-r--r--src/plugins/irc/irc-protocol.c345
-rw-r--r--tests/unit/plugins/irc/test-irc-nick.cpp4
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp25
21 files changed, 414 insertions, 324 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index d6af00f7a..5dcf1c3f5 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -25,6 +25,7 @@ New features::
* buflist: increase max number of buflist items from 3 to 5 (issue #1703)
* fset: add variable `allowed_values` in options, add options fset.color.allowed_values and fset.color.allowed_values_selected
* fset: allow long type name in type filter
+ * irc: add count for all nick modes in output of `/names` (issue #97)
* irc: compute color in case insensitive way, reintroduce infos "irc_nick_color" and "irc_nick_color_name", add support of server name (issue #194)
* irc: add buffer for /list reply, add options irc.color.list_buffer_line_selected, irc.color.list_buffer_line_selected_bg, irc.look.list_buffer_sort, irc.look.list_buffer_scroll_horizontal, irc.look.new_list_position, irc.look.list_buffer_topic_strip_colors (issue #1972)
* irc: display commands 716/717 in private buffer (if present) (issue #146)
diff --git a/po/cs.po b/po/cs.po
index 5898e9d48..fa2bae872 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10301,9 +10301,12 @@ msgstr "%s%s: nemohu vytvořit přezdívku \"%s\" pro kanál \"%s\""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sPřezdívka %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sPřezdívka %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] ""
+msgstr[1] ""
+msgstr[2] ""
msgid "op"
msgid_plural "ops"
@@ -10326,13 +10329,9 @@ msgstr[0] "voiců"
msgstr[1] "voice"
msgstr[2] "voiců"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] ""
-msgstr[1] ""
-msgstr[2] ""
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sPřezdívka %s%s%s: %s[%s%s]"
#, fuzzy, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/de.po b/po/de.po
index 20b444565..9994aafe0 100644
--- a/po/de.po
+++ b/po/de.po
@@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-08-24 13:36+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -12779,9 +12779,14 @@ msgstr ""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sNicks %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sNicks %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+#, fuzzy
+#| msgid "%s%s%d%s regular"
+#| msgid_plural "%s%s%d%s regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] "%s%s%d%s regulär"
+msgstr[1] "%s%s%d%s reguläre"
msgid "op"
msgid_plural "ops"
@@ -12798,12 +12803,9 @@ msgid_plural "voiced"
msgstr[0] "Stimme"
msgstr[1] "Stimmen"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] "%s%s%d%s regulär"
-msgstr[1] "%s%s%d%s reguläre"
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sNicks %s%s%s: %s[%s%s]"
#, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/es.po b/po/es.po
index 960f4f063..1893e04a1 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -11042,9 +11042,11 @@ msgstr "%s%s: no es posible crear el apodo \"%s\" para el canal \"%s\""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sApodos %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sApodos %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] ""
+msgstr[1] ""
msgid "op"
msgid_plural "ops"
@@ -11064,12 +11066,9 @@ msgid_plural "voiced"
msgstr[0] "voz"
msgstr[1] "voces"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] ""
-msgstr[1] ""
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sApodos %s%s%s: %s[%s%s]"
# dunno what reop means
#, fuzzy, c-format
diff --git a/po/fr.po b/po/fr.po
index b77dc2d1d..86c7121e9 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
-"PO-Revision-Date: 2023-08-25 13:31+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
+"PO-Revision-Date: 2023-08-26 15:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -12459,9 +12459,11 @@ msgstr "%s%s : impossible de créer le pseudo \"%s\" pour le canal \"%s\""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sPseudos %s%s%s : %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sPseudos %s%s%s : %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] "régulier"
+msgstr[1] "réguliers"
msgid "op"
msgid_plural "ops"
@@ -12478,12 +12480,9 @@ msgid_plural "voiced"
msgstr[0] "avec voix"
msgstr[1] "avec voix"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] "%s%s%d%s régulier"
-msgstr[1] "%s%s%d%s réguliers"
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sPseudos %s%s%s : %s[%s%s]"
#, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/hu.po b/po/hu.po
index c15e86d61..e780ab22d 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9738,9 +9738,11 @@ msgstr "%s nem sikerült a(z) \"%s\" nevet felvenni a \"%s\" szobában\n"
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%s Szerver: %s%s %s[%s%s%s]\n"
-#, fuzzy, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%s Szerver: %s%s %s[%s%s%s]\n"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] ""
+msgstr[1] ""
#, fuzzy
msgid "op"
@@ -9760,12 +9762,9 @@ msgid_plural "voiced"
msgstr[0] "voice"
msgstr[1] "voice"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
-#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] ""
-msgstr[1] ""
+#, fuzzy, c-format
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%s Szerver: %s%s %s[%s%s%s]\n"
#, fuzzy, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/it.po b/po/it.po
index f1f20598e..68df303a1 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10770,9 +10770,11 @@ msgstr "%s%s: impossibile creare il nick \"%s\" per il canale \"%s\""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sNick %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sNick %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] ""
+msgstr[1] ""
msgid "op"
msgid_plural "ops"
@@ -10792,12 +10794,9 @@ msgid_plural "voiced"
msgstr[0] "voice"
msgstr[1] "voice"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] ""
-msgstr[1] ""
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sNick %s%s%s: %s[%s%s]"
#, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/ja.po b/po/ja.po
index 26a440dd3..cc0b41692 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-08-08 07:13+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -12011,9 +12011,10 @@ msgstr "%s%s: ニックネーム \"%s\" をチャンネル \"%s\" に作れま
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sニックネーム %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sニックネーム %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] ""
msgid "op"
msgid_plural "ops"
@@ -12030,11 +12031,9 @@ msgid "voiced"
msgid_plural "voiced"
msgstr[0] "発言"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] ""
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sニックネーム %s%s%s: %s[%s%s]"
#, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/pl.po b/po/pl.po
index 99a81f0c7..f9f5c349e 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-08-08 07:13+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@@ -13218,9 +13218,15 @@ msgstr "%s%s: nie można utworzyć nicka \"%s\" dla kanału \"%s\""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sNicki %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sNicki %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+#, fuzzy
+#| msgid "%s%s%d%s normal"
+#| msgid_plural "%s%s%d%s normals"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] "%s%s%d%s normal"
+msgstr[1] "%s%s%d%s normals"
+msgstr[2] "%s%s%d%s normals"
msgid "op"
msgid_plural "ops"
@@ -13243,15 +13249,9 @@ msgstr[0] "voice"
msgstr[1] "voice"
msgstr[2] "voice"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
-#, fuzzy, c-format
-#| msgid "%s%s%d%s normal"
-#| msgid_plural "%s%s%d%s normals"
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] "%s%s%d%s normal"
-msgstr[1] "%s%s%d%s normals"
-msgstr[2] "%s%s%d%s normals"
+#, c-format
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sNicki %s%s%s: %s[%s%s]"
#, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/pt.po b/po/pt.po
index 6995ccfcc..426861e4b 100644
--- a/po/pt.po
+++ b/po/pt.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -11724,9 +11724,11 @@ msgstr "%s%s: não é possível criar o nick \"%s\" do canal \"%s\""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sNicks %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sNicks %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] ""
+msgstr[1] ""
msgid "op"
msgid_plural "ops"
@@ -11746,12 +11748,9 @@ msgid_plural "voiced"
msgstr[0] "voz"
msgstr[1] "vozes"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] ""
-msgstr[1] ""
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sNicks %s%s%s: %s[%s%s]"
#, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index d7385b05b..61ee654bf 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10308,9 +10308,11 @@ msgstr "%s%s: não foi possível criar apelido \"%s\" para o canal \"%s\""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sApelidos: %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sApelidos %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] ""
+msgstr[1] ""
msgid "op"
msgid_plural "ops"
@@ -10327,12 +10329,9 @@ msgid_plural "voiced"
msgstr[0] ""
msgstr[1] ""
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] ""
-msgstr[1] ""
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sApelidos %s%s%s: %s[%s%s]"
#, fuzzy, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/ru.po b/po/ru.po
index abe835355..66c061d60 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9778,9 +9778,12 @@ msgstr "%s не могу создать ник \"%s\" для канала \"%s\"
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sСервер: %s%s %s[%s%s%s]\n"
-#, fuzzy, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sСервер: %s%s %s[%s%s%s]\n"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] ""
+msgstr[1] ""
+msgstr[2] ""
#, fuzzy
msgid "op"
@@ -9803,13 +9806,9 @@ msgstr[0] "войс"
msgstr[1] "войс"
msgstr[2] "войс"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
-#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] ""
-msgstr[1] ""
-msgstr[2] ""
+#, fuzzy, c-format
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sСервер: %s%s %s[%s%s%s]\n"
#, fuzzy, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/sr.po b/po/sr.po
index 0a60f962d..f59f55c8c 100644
--- a/po/sr.po
+++ b/po/sr.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-08-08 07:14+0200\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -12293,9 +12293,15 @@ msgstr "%s%s: није могуће креирање надимка „%s” з
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sНадимци %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sНадимци %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+#, fuzzy
+#| msgid "%s%s%d%s regular"
+#| msgid_plural "%s%s%d%s regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] "%s%s%d%s обичан"
+msgstr[1] "%s%s%d%s обична"
+msgstr[2] "%s%s%d%s обичних"
msgid "op"
msgid_plural "ops"
@@ -12315,13 +12321,9 @@ msgstr[0] "говори"
msgstr[1] "говоре"
msgstr[2] "говори"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] "%s%s%d%s обичан"
-msgstr[1] "%s%s%d%s обична"
-msgstr[2] "%s%s%d%s обичних"
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sНадимци %s%s%s: %s[%s%s]"
#, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/tr.po b/po/tr.po
index f352c73a0..157f05a08 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2023-08-08 07:14+0200\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -12703,9 +12703,14 @@ msgstr "%s%s: şu kanal için \"%s\" takma adı oluşturulamıyor: \"%s\""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sTakma adlar %s%s%s: %s[%s%s%s]"
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr "%sTakma adlar %s%s%s: %s[%s%s]"
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+#, fuzzy
+#| msgid "%s%s%d%s normal"
+#| msgid_plural "%s%s%d%s normals"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] "%s%s%d%s normal kullanıcı"
+msgstr[1] "%s%s%d%s normal kullanıcı"
msgid "op"
msgid_plural "ops"
@@ -12725,14 +12730,9 @@ msgid_plural "voiced"
msgstr[0] "yardımcı"
msgstr[1] "yardımcı"
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
-#, fuzzy, c-format
-#| msgid "%s%s%d%s normal"
-#| msgid_plural "%s%s%d%s normals"
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] "%s%s%d%s normal kullanıcı"
-msgstr[1] "%s%s%d%s normal kullanıcı"
+#, c-format
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr "%sTakma adlar %s%s%s: %s[%s%s]"
#, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/po/weechat.pot b/po/weechat.pot
index 149317bec..df50bbc6a 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-08-25 13:26+0200\n"
+"POT-Creation-Date: 2023-08-26 15:27+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8775,9 +8775,11 @@ msgstr ""
msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr ""
-#, c-format
-msgid "%sNicks %s%s%s: %s[%s%s]"
-msgstr ""
+#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
+msgid "regular"
+msgid_plural "regular"
+msgstr[0] ""
+msgstr[1] ""
msgid "op"
msgid_plural "ops"
@@ -8794,12 +8796,9 @@ msgid_plural "voiced"
msgstr[0] ""
msgstr[1] ""
-#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#, c-format
-msgid "%s%s%d%s regular"
-msgid_plural "%s%s%d%s regular"
-msgstr[0] ""
-msgstr[1] ""
+msgid "%sNicks %s%s%s: %s[%s%s]"
+msgstr ""
#, c-format
msgid "%sChannel %s%s%s: %s%d%s %s %s(%s%s)"
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 1b0785ab4..86ba9859a 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -6657,7 +6657,7 @@ IRC_COMMAND_CALLBACK(wallchops)
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
- if (irc_nick_is_op (ptr_server, ptr_nick)
+ if (irc_nick_is_op_or_higher (ptr_server, ptr_nick)
&& (irc_server_strcasecmp (ptr_server,
ptr_nick->name,
ptr_server->nick) != 0))
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index 286907999..b56666ce2 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -282,16 +282,15 @@ irc_nick_set_host (struct t_irc_nick *nick, const char *host)
}
/*
- * Checks if nick is "op" (or better than "op", for example channel admin or
- * channel owner).
+ * Checks if nick is "op" or higher than "op", like channel admin/owner.
*
* Returns:
- * 1: nick is "op" (or better)
+ * 1: nick is "op" or higher
* 0: nick is not op
*/
int
-irc_nick_is_op (struct t_irc_server *server, struct t_irc_nick *nick)
+irc_nick_is_op_or_higher (struct t_irc_server *server, struct t_irc_nick *nick)
{
int index;
@@ -860,44 +859,66 @@ irc_nick_search (struct t_irc_server *server, struct t_irc_channel *channel,
}
/*
- * Returns number of nicks (total, ops, halfops, voiced, regular) on a channel.
+ * Returns number of nicks per mode on a channel, as an array of integers
+ * whose size is the number of modes + 1 (for regular users).
+ *
+ * For example if modes == "ohv", the array returned has a size of 4, with:
+ * - array[0] = number of nicks with mode "o"
+ * - array[1] = number of nicks with mode "h"
+ * - array[2] = number of nicks with mode "v"
+ * - array[3] = number of nicks with no mode (regular users)
+ *
+ * The parameter *size is set with the array size (number of integers in the
+ * array, NOT the size in bytes).
+ *
+ * Note: result must be freed after use (if not NULL).
*/
-void
+int *
irc_nick_count (struct t_irc_server *server, struct t_irc_channel *channel,
- int *total, int *count_ops, int *count_halfops,
- int *count_voiced, int *count_regular)
+ int *size)
{
struct t_irc_nick *ptr_nick;
+ const char *ptr_prefix_modes;
+ int i, *nicks_by_mode, mode_found;
- (*total) = 0;
- (*count_ops) = 0;
- (*count_halfops) = 0;
- (*count_voiced) = 0;
- (*count_regular) = 0;
- for (ptr_nick = channel->nicks; ptr_nick;
- ptr_nick = ptr_nick->next_nick)
+ if (!server || !channel || !size)
+ return NULL;
+
+ *size = 0;
+
+ ptr_prefix_modes = irc_server_get_prefix_modes (server);
+ if (!ptr_prefix_modes)
+ return NULL;
+
+ *size = strlen (ptr_prefix_modes) + 1;
+ nicks_by_mode = (int *)calloc (*size, sizeof (*nicks_by_mode));
+ if (!nicks_by_mode)
{
- (*total)++;
- if (irc_nick_is_op (server, ptr_nick))
- {
- (*count_ops)++;
- }
- else
+ *size = 0;
+ return NULL;
+ }
+
+ for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
+ {
+ mode_found = 0;
+ for (i = 0; ptr_prefix_modes[i]; i++)
{
- if (irc_nick_has_prefix_mode (server, ptr_nick, 'h'))
+ if (irc_nick_has_prefix_mode (server, ptr_nick, ptr_prefix_modes[i]))
{
- (*count_halfops)++;
- }
- else
- {
- if (irc_nick_has_prefix_mode (server, ptr_nick, 'v'))
- (*count_voiced)++;
- else
- (*count_regular)++;
+ nicks_by_mode[i]++;
+ mode_found = 1;
+ break;
}
}
+ if (!mode_found)
+ {
+ /* regular user */
+ nicks_by_mode[*size - 1]++;
+ }
}
+
+ return nicks_by_mode;
}
/*
diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h
index a9b649eb6..8d7ec911b 100644
--- a/src/plugins/irc/irc-nick.h
+++ b/src/plugins/irc/irc-nick.h
@@ -54,8 +54,8 @@ extern char *irc_nick_find_color (struct t_irc_server *server,
extern char *irc_nick_find_color_name (struct t_irc_server *server,
const char *nickname);
extern void irc_nick_set_host (struct t_irc_nick *nick, const char *host);
-extern int irc_nick_is_op (struct t_irc_server *server,
- struct t_irc_nick *nick);
+extern int irc_nick_is_op_or_higher (struct t_irc_server *server,
+ struct t_irc_nick *nick);
extern int irc_nick_has_prefix_mode (struct t_irc_server *server,
struct t_irc_nick *nick,
char prefix_mode);
@@ -87,10 +87,8 @@ extern void irc_nick_free_all (struct t_irc_server *server,
extern struct t_irc_nick *irc_nick_search (struct t_irc_server *server,
struct t_irc_channel *channel,
const char *nickname);
-extern void irc_nick_count (struct t_irc_server *server,
- struct t_irc_channel *channel, int *total,
- int *count_ops, int *count_halfops,
- int *count_voiced, int *count_regular);
+extern int *irc_nick_count (struct t_irc_server *server,
+ struct t_irc_channel *channel, int *size);
extern void irc_nick_set_away (struct t_irc_server *server,
struct t_irc_channel *channel,
struct t_irc_nick *nick, int is_away);
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index bd04cd6cc..5fff17b35 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -6476,6 +6476,174 @@ IRC_PROTOCOL_CALLBACK(354)
}
/*
+ * Returns a string with the list of nicks on a channel.
+ *
+ * Note: result must be freed after use.
+ */
+
+char *
+irc_protocol_get_string_channel_nicks (struct t_irc_server *server,
+ struct t_irc_channel *channel)
+{
+ struct t_infolist *infolist;
+ struct t_config_option *ptr_option;
+ const char *prefix, *prefix_color, *nickname;
+ char **str_nicks, *color;
+
+ str_nicks = weechat_string_dyn_alloc (1024);
+ if (!str_nicks)
+ return NULL;
+
+ infolist = weechat_infolist_get ("nicklist", channel->buffer, NULL);
+ if (!infolist)
+ {
+ weechat_string_dyn_free (str_nicks, 1);
+ return NULL;
+ }
+
+ while (weechat_infolist_next (infolist))
+ {
+ if (strcmp (weechat_infolist_string (infolist, "type"), "nick") == 0)
+ {
+ if (*str_nicks[0])
+ {
+ weechat_string_dyn_concat (str_nicks,
+ IRC_COLOR_RESET,
+ -1);
+ weechat_string_dyn_concat (str_nicks, " ", -1);
+ }
+ prefix = weechat_infolist_string (infolist, "prefix");
+ if (prefix[0] && (prefix[0] != ' '))
+ {
+ prefix_color = weechat_infolist_string (infolist,
+ "prefix_color");
+ if (strchr (prefix_color, '.'))
+ {
+ ptr_option = weechat_config_get (
+ weechat_infolist_string (infolist, "prefix_color"));
+ if (ptr_option)
+ {
+ weechat_string_dyn_concat (
+ str_nicks,
+ weechat_color (
+ weechat_config_string (ptr_option)),
+ -1);
+ }
+ }
+ else
+ {
+ weechat_string_dyn_concat (str_nicks,
+ weechat_color (prefix_color),
+ -1);
+ }
+ weechat_string_dyn_concat (str_nicks, prefix, -1);
+ }
+ nickname = weechat_infolist_string (infolist, "name");
+ if (weechat_config_boolean (irc_config_look_color_nicks_in_names))
+ {
+ if (irc_server_strcasecmp (server, nickname, server->nick) == 0)
+ {
+ weechat_string_dyn_concat (str_nicks,
+ IRC_COLOR_CHAT_NICK_SELF,
+ -1);
+ }
+ else
+ {
+ color = irc_nick_find_color (server, nickname);
+ weechat_string_dyn_concat (str_nicks, color, -1);
+ if (color)
+ free (color);
+ }
+ }
+ else
+ {
+ weechat_string_dyn_concat (str_nicks, IRC_COLOR_RESET, -1);
+ }
+ weechat_string_dyn_concat (str_nicks, nickname, -1);
+ }
+ }
+
+ weechat_infolist_free (infolist);
+
+ return weechat_string_dyn_free (str_nicks, 0);
+}
+
+/*
+ * Returns a string with the count of nicks per mode on a channel.
+ *
+ * Note: result must be freed after use.
+ */
+
+char *
+irc_protocol_get_string_channel_nicks_count (struct t_irc_server *server,
+ struct t_irc_channel *channel)
+{
+ const char *ptr_prefix_modes;
+ char **str_counts, str_count[128], str_mode_name[128];
+ int i, *nicks_by_mode, size;
+
+ ptr_prefix_modes = irc_server_get_prefix_modes (server);
+ if (!ptr_prefix_modes)
+ return NULL;
+
+ str_counts = weechat_string_dyn_alloc (1024);
+ if (!str_counts)
+ return NULL;
+
+ nicks_by_mode = irc_nick_count (server, channel, &size);
+ if (!nicks_by_mode)
+ {
+ weechat_string_dyn_free (str_counts, 1);
+ return NULL;
+ }
+
+ for (i = 0; i < size; i++)
+ {
+ snprintf (str_count, sizeof (str_count),
+ "%s%d%s ",
+ IRC_COLOR_CHAT_CHANNEL,
+ nicks_by_mode[i],
+ IRC_COLOR_RESET);
+ if (i == size - 1)
+ {
+ snprintf (str_mode_name, sizeof (str_mode_name),
+ "%s",
+ /* TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular" */
+ NG_("regular", "regular", nicks_by_mode[i]));
+ }
+ else if (ptr_prefix_modes[i] == 'o')
+ {
+ snprintf (str_mode_name, sizeof (str_mode_name),
+ "%s", NG_("op", "ops", nicks_by_mode[i]));
+ }
+ else if (ptr_prefix_modes[i] == 'h')
+ {
+ snprintf (str_mode_name, sizeof (str_mode_name),
+ "%s", NG_("halfop", "halfops", nicks_by_mode[i]));
+ }
+ else if (ptr_prefix_modes[i] == 'v')
+ {
+ snprintf (str_mode_name, sizeof (str_mode_name),
+ "%s", NG_("voiced", "voiced", nicks_by_mode[i]));
+ }
+ else
+ {
+ /* other modes: "+x" */
+ snprintf (str_mode_name, sizeof (str_mode_name),
+ "+%c", ptr_prefix_modes[i]);
+ }
+ if (*str_counts[0])
+ weechat_string_dyn_concat (str_counts, ", ", -1);
+ weechat_string_dyn_concat (str_counts, str_count, -1);
+ weechat_string_dyn_concat (str_counts, str_mode_name, -1);
+ }
+
+ free (nicks_by_mode);
+
+ return weechat_string_dyn_free (str_counts, 0);
+}
+
+/*
* Callback for the IRC command "366": end of /names list.
*
* Command looks like:
@@ -6485,11 +6653,7 @@ IRC_PROTOCOL_CALLBACK(354)
IRC_PROTOCOL_CALLBACK(366)
{
struct t_irc_channel *ptr_channel;
- struct t_infolist *infolist;
- struct t_config_option *ptr_option;
- int num_nicks, num_ops, num_halfops, num_voiced, num_regular;
- char *str_params, str_count[1024], **str_nicks, *color;
- const char *prefix, *prefix_color, *nickname;
+ char *str_params, *string;
IRC_PROTOCOL_MIN_PARAMS(3);
@@ -6497,170 +6661,57 @@ IRC_PROTOCOL_CALLBACK(366)
if (ptr_channel && ptr_channel->nicks)
{
- /* display users on channel */
+ /* display the list of users on channel */
if (weechat_hashtable_has_key (ptr_channel->join_msg_received, "353")
|| weechat_hashtable_has_key (irc_config_hashtable_display_join_message, "353"))
{
- infolist = weechat_infolist_get ("nicklist", ptr_channel->buffer, NULL);
- if (infolist)
+ string = irc_protocol_get_string_channel_nicks (server, ptr_channel);
+ if (string)
{
- str_nicks = weechat_string_dyn_alloc (1024);
- while (weechat_infolist_next (infolist))
- {
- if (strcmp (weechat_infolist_string (infolist, "type"),
- "nick") == 0)
- {
- if (*str_nicks[0])
- {
- weechat_string_dyn_concat (str_nicks,
- IRC_COLOR_RESET,
- -1);
- weechat_string_dyn_concat (str_nicks, " ", -1);
- }
- prefix = weechat_infolist_string (infolist, "prefix");
- if (prefix[0] && (prefix[0] != ' '))
- {
- prefix_color = weechat_infolist_string (infolist,
- "prefix_color");
- if (strchr (prefix_color, '.'))
- {
- ptr_option = weechat_config_get (weechat_infolist_string (infolist,
- "prefix_color"));
- if (ptr_option)
- {
- weechat_string_dyn_concat (
- str_nicks,
- weechat_color (
- weechat_config_string (ptr_option)),
- -1);
- }
- }
- else
- {
- weechat_string_dyn_concat (
- str_nicks,
- weechat_color (prefix_color),
- -1);
- }
- weechat_string_dyn_concat (str_nicks, prefix, -1);
- }
- nickname = weechat_infolist_string (infolist, "name");
- if (weechat_config_boolean (irc_config_look_color_nicks_in_names))
- {
- if (irc_server_strcasecmp (server, nickname, server->nick) == 0)
- {
- weechat_string_dyn_concat (
- str_nicks,
- IRC_COLOR_CHAT_NICK_SELF,
- -1);
- }
- else
- {
- color = irc_nick_find_color (server, nickname);
- weechat_string_dyn_concat (str_nicks, color, -1);
- if (color)
- free (color);
- }
- }
- else
- {
- weechat_string_dyn_concat (str_nicks,
- IRC_COLOR_RESET,
- -1);
- }
- weechat_string_dyn_concat (str_nicks, nickname, -1);
- }
- }
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
- server, NULL, command, "names",
- ptr_channel->buffer),
+ server, NULL, command, "names", ptr_channel->buffer),
date,
- irc_protocol_tags (
- server, command, tags, NULL, NULL, NULL),
+ irc_protocol_tags (server, command, tags, NULL, NULL, NULL),
_("%sNicks %s%s%s: %s[%s%s]"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_CHANNEL,
ptr_channel->name,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_DELIMITERS,
- *str_nicks,
+ string,
IRC_COLOR_CHAT_DELIMITERS);
- weechat_string_dyn_free (str_nicks, 1);
- weechat_infolist_free (infolist);
+ free (string);
}
}
- /*
- * display the number of total nicks, ops, halfops, voiced and
- * regular on the channel
- */
+ /* display the number of nicks per mode on channel */
if (weechat_hashtable_has_key (ptr_channel->join_msg_received, "366")
|| weechat_hashtable_has_key (irc_config_hashtable_display_join_message, "366"))
{
- irc_nick_count (server, ptr_channel, &num_nicks, &num_ops,
- &num_halfops, &num_voiced, &num_regular);
- str_nicks = weechat_string_dyn_alloc (1024);
- if (irc_server_get_prefix_mode_index (server, 'o') >= 0)
- {
- snprintf (str_count, sizeof (str_count),
- "%s%s%d%s %s",
- (*str_nicks[0]) ? ", " : "",
- IRC_COLOR_CHAT_CHANNEL,
- num_ops,
- IRC_COLOR_RESET,
- NG_("op", "ops", num_ops));
- weechat_string_dyn_concat (str_nicks, str_count, -1);
- }
- if (irc_server_get_prefix_mode_index (server, 'h') >= 0)
- {
- snprintf (str_count, sizeof (str_count),
- "%s%s%d%s %s",
- (*str_nicks[0]) ? ", " : "",
- IRC_COLOR_CHAT_CHANNEL,
- num_halfops,
- IRC_COLOR_RESET,
- NG_("halfop", "halfops", num_halfops));
- weechat_string_dyn_concat (str_nicks, str_count, -1);
- }
- if (irc_server_get_prefix_mode_index (server, 'v') >= 0)
+ string = irc_protocol_get_string_channel_nicks_count (server,
+ ptr_channel);
+ if (string)
{
- snprintf (str_count, sizeof (str_count),
- "%s%s%d%s %s",
- (*str_nicks[0]) ? ", " : "",
- IRC_COLOR_CHAT_CHANNEL,
- num_voiced,
- IRC_COLOR_RESET,
- NG_("voiced", "voiced", num_voiced));
- weechat_string_dyn_concat (str_nicks, str_count, -1);
+ weechat_printf_date_tags (
+ irc_msgbuffer_get_target_buffer (
+ server, NULL, command, "names", ptr_channel->buffer),
+ date,
+ irc_protocol_tags (server, command, tags, NULL, NULL, NULL),
+ _("%sChannel %s%s%s: %s%d%s %s %s(%s%s)"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ ptr_channel->name,
+ IRC_COLOR_RESET,
+ IRC_COLOR_CHAT_CHANNEL,
+ ptr_channel->nicks_count,
+ IRC_COLOR_RESET,
+ NG_("nick", "nicks", ptr_channel->nicks_count),
+ IRC_COLOR_CHAT_DELIMITERS,
+ string,
+ IRC_COLOR_CHAT_DELIMITERS);
+ free (string);
}
- snprintf (
- str_count, sizeof (str_count),
- /* TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular" */
- NG_("%s%s%d%s regular", "%s%s%d%s regular", num_regular),
- (*str_nicks[0]) ? ", " : "",
- IRC_COLOR_CHAT_CHANNEL,
- num_regular,
- IRC_COLOR_RESET);
- weechat_string_dyn_concat (str_nicks, str_count, -1);
- weechat_printf_date_tags (
- irc_msgbuffer_get_target_buffer (
- server, NULL, command, "names", ptr_channel->buffer),
- date,
- irc_protocol_tags (server, command, tags, NULL, NULL, NULL),
- _("%sChannel %s%s%s: %s%d%s %s %s(%s%s)"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- ptr_channel->name,
- IRC_COLOR_RESET,
- IRC_COLOR_CHAT_CHANNEL,
- num_nicks,
- IRC_COLOR_RESET,
- NG_("nick", "nicks", num_nicks),
- IRC_COLOR_CHAT_DELIMITERS,
- *str_nicks,
- IRC_COLOR_CHAT_DELIMITERS);
- weechat_string_dyn_free (str_nicks, 1);
}
if (!weechat_hashtable_has_key (ptr_channel->join_msg_received, command))
diff --git a/tests/unit/plugins/irc/test-irc-nick.cpp b/tests/unit/plugins/irc/test-irc-nick.cpp
index 6a22879ff..9d8f4ea0c 100644
--- a/tests/unit/plugins/irc/test-irc-nick.cpp
+++ b/tests/unit/plugins/irc/test-irc-nick.cpp
@@ -298,10 +298,10 @@ TEST(IrcNick, IrcNickSetHost)
/*
* Tests functions:
- * irc_nick_is_op
+ * irc_nick_is_op_or_higher
*/
-TEST(IrcNick, IrcNickIsOp)
+TEST(IrcNick, IrcNickIsOpOrHigher)
{
/* TODO: write tests */
}
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index 101aa14ec..61518b3d1 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -5009,6 +5009,8 @@ TEST(IrcProtocolWithServer, 354)
/*
* Tests functions:
+ * irc_protocol_get_string_channel_nicks
+ * irc_protocol_get_string_channel_nicks_count
* irc_protocol_cb_366 (end of /names list)
*/
@@ -5075,6 +5077,29 @@ TEST(IrcProtocolWithServer, 366)
"Channel #test: 9 nicks (2 ops, 2 halfops, 2 voiced, 3 regular)",
"irc_366,irc_numeric,log3");
+ RECV(":server 005 alice PREFIX=(qaohv)~&@%+ :are supported");
+
+ RECV(":server 353 alice = #test :~jessica");
+ RECV(":server 366 alice #test :End of /NAMES list");
+ CHECK_CHAN(
+ "--",
+ "Channel #test: 10 nicks (1 +q, 0 +a, 2 ops, 2 halfops, 2 voiced, 3 regular)",
+ "irc_366,irc_numeric,log3");
+
+ RECV(":server 353 alice = #test :&karl");
+ RECV(":server 366 alice #test :End of /NAMES list");
+ CHECK_CHAN(
+ "--",
+ "Channel #test: 11 nicks (1 +q, 1 +a, 2 ops, 2 halfops, 2 voiced, 3 regular)",
+ "irc_366,irc_numeric,log3");
+
+ RECV(":server 353 alice = #test :&mike");
+ RECV(":server 366 alice #test :End of /NAMES list");
+ CHECK_CHAN(
+ "--",
+ "Channel #test: 12 nicks (1 +q, 2 +a, 2 ops, 2 halfops, 2 voiced, 3 regular)",
+ "irc_366,irc_numeric,log3");
+
/* channel not found */
RECV(":server 366 alice #xyz end");
CHECK_SRV("--", "#xyz: end", "irc_366,irc_numeric,log3");