Example #1
0
        public void SetupJoinRoomCommand(JabberID server)
        {
            string room = null;

            if (server.IsBareJID())
            {
                int resourceLoc = RoomCommands.Join.Length + server.ToString().Length + 1;

                room = string.Concat(server.ToString(), "/", _sm.LocalUser.UserName);
                txtOutgoingMessage.Text = string.Concat(RoomCommands.Join, room);
                txtOutgoingMessage.Select(resourceLoc, _sm.LocalUser.UserName.Length);
            }
            else if (server.IsServerJID())
            {
                room = string.Concat("@", server.ToString(), "/", _sm.LocalUser.UserName);
                txtOutgoingMessage.Text = string.Concat(RoomCommands.Join, room);
                txtOutgoingMessage.Select(RoomCommands.Join.Length, 0);
            }
            else if (server.IsFullJID())
            {
                room = server.ToString();
                int resourceLoc = room.LastIndexOf("/") + 1;

                txtOutgoingMessage.Text = string.Concat(RoomCommands.Join, room);
                txtOutgoingMessage.Select(resourceLoc, server.Resource.Length);
            }

            txtOutgoingMessage.Focus();
        }
Example #2
0
 private string FormatMessage( JabberID fromJID, string message )
 {
     if (fromJID.IsBareJID() || fromJID.IsServerJID())
         return string.Format("**{0}**", message);
     else
         return string.Format("<{0}> {1}", fromJID.Resource, message);
 }