def listen(): readbuffer = "" while True: # loop FOREVER (exit with ctrl c) # all of the code between set 1 and set 2 is just putting the message received from the server into a nice format for us # set 1 readbuffer=readbuffer+s.recv(1024).decode() # store info sent from the server into print("LTHREAD received data") temp=readbuffer.split("\n") # remove \n from the readbuffer and store in a temp variable readbuffer=temp.pop( ) # restore readbuffer to empty #totranslate = "" for line in temp: # parse through every line read from server # turn line into a list line=line.rstrip() line=line.split() # set 2 if(line[0]=="PING"): #if irc server sends a ping, pong back at it # this assignment (indivserver) really should only be done once indivserver = line[1] PONG = True print("LTHREAD PONG") elif(line[2]==CHAN): #if a message comes in from the channel print("LTHREAD message sent from " + CHAN) thread = Thread(target = trans, args = (line, USER, userlang)) thread.handled = False thread.start() threads.append(thread) #line[0] is user ident elif(line[0][1:len(USER)+1] == USER and line[2]==NICK): #if user privmsg us #transmesg(line, CHAN, chanlang) thread = Thread(target = trans, args = (line, CHAN, chanlang)) thread.handled = False thread.start() threads.append(thread)