api: add info "auto_connect" (closes #1453)
This commit is contained in:
parent
c05cb595dc
commit
c29b45a0f2
@ -23,6 +23,7 @@ New features::
|
||||
* core: add variable "old_full_name" in buffer, set during buffer renaming (issue #1428)
|
||||
* core: add debug option "-d" in command /eval (issue #1434)
|
||||
* api: add functions crypto_hash and crypto_hash_pbkdf2
|
||||
* api: add info "auto_connect" (issue #1453)
|
||||
* api: add info "weechat_headless" (issue #1433)
|
||||
* buflist: add pointer "window" in bar item evaluation
|
||||
* irc: add support of fake servers (no I/O, for testing purposes)
|
||||
|
@ -17,6 +17,40 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog]
|
||||
(file _ChangeLog.adoc_ in sources).
|
||||
|
||||
|
||||
[[v2.8]]
|
||||
== Version 2.8 (under dev)
|
||||
|
||||
[[v2.8_auto_connection_to_servers]]
|
||||
=== Auto connection to servers
|
||||
|
||||
The command line option `-a` (or `--no-connect`), which can also be used in the
|
||||
`/plugin` command, is now used to set a new info called `auto_connect`
|
||||
(see the function "info_get" in the Plugin API reference).
|
||||
|
||||
Therefore, the option is not sent any more to the function `weechat_plugin_init`
|
||||
of plugins. +
|
||||
The plugins using this option must now get the info `auto_connect` and check
|
||||
if the value is "1" (a string with just `1`).
|
||||
|
||||
The purpose of this change is to allow scripts as well to check this info on
|
||||
startup, and connect or not, depending on the value (see issue #1453).
|
||||
|
||||
To be compatible with WeeChat ≤ 2.7, the script can do this, for example
|
||||
in Python:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
auto_connect = weechat.info_get("auto_connect", "") != "0"
|
||||
----
|
||||
|
||||
The variable `auto_connect` will be set like that, depending on the WeeChat
|
||||
version:
|
||||
|
||||
* WeeChat ≤ 2.7: always `True` because the info is an empty string (it does not
|
||||
exist), which is different from "0",
|
||||
* WeeChat ≥ 2.8: `True` by default, and `False` if `-a` or `--no-connect` is
|
||||
given by the user (either on command line or when loading the plugin).
|
||||
|
||||
[[v2.7.1]]
|
||||
== Version 2.7.1 (2020-02-20)
|
||||
|
||||
|
@ -80,6 +80,8 @@
|
||||
|
||||
| tcl | tcl_version | Version des verwendeten Interpreters | -
|
||||
|
||||
| weechat | auto_connect | 1 if automatic connection to servers is enabled, 0 if it has been disabled by the user (option "-a" or "--no-connect") | -
|
||||
|
||||
| weechat | charset_internal | Interner WeeChat Zeichensatz | -
|
||||
|
||||
| weechat | charset_terminal | Terminal Zeichensatz | -
|
||||
|
@ -80,6 +80,8 @@
|
||||
|
||||
| tcl | tcl_version | version of the interpreter used | -
|
||||
|
||||
| weechat | auto_connect | 1 if automatic connection to servers is enabled, 0 if it has been disabled by the user (option "-a" or "--no-connect") | -
|
||||
|
||||
| weechat | charset_internal | WeeChat internal charset | -
|
||||
|
||||
| weechat | charset_terminal | terminal charset | -
|
||||
|
@ -80,6 +80,8 @@
|
||||
|
||||
| tcl | tcl_version | version de l'interpréteur utilisé | -
|
||||
|
||||
| weechat | auto_connect | 1 si la connexion automatique aux serveurs est activée, 0 si elle a été désactivée par l'utilisateur (option "-a" ou "--no-connect") | -
|
||||
|
||||
| weechat | charset_internal | charset interne à WeeChat | -
|
||||
|
||||
| weechat | charset_terminal | charset du terminal | -
|
||||
|
@ -80,6 +80,8 @@
|
||||
|
||||
| tcl | tcl_version | version of the interpreter used | -
|
||||
|
||||
| weechat | auto_connect | 1 if automatic connection to servers is enabled, 0 if it has been disabled by the user (option "-a" or "--no-connect") | -
|
||||
|
||||
| weechat | charset_internal | set caratteri interno di WeeChat | -
|
||||
|
||||
| weechat | charset_terminal | set caratteri terminale | -
|
||||
|
@ -80,6 +80,8 @@
|
||||
|
||||
| tcl | tcl_version | 使用中のインタプリタのバージョン | -
|
||||
|
||||
| weechat | auto_connect | 1 if automatic connection to servers is enabled, 0 if it has been disabled by the user (option "-a" or "--no-connect") | -
|
||||
|
||||
| weechat | charset_internal | WeeChat 内部文字セット | -
|
||||
|
||||
| weechat | charset_terminal | 端末の文字セット | -
|
||||
|
@ -80,6 +80,8 @@
|
||||
|
||||
| tcl | tcl_version | wersja użytego interpretera | -
|
||||
|
||||
| weechat | auto_connect | 1 if automatic connection to servers is enabled, 0 if it has been disabled by the user (option "-a" or "--no-connect") | -
|
||||
|
||||
| weechat | charset_internal | wewnętrzne kodowanie WeeChat | -
|
||||
|
||||
| weechat | charset_terminal | kodowanie terminala | -
|
||||
|
7
po/cs.po
7
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: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
|
||||
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -10184,6 +10184,11 @@ msgstr "1 pokud se WeeChat aktualizuje (příkaz `/upgrade`)"
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr "1 pokud se WeeChat aktualizuje (příkaz `/upgrade`)"
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr "znaková sada terminálu"
|
||||
|
||||
|
7
po/de.po
7
po/de.po
@ -24,7 +24,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-14 21:11+0100\n"
|
||||
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
|
||||
"Language-Team: German <kde-i18n-de@kde.org>\n"
|
||||
@ -12054,6 +12054,11 @@ msgstr "1 falls WeeChat ein Upgrade durchführt (Befehl `/upgrade`)"
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr "1, falls WeeChat im Hintergrundmodus ausgeführt wird"
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr "Terminal Zeichensatz"
|
||||
|
||||
|
7
po/es.po
7
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: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
|
||||
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -10497,6 +10497,11 @@ msgstr "1 si WeeChat se está actualizando (comando `/upgrade`)"
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr "1 si WeeChat se está actualizando (comando `/upgrade`)"
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr "set de caracteres de la terminal"
|
||||
|
||||
|
11
po/fr.po
11
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: 2020-03-08 14:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-20 20:22+0100\n"
|
||||
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"Language: fr\n"
|
||||
@ -11781,6 +11781,13 @@ msgstr "1 si WeeChat est en cours de mise à jour (commande `/upgrade`)"
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr "1 si WeeChat tourne sans interface"
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
"1 si la connexion automatique aux serveurs est activée, 0 si elle a été "
|
||||
"désactivée par l'utilisateur (option \"-a\" ou \"--no-connect\")"
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr "charset du terminal"
|
||||
|
||||
|
7
po/hu.po
7
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: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
|
||||
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -9538,6 +9538,11 @@ msgstr ""
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "terminal charset"
|
||||
msgstr "pufferek kezelése"
|
||||
|
7
po/it.po
7
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: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
|
||||
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -10682,6 +10682,11 @@ msgstr "1 se si sta aggiornando WeeChat (comando `/upgrade`)"
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr "1 se si sta aggiornando WeeChat (comando `/upgrade`)"
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr "set caratteri terminale"
|
||||
|
||||
|
7
po/ja.po
7
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: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
|
||||
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
|
||||
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
|
||||
@ -11309,6 +11309,11 @@ msgstr "WeeChat がアップグレード中は 1 (コマンド `/upgrade`)"
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr "WeeChat をヘッドレスモードで実行中 (Ctrl-C で終了します)。"
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr "端末の文字セット"
|
||||
|
||||
|
7
po/pl.po
7
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: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
|
||||
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
|
||||
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
|
||||
@ -11517,6 +11517,11 @@ msgstr "1 jeżeli WeeChat jest aktualizowany (komenda `/upgrade`)"
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr "WeeChat działa w trybie bez interfejsu (naciśnij Ctrl-C żeby wyjść)."
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr "kodowanie terminala"
|
||||
|
||||
|
7
po/pt.po
7
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: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
|
||||
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
|
||||
"Language-Team: Portuguese <>\n"
|
||||
@ -11144,6 +11144,11 @@ msgstr "1 se o WeeChat está a atualizar (comando `/upgrade`)"
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr "1 se o WeeChat está a atualizar (comando `/upgrade`)"
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr "charset do termianl"
|
||||
|
||||
|
@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2019-11-03 08:38+0100\n"
|
||||
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -9984,6 +9984,11 @@ msgstr "1 se o WeeChat está sendo atualizado (comando `/upgrade`)"
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr "1 se o WeeChat está sendo atualizado (comando `/upgrade`)"
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr "charset do terminar"
|
||||
|
||||
|
7
po/ru.po
7
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: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2020-03-08 14:22+0100\n"
|
||||
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -9574,6 +9574,11 @@ msgstr ""
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "terminal charset"
|
||||
msgstr "управление буферами"
|
||||
|
7
po/tr.po
7
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: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\n"
|
||||
"PO-Revision-Date: 2019-11-03 08:38+0100\n"
|
||||
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -8705,6 +8705,11 @@ msgstr ""
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr ""
|
||||
|
||||
|
@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-03-08 14:21+0100\n"
|
||||
"POT-Creation-Date: 2020-03-20 12:21+0100\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"
|
||||
@ -8566,6 +8566,11 @@ msgstr ""
|
||||
msgid "1 if WeeChat is running headless"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"1 if automatic connection to servers is enabled, 0 if it has been disabled "
|
||||
"by the user (option \"-a\" or \"--no-connect\")"
|
||||
msgstr ""
|
||||
|
||||
msgid "terminal charset"
|
||||
msgstr ""
|
||||
|
||||
|
@ -114,6 +114,7 @@ int weechat_no_gcrypt = 0; /* remove init/deinit of gcrypt */
|
||||
/* (useful with valgrind) */
|
||||
struct t_weelist *weechat_startup_commands = NULL; /* startup commands */
|
||||
/* (option -r) */
|
||||
int weechat_auto_connect = 1; /* auto-connect to servers */
|
||||
|
||||
|
||||
/*
|
||||
@ -256,7 +257,7 @@ weechat_parse_args (int argc, char *argv[])
|
||||
switch (opt)
|
||||
{
|
||||
case 'a': /* -a / --no-connect */
|
||||
/* option ignored, it will be used by the irc plugin */
|
||||
/* option ignored, it will be used by plugins/scripts */
|
||||
break;
|
||||
case 'c': /* -c / --colors */
|
||||
gui_color_display_terminal_colors ();
|
||||
|
@ -116,6 +116,7 @@ extern int weechat_plugin_no_dlclose;
|
||||
extern int weechat_no_gnutls;
|
||||
extern int weechat_no_gcrypt;
|
||||
extern struct t_weelist *weechat_startup_commands;
|
||||
extern int weechat_auto_connect;
|
||||
|
||||
extern void weechat_term_check ();
|
||||
extern void weechat_shutdown (int return_code, int crash);
|
||||
|
@ -165,6 +165,7 @@ int
|
||||
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
{
|
||||
int i, auto_connect;
|
||||
char *info_auto_connect;
|
||||
|
||||
weechat_plugin = plugin;
|
||||
|
||||
@ -217,16 +218,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
irc_bar_item_init ();
|
||||
|
||||
/* check if auto-connect is enabled */
|
||||
info_auto_connect = weechat_info_get ("auto_connect", NULL);
|
||||
auto_connect = (info_auto_connect && (strcmp (info_auto_connect, "1") == 0)) ?
|
||||
1 : 0;
|
||||
if (info_auto_connect)
|
||||
free (info_auto_connect);
|
||||
|
||||
/* look at arguments */
|
||||
auto_connect = 1;
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
if ((weechat_strcasecmp (argv[i], "-a") == 0)
|
||||
|| (weechat_strcasecmp (argv[i], "--no-connect") == 0))
|
||||
{
|
||||
auto_connect = 0;
|
||||
}
|
||||
else if ((weechat_strncasecmp (argv[i], IRC_PLUGIN_NAME, 3) == 0))
|
||||
if ((weechat_strncasecmp (argv[i], IRC_PLUGIN_NAME, 3) == 0))
|
||||
{
|
||||
if (!irc_server_alloc_with_url (argv[i]))
|
||||
{
|
||||
|
@ -337,6 +337,27 @@ plugin_api_info_weechat_headless_cb (const void *pointer, void *data,
|
||||
return strdup (value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns WeeChat info "auto_connect".
|
||||
*/
|
||||
|
||||
char *
|
||||
plugin_api_info_auto_connect_cb (const void *pointer, void *data,
|
||||
const char *info_name,
|
||||
const char *arguments)
|
||||
{
|
||||
char value[32];
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) info_name;
|
||||
(void) arguments;
|
||||
|
||||
snprintf (value, sizeof (value), "%d", weechat_auto_connect);
|
||||
return strdup (value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns WeeChat info "charset_terminal".
|
||||
*/
|
||||
@ -1764,6 +1785,11 @@ plugin_api_info_init ()
|
||||
hook_info (NULL, "weechat_headless",
|
||||
N_("1 if WeeChat is running headless"),
|
||||
NULL, &plugin_api_info_weechat_headless_cb, NULL, NULL);
|
||||
hook_info (NULL, "auto_connect",
|
||||
N_("1 if automatic connection to servers is enabled, "
|
||||
"0 if it has been disabled by the user (option \"-a\" or "
|
||||
"\"--no-connect\")"),
|
||||
NULL, &plugin_api_info_auto_connect_cb, NULL, NULL);
|
||||
hook_info (NULL, "charset_terminal",
|
||||
N_("terminal charset"),
|
||||
NULL, &plugin_api_info_charset_terminal_cb, NULL, NULL);
|
||||
|
@ -271,7 +271,8 @@ plugin_check_autoload (const char *filename)
|
||||
void
|
||||
plugin_get_args (struct t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
int *plugin_argc, char ***plugin_argv)
|
||||
int *plugin_argc, char ***plugin_argv,
|
||||
int *no_connect)
|
||||
{
|
||||
int i, temp_argc, length_plugin_name;
|
||||
char **temp_argv;
|
||||
@ -279,6 +280,8 @@ plugin_get_args (struct t_weechat_plugin *plugin,
|
||||
temp_argc = 0;
|
||||
temp_argv = NULL;
|
||||
|
||||
*no_connect = 0;
|
||||
|
||||
length_plugin_name = strlen (plugin->name);
|
||||
|
||||
if (argc > 0)
|
||||
@ -289,12 +292,15 @@ plugin_get_args (struct t_weechat_plugin *plugin,
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
if ((strcmp (argv[i], "-a") == 0)
|
||||
|| (strcmp (argv[i], "--no-connect") == 0)
|
||||
|| (strcmp (argv[i], "-s") == 0)
|
||||
|| (strcmp (argv[i], "--no-script") == 0)
|
||||
|| ((strncmp (argv[i], plugin->name,
|
||||
length_plugin_name) == 0)
|
||||
&& (argv[i][length_plugin_name] == ':')))
|
||||
|| (strcmp (argv[i], "--no-connect") == 0))
|
||||
{
|
||||
*no_connect = 1;
|
||||
}
|
||||
else if ((strcmp (argv[i], "-s") == 0)
|
||||
|| (strcmp (argv[i], "--no-script") == 0)
|
||||
|| ((strncmp (argv[i], plugin->name,
|
||||
length_plugin_name) == 0)
|
||||
&& (argv[i][length_plugin_name] == ':')))
|
||||
{
|
||||
temp_argv[temp_argc++] = argv[i];
|
||||
}
|
||||
@ -325,7 +331,7 @@ int
|
||||
plugin_call_init (struct t_weechat_plugin *plugin, int argc, char **argv)
|
||||
{
|
||||
t_weechat_init_func *init_func;
|
||||
int plugin_argc, rc;
|
||||
int plugin_argc, no_connect, rc, old_auto_connect;
|
||||
char **plugin_argv;
|
||||
|
||||
if (plugin->initialized)
|
||||
@ -337,7 +343,11 @@ plugin_call_init (struct t_weechat_plugin *plugin, int argc, char **argv)
|
||||
return 0;
|
||||
|
||||
/* get arguments for the plugin */
|
||||
plugin_get_args (plugin, argc, argv, &plugin_argc, &plugin_argv);
|
||||
plugin_get_args (plugin, argc, argv,
|
||||
&plugin_argc, &plugin_argv, &no_connect);
|
||||
|
||||
old_auto_connect = weechat_auto_connect;
|
||||
weechat_auto_connect = (no_connect) ? 0 : 1;
|
||||
|
||||
/* init plugin */
|
||||
if (weechat_debug_core >= 1)
|
||||
@ -362,6 +372,8 @@ plugin_call_init (struct t_weechat_plugin *plugin, int argc, char **argv)
|
||||
plugin->filename);
|
||||
}
|
||||
|
||||
weechat_auto_connect = old_auto_connect;
|
||||
|
||||
if (plugin_argv)
|
||||
free (plugin_argv);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user