当前位置: 首页>>代码示例>>Golang>>正文


Golang PermaNode.MimeType方法代码示例

本文整理汇总了Golang中lightwavegrapher.PermaNode.MimeType方法的典型用法代码示例。如果您正苦于以下问题:Golang PermaNode.MimeType方法的具体用法?Golang PermaNode.MimeType怎么用?Golang PermaNode.MimeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lightwavegrapher.PermaNode的用法示例。


在下文中一共展示了PermaNode.MimeType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Signal_ReceivedInvitation

func (self *channelAPI) Signal_ReceivedInvitation(perma grapher.PermaNode, permission grapher.PermissionNode) {
	// TODO: Compute digest
	var digest = "Untitled page"
	msgJson := map[string]interface{}{"perma": perma.BlobRef(), "type": "invitation", "signer": permission.Signer(), "permission": permission.BlobRef(), "digest": digest}
	fillInboxItem(self.store, perma.BlobRef(), int64(0), msgJson)
	schema, err := json.Marshal(msgJson)
	if err != nil {
		panic(err.String())
	}
	if self.bufferOnly {
		self.messageBuffer = append(self.messageBuffer, string(schema))
	} else {
		if perma.MimeType() == "application/x-lightwave-page" {
			addToInbox(self.c, permission.UserName(), perma.BlobRef(), 0)
		}
		err = self.forwardToUser(permission.UserName(), string(schema))
	}
	if err != nil {
		log.Printf("Err Forward: %v", err)
	}

	// Automatically accept the invitation
	//  self.grapher.CreateKeepBlob(perma.BlobRef(), permission.BlobRef())
}
开发者ID:AaronO,项目名称:lightwave,代码行数:24,代码来源:channel.go

示例2: Blob_Keep

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)
	}
}
开发者ID:AaronO,项目名称:lightwave,代码行数:20,代码来源:channel.go


注:本文中的lightwavegrapher.PermaNode.MimeType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。