aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/help.rs')
-rw-r--r--src/plugins/help.rs26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/plugins/help.rs b/src/plugins/help.rs
index f048a8e..9a67c99 100644
--- a/src/plugins/help.rs
+++ b/src/plugins/help.rs
@@ -1,30 +1,38 @@
+use std::marker::PhantomData;
+
use irc::client::prelude::*;
use plugin::*;
+use FrippyClient;
use error::ErrorKind as FrippyErrorKind;
use error::FrippyError;
use failure::ResultExt;
#[derive(PluginName, Default, Debug)]
-pub struct Help;
+pub struct Help<C> {
+ phantom: PhantomData<C>,
+}
-impl Help {
- pub fn new() -> Help {
- Help {}
+impl<C: FrippyClient> Help<C> {
+ pub fn new() -> Self {
+ Help {
+ phantom: PhantomData,
+ }
}
}
-impl Plugin for Help {
- fn execute(&self, _: &IrcClient, _: &Message) -> ExecutionStatus {
+impl<C: FrippyClient> Plugin for Help<C> {
+ type Client = C;
+ fn execute(&self, _: &Self::Client, _: &Message) -> ExecutionStatus {
ExecutionStatus::Done
}
- fn execute_threaded(&self, _: &IrcClient, _: &Message) -> Result<(), FrippyError> {
+ fn execute_threaded(&self, _: &Self::Client, _: &Message) -> Result<(), FrippyError> {
panic!("Help should not use threading")
}
- fn command(&self, client: &IrcClient, command: PluginCommand) -> Result<(), FrippyError> {
+ fn command(&self, client: &Self::Client, command: PluginCommand) -> Result<(), FrippyError> {
client
.send_notice(
&command.source,
@@ -37,7 +45,7 @@ impl Plugin for Help {
Ok(())
}
- fn evaluate(&self, _: &IrcClient, _: PluginCommand) -> Result<String, String> {
+ fn evaluate(&self, _: &Self::Client, _: PluginCommand) -> Result<String, String> {
Err(String::from("Help has not been added yet."))
}
}