Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import sys
- import socket
- import string
- import re
- HOST="irc.freenode.net"
- PORT=6667
- NICK="xxx"
- PASSWORD="xxx"
- IDENT="xxx"
- REALNAME="django logger"
- CHANNELS=("#django", "#django-dev",)
- DEBUG=True
- readbuffer=""
- 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("NickServ identify %s\r\n" % PASSWORD)
- while 1:
- readbuffer=readbuffer+s.recv(1024)
- temp=string.split(readbuffer, "\n")
- readbuffer=temp.pop( )
- for line in temp:
- line=string.rstrip(line)
- if "You are now identified" in line:
- for channel in CHANNELS:
- s.send("JOIN %s\r\n" % (channel))
- line=string.split(line)
- if(line[0]=="PING"):
- s.send("PONG %s\r\n" % line[1])
- if("PRIVMSG" in line):
- channel = line[2]
- msg = " ".join(line[3:])[1:]
- user = re.findall("^:([^!]+)!", line[0])[0]
Add Comment
Please, Sign In to add comment