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: 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.
|
* L: Ask the server for current chat buffer's length.
|
||||||
|
|
||||||
@ -29,9 +29,11 @@ Available commands:
|
|||||||
|
|
||||||
* q: Exit.
|
* q: Exit.
|
||||||
|
|
||||||
* e: Toggle encryption
|
* e: Toggle encryption.
|
||||||
|
|
||||||
* E: Set encryption password. (Can also be set via "DOBROHO_VECHORA_ENCRYPTION_PASSWORD" environment variable.)
|
* E: Set encryption password. (Can also be set via "DOBROHO_VECHORA_ENCRYPTION_PASSWORD" environment variable.)
|
||||||
|
|
||||||
|
* n: Change nickname.
|
||||||
|
|
||||||
|
|
||||||
Client prints "?" on unknown commands.
|
Client prints "?" on unknown commands.
|
||||||
|
@ -16,7 +16,10 @@ print_usage() {
|
|||||||
[ -z "${port}" ] && print_usage 'No port given.'
|
[ -z "${port}" ] && print_usage 'No port given.'
|
||||||
[ -z "${5}" ] || print_usage 'Too many arguments.'
|
[ -z "${5}" ] || print_usage 'Too many arguments.'
|
||||||
|
|
||||||
|
on_nick_set() {
|
||||||
[ -z "${nick}" ] || nick="<${nick}> "
|
[ -z "${nick}" ] || nick="<${nick}> "
|
||||||
|
}
|
||||||
|
on_nick_set
|
||||||
|
|
||||||
open_socket() {
|
open_socket() {
|
||||||
exec 3<> "/dev/tcp/${ip}/${port}"
|
exec 3<> "/dev/tcp/${ip}/${port}"
|
||||||
@ -115,7 +118,7 @@ wait_for_messages() {
|
|||||||
length=0
|
length=0
|
||||||
enc=0
|
enc=0
|
||||||
while :; do
|
while :; do
|
||||||
read cmd
|
read -r cmd
|
||||||
case "${cmd}" in
|
case "${cmd}" in
|
||||||
I)
|
I)
|
||||||
tmp="$(mktemp)"
|
tmp="$(mktemp)"
|
||||||
@ -124,7 +127,7 @@ while :; do
|
|||||||
rm "${tmp}"
|
rm "${tmp}"
|
||||||
;;
|
;;
|
||||||
i)
|
i)
|
||||||
read a
|
read -r a
|
||||||
send_message 0"${nick}$(echo "${a}" | encrypt)"
|
send_message 0"${nick}$(echo "${a}" | encrypt)"
|
||||||
;;
|
;;
|
||||||
L)
|
L)
|
||||||
@ -151,7 +154,7 @@ while :; do
|
|||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
E)
|
E)
|
||||||
read -s DOBROHO_VECHORA_ENCRYPTION_PASSWORD
|
read -r -s DOBROHO_VECHORA_ENCRYPTION_PASSWORD
|
||||||
export DOBROHO_VECHORA_ENCRYPTION_PASSWORD
|
export DOBROHO_VECHORA_ENCRYPTION_PASSWORD
|
||||||
;;
|
;;
|
||||||
e)
|
e)
|
||||||
@ -167,6 +170,10 @@ while :; do
|
|||||||
echo 0
|
echo 0
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
n)
|
||||||
|
read -r nick
|
||||||
|
on_nick_set
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo '?'
|
echo '?'
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user