Browse files

Merge pull request #92 from hyPiRion/get-seen-case-insensitive

Get seen case insensitive
  • Loading branch information...
2 parents 1d0a2f5 + ee3cc26 commit 6c592a3bf789b8dbec5551a1d6e62f4ca8a90dbe @Raynes committed Aug 26, 2013
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/lazybot/plugins/seen.clj
@@ -1,7 +1,7 @@
(ns lazybot.plugins.seen
(:use [lazybot registry info]
[lazybot.utilities :only [format-time]]
- [somnium.congomongo :only [fetch fetch-one insert! destroy!]]
+ [somnium.congomongo :only [fetch fetch-one insert! destroy!]]
[clojure.string :only [join]]))
(defn now []
@@ -11,21 +11,23 @@
"Takes a nick and updates the seen database with that nick and the current time."
[nick server channel doing]
(let [lower-nick (.toLowerCase nick)]
- (destroy! :seen {:nick nick :server server})
+ (destroy! :seen {:nick lower-nick :server server})
(insert! :seen
{:server server
:time (now)
:chan channel
:doing doing
- :nick nick})))
+ :nick lower-nick})))
(defn get-seen
"Gets the last-seen for a nick."
[nick server]
- (when-let [seen-map (fetch-one :seen :where {:nick nick :server server})]
+ (when-let [seen-map (fetch-one :seen :where {:nick (.toLowerCase nick)
+ :server server})]
(update-in seen-map [:time] #(- (now) %))))
-(defn put-seen [{:keys [nick channel com]} doing] (tack-time nick (:server @com) channel doing))
+(defn put-seen [{:keys [nick channel com]} doing]
+ (tack-time nick (:server @com) channel doing))
(:hook :on-message

0 comments on commit 6c592a3

Please sign in to comment.