def _point_msg(pauth,tmsg): msgfrom, addr = points.check_hash(pauth) if not addr: return 'auth error!' cfg = config('_server.cfg') mo = api.toss(msgfrom,'%s,%s' % (cfg['server']['address'],addr),tmsg.strip()) if mo.msg.startswith('@repto:'): tmpmsg = mo.msg.splitlines() mo.repto = tmpmsg[0][7:] mo.msg = '\n'.join(tmpmsg[1:]) # а ещё лучше - засунуть это в api.toss if len(mo.msg.encode('utf-8')) < 64100: h = api.point_newmsg(mo) if h: return 'msg ok:%s: <a href="/%s">%s</a>' % (h, mo.echoarea, mo.echoarea) else: return 'error:unknown' else: return 'msg big!'
def _point_msg(pauth, tmsg): msgfrom, addr = points.check_hash(pauth) if not addr: return 'auth error!' cfg = api.load_echo(False) mo = api.toss(msgfrom, '%s, %s' % (cfg[0][1], addr), tmsg.strip()) if mo.msg.startswith('@repto:'): tmpmsg = mo.msg.splitlines() mo.repto = tmpmsg[0][7:] mo.msg = '\n'.join(tmpmsg[1:]) if len(mo.msg.encode('utf-8')) < 64100: h = api.point_newmsg(mo) if h: return 'msg ok:%s: <a href="/%s">%s</a>' % (h, mo.echoarea, mo.echoarea) else: return 'error:unknown' else: return 'msg big!'
def _point_msg(pauth, tmsg): msgfrom, addr = points.check_hash(pauth) if not addr: return 'auth error!' cfg = config('_server.cfg') mo = api.toss(msgfrom, '%s,%s' % (cfg['server']['address'], addr), tmsg.strip()) if mo.msg.startswith('@repto:'): tmpmsg = mo.msg.splitlines() mo.repto = tmpmsg[0][7:] mo.msg = '\n'.join(tmpmsg[1:]) # а ещё лучше - засунуть это в api.toss if len(mo.msg.encode('utf-8')) < 64100: h = api.point_newmsg(mo) if h: return 'msg ok:%s: <a href="/%s">%s</a>' % (h, mo.echoarea, mo.echoarea) else: return 'error:unknown' else: return 'msg big!'
import api, api.sx as sx, sys, ww MSGFROM = '51t' ADDR = 'lenina,1' for f in sys.argv[1:]: txt = open(f).read() mo = api.toss(MSGFROM, ADDR, txt) if mo: if mo.msg.startswith('@repto:'): tmpmsg = mo.msg.splitlines() mo.repto = tmpmsg[0][7:] mo.msg = '\n'.join(tmpmsg[1:]) h = ww.send_msg(mo) print '%s to %s' % (h, mo.echoarea)
import api, api.sx as sx, sys, ww MSGFROM='51t' ADDR='lenina,1' for f in sys.argv[1:]: txt = open(f).read() mo = api.toss(MSGFROM,ADDR,txt) if mo: if mo.msg.startswith('@repto:'): tmpmsg = mo.msg.splitlines() mo.repto = tmpmsg[0][7:] mo.msg = '\n'.join(tmpmsg[1:]) h = ww.send_msg(mo) print '%s to %s' % ( h , mo.echoarea )