summaryrefslogtreecommitdiff
path: root/bin/ii-connect
blob: 652f94a704f8d73dc5486a9ca98f57d2f18426e2 (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
#!/bin/sh

# identify to nickserv and log in to the correct irc channels

# shellcheck disable=SC2119,SC2120

# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"

# wait for nickserv complaint
while ! grep -qF 'This nickname is registered. Please choose a different nickname' "${irc_dir}/nickserv/out"; do
  sleep 1
done

# wait for registering to succeed
while ! grep -q 'You are \(now identified for\|already logged in as\) ' "${irc_dir}/nickserv/out"; do
  # register
  printf 'identify %s\n' "${irc_password}" | \
    sponge "${irc_dir}/nickserv/in"
  sleep 5
done

# join channel
echo '/j #archlinux32' | \
  sponge "${irc_dir}/in"