aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/packages.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-30 20:47:18 +0800
committerobscuren <geffobscura@gmail.com>2015-01-30 20:47:18 +0800
commitaf927ffdaf0c2c31047d22ab4a3163a4ef9d2342 (patch)
tree5269be68210713e977635069cdcb52bbf36396e3 /rpc/packages.go
parentc03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7 (diff)
downloaddexon-af927ffdaf0c2c31047d22ab4a3163a4ef9d2342.tar.gz
dexon-af927ffdaf0c2c31047d22ab4a3163a4ef9d2342.tar.zst
dexon-af927ffdaf0c2c31047d22ab4a3163a4ef9d2342.zip
Added whisper messages
* have identity & get messages
Diffstat (limited to 'rpc/packages.go')
-rw-r--r--rpc/packages.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/rpc/packages.go b/rpc/packages.go
index 8344d6a46..06de5ca38 100644
--- a/rpc/packages.go
+++ b/rpc/packages.go
@@ -299,6 +299,16 @@ func (p *EthereumApi) WhisperPost(args *WhisperMessageArgs, reply *interface{})
return nil
}
+func (p *EthereumApi) HasWhisperIdentity(args string, reply *interface{}) error {
+ *reply = p.xeth.Whisper().HasIdentity(args)
+ return nil
+}
+
+func (p *EthereumApi) WhisperMessages(id int, reply *interface{}) error {
+ *reply = p.xeth.Whisper().Messages(id)
+ return nil
+}
+
func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error {
// Spec at https://github.com/ethereum/wiki/wiki/Generic-ON-RPC
rpclogger.DebugDetailf("%T %s", req.Params, req.Params)
@@ -405,7 +415,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
}
return p.NewWhisperFilter(args, reply)
case "shh_changed":
- args, err := req.ToWhisperChangedArgs()
+ args, err := req.ToWhisperIdArgs()
if err != nil {
return err
}
@@ -413,9 +423,21 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
case "shh_post":
args, err := req.ToWhisperPostArgs()
if err != nil {
- return nil
+ return err
}
return p.WhisperPost(args, reply)
+ case "shh_haveIdentity":
+ args, err := req.ToWhisperHasIdentityArgs()
+ if err != nil {
+ return err
+ }
+ return p.HasWhisperIdentity(args, reply)
+ case "shh_getMessages":
+ args, err := req.ToWhisperIdArgs()
+ if err != nil {
+ return err
+ }
+ return p.WhisperMessages(args, reply)
default:
return NewErrorResponse(fmt.Sprintf("%v %s", ErrorNotImplemented, req.Method))
}