Allow changing nicknames + minor fixes.
This commit is contained in:
parent
2dc8fd391c
commit
92dda7f46d
@ -17,7 +17,7 @@ Available commands:
|
||||
|
||||
* I: Calls the editor (from VISUAL variable, if unset EDITOR is used. If both unset vi is used) and send the message if it is not empty.
|
||||
|
||||
* i: Send the next string from stdout
|
||||
* i: Send the next string from stdout.
|
||||
|
||||
* L: Ask the server for current chat buffer's length.
|
||||
|
||||
@ -29,9 +29,11 @@ Available commands:
|
||||
|
||||
* q: Exit.
|
||||
|
||||
* e: Toggle encryption
|
||||
* e: Toggle encryption.
|
||||
|
||||
* E: Set encryption password. (Can also be set via "DOBROHO_VECHORA_ENCRYPTION_PASSWORD" environment variable.)
|
||||
|
||||
* n: Change nickname.
|
||||
|
||||
|
||||
Client prints "?" on unknown commands.
|
||||
|
@ -16,7 +16,10 @@ print_usage() {
|
||||
[ -z "${port}" ] && print_usage 'No port given.'
|
||||
[ -z "${5}" ] || print_usage 'Too many arguments.'
|
||||
|
||||
on_nick_set() {
|
||||
[ -z "${nick}" ] || nick="<${nick}> "
|
||||
}
|
||||
on_nick_set
|
||||
|
||||
open_socket() {
|
||||
exec 3<> "/dev/tcp/${ip}/${port}"
|
||||
@ -115,7 +118,7 @@ wait_for_messages() {
|
||||
length=0
|
||||
enc=0
|
||||
while :; do
|
||||
read cmd
|
||||
read -r cmd
|
||||
case "${cmd}" in
|
||||
I)
|
||||
tmp="$(mktemp)"
|
||||
@ -124,7 +127,7 @@ while :; do
|
||||
rm "${tmp}"
|
||||
;;
|
||||
i)
|
||||
read a
|
||||
read -r a
|
||||
send_message 0"${nick}$(echo "${a}" | encrypt)"
|
||||
;;
|
||||
L)
|
||||
@ -151,7 +154,7 @@ while :; do
|
||||
exit
|
||||
;;
|
||||
E)
|
||||
read -s DOBROHO_VECHORA_ENCRYPTION_PASSWORD
|
||||
read -r -s DOBROHO_VECHORA_ENCRYPTION_PASSWORD
|
||||
export DOBROHO_VECHORA_ENCRYPTION_PASSWORD
|
||||
;;
|
||||
e)
|
||||
@ -167,6 +170,10 @@ while :; do
|
||||
echo 0
|
||||
fi
|
||||
;;
|
||||
n)
|
||||
read -r nick
|
||||
on_nick_set
|
||||
;;
|
||||
*)
|
||||
echo '?'
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user