示例#1
0
func (self *channelAPI) Signal_AcceptedInvitation(perma grapher.PermaNode, permission grapher.PermissionNode, keep grapher.KeepNode) {
	msgJson := map[string]interface{}{"perma": perma.BlobRef(), "type": "accept", "signer": permission.Signer(), "permission": permission.BlobRef()}
	schema, err := json.Marshal(msgJson)
	if err != nil {
		panic(err.String())
	}
	if self.bufferOnly {
		self.messageBuffer = append(self.messageBuffer, string(schema))
	} else {
		err = self.forwardToUser(keep.Signer(), string(schema))
	}
	if err != nil {
		log.Printf("Err Forward: %v", err)
	}
}
示例#2
0
func (self *channelAPI) Blob_Keep(perma grapher.PermaNode, permission grapher.PermissionNode, keep grapher.KeepNode) {
	mutJson := map[string]interface{}{"perma": perma.BlobRef(), "seq": keep.SequenceNumber(), "type": "keep", "signer": keep.Signer(), "mimetype": perma.MimeType()}
	if permission != nil {
		mutJson["permission"] = permission.SequenceNumber()
	}
	schema, err := json.Marshal(mutJson)
	if err != nil {
		panic(err.String())
	}
	message := string(schema)
	if self.bufferOnly {
		self.messageBuffer = append(self.messageBuffer, string(schema))
	} else {
		self.forwardToUser(keep.Signer(), message)
		err = self.forwardToFollowers(perma.BlobRef(), message)
	}
	if err != nil {
		log.Printf("Err Forward: %v", err)
	}
}