aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-22 20:23:11 +0800
committerobscuren <geffobscura@gmail.com>2014-12-22 20:23:11 +0800
commit4051c0333f43765a7414a4e0e8ac51e7148b0646 (patch)
tree87c3637424820a681b88723bc666f3d01c069e82 /ui/qt
parente42517754ac2912b6d3ca78a34b8aeadf8805906 (diff)
downloadgo-tangerine-4051c0333f43765a7414a4e0e8ac51e7148b0646.tar.gz
go-tangerine-4051c0333f43765a7414a4e0e8ac51e7148b0646.tar.zst
go-tangerine-4051c0333f43765a7414a4e0e8ac51e7148b0646.zip
Added whisper js api
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/qwhisper/message.go4
-rw-r--r--ui/qt/qwhisper/whisper.go9
2 files changed, 7 insertions, 6 deletions
diff --git a/ui/qt/qwhisper/message.go b/ui/qt/qwhisper/message.go
index 07505ba09..c87647399 100644
--- a/ui/qt/qwhisper/message.go
+++ b/ui/qt/qwhisper/message.go
@@ -8,7 +8,7 @@ import (
type Message struct {
ref *whisper.Message
- Flags byte
+ Flags int32
Payload string
From string
}
@@ -16,7 +16,7 @@ type Message struct {
func ToQMessage(msg *whisper.Message) *Message {
return &Message{
ref: msg,
- Flags: msg.Flags,
+ Flags: int32(msg.Flags),
Payload: ethutil.Bytes2Hex(msg.Payload),
From: ethutil.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())),
}
diff --git a/ui/qt/qwhisper/whisper.go b/ui/qt/qwhisper/whisper.go
index 6fb00cdac..62676daf5 100644
--- a/ui/qt/qwhisper/whisper.go
+++ b/ui/qt/qwhisper/whisper.go
@@ -33,9 +33,9 @@ func (self *Whisper) SetView(view qml.Object) {
self.view = view
}
-func (self *Whisper) Post(data string, to, from string, topics []string, pow, ttl uint32) {
+func (self *Whisper) Post(data, to, from string, topics []string, priority, ttl uint32) {
msg := whisper.NewMessage(fromHex(data))
- envelope, err := msg.Seal(time.Duration(pow), whisper.Opts{
+ envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{
Ttl: time.Duration(ttl),
To: crypto.ToECDSAPub(fromHex(to)),
From: crypto.ToECDSA(fromHex(from)),
@@ -64,13 +64,14 @@ func (self *Whisper) HasIdentity(key string) bool {
func (self *Whisper) Watch(opts map[string]interface{}, view *qml.Common) int {
filter := filterFromMap(opts)
+ var i int
filter.Fn = func(msg *whisper.Message) {
if view != nil {
- view.Call("onMessage", ToQMessage(msg))
+ view.Call("onShhMessage", ToQMessage(msg), i)
}
}
- i := self.Whisper.Watch(filter)
+ i = self.Whisper.Watch(filter)
self.watches[i] = &Watch{}
return i