summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rss.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/rss.go b/rss.go
index 31be5ba..03bfba0 100644
--- a/rss.go
+++ b/rss.go
@@ -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())
}
}