Commits

Anonymous committed 4022794

mention '/l' nickserv twice and add timeout to waiting for fifo

Comments (0)

Files changed (1)

 # "fifo command" pairs for each. Each server block should be separated by a new
 # line. I do not do any error checking for you, don't screw up the format.
 # For example:
-#
+# <start of $SERVERS>
 # irc.oftc.net mynick
 # in /j nickserv identify mypass
 # nickserv/in /l
+# nickserv/in /l
 # in /j #somechannel
 # in /j #anotherchannel
 # #somechannel/in hello channel
 # localhost differentnick
 # &bitlbee/in identify diffpass
 # &bitlbee/in blist
+# <EOF>
+#
+# TIP: note the "nickserv/in /l" twice, once identified nickserv tells you that
+#      you have been succesfully identifed, hence reopening the window if you
+#      have already closed it. True, this causes a race condition as nickserv
+#      may have already messages you before the first '/l'... but the waiting
+#      for a fifo loop now has a timeout :-)
 
 PREFIX="$HOME/irc"
 SERVERS="$PREFIX/servers"
 			fifo="${line%% *}"
 			cmd="${line#* }"
 			# wait for the fifo to exist, don't want to make a normal file
-			while ! [ -p "$PREFIX/$serv/$fifo" ]; do sleep 1; done
+			i=0
+			while ! [ -p "$PREFIX/$serv/$fifo" -a $i -lt 10 ]; do
+				i=$((i + 1))
+				sleep 1
+			done
+			if ! [ -p "$PREFIX/$serv/$fifo" ]; then
+				echo "WARNING: skipping $cmd > $PREFIX/$serv/$fifo: timed out"
+				continue
+			fi
 			echo "$cmd" > "$PREFIX/$serv/$fifo"
+			echo "$cmd > $PREFIX/$serv/$fifo"
 		done >> "$LOG" 2>&1 & # background so we can start ii
 
 		ii -n "$nick" -s "$serv" -i "$PREFIX"