summaryrefslogtreecommitdiff
path: root/href.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-09-21 21:29:49 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-09-21 21:29:49 +0200
commit3daaf1f4f28443dfb0439d1f8ced0b129fd89d76 (patch)
treef807171971c34a9645e17101e786f5bc23bd70dd /href.go
parenta43882dbaba974123a4bc348fd317a430abc49d9 (diff)
Parse www prefix too
Diffstat (limited to 'href.go')
-rw-r--r--href.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/href.go b/href.go
index 5c5fa1a..c04d633 100644
--- a/href.go
+++ b/href.go
@@ -88,7 +88,11 @@ func FetchTitle(uri string) (string, error) {
func ExtractLinks(conn *irc.Conn, line *irc.Line) {
for _, v := range strings.Fields(line.Text()) {
- if strings.HasPrefix(v, "http") {
+ switch {
+ case strings.HasPrefix(v, "www"):
+ v = "http://" + v
+ fallthrough
+ case strings.HasPrefix(v, "http"):
go func(uri string) {
log.Println(line.Nick, uri)
t, err := FetchTitle(uri)