Include tox chat in mesh options

This commit is contained in:
Bob Mottram 2015-08-26 20:28:01 +01:00
parent fedc82ea9e
commit 20084820a1
1 changed files with 94 additions and 29 deletions

View File

@ -28,6 +28,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
IRSSI_PATH=/usr/bin/irssi
MUMBLE_PATH=/usr/bin/mumble
TOXIC_PATH=/usr/local/bin/toxic
DHTNODES=/usr/local/share/toxic/DHTnodes
IRC_PORT=6697 IRC_PORT=6697
PEERS_FILE=/tmp/meshpeers.txt PEERS_FILE=/tmp/meshpeers.txt
@ -35,6 +40,14 @@ if [ ! -f /usr/bin/batman ]; then
freedombone-client freedombone-client
fi fi
# alternative toxic paths
if [ -f /usr/bin/toxic ]; then
TOXIC_PATH=/usr/bin/toxic
fi
if [ -f /usr/share/toxic/DHTnodes ]; then
DHTNODES=/usr/share/toxic/DHTnodes
fi
if [ ! -f /tmp/meshtype ]; then if [ ! -f /tmp/meshtype ]; then
sudo batman start sudo batman start
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
@ -66,7 +79,7 @@ echo "| | | "
echo "|--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-. " echo "|--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-. "
echo "| | (.-' (.-' ( | ( )| | | | )( )| | (.-' " echo "| | (.-' (.-' ( | ( )| | | | )( )| | (.-' "
echo "' ' --' --' -' - -' ' ' -' -' -' ' - --'" echo "' ' --' --' -' - -' ' ' -' -' -' ' - --'"
echo ' M E S H N E T W O R K' echo ' Freedom in the Mesh'
echo '' echo ''
echo 'Please choose a peer to connect to:' echo 'Please choose a peer to connect to:'
idx=1 idx=1
@ -101,30 +114,55 @@ if [ ! $AVAHI_DOMAIN ]; then
fi fi
# Connect to IRC # Connect to IRC
if [ ! -f /usr/bin/irssi ]; then if [ ! -f $IRSSI_PATH ]; then
if [ -f /usr/bin/mumble ]; then if [ ! -f $TOXIC_PATH ]; then
mumble & if [ -f $MUMBLE_PATH ]; then
exit 0 MUMBLE_PATH &
exit 0
fi
echo 'You need irssi/mumble/toxic installed on your system'
sudo batman stop
exit 4
fi fi
echo 'You need irssi and/or mumble installed on your system'
sudo batman stop
exit 4
fi fi
if [ ! -f /usr/bin/mumble ]; then if [ ! -f $MUMBLE_PATH ]; then
if [ -f /usr/bin/irssi ]; then if [ ! -f $TOXIC_PATH ]; then
irssi -c $AVAHI_DOMAIN -p $IRC_PORT -n $USER if [ -f $IRSSI_PATH ]; then
exit 0 $IRSSI_PATH -c $AVAHI_DOMAIN -p $IRC_PORT -n $USER
exit 0
fi
echo 'You need irssi/mumble/toxic installed on your system'
sudo batman stop
exit 4
fi
fi
if [ ! -f $MUMBLE_PATH ]; then
if [ ! -f $IRSSI_PATH ]; then
if [ -f $TOXIC_PATH ]; then
lstox -f dht > $DHTNODES
PEER_TOX_ID=$(lstox -p $AVAHI_DOMAIN | head -n 1 | awk -F ' ' '{print $2}')
if [ ${#PEER_TOX_ID} -gt 30 ]; then
echo "/add $PEER_TOX_ID
" | $TOXIC_PATH -d
exit 0
else
echo "Tox ID for $AVAHI_DOMAIN was not found"
exit 6
fi
fi
echo 'You need irssi/mumble/toxic installed on your system'
sudo batman stop
exit 4
fi fi
echo 'You need irssi and/or mumble installed on your system'
sudo batman stop
exit 4
fi fi
echo '' echo ''
echo 'Choose communication service:' echo 'Choose communication service:'
echo ' 1. VoIP + Instant Messaging' echo ' 1. VoIP'
echo ' 2. IRC (WARNING: not encrypted)' echo ' 2. Tox Chat'
echo ' 3. IRC (WARNING: not encrypted)'
echo '' echo ''
read peer_index read peer_index
@ -137,19 +175,46 @@ if [ ! $peer_index ]; then
fi fi
if [[ $peer_index == 1 ]]; then if [[ $peer_index == 1 ]]; then
echo '' if [ -f $MUMBLE_PATH ]; then
echo 'To setup for the first time click "Add New", then set:' echo ''
echo " Label: $AVAHI_DOMAIN" echo 'To setup for the first time click "Add New", then set:'
echo " Address: $AVAHI_DOMAIN" echo " Label: $AVAHI_DOMAIN"
echo ' Port: 64738' echo " Address: $AVAHI_DOMAIN"
echo " Username: $USER" echo ' Port: 64738'
echo '' echo " Username: $USER"
echo 'Press Enter to continue.' echo ''
echo '' echo 'Press Enter to continue.'
read peer_index echo ''
mumble & read peer_index
$MUMBLE_PATH &
else
echo 'Mumble may not be installed on this system'
exit 5
fi
else else
irssi -c $AVAHI_DOMAIN -p $IRC_PORT -n $USER if [[ $peer_index == 2 ]]; then
if [ -f $TOX_PATH ]; then
lstox -f dht > $DHTNODES
PEER_TOX_ID=$(lstox -p $AVAHI_DOMAIN | head -n 1 | awk -F ' ' '{print $2}')
if [ ${#PEER_TOX_ID} -gt 30 ]; then
echo "/add $PEER_TOX_ID
" | $TOXIC_PATH -d
else
echo "Tox ID for $AVAHI_DOMAIN was not found"
exit 6
fi
else
echo 'Tox may not be installed on this system'
exit 7
fi
else
if [ -f $IRSSI_PATH ]; then
$IRSSI_PATH -c $AVAHI_DOMAIN -p $IRC_PORT -n $USER
else
echo 'Irssi may not be installed on this system'
exit 8
fi
fi
fi fi
exit 0 exit 0