Kordophone-2.6: lastMessage in /conversations
This commit is contained in:
4
main.go
4
main.go
@@ -38,12 +38,12 @@ func setupLogging() {
|
||||
func printWelcomeMessage() {
|
||||
// Print ascii art of "Kordophone"
|
||||
fmt.Println(`
|
||||
_ __ _ _
|
||||
_ __ _ _
|
||||
| |/ /___ _ _ __| |___ _ __| |_ ___ _ _ ___
|
||||
| ' </ _ \ '_/ _' / _ \ '_ \ ' \/ _ \ ' \/ -_)
|
||||
|_|\_\___/_| \__,_\___/ .__/_||_\___/_||_\___|
|
||||
|_|
|
||||
`)
|
||||
`)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -13,6 +13,7 @@ type Conversation struct {
|
||||
DisplayName *string `json:"displayName,omitempty"` // Optional
|
||||
UnreadCount int `json:"unreadCount"`
|
||||
LastMessagePreview string `json:"lastMessagePreview"`
|
||||
LastMessage Message `json:"lastMessage"`
|
||||
Guid string `json:"guid"`
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
type Message struct {
|
||||
Text string `json:"text"`
|
||||
Guid string `json:"guid"`
|
||||
Sender *string `json:"sender"` // Optional: nil means from "me"
|
||||
Sender *string `json:"sender,omitempty"` // Optional: nil means from "me"
|
||||
Date time.Time `json:"date"`
|
||||
|
||||
// Map of attachment GUID to attachment metadata
|
||||
Attachments *map[string]AttributionInfo `json:"attachmentMetadata"` // Optional
|
||||
Attachments *map[string]AttributionInfo `json:"attachmentMetadata,omitempty"` // Optional
|
||||
}
|
||||
|
||||
type AttributionInfo struct {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
const VERSION = "Kordophone-2.0"
|
||||
const VERSION = "Kordophone-2.6"
|
||||
|
||||
const (
|
||||
AUTH_USERNAME = "test"
|
||||
@@ -118,7 +118,8 @@ func (s *Server) PopulateWithTestData() {
|
||||
}
|
||||
}
|
||||
|
||||
// Update last message preview
|
||||
// Update last message
|
||||
convo.LastMessage = lastMessage
|
||||
convo.LastMessagePreview = lastMessage.Text
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user