def ws_edit(request): try: cid = request.POST["cid"] mid = request.POST["mid"] oldmsg = request.POST["oldmsg"] newmsg = request.POST["newmsg"] chash = request.POST["hash"] except KeyError: return HttpResponse("err") Chat.edit(request.user, cid, chash, mid, oldmsg, newmsg) return HttpResponse("ok")
def ws_wizz(request): try: msg = request.POST["msg"] cid = request.POST["cid"] chash = request.POST["hash"] # TODO no history feature # keep = (request.POST["keep"].lower() == "true") keep = True except KeyError: return HttpResponse("err") Chat.wizz(request.user, cid, chash, msg, keep) return HttpResponse("ack")
def ws_msg(request): try: msg = request.POST["msg"] cid = request.POST["cid"] chash = request.POST["hash"] me_msg = request.POST["me_msg"] # TODO no history feature # keep = (request.POST["keep"].lower() == "true") keep = True if me_msg == "true": me_msg = True else: me_msg = False except KeyError: return HttpResponse("err") Chat.message(request.user, cid, chash, msg, me_msg, keep) return HttpResponse("ack")
def DISCONNECTION_HANDLER(usr): from chat.chat_management import Chat Chat.disconnect(usr)
def ws_identicate(request): Chat.connect(request.user) return HttpResponse("ok")