Example #1
0
def dashboard():
    myChats = ChatHandler().getAllChatsMember(str(id))
    chats = ChatHandler().getAllChatsNames(str(id))
    print(myChats)
    print(chats)
    if not id:
        return login()
    else:
        print("ID: ", id)
        return render_template('dashboard.html', chats=chats, myChats=myChats)
Example #2
0
def getAllChats():
    print(request)
    if request.method == 'GET':
        return ChatHandler().getAllChatGroups()
    elif request.method == 'POST':
        return ChatHandler().newChat(request.json)
Example #3
0
def likeMessage(userId, messageId, like):
    ChatHandler().likeMessage(userId, messageId, like)
    return "LIKED"
Example #4
0
def viewMessages(chatId):
    return ChatHandler().getMessages(chatId)
Example #5
0
def getChatbyName(cgid, uid):
    return ChatHandler().getChatMsgsByUserId(cgid, uid)
Example #6
0
def getChatByUser():
    global loggedUID
    return ChatHandler().getChatGroupsByUserId(loggedUID)
Example #7
0
def getAllMessagesByChat(cgid):
    return ChatHandler().getAllMessagesByChat(cgid)
Example #8
0
def postMessage(chat, user, message):
    mid = ChatHandler().postMessage(chat, user, message)
    messageID = {'mid': mid}
    print("MID: ", messageID)
    return jsonify(MID=messageID)
Example #9
0
def joinChat():
    if not id:
        return login()
    ChatHandler().addContactToChat(request.form['chats'], str(id))
    return dashboard()
Example #10
0
def createChat(name):
    return ChatHandler().createChat(name)
Example #11
0
def removeChat(name):
    return ChatHandler().removeChat(name)
Example #12
0
def allChats():
    return ChatHandler().getAllChats()
Example #13
0
def replyToMessageREST(message, replying):
    return ChatHandler().replyToMessage(message, replying)
Example #14
0
def isMember(userid):
    return ChatHandler().getAllChatsMemberJSON(userid)
Example #15
0
def getChatbyID(cgid):
    if request.method == 'GET':
        return ChatHandler().getChatByID(cgid)
    elif request.method == 'POST':
        global loggedUID
        return ChatHandler().joinChat(request.json, loggedUID)
Example #16
0
def addContactToChat(chat, id):
    return ChatHandler().addContactToChat(chat, id)
Example #17
0
def getChatbyUser(uid):
    return ChatHandler().getChatGroupsByUserId(uid)
Example #18
0
def removeContactFromChat(chat, id):
    return ChatHandler().removeContactFromChat(chat, id)
Example #19
0
def getChatsNotJoined():
    global loggedUID
    return ChatHandler().getChatsNotJoined(loggedUID)
Example #20
0
def getChatById(chatId):
    return ChatHandler().getChatById(chatId)
Example #21
0
def getChatOwner(cgid):
    return ChatHandler().getChatOwner(cgid)
Example #22
0
def getAdminChatById(chatId):
    return ChatHandler().getAdminByChatId(chatId)
Example #23
0
def getChatMembers(cgid):
    return ChatHandler().getChatMembers(cgid)
Example #24
0
def chats():
    if request.args:
        return ChatHandler().searchChats(request.args)
    else:
        handler = ChatHandler()
        return handler.getAllChats()