Example #1
0
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)
Example #2
0
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))
Example #3
0
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))
Example #4
0
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))
Example #5
0
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))
Example #6
0
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))
Example #7
0
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))
Example #8
0
File: gui.py Project: pearu/iocbio
    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
Example #9
0
    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
Example #10
0
File: gui.py Project: pearu/iocbio
 def apply_resource_selection (self):
     if isadmin():
         print 'You are Administrator'
         return True
     self.apply_resource_message = 'This program must be run as Administrator'
Example #11
0
 def apply_resource_selection(self):
     if isadmin():
         print 'You are Administrator'
         return True
     self.apply_resource_message = 'This program must be run as Administrator'