Permalink
Browse files

Added new IRC functions and an autodoc dep.

  • Loading branch information...
1 parent 474e6a8 commit 45e5b4c8a62a4aacba118415392f1145ac0737c5 @Raynes committed Apr 16, 2010
Showing with 16 additions and 2 deletions.
  1. +1 −0 project.clj
  2. +15 −2 src/irclj/irclj.clj
View
1 project.clj
@@ -4,5 +4,6 @@
[org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]]
:dev-dependencies [[swank-clojure "1.1.0"]
[leiningen/lein-swank "1.1.0"]
+ [autodoc "0.7.0"]
[lein-search "0.3.0-SNAPSHOT"]
[lein-clojars "0.5.0"]])
View
17 src/irclj/irclj.clj
@@ -64,6 +64,16 @@
[irc channel mode nick]
(send-msg "MODE" irc channel (str mode " " nick)))
+(defn set-topic
+ "Sets the topic for a channel."
+ [irc channel topic]
+ (send-msg "TOPIC" irc channel (str ":" topic)))
+
+(defn kick
+ "Kicks a user from a channel."
+ [irc channel nick reason]
+ (send-msg "KICK" irc channel (str nick " :" reason)))
+
(defn- extract-message [s]
(apply str (rest (join " " s))))
@@ -131,16 +141,19 @@
(.close sockin)
(.close sockout)))
-(defn get-irc-line
+(defn- get-irc-line
+ "Reads a line from IRC. Returns the string 'Socket Closed.' if the socket provided is closed."
[sockin]
(try (.readLine sockin)
(catch java.net.SocketException _ "Socket Closed.")))
-(defn strip-start
+(defn- strip-start
+ "Strips everything away until the message."
[s]
(second (.split s ":")))
(defn get-names
+ "Gets a list of the users in a channel. Includes modes."
[irc channel]
(send-msg "NAMES" irc "" channel)
(loop [acc []]

0 comments on commit 45e5b4c

Please sign in to comment.