Esempio n. 1
0
// send converts |msg| into a RobustMessage and appends it to |reply|.
func (i *IRCServer) send(reply *Replyctx, msg *irc.Message) *types.RobustMessage {
	if reply.lastmsg == msg {
		return reply.Messages[len(reply.Messages)-1]
	}

	reply.replyid++

	robustmsg := &types.RobustMessage{
		// The IDs must be the same across servers.
		Id: types.RobustId{
			Id:    reply.msgid,
			Reply: reply.replyid,
		},
		Data:           string(msg.Bytes()),
		InterestingFor: make(map[int64]bool),
	}

	reply.Messages = append(reply.Messages, robustmsg)
	reply.lastmsg = msg

	return robustmsg
}