Introduction
Introduction Statistics Contact Development Disclaimer Help
annna-start-server - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
annna-start-server (1494B)
---
1 #!/bin/sh
2
3 export IRC_SERVERBASE="${ANNNA_IRCBASE}/${IRC_SERVER}"
4 while annna-alive;
5 do
6 rm -rf "${IRC_SERVERBASE}"
7 mkdir -p "${IRC_SERVERBASE}"
8
9 [ $IRC_TLS -gt 0 ] && tlsparam=" -v -t"
10 [ -n "${IRC_USER}" ] && ircuserparam=" -n ${IRC_USER}"
11 ircpassparam=""
12 [ -n "${IRC_PASS}" ] && ircpassparam=" -k IRC_PASS"
13
14 ii -s "${IRC_SERVER}"${ircpassparam}${ircuserparam}${tlsparam} \
15 -f "${IRC_NAME}" -p ${IRC_PORT} 2>&1 \
16 | while read -r servermsg;
17 do
18 annna-alive || exit 1
19 servermsg="$(printf "%s\n" "${servermsg}" | sed -e 's,\r$,,')"
20
21 export IRC_PASS=
22 export IRC_CMD_USER="$(printf "%s\n" "${servermsg}" \
23 | cut -d' ' -f 2 \
24 | cut -d':' -f 2 \
25 | cut -d'!' -f 1)"
26 export IRC_CMD="$(printf "%s\n" "${servermsg}" \
27 | cut -d' ' -f 3)"
28 export IRC_PRIVMSG_TEXT=""
29
30 case "${IRC_CMD}" in
31 "433") exit 1;; # Nickname in use.
32 "001") annna-join-channels;; # Welcome.
33 "NICK"|"353"|"332"|"PING");;
34 "PART")
35 export IRC_CHANNEL="$(printf "%s\n" "${servermsg}" \
36 | cut -d' ' -f 4)"
37 annna-channel-message
38 ;;
39 "JOIN")
40 export IRC_CHANNEL="$(printf "%s\n" "${servermsg}" \
41 | cut -d' ' -f 4 \
42 | cut -d':' -f 2-)"
43 annna-channel-message
44 ;;
45 "PRIVMSG"|"NOTICE")
46 export IRC_CHANNEL="$(printf "%s\n" "${servermsg}" \
47 | cut -d' ' -f 4)"
48 export IRC_PRIVMSG_TEXT="$(printf "%s\n" "${servermsg}" \
49 | cut -d' ' -f 5- \
50 | cut -d':' -f 2-)"
51 annna-channel-message
52 ;;
53 esac
54 done
55
56 rm -rf "${IRC_SERVERBASE}"
57 [ ! -f "${IRC_SERVER}/reconnect" ] && break
58 sleep 5
59 done
60
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.