This introduces a new command called "handshake" in the weechat relay protocol.
It should be sent by the client before the "init" command, to negotiate the way
to authenticate with a password.
3 new options are added:
* relay.network.auth_password
* relay.network.hash_iterations
* relay.network.nonce_size
Now the status "waiting_auth" is used and displayed in the relay buffer.
When a client connects, there are now 2 messages (except for irc protocol if
there's no password required):
relay: new client on port 9000: 1/weechat/1.2.3.4 (waiting auth)
relay: client 1/weechat/1.2.3.4 authenticated
If the authentication fails, the messages are:
relay: new client on port 9000: 1/weechat/1.2.3.4 (waiting auth)
=!= relay: authentication failed with client 1/weechat/1.2.3.4
The relay client is supposed to be safe by default, and the relay connection
should be protected by the different ways (restriction on IP address, SSL,
strong password, Time-based One-Time Password, local bind address and use of
SSH tunnel…).
So this option lets the user add extra security by allowing only some
commands (whitelist), or allowing any commands except a list of given
commands (blacklist).
This pointer is the first argument received by callbacks, and the
existing argument "data" is now automatically freed by WeeChat when the
object containing the callback is removed.
With this new pointer, the linked list of callbacks in scripts has been
removed. This will improve speed of scripts (using a lot of hooks),
reduce memory used by scripts and reduce time to unload scripts.
Following functions are affected in the C API:
* exec_on_files
* config_new
* config_new_section
* config_new_option
* hook_command
* hook_command_run
* hook_timer
* hook_fd
* hook_process
* hook_process_hashtable
* hook_connect
* hook_print
* hook_signal
* hook_hsignal
* hook_config
* hook_completion
* hook_modifier
* hook_info
* hook_info_hashtable
* hook_infolist
* hook_hdata
* hook_focus
* unhook_all_plugin
* buffer_new
* bar_item_new
* upgrade_new
* upgrade_read
Some commands like /upgrade sent by relay client can cause problems, because
they were executed immediately (while relay code is running). The /upgrade
command unloads all plugins, so the result is unpredictable (it can cause a
crash).
This commit adds a timer (1 millisecond) to delay the execution of command
after we go back in the WeeChat main loop.
The temporary option was introduced because the nicklist diff was experimental.
It is now enabled by default, and there is no way to disable it. Therefore any
relay client using weechat protocol must implement the message "_nicklist_diff"
(unless nicklist is ignored by client).
Extra note: a full nicklist may still be sent if a message with diff would be
bigger than whole nicklist. So both full nicklist (message "_nicklist") and
nicklist diff (message "_nicklist_diff") must be implemented by clients.
This is an experimental feature, that must be explicitely enabled by clients
(for weechat protocol) in the init command with option "nicklistdiff", for example:
init password=mypasswd,nicklistdiff=1
This option will be removed when clients will handle nicklist diff.
Fix:
- use proper arguments in commands sync/desync (use argv[0] instead of argv[1])
- when searching if a buffer is synchronized, its name has higher priority on "*"
(so first check if buffer is synchronized, and if not found, search if "*" is
synchronized)
- when receiving a "nicklist_*" signal, check if the buffer is synchronized with
flag "RELAY_WEECHAT_PROTOCOL_SYNC_NICKLIST"