aboutsummaryrefslogtreecommitdiff
path: root/src/client/dispatch.rs
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/client/dispatch.rs
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/client/dispatch.rs')
-rw-r--r--src/client/dispatch.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs
index 8c10e75..96c8e69 100644
--- a/src/client/dispatch.rs
+++ b/src/client/dispatch.rs
@@ -2,7 +2,8 @@ use std::sync::{Arc, Mutex};
use std::thread;
use super::event_store::EventStore;
use super::login_type::LoginType;
-use super::{Connection, Context};
+use super::Context;
+use super::gateway::Shard;
use ::model::{ChannelId, Event, Message};
#[cfg(feature="framework")]
@@ -35,14 +36,14 @@ macro_rules! update {
}
fn context(channel_id: Option<ChannelId>,
- conn: Arc<Mutex<Connection>>,
+ conn: Arc<Mutex<Shard>>,
login_type: LoginType) -> Context {
Context::new(channel_id, conn, login_type)
}
#[cfg(feature="framework")]
pub fn dispatch(event: Event,
- conn: Arc<Mutex<Connection>>,
+ conn: Arc<Mutex<Shard>>,
framework: Arc<Mutex<Framework>>,
login_type: LoginType,
event_store: Arc<Mutex<EventStore>>) {
@@ -69,7 +70,7 @@ pub fn dispatch(event: Event,
#[cfg(not(feature="framework"))]
pub fn dispatch(event: Event,
- conn: Arc<Mutex<Connection>>,
+ conn: Arc<Mutex<Shard>>,
login_type: LoginType,
event_store: Arc<Mutex<EventStore>>) {
match event {
@@ -99,7 +100,7 @@ fn dispatch_message(context: Context,
#[allow(cyclomatic_complexity)]
fn handle_event(event: Event,
- conn: Arc<Mutex<Connection>>,
+ conn: Arc<Mutex<Shard>>,
login_type: LoginType,
event_store: Arc<Mutex<EventStore>>) {
match event {