pub enum ControlMessage {
Cancel {
message_id: String,
},
Newgroup {
group: String,
moderated: bool,
},
Rmgroup {
group: String,
},
Checkgroups {
scope: Option<String>,
serial: Option<String>,
},
Ihave {
message_ids: Vec<String>,
relayer: Option<String>,
},
Sendme {
message_ids: Vec<String>,
relayer: Option<String>,
},
Unknown {
value: String,
},
}Expand description
Control message types (RFC 5537 Section 5)
Control messages are special articles that trigger administrative actions on news servers rather than being displayed to users.
Variants§
Cancel
Cancel an article (RFC 5537 Section 5.3)
Format: cancel <message-id>
Withdraws an article from circulation. The message-id specifies which article to cancel.
Newgroup
Create or modify a newsgroup (RFC 5537 Section 5.2.1)
Format: newgroup <newsgroup-name> [moderated]
Creates a new newsgroup or modifies an existing one. The optional
moderated keyword indicates the group should be moderated.
Fields
Rmgroup
Remove a newsgroup (RFC 5537 Section 5.2.2)
Format: rmgroup <newsgroup-name>
Removes a newsgroup from the server.
Checkgroups
Provide authoritative group list (RFC 5537 Section 5.2.3)
Format: checkgroups [scope] [#serial-number]
Provides an authoritative list of valid newsgroups for a hierarchy.
Fields
Ihave
Legacy peer-to-peer article exchange (RFC 5537 Section 5.5)
Format: ihave <msg-id> [<msg-id>...] <relayer-name>
Largely obsolete. Use NNTP IHAVE command instead (RFC 3977 Section 6.3.2).
Fields
Sendme
Legacy peer-to-peer article exchange (RFC 5537 Section 5.5)
Format: sendme <msg-id> [<msg-id>...] <relayer-name>
Largely obsolete. Requests articles from a peer.
Fields
Unknown
Unknown or unrecognized control message type
Contains the raw control header value for custom handling.
Implementations§
Source§impl ControlMessage
impl ControlMessage
Sourcepub fn parse(control: &str) -> Option<ControlMessage>
pub fn parse(control: &str) -> Option<ControlMessage>
Parse a control message from a Control header value
§Arguments
control- The value of the Control header field
§Examples
use nntp_rs::article::ControlMessage;
let msg = ControlMessage::parse("cancel <spam@example.com>").unwrap();
match msg {
ControlMessage::Cancel { message_id } => {
assert_eq!(message_id, "<spam@example.com>");
}
_ => panic!("Expected cancel"),
}
let msg = ControlMessage::parse("newgroup comp.lang.rust moderated").unwrap();
match msg {
ControlMessage::Newgroup { group, moderated } => {
assert_eq!(group, "comp.lang.rust");
assert!(moderated);
}
_ => panic!("Expected newgroup"),
}Trait Implementations§
Source§impl Clone for ControlMessage
impl Clone for ControlMessage
Source§fn clone(&self) -> ControlMessage
fn clone(&self) -> ControlMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more