diff options
| author | Scott Ostler <sbsotler@gmail.com> | 2010-11-29 01:15:49 -0500 |
|---|---|---|
| committer | Scott Ostler <sbsotler@gmail.com> | 2010-11-29 01:15:49 -0500 |
| commit | dd46cb29fa939546908db15fc92491bc49f3130f (patch) | |
| tree | 50b8f74086728540cbc49249d4b98aacb9040d12 /src/utils.clj | |
| parent | d82ee6e32595edef8b7c5782f72eacac24d8a0c2 (diff) | |
Commit initial vip-only direct messaging
Diffstat (limited to 'src/utils.clj')
| -rwxr-xr-x | src/utils.clj | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/utils.clj b/src/utils.clj index 84454cd..8aaffba 100755 --- a/src/utils.clj +++ b/src/utils.clj @@ -36,26 +36,6 @@ (.setMaxConnections 10))})) -;; Message parsing - -;; http://snippets.dzone.com/posts/show/6995 -(def url-regex #"(?i)^((http\:\/\/|https\:\/\/|ftp\:\/\/)|(www\.))+(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$") -(def pic-regex #"(?i)\.(jpg|jpeg|png|gif|bmp|svg)(\?|&|$)") - -(defn is-image? [word] - (and (re-find url-regex word) - (re-find pic-regex word))) - -(defn take-images [content] - (filter is-image? (.split content " "))) - -(defn classify-msg [msg] - (let [words (.split msg " ") - imgs (map is-image? words)] - (cond (every? boolean imgs) :image - (some boolean imgs) :mixed - :else :text))) - ;; Misc (defn except! [& more] @@ -415,9 +395,6 @@ (defn serve-template [template session] (.toString (fetch-template template session))) -(defn first-or-nil [l] - (if (empty? l) nil (first l))) - ;; VIP (defn is-vip? [session] |
