rpc, ui/qt/qwhisper, whisper, xeth: introduce complex topic filters

This commit is contained in:
Péter Szilágyi
2015-04-21 18:31:08 +03:00
parent 15586368e5
commit ae4bfc3cfb
11 changed files with 374 additions and 60 deletions

View File

@ -67,11 +67,11 @@ func (self *Whisper) Post(payload string, to, from string, topics []string, prio
// Watch installs a new message handler to run in case a matching packet arrives
// from the whisper network.
func (self *Whisper) Watch(to, from string, topics []string, fn func(WhisperMessage)) int {
func (self *Whisper) Watch(to, from string, topics [][]string, fn func(WhisperMessage)) int {
filter := whisper.Filter{
To: crypto.ToECDSAPub(common.FromHex(to)),
From: crypto.ToECDSAPub(common.FromHex(from)),
Topics: whisper.NewTopicsFromStrings(topics...),
Topics: whisper.NewTopicFilterFromStrings(topics...),
}
filter.Fn = func(message *whisper.Message) {
fn(NewWhisperMessage(message))