# -*- coding: windows-1251 -*-
import sys
import socket
import string
log = open("log","w")
HOST="irc.turli.net"
PORT=6667
NICK="d327h"
IDENT="H311"
REALNAME="noname"
readbuffer=""
def send(stren):
s.send(stren)
bac = s.recv(1024)
return bac
def l2s(listeg):
tru=listeg[4:]
return ' '.join(tru)
idinax = 'go away nigga'
s=socket.socket( )
s.connect((HOST, PORT))
s.send("NICK %s\r\n" % NICK)
s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
s.send("JOIN #unix\n")
while 1:
readbuffer=readbuffer+s.recv(1024)
temp=string.split(readbuffer, "\n")
readbuffer=temp.pop( )
for line in temp:
line=string.rstrip(line)
line=string.split(line)
print line
leng=len(line)
atc=line[0]
log.write("\n".join(line))
if(line[0]=="PING"):
s.send("PONG %s\r\n" % line[1])
elif(len(line)>=4):
if(line[3]==":!bla"):
s.send("PRIVMSG %s %s\r\n" % (line[2],idinax))
if(line[3]==":\xea\xf3"):
s.send("PRIVMSG %s %s\r\n" % (line[2],"hi"))
if(line[3]==":!s"):
if(atc[:3]==":xN"):
assd=send(l2s(line))
s.send("NOTICE xN %s" % (assd))
else:
s.send("PRIVMSG %s u are noob=)" % (line[2])
log.close()