; and (ii) in the case of a prosecution for an offense described in this paragraph for which a person was entitled to a jury trial in the jurisdiction in which the case was tried, either— (I) the case was tried by a jury; or (II) the person knowingly and intelligently waived the right to have the case tried by a jury, by guilty plea or otherwise. (C) A person shall not be considered to have been convicted of such an offense for purposes of this chapter if the conviction has been expunged or set aside, or is an offense for which the person has been pardoned or has had civil rights restored (if the law of the applicable jurisdiction provides for the loss of civil rights under such an offense) unless the pardon, expungement, or restoration of civil rights expressly provides that the person may not ship, transport, possess, or receive firearms. . (b) Addition of stalking and those subject to court order Section 922 of title 18, United States Code, is amended— (1) in subsection (d)— (A) in paragraph (8)— (i) in the matter preceding subparagraph (A), by striking that restrains such person and all that follows and inserting described in subsection (g)(8); ; and (ii) by striking subparagraphs (A) and (B); and (B) in paragraph (9), by inserting before the semicolon at the end the following: or a misdemeanor crime of stalking ; and (2) in subsection (g)— (A) by amending paragraph (8) to read as follows: (8) who is subject to a court order— (A) that was issued— (i) after a hearing of which such person received actual notice, and at which such person had an opportunity to participate; or (ii) in the case of an ex parte order, relative to which notice and opportunity to be heard are provided— (I) within the time required by State, tribal, or territorial law; and (II) in any event within a reasonable time after the order is issued, sufficient to protect the due process rights of the person