def loadchat(): chatdata = mm.loadchat(mm.getuid(session), int(request.args['id']), int(request.args['loaded']), LOAD_AT_ONCE, mm.gethisttime(int(request.args['id']), session)) return json.dumps([{ 'name': x[0], 'msg': x[1], 'date': x[2].strftime("%H:%M:%S %d-%m-%Y") } for x in chatdata])
def longpoll(): tmp = mm.longpoll(mm.getuid(session), int(request.args['id']), mm.getpolltime(int(request.args['id']), session)) if len(tmp) > 0: mm.setpolltime(int(request.args['id']), session, tmp[-1][2]) return json.dumps([{ 'name': x[0], 'msg': x[1], 'date': x[2].strftime("%H:%M:%S %d-%m-%Y") } for x in tmp])
def invite(): uid = mm.getuidbyname(request.form['username']) cid = int(request.form['id']) key = request.form['key'] mm.invite(mm.getuid(session), uid, cid, key) return ''
def postchat(): mm.postchat(mm.getuid(session), int(request.form['id']), request.form['message']) return ''
def createchat(): return mm.createchat(mm.getuid(session), request.form['chatname'])
def main(): return render_template("main.html", chats=mm.getchats(mm.getuid(session)))
def index(): if mm.getuid(session) is not None: return redirect(url_for('main')) else: return redirect(url_for('login'))
def loadinvitekey(): return mm.loadchatkeyRSA(mm.getuid(session), int(request.args['id']))
def savechatkey(): return mm.savechatkey(mm.getuid(session), int(request.form['id']), request.form['key'])