Skip to content

Commit f87e7c2

Browse files
committed
New Version 0.7
1 parent a4c4a2b commit f87e7c2

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

togglestate

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ do
99
done
1010
echo
1111

12-
version="0.6"
12+
version="0.7"
1313
# Now with GitHub :D
1414

1515
function getstate {
@@ -26,23 +26,24 @@ function changestate {
2626
echo -e "{\n\t\"space\": \"$var_space\"," # Create JSON
2727
if [[ $(getstate $3) = $var_state || $var_state = "show" ]] ; then
2828
if [[ $(getstate $3) = $var_state ]]; then
29-
echo -e "\t\"change\": \"no change\",\n"
29+
echo -e "\t\"state\": \"no change\",\n"
3030
fi
3131
echo "$(getstate $3)"
3232
else
3333
if [ $var_token = $1 ]; then
3434
if [ $var_state = "open" ]; then
3535
sed -i s/'"open": false'/'"open": true'/g $3
3636
sed -i s/CLOSED/OPEN/g $4
37-
echo -e "\t\"change\": \"open\","
37+
#nc
38+
echo -e "\t\"status\": \"open\","
3839
elif [ $var_state = "closed" ]; then
3940
sed -i s/'"open": true'/'"open": false'/g $3
4041
sed -i s/OPEN/CLOSED/g $4
41-
echo -e "\t\"change\": \"closed\","
42+
echo -e "\t\"status\": \"closed\","
4243
elif [ $var_state = "help" ]; then
4344
echo -e "\t\"available_commands\": {\n\t\t\"open\": \"Set status to 'open'\",\n\t\t\"closed\": \"Set status to closed\",\n\t\t\"show\": \"Show current sace status\",\n\t\t\"help\": \"Show this help\"\n\t},"
4445
else
45-
echo -e "\t\"change\": \"unchanged because of wrong given state information\",\n\t\"hint\": \"try 'help' as parameter for available options\","
46+
echo -e "\t\"status\": \"unchanged because of wrong given state information\",\n\t\"hint\": \"try 'help' as parameter for available options\","
4647
fi
4748
echo -e "\t\"access\": \"authorized\","
4849
else
@@ -55,7 +56,7 @@ function changestate {
5556
}
5657

5758
# Die Konfiguration wird aus einer Seperaten nicht mit dem git gesyncten CSV Datei gelesen:
58-
IFS=':'
59+
IFS='|'
5960
declare -a config=( $( cat $(dirname $0)/spaceapi-server/config.csv ) )
6061
IFS=$saveIFS
6162

@@ -65,14 +66,16 @@ case $var_space in
6566
token="${config[1]}"
6667
jsonfilename="${config[2]}"
6768
mapfilename="${config[3]}"
68-
changestate $token $var_space $jsonfilename $mapfilename
69+
returnhost="${config[4]}"
70+
changestate $token $var_space $jsonfilename $mapfilename $returnhost
6971
;;
7072
${config[5]})
7173
# Eintrag fuer den Slack channel: '/see-base show' s/show/open|closed|help/g
7274
token="${config[6]}"
7375
jsonfilename="${config[7]}"
7476
mapfilename="${config[8]}"
75-
changestate $token $var_space $jsonfilename $mapfilename
77+
returnhost="${config[7]}"
78+
changestate $token $var_space $jsonfilename $mapfilename $returnhost
7679
;;
7780
${config[10]})
7881
# Eintrag für den IRC Bot: !toolbox ["", "open", "closed"]

0 commit comments

Comments
 (0)