aboutsummaryrefslogtreecommitdiff
path: root/src/client/context.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-06-07 15:01:47 -0700
committerZeyla Hellyer <[email protected]>2017-06-07 15:01:47 -0700
commit8f8a05996c5b47ec9401aabb517d96ed2af5c36b (patch)
treeab48c3b558c396f4f6d12c98a466074f97f17acf /src/client/context.rs
parentWs read/write timeout after 90s (diff)
downloadserenity-8f8a05996c5b47ec9401aabb517d96ed2af5c36b.tar.xz
serenity-8f8a05996c5b47ec9401aabb517d96ed2af5c36b.zip
Upgrade rust-websocket, rust-openssl, and hyper
Upgrade `rust-websocket` to v0.20, maintaining use of its sync client. This indirectly switches from `rust-openssl` v0.7 - which required openssl-1.0 on all platforms - to `native-tls`, which allows for use of schannel on Windows, Secure Transport on OSX, and openssl-1.1 on other platforms. Additionally, since hyper is no longer even a dependency of rust-websocket, we can safely and easily upgrade to `hyper` v0.10 and `multipart` v0.12. This commit is fairly experimental as it has not been tested on a long-running bot.
Diffstat (limited to 'src/client/context.rs')
-rw-r--r--src/client/context.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/client/context.rs b/src/client/context.rs
index 5d36647..ec072ca 100644
--- a/src/client/context.rs
+++ b/src/client/context.rs
@@ -134,7 +134,8 @@ impl Context {
///
/// [`Online`]: ../model/enum.OnlineStatus.html#variant.Online
pub fn online(&self) {
- self.shard.lock().unwrap().set_status(OnlineStatus::Online);
+ let mut shard = self.shard.lock().unwrap();
+ shard.set_status(OnlineStatus::Online);
}
/// Sets the current user as being [`Idle`]. This maintains the current
@@ -157,7 +158,8 @@ impl Context {
///
/// [`Idle`]: ../model/enum.OnlineStatus.html#variant.Idle
pub fn idle(&self) {
- self.shard.lock().unwrap().set_status(OnlineStatus::Idle);
+ let mut shard = self.shard.lock().unwrap();
+ shard.set_status(OnlineStatus::Idle);
}
/// Sets the current user as being [`DoNotDisturb`]. This maintains the
@@ -180,7 +182,8 @@ impl Context {
///
/// [`DoNotDisturb`]: ../model/enum.OnlineStatus.html#variant.DoNotDisturb
pub fn dnd(&self) {
- self.shard.lock().unwrap().set_status(OnlineStatus::DoNotDisturb);
+ let mut shard = self.shard.lock().unwrap();
+ shard.set_status(OnlineStatus::DoNotDisturb);
}
/// Sets the current user as being [`Invisible`]. This maintains the current
@@ -203,7 +206,8 @@ impl Context {
/// [`Event::Ready`]: ../model/event/enum.Event.html#variant.Ready
/// [`Invisible`]: ../model/enum.OnlineStatus.html#variant.Invisible
pub fn invisible(&self) {
- self.shard.lock().unwrap().set_status(OnlineStatus::Invisible);
+ let mut shard = self.shard.lock().unwrap();
+ shard.set_status(OnlineStatus::Invisible);
}
/// "Resets" the current user's presence, by setting the game to `None` and
@@ -228,9 +232,8 @@ impl Context {
/// [`Online`]: ../model/enum.OnlineStatus.html#variant.Online
/// [`set_presence`]: #method.set_presence
pub fn reset_presence(&self) {
- self.shard.lock()
- .unwrap()
- .set_presence(None, OnlineStatus::Online, false)
+ let mut shard = self.shard.lock().unwrap();
+ shard.set_presence(None, OnlineStatus::Online, false)
}
/// Sets the current game, defaulting to an online status of [`Online`].
@@ -260,9 +263,8 @@ impl Context {
///
/// [`Online`]: ../model/enum.OnlineStatus.html#variant.Online
pub fn set_game(&self, game: Game) {
- self.shard.lock()
- .unwrap()
- .set_presence(Some(game), OnlineStatus::Online, false);
+ let mut shard = self.shard.lock().unwrap();
+ shard.set_presence(Some(game), OnlineStatus::Online, false);
}
/// Sets the current game, passing in only its name. This will automatically
@@ -302,9 +304,8 @@ impl Context {
url: None,
};
- self.shard.lock()
- .unwrap()
- .set_presence(Some(game), OnlineStatus::Online, false);
+ let mut shard = self.shard.lock().unwrap();
+ shard.set_presence(Some(game), OnlineStatus::Online, false);
}
/// Sets the current user's presence, providing all fields to be passed.
@@ -351,8 +352,7 @@ impl Context {
game: Option<Game>,
status: OnlineStatus,
afk: bool) {
- self.shard.lock()
- .unwrap()
- .set_presence(game, status, afk)
+ let mut shard = self.shard.lock().unwrap();
+ shard.set_presence(game, status, afk)
}
}