diff --git a/doc/de/autogen/irc_options.xml b/doc/de/autogen/irc_options.xml index 83c710c2b..68a554c18 100644 --- a/doc/de/autogen/irc_options.xml +++ b/doc/de/autogen/irc_options.xml @@ -106,13 +106,13 @@ -irc.look.nick_completion_smart: Intelligente vervollständigung der Nicknamen (vervollständigt zuerst mit dem letzten Nick, der einen angesprochen hat) +irc.look.nick_completion_smart: smart completion for nicks (completes first with last speakers) - type: boolean + type: integer - values: on, off (default value: on) + values: off, speakers, speakers_highlights (default value: speakers) diff --git a/doc/en/autogen/irc_options.xml b/doc/en/autogen/irc_options.xml index 50e27d395..31a953d1c 100644 --- a/doc/en/autogen/irc_options.xml +++ b/doc/en/autogen/irc_options.xml @@ -106,13 +106,13 @@ -irc.look.nick_completion_smart: smart completion for nicks (completes with last speakers first) +irc.look.nick_completion_smart: smart completion for nicks (completes first with last speakers) - type: boolean + type: integer - values: on, off (default value: on) + values: off, speakers, speakers_highlights (default value: speakers) diff --git a/doc/fr/autogen/irc_options.xml b/doc/fr/autogen/irc_options.xml index d91315cd7..4cac272f5 100644 --- a/doc/fr/autogen/irc_options.xml +++ b/doc/fr/autogen/irc_options.xml @@ -109,10 +109,10 @@ irc.look.nick_completion_smart: complétion intelligente pour les pseudos (complète d'abord avec les personnes qui ont parlé récemment) - type: booléen + type: entier - valeurs: on, off (valeur par défaut: on) + valeurs: off, speakers, speakers_highlights (valeur par défaut: speakers) diff --git a/po/cs.po b/po/cs.po index 785cedbfa..54c87c334 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-04-01 22:41+0200\n" +"POT-Creation-Date: 2009-04-03 15:08+0200\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -3547,7 +3547,8 @@ msgstr "text pro zobrazení před přezdívkou v okně rozhovoru" msgid "text to display after nick in chat window" msgstr "text pro zobrazení za přezdívkou v okně rozhovoru" -msgid "smart completion for nicks (completes with last speakers first)" +#, fuzzy +msgid "smart completion for nicks (completes first with last speakers)" msgstr "chytré doplňování přezdívek (doplňovat posledně mluvící jako první)" msgid "display message when (un)marking as away" @@ -4379,6 +4380,9 @@ msgstr "automaticky znovu přijít na kanál po vykopnutí" msgid "open new MUCs/privates near server" msgstr "otevřít nový kanál/soukromý rozhovor poblíž serveru" +msgid "smart completion for nicks (completes with last speakers first)" +msgstr "chytré doplňování přezdívek (doplňovat posledně mluvící jako první)" + msgid "display MUC modes in \"buffer_name\" bar item" msgstr "" @@ -5558,6 +5562,12 @@ msgstr "%s DCC: nemohu nastavit 'neblokovaci' volbu na soket\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s chybí argument pro volbu \"%s\"\n" +#, fuzzy +#~ msgid "" +#~ "smart completion for nicks (completes first with last speakers, " +#~ "highlights or both)" +#~ msgstr "chytré doplňování přezdívek (doplňovat posledně mluvící jako první)" + #~ msgid "" #~ "partially complete nicks (stop when many nicks found begin with same " #~ "letters)" diff --git a/po/de.po b/po/de.po index ccf5bc42e..0732a5a07 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-04-01 22:41+0200\n" +"POT-Creation-Date: 2009-04-03 15:08+0200\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -3525,7 +3525,8 @@ msgstr "Text, der im Chatfenster vor dem Nickname erscheinen soll" msgid "text to display after nick in chat window" msgstr "Text, der im Chatfenster nach dem Nickname erscheinen soll" -msgid "smart completion for nicks (completes with last speakers first)" +#, fuzzy +msgid "smart completion for nicks (completes first with last speakers)" msgstr "" "Intelligente vervollständigung der Nicknamen (vervollständigt zuerst mit dem " "letzten Nick, der einen angesprochen hat)" @@ -4326,6 +4327,11 @@ msgstr "Channels nach Kick automatisch wieder betreten, falls möglich" msgid "open new MUCs/privates near server" msgstr "öffne neue Channels oder private Nachrichten neben dem Server-Puffer" +msgid "smart completion for nicks (completes with last speakers first)" +msgstr "" +"Intelligente vervollständigung der Nicknamen (vervollständigt zuerst mit dem " +"letzten Nick, der einen angesprochen hat)" + msgid "display MUC modes in \"buffer_name\" bar item" msgstr "" @@ -5491,6 +5497,14 @@ msgstr "%s DCC: kann die 'nonblock'-Option für den Socket nicht festlegen\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" +#, fuzzy +#~ msgid "" +#~ "smart completion for nicks (completes first with last speakers, " +#~ "highlights or both)" +#~ msgstr "" +#~ "Intelligente vervollständigung der Nicknamen (vervollständigt zuerst mit " +#~ "dem letzten Nick, der einen angesprochen hat)" + #~ msgid "[action [args] | number | [[server] [channel]]]" #~ msgstr "[Aktion [Argumente] | Nummer | [[Server] [Channel]]]" diff --git a/po/es.po b/po/es.po index 04d9d044d..0a13abc19 100644 --- a/po/es.po +++ b/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-04-01 22:41+0200\n" +"POT-Creation-Date: 2009-04-03 15:08+0200\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Roberto González Cardenete \n" "Language-Team: weechat-dev \n" @@ -3514,7 +3514,7 @@ msgstr "texto a mostrar antes del nick en la ventana de charla" msgid "text to display after nick in chat window" msgstr "texto a mostrar tras el nick en la ventana de charla" -msgid "smart completion for nicks (completes with last speakers first)" +msgid "smart completion for nicks (completes first with last speakers)" msgstr "" msgid "display message when (un)marking as away" @@ -4316,6 +4316,9 @@ msgstr "unirse de nuevo automáticamente a los canales cuando sea expulsado" msgid "open new MUCs/privates near server" msgstr "abrir nuevos canales/privados cerca del servidor" +msgid "smart completion for nicks (completes with last speakers first)" +msgstr "" + msgid "display MUC modes in \"buffer_name\" bar item" msgstr "" diff --git a/po/fr.po b/po/fr.po index 77bedfe2b..758cb56e1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-04-01 22:41+0200\n" -"PO-Revision-Date: 2009-04-01 22:42+0200\n" +"POT-Creation-Date: 2009-04-03 15:08+0200\n" +"PO-Revision-Date: 2009-04-03 15:08+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -3661,7 +3661,7 @@ msgstr "texte à afficher avant le pseudo dans la fenêtre de discussion" msgid "text to display after nick in chat window" msgstr "texte à afficher après le pseudo dans la fenêtre de discussion" -msgid "smart completion for nicks (completes with last speakers first)" +msgid "smart completion for nicks (completes first with last speakers)" msgstr "" "complétion intelligente pour les pseudos (complète d'abord avec les " "personnes qui ont parlé récemment)" @@ -4488,6 +4488,11 @@ msgstr "rejoindre automatiquement les MUCs quand mis dehors" msgid "open new MUCs/privates near server" msgstr "ouvrir les nouveaux MUCs/privés près du serveur" +msgid "smart completion for nicks (completes with last speakers first)" +msgstr "" +"complétion intelligente pour les pseudos (complète d'abord avec les " +"personnes qui ont parlé récemment)" + msgid "display MUC modes in \"buffer_name\" bar item" msgstr "affiche les modes du MUC dans l'objet de barre \"buffer_name\"" @@ -5679,6 +5684,13 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s" +#~ msgid "" +#~ "smart completion for nicks (completes first with last speakers, " +#~ "highlights or both)" +#~ msgstr "" +#~ "complétion intelligente pour les pseudos (complète d'abord avec les " +#~ "personnes qui ont parlé récemment)" + #~ msgid "" #~ "partially complete nicks (stop when many nicks found begin with same " #~ "letters)" diff --git a/po/hu.po b/po/hu.po index 33ce11ed1..e7bfebd06 100644 --- a/po/hu.po +++ b/po/hu.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-04-01 22:41+0200\n" +"POT-Creation-Date: 2009-04-03 15:08+0200\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -3562,7 +3562,8 @@ msgstr "a név előtt megjelenítendő szöveg a beszédablakban" msgid "text to display after nick in chat window" msgstr "a név után megjelenítendő szöveg a beszédablakban" -msgid "smart completion for nicks (completes with last speakers first)" +#, fuzzy +msgid "smart completion for nicks (completes first with last speakers)" msgstr "okos névkiegészítés (először az utolsó partnerre egészít ki)" msgid "display message when (un)marking as away" @@ -4381,6 +4382,9 @@ msgstr "automatikus visszalépés a szobába kirúgáskor" msgid "open new MUCs/privates near server" msgstr "az új szobák/privát beszélgetések a szerverhez közel nyíljanak" +msgid "smart completion for nicks (completes with last speakers first)" +msgstr "okos névkiegészítés (először az utolsó partnerre egészít ki)" + msgid "display MUC modes in \"buffer_name\" bar item" msgstr "" @@ -5545,6 +5549,12 @@ msgstr "%s DCC: nem sikerült 'nonblock' opciót beállítani a csatornán\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" +#, fuzzy +#~ msgid "" +#~ "smart completion for nicks (completes first with last speakers, " +#~ "highlights or both)" +#~ msgstr "okos névkiegészítés (először az utolsó partnerre egészít ki)" + #~ msgid "[action [args] | number | [[server] [channel]]]" #~ msgstr "[utasítás[argumentumok] | szám | [[szerver] [szoba]]]" diff --git a/po/ru.po b/po/ru.po index 057df7a4e..b3c1c3ccd 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-04-01 22:41+0200\n" +"POT-Creation-Date: 2009-04-03 15:08+0200\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -3555,7 +3555,8 @@ msgstr "текст, который отображать до ника в окн msgid "text to display after nick in chat window" msgstr "текст, который отображать после ника в окне чата" -msgid "smart completion for nicks (completes with last speakers first)" +#, fuzzy +msgid "smart completion for nicks (completes first with last speakers)" msgstr "умное дополнение ников (начинает перебор с последних собеседников)" msgid "display message when (un)marking as away" @@ -4364,6 +4365,9 @@ msgstr "автоматически перезаходить на каналы п msgid "open new MUCs/privates near server" msgstr "открывать новые каналы/приваты рядом с сервером" +msgid "smart completion for nicks (completes with last speakers first)" +msgstr "умное дополнение ников (начинает перебор с последних собеседников)" + msgid "display MUC modes in \"buffer_name\" bar item" msgstr "" @@ -5516,6 +5520,12 @@ msgstr "%s DCC: не могу установить неблокирующий р msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s нет аргумента для параметра \"%s\"\n" +#, fuzzy +#~ msgid "" +#~ "smart completion for nicks (completes first with last speakers, " +#~ "highlights or both)" +#~ msgstr "умное дополнение ников (начинает перебор с последних собеседников)" + #~ msgid "[action [args] | number | [[server] [channel]]]" #~ msgstr "[действие [аргументы] | номер | [[сервер] [канал]]]" diff --git a/po/weechat.pot b/po/weechat.pot index 0a225fd3e..b9f9fa75d 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-04-01 22:41+0200\n" +"POT-Creation-Date: 2009-04-03 15:08+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3025,7 +3025,7 @@ msgstr "" msgid "text to display after nick in chat window" msgstr "" -msgid "smart completion for nicks (completes with last speakers first)" +msgid "smart completion for nicks (completes first with last speakers)" msgstr "" msgid "display message when (un)marking as away" @@ -3740,6 +3740,9 @@ msgstr "" msgid "open new MUCs/privates near server" msgstr "" +msgid "smart completion for nicks (completes with last speakers first)" +msgstr "" + msgid "display MUC modes in \"buffer_name\" bar item" msgstr "" diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 537d18bf7..b5c2d8af6 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -307,21 +307,17 @@ irc_channel_set_away (struct t_irc_channel *channel, const char *nick_name, } /* - * irc_channel_nick_speaking_add: add a nick speaking on a channel + * irc_channel_nick_speaking_add_to_list: add a nick speaking on a channel */ void -irc_channel_nick_speaking_add (struct t_irc_channel *channel, - const char *nick_name, int highlight) +irc_channel_nick_speaking_add_to_list (struct t_irc_channel *channel, + const char *nick_name, + int highlight) { int size, to_remove, i; struct t_weelist_item *ptr_item; - if (highlight < 0) - highlight = 0; - if (highlight > 1) - highlight = 1; - /* create list if it does not exist */ if (!channel->nicks_speaking[highlight]) channel->nicks_speaking[highlight] = weechat_list_new (); @@ -349,6 +345,24 @@ irc_channel_nick_speaking_add (struct t_irc_channel *channel, } } +/* + * irc_channel_nick_speaking_add: add a nick speaking on a channel + */ + +void +irc_channel_nick_speaking_add (struct t_irc_channel *channel, + const char *nick_name, int highlight) +{ + if (highlight < 0) + highlight = 0; + if (highlight > 1) + highlight = 1; + if (highlight) + irc_channel_nick_speaking_add_to_list (channel, nick_name, 1); + + irc_channel_nick_speaking_add_to_list (channel, nick_name, 0); +} + /* * irc_channel_nick_speaking_rename: rename a nick speaking on a channel */ diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c index 3ca5d69a2..0de87a2ca 100644 --- a/src/plugins/irc/irc-completion.c +++ b/src/plugins/irc/irc-completion.c @@ -176,6 +176,36 @@ irc_completion_channel_cb (void *data, const char *completion_item, return WEECHAT_RC_OK; } +/* + * irc_completion_channel_nicks_add_speakers: add recent speakers to completion + * list + */ + +void +irc_completion_channel_nicks_add_speakers (struct t_gui_completion *completion, + struct t_irc_channel *channel, + int highlight) +{ + int list_size, i; + const char *nick; + + if (channel->nicks_speaking[highlight]) + { + list_size = weechat_list_size (channel->nicks_speaking[highlight]); + for (i = 0; i < list_size; i++) + { + nick = weechat_list_string (weechat_list_get (channel->nicks_speaking[highlight], i)); + if (nick && irc_nick_search (channel, nick)) + { + weechat_hook_completion_list_add (completion, + nick, + 1, + WEECHAT_LIST_POS_BEGINNING); + } + } + } +} + /* * irc_completion_channel_nicks_cb: callback for completion with nicks * of current channel @@ -187,8 +217,6 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item, struct t_gui_completion *completion) { struct t_irc_nick *ptr_nick; - const char *nick; - int list_size, i, j; IRC_GET_SERVER_CHANNEL(buffer); @@ -209,28 +237,15 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item, 1, WEECHAT_LIST_POS_SORT); } - /* add nicks speaking recently on this channel */ - if (weechat_config_boolean (irc_config_look_nick_completion_smart)) + /* add recent speakers on channel */ + if (weechat_config_integer (irc_config_look_nick_completion_smart) == IRC_CONFIG_NICK_COMPLETION_SMART_SPEAKERS) { - /* 0 => nick speaking ; 1 => nick speaking to me (with highlight) */ - for (i = 0; i < 2; i++) - { - if (ptr_channel->nicks_speaking[i]) - { - list_size = weechat_list_size (ptr_channel->nicks_speaking[i]); - for (j = 0; j < list_size; j++) - { - nick = weechat_list_string (weechat_list_get (ptr_channel->nicks_speaking[i], j)); - if (nick && irc_nick_search (ptr_channel, nick)) - { - weechat_hook_completion_list_add (completion, - nick, - 1, - WEECHAT_LIST_POS_BEGINNING); - } - } - } - } + irc_completion_channel_nicks_add_speakers (completion, ptr_channel, 0); + } + /* add nicks whose make highlights on me recently on this channel */ + if (weechat_config_integer (irc_config_look_nick_completion_smart) == IRC_CONFIG_NICK_COMPLETION_SMART_SPEAKERS_HIGHLIGHTS) + { + irc_completion_channel_nicks_add_speakers (completion, ptr_channel, 1); } /* add self nick at the end */ weechat_hook_completion_list_add (completion, diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index f7bb28ffa..20cf063bc 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -1060,14 +1060,16 @@ irc_config_init () NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_nick_completion_smart = weechat_config_new_option ( irc_config_file, ptr_section, - "nick_completion_smart", "boolean", - N_("smart completion for nicks (completes with last speakers first)"), - NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + "nick_completion_smart", "integer", + N_("smart completion for nicks (completes first with last speakers)"), + "off|speakers|speakers_highlights", 0, 0, "speakers", NULL, 0, NULL, NULL, + NULL, NULL, NULL, NULL); irc_config_look_display_away = weechat_config_new_option ( irc_config_file, ptr_section, "display_away", "integer", N_("display message when (un)marking as away"), - "off|local|channel", 0, 0, "local", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + "off|local|channel", 0, 0, "local", NULL, 0, NULL, NULL, NULL, NULL, + NULL, NULL); irc_config_look_display_channel_modes = weechat_config_new_option ( irc_config_file, ptr_section, "display_channel_modes", "boolean", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 0a09e6b8a..44a46d288 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -22,6 +22,10 @@ #define IRC_CONFIG_NAME "irc" +#define IRC_CONFIG_NICK_COMPLETION_SMART_OFF 0 +#define IRC_CONFIG_NICK_COMPLETION_SMART_SPEAKERS 1 +#define IRC_CONFIG_NICK_COMPLETION_SMART_SPEAKERS_HIGHLIGHTS 2 + #define IRC_CONFIG_DISPLAY_AWAY_OFF 0 #define IRC_CONFIG_DISPLAY_AWAY_LOCAL 1 #define IRC_CONFIG_DISPLAY_AWAY_CHANNEL 2