pub struct Register<O> {
pub password: fn(&O) -> Option<Line<'static>>,
pub username: fn(&O) -> User<'static>,
pub user_p1: fn(&O) -> Arg<'static>,
pub user_p2: fn(&O) -> Arg<'static>,
pub realname: fn(&O) -> Line<'static>,
pub nicks: fn(&O) -> Box<dyn NickGen>,
pub caps: fn(&O) -> Box<dyn CapFn>,
pub auth: fn(&O) -> (SaslQueue, bool),
}client only.Expand description
Client logic for the connection registration process.
Consider using the register_as_bot(), register_as_client(),
or register_as_custom() functions to instantiate one of these.
The handler returned by using this type signals completion over its channel. Most of the useful data about client registration is added to the client as shared state. In particular, connection statistics and the MOTD are NOT stored, and should be read using a different handler.
Fields§
§password: fn(&O) -> Option<Line<'static>>Returns the server password, if any.
username: fn(&O) -> User<'static>Returns the username to use for connection.
user_p1: fn(&O) -> Arg<'static>Returns the value used for the first unused USER parameter.
For older IRC software, this parameter is not actually unusused. RFC1459 specifies that this should be the connecting system’s hostname, while RFC2812 specifies that this should be a decimal integer whose bits are used to set user modes on connection.
user_p2: fn(&O) -> Arg<'static>Returns the value used for the second unused USER parameter.
For older IRC software, this parameter is not actually unusused. RFC1459 specifies that this should be the name of the server being connected to.
realname: fn(&O) -> Line<'static>Returns the realname to use for connection.
nicks: fn(&O) -> Box<dyn NickGen>Creates a nick generator.
caps: fn(&O) -> Box<dyn CapFn>Returns a boxed CapFn that provides a set of capabilities to require,
given a set of available capabilities.
These capabilities will be requested from the server,
except for sts which is special-cased to never be requested, only checked for presence.
auth: fn(&O) -> (SaslQueue, bool)Returns a SaslQueue to attempt
and whether to close the connection on non-authentication.
Implementations§
Source§impl<O> Register<O>
impl<O> Register<O>
Sourcepub fn register_msgs(
&self,
opts: &O,
sink: impl ClientMsgSink<'static>,
) -> (Nick<'static>, Option<Box<dyn NickGen>>)
pub fn register_msgs( &self, opts: &O, sink: impl ClientMsgSink<'static>, ) -> (Nick<'static>, Option<Box<dyn NickGen>>)
Sends the initial burst of messages for connection registration. Also returns the nickname used and a generator for fallback nicknames.
§Errors
Errors only if retrieving the server password errors.
Trait Implementations§
Source§impl<'a, O> MakeHandler<&'a O> for &'a Register<O>
impl<'a, O> MakeHandler<&'a O> for &'a Register<O>
Source§type Error = Infallible
type Error = Infallible
Source§type Receiver<Spec: ChannelSpec> = <Spec as ChannelSpec>::Oneshot<<&'a Register<O> as MakeHandler<&'a O>>::Value>
type Receiver<Spec: ChannelSpec> = <Spec as ChannelSpec>::Oneshot<<&'a Register<O> as MakeHandler<&'a O>>::Value>
Source§fn make_handler(
self,
_: &ClientState,
queue: QueueEditGuard<'_>,
opts: &'a O,
) -> Result<Box<dyn Handler<Value = Self::Value>>, Self::Error>
fn make_handler( self, _: &ClientState, queue: QueueEditGuard<'_>, opts: &'a O, ) -> Result<Box<dyn Handler<Value = Self::Value>>, Self::Error>
T into a Handler and queues messages.