def deleteAll(): response = Connection.notificationRequest("delete-all", {}) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message)
def resetUsername(): username = input("Username -> ") response = Connection.profileRequest("reset-username", {"username": username}) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message)
def deleteStream(): chatWith = input("Username -> ") response = Connection.chatRequest("delete-stream", {"chatWith": chatWith}) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message)
def chat(): chatWith = input("Chat With (Username) -> ") response = Connection.chatRequest("chat-permission", {"chatWith": chatWith}) successful = response.get("successful") message = response.get("message") if successful: chatView.ChatView.view(chatWith) else: Common.printNegativeText(message)
def ignore(): username = input("Username -> ") response = Connection.friendshipRequest("ignore", {"username": username}) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message)
def resetEmail(): email = input("Email -> ") response = Connection.profileRequest("reset-email", {"email": email}) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message)
def resetPassword(): password = getpass("Password -> ") response = Connection.profileRequest("reset-password", {"password": password}) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message)
def handler(self): if self.commandStructureCompatibility(): if CommandConfig.insideTheCommonCommands(self.__command): CommandConfig.getCommonCommands().get(self.__command).get("function")(controller=self.__controller) elif CommandConfig.insideTheSpecialCommands(self.__controller, self.__command): CommandConfig.getSpecialCommands(self.__controllerName).get(self.__command).get("function")() else: Common.printNegativeText( CommandStructureConstants.NO_SUCH_COMMAND_ERR) else: Common.printNegativeText( CommandStructureConstants.COMMAND_STRUCTURE_COMPATIBILITY_ERR)
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"))
def deleteOne(): try: notificationId = int(input("Notification Id -> ")) except ValueError: Common.printNegativeText("Notification id must be integer") return response = Connection.notificationRequest("delete-one", {"id": notificationId}) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message)
def registerForm(): form = RegisterForm() form.fillTheForm() Common.clearTerminal() if form.validation(): response = Connection.registerRequest(form.getData()) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message) else: Common.printNegativeText(form.getValidationMessage()) Common.programSleep()
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"))
def loginForm(): form = LoginForm() form.fillTheForm() Common.clearTerminal() if form.validation(): response = Connection.loginRequest(form.getData()) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) Common.programSleep() LobbyView.view() else: Common.printNegativeText(message) else: Common.printNegativeText(form.getValidationMessage()) Common.programSleep()