Trait hiirc::Listener
[−]
[src]
pub trait Listener { fn any(&mut self, irc: Arc<Irc>, event: &Event) { ... } fn msg(&mut self, irc: Arc<Irc>, msg: &Message) { ... } fn error_msg(&mut self, irc: Arc<Irc>, code: &Code, err: &Message) { ... } fn close(&mut self, irc: Arc<Irc>, reason: &str) { ... } fn disconnect(&mut self, irc: Arc<Irc>) { ... } fn reconnecting(&mut self, irc: Arc<Irc>) { ... } fn reconnect(&mut self, irc: Arc<Irc>) { ... } fn welcome(&mut self, irc: Arc<Irc>) { ... } fn channel_join(&mut self, irc: Arc<Irc>, channel: Arc<Channel>) { ... } fn user_join(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>
) { ... } fn user_part(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>
) { ... } fn user_quit(&mut self, irc: Arc<Irc>, nickname: &str) { ... } fn channel_msg(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
sender: Arc<ChannelUser>,
message: &str
) { ... } fn channel_notice(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
sender: Arc<ChannelUser>,
message: &str
) { ... } fn private_msg(&mut self, irc: Arc<Irc>, sender: &str, message: &str) { ... } fn private_notice(&mut self, irc: Arc<Irc>, sender: &str, message: &str) { ... } fn topic(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
topic: Option<Arc<String>>
) { ... } fn topic_change(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
topic: Option<Arc<String>>
) { ... } fn nick_change(&mut self, irc: Arc<Irc>, oldnick: &str, newnick: &str) { ... } fn kick(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>
) { ... } fn ping(&mut self, irc: Arc<Irc>, server: &str) { ... } fn pong(&mut self, irc: Arc<Irc>, server: &str) { ... } fn user_mode_change(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>,
old_status: ChannelUserStatus,
new_status: ChannelUserStatus
) { ... } }
Implement this trait to handle events.
Provided Methods
fn any(&mut self, irc: Arc<Irc>, event: &Event)
Any event.
This includes everything sent by the irc server, i/o errors, disconnects, reconnects, etc.
fn msg(&mut self, irc: Arc<Irc>, msg: &Message)
Any message.
This is not to be confused with channel_msg
or private_msg
!
Messages are a subset of events, they're what the irc server sends.
fn error_msg(&mut self, irc: Arc<Irc>, code: &Code, err: &Message)
Any error message.
When the server sends an error message.
fn close(&mut self, irc: Arc<Irc>, reason: &str)
When the connection is closed.
It can happen if you manually close the connection, if you set the ReconnectionSettings
to DoNotReconnect
or if the maximun number of reconnection attempts is reached.
fn disconnect(&mut self, irc: Arc<Irc>)
When the connection is broken.
fn reconnecting(&mut self, irc: Arc<Irc>)
When an attempt to reconnect is made.
fn reconnect(&mut self, irc: Arc<Irc>)
When the connection is re-established.
fn welcome(&mut self, irc: Arc<Irc>)
When the server sends the welcome packet.
fn channel_join(&mut self, irc: Arc<Irc>, channel: Arc<Channel>)
When the client sucessfully joins a channel.
fn user_join(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>
)
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>
)
When a user joins a channel we are listening on.
fn user_part(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>
)
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>
)
When a user parts a channel we are listening on.
fn user_quit(&mut self, irc: Arc<Irc>, nickname: &str)
When a user quits.
fn channel_msg(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
sender: Arc<ChannelUser>,
message: &str
)
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
sender: Arc<ChannelUser>,
message: &str
)
When a channel message is received.
fn channel_notice(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
sender: Arc<ChannelUser>,
message: &str
)
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
sender: Arc<ChannelUser>,
message: &str
)
When a channel notice is received.
fn private_msg(&mut self, irc: Arc<Irc>, sender: &str, message: &str)
When a private message is received.
fn private_notice(&mut self, irc: Arc<Irc>, sender: &str, message: &str)
When a private notice is received.
fn topic(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
topic: Option<Arc<String>>
)
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
topic: Option<Arc<String>>
)
Reply to a get_topic
command and when joining a channel.
Note that this event might be called before the channel's user list is populated. If a channel has no topic, this event will not be fired when you join a channel. It's safe to assume that a channel has no topic if this event is not fired when joining.
fn topic_change(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
topic: Option<Arc<String>>
)
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
topic: Option<Arc<String>>
)
When the topic of is changed by someone.
If you use the set_topic
method, you will get a topic_change
event instead of a
topic
event.
fn nick_change(&mut self, irc: Arc<Irc>, oldnick: &str, newnick: &str)
When the nick of a user changes.
fn kick(&mut self, irc: Arc<Irc>, channel: Arc<Channel>, user: Arc<ChannelUser>)
When a user gets kicked from a channel.
fn ping(&mut self, irc: Arc<Irc>, server: &str)
When the server sends a ping message.
fn pong(&mut self, irc: Arc<Irc>, server: &str)
When the server sends a pong message.
fn user_mode_change(
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>,
old_status: ChannelUserStatus,
new_status: ChannelUserStatus
)
&mut self,
irc: Arc<Irc>,
channel: Arc<Channel>,
user: Arc<ChannelUser>,
old_status: ChannelUserStatus,
new_status: ChannelUserStatus
)
When the mode of a user in a channel changes.