Example #1
0
                        # confirm entered user is signed up
                        check_recipient = User(username, password1)
                        check_recipient.confirm_user(receiver)

                        # pick value from file saved in the class method
                        confirm_user_file = open("value.txt", "r")
                        confirmed_user = confirm_user_file.readline()

                        # check if recipient is in database
                        if confirmed_user == "successful":
                            content = input(
                                "\nEnter message: \n")  #get message from user
                            new_message = Message(username, receiver, username,
                                                  password1, content)
                            new_message.save_message()  #save the message
                            new_message.display_sent_message(
                            )  #display the saved message

                            choice1 = str(
                                input(
                                    "\nChoose next action: \n1 >> View all Users\n2 >> View Users Online\n3 >> Send a message\n4 >> View my messages \n5 >> Reply a message\n0 >> Logout\n"
                                ))

                        else:
                            print("\nUser is not signed up")
                            choice1 = str(
                                input(
                                    "\nChoose next action: \n1 >> View all Users\n2 >> View Users Online\n3 >> Send a message\n4 >> View my messages \n5 >> Reply a message\n0 >> Logout\n"
                                ))