aboutsummaryrefslogtreecommitdiffstats
path: root/mumlib
diff options
context:
space:
mode:
Diffstat (limited to 'mumlib')
-rw-r--r--mumlib/src/command.rs15
-rw-r--r--mumlib/src/error.rs2
2 files changed, 14 insertions, 3 deletions
diff --git a/mumlib/src/command.rs b/mumlib/src/command.rs
index c5d4676..8cb7cb9 100644
--- a/mumlib/src/command.rs
+++ b/mumlib/src/command.rs
@@ -77,7 +77,7 @@ pub enum Command {
Ping,
SendMessage {
message: String,
- targets: Vec<MessageTarget>,
+ targets: MessageTarget,
},
ServerConnect {
host: String,
@@ -128,8 +128,17 @@ pub enum CommandResponse {
},
}
+/// Messages sent to channels can be sent either to a named channel or the
+/// currently connected channel.
+#[derive(Clone, Debug, Deserialize, Serialize)]
+pub enum ChannelTarget {
+ Current,
+ Named(String)
+}
+
+/// Messages can be sent to either channels or specific users.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum MessageTarget {
- Channel { recursive: bool, name: String },
- User { name: String },
+ Channel(Vec<(ChannelTarget, bool)>), // (target, recursive)
+ User(Vec<String>),
}
diff --git a/mumlib/src/error.rs b/mumlib/src/error.rs
index c492a5f..2cb3927 100644
--- a/mumlib/src/error.rs
+++ b/mumlib/src/error.rs
@@ -12,6 +12,7 @@ pub enum Error {
InvalidUsername(String),
InvalidServerPassword,
Unimplemented,
+ NotConnectedToChannel,
}
impl std::error::Error for Error {}
@@ -28,6 +29,7 @@ impl fmt::Display for Error {
Error::InvalidUsername(username) => write!(f, "Invalid username: {}", username),
Error::InvalidServerPassword => write!(f, "Invalid server password"),
Error::Unimplemented => write!(f, "Unimplemented"),
+ Error::NotConnectedToChannel => write!(f, "Not connected to a channel"),
}
}
}