def _parze(msg): pz = msg.splitlines() mo = sx.mydict() optz = pz[0].split('/') mo.update( dict(zip(optz[::2],optz[1::2])) ) for i,n in enumerate(('echoarea','date','msgfrom','addr','msgto','subj')): mo[n] = pz[i+1] mo.msg = '\n'.join(pz[8:]) mo.date = int(mo.date) return mo
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
def create_msg(rq_raw,u): ''' create msg from user form ''' rq = check_check(rq_raw) date = str(gts()) o = mydict(txt=rq.txt,title=rq.title,date=date,ea=rq.ea,who=u.uname,addr=u.uaddr,to=rq.to) if rq.repto: o.repto=rq.repto if rq.tags and not rq.topicid: o.tags = mk_tags(rq.tags) blob = fo.obj_to_file(o,60).encode('utf-8') msgid = hsh(blob) o.topicid = rq.topicid or msgid o = msghook.hook(o,True) blob = fo.obj_to_file(o).encode('utf-8') write_msg(o,msgid,blob,date,True) return msgid
def get_msg(h): txt = raw_msg(h) return _parze(txt) if txt else sx.mydict(msg='no message', date=0)
def point_newmsg(tags): mo = sx.mydict(date=sx.gts()) mo.update(**tags) if _filter_msg_call(tags): return mkmsg(mo)
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
def get_msg(h): txt = raw_msg(h) return _parze(txt) if txt else sx.mydict(msg='no message',date=0)
def echo_desc(e): return mydict([x.split(' ', 1) for x in lst('e.desc')]).get(e, 'no desc')