Пример #1
0
 // Send Message To recipient User In Private Chat
 public void SendMessage(NetUser sender, Message <int> msg)
 {
     try
     {
         NetUser recipient = sender.PrivateChats[msg.ID];
         MessageData.AddMessage(msg, sender.Email, recipient.Email);
         SerializableObject <Status> obj =
             new SerializableObject <Status>(Status.Message, msg);
         sender.Send(obj);
         msg.ChangeID(sender);
         recipient.Send(obj);
     }
     catch (Exception e)
     {
         Console.WriteLine("PrivateChatsHandler|SendMessage| User: "******" \nError: " + e.Message);
     }
 }
Пример #2
0
        //Happens When User Send Message
        void SendMessageTo(NetUser u, Message msg)
        {
            switch (msg.Type)
            {
            case MessageType.Global:
                database.AddMessage(msg, u.Email);
                OnNewMessage(msg);
                MyUsers.SendMessage(msg);
                break;

            case MessageType.Private:
                Private.SendMessage(u, (Message <int>)msg);
                break;

            case MessageType.Group:
                Group.SendMesseage(u, (Message <Guid>)msg);
                break;
            }
        }