aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorillia k <[email protected]>2017-05-22 22:49:07 +0300
committerZeyla Hellyer <[email protected]>2017-05-22 12:49:07 -0700
commit8f88c6b0613199492ebca8cd9f2bf4dd5c97add7 (patch)
treeea2f86a016e8e6a4dc91f8b7492fcb716f946915 /src/client
parentAdd support for retrieving invites with counts (diff)
downloadserenity-8f88c6b0613199492ebca8cd9f2bf4dd5c97add7.tar.xz
serenity-8f88c6b0613199492ebca8cd9f2bf4dd5c97add7.zip
Handle message type 7 (member join)
When message type 7 is received from the gateway, transform the content if the type is 7 to a proper greeting. Additionally, when the type is 6, provide a proper content notifying that a user has pinned a message to the channel. These transformations are not done at REST-level when retrieving messages, and are instead done in `ChannelId::message` and `ChannelId::messages`.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/dispatch.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs
index cea3ed3..56b5f6e 100644
--- a/src/client/dispatch.rs
+++ b/src/client/dispatch.rs
@@ -108,10 +108,14 @@ pub fn dispatch(event: Event,
}
fn dispatch_message(context: Context,
- message: Message,
+ mut message: Message,
event_store: &Arc<RwLock<EventStore>>) {
if let Some(handler) = handler!(on_message, event_store) {
- thread::spawn(move || (handler)(context, message));
+ thread::spawn(move || {
+ message.transform_content();
+
+ (handler)(context, message);
+ });
}
}