예제 #1
0
def get_echoarea(name, raw=False):
    if not flt.echo_flt(name): return '' if raw else []
    try:
        txt = open('echo/%s' % name).read()
        return txt if raw else txt.splitlines()
    except:
        return '' if raw else []
예제 #2
0
파일: __init__.py 프로젝트: 6vasia/ii-base
def get_echoarea(name,raw=False):
    if not flt.echo_flt(name): return '' if raw else []
    try:
        txt = open('echo/%s' % name).read()
        return txt if raw else txt.splitlines()
    except:
        return '' if raw else []
예제 #3
0
def mkmsg(obj, rh=None):
    if not flt.echo_flt(obj.echoarea): return
    if rh and not flt.msg_flt(rh): return
    s = _out(obj).encode('utf-8')
    h = rh or sx.hsh(s)
    if len(s) < 65536:
        open('msg/%s' % h, 'wb').write(s)
        open('echo/%s' % obj.echoarea, 'ab').write(h + '\n')
        return h
예제 #4
0
파일: __init__.py 프로젝트: 6vasia/ii-base
def mkmsg(obj,rh=None):
    if not flt.echo_flt(obj.echoarea): return
    if rh and not flt.msg_flt(rh): return
    s = _out(obj).encode('utf-8')
    h = rh or sx.hsh(s)
    if len(s) < 65536:
        open('msg/%s' % h,'wb').write(s)
        open('echo/%s' % obj.echoarea,'ab').write(h + '\n')
        return h
예제 #5
0
def toss(msgfrom, addr, tmsg):
    lines = b64d(tmsg).decode('utf-8').splitlines()
    if flt.echo_flt(lines[0]):
        mo = sx.mydict(date=sx.gts(),
                       msgfrom=msgfrom,
                       addr=addr,
                       echoarea=lines[0],
                       msgto=lines[1],
                       subj=lines[2],
                       msg='\n'.join(lines[4:]))
        return mo
예제 #6
0
파일: __init__.py 프로젝트: 6vasia/ii-base
def toss(msgfrom,addr,tmsg):
    lines = b64d(tmsg).decode('utf-8').splitlines()
    if flt.echo_flt(lines[0]):
        mo = sx.mydict(date=sx.gts(),msgfrom=msgfrom,addr=addr,echoarea=lines[0],msgto=lines[1],subj=lines[2],msg='\n'.join(lines[4:]))
        return mo