ToString() public method

Return the translated version of this message. If no translation is available, return the message itself
public ToString ( ) : string
return string
Example #1
0
 void OnMucMessage(Message msg)
 {
     User user = msg.MucUser;
     string text;
     if (user.Invite != null) {
         if (user.Invite.Reason != null && user.Invite.Reason.Trim().Length > 0) {
             text = String.Format(_("You have been invited to {2} by {0} because {1}"),
                                  user.Invite.From,
                                  user.Invite.Reason,
                                  msg.From
                                  );
         } else {
             text = String.Format(_("You have been invited to {1} by {0}"),
                                  user.Invite.From,
                                  msg.From
                                  );
         }
     } else {
         text = msg.ToString();
     }
     var builder = CreateMessageBuilder();
     builder.AppendEventPrefix();
     var txt = builder.CreateText(text);
     txt.IsHighlight = true;
     builder.AppendText(txt);
     Session.AddMessageToChat(NetworkChat, builder.ToMessage());
     builder = CreateMessageBuilder();
     string url;
     if (!String.IsNullOrEmpty(user.Password)) {
         url = String.Format("xmpp:{0}?join;password={1}", msg.From, user.Password);
     } else {
         url = String.Format("xmpp:{0}?join", msg.From);
     }
     builder.AppendUrl(url, _("Accept invite (join room)"));
     Session.AddMessageToChat(NetworkChat, builder.ToMessage());
 }
Example #2
0
 public void SendMessage(Message message)
 {
     IPAddress Ip = GetIPAddress();
     Console.WriteLine("SendMessage:" + message.ToString());
     if (Ip != null)
     {
         EthernetSocket eth = new EthernetSocket(Ip);
         eth.SendMessage(message);
     }
 }