Skip to content

Commit

Permalink
feat: add a "watching" user field
Browse files Browse the repository at this point in the history
  • Loading branch information
vyneer authored and jbpratt committed Oct 18, 2023
1 parent 201abfc commit 8eeebb1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions messageStructs.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ type (
Nick string `json:"nick"`
Features []string `json:"features"`
CreatedDate time.Time `json:"createdDate"`
Watching watching `json:"watching"`
}

watching struct {
Platform string `json:"platform"`
ID string `json:"id"`
}

// RoomAction represents a user joining or quitting the chat
Expand Down
6 changes: 6 additions & 0 deletions parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func parseMessage(s string) (Message, error) {
Nick: m.Nick,
Features: m.Features,
CreatedDate: m.CreatedDate,
Watching: m.Watching,
}

message := Message{
Expand All @@ -41,6 +42,7 @@ func parsePin(s string) (Pin, error) {
Nick: p.Nick,
Features: p.Features,
CreatedDate: p.CreatedDate,
Watching: p.Watching,
}

pin := Pin{
Expand Down Expand Up @@ -71,6 +73,7 @@ func parseMute(s string, sess *Session) (Mute, error) {
Nick: u.Nick,
Features: u.Features,
CreatedDate: u.CreatedDate,
Watching: u.Watching,
},
Online: online,
}
Expand All @@ -96,6 +99,7 @@ func parseBan(s string, sess *Session) (Ban, error) {
Nick: u.Nick,
Features: u.Features,
CreatedDate: u.CreatedDate,
Watching: u.Watching,
},
Online: online,
}
Expand Down Expand Up @@ -127,6 +131,7 @@ func parseRoomAction(s string) (RoomAction, error) {
Nick: ra.Nick,
Features: ra.Features,
CreatedDate: ra.CreatedDate,
Watching: ra.Watching,
},
Timestamp: unixToTime(ra.Timestamp),
}
Expand Down Expand Up @@ -244,6 +249,7 @@ func parseSubOnly(s string) (SubOnly, error) {
Nick: so.Nick,
Features: so.Features,
CreatedDate: so.CreatedDate,
Watching: so.Watching,
},
Timestamp: unixToTime(so.Timestamp),
// the backend specifies values "on" and "off" ONLY.
Expand Down

0 comments on commit 8eeebb1

Please sign in to comment.