2 ## @author Michael Klier <chi@chimeric.de>
3 # @www http://www.chimeric.de/pojects/ZenTwitter
4 ## Multi-user support by Isengrin L. Feuille <Autumnspeech@gmail.com>
5 # trivial twitter status update client
8 URL
="https://twitter.com/statuses/update.xml"
16 USER
=$
(${ZENITY} --entry --text="You haven't configured Zentwitter, enter your username" --title="ZenTwitter")
17 while [[ $
(echo "${USER}" |
tr -d ' ') == "" ]];
19 USER
=$
(${ZENITY} --entry --text="D'oh! You entered nothing! Write your username again or check if it's in ~/.zentwitterrc:" --title="ZenTwitter")
26 PASS
=$
(${ZENITY} --entry --text="Now enter your password" --title="ZenTwitter")
27 while [[ $
(echo "${PASS}" |
tr -d ' ') == "" ]];
29 PASS
=$
(${ZENITY} --entry --text="D'oh! You entered nothing! Write your password again or check if it's in ~/.zentwitterrc:" --title="ZenTwitter")
38 USER
=$
(${SED} -n 1p
$ZTRC)
39 PASS
=$
(${SED} -n 2p
$ZTRC)
42 # check if zenity is installed
43 if [[ ! -x $ZENITY ]];
45 echo "ERROR: Zenity is missing!"
49 # check if curl is installed
52 $ZENITY --error --text="ERROR: curl is missing" --title="ZenTwitter"
56 # check if sed is installed
59 $ZENITY --error --text="ERROR: sed is missing" --title="ZenTwitter"
63 # get tweet & update status
69 export tweet
=$
(${ZENITY} --entry --text="Gimme your tweet:" --title="ZenTwitter")
72 while [[ $
(echo "${tweet}" |
tr -d ' ') == "" ]];
74 tweet
=$
(${ZENITY} --entry --text="D'oh! You entered nothing! Try again or cancel:" --title="ZenTwitter")
81 export count
=`echo "$tweet" | wc -m`;
83 if [ $count -gt 140 ]; then
84 $ZENITY --error --text="Your status was over 140 characters." --title="ZenTwitter"
88 if [ -z "$tweet" ]; then
89 $ZENITY --error --text="Your status wasn't changed." --title="ZenTwitter"
92 $CURL -u ${USER}:${PASS} -d status="${tweet}" -d source="ZenTwitter" -s ${URL}
102 # $ZENITY --info --text="Updated successful!" --title="ZenTwitter"
105 $ZENITY --error --text="Something went wrong!\nRun ZenTwitter from a commandline for more information!" --title="ZenTwitter"