aboutsummaryrefslogtreecommitdiff
path: root/src/ext
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-21 19:17:57 -0800
committerAustin Hellyer <[email protected]>2016-11-21 19:17:57 -0800
commit6b1a83111d4d9cc2ef2f4eed1ee8f58d45525078 (patch)
treea6f0303ebcf4a474f603aaa5c8fff67409d42a17 /src/ext
parentAdd support for creating embed images (diff)
downloadserenity-6b1a83111d4d9cc2ef2f4eed1ee8f58d45525078.tar.xz
serenity-6b1a83111d4d9cc2ef2f4eed1ee8f58d45525078.zip
Re-organize the client module
Re-organize the client module, creating a `gateway` submodule, and splitting the connection into separate files in it. The connection was a conglomeration of a number of purposes, most of which are actually used elsewhere in the library and/or exposed to the user. Thus, it makes sense to separate each item in a gateway-specific module. By splitting the client module further, this is a re-organization for preliminary RPC support WRT the Client. Additionally, rename the Connection struct to a Shard. The Connection itself was not the actual connection, and was a higher-level interface to the real connection logic. A Shard is a more accurate representation of what it actually is.
Diffstat (limited to 'src/ext')
-rw-r--r--src/ext/voice/handler.rs8
-rw-r--r--src/ext/voice/manager.rs6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/ext/voice/handler.rs b/src/ext/voice/handler.rs
index 8dc0ab1..1f2a5d2 100644
--- a/src/ext/voice/handler.rs
+++ b/src/ext/voice/handler.rs
@@ -2,7 +2,7 @@ use serde_json::builder::ObjectBuilder;
use std::sync::mpsc::{self, Sender};
use super::connection_info::ConnectionInfo;
use super::{Status as VoiceStatus, Target};
-use ::client::ConnectionStatus;
+use ::client::gateway::GatewayStatus;
use ::constants::VoiceOpCode;
use ::model::{ChannelId, GuildId, VoiceState};
use super::threading;
@@ -39,7 +39,7 @@ pub struct Handler {
sender: Sender<VoiceStatus>,
session_id: Option<String>,
user_id: u64,
- ws: Sender<ConnectionStatus>,
+ ws: Sender<GatewayStatus>,
}
impl Handler {
@@ -52,7 +52,7 @@ impl Handler {
///
/// [`Manager::join`]: struct.Manager.html#method.join
#[doc(hidden)]
- pub fn new(target: Target, ws: Sender<ConnectionStatus>, user_id: u64)
+ pub fn new(target: Target, ws: Sender<GatewayStatus>, user_id: u64)
-> Self {
let (tx, rx) = mpsc::channel();
@@ -260,7 +260,7 @@ impl Handler {
.insert("self_mute", self.self_mute))
.build();
- let _ = self.ws.send(ConnectionStatus::SendMessage(map));
+ let _ = self.ws.send(GatewayStatus::SendMessage(map));
}
fn send(&mut self, status: VoiceStatus) {
diff --git a/src/ext/voice/manager.rs b/src/ext/voice/manager.rs
index c6c7533..b4f3501 100644
--- a/src/ext/voice/manager.rs
+++ b/src/ext/voice/manager.rs
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use std::sync::mpsc::Sender as MpscSender;
use super::{Handler, Target};
-use ::client::ConnectionStatus;
+use ::client::gateway::GatewayStatus;
use ::model::{ChannelId, GuildId};
/// A manager is a struct responsible for managing [`Handler`]s which belong to
@@ -23,12 +23,12 @@ use ::model::{ChannelId, GuildId};
pub struct Manager {
handlers: HashMap<Target, Handler>,
user_id: u64,
- ws: MpscSender<ConnectionStatus>,
+ ws: MpscSender<GatewayStatus>,
}
impl Manager {
#[doc(hidden)]
- pub fn new(ws: MpscSender<ConnectionStatus>, user_id: u64) -> Manager {
+ pub fn new(ws: MpscSender<GatewayStatus>, user_id: u64) -> Manager {
Manager {
handlers: HashMap::new(),
user_id: user_id,