コード例 #1
0
def push_msg(json):
    if app.auth():
        if json["username"] != "":
            if json["message"] != "":
                websocket.emit("msg-received", json)
                json["timestamp"] = Utils.timestamp()
                app.send_msg(json)
                Log.log_chat(json["timestamp"], json["username"], json["message"])
    else:
        return redirect(url_for("login"))
コード例 #2
0
def push_msg(json):
    if app.auth():
        try:
            if json['username'] != '':
                if json['message'] != '':
                    websocket.emit('msg-received', json)
                    json['timestamp'] = Utils.timestamp()
                    app.send_msg(json)

                    Log.log_chat(json['timestamp'], json['username'],
                                 json['message'])
        except:
            pass
    else:
        return redirect(url_for('login'))
コード例 #3
0
ファイル: gui.py プロジェクト: slooppe/ThunderShell
def push_msg(json):
    if app.auth():
        try:
            if json['username'] != '':
                if json['message'] != '':
                    websocket.emit('msg-received', json)
                    json['timestamp'] = Utils.timestamp()
                    app.send_msg(json)
                    # We are logging the chat because we have a small brain and
                    # are unable to remember things, if this bother you just comment it out :)
                    Log.log_chat(json['timestamp'], json['username'],
                                 json['message'])
        except KeyError:
            pass
    else:
        return redirect(url_for('login'))