public void send_messages(string sender, string receiver, string message) //a function to store messages { messages m = new messages(); m.set_sender(sender); m.set_receiver(receiver); m.set_message(message); message_list.Add(m); //adds information to message_list }
public void received_messages(string logged_in) //gets the user who is logged in and displays his received messages { string rec; Console.WriteLine("Message" + " " + "Sender"); for (int i = 0; i < message_list.Count; i++) { messages msg = (messages)message_list[i]; rec = msg.get_receiver(); if (rec == logged_in) //checking if looged in user matches the user from list { Console.WriteLine(msg.get_message() + " " + msg.get_sender()); } } }