Sections 646.9(a) through 646.9(c) of the Penal Code proscribes sentencing alternatives for a violation of section 646.9(a), Stalking. These alternatives are based to a large extent on the criminal history of the defendant or other aggravating factors.
Section 646.9(c)(2) imposes alternative sentence for a person who has suffered previous stalking conviction. The sentence is county jail for not over 1 year, or state prison.
If there is a temporary restraining order, injunction, or any other court order prohibiting the behavior outlined in 646.9(a) and a person commits a violation of that statute the sentence is a mandatory 2,3, or 4 years in prison. A court order includes an order imposed as a condition of probation.  If a person has been previously convicted of a felony Stalking violation under section 646.9(a) and commits a subsequent violation of 646.9 the sentence is a mandatory prison sentence of 2, 3 or 4 years. A person previously convicted of a felony violation of section 273.5, Infliction of Corporal Injury on Spouse, or Cohabitant; or violating a restraining order under section 273.6; or a violation of section 422, Terrorist Threats, must be sentence to county jail for up to one year or a state prison sentence of 2, 3, or 5 years.
A court has the discretion to require a person convicted of a violation to register as a Sex Offender under section 290.006. 
If probation is granted the defendant must participate in counseling as a condition of probation, unless the court, on a showing of good cause, decides not to impose this requirement.
The court may issue a restraining order valid for up to 10 years requiring the defendant to not contact the victim if justified by the particular facts including.
(a) The seriousness of the facts before the court.
(b) The probability of future violations.
(c) The safety of the victim and the victim's immediate family.
This order may be issued whether the sentence is probation, county jail, or state prison.
The court is also required to consider treatment in a state hospital under section 2684 of the penal code.
A judge may issue an emergency protective order if a peace officer states reasonable grounds to believe that a person is in immediate and present danger of being stalked and that the order is necessary to prevent the stalking. If the order is violated a person can be punished under section 166, criminal contempt if a violation of that statute is also pleaded and proved. A person subject to an emergency protective order may not own, possess, purchase, or receive a firearm while the order is in effect.
The court may order that a party enjoined under 646.91 be prohibited from attempting to discover the address or location of the person protected by the order, or their family.