// join an existing group (UserAdd)
join an existing group (UserAdd)
// join an existing group ( UserAdd )
func (p *Protocol) Join(gid string) (*GroupChannel, error) {
	gik, err := p.directory.LookupGroup(gid)
	if err != nil {
		return nil, err
	}
	if gik == nil {
		return nil, ErrGroupNotFound
	}
	uik, err := p.generateUIK()
	if err != nil {
		return nil, err
	}
	channel, err := p.CreateGroupChannelWithGIK(gik, uik)
	if err != nil {
		return nil, err
	}
	if err := channel.Join(); err != nil {
		return nil, err
	}
	return channel, nil
}
func ( p * Protocol ) Join ( gid string ) ( * GroupChannel , error ) { gik , err := p . directory . LookupGroup ( gid ) if err != nil { return nil , err } if gik == nil { return nil , ErrGroupNotFound } uik , err := p . generateUIK ( ) if err != nil { return nil , err } channel , err := p . CreateGroupChannelWithGIK ( gik , uik ) if err != nil { return nil , err } if err := channel . Join ( ) ; err != nil { return nil , err } return channel , nil }
join an existing group (UserAdd)
join an existing group ( UserAdd )
// lookup the group // we should renew the UIK and register it to the directory service