aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugin.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugin.rs')
-rw-r--r--src/plugin.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugin.rs b/src/plugin.rs
index 8785708..88fe3ce 100644
--- a/src/plugin.rs
+++ b/src/plugin.rs
@@ -4,13 +4,19 @@ use std::fmt;
use irc::client::prelude::*;
use irc::error::IrcError;
+pub enum ExecutionStatus {
+ Done,
+ Err(IrcError),
+ RequiresThread,
+}
+
/// `Plugin` has to be implemented for any struct that should be usable
/// as a plugin in frippy.
pub trait Plugin: PluginName + Send + Sync + fmt::Debug {
/// This should return true if the `Plugin` wants to do work on the message.
- fn is_allowed(&self, server: &IrcClient, message: &Message) -> bool;
+ fn execute(&self, server: &IrcClient, message: &Message) -> ExecutionStatus;
/// Handles messages which are not commands but still necessary.
- fn execute(&self, server: &IrcClient, message: &Message) -> Result<(), IrcError>;
+ fn execute_threaded(&self, server: &IrcClient, message: &Message) -> Result<(), IrcError>;
/// Handles any command directed at this plugin.
fn command(&self, server: &IrcClient, command: PluginCommand) -> Result<(), IrcError>;
/// Should work like command but return a String instead of sending messages to IRC.