diff options
author | Dimitri Sokolyuk <demon@dim13.org> | 2015-08-15 13:46:26 +0200 |
---|---|---|
committer | Dimitri Sokolyuk <demon@dim13.org> | 2015-08-15 13:46:26 +0200 |
commit | 2cedfd17b76067124fe1b3455ad0f135a95e5390 (patch) | |
tree | f2c9752ae76dab1375814aff3cf5fc45cf08bed0 /rss.go | |
parent | 420bcc416b57372365bc9cb8df154c038f273c91 (diff) |
Don't show author if there is none
Diffstat (limited to 'rss.go')
-rw-r--r-- | rss.go | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -60,11 +60,20 @@ type News struct { var news = make(chan News) +func (n News) String() string { + s := fmt.Sprintf("%v: %v", n.Name, n.Title) + if n.Author != "" { + s += fmt.Sprintf(" (%v) ", n.Author) + } else { + s += " - " + } + s += fmt.Sprintf("%v", n.Link) + return s +} + func ShowNews(conn *irc.Conn, _ *irc.Line) { for n := range news { - s := fmt.Sprintf("%v: %v (%v) %v", - n.Name, n.Title, n.Author, n.Link) - conn.Notice(*room, s) + conn.Notice(*room, n.String()) } } |