aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/currency.rs16
-rw-r--r--src/plugins/emoji.rs10
-rw-r--r--src/plugins/help.rs10
-rw-r--r--src/plugins/keepnick.rs12
-rw-r--r--src/plugins/url.rs10
5 files changed, 29 insertions, 29 deletions
diff --git a/src/plugins/currency.rs b/src/plugins/currency.rs
index 4d44d9a..32a2506 100644
--- a/src/plugins/currency.rs
+++ b/src/plugins/currency.rs
@@ -6,7 +6,7 @@ use std::io::Read;
use std::num::ParseFloatError;
use irc::client::prelude::*;
-use irc::error::Error as IrcError;
+use irc::error::IrcError;
use self::reqwest::Client;
use self::reqwest::header::Connection;
@@ -78,7 +78,7 @@ impl Currency {
})
}
- fn convert(&self, server: &IrcServer, command: &mut PluginCommand) -> Result<String, String> {
+ fn convert(&self, server: &IrcClient, command: &mut PluginCommand) -> Result<String, String> {
if command.tokens.len() < 3 {
return Err(self.invalid_command(server));
@@ -105,7 +105,7 @@ impl Currency {
}
}
- fn help(&self, server: &IrcServer) -> String {
+ fn help(&self, server: &IrcClient) -> String {
format!("usage: {} currency value from_currency to_currency\r\n\
example: 1.5 eur usd\r\n\
available currencies: AUD, BGN, BRL, CAD, \
@@ -116,7 +116,7 @@ impl Currency {
server.current_nickname())
}
- fn invalid_command(&self, server: &IrcServer) -> String {
+ fn invalid_command(&self, server: &IrcClient) -> String {
format!("Incorrect Command. \
Send \"{} currency help\" for help.",
server.current_nickname())
@@ -124,15 +124,15 @@ impl Currency {
}
impl Plugin for Currency {
- fn is_allowed(&self, _: &IrcServer, _: &Message) -> bool {
+ fn is_allowed(&self, _: &IrcClient, _: &Message) -> bool {
false
}
- fn execute(&self, _: &IrcServer, _: &Message) -> Result<(), IrcError> {
+ fn execute(&self, _: &IrcClient, _: &Message) -> Result<(), IrcError> {
panic!("Currency does not implement the execute function!")
}
- fn command(&self, server: &IrcServer, mut command: PluginCommand) -> Result<(), IrcError> {
+ fn command(&self, server: &IrcClient, mut command: PluginCommand) -> Result<(), IrcError> {
if command.tokens.is_empty() {
return server.send_notice(&command.source, &self.invalid_command(server));
@@ -147,7 +147,7 @@ impl Plugin for Currency {
}
}
- fn evaluate(&self, server: &IrcServer, mut command: PluginCommand) -> Result<String, String>{
+ fn evaluate(&self, server: &IrcClient, mut command: PluginCommand) -> Result<String, String>{
if command.tokens.is_empty() {
return Err(self.invalid_command(server));
}
diff --git a/src/plugins/emoji.rs b/src/plugins/emoji.rs
index 512a62e..c19593d 100644
--- a/src/plugins/emoji.rs
+++ b/src/plugins/emoji.rs
@@ -3,7 +3,7 @@ extern crate unicode_names;
use std::fmt;
use irc::client::prelude::*;
-use irc::error::Error as IrcError;
+use irc::error::IrcError;
use plugin::*;
@@ -97,14 +97,14 @@ impl Emoji {
}
impl Plugin for Emoji {
- fn is_allowed(&self, _: &IrcServer, message: &Message) -> bool {
+ fn is_allowed(&self, _: &IrcClient, message: &Message) -> bool {
match message.command {
Command::PRIVMSG(_, _) => true,
_ => false,
}
}
- fn execute(&self, server: &IrcServer, message: &Message) -> Result<(), IrcError> {
+ fn execute(&self, server: &IrcClient, message: &Message) -> Result<(), IrcError> {
match message.command {
Command::PRIVMSG(_, ref content) => {
server.send_privmsg(message.response_target().unwrap(),
@@ -114,12 +114,12 @@ impl Plugin for Emoji {
}
}
- fn command(&self, server: &IrcServer, command: PluginCommand) -> Result<(), IrcError> {
+ fn command(&self, server: &IrcClient, command: PluginCommand) -> Result<(), IrcError> {
server.send_notice(&command.source,
"This Plugin does not implement any commands.")
}
- fn evaluate(&self, _: &IrcServer, command: PluginCommand) -> Result<String, String> {
+ fn evaluate(&self, _: &IrcClient, command: PluginCommand) -> Result<String, String> {
let emojis = self.emoji(&command.tokens[0]);
if emojis.is_empty() {
Ok(emojis)
diff --git a/src/plugins/help.rs b/src/plugins/help.rs
index cea325f..1bb15e1 100644
--- a/src/plugins/help.rs
+++ b/src/plugins/help.rs
@@ -1,5 +1,5 @@
use irc::client::prelude::*;
-use irc::error::Error as IrcError;
+use irc::error::IrcError;
use plugin::*;
@@ -13,19 +13,19 @@ impl Help {
}
impl Plugin for Help {
- fn is_allowed(&self, _: &IrcServer, _: &Message) -> bool {
+ fn is_allowed(&self, _: &IrcClient, _: &Message) -> bool {
false
}
- fn execute(&self, _: &IrcServer, _: &Message) -> Result<(), IrcError> {
+ fn execute(&self, _: &IrcClient, _: &Message) -> Result<(), IrcError> {
panic!("Help does not implement the execute function!")
}
- fn command(&self, server: &IrcServer, command: PluginCommand) -> Result<(), IrcError> {
+ fn command(&self, server: &IrcClient, command: PluginCommand) -> Result<(), IrcError> {
server.send_notice(&command.source, "Help has not been added yet.")
}
- fn evaluate(&self, _: &IrcServer, _: PluginCommand) -> Result<String, String> {
+ fn evaluate(&self, _: &IrcClient, _: PluginCommand) -> Result<String, String> {
Err(String::from("Help has not been added yet."))
}
}
diff --git a/src/plugins/keepnick.rs b/src/plugins/keepnick.rs
index 2970857..4a40e8f 100644
--- a/src/plugins/keepnick.rs
+++ b/src/plugins/keepnick.rs
@@ -1,5 +1,5 @@
use irc::client::prelude::*;
-use irc::error::Error as IrcError;
+use irc::error::IrcError;
use plugin::*;
@@ -11,7 +11,7 @@ impl KeepNick {
KeepNick {}
}
- fn check_nick(&self, server: &IrcServer, leaver: &str) -> Result<(), IrcError> {
+ fn check_nick(&self, server: &IrcClient, leaver: &str) -> Result<(), IrcError> {
let cfg_nick = match server.config().nickname {
Some(ref nick) => nick.clone(),
None => return Ok(()),
@@ -34,14 +34,14 @@ impl KeepNick {
}
impl Plugin for KeepNick {
- fn is_allowed(&self, _: &IrcServer, message: &Message) -> bool {
+ fn is_allowed(&self, _: &IrcClient, message: &Message) -> bool {
match message.command {
Command::QUIT(_) => true,
_ => false,
}
}
- fn execute(&self, server: &IrcServer, message: &Message) -> Result<(), IrcError> {
+ fn execute(&self, server: &IrcClient, message: &Message) -> Result<(), IrcError> {
match message.command {
Command::QUIT(ref nick) => {
self.check_nick(server, &nick.clone().unwrap_or_else(|| String::new()))
@@ -50,12 +50,12 @@ impl Plugin for KeepNick {
}
}
- fn command(&self, server: &IrcServer, command: PluginCommand) -> Result<(), IrcError> {
+ fn command(&self, server: &IrcClient, command: PluginCommand) -> Result<(), IrcError> {
server.send_notice(&command.source,
"This Plugin does not implement any commands.")
}
- fn evaluate(&self, _: &IrcServer, _: PluginCommand) -> Result<String, String> {
+ fn evaluate(&self, _: &IrcClient, _: PluginCommand) -> Result<String, String> {
Err(String::from("This Plugin does not implement any commands."))
}
}
diff --git a/src/plugins/url.rs b/src/plugins/url.rs
index ab36833..b980d3e 100644
--- a/src/plugins/url.rs
+++ b/src/plugins/url.rs
@@ -3,7 +3,7 @@ extern crate reqwest;
extern crate select;
use irc::client::prelude::*;
-use irc::error::Error as IrcError;
+use irc::error::IrcError;
use self::regex::Regex;
@@ -126,14 +126,14 @@ impl Url {
}
impl Plugin for Url {
- fn is_allowed(&self, _: &IrcServer, message: &Message) -> bool {
+ fn is_allowed(&self, _: &IrcClient, message: &Message) -> bool {
match message.command {
Command::PRIVMSG(_, ref msg) => RE.is_match(msg),
_ => false,
}
}
- fn execute(&self, server: &IrcServer, message: &Message) -> Result<(), IrcError> {
+ fn execute(&self, server: &IrcClient, message: &Message) -> Result<(), IrcError> {
match message.command {
Command::PRIVMSG(_, ref content) => {
match self.url(content) {
@@ -145,12 +145,12 @@ impl Plugin for Url {
}
}
- fn command(&self, server: &IrcServer, command: PluginCommand) -> Result<(), IrcError> {
+ fn command(&self, server: &IrcClient, command: PluginCommand) -> Result<(), IrcError> {
server.send_notice(&command.source,
"This Plugin does not implement any commands.")
}
- fn evaluate(&self, _: &IrcServer, command: PluginCommand) -> Result<String, String> {
+ fn evaluate(&self, _: &IrcClient, command: PluginCommand) -> Result<String, String> {
self.url(&command.tokens[0]).map_err(|e| String::from(e))
}
}