fn join_group(&self, welcome: Welcome) -> Result<(), String> {
        log::debug!("{} joining group ...", self.username);

        let kpb = self.identity.borrow_mut().update(&self.crypto);
        let mls_group = match MlsGroup::new_from_welcome(
            welcome,
            None, /* no public tree here, has to be in the extension */
            kpb,
            None, /* PSK fetcher */
            &self.crypto,
        ) {
            Ok(g) => g,
            Err(e) => {
                let s = format!("Error creating group from Welcome: {:?}", e);
                log::info!("{}", s);
                return Err(s);
            }
        };

        let group_id = mls_group.group_id();
        // XXX: Add application layer protocol for name etc.
        let group_name = String::from_utf8(group_id.to_vec()).unwrap();
        let group_aad = group_name.clone() + " AAD";
        let group_id = group_id.to_vec();

        // FIXME
        let tree = mls_group.tree();
        let leaf_count = tree.leaf_count();
        let mut members = Vec::new();
        for index in 0..leaf_count.as_usize() {
            let leaf = &tree.nodes[LeafIndex::from(index)];
            if let Some(leaf_node) = leaf.key_package() {
                members.push(leaf_node.credential().identity().to_vec());
            }
        }
        drop(tree);

        let group = Group {
            group_id: group_id.clone(),
            group_name: group_name.clone(),
            members,
            conversation: Conversation::default(),
            mls_group: RefCell::new(mls_group),
            group_aad: group_aad.as_bytes().to_vec(),
            pending_proposals: Vec::new(),
        };

        log::trace!("   {}", group_name);

        match self.groups.borrow_mut().insert(group_id, group) {
            Some(old) => Err(format!("Overrode the group {:?}", old.group_name)),
            None => Ok(()),
        }
    }
/// Join a group with the provided welcome message.
Join a group with the provided welcome message.
Join a group with the provided welcome message .
fn join_group(&self, welcome: Welcome) -> Result<(), String> {
        log::debug!("{} joining group ...", self.username);
        let kpb = self.identity.borrow_mut().update(&self.crypto);
        let mls_group = match MlsGroup::new_from_welcome(
            welcome,
            None, /* no public tree here, has to be in the extension */
            kpb,
            None, /* PSK fetcher */
            &self.crypto,
        ) {
            Ok(g) => g,
            Err(e) => {
                let s = format!("Error creating group from Welcome: {:?}", e);
                log::info!("{}", s);
                return Err(s);
            }
        };
        let group_id = mls_group.group_id();
        // XXX: Add application layer protocol for name etc.
        let group_name = String::from_utf8(group_id.to_vec()).unwrap();
        let group_aad = group_name.clone() + " AAD";
        let group_id = group_id.to_vec();
        // FIXME
        let tree = mls_group.tree();
        let leaf_count = tree.leaf_count();
        let mut members = Vec::new();
        for index in 0..leaf_count.as_usize() {
            let leaf = &tree.nodes[LeafIndex::from(index)];
            if let Some(leaf_node) = leaf.key_package() {
                members.push(leaf_node.credential().identity().to_vec());
            }
        }
        drop(tree);
        let group = Group {
            group_id: group_id.clone(),
            group_name: group_name.clone(),
            members,
            conversation: Conversation::default(),
            mls_group: RefCell::new(mls_group),
            group_aad: group_aad.as_bytes().to_vec(),
            pending_proposals: Vec::new(),
        };
        log::trace!("   {}", group_name);
        match self.groups.borrow_mut().insert(group_id, group) {
            Some(old) => Err(format!("Overrode the group {:?}", old.group_name)),
            None => Ok(()),
        }
    }
fn join_group ( & self , welcome : Welcome ) -> Result < ( ) , String > { log :: debug ! ( " " self username ) ; let kpb = self . identity . borrow_mut ( ) . update ( & self . crypto ) ; let mls_group = match MlsGroup :: new_from_welcome ( welcome , None , /* no public tree here, has to be in the extension */ kpb , None , /* PSK fetcher */ & self . crypto , ) { Ok ( g ) => g , Err ( e ) => { let s = format ! ( " " e ) ; log :: info ! ( " " s ) ; return Err ( s ) ; } } ; let group_id = mls_group . group_id ( ) ; // XXX: Add application layer protocol for name etc. let group_name = String :: from_utf8 ( group_id . to_vec ( ) ) . unwrap ( ) ; let group_aad = group_name . clone ( ) + " " ; let group_id = group_id . to_vec ( ) ; // FIXME let tree = mls_group . tree ( ) ; let leaf_count = tree . leaf_count ( ) ; let mut members = Vec :: new ( ) ; for index in 0 .. leaf_count . as_usize ( ) { let leaf = & tree . nodes [ LeafIndex :: from ( index ) ] ; if let Some ( leaf_node ) = leaf . key_package ( ) { members . push ( leaf_node . credential ( ) . identity ( ) . to_vec ( ) ) ; } } drop ( tree ) ; let group = Group { group_id : group_id . clone ( ) , group_name : group_name . clone ( ) , members , conversation : Conversation :: default ( ) , mls_group : RefCell :: new ( mls_group ) , group_aad : group_aad . as_bytes ( ) . to_vec ( ) , pending_proposals : Vec :: new ( ) , } ; log :: trace ! ( " " group_name ) ; match self . groups . borrow_mut ( ) . insert ( group_id , group ) { Some ( old ) => Err ( format ! ( " " old group_name ) ) , None => Ok ( ( ) ) , } }
Join a group with the provided welcome message.
Join a group with the provided welcome message .
&self
welcome
Welcome
&self
welcome
Welcome