diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | doc/de/weechat_user.de.adoc | 2 | ||||
-rw-r--r-- | doc/en/weechat_user.en.adoc | 1 | ||||
-rw-r--r-- | doc/fr/weechat_user.fr.adoc | 1 | ||||
-rw-r--r-- | doc/it/weechat_user.it.adoc | 1 | ||||
-rw-r--r-- | doc/ja/weechat_user.ja.adoc | 2 | ||||
-rw-r--r-- | doc/pl/weechat_user.pl.adoc | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-bar-item.c | 53 |
8 files changed, 63 insertions, 0 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index a3445367a..44124a7ff 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -39,6 +39,7 @@ Bug fixes:: * core: do not remove quotes in arguments of command /eval as they can be part of the evaluated expression/condition (issue #1601) * core: display an error when the buffer is not found with command /command -buffer * buflist: add option buflist.look.use_items to speed up display of buflist (issue #1613) + * irc: add bar item "irc_nick_prefix" * irc: fix separator between nick and host in bar item "irc_nick_host" * irc: fix completion of commands /halfop and /dehalfop diff --git a/doc/de/weechat_user.de.adoc b/doc/de/weechat_user.de.adoc index 70109f5b5..d752e5a97 100644 --- a/doc/de/weechat_user.de.adoc +++ b/doc/de/weechat_user.de.adoc @@ -774,6 +774,8 @@ andere Items die man nutzen kann (die aber nicht standardmäßig in einer Bar ak // TRANSLATION MISSING | irc_nick_host | `+Flashy!user@host.com+` | Current IRC nick and host. | irc_nick_modes | `i` | IRC Modi für den eigenen Nick. +// TRANSLATION MISSING +| irc_nick_prefix | `@` | IRC nick prefix on channel. | mouse_status | `M` | Status der Maus (keine Anzeige, falls Maus deaktiviert). | spell_dict | `de,en` | zeigt an welche Wörterbücher für die Rechtschreibung im aktuellen Buffer genutzt werden. | spell_suggest | `Glück,Glocke,Block` | Vorschläge für ein falsch geschriebenes Wort. diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc index ebdde1744..273720af0 100644 --- a/doc/en/weechat_user.en.adoc +++ b/doc/en/weechat_user.en.adoc @@ -759,6 +759,7 @@ Other items available (not used in bars by default): | irc_nick | `+Flashy+` | Current IRC nick. | irc_nick_host | `+Flashy!user@host.com+` | Current IRC nick and host. | irc_nick_modes | `i` | IRC modes for self nick. +| irc_nick_prefix | `@` | IRC nick prefix on channel. | mouse_status | `M` | Mouse status (empty if mouse is disabled). | spell_dict | `fr,en` | Spelling dictionaries used on current buffer. | spell_suggest | `print,prone,prune` | Spelling suggestions for word under cursor (if misspelled). diff --git a/doc/fr/weechat_user.fr.adoc b/doc/fr/weechat_user.fr.adoc index 09bbde01a..1b9ab4dd2 100644 --- a/doc/fr/weechat_user.fr.adoc +++ b/doc/fr/weechat_user.fr.adoc @@ -774,6 +774,7 @@ Autres objets (non utilisés dans des barres par défaut) : | irc_nick | `+Flashy+` | Pseudo IRC. | irc_nick_host | `+Flashy!user@host.com+` | Pseudo et hôte IRC. | irc_nick_modes | `i` | Modes IRC pour le pseudo. +| irc_nick_prefix | `@` | Préfixe de pseudo IRC sur le canal. | mouse_status | `M` | Statut de la souris (vide si la souris est désactivée). | spell_dict | `fr,en` | Dictionnaires utilisés pour la vérification de l'orthographe sur le tampon courant. | spell_suggest | `print,prone,prune` | Suggestions pour le mot sous le curseur (si mal orthographié). diff --git a/doc/it/weechat_user.it.adoc b/doc/it/weechat_user.it.adoc index dfb0b92f2..470b58384 100644 --- a/doc/it/weechat_user.it.adoc +++ b/doc/it/weechat_user.it.adoc @@ -832,6 +832,7 @@ Other items available (not used in bars by default): | irc_nick | `+Flashy+` | Current IRC nick. | irc_nick_host | `+Flashy!user@host.com+` | Current IRC nick and host. | irc_nick_modes | `i` | IRC modes for self nick. +| irc_nick_prefix | `@` | IRC nick prefix on channel. | mouse_status | `M` | Mouse status (empty if mouse is disabled). | spell_dict | `fr,en` | Spelling dictionaries used on current buffer. | spell_suggest | `print,prone,prune` | Spelling suggestions for word under cursor (if misspelled). diff --git a/doc/ja/weechat_user.ja.adoc b/doc/ja/weechat_user.ja.adoc index 56f578704..97e79abf5 100644 --- a/doc/ja/weechat_user.ja.adoc +++ b/doc/ja/weechat_user.ja.adoc @@ -790,6 +790,8 @@ WeeChat を起動した端末の例: // TRANSLATION MISSING | irc_nick_host | `+Flashy!user@host.com+` | Current IRC nick and host. | irc_nick_modes | `i` | 自分のニックネームに対する IRC モード +// TRANSLATION MISSING +| irc_nick_prefix | `@` | IRC nick prefix on channel. | mouse_status | `M` | マウスの状態 (マウスが無効化されている場合は空文字列) | spell_dict | `fr,en` | 現在のバッファにおけるスペリング辞書 | spell_suggest | `print,prone,prune` | カーソル下の単語に対するスペリング候補 (スペルが間違っている場合) diff --git a/doc/pl/weechat_user.pl.adoc b/doc/pl/weechat_user.pl.adoc index 4436e287d..f417ecf54 100644 --- a/doc/pl/weechat_user.pl.adoc +++ b/doc/pl/weechat_user.pl.adoc @@ -774,6 +774,8 @@ Inne dostępne elementy (nie używane domyślnie w paskach): // TRANSLATION MISSING | irc_nick_host | `+Flashy!user@host.com+` | Current IRC nick and host. | irc_nick_modes | `i` | Atrybuty IRC dla własnego nicka. +// TRANSLATION MISSING +| irc_nick_prefix | `@` | IRC nick prefix on channel. | mouse_status | `M` | Status obsługi myszy (pusty jeśli obsługa myszy jest wyłączona). | spell_dict | `fr,en` | Słowniki używane w obecnym buforze. | spell_suggest | `print,prone,prune` | Sugestie dla słowa pod kursorem (jeśli zawiera błąd). diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index f8c85f29c..2a39596ea 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -644,6 +644,57 @@ irc_bar_item_nick_modes (const void *pointer, void *data, } /* + * Returns content of bar item "nick_prefix": bar item with nick prefix. + */ + +char * +irc_bar_item_nick_prefix (const void *pointer, void *data, + struct t_gui_bar_item *item, + struct t_gui_window *window, + struct t_gui_buffer *buffer, + struct t_hashtable *extra_info) +{ + struct t_irc_server *server; + struct t_irc_channel *channel; + struct t_irc_nick *ptr_nick; + char str_prefix[64]; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) item; + (void) window; + (void) extra_info; + + if (!buffer) + return NULL; + + irc_buffer_get_server_and_channel (buffer, &server, &channel); + if (!server || !server->nick) + return NULL; + + str_prefix[0] = '\0'; + if (channel && (channel->type == IRC_CHANNEL_TYPE_CHANNEL)) + { + ptr_nick = irc_nick_search (server, channel, server->nick); + if (ptr_nick) + { + if (weechat_config_boolean (irc_config_look_nick_mode_empty) + || (ptr_nick->prefix[0] != ' ')) + { + snprintf (str_prefix, sizeof (str_prefix), "%s%s", + weechat_color ( + irc_nick_get_prefix_color_name ( + server, ptr_nick->prefix[0])), + ptr_nick->prefix); + } + } + } + + return (str_prefix[0]) ? strdup (str_prefix) : NULL; +} + +/* * Focus on nicklist. */ @@ -769,6 +820,8 @@ irc_bar_item_init () &irc_bar_item_input_prompt, NULL, NULL); weechat_bar_item_new ("irc_nick_modes", &irc_bar_item_nick_modes, NULL, NULL); + weechat_bar_item_new ("irc_nick_prefix", + &irc_bar_item_nick_prefix, NULL, NULL); weechat_hook_focus ("buffer_nicklist", &irc_bar_item_focus_buffer_nicklist, NULL, NULL); |