Example #1
0
                        # create an instance of the User class and call the view_received_message method to view messages sent to user
                        reply_messages = Message(username, receiver, username,
                                                 password1, "sample_content")
                        reply_messages.view_users_of_sent_message()

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

                        if confirmed_user == "successful":  # proceed to reply message
                            receiver = input(
                                "\nWho's message are you replying? \n")
                            content = input("Write message: \n")
                            new_message = Message(username, receiver, sender,
                                                  password1, content)
                            new_message.reply_message(
                            )  #calling the reply message function
                            new_message.display_sent_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 >> Log Out\n"
                                ))
                        else:

                            # if a user has not been sent a message
                            print("\nNo message to reply")
                            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"
                                ))

                    elif choice1 == "0":