Exemple #1
0
def updatePasswords():
    global passwords
    newpw = {}
    fn = conf.get('main', 'basedir') + conf.get('main', 'pwfile')
    if os.path.isfile(fn):
        content = readFile(fn)
        for line in content:
            (nick, pw) = line.split()
            newpw[nick] = pw
        passwords = newpw
Exemple #2
0
def updateAddresses():
    global addresses
    newaddy = {}
    fn = conf.get('main', 'basedir') + conf.get('main', 'addressfile')
    if os.path.isfile(fn):
        content = readFile(fn)
        for line in content:
            (nick, addy) = line.split()
            newaddy[nick] = addy
        addresses = newaddy
Exemple #3
0
def updateAddresses():
    global addresses
    newaddy = {}
    fn = conf.get('main', 'basedir') + conf.get('main', 'addressfile')
    if os.path.isfile(fn):
        content = readFile(fn)
        for line in content:
            (nick, addy) = line.split()
            newaddy[nick] = addy
        addresses = newaddy
def updatePayouts():
    global payouts
    newpay = {}
    fn = conf.get('main', 'basedir') + conf.get('main', 'payoutsfile')
    if os.path.isfile(fn):
        content = readFile(fn)
        for line in content:
            (timestamp, nick, amount) = line.split()
            newpay[nick] = "%s %s" % (timestamp, amount)
        payouts = newpay
Exemple #5
0
def updatePasswords():
    global passwords
    newpw = {}
    fn = conf.get('main', 'basedir') + conf.get('main', 'pwfile')
    if os.path.isfile(fn):
        content = readFile(fn)
        for line in content:
            (nick, pw) = line.split()
            newpw[nick] = pw
        passwords = newpw
def populateAddresses():
    global addys
    newaddys = {}
    fn = conf.get('main', 'basedir') + conf.get('main', 'addressfile')
    if os.path.isfile(fn):
        content = readFile(fn)
        for line in content:
            (n, a) = line.split()
            newaddys[n] = a
        addys = newaddys
Exemple #7
0
def populateAddresses():
    global addys
    newaddys = {}
    fn = conf.get('main', 'basedir') + conf.get('main', 'addressfile')
    if os.path.isfile(fn):
        content = readFile(fn)
        for line in content:
            (n, a) = line.split()
            newaddys[n] = a
        addys = newaddys
Exemple #8
0
def populateLogs():
    global logs
    for file in glob.glob(conf.get('main', 'basedir') + \
                          conf.get('main', 'nicksdir') + '*'):
        if re.search('\.', file):
            continue
        (head, tail) = os.path.split(file)
        file = file + '/' + tail
        if os.path.isfile(file):
            logs[tail] = readFile(file)
Exemple #9
0
def populateLogs():
    global logs
    for file in glob.glob(conf.get('main', 'basedir') + \
                          conf.get('main', 'nicksdir') + '*'):
        if re.search('\.', file):
            continue
        (head, tail) = os.path.split(file)
        file = file + '/' + tail
        if os.path.isfile(file):
            logs[tail] = readFile(file)
Exemple #10
0
def updateAddressFile(nick, address):
    addys = {}
    fn = conf.get('main', 'basedir') + conf.get('main', 'addressfile')
    writedir = os.path.dirname(fn)
    if os.path.isfile(fn):
        content = readFile(fn)
        for line in content:
            (n, a) = line.split()
            addys[n] = a
        addys[nick] = address
        with open(fn, "w+") as fw:
            fcntl.flock(fw.fileno(), fcntl.LOCK_EX)
            for key, value in addys.iteritems():
                fw.write("%s %s\n" % (key, value))
            fw.close()
    else:
        if not os.path.exists(writedir):
            os.makedirs(writedir)
        with open(fn, "a") as f:
            fcntl.flock(f.fileno(), fcntl.LOCK_EX)
            f.write("%s %s\n" % (nick, address))
            f.close()
Exemple #11
0
def updateAddressFile(nick, address):
    addys = {}
    fn = conf.get('main', 'basedir') + conf.get('main', 'addressfile')
    writedir = os.path.dirname(fn)
    if os.path.isfile(fn):
        content = readFile(fn)
        for line in content:
            (n, a) = line.split()
            addys[n] = a
        addys[nick] = address
        with open(fn,"w+") as fw:
            fcntl.flock(fw.fileno(), fcntl.LOCK_EX)
            for key, value in addys.iteritems():
                fw.write("%s %s\n" % (key, value))
            fw.close()
    else:
        if not os.path.exists(writedir):
            os.makedirs(writedir)
        with open(fn, "a") as f:
            fcntl.flock(f.fileno(), fcntl.LOCK_EX)
            f.write("%s %s\n" % (nick, address))
            f.close()