Anonymous avatar Anonymous committed 9c421a7

add chat.sh script

Comments (0)

Files changed (1)

+#!/bin/sh
+
+# SERVERS should be a file with a list of "server nick" pairs with a list of
+# "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:
+#
+# irc.oftc.net mynick
+# in /j nickserv identify mypass
+# nickserv/in /l
+# in /j #somechannel
+# in /j #anotherchannel
+# #somechannel/in hello channel
+#
+# localhost differentnick
+# &bitlbee/in identify diffpass
+# &bitlbee/in blist
+
+PREFIX="$HOME/irc"
+SERVERS="$PREFIX/servers"
+
+while read line; do
+	serv="${line%% *}"
+	nick="${line#* }"
+
+	# start ii first, so we don't hang trying to write to the fifo
+	while true; do
+		ii -n "$nick" -s "$serv" -i "$PREFIX" 
+		[ $? -eq 2] || break # only restart ii on timeout (not default for ii)
+	done &
+
+	while read line; do
+		[ -n "$line" ] || break # stop on empty line
+		fifo="${line%% *}"
+		cmd="${line#* }"
+		echo "$cmd" > "$PREFIX/$serv/$fifo"
+	done
+done
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.