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

# register
printf 'identify %s\n' "${irc_password}" | \
  sponge "${irc_dir}/nickserv/in"

# wait for registering to succeed
while ! grep -qF 'You are now identified for' "${irc_dir}/nickserv/out"; do
  sleep 1
done

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