func (VS *Server) messagesToHTML(c *gin.Context, idUser bson.ObjectId, msgs []Message) []MessageHTML {
	var messages []MessageHTML
	var message MessageHTML
	for _, m := range msgs {
		message.ID = m.ID
		message.IDConversation = m.IDConversation
		if m.Audio != "" {
			message.Audio = "/local/conversations/" + m.IDConversation.Hex() + "/" + m.Audio
		}
		if m.Photo != "" {
			message.Photo = "/local/conversations/" + m.IDConversation.Hex() + "/" + m.Photo
		}
		if m.IDUser == idUser {
			message.Class = "emitter"
		} else {
			message.Class = "receiver"
		}

		timeStamp := time.Unix(m.Date, 0)
		hr, min, sec := timeStamp.Clock()
		hour, minute, second := "", "", ""
		if hr < 10 {
			hour = "0" + strconv.Itoa(hr)
		} else {
			hour = strconv.Itoa(hr)
		}
		if min < 10 {
			minute = "0" + strconv.Itoa(min)
		} else {
			minute = strconv.Itoa(min)
		}
		if sec < 10 {
			second = "0" + strconv.Itoa(sec)
		} else {
			second = strconv.Itoa(sec)
		}
		message.Time = hour + ":" + minute + ":" + second
		message.Text = m.Text
		if m.IDUser != "" {
			message.User = VS.getUserByID(c, m.IDUser, "h_view", "messagesToHTML", "message.User = VS.getUserByID").Name
		}
		y, mo, d := time.Unix(m.Date, 0).Date()
		message.Date = time.Unix(m.Date, 0).Weekday().String() + ", " + strconv.Itoa(d) + " of " + mo.String() + " of " + strconv.Itoa(y)
		messages = append(messages, message)
	}
	return messages
}
// Create the human readable information for the table for Messages
Create the human readable information for the table for Messages
// Create the human readable information for the table for Messages
func (VS *Server) messagesToHTML(c *gin.Context, idUser bson.ObjectId, msgs []Message) []MessageHTML {
	var messages []MessageHTML
	var message MessageHTML
	for _, m := range msgs {
		message.ID = m.ID
		message.IDConversation = m.IDConversation
		if m.Audio != "" {
			message.Audio = "/local/conversations/" + m.IDConversation.Hex() + "/" + m.Audio
		}
		if m.Photo != "" {
			message.Photo = "/local/conversations/" + m.IDConversation.Hex() + "/" + m.Photo
		}
		if m.IDUser == idUser {
			message.Class = "emitter"
		} else {
			message.Class = "receiver"
		}
		timeStamp := time.Unix(m.Date, 0)
		hr, min, sec := timeStamp.Clock()
		hour, minute, second := "", "", ""
		if hr < 10 {
			hour = "0" + strconv.Itoa(hr)
		} else {
			hour = strconv.Itoa(hr)
		}
		if min < 10 {
			minute = "0" + strconv.Itoa(min)
		} else {
			minute = strconv.Itoa(min)
		}
		if sec < 10 {
			second = "0" + strconv.Itoa(sec)
		} else {
			second = strconv.Itoa(sec)
		}
		message.Time = hour + ":" + minute + ":" + second
		message.Text = m.Text
		if m.IDUser != "" {
			message.User = VS.getUserByID(c, m.IDUser, "h_view", "messagesToHTML", "message.User = VS.getUserByID").Name
		}
		y, mo, d := time.Unix(m.Date, 0).Date()
		message.Date = time.Unix(m.Date, 0).Weekday().String() + ", " + strconv.Itoa(d) + " of " + mo.String() + " of " + strconv.Itoa(y)
		messages = append(messages, message)
	}
	return messages
}
func ( VS * Server ) messagesToHTML ( c * gin . Context , idUser bson . ObjectId , msgs [ ] Message ) [ ] MessageHTML { var messages [ ] MessageHTML var message MessageHTML for _ , m := range msgs { message . ID = m . ID message . IDConversation = m . IDConversation if m . Audio != " " { message . Audio = " " + m . IDConversation . Hex ( ) + " " + m . Audio } if m . Photo != " " { message . Photo = " " + m . IDConversation . Hex ( ) + " " + m . Photo } if m . IDUser == idUser { message . Class = " " } else { message . Class = " " } timeStamp := time . Unix ( m . Date , 0 ) hr , min , sec := timeStamp . Clock ( ) hour , minute , second := " " , " " , " " if hr < 10 { hour = " " + strconv . Itoa ( hr ) } else { hour = strconv . Itoa ( hr ) } if min < 10 { minute = " " + strconv . Itoa ( min ) } else { minute = strconv . Itoa ( min ) } if sec < 10 { second = " " + strconv . Itoa ( sec ) } else { second = strconv . Itoa ( sec ) } message . Time = hour + " " + minute + " " + second message . Text = m . Text if m . IDUser != " " { message . User = VS . getUserByID ( c , m . IDUser , " " , " " , " " ) . Name } y , mo , d := time . Unix ( m . Date , 0 ) . Date ( ) message . Date = time . Unix ( m . Date , 0 ) . Weekday ( ) . String ( ) + " " + strconv . Itoa ( d ) + " " + mo . String ( ) + " " + strconv . Itoa ( y ) messages = append ( messages , message ) } return messages }
Create the human readable information for the table for Messages
Create the human readable information for the table for Messages