1 USING: help.markup help.syntax quotations kernel irc.messages ;
4 HELP: irc-client "IRC Client object" ;
6 HELP: irc-server-listener "Listener for server messages unmanaged by other listeners" ;
8 HELP: irc-channel-listener "Listener for irc channels" ;
10 HELP: irc-nick-listener "Listener for irc users" ;
12 HELP: irc-profile "IRC Client profile object" ;
14 HELP: connect-irc "Connecting to an irc server"
15 { $values { "irc-client" "an irc client object" } }
16 { $description "Connects and logins " { $link irc-client } " using the settings specified on its " { $link irc-profile } "." } ;
18 HELP: add-listener "Listening to irc channels/users/etc"
19 { $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } }
20 { $description "Registers " { $snippet "irc-listener" } " with " { $snippet "irc-client" } " and starts listening." } ;
22 HELP: join-irc-channel "Joining channels"
23 { $values { "irc-client-listener" "an irc client listener object" } }
24 { $description "Joins to the channel being listened by " { $snippet "irc-listener" } "." } ;
26 HELP: remove-listener "Stop an unregister listener"
27 { $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } }
28 { $description "Unregisters " { $snippet "irc-listener" } " from " { $snippet "irc-client" } " and stops listening. This is how you part from a channel." } ;
30 HELP: terminate-irc "Terminates an irc client"
31 { $values { "irc-client" "an irc client object" } }
32 { $description "Terminates all activity by " { $link irc-client } " cleaning up resources and notifying listeners." } ;
34 HELP: write-message "Sends a message through a listener"
35 { $values { "message" "a string or irc message object" } { "irc-listener" "an irc listener object" } }
36 { $description "Sends " { $snippet "message" } " through " { $snippet "irc-listener" } ". Strings are automatically promoted to privmsg objects." } ;
38 HELP: read-message "Reads a message from a listener"
39 { $values { "irc-listener" "an irc listener object" } { "message" "an irc message object" } }
40 { $description "Reads " { $snippet "message" } " from " { $snippet "irc-listener" } "." } ;
42 ARTICLE: "irc.client" "IRC Client"
43 "An IRC Client library"
44 { $heading "IRC objects:" }
45 { $subsection irc-client }
46 { $heading "Listener objects:" }
47 { $subsection irc-server-listener }
48 { $subsection irc-channel-listener }
49 { $subsection irc-nick-listener }
50 { $heading "Setup objects:" }
51 { $subsection irc-profile }
53 { $subsection connect-irc }
54 { $subsection terminate-irc }
55 { $subsection add-listener }
56 { $subsection remove-listener }
57 { $subsection join-irc-channel }
58 { $subsection read-message }
59 { $subsection write-message }
60 { $heading "IRC messages" }
61 "Some of the RFC defined irc messages as objects:"
63 { { $link irc-message } "base of all irc messages" }
64 { { $link logged-in } "logged in to server" }
65 { { $link ping } "ping message" }
66 { { $link join } "channel join" }
67 { { $link part } "channel part" }
68 { { $link quit } "quit from irc" }
69 { { $link privmsg } "private message (to client or channel)" }
70 { { $link kick } "kick from channel" }
71 { { $link roomlist } "list of participants in channel" }
72 { { $link nick-in-use } "chosen nick is in use by another client" }
73 { { $link notice } "notice message" }
74 { { $link mode } "mode change" }
75 { { $link unhandled } "uninmplemented/unhandled message" }
77 { $heading "Special messages" }
78 "Some special messages that are created by the library and not by the irc server."
80 { { $link irc-listener-end } "sent to a listener when it has been dettached from the client, the listener should stop after it receives this message. " }
81 { { $link irc-end } " sent when the client isn't running anymore, listeners should stop after it receives this message." }
82 { { $link irc-disconnected } " sent to notify listeners that connection was lost." }
83 { { $link irc-connected } " sent to notify listeners that a connection with the irc server was established." } }
85 { $heading "Example:" }
90 "! Create the profile and client objects"
91 "\"irc.freenode.org\" irc-port \"mybot123\" f <irc-profile> <irc-client> bot set"
92 "! Connect to the server"
94 "! Create a channel listener"
95 "\"#mychannel123\" <irc-channel-listener> mychannel set"
96 "! Register and start listener (this joins the channel)"
97 "mychannel get bot get add-listener"
98 "! Join to the channel"
99 "mychannel get join-irc-channel"
100 "! Send a message to the channel"
101 "\"what's up?\" mychannel get write-message"
102 "! Read a message from the channel"
103 "mychannel get read-message"