Ejemplo n.º 1
0
func (pm *TextMessage) writeTo(client *Client, w io.Writer) (int64, error) {
	packet := MumbleProto.TextMessage{
		Message: &pm.Message,
	}
	if pm.Users != nil {
		packet.Session = make([]uint32, len(pm.Users))
		for i, user := range pm.Users {
			packet.Session[i] = user.session
		}
	}
	if pm.Channels != nil {
		packet.ChannelId = make([]uint32, len(pm.Channels))
		for i, channel := range pm.Channels {
			packet.ChannelId[i] = channel.id
		}
	}
	if pm.Trees != nil {
		packet.TreeId = make([]uint32, len(pm.Trees))
		for i, channel := range pm.Trees {
			packet.TreeId[i] = channel.id
		}
	}
	proto := protoMessage{&packet}
	return proto.writeTo(client, w)
}
Ejemplo n.º 2
0
func (tm *TextMessage) writeMessage(client *Client) error {
	packet := MumbleProto.TextMessage{
		Message: &tm.Message,
	}
	if tm.Users != nil {
		packet.Session = make([]uint32, len(tm.Users))
		for i, user := range tm.Users {
			packet.Session[i] = user.Session
		}
	}
	if tm.Channels != nil {
		packet.ChannelId = make([]uint32, len(tm.Channels))
		for i, channel := range tm.Channels {
			packet.ChannelId[i] = channel.ID
		}
	}
	if tm.Trees != nil {
		packet.TreeId = make([]uint32, len(tm.Trees))
		for i, channel := range tm.Trees {
			packet.TreeId[i] = channel.ID
		}
	}
	proto := protoMessage{&packet}
	return proto.writeMessage(client)
}