def changeMode(conn, msg): if utils.isadmin(conn, msg): cmd = msg.text.split()[0][1:] if len(msg.text.split()) > 1: wie = msg.text.split()[1] else: wie = msg.user conn.send("MODE %s %s %s\r\n" % (msg.channel, modes[cmd], wie)) else: conn.send("PRIVMSG %s :Je moet een operator zijn om dit commando te kunnen uitvoeren.\r\n" % msg.user)
def topic(conn, msg): if msg.user == settings.irc_OWNER or utils.isadmin(conn, msg): if len(msg.text.split()) > 1: topic = ' '.join(msg.text.split()[1:]) conn.send('TOPIC %s :%s\r\n' % (msg.channel, topic)) else: usage = 'Gebruik: !topic topic' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage)) else: usage = 'Je moet een operator zijn om dit commando te kunnen gebruiken.' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage))
def delquote(conn, msg): if msg.user == settings.irc_OWNER or utils.isadmin(conn, msg): if len(msg.text.split()) > 1 and msg.text.split()[1].isdigit(): rowid = sqlite.set('DELETE FROM irc_quote WHERE id=?', (msg.text.split()[1],)) conn.send('PRIVMSG %s :Quote %i deleted!\r\n' % (msg.channel, int(msg.text.split()[1]))) else: usage = 'Gebruik: !delquote id' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage)) else: usage = 'Je moet een operator zijn om dit commando te kunnen gebruiken.' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage))
def kick(conn, msg): if msg.user == settings.irc_OWNER or utils.isadmin(conn, msg): if len(msg.text.split()) == 2: conn.send('KICK '+msg.channel+' '+msg.text.split()[1]+'\r\n') elif len(msg.text.split()) > 2: conn.send('KICK '+msg.channel+' '+msg.text.split()[1]+' :'+" ".join(msg.text.split()[2:])+'\r\n') else: usage = 'Gebruik: !kick naam [reden] (reden is optioneel)' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage)) else: usage = 'Je moet een operator zijn om dit commando te gebruiken.' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage))
def unassign(conn, msg): if msg.user == settings.irc_OWNER or utils.isadmin(conn, msg): if len(msg.text.split()) > 1: word = msg.text.split()[1] rowid = mysql.set('DELETE FROM irc_assign WHERE word=%s', (word)) conn.send('PRIVMSG %s :%s unassigned.\r\n' % (msg.channel, word)) else: usage = 'Gebruik: !unassign woord' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage)) else: usage = 'Je moet een operator zijn om dit commando te kunnen gebruiken.' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage))
def assign(conn, msg): if msg.user == settings.irc_OWNER or utils.isadmin(conn, msg): if len(msg.text.split()) > 2: word = msg.text.split()[1] defin = ' '.join(msg.text.split()[2:]) rows, count = mysql.get('SELECT * FROM irc_assign WHERE word=%s', (word)) if count > 0: conn.send('PRIVMSG %s :%s is already defined: %s\r\n' % (msg.channel, rows[0][1], rows[0][2])) else: rowid = mysql.set('INSERT INTO irc_assign (word, def) VALUES (%s, %s)', (word, defin)) conn.send('PRIVMSG %s :%s added to assign list.\r\n' % (msg.channel, word)) else: usage = 'Gebruik: !assign woord definitie' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage)) else: usage = 'Je moet een administrator zijn om dit commando te kunnen uitvoeren.' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage))
def reassign(conn, msg): if msg.user == settings.irc_OWNER or utils.isadmin(conn, msg): if len(msg.text.split()) > 2: word = msg.text.split()[1] defin = ' '.join(msg.text.split()[2:]) rows, count = mysql.get('SELECT * FROM irc_assign WHERE word=%s', (word)) if count == 0: conn.send('PRIVMSG %s :%s is not defined yet. Use !assign word def to assign it.\r\n' % (msg.channel, word)) else: rowid = mysql.set('UPDATE irc_assign SET def=%s WHERE word=%s', (defin, word)) conn.send('PRIVMSG %s :%s reassigned to: %s\r\n' % (msg.channel, word, defin)) else: usage = 'Gebruik: !reassign woord definitie' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage)) else: usage = 'Je moet een administrator zijn om dit commando te kunnen uitvoeren.' conn.send('PRIVMSG %s :%s\r\n' % (msg.user, usage))
def __init__ (self, logfile=None, working_dir = None): if working_dir is not None: if not os.path.isdir (working_dir): os.makedirs(working_dir) print 'chdir',working_dir os.chdir(working_dir) self.working_dir = working_dir or '.' if logfile is None: self.app = wx.App(redirect=False) else: logfile = os.path.abspath (logfile) if os.path.isfile (logfile): os.remove(logfile) print 'All output will be redirected to %r' % (logfile) print 'When finished, press ENTER to close this program...' self.app = wx.App(redirect=True, filename=logfile) self.logfile = logfile print 'time.ctime()->%r' % (time.ctime()) print 'sys.executable=%r' % (sys.executable) print 'sys.path=%r' % (sys.path) print 'sys.platform=%r' % (sys.platform) print 'os.name=%r' % (os.name) print 'platform.uname()->%r' % (platform.uname(),) print 'os.environ["PATH"]=%r' % (os.environ["PATH"]) print 'os.getcwd()->%r' % (os.getcwd()) print 'isadmin()->%r' % (isadmin()) wx.Frame.__init__(self, None, -1) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnWizPageChanged) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnWizPageChanging) #nb = wx.Notebook(self, -1) wizard = wiz.Wizard(self, -1, __file__) wizard.SetPageSize ((600, 500)) wizard.model = self self.wizard = wizard
def __init__(self, logfile=None, working_dir=None): if working_dir is not None: if not os.path.isdir(working_dir): os.makedirs(working_dir) print 'chdir', working_dir os.chdir(working_dir) self.working_dir = working_dir or '.' if logfile is None: self.app = wx.App(redirect=False) else: logfile = os.path.abspath(logfile) if os.path.isfile(logfile): os.remove(logfile) print 'All output will be redirected to %r' % (logfile) print 'When finished, press ENTER to close this program...' self.app = wx.App(redirect=True, filename=logfile) self.logfile = logfile print 'time.ctime()->%r' % (time.ctime()) print 'sys.executable=%r' % (sys.executable) print 'sys.path=%r' % (sys.path) print 'sys.platform=%r' % (sys.platform) print 'os.name=%r' % (os.name) print 'platform.uname()->%r' % (platform.uname(), ) print 'os.environ["PATH"]=%r' % (os.environ["PATH"]) print 'os.getcwd()->%r' % (os.getcwd()) print 'isadmin()->%r' % (isadmin()) wx.Frame.__init__(self, None, -1) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnWizPageChanged) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnWizPageChanging) #nb = wx.Notebook(self, -1) wizard = wiz.Wizard(self, -1, __file__) wizard.SetPageSize((600, 500)) wizard.model = self self.wizard = wizard
def apply_resource_selection (self): if isadmin(): print 'You are Administrator' return True self.apply_resource_message = 'This program must be run as Administrator'
def apply_resource_selection(self): if isadmin(): print 'You are Administrator' return True self.apply_resource_message = 'This program must be run as Administrator'