2008-07-09 21:48:17 -04:00
USING: help.markup help.syntax quotations kernel irc.messages ;
2008-06-09 19:40:54 -04:00
IN: irc.client
2008-09-30 02:11:54 -04:00
HELP: irc-client "IRC Client object" ;
2008-06-09 19:40:54 -04:00
2008-09-30 02:11:54 -04:00
HELP: irc-server-listener "Listener for server messages unmanaged by other listeners" ;
2008-06-09 19:40:54 -04:00
2008-09-30 02:11:54 -04:00
HELP: irc-channel-listener "Listener for irc channels" ;
2008-06-09 19:40:54 -04:00
2008-09-30 02:11:54 -04:00
HELP: irc-nick-listener "Listener for irc users" ;
2008-06-09 19:40:54 -04:00
2008-09-30 02:11:54 -04:00
HELP: irc-profile "IRC Client profile object" ;
2008-06-09 19:40:54 -04:00
HELP: connect-irc "Connecting to an irc server"
{ $values { "irc-client" "an irc client object" } }
{ $description "Connects and logins " { $link irc-client } " using the settings specified on its " { $link irc-profile } "." } ;
HELP: add-listener "Listening to irc channels/users/etc"
2008-07-08 15:57:53 -04:00
{ $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } }
2008-06-09 19:40:54 -04:00
{ $description "Registers " { $snippet "irc-listener" } " with " { $snippet "irc-client" } " and starts listening." } ;
2008-09-30 02:11:54 -04:00
HELP: join-irc-channel "Joining channels"
{ $values { "irc-client-listener" "an irc client listener object" } }
{ $description "Joins to the channel being listened by " { $snippet "irc-listener" } "." } ;
2008-07-08 15:57:53 -04:00
HELP: remove-listener "Stop an unregister listener"
{ $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } }
{ $description "Unregisters " { $snippet "irc-listener" } " from " { $snippet "irc-client" } " and stops listening. This is how you part from a channel." } ;
2008-06-09 19:40:54 -04:00
HELP: terminate-irc "Terminates an irc client"
{ $values { "irc-client" "an irc client object" } }
{ $description "Terminates all activity by " { $link irc-client } " cleaning up resources and notifying listeners." } ;
2008-07-08 15:57:53 -04:00
HELP: write-message "Sends a message through a listener"
{ $values { "message" "a string or irc message object" } { "irc-listener" "an irc listener object" } }
{ $description "Sends " { $snippet "message" } " through " { $snippet "irc-listener" } ". Strings are automatically promoted to privmsg objects." } ;
HELP: read-message "Reads a message from a listener"
{ $values { "irc-listener" "an irc listener object" } { "message" "an irc message object" } }
{ $description "Reads " { $snippet "message" } " from " { $snippet "irc-listener" } "." } ;
2008-06-09 19:40:54 -04:00
ARTICLE: "irc.client" "IRC Client"
"An IRC Client library"
{ $heading "IRC objects:" }
{ $subsection irc-client }
{ $heading "Listener objects:" }
{ $subsection irc-server-listener }
{ $subsection irc-channel-listener }
{ $subsection irc-nick-listener }
{ $heading "Setup objects:" }
{ $subsection irc-profile }
{ $heading "Words:" }
{ $subsection connect-irc }
{ $subsection terminate-irc }
{ $subsection add-listener }
2008-07-08 15:57:53 -04:00
{ $subsection remove-listener }
2008-09-30 02:11:54 -04:00
{ $subsection join-irc-channel }
2008-07-08 15:57:53 -04:00
{ $subsection read-message }
{ $subsection write-message }
2008-06-09 19:40:54 -04:00
{ $heading "IRC messages" }
"Some of the RFC defined irc messages as objects:"
{ $table
{ { $link irc-message } "base of all irc messages" }
{ { $link logged-in } "logged in to server" }
{ { $link ping } "ping message" }
{ { $link join } "channel join" }
{ { $link part } "channel part" }
{ { $link quit } "quit from irc" }
{ { $link privmsg } "private message (to client or channel)" }
{ { $link kick } "kick from channel" }
{ { $link roomlist } "list of participants in channel" }
{ { $link nick-in-use } "chosen nick is in use by another client" }
{ { $link notice } "notice message" }
{ { $link mode } "mode change" }
{ { $link unhandled } "uninmplemented/unhandled message" }
}
{ $heading "Special messages" }
"Some special messages that are created by the library and not by the irc server."
{ $table
2008-09-30 02:11:54 -04:00
{ { $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. " }
{ { $link irc-end } " sent when the client isn't running anymore, listeners should stop after it receives this message." }
2008-06-09 19:40:54 -04:00
{ { $link irc-disconnected } " sent to notify listeners that connection was lost." }
{ { $link irc-connected } " sent to notify listeners that a connection with the irc server was established." } }
{ $heading "Example:" }
{ $code
2008-09-30 02:11:54 -04:00
"USING: irc.client ;"
2008-06-09 19:40:54 -04:00
"SYMBOL: bot"
"SYMBOL: mychannel"
"! Create the profile and client objects"
"\"irc.freenode.org\" irc-port \"mybot123\" f <irc-profile> <irc-client> bot set"
"! Connect to the server"
"bot get connect-irc"
"! Create a channel listener"
"\"#mychannel123\" <irc-channel-listener> mychannel set"
"! Register and start listener (this joins the channel)"
2008-07-08 15:57:53 -04:00
"mychannel get bot get add-listener"
2008-09-30 02:11:54 -04:00
"! Join to the channel"
"mychannel get join-irc-channel"
2008-06-09 19:40:54 -04:00
"! Send a message to the channel"
2008-07-08 15:57:53 -04:00
"\"what's up?\" mychannel get write-message"
2008-06-09 19:40:54 -04:00
"! Read a message from the channel"
2008-07-08 15:57:53 -04:00
"mychannel get read-message"
2008-06-09 19:40:54 -04:00
}
;
ABOUT: "irc.client"