By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,965 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,965 IT Pros & Developers. It's quick & easy.

looped if's stop working

P: n/a
After figuring out how to have a threaded frontend to pass varibles
I've run into a problem. The 'quit' command works as long as issue it
fast enough as soon as the if's start looping. If I wait about 5
seconds, the commands will close the frontend thread but leave the main
loop running. This seems to be becuase the looped ifs stopped
evaluating at all. Is there a better way to do this (events)? If not
how could I keep the if's running?

Thanks

Note- the 'join' command has no effect either.
Code:
#!usr/bin/python
#Filename: NIRC Core

import sys
import irc
import threading

def giveop(user):
pass

def ip():
pass

def uptime():
pass

def auth(user,password,ip):
pass

def kill(user):
pass

def mute(user):
pass

def servertest():
pass

class receiver(threading.Thread):
def run(self):
while 1:
n = raw_input('Enter Bot Commands : ')
if n == 'quit':
funcvars.breaker = True
break
if n == 'join':
funcvars.join = raw_input('Enter Chan Name : ')

class funcvars:
breaker = False
join = ''

NIRC=irc.IRC_Object( )
conn=NIRC.new_connection( )
s = raw_input('Enter Commands : ')
if s == 'quit':
sys.exit()
if s == 'version':
print 'Version Alpha 0.1'
if s == 'ircstart':
conn.nick='Nilzirc'
conn.ident='nilzirc'
conn.server=('irc.deltaanime.net', 6667)
conn.realname='Noobwrangler McNeal'
print 'Connection Started'
receiver().start()
while 1:
NIRC.main_loop( )
if funcvars.breaker == True:
break
if funcvars.join != '':
conn.send_string('JOIN '+funcvars.join)
print 'Ending IRC communication'

Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.