示例#1
0
def createPost(boardName,user,title,content,reid=False):
	f = open(boardFolder + boardName +"/.DIR","ab")
	fileid = int(time.time())
	while "M.%d.A"%fileid in [i["filename"] for i in getPostsList(boardName)]:
		fileid +=1
	filepath = "%s%s/%s/%s"%(boardFolder,boardName,str(fileid%500).zfill(3),"M."+str(fileid)+".A")
	print filepath
	f = open(filepath, "wb")
	f.write(content)
	f.close()
	f = open(boardFolder + boardName +"/.DIR","ab")
	ldata = ["M.%d.A"%fileid,"%s"%(user,user),0,title,0,"",fileid,reid and reid or fileid]
	data = functions.packStruct(ldata,DIRstruct,256)
	f.write(data)
	f.close()
	return dict(zip(order,ldata))
示例#2
0
def sendMail(idfrom,idto,title,content):
	fileid = int(time.time())
	while "M.%d.A"%fileid in getMailList(idto):
		fileid +=1
	f = open("/home/bbs/bbshome/mail/%s/%s/%s/%s" \
		%(idto[0].upper(),idto[1].upper(),idto,"M.%d.A"%fileid), "wb")
	f.write(content)
	f.close()
	f = open("/home/bbs/bbshome/mail/%s/%s/%s/.DIR"%(idto[0].upper(),idto[1].upper(),idto),"ab")
	ldata = ["M.%d.A"%fileid,"%s (%s)"%(idfrom,idfrom),0,title,0,"",fileid,fileid]
	data = functions.packStruct(ldata,DIRstruct,256)
	f.write(data)
	f.close()
	cnt = getUnreadCount(idto)
	setUnreadCount(idto,cnt+1)
	return dict(zip(order,ldata))
示例#3
0
def sendMail(idfrom, idto, title, content):
    fileid = int(time.time())
    while "M.%d.A" % fileid in getMailList(idto):
        fileid += 1
    f = open("/home/bbs/bbshome/mail/%s/%s/%s/%s" \
     %(idto[0].upper(),idto[1].upper(),idto,"M.%d.A"%fileid), "wb")
    f.write(content)
    f.close()
    f = open(
        "/home/bbs/bbshome/mail/%s/%s/%s/.DIR" %
        (idto[0].upper(), idto[1].upper(), idto), "ab")
    ldata = [
        "M.%d.A" % fileid,
        "%s (%s)" % (idfrom, idfrom), 0, title, 0, "", fileid, fileid
    ]
    data = functions.packStruct(ldata, DIRstruct, 256)
    f.write(data)
    f.close()
    cnt = getUnreadCount(idto)
    setUnreadCount(idto, cnt + 1)
    return dict(zip(order, ldata))
示例#4
0
def createPost(boardName, user, title, content, reid=False):
    f = open(boardFolder + boardName + "/.DIR", "ab")
    fileid = int(time.time())
    while "M.%d.A" % fileid in [
            i["filename"] for i in getPostsList(boardName)
    ]:
        fileid += 1
    filepath = "%s%s/%s/%s" % (boardFolder, boardName, str(
        fileid % 500).zfill(3), "M." + str(fileid) + ".A")
    print filepath
    f = open(filepath, "wb")
    f.write(content)
    f.close()
    f = open(boardFolder + boardName + "/.DIR", "ab")
    ldata = [
        "M.%d.A" % fileid,
        "%s" % (user, user), 0, title, 0, "", fileid, reid and reid or fileid
    ]
    data = functions.packStruct(ldata, DIRstruct, 256)
    f.write(data)
    f.close()
    return dict(zip(order, ldata))