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();
        }