diff --git a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go
index 53b09ba..e660852 100644
--- a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go
+++ b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go
@@ -327,6 +327,10 @@ func (s *Service) newItems(feedURL string, allItems []*gofeed.Item) (items []gof
// This will inevitably break for some people, but that group of people are probably smaller, so *shrug*.
i.Title = html.UnescapeString(i.Title)
i.Description = html.UnescapeString(i.Description)
+ if i.Author != nil {
+ i.Author.Name = html.UnescapeString(i.Author.Name)
+ i.Author.Email = html.UnescapeString(i.Author.Email)
+ }
items = append(items, *i)
}
@@ -355,18 +359,30 @@ func itemToHTML(feed *gofeed.Feed, item gofeed.Item) gomatrix.HTMLMessage {
if itemTitle == "" {
itemTitle = feed.Title
}
-
+
+ fmtBody := fmt.Sprintf("%s:
%s",
+ html.EscapeString(feed.Title), html.EscapeString(item.Link), html.EscapeString(itemTitle))
+ if item.Author != nil {
+ if len(item.Author.Name) > 0 && len(item.Author.Email) > 0 {
+ fmtBody += fmt.Sprintf(" by %s", html.EscapeString(item.Author.Email),
+ html.EscapeString(item.Author.Name))
+ } else if len(item.Author.Name) > 0 {
+ fmtBody += fmt.Sprintf(" by %s", html.EscapeString(item.Author.Name))
+ } else if len(item.Author.Email) > 0 {
+ fmtBody += fmt.Sprintf(" by %s", html.EscapeString(item.Author.Email),
+ html.EscapeString(item.Author.Email))
+ }
+ }
return gomatrix.HTMLMessage{
Body: fmt.Sprintf("%s: %s ( %s )",
- html.EscapeString(feed.Title), html.EscapeString(item.Title), html.EscapeString(item.Link)),
- MsgType: "m.notice",
- Format: "org.matrix.custom.html",
- FormattedBody: fmt.Sprintf("%s:
%s",
- html.EscapeString(feed.Title), html.EscapeString(item.Link), html.EscapeString(itemTitle)),
- // FeedTitle:
- //
- // Title of the Entry
- }
+ html.EscapeString(feed.Title), html.EscapeString(itemTitle), html.EscapeString(item.Link)),
+ MsgType: "m.notice",
+ Format: "org.matrix.custom.html",
+ FormattedBody: fmtBody,
+ // FeedTitle:
+ //
+ // Title of the Entry
+ }
}
func ensureItemsHaveGUIDs(feed *gofeed.Feed) {