Include optional family
field in Hello
messages
This commit is contained in:
parent
4ca9ffaa0e
commit
43006e9a53
2 changed files with 3 additions and 2 deletions
|
@ -18,6 +18,7 @@ pub struct MessageRelations {
|
||||||
pub enum MessageContent {
|
pub enum MessageContent {
|
||||||
Hello {
|
Hello {
|
||||||
peer_name: String,
|
peer_name: String,
|
||||||
|
family: Option<Family>,
|
||||||
},
|
},
|
||||||
JoinFamily,
|
JoinFamily,
|
||||||
AddedToFamily {
|
AddedToFamily {
|
||||||
|
|
|
@ -17,9 +17,9 @@ pub fn handle(state: &CommState, peer: &PeerId, message: Message) {
|
||||||
state.own_peer_id().unwrap()
|
state.own_peer_id().unwrap()
|
||||||
);
|
);
|
||||||
match message.content() {
|
match message.content() {
|
||||||
MessageContent::Hello { peer_name } => {
|
MessageContent::Hello { peer_name, family } => {
|
||||||
state
|
state
|
||||||
.set_peer(Peer::new(peer.to_owned(), Some(peer_name.to_string()), None)) //TODO: Allow sending Family in Hello message
|
.set_peer(Peer::new(peer.to_owned(), Some(peer_name.to_string()), family.to_owned()))
|
||||||
.expect("State failed");
|
.expect("State failed");
|
||||||
}
|
}
|
||||||
MessageContent::JoinFamily => state.request_family_join(peer.to_owned()),
|
MessageContent::JoinFamily => state.request_family_join(peer.to_owned()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue