summaryrefslogtreecommitdiff
path: root/src/message.clj
diff options
context:
space:
mode:
authorScott Ostler <scottbot9000@gmail.com>2011-01-04 15:42:23 -0500
committerScott Ostler <scottbot9000@gmail.com>2011-01-04 15:42:23 -0500
commit92b092823c21af1339e0d42716dc856357f93e85 (patch)
tree809221e2a3b3c88306ba5e4b4996eb05297cec02 /src/message.clj
parent7a031af911887a913857fdcebb252231119f4bf9 (diff)
Added topics, refactored recipient handling
Diffstat (limited to 'src/message.clj')
-rw-r--r--src/message.clj12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/message.clj b/src/message.clj
index a8e0e9b..9f1380b 100644
--- a/src/message.clj
+++ b/src/message.clj
@@ -1,5 +1,6 @@
(ns message
- (:use user))
+ (:use user
+ utils))
;; Message parsing
@@ -26,7 +27,7 @@
(defn get-recips [content]
(filter
boolean
- (for [at-nick (re-seq recip-regex content)]
+ (for [at-nick (set (re-seq recip-regex content))]
(fetch-nick (.substring (.trim at-nick) 1)))))
(defn get-recips-from-msgs [msgs]
@@ -37,3 +38,10 @@
boolean
(for [r recips]
(fetch-nick (.substring (.trim r) 1))))))
+
+(def topic-regex #"(?:^|\s)#\w+")
+
+(defn get-topics [content]
+ (set
+ (for [r (re-seq topic-regex content)]
+ (lower-case (.substring r 1)))))