Commit 622771bd authored by stettberger's avatar stettberger

stiis - stettberger's ii system

parent 01b85d21
si
demultiplexer.py
input_shell
install:
mkdir -p ${HOME}/irc
mkdir -p ${HOME}/bin
touch ${HOME}/irc/serv.def
touch ${HOME}/irc/chan.def
cp irc_shell ${HOME}/bin
cp irc_client ${HOME}/bin
cp connect ${HOME}/bin
cp demultiplexer.py ${HOME}/bin
@echo
@echo "Installed stiis"
@echo
@echo "*******************************************"
@echo "* See README for details in Configuration *"
@echo "*******************************************"
\ No newline at end of file
Format of the $HOME/irc/serv.def:
$HOST;$SHORT_NAME;$PROGRAM
an example is:
irc.oftc.net;oftc;ii -s irc.oftc.net -f Didi
Format of the $HOME/irc/chan.def:
$HOST;$CHANNEL;$SHORT_NAME;$COLOR
example:
irc.oftc.net;#ii;ii;yellow
Colors can be:
red
green
yellow
blue
magenta
cyan
white
Programs:
connect - Reads the $HOME/irc/serv.def an executes $PROGRAM
demultiplexer.py - Demultiplexes all the Status outputes in $HOME/irc/out (based on inotify)
irc_client - opens 2 Xterms: a multitail with all channels and an with the irc_shell
irc_shell - Input shell
Input Shell:
/p - prints all "channels"
/s $SHORT_NAME - select the channel
/link <$SHORT_NAME> - Reads either the selectet channel or the actual channel for the last url, and opens it
#!/bin/sh
# Starting chats
while read i; do
PROG=$(echo $i | awk -F ';' '{print $3}');
$PROG &
done < $HOME/irc/serv.def
$HOME/bin/demultiplexer.py &
\ No newline at end of file
......@@ -39,6 +39,8 @@ for i in os.listdir(ircdir):
files.append([filename,fd, i])
tmp.append(filename)
print tmp
mask = EventsCodes.IN_MODIFY
ino = SimpleINotify()
wdd = ino.add_watch(tmp , mask, DeMulti(), rec=False)
......
#!/bin/sh
XTERM="xterm -fg white -bg black"
export IRCDIR="$HOME/irc"
sleep 5
# Channel Joinen
while read i; do
SERVER=$(echo $i | awk -F ';' '{print $1 }')
CHANNEL=$(echo $i | awk -F ';' '{print $2}')
echo "/j $CHANNEL" > $IRCDIR/$SERVER/in
echo "Joined $CHANNEL"
WATCH="$WATCH -f $IRCDIR/$SERVER/$CHANNEL/out"
done < $IRCDIR/chan.def
WATCH="$WATCH -f $IRCDIR/out"
$XTERM -e multitail -CS irc $WATCH -s 2 &
$XTERM -e $HOME/bin/irc_shell
......@@ -155,12 +155,38 @@ def proc_input(line):
t.write("%s\n"%line)
t.close()
# Try to open config file:
fd=open("%s/.si_shellrc"%os.environ['HOME'])
for i in fd.readlines():
if i[0]=="#":
continue
proc_input("/"+i.replace("\n", ""))
def init():
##Servers
try:
fd=open("%s/serv.def"%ircdir)
except:
print "Error: Couldn't open servers definition"
sys.exit(-1)
for i in fd.readlines():
i=i.split(";", 3)
if len(i)<3:
print i, "is not a valid line (serv.def)"
continue
servers.append(Server(i[0], i[1]))
fd.close()
try:
fd=open("%s/chan.def"%ircdir)
except:
print "Error: Couldn't open channel definition"
for i in fd.readlines():
i=i.split(";", 3)
if len(i)<4:
print i, "is not a valid line (chan.def)"
continue
for s in servers:
if s.host == i[0]:
try:
s.add_channel(i[1], i[2], Server.colors[i[3].replace("\n","")])
except:
print i, " couldn't be appended (chan.def)"
# Initialize channels
init()
while True:
if globals()['now']==None:
......@@ -168,7 +194,10 @@ while True:
globals()['now']=['','',None]
else:
globals()['now']=servers[0].channels[0]
line=raw_input("%s> "%globals()['now'][1])
try:
line=raw_input("%s> "%globals()['now'][1])
except:
sys.exit(0)
if len(line)==0:
continue
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment