1 USING: help.markup help.syntax quotations kernel irc.messages ;
4 HELP: irc-client "IRC Client object"
7 HELP: irc-server-listener "Listener for server messages unmanaged by other listeners"
10 HELP: irc-channel-listener "Listener for irc channels"
13 HELP: irc-nick-listener "Listener for irc users"
16 HELP: irc-profile "IRC Client profile object"
19 HELP: connect-irc "Connecting to an irc server"
20 { $values { "irc-client" "an irc client object" } }
21 { $description "Connects and logins " { $link irc-client } " using the settings specified on its " { $link irc-profile } "." } ;
23 HELP: add-listener "Listening to irc channels/users/etc"
24 { $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } }
25 { $description "Registers " { $snippet "irc-listener" } " with " { $snippet "irc-client" } " and starts listening." } ;
27 HELP: remove-listener "Stop an unregister listener"
28 { $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } }
29 { $description "Unregisters " { $snippet "irc-listener" } " from " { $snippet "irc-client" } " and stops listening. This is how you part from a channel." } ;
31 HELP: terminate-irc "Terminates an irc client"
32 { $values { "irc-client" "an irc client object" } }
33 { $description "Terminates all activity by " { $link irc-client } " cleaning up resources and notifying listeners." } ;
35 HELP: write-message "Sends a message through a listener"
36 { $values { "message" "a string or irc message object" } { "irc-listener" "an irc listener object" } }
37 { $description "Sends " { $snippet "message" } " through " { $snippet "irc-listener" } ". Strings are automatically promoted to privmsg objects." } ;
39 HELP: read-message "Reads a message from a listener"
40 { $values { "irc-listener" "an irc listener object" } { "message" "an irc message object" } }
41 { $description "Reads " { $snippet "message" } " from " { $snippet "irc-listener" } "." } ;
43 ARTICLE: "irc.client" "IRC Client"
44 "An IRC Client library"
45 { $heading "IRC objects:" }
46 { $subsection irc-client }
47 { $heading "Listener objects:" }
48 { $subsection irc-server-listener }
49 { $subsection irc-channel-listener }
50 { $subsection irc-nick-listener }
51 { $heading "Setup objects:" }
52 { $subsection irc-profile }
54 { $subsection connect-irc }
55 { $subsection terminate-irc }
56 { $subsection add-listener }
57 { $subsection remove-listener }
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-end } " sent when the client isn't running anymore, listeners should stop after this." }
81 { { $link irc-disconnected } " sent to notify listeners that connection was lost." }
82 { { $link irc-connected } " sent to notify listeners that a connection with the irc server was established." } }
84 { $heading "Example:" }
86 "USING: irc.client concurrency.mailboxes ;"
89 "! Create the profile and client objects"
90 "\"irc.freenode.org\" irc-port \"mybot123\" f <irc-profile> <irc-client> bot set"
91 "! Connect to the server"
93 "! Create a channel listener"
94 "\"#mychannel123\" <irc-channel-listener> mychannel set"
95 "! Register and start listener (this joins the channel)"
96 "mychannel get bot get add-listener"
97 "! Send a message to the channel"
98 "\"what's up?\" mychannel get write-message"
99 "! Read a message from the channel"
100 "mychannel get read-message"