whisper: clean up and integrate topics

This commit is contained in:
Péter Szilágyi
2015-04-13 12:16:51 +03:00
parent 7b501906db
commit 9a53390f49
7 changed files with 85 additions and 43 deletions

View File

@ -75,8 +75,13 @@ func (self *Message) Wrap(pow time.Duration, options Options) (*Envelope, error)
return nil, err
}
}
// Convert the user topic into whisper ones
topics := make([]Topic, len(options.Topics))
for i, topic := range options.Topics {
topics[i] = NewTopic(topic)
}
// Wrap the processed message, seal it and return
envelope := NewEnvelope(options.TTL, options.Topics, self)
envelope := NewEnvelope(options.TTL, topics, self)
envelope.Seal(pow)
return envelope, nil