def remove(line):
    common.log("")
    folder = setFolder(conf["folder"], common.ask("DIRHASH " + line[1]))
                
    if deleteFile(line[1], folder):
        common.sprint('REMOVE-SUCCESS ' + line[1] + '')
    else:
        common.sprint('REMOVE-FAILURE ' + line[1] + ' This file could not be removed')
    common.log("Done")
def remove(line):
    common.log("")
    folder = setFolder(conf["folder"], common.ask("DIRHASH " + line[1]))

    if deleteFile(line[1], folder):
        common.sprint('REMOVE-SUCCESS ' + line[1] + '')
    else:
        common.sprint('REMOVE-FAILURE ' + line[1] +
                      ' This file could not be removed')
    common.log("Done")
def checkpresent(line):
    common.log("")
    folder = setFolder(conf["folder"], common.ask("DIRHASH " + line[1]))
    if not len(folder):
        common.sprint('CHECKPRESENT-UNKNOWN ' + line[1] + ' this remote is not currently available')
        return None

    if checkFile(line[1], folder):
        common.sprint('CHECKPRESENT-SUCCESS ' + line[1] + '')
    else:
        common.sprint('CHECKPRESENT-FAILURE ' + line[1] + '')
    common.log("Done")
def checkpresent(line):
    common.log("")
    folder = setFolder(conf["folder"], common.ask("DIRHASH " + line[1]))
    if not len(folder):
        common.sprint('CHECKPRESENT-UNKNOWN ' + line[1] +
                      ' this remote is not currently available')
        return None

    if checkFile(line[1], folder):
        common.sprint('CHECKPRESENT-SUCCESS ' + line[1] + '')
    else:
        common.sprint('CHECKPRESENT-FAILURE ' + line[1] + '')
    common.log("Done")
def transfer(line):
    common.log("")

    folder = setFolder(conf["folder"], common.ask("DIRHASH " + line[2]))

    if line[1] == "STORE":
        if postFile(line[2], " ".join(line[3:]), folder):
            common.sprint('TRANSFER-SUCCESS STORE ' + line[2] + '')
        else:
            common.sprint('TRANSFER-FAILURE STORE ' + line[2] + ' File could not be stored')
    if line[1] == "RETRIEVE":
        if getFile(line[2], " ".join(line[3:]), folder):
            common.sprint('TRANSFER-SUCCESS RETRIEVE ' + line[2] + '')
        else:
            common.sprint('TRANSFER-FAILURE RETRIEVE ' + line[2] + ' File could not be retrieved')
    common.log("Done")
def transfer(line):
    common.log("")

    folder = setFolder(conf["folder"], common.ask("DIRHASH " + line[2]))

    if line[1] == "STORE":
        if postFile(line[2], " ".join(line[3:]), folder):
            common.sprint('TRANSFER-SUCCESS STORE ' + line[2] + '')
        else:
            common.sprint('TRANSFER-FAILURE STORE ' + line[2] +
                          ' File could not be stored')
    if line[1] == "RETRIEVE":
        if getFile(line[2], " ".join(line[3:]), folder):
            common.sprint('TRANSFER-SUCCESS RETRIEVE ' + line[2] + '')
        else:
            common.sprint('TRANSFER-FAILURE RETRIEVE ' + line[2] +
                          ' File could not be retrieved')
    common.log("Done")