Example #1
0
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])
Example #2
0
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])
Example #3
0
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 ''
Example #4
0
def postchat():
    mm.postchat(mm.getuid(session), int(request.form['id']),
                request.form['message'])
    return ''
Example #5
0
def createchat():
    return mm.createchat(mm.getuid(session), request.form['chatname'])
Example #6
0
def main():
    return render_template("main.html", chats=mm.getchats(mm.getuid(session)))
Example #7
0
def index():
    if mm.getuid(session) is not None:
        return redirect(url_for('main'))
    else:
        return redirect(url_for('login'))
Example #8
0
def loadinvitekey():
    return mm.loadchatkeyRSA(mm.getuid(session), int(request.args['id']))
Example #9
0
def savechatkey():
    return mm.savechatkey(mm.getuid(session), int(request.form['id']),
                          request.form['key'])