Пример #1
0
    def __sendMessage(message):
        receiver = programLocation.getLocationParameters().get("chatWith")

        response = Connection.chatRequest("send-message", {
            "receiver": receiver,
            "message": message
        })

        if response.get("successful"):
            date = datetime.now().strftime("%d/%m/%Y %H:%M:%S")

            Common.printChatLabelText(f"<You> <{date}>: ")
            Common.printStandartText(message)
        else:
            Common.printNegativeText(response.get("message"))
Пример #2
0
    def newIncomingMessages():
        chatWith = programLocation.getLocationParameters().get("chatWith")

        while programLocation.getLocation(
        ) == "ChatController" and Connection.isSession():
            response = Connection.chatRequest("new-incoming-messages",
                                              {"chatWith": chatWith})

            if response.get("successful"):
                for messageSet in response.get("newIncomingMessages"):
                    sender = messageSet.get("sender")
                    date = messageSet.get("date")
                    message = messageSet.get("message")

                    Common.printChatLabelText(f"<{sender}> <{date}>: ")
                    Common.printStandartText(message)

            time.sleep(.1)
Пример #3
0
    def stream():
        response = Connection.chatRequest("stream", {
            "chatWith":
            programLocation.getLocationParameters().get("chatWith")
        })
        successful = response.get("successful")

        if successful:
            for messageSet in response.get("stream"):
                sender = messageSet.get("sender")
                date = messageSet.get("date")
                message = messageSet.get("message")

                if sender == "__session__":
                    Common.printChatLabelText(f"<You> <{date}>: ")
                    Common.printStandartText(message)
                else:
                    Common.printChatLabelText(f"<{sender}> <{date}>: ")
                    Common.printStandartText(message)
        else:
            Common.printNegativeText(response.get("message"))
Пример #4
0
 def getViewTitles():
     Common.clearTerminal()
     Common.printStandartText(ViewTextConstants.REGISTER_TITLE)
Пример #5
0
 def getViewTitles():
     Common.clearTerminal()
     Common.printStandartText(
         f"Chat area with {programLocation.getLocationParameters().get('chatWith')}, say /help for help\n"
     )
Пример #6
0
 def getViewTexts():
     Common.clearTerminal()
     Common.printStandartText(ViewTextConstants.ACCESS_TITLE)
     Common.printStandartText(ViewTextConstants.ACCESS_SUBTITLE)
 def getViewTitles():
     Common.clearTerminal()
     Common.printStandartText(ViewTextConstants.NOTIFICATION_TITLE)