tazirc rev 9

Add an ask/interactive mode on startup
author Christophe Lincoln <pankso@slitaz.org>
date Tue Jan 14 23:25:58 2014 +0100 (2014-01-14)
parents 58eaeeaa5468
children 1b813a8d6daf
files po/fr.po po/tazirc.pot tazirc
line diff
     1.1 --- a/po/fr.po	Tue Jan 14 21:46:08 2014 +0100
     1.2 +++ b/po/fr.po	Tue Jan 14 23:25:58 2014 +0100
     1.3 @@ -7,8 +7,8 @@
     1.4  msgstr ""
     1.5  "Project-Id-Version: TazIRC 1.0\n"
     1.6  "Report-Msgid-Bugs-To: \n"
     1.7 -"POT-Creation-Date: 2014-01-14 21:42+0100\n"
     1.8 -"PO-Revision-Date: 2014-01-14 19:17+0100\n"
     1.9 +"POT-Creation-Date: 2014-01-14 23:15+0100\n"
    1.10 +"PO-Revision-Date: 2014-01-14 23:24+0100\n"
    1.11  "Last-Translator: Christophe Lincoln <pankso@slitaz.org>\n"
    1.12  "Language-Team: French\n"
    1.13  "Language: fr\n"
    1.14 @@ -17,39 +17,69 @@
    1.15  "Content-Transfer-Encoding: 8bit\n"
    1.16  "Plural-Forms: nplurals=2; plural=(n > 1);\n"
    1.17  
    1.18 -#: tazirc:19 tazirc-lb:18
    1.19 +#: tazirc:26
    1.20 +msgid "Auto-join a channel is optionnal"
    1.21 +msgstr "Rejoindre automatiquement un canal est une option"
    1.22 +
    1.23 +#: tazirc:29
    1.24 +#: tazirc:31
    1.25 +msgid "IRC server : "
    1.26 +msgstr "Server IRC : "
    1.27 +
    1.28 +#: tazirc:34
    1.29 +msgid "Nick name  : "
    1.30 +msgstr "Pseudo     : "
    1.31 +
    1.32 +#: tazirc:37
    1.33 +msgid "Channel    : "
    1.34 +msgstr "Canal      : "
    1.35 +
    1.36 +#: tazirc:41
    1.37 +msgid "empty value"
    1.38 +msgstr "Valeure vide"
    1.39 +
    1.40 +#: tazirc:57
    1.41 +#: tazirc-lb:18
    1.42  msgid "Usage:"
    1.43  msgstr "Utilisation:"
    1.44  
    1.45 -#: tazirc:21 tazirc-lb:20
    1.46 +#: tazirc:59
    1.47 +#: tazirc-lb:20
    1.48  msgid "Options:"
    1.49  msgstr "Options:"
    1.50  
    1.51 -#: tazirc:22
    1.52 +#: tazirc:60
    1.53  msgid "Join specified channel after connection"
    1.54  msgstr "Joindre la canal après connection"
    1.55  
    1.56 -#: tazirc:23 tazirc-lb:22
    1.57 +#: tazirc:61
    1.58 +#: tazirc-lb:22
    1.59  msgid "Use specified mode. Default: +i"
    1.60  msgstr "Utilise le mode spécifié. Défaut: +i"
    1.61  
    1.62 -#: tazirc:24 tazirc-lb:23
    1.63 +#: tazirc:62
    1.64 +#: tazirc-lb:23
    1.65  msgid "Use specified port. Default: 6667"
    1.66  msgstr "Utilise le port spécifié. Défaut: 6667"
    1.67  
    1.68 -#: tazirc:57 tazirc-lb:44
    1.69 +#: tazirc:63
    1.70 +msgid "Will ask for server, nick and channel"
    1.71 +msgstr "Demande le nom de server, pseudo et canal"
    1.72 +
    1.73 +#: tazirc:89
    1.74 +#: tazirc-lb:44
    1.75  msgid "Connecting to:"
    1.76  msgstr "Connection à:"
    1.77  
    1.78 -#: tazirc:93
    1.79 +#: tazirc:127
    1.80  msgid "Joining:"
    1.81  msgstr "Adhésion à:"
    1.82  
    1.83 -#: tazirc:96
    1.84 +#: tazirc:130
    1.85  msgid "Diconnecting from:"
    1.86  msgstr "Déconnection de:"
    1.87  
    1.88 -#: tazirc:103
    1.89 +#: tazirc:137
    1.90  msgid "No channel to send to"
    1.91  msgstr "Pas canal dans lequel envoyer"
    1.92  
     2.1 --- a/po/tazirc.pot	Tue Jan 14 21:46:08 2014 +0100
     2.2 +++ b/po/tazirc.pot	Tue Jan 14 23:25:58 2014 +0100
     2.3 @@ -8,7 +8,7 @@
     2.4  msgstr ""
     2.5  "Project-Id-Version: TazIRC 1.0\n"
     2.6  "Report-Msgid-Bugs-To: \n"
     2.7 -"POT-Creation-Date: 2014-01-14 21:42+0100\n"
     2.8 +"POT-Creation-Date: 2014-01-14 23:15+0100\n"
     2.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    2.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    2.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    2.12 @@ -17,39 +17,63 @@
    2.13  "Content-Type: text/plain; charset=CHARSET\n"
    2.14  "Content-Transfer-Encoding: 8bit\n"
    2.15  
    2.16 -#: tazirc:19 tazirc-lb:18
    2.17 +#: tazirc:26
    2.18 +msgid "Auto-join a channel is optionnal"
    2.19 +msgstr ""
    2.20 +
    2.21 +#: tazirc:29 tazirc:31
    2.22 +msgid "IRC server : "
    2.23 +msgstr ""
    2.24 +
    2.25 +#: tazirc:34
    2.26 +msgid "Nick name  : "
    2.27 +msgstr ""
    2.28 +
    2.29 +#: tazirc:37
    2.30 +msgid "Channel    : "
    2.31 +msgstr ""
    2.32 +
    2.33 +#: tazirc:41
    2.34 +msgid "empty value"
    2.35 +msgstr ""
    2.36 +
    2.37 +#: tazirc:57 tazirc-lb:18
    2.38  msgid "Usage:"
    2.39  msgstr ""
    2.40  
    2.41 -#: tazirc:21 tazirc-lb:20
    2.42 +#: tazirc:59 tazirc-lb:20
    2.43  msgid "Options:"
    2.44  msgstr ""
    2.45  
    2.46 -#: tazirc:22
    2.47 +#: tazirc:60
    2.48  msgid "Join specified channel after connection"
    2.49  msgstr ""
    2.50  
    2.51 -#: tazirc:23 tazirc-lb:22
    2.52 +#: tazirc:61 tazirc-lb:22
    2.53  msgid "Use specified mode. Default: +i"
    2.54  msgstr ""
    2.55  
    2.56 -#: tazirc:24 tazirc-lb:23
    2.57 +#: tazirc:62 tazirc-lb:23
    2.58  msgid "Use specified port. Default: 6667"
    2.59  msgstr ""
    2.60  
    2.61 -#: tazirc:57 tazirc-lb:44
    2.62 +#: tazirc:63
    2.63 +msgid "Will ask for server, nick and channel"
    2.64 +msgstr ""
    2.65 +
    2.66 +#: tazirc:89 tazirc-lb:44
    2.67  msgid "Connecting to:"
    2.68  msgstr ""
    2.69  
    2.70 -#: tazirc:93
    2.71 +#: tazirc:127
    2.72  msgid "Joining:"
    2.73  msgstr ""
    2.74  
    2.75 -#: tazirc:96
    2.76 +#: tazirc:130
    2.77  msgid "Diconnecting from:"
    2.78  msgstr ""
    2.79  
    2.80 -#: tazirc:103
    2.81 +#: tazirc:137
    2.82  msgid "No channel to send to"
    2.83  msgstr ""
    2.84  
     3.1 --- a/tazirc	Tue Jan 14 21:46:08 2014 +0100
     3.2 +++ b/tazirc	Tue Jan 14 23:25:58 2014 +0100
     3.3 @@ -13,26 +13,59 @@
     3.4  TEXTDOMAIN='tazirc'
     3.5  export TEXTDOMAIN
     3.6  
     3.7 -if [ ! "$1" ] || [ ! "$2" ]; then
     3.8 +# Early function used by --ask
     3.9 +logo() {
    3.10 +	clear
    3.11 +	colorize 30 "TazIRC - SliTaz IRC Client"
    3.12 +}
    3.13 +
    3.14 +# Handle ask mode now. So we set $host $nick and optionnaly $chan
    3.15 +# Ask only for a nick: tazirc --ask --host=irc.freenode.net --chan=slitaz
    3.16 +if [ "$ask" ]; then
    3.17 +	logo
    3.18 +	gettext "Auto-join a channel is optionnal"; echo ""
    3.19 +	newline
    3.20 +	if [ "$host" ]; then
    3.21 +		gettext "IRC server : "; echo "$host"
    3.22 +	else
    3.23 +		gettext "IRC server : "; read host
    3.24 +	fi
    3.25 +	if [ ! "$nick" ]; then 
    3.26 +		gettext "Nick name  : "; read nick
    3.27 +	fi
    3.28 +	if [ ! "$chan" ]; then
    3.29 +		gettext "Channel    : "; read chan
    3.30 +	fi
    3.31 +	newline
    3.32 +	if [ ! "$host" ] || [ ! "$nick" ]; then
    3.33 +		echo "$(colorize 31 'ERROR:') $(gettext 'empty value')"
    3.34 +		newline && exit 0
    3.35 +	fi
    3.36 +fi
    3.37 +
    3.38 +# Cmdline --options= are parsed by libtaz.sh
    3.39 +[ "$host" ] || host="$1"
    3.40 +[ "$nick" ] || nick="$2"
    3.41 +[ "$mode" ] || mode="+i"
    3.42 +[ "$port" ] || port="6667"
    3.43 +send="/tmp/tazirc/${host}.${nick}.$$.txt"
    3.44 +
    3.45 +# Help and usage without 2 cmdline args
    3.46 +if [ ! "$host" ] || [ ! "$nick" ]; then
    3.47  	cat << EOT
    3.48  
    3.49 -$(boldify "$(gettext 'Usage:')") $(basename $0) [host] [nick] [--option]" 
    3.50 +$(boldify "$(gettext 'Usage:')") $(basename $0) [host] [nick] [--option]
    3.51  
    3.52  $(boldify "$(gettext 'Options:')")
    3.53    --chan=    $(gettext "Join specified channel after connection")
    3.54    --mode=    $(gettext "Use specified mode. Default: +i")
    3.55    --port=    $(gettext "Use specified port. Default: 6667")
    3.56 +  --ask      $(gettext "Will ask for server, nick and channel")
    3.57  
    3.58  EOT
    3.59  	exit 0
    3.60  fi
    3.61  
    3.62 -# Cmdline --options= are parsed by libtaz.sh
    3.63 -[ "$mode" ] || mode="+i"
    3.64 -[ "$port" ] || port="6667"
    3.65 -host="$1" && nick="$2"
    3.66 -send="/tmp/tazirc/${host}.${nick}.$$.txt"
    3.67 -
    3.68  # Clean up on exit
    3.69  trap "echo 'Exiting...' && rm -f $send" SIGINT INT TERM
    3.70  trap "kill 0" EXIT
    3.71 @@ -51,10 +84,11 @@
    3.72  # Start: send login commands to connect to server then handle commands
    3.73  #
    3.74  
    3.75 -# Introduce me!
    3.76 -clear
    3.77 -colorize 30 "TazIRC - SliTaz IRC Client"
    3.78 +# Hello World!
    3.79 +[ ! "$ask" ] && logo
    3.80  boldify "$(gettext 'Connecting to:') $host $([ $chan ] && echo \#${chan})"
    3.81 +
    3.82 +# Login commands
    3.83  cat > ${send} << EOT
    3.84  NICK $nick
    3.85  USER $nick $mode * :$0