aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/emoji.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-02-12 19:16:59 +0100
committerJokler <jokler.contact@gmail.com>2018-02-12 19:16:59 +0100
commitda5c2c8e4893bfb095a8e2122b943c4dca61c41d (patch)
tree3bf1e64c4a128e6b0cb5d5172daf1e3398406715 /src/plugins/emoji.rs
parentddf42bc0292b0befe2b2f47f3284d9ffeaf6f4b4 (diff)
downloadfrippy-da5c2c8e4893bfb095a8e2122b943c4dca61c41d.tar.gz
frippy-da5c2c8e4893bfb095a8e2122b943c4dca61c41d.zip
Replace is_allowed with a single-threaded execute function
The old execute got renamed to exeute_threaded.
Diffstat (limited to 'src/plugins/emoji.rs')
-rw-r--r--src/plugins/emoji.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/plugins/emoji.rs b/src/plugins/emoji.rs
index c19593d..02a31f8 100644
--- a/src/plugins/emoji.rs
+++ b/src/plugins/emoji.rs
@@ -97,25 +97,25 @@ impl Emoji {
}
impl Plugin for Emoji {
- fn is_allowed(&self, _: &IrcClient, message: &Message) -> bool {
- match message.command {
- Command::PRIVMSG(_, _) => true,
- _ => false,
- }
- }
-
- fn execute(&self, server: &IrcClient, message: &Message) -> Result<(), IrcError> {
+ fn execute(&self, client: &IrcClient, message: &Message) -> ExecutionStatus {
match message.command {
Command::PRIVMSG(_, ref content) => {
- server.send_privmsg(message.response_target().unwrap(),
- &self.emoji(content))
+ match client.send_privmsg(message.response_target().unwrap(),
+ &self.emoji(content)) {
+ Ok(_) => ExecutionStatus::Done,
+ Err(e) => ExecutionStatus::Err(e),
+ }
}
- _ => Ok(()),
+ _ => ExecutionStatus::Done,
}
}
- fn command(&self, server: &IrcClient, command: PluginCommand) -> Result<(), IrcError> {
- server.send_notice(&command.source,
+ fn execute_threaded(&self, _: &IrcClient, _: &Message) -> Result<(), IrcError> {
+ panic!("Emoji should not use threading")
+ }
+
+ fn command(&self, client: &IrcClient, command: PluginCommand) -> Result<(), IrcError> {
+ client.send_notice(&command.source,
"This Plugin does not implement any commands.")
}