mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Update to work with polariton v0.2
This commit is contained in:
@@ -13,7 +13,7 @@ pub struct ClanMember {
|
||||
}
|
||||
|
||||
impl ClanMember {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
pub fn as_transmissible<C>(&self) -> Typed<C> {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("userName".into()), Typed::Str(self.username.clone().into())),
|
||||
(Typed::Str("displayName".into()), Typed::Str(self.display_name.clone().into())),
|
||||
@@ -59,7 +59,7 @@ pub struct ClanInfo {
|
||||
}
|
||||
|
||||
impl ClanInfo {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
pub fn as_transmissible<C>(&self) -> Typed<C> {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("clanName".into()), Typed::Str(self.clan_name.clone().into())),
|
||||
(Typed::Str("clanDescription".into()), Typed::Str(self.clan_description.clone().into())),
|
||||
|
||||
@@ -10,7 +10,7 @@ pub struct ClanInviteInfo {
|
||||
}
|
||||
|
||||
impl ClanInviteInfo {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
pub fn as_transmissible<C>(&self) -> Typed<C> {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("userName".into()), Typed::Str(self.username.clone().into())),
|
||||
(Typed::Str("displayName".into()), Typed::Str(self.display_name.clone().into())),
|
||||
|
||||
21
rc_social_room/src/data/custom.rs
Normal file
21
rc_social_room/src/data/custom.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum CustomType {
|
||||
FriendInfo, // TODO actually serialise
|
||||
}
|
||||
|
||||
pub struct CustomTypeSerdes;
|
||||
|
||||
impl polariton::serdes::CustomSerdes<CustomType> for CustomTypeSerdes {
|
||||
fn dump(_c: &CustomType, w: &mut dyn std::io::Write) -> std::io::Result<usize> {
|
||||
let payload = vec![ // FIXME don't manually serialize
|
||||
0u8, // byte custom type
|
||||
0u8, 5u8, // short custom object size
|
||||
3u8, 0u8, 0u8, 0u8, 0u8, // content
|
||||
];
|
||||
w.write(&payload)
|
||||
}
|
||||
|
||||
fn parse(_r: &mut dyn std::io::Read) -> std::io::Result<CustomType> {
|
||||
Ok(CustomType::FriendInfo)
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ pub struct AvatarInfo {
|
||||
}
|
||||
|
||||
impl AvatarInfo {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
pub fn as_transmissible<C>(&self) -> Typed<C> {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("name".into()), Typed::Str(self.name.clone().into())),
|
||||
(Typed::Str("useCustomAvatar".into()), Typed::Bool(self.use_custom_avatar.into())),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
pub mod friend;
|
||||
pub mod clan_invite;
|
||||
pub mod clan;
|
||||
pub mod custom;
|
||||
|
||||
Reference in New Issue
Block a user