Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 20th, 2012  |  syntax: None  |  size: 0.68 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. while 1:
  2.                         try: #make sure you put add the except, or remove this try. i have it msg a channel when it errors, or print the error.
  3.                                 try:
  4.                                         self.irc.send('\r\n') #makes sure the connection is still alive, but doesnt actually send anything..
  5.                                         self.data = self.extra+self.irc.recv(1024) #make sure self.extra is pre-set to ''
  6.                                         self.data = self.data.replace("\r",'').split("\n")
  7.                                         self.extra = self.data.pop()
  8.                                 except socket.error:
  9.                                         sock = ''
  10.                                         self.irc.close()
  11.                                         exit()
  12.                                 for self.line in self.data:
  13.                                         if self.line != '':
  14.                                                 self.line = self.line.split(" ")
  15.                                                 #self.line[0] would be the first word of the line being sent from the server.