summaryrefslogtreecommitdiff
path: root/skel/parabola-irc.sh
blob: b457e712dc9ad2e25a6f831f760f1a11272c3bd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

DEFAULT_NICK='parabola-user' # ASSERT: as defined in ~/.purple/accounts.xml and ~/.purple/blist.xml


if [ -z "$(grep $DEFAULT_NICK@irc.freenode.net ~/.purple/accounts.xml)" ] || \
   [ -z "$(grep $DEFAULT_NICK@irc.freenode.net ~/.purple/blist.xml   )" ]
then if zenity --question --width=320 \
               --title="Parabola IRC Login" \
               --text="The default 'parabola-user' freenode IRC account has been modified. \
This desktop shortcut is only for that account. You can either restore Pidgin to it's default \
configuration (deleting any changes you have made); or delete this shortcut from the desktop." \
               --ok-label="Reset Pidgin completely" \
               --cancel-label="Remove this desktop shortcut"
     then cp ~/.purple/accounts.default.xml ~/.purple/accounts.xml
          cp ~/.purple/blist.default.xml    ~/.purple/blist.xml
     else rm ~/Desktop/parabola-irc.desktop
          rm ~/parabola-irc.sh
          exit
     fi
fi

nick=$(zenity --entry --width=320          \
              --title="Parabola IRC Login" \
              --text="Choose a nick-name:" \
              --entry-text=$DEFAULT_NICK   )
nick=${nick// /} ; [ "$nick" ] || nick=$DEFAULT_NICK ;

sed -i "s|$DEFAULT_NICK@irc.freenode.net|$nick@irc.freenode.net|" ~/.purple/accounts.xml
sed -i "s|$DEFAULT_NICK@irc.freenode.net|$nick@irc.freenode.net|" ~/.purple/blist.xml

pidgin