.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::Hotline::Client 3pm" .TH Net::Hotline::Client 3pm "2021-01-09" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::Hotline::Client \- Perl library for the Hotline internet client .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Net::Hotline::Client; \& \& $hlc = new Net::Hotline::Client; \& $hlc\->connect("127.0.0.1") \& \& $hlc\->chat_handler(\e&Chat_Handler); \& $hlc\->msg_handler(\e&Msg_Handler); \& \& $hlc\->login(Login => "Steve", \& Password => "xyzzy", \& Nickname => "Jobs", \& Icon => 128); \& \& $hlc\->run(); \& ... .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Net::Hotline::Client is a class implementing a Hotline internet client in Perl. It was specifically developed to aid in the creation of Hotline \&\*(L"bots,\*(R" although it's suitable for most other tasks as well. Hotline is an internet client/server system that's sort of a cross between \s-1IRC\s0 and a \s-1BBS.\s0 See http://www.hotlinesw.com/ for more information. .PP This document assumes you have some knowledge of the Hotline client. If not, I suggest downloading it from the \s-1URL\s0 above. (It's shareware. Mac and \&\s-1PC\s0 versions are available) .SH "CAVEATS" .IX Header "CAVEATS" The Hotline protocol is not public. (An \s-1RFC\s0? I wish!) This module got its start with the aid of the C source code from the Unix \*(L"hx\*(R" Hotline client written by Ryan Nielsen, the beginnings of a Java Hotline bot written by Gary Wong, and many hours spent staring at hexdumps of network data. Some features are still not implemented, the most notable being user administration capabilities. Finally, I'm sure all hell will break loose with the next major revision of Hotline. Such is life. .SH "GETTING STARTED" .IX Header "GETTING STARTED" Before delving into the nitty-gritty details, it's important to understand the philosophy behind design of this module. If you do not read this section first, you will probably be confused by the rest of the documentation. Take the time now and save yourself headaches later. .PP Hotline is an event-driven protocol. A Hotline client receives packets each time something interesting occurs on the server\*(--a new user joins, someone says something in chat, someone goes idle, etc. The client receives these packets whether it's ready for them or not. This type of interaction lends itself to an event\-loop/callback\-routine design, which is how this module was originally implemented. Handler routines are set for the events you're interested in, and then the event loop is started. .PP In this model, client actions are also treated as events. To retrieve the news, for example, the client calls a function that sends a news request to the server and returns a task \s-1ID\s0 number. The client then returns to the event loop and watches the incoming packet stream for a packet with the same task \s-1ID\s0 (it will be either a packet containing the news or a task error packet). In the time between when the news request was sent and the response is received from the server, many other unrelated events can (and probably will) occur. .PP This system works great for things like bots that want to deal with events in a non-linear fashion, but what about when you want to do things in a more deterministic manner? For example, imagine trying to implement a command line FTP-like Hotline client using the event loop model. Sure, it's possible, but it's not pretty! I found this out the hard way. What's needed are what I'm going to call \*(L"blocking tasks.\*(R" That is, function calls that don't return until their work is done. In this new model, the news request function would not merely return a task \s-1ID\s0 number, it would return the news itself (or an error, of course). .PP To accomplish this, the \*(L"blocking task\*(R" version of the news retrieval function has to do everything that you'd do in the event loop model: send a request for the news and watch the incoming packet stream for the task results. There's no magic here. Of course, the question of what to do with those \*(L"unrelated\*(R" packets presents itself. They can't just be ignored because they may be telling the client something important like \*(L"you've just been disconnected.\*(R" On the other hand, allowing them to invoke handler routines might spin us off into another section of the code indefinitely. .PP The solution I came up with is to let the user decide. All unrelated events that occur during blocking tasks are subject to the bare minimum processing needed to keep the internal state of the client object consistent (tracking joining and leaving users, disconnect messages, etc.). Going further, handler routines can indeed be called. The behavior is controlled by the client object's attributes. .PP These two modes of operation are called \*(L"event loop mode\*(R" and \*(L"blocking task mode\*(R" in the rest of the documentation. It's important to decide which model suits your particular needs before starting your Hotline client code. Blindly mixing and matching these techniques will get you nowhere fast. Now, on to the good stuff... .SH "METHODS" .IX Header "METHODS" .SS "\s-1CONNECTING\s0" .IX Subsection "CONNECTING" .IP "connect \s-1ADDRESS\s0" 4 .IX Item "connect ADDRESS" Opens a network connection to \s-1ADDRESS,\s0 which can be an \s-1IP\s0 address or hostname optionally followed by a space or a colon and a port number. If no port is given, it defaults to 5500 (Hotline standard port) .Sp Examples: .Sp .Vb 2 \& $hlc\->connect("127.0.0.1:1234"); \& $hlc\->connect("hostname.com 5678"); .Ve .Sp Returns 1 if successful, undef otherwise. .IP "disconnect" 4 .IX Item "disconnect" Closes the network connection. Returns 1 if a connection was closed, undef if the connection wasn't open to begin with. .IP "login \s-1PARAMETERS\s0" 4 .IX Item "login PARAMETERS" Logs into a Hotline server opened via \f(CW\*(C`connect()\*(C'\fR, and requests the news and the userlist (unless overridden by the \*(L"NoNews\*(R" and \*(L"NoUserList\*(R" parameters). Arguments are in a \*(L"named parameter\*(R" format, and are case-sensitive. The parameters are: .Sp .Vb 6 \& Nickname Your nickname (default: guest) \& Login Your account name (default: guest) \& Password Your account password (default: ) \& Icon Your icon number (default: 410, the big red "H") \& NoNews If true, do not request the news. \& NoUserList If true, do not request the userlist. .Ve .Sp Example of use: .Sp .Vb 5 \& $hlc\->login(Login => "Steve", \& Password => "xyzzy", \& Nickname => "Jobs", \& Icon => 128, \& NoNews => 1); .Ve .Sp If omitted, all parameters except Password will default to some sane (if not necessarily \*(L"sensible\*(R") value. The news and userlist will be requested unless NoNews and/or NoUserList are explicitly set by the user. Keep in mind that client functions like the tracking of connected users will not work properly without the userlist. .Sp In blocking task mode, \fBlogin()\fR returns 1 on success, undef if an error occurred, and \*(L"zero but true\*(R" (\*(L"0E\-0\*(R") if the login was successful, but the news and/or userlist retrieval failed. .Sp In event loop mode, \fBlogin()\fR returns the task number if the login request was sent successfully, undef otherwise. .IP "run" 4 .IX Item "run" Starts the event loop. Returns when the connection has to the server has been closed. .SS "\s-1SETTINGS\s0" .IX Subsection "SETTINGS" .IP "blocking \s-1EXPR\s0" 4 .IX Item "blocking EXPR" Turns blocking network i/o on or off depending on how \s-1EXPR\s0 evaluates (true turns blocking i/o on). Returns the current setting. Blocking i/o is on by default. In this mode, the event loop will cycle each time data of any kind comes from the server. This means that your hotline client may spend a lot of its time blocked (and therefore unable to do anything interesting) waiting for something to happen on the server. Using non-blocking i/o will cycle through the event loop more frequently (see \f(CW\*(C`event_timing()\*(C'\fR below) regardless of server activity. .IP "blocking_tasks \s-1EXPR\s0" 4 .IX Item "blocking_tasks EXPR" With no arguments, returns the blocking task status. With one argument, blocking tasks will be turned on or off depending on how \s-1EXPR\s0 evaluates (true means blocking task mode is active). Blocking tasks are off by default. .IP "clear_error" 4 .IX Item "clear_error" Clears the error message text available via \f(CW\*(C`last_error()\*(C'\fR. \&\f(CW\*(C`last_error()\*(C'\fR is not cleared by the client object, so you may need to explicitly clear it before running a blocking task to prevent it from containing an old, unrelated error message if the blocking task somehow failed without setting \f(CW\*(C`last_error()\*(C'\fR. (This should not happen, but you never know...) .IP "connect_timeout \s-1SECS\s0" 4 .IX Item "connect_timeout SECS" Sets the connection timeout to \s-1SECS\s0 seconds (if present). Returns the current connection timeout. .IP "data_fork_extension \s-1TEXT\s0" 4 .IX Item "data_fork_extension TEXT" Sets the data fork filename extension for downloads to \s-1TEXT\s0 (if present). Returns the current data fork filename extension. The default setting is \*(L".data\*(R" .IP "downloads_dir \s-1PATH\s0" 4 .IX Item "downloads_dir PATH" Sets the directory where downloaded files are placed to \s-1PATH\s0 (if present). Returns the current setting. .IP "event_timing \s-1SECS\s0" 4 .IX Item "event_timing SECS" Sets the event loop timing to \s-1SECS\s0 seconds (if present). Fractional seconds are allowed. The default setting is 1 second. This option only has an effect when non-blocking i/o is active (see \f(CW\*(C`blocking()\*(C'\fR). Returns the current event timing setting. .IP "handlers_during_blocking_tasks \s-1EXPR\s0" 4 .IX Item "handlers_during_blocking_tasks EXPR" Allows handlers to run during blocking tasks if \s-1EXPR\s0 is present and evaluates to true. Returns the current setting. The default setting is off. .IP "path_separator \s-1CHARACTER\s0" 4 .IX Item "path_separator CHARACTER" Sets the path separator to \s-1CHARACTER\s0 (if present). The default setting is the Mac \s-1OS\s0 path separator \*(L":\*(R". Returns the current value of the path separator. Note that this is the path separator used when sending commands to the server and has no bearing on what the path separator is on the local system. You should not need to change this, since all current Hotline servers use \*(L":\*(R" regardless of the platform they're running on. .IP "rsrc_fork_extension \s-1TEXT\s0" 4 .IX Item "rsrc_fork_extension TEXT" Sets the resource fork filename extension for downloads to \s-1TEXT\s0 (if present). Returns the current resource fork filename extension. The default setting is \*(L".rsrc\*(R" .IP "tracker \s-1ADDR\s0" 4 .IX Item "tracker ADDR" Sets the tracker address to \s-1ADDR\s0 (if present), where \s-1ADDR\s0 is an \s-1IP\s0 address or hostname, optionally followed by a colon and a port number. Returns the current tracker address. .IP "xfer_bufsize \s-1BYTES\s0" 4 .IX Item "xfer_bufsize BYTES" Sets the file transfer buffer size to \s-1BYTES.\s0 Returns the current buffer size. The default is 4096 bytes. .SS "\s-1COMMANDS\s0" .IX Subsection "COMMANDS" Unless otherwise specified, the methods in this section are treated as \*(L"tasks\*(R" by Hotline. Their status (start time, finish time, error state, etc.) is tracked internally by task number. In event mode, they return a task number if the request was sent successfully, and undef or an empty list if an error occurred. In blocking task mode, the return values vary. .PP Some commands (like \f(CW\*(C`chat()\*(C'\fR and \f(CW\*(C`pchat()\*(C'\fR, for example) are not treated as \&\*(L"tasks\*(R" by Hotline. They always return 1 on success, rather than a task number. The actual completion of a such commands can only be determined by examining the resulting data from the server. For example, if you \&\f(CW\*(C`chat("hello")\*(C'\fR, you can look for that line of chat in your chat handler. (This is rarely necessary since the failure of such a command usually means that you have much bigger problems.) .IP "ban \s-1USER\s0" 4 .IX Item "ban USER" .PD 0 .IP "ban \s-1SOCKET\s0" 4 .IX Item "ban SOCKET" .PD Bans the user specified by a Net::Hotline::User object or a user socket number. .Sp In blocking task mode, returns 1 on success or undef if an error occurred. In event loop mode, returns a task number if the request was sent successfully, or undef if an error occurred. .IP "chat \s-1LIST\s0" 4 .IX Item "chat LIST" Sends the text formed by the concatenation of \s-1LIST\s0 to the server as \*(L"chat.\*(R" Perl newlines (\*(L"\en\*(R") are translated to Net::Hotline::Constants::HTLC_NEWLINE, which is Hotline's native newline character. .Sp Not treated as a task: returns 1 on success, undef or an empty list on failure. .IP "chat_action \s-1LIST\s0" 4 .IX Item "chat_action LIST" Sends the text formed by the concatenation of \s-1LIST\s0 to the server as a \*(L"chat action.\*(R" Perl newlines (\*(L"\en\*(R") are translated to Net::Hotline::Constants::HTLC_NEWLINE, which is Hotline's native newline character. .Sp Not treated as a task: returns 1 on success, undef or an empty list on failure. .IP "comment \s-1PATH, TEXT\s0" 4 .IX Item "comment PATH, TEXT" Sets the comments for the file or folder located at \s-1PATH\s0 to \s-1TEXT.\s0 If \s-1TEXT\s0 is undef or an empty string, the comments for the file or folder will be removed. .Sp In blocking task mode, returns 1 on success or undef if an error occurred. In event loop mode, returns a task number if the request was sent successfully, or undef if an error occurred. .IP "delete_file \s-1PATH\s0" 4 .IX Item "delete_file PATH" Deletes the file or folder located at located at \s-1PATH.\s0 .Sp In blocking task mode, returns 1 on success or undef if an error occurred. In event loop mode, returns a task number if the request was sent successfully, or undef if an error occurred. .IP "get_file \s-1PATH\s0" 4 .IX Item "get_file PATH" Download the file on the server located at \s-1PATH\s0 to the local directory set via \f(CW\*(C`downloads_dir()\*(C'\fR. In Mac \s-1OS,\s0 file names longer than 31 characters are truncated, preserving the filename extension (i.e. \*(L".jpg\*(R") if possible. .Sp In blocking task mode, returns either an array (in array context) or a reference to an array (in scalar context) containing a Net::Hotline::Task object, a download reference number, and the size of the download on success, an undef or an empty list if an error occurred. Those return values are meant to be fed to \f(CW\*(C`recv_file()\*(C'\fR like this (error handling omitted): .Sp .Vb 1 \& ($task, $ref, $size) = $hlc\->get_file("Folder1:file.sit"); \& \& $hlc\->recv_file($task, $ref, $size); .Ve .Sp In event loop mode, returns a task number if the request was sent successfully, and undef or an empty list if an error occurred. .IP "get_file_resume \s-1PATH\s0" 4 .IX Item "get_file_resume PATH" Resume downloading the file on the server located at \s-1PATH\s0 to the local directory set via \f(CW\*(C`downloads_dir()\*(C'\fR. The partially downloaded file(s) must exist in the local download directory, and (on non-Mac \s-1OS\s0 systems) must have filename extensions matching the current settings of \&\f(CW\*(C`data_fork_extension()\*(C'\fR and \f(CW\*(C`rsrc_fork_extensions()\*(C'\fR. .Sp In blocking task mode, returns either an array (in array context) or a reference to an array (in scalar context) containing a Net::Hotline::Task object, a download reference number, and the size of the download on success, and undef or an empty list if an error occurred. Those return values are meant to be fed to \f(CW\*(C`recv_file()\*(C'\fR like this (error handling omitted): .Sp .Vb 1 \& ($task, $ref, $size) = $hlc\->get_file_resume("Folder1:file.sit"); \& \& $hlc\->recv_file($task, $ref, $size); .Ve .Sp In event loop mode, returns a task number if the request was sent successfully, and undef or an empty list if an error occurred. .IP "get_fileinfo \s-1PATH\s0" 4 .IX Item "get_fileinfo PATH" Returns a Net::Hotline::FileInfoItem object corresponding to the file specified by \s-1PATH,\s0 or undef if an error occurred. Should only be used in blocking task mode. .IP "get_filelist \s-1PATH\s0" 4 .IX Item "get_filelist PATH" Returns an array (in array context) or a reference to an array (in scalar context) of Net::Hotline::FileListItem objects corresponding to the contents of the server directory \s-1PATH,\s0 and the scalar value 0 if an error occurred (in order to distinguish between an empty directory and an error: an empty directory will return an empty list in array context and undef in scalar context). Should only be used in blocking task mode. .IP "get_news" 4 .IX Item "get_news" Get the news from the server. .Sp Returns an array containing the new posts (in array context) or the news as a string (in scalar context) on success, and undef if an error occurred. Note that successful retrieval of an empty news file will return an empty string ("") or an empty list. Should only be used in blocking task mode. .IP "get_userinfo \s-1SOCKET\s0" 4 .IX Item "get_userinfo SOCKET" Returns information about the user specified by \s-1SOCKET\s0 as a string, or undef if there was an error. Will not work unless the userlist has been retrieved from the server. Should only be used in blocking task mode. .IP "get_userlist" 4 .IX Item "get_userlist" Returns a reference to a hash keyed by socket number containing Net::Hotline::User objects for all users currently logged on. Should only be used in blocking task mode. .IP "icon \s-1ICON\s0" 4 .IX Item "icon ICON" Sets your icon in the userlist to \s-1ICON,\s0 where \s-1ICON\s0 is an icon \s-1ID\s0 number. .IP "kick \s-1USER\s0" 4 .IX Item "kick USER" .PD 0 .IP "kick \s-1SOCKET\s0" 4 .IX Item "kick SOCKET" .PD Disconnects the user specified by a Net::Hotline::User object or a user socket number. .Sp In blocking task mode, returns 1 on success or undef if an error occurred. In event loop mode, returns a task number if the request was sent successfully, or undef if an error occurred. .IP "macbinary \s-1MACBIN_FILE, DATA_FILE, DATA_LEN, RSRC_FILE, RSRC_LEN BUF_SIZE, TYPE, CREATOR, COMMENTS, CREATED, MODIFIED, FINDER_FLAGS\s0" 4 .IX Item "macbinary MACBIN_FILE, DATA_FILE, DATA_LEN, RSRC_FILE, RSRC_LEN BUF_SIZE, TYPE, CREATOR, COMMENTS, CREATED, MODIFIED, FINDER_FLAGS" Creates a MacBinary \s-1II\s0 file at the path designated by \s-1MACBIN_FILE\s0 based on the file paths and other information supplied as arguments (see the \&\f(CW\*(C`recv_file()\*(C'\fR method for a description of the other arguments). If \&\s-1MACBIN_FILE\s0 is undefined, it defaults to \s-1DATA_FILE\s0 with \*(L".bin\*(R" tacked onto the end. It returns 1 on success, and undef if \s-1MACBIN_FILE\s0 already exists or can't be created, if \s-1DATA_LEN\s0 is greater than zero and \s-1DATA_FILE\s0 can't be opened, or if \s-1RSRC_LEN\s0 is greater than zero and \s-1RSRC_FILE\s0 can't be opened. The error condition is available via both \f(CW\*(C`last_error()\*(C'\fR and $! because \fBmacbinary()\fR can be called as a method or as a function. Example: .Sp .Vb 5 \& # As a method \& unless($hlc\->macbinary(@args)) \& { \& die "macbinary: ", $hlc\->last_error(); \& } \& \& # As a function \& unless(macbinary(@args)) \& { \& die "macbinary: $!"; \& } .Ve .IP "move \s-1SRC, DEST\s0" 4 .IX Item "move SRC, DEST" Moves the file or folder located at the path \s-1SRC\s0 to the directory located at the path \s-1DEST.\s0 \s-1SRC\s0 should be the full path to the file or folder you want to move, and \s-1DEST\s0 should be the full path to the \fBdirectory\fR you want to move \s-1SRC\s0 too. The file or folder name should only appear in the \s-1SRC\s0 path, never in the \s-1DEST\s0 path. As a consequence, renaming files or folders must be done through \f(CW\*(C`rename()\*(C'\fR and cannot be rolled into a \f(CW\*(C`move()\*(C'\fR call. Here's an example of a valid call to \f(CW\*(C`move()\*(C'\fR: .Sp .Vb 1 \& $hlc\->move("Folder1:file1", "Folder2:"); .Ve .Sp This moves the \*(L"file1\*(R" from \*(L"Folder1\*(R" to \*(L"Folder2\*(R" .Sp In blocking task mode, returns 1 on success or undef if an error occurred. In event loop mode, returns a task number if the request was sent successfully, or undef if an error occurred. .IP "msg \s-1USER, LIST\s0" 4 .IX Item "msg USER, LIST" .PD 0 .IP "msg \s-1SOCKET, LIST\s0" 4 .IX Item "msg SOCKET, LIST" .PD Sends the text formed by the concatenation of \s-1LIST\s0 as a private message to the user specified by a Net::Hotline::User object or a user socket number. .Sp In blocking task mode, returns 1 on success or undef if an error occurred. In event loop mode, returns a task number if the request was sent successfully, or undef if an error occurred. .IP "new_folder \s-1PATH\s0" 4 .IX Item "new_folder PATH" Create a new folder located at \s-1PATH.\s0 .Sp In blocking task mode, returns 1 on success or undef if an error occurred. In event loop mode, returns a task number if the request was sent successfully, or undef if an error occurred. .IP "nick \s-1TEXT\s0" 4 .IX Item "nick TEXT" Sets your nickname in the userlist to \s-1TEXT.\s0 .IP "pchat \s-1REF, LIST\s0" 4 .IX Item "pchat REF, LIST" Sends the text formed by the concatenation of \s-1LIST\s0 to the private chat window specified by \s-1REF.\s0 Perl newlines (\*(L"\en\*(R") are translated to Net::Hotline::Constants::HTLC_NEWLINE, which is Hotline's native newline character. .Sp Not treated as a task: returns 1 on success, undef or an empty list on failure. .IP "pchat_action \s-1REF, LIST\s0" 4 .IX Item "pchat_action REF, LIST" Sends the text formed by the concatenation of \s-1LIST\s0 to the private chat window specified by \s-1REF\s0 as a \*(L"chat action\*(R". Perl newlines (\*(L"\en\*(R") are translated to Net::Hotline::Constants::HTLC_NEWLINE, which is Hotline's native newline character. .Sp Not treated as a task: returns 1 on success, undef or an empty list on failure. .IP "pchat_accept \s-1REF\s0" 4 .IX Item "pchat_accept REF" Accepts an invitaton to the private chat specified by \s-1REF.\s0 .Sp In blocking task mode, returns 1 on success. In event loop mode, returns a task number if the request was sent successfully. In both modes, it returns undef or an empty list if an error occurred. .IP "pchat_decline \s-1REF\s0" 4 .IX Item "pchat_decline REF" Declines an invitaton to the private chat specified by \s-1REF.\s0 .Sp Not treated as a task: returns 1 on success, undef or an empty list on failure. .IP "pchat_invite \s-1SOCKET, REF\s0" 4 .IX Item "pchat_invite SOCKET, REF" Invite the user specified by \s-1SOCKET\s0 to an existing private chat specified by \&\s-1REF,\s0 or create a new private chat if \s-1REF\s0 is not given. There is no \&\f(CW\*(C`pchat_create()\*(C'\fR command. To create a new private chat, you must invite someone. Call \f(CW\*(C`pchat_invite()\*(C'\fR with your own socket number and no \s-1REF\s0 argument to create a new private chat with only yourself in it (you will not have to explicitly accept this invitation). .Sp In blocking task mode, returns 1 on success, and undef or an empty list if an error occurred. .Sp In event mode, it returns a task number if it had to create a new private chat (i.e. if no \s-1REF\s0 argument was given) or 1 (if inviting to an existing private chat) on success, and undef or an empty list if an error occurred. .IP "pchat_leave \s-1REF\s0" 4 .IX Item "pchat_leave REF" Leave the private chat specified by \s-1REF.\s0 .Sp Not treated as a task: returns 1 on success, undef or an empty list on failure. .IP "pchat_subject \s-1REF, TEXT\s0" 4 .IX Item "pchat_subject REF, TEXT" Sets the subject of the private chat specified by \s-1REF\s0 to \s-1TEXT.\s0 .Sp Not treated as a task: returns 1 on success, undef or an empty list on failure. .IP "post_news \s-1LIST\s0" 4 .IX Item "post_news LIST" Sends the text formed by the concatenation of \s-1LIST\s0 to the server as a news post. .Sp In blocking task mode, returns 1 on success. In event loop mode, returns a task number if the request was sent successfully. In both modes, it returns undef or an empty list if an error occurred. .IP "put_file \s-1SRC_PATH, DEST_PATH, COMMENT\s0" 4 .IX Item "put_file SRC_PATH, DEST_PATH, COMMENT" Upload the file located at \s-1SRC_PATH\s0 to the server directory \s-1DEST_PATH,\s0 with the file comments \s-1COMMENT.\s0 \s-1SRC_PATH\s0 must be in the native path format of the local system (i.e. using \*(L":\*(R" as the path separator on Mac \s-1OS,\s0 and \*(L"/\*(R" on most other OSes). \s-1DEST_PATH\s0 must be in Hotline's native path format (\*(L":\*(R" as the path separator). If \s-1COMMENT\s0 is omitted, the actual Finder comments will be read from the file to be uploaded if running on Mac \s-1OS.\s0 Otherwise, the comments will be blank. \f(CW\*(C`put_file()\*(C'\fR tries to upload a new file. If you are resuming a file upload, you must call \&\f(CW\*(C`send_file_resume()\*(C'\fR instead. .Sp In blocking task mode, returns an array (in array context) or a reference to an array (in scalar context) containing a Net::Hotline::Task object, an upload reference number, and the size of the upload, and undef or an empty list if an error occurred. Those return values are meant to be fed to \&\f(CW\*(C`send_file()\*(C'\fR like this (error handling omitted): .Sp .Vb 3 \& ($task, $ref, $size) = $hlc\->put_file("/home/john/file.gz", \& "Folder1:Folder2" \& "A fun file!"); \& \& $hlc\->send_file($task, $ref, $size); .Ve .Sp In event loop mode, returns a task number if the request was sent successfully, and undef or an empty list if an error occurred. .IP "put_file_resume \s-1SRC_PATH, DEST_PATH, COMMENT\s0" 4 .IX Item "put_file_resume SRC_PATH, DEST_PATH, COMMENT" Resume uploading the file located at \s-1SRC_PATH\s0 to the server directory \&\s-1DEST_PATH,\s0 with the file comments \s-1COMMENT.\s0 \s-1SRC_PATH\s0 must be in the native path format of the local system (i.e. using \*(L":\*(R" as the path separator on Mac \s-1OS,\s0 and \*(L"/\*(R" on most other OSes). \s-1DEST_PATH\s0 must be in Hotline's native path format (\*(L":\*(R" as the path separator). If \s-1COMMENT\s0 is omitted, the actual Finder comments will be read from the file to be uploaded if running on Mac \&\s-1OS.\s0 Otherwise, the comments will be blank. Use \f(CW\*(C`put_file()\*(C'\fR to upload a new file. .Sp In blocking task mode, returns an array (in array context) or a reference to an array (in scalar context) containing a Net::Hotline::Task object, an upload reference number, the size of the upload, and additional information needed to resume the upload, and undef or an empty list if an error occurred. Those return values are meant to be fed to \f(CW\*(C`send_file()\*(C'\fR like this (error handling omitted): .Sp .Vb 4 \& ($task, $ref, $size, $rflt) = \& $hlc\->put_file_resume("/home/john/file.gz", \& "Folder1:Folder2" \& "A fun file!"); \& \& $hlc\->send_file($task, $ref, $size, $rflt); .Ve .Sp In event loop mode, returns a task number if the request was sent successfully, and undef or an empty list if an error occurred. .IP "recv_file \s-1TASK, REF, SIZE\s0" 4 .IX Item "recv_file TASK, REF, SIZE" Starts receiving the file designated by the Net::Hotline::Task object \s-1TASK,\s0 the download reference number \s-1REF,\s0 and the size in bytes \s-1SIZE\s0 returned by \&\f(CW\*(C`get_file()\*(C'\fR (in blocking task mode) or supplied to the \f(CW\*(C`get_file()\*(C'\fR handler routine (in event loop mode). When the download is complete, \&\f(CW\*(C`recv_file()\*(C'\fR returns a reference to an array containing the following values: .Sp .Vb 11 \& DATA_FILE Path to the file containing the data fork. \& DATA_LEN Length of the data fork. \& RSRC_FILE Path to the file containing the Mac resource fork. \& RSRC_LEN Length of the resource fork. \& BUFSIZE Buffer size that was used during the download. \& TYPE Four\-letter Mac file type code. \& CREATOR Four\-letter Mac file creator code. \& COMMENTS Mac Finder comments. \& CREATED Date created (in Mac time format) \& MODIFIED Date modified (in Mac time format) \& FINDER_FLAGS Mac finder flags packed in two bytes. .Ve .Sp which are typically fed to the \f(CW\*(C`macbinary()\*(C'\fR method to create a single MacBinary \s-1II\s0 file from the separate resource fork and data fork files. (On Mac \s-1OS\s0 systems, a single Mac OS-native two-forked file is created, so there's no need to call \f(CW\*(C`macbinary()\*(C'\fR) Here's an example of typical usage (error checking omitted): .Sp .Vb 6 \& # Event loop mode: \& # (Inside your get_file() handler subroutine) \& ... \& $ret = $hlc\->recv_file($task, $ref, $size); \& $hlc\->macbinary(undef, $ret); \& ... .Ve .Sp or .Sp .Vb 6 \& # Blocking task mode: \& ... \& ($task, $ref, $size) = $hlc\->get_file($path); \& $ret = $hlc\->recv_file($task, $ref, $size); \& $hlc\->macbinary(undef, $ret) \& ... .Ve .Sp See \f(CW\*(C`macbinary()\*(C'\fR for more details on its usage. If either the data fork or resource fork is empty, the fork length returned by \f(CW\*(C`recv_file()\*(C'\fR will be zero and the file path returned will be undef. .IP "rename \s-1PATH, NAME\s0" 4 .IX Item "rename PATH, NAME" Renames the file or folder located at \s-1PATH\s0 to \s-1NAME.\s0 Note that \s-1PATH\s0 is the full path to the target, but \s-1NAME\s0 is just the new name without any path specification. Example: .Sp .Vb 1 \& $hlc\->rename("Pets:cat", "dog"); .Ve .Sp This changes the name of the file \*(L"cat\*(R" in the folder \*(L"Pets\*(R" to \*(L"dog\*(R" .Sp In blocking task mode, returns 1 on success or undef if an error occurred. In event loop mode, returns a task number if the request was sent successfully, or undef if an error occurred. .IP "send_file \s-1TASK, REF, SIZE, RFLT\s0" 4 .IX Item "send_file TASK, REF, SIZE, RFLT" Starts sending the file designated by the Net::Hotline::Task object \s-1TASK,\s0 the upload reference number \s-1REF,\s0 the size in bytes \s-1SIZE,\s0 and the resume information \s-1RFLT\s0 returned by \f(CW\*(C`put_file()\*(C'\fR (in blocking task mode) or supplied to the \f(CW\*(C`put_file()\*(C'\fR handler routine (in event loop mode). Returns 1 if the upload completed successfully, or undef if there was an error. .IP "tracker_list \s-1TIMEOUT\s0" 4 .IX Item "tracker_list TIMEOUT" Connects to the server set via the \f(CW\*(C`tracker()\*(C'\fR method and retrieves the list of servers tracked by that tracker. Returns an array (in array context) or a reference to an array (in scalar context) of Net::Hotline::TrackerListItem objects on success, and undef or an empty list on failure, with the error condition available via \f(CW\*(C`last_error()\*(C'\fR. .Sp The initial connection to the tracker will timeout after \s-1TIMEOUT\s0 seconds, or the current value set via \f(CW\*(C`connection_timeout()\*(C'\fR if \s-1TIMEOUT\s0 is omitted. A \s-1TIMEOUT\s0 value of zero will disable the timeout. .Sp Note that this method does not return until it has retrieved the list of tracked servers, and that the timeout applies \fBonly\fR to the initial connection to the tracker. It is often the case with overloaded trackers that this method will hang when writing to or reading from the tracker (regardless of the timeout value), many times resulting in a \f(CW\*(C`die\*(C'\fR with a broken pipe error in one of the network I/O functions. To avoid this, either try a more responsive tracker and/or wrap your \f(CW\*(C`tracker_list()\*(C'\fR call in an \f(CW\*(C`eval\*(C'\fR block and check \f(CW$@\fR. .SS "\s-1REQUESTS\s0" .IX Subsection "REQUESTS" All the methods in this section are treated as \*(L"tasks\*(R" by Hotline. Their status (start time, finish time, error state, etc.) is tracked internally by task number. They return a task number if the request was sent successfully, undef otherwise. .PP When a tasks completes, the data is stored in the appropriate Net::Hotline::Client attribute. For example, when a \f(CW\*(C`req_news()\*(C'\fR task completes, the data is available via the \fBnews()\fR method. .IP "req_filelist \s-1PATH\s0" 4 .IX Item "req_filelist PATH" Requests the file listing for the folder specified by \s-1PATH,\s0 or the root directory if \s-1PATH\s0 is omitted. .IP "req_fileinfo \s-1PATH\s0" 4 .IX Item "req_fileinfo PATH" Requests the file information for the file or folder specified by \s-1PATH.\s0 .IP "req_news" 4 .IX Item "req_news" Requests the news from the server. .IP "req_userinfo \s-1SOCKET\s0" 4 .IX Item "req_userinfo SOCKET" Requests user information for the user specified by \s-1SOCKET.\s0 .IP "req_userlist" 4 .IX Item "req_userlist" Request the list of users currently logged on. .SS "\s-1ATTRIBUTES\s0" .IX Subsection "ATTRIBUTES" The methods in this section return data or references to data structures in the Net::Hotline::Client object. Some data structures contain references to objects. For details on those objects, see their respective documentation (i.e. perldoc Net::Hotline::User) .IP "agreement" 4 .IX Item "agreement" Returns a reference to the server's user agreement text, or undef if there is none. .IP "connected" 4 .IX Item "connected" Returns true if a network connection to a server is open. .IP "files" 4 .IX Item "files" Returns a reference to a hash of arrays containing Net::Hotline::FileListItem objects, keyed by directory path. Here's some sample code that prints the entire file tree: .Sp .Vb 1 \& $files = $hlc\->files(); # Get reference to the file tree \& \& foreach $directory (keys(%{$files})) \& { \& print "$directory\en"; # Ex: "Uploads:Pictures" \& \& foreach $file (@{$files\->{$directory}}) \& { \& print "\et", $file\->name(), "\en"; # Ex: "Picture.jpg" \& } \& } .Ve .IP "last_activity" 4 .IX Item "last_activity" Returns the time the last packet was received from the server in the system's native \f(CW\*(C`time()\*(C'\fR format. (Usually seconds since the Unix epoch. MacPerl is probably the only odd-ball) .IP "last_error" 4 .IX Item "last_error" Returns a text error message detailing the last error that occurred. Use this method to determine the cause of failure when a blocking task returns undef. Example: .Sp .Vb 4 \& ... \& $hlc\->blocking_tasks(1); \& ... \& $hlc\->get_filelist("Folder1") || die $hlc\->last_error(); .Ve .Sp Don't rely on \f(CW\*(C`last_error()\*(C'\fR unless you're in blocking task mode. In event loop mode, set a handler routine via \f(CW\*(C`task_error_handler()\*(C'\fR and deal with errors there via the task object's \f(CW\*(C`error()\*(C'\fR and \f(CW\*(C`error_text()\*(C'\fR methods. .IP "logged_in" 4 .IX Item "logged_in" Returns true if currently logged into a server. .IP "news" 4 .IX Item "news" Returns a reference to an array of news posts, or undef if the news has not yet been requested or is empty. .IP "pchats" 4 .IX Item "pchats" Returns a reference to a hash of Net::Hotline::PrivateChat objects, keyed by reference number, that represent all the private chats that the client is currently engaged in, or undef or an empty list if not in any private chats. .IP "server" 4 .IX Item "server" Returns the address of the server currently connected to as a hostname or \&\s-1IP\s0 address, depending on what the actual argument to \f(CW\*(C`connect()\*(C'\fR was. If the port connected to is anything other than the standard Hotline port (5500), then a colon and the port number are tacked onto the end of the server name. If not connected at all, undef is returned. .IP "userlist" 4 .IX Item "userlist" Returns a reference to a hash of Net::Hotline::User objects keyed by socket number, or undef if the userlist has not yet been received. .IP "user_by_nick \s-1REGEX\s0" 4 .IX Item "user_by_nick REGEX" Returns reference(s) to user objects with nicknames matching \s-1REGEX,\s0 and undef or an empty list if there are no matches. Also returns undef or an empty list if called before the userlist has been retrieved from the server. \s-1REGEX\s0 is treated as a case-sensitive anchored regular expression internally (i.e. \f(CW\*(C`/^REGEX$/\*(C'\fR). If your regex matches more than one user's nickname, and \f(CW\*(C`user_by_nick()\*(C'\fR was called in array context, an array of references to user objects will be returned. Otherwise, the first user object that matched will be returned (as ordered by socket number, from low to high). .IP "user_by_socket \s-1SOCKET\s0" 4 .IX Item "user_by_socket SOCKET" Returns the user object whose socket number is equal to \s-1SOCKET,\s0 or undef if there is no user at that socket. .SS "\s-1HANDLERS\s0" .IX Subsection "HANDLERS" The methods in this section deal with getting and setting the handler routines for events and tasks. If you do not set your own handler for an event, the default handler (usually just a print to \s-1STDOUT\s0) will be used. You can enable and disable the default handlers with the \&\f(CW\*(C`default_handlers()\*(C'\fR method. They are disabled by default. .IP "default_handlers \s-1EXPR\s0" 4 .IX Item "default_handlers EXPR" If \s-1EXPR\s0 is omitted, it returns the default handler setting. Otherwise, it sets the default handler setting to \s-1EXPR\s0 (anything that evaluates to true is considered \*(L"on\*(R"). Default handlers are disabled by default. .IP "handlers" 4 .IX Item "handlers" Returns a reference to a hash, keyed by event type strings (the strings in \&\s-1CAPS\s0 below). The values associated with the keys are either code references or undef. Event types are as follows: .Sp .Vb 1 \& Events: \& \& AGREEMENT User agreement text received. \& CHAT New chat appeared. \& CHAT_ACTION A new chat "action" appeared. \& COLOR A user changed color in the userlist. \& EVENT Next cycle in the event loop. \& ICON A user changed icon in the userlist. \& JOIN A user joined the server. \& LEAVE A user left the server. \& MSG A private message arrived. \& NEWS News received. \& NEWS_POSTED A news post was made by another user. \& NICK A user changed nickname in the userlist. \& PCHAT_CHAT New private chat appeared. \& PCHAT_ACTION A new private chat action appeared. \& PCHAT_INVITE An invitation to private chat arrived. \& PCHAT_JOIN A user joined a private chat. \& PCHAT_LEAVE A user left a private chat. \& PCHAT_SUBJECT Private chat subject changed. \& QUIT The server was shutdown politely. \& SERVER_MSG A server message arrived. \& \& Tasks: \& \& BAN Ban user task completed. \& FILE_DELETE A file or folder was deleted. \& FILE_GET A file download is ready to begin. \& FILE_PUT A file upload is ready to begin. \& FILE_GET_INFO File information received. \& FILE_SET_INFO File information set. \& FILE_LIST File list received. \& FILE_MKDIR New folder created. \& FILE_MOVE A file or folder was moved. \& KICK Disconnect user task completed. \& LOGIN Login task completed. \& NEWS_POST News post task completed. \& PCHAT_ACCEPT You have joined a private chat. \& PCHAT_CREATE New private chat created. \& SEND_MSG Private message sent. \& TASK_ERROR A task error ocurred. \& USER_GETINFO User information received. \& USER_LIST User list received. .Ve .SS "\s-1SET/GET HANDLERS\s0" .IX Subsection "SET/GET HANDLERS" The methods in this section expect either one code reference argument, or no arguments at all. With one argument, the handler is set to the given code reference. The return value is always the current value of the handler (should be either undef or a code reference). .PP The code reference should point to a subroutine that expects at least one argument: the Net::Hotline::Client object itself (listed as \*(L"\s-1SELF\*(R"\s0 below). Other arguments vary according to the event being handled. In this section, only the varying arguments to the handler subroutine are described. .PP Also note that you don't have to do the \*(L"obvious\*(R" tasks associated with each handler. For example, in the \*(L"leave\*(R" handler, you don't have to remove the user from the userlist. That will be done for you by the Net::Hotline::Client object. .PP \fI\s-1EVENTS\s0\fR .IX Subsection "EVENTS" .IP "agreement_handler \s-1CODE\s0 (\s-1SELF, TEXT\s0)" 4 .IX Item "agreement_handler CODE (SELF, TEXT)" User agreement text received. .Sp .Vb 1 \& TEXT Reference to the agreement text. .Ve .IP "chat_handler \s-1CODE\s0 (\s-1SELF, TEXT\s0)" 4 .IX Item "chat_handler CODE (SELF, TEXT)" New chat appeared. .Sp .Vb 1 \& TEXT Reference to the chat text. .Ve .IP "chat_action_handler \s-1CODE\s0 (\s-1SELF, TEXT\s0)" 4 .IX Item "chat_action_handler CODE (SELF, TEXT)" A new chat \*(L"action\*(R" appeared. .Sp .Vb 1 \& TEXT Reference to the chat action text. .Ve .IP "color_handler \s-1CODE\s0 (\s-1SELF, USER, OLD_COLOR, NEW_COLOR\s0)" 4 .IX Item "color_handler CODE (SELF, USER, OLD_COLOR, NEW_COLOR)" A user changed color in the userlist. .Sp .Vb 3 \& USER A Net::Hotline::User object. \& OLD_COLOR The user\*(Aqs previous color. \& NEW_COLOR The user\*(Aqs new color. .Ve .Sp Valid colors: .Sp .Vb 4 \& 1 Black Active normal user. \& 2 Red Active admin user. \& 3 Gray Inactive normal user. \& 4 Pink Inactive admin user. .Ve .Sp The hash \f(CW%Net::Hotline::Constants::HTLC_COLORS\fR contains color number-to-name mappings. .IP "event_loop_handler \s-1CODE\s0 (\s-1SELF, IDLE\s0)" 4 .IX Item "event_loop_handler CODE (SELF, IDLE)" Next cycle in the event loop. Idle events only occur when non-blocking i/o is active. .Sp .Vb 1 \& IDLE True if the event is an idle event. .Ve .IP "icon_handler \s-1CODE\s0 (\s-1SELF, USER, OLD_ICON, NEW_ICON\s0)" 4 .IX Item "icon_handler CODE (SELF, USER, OLD_ICON, NEW_ICON)" A user changed icon in the userlist. .Sp .Vb 3 \& USER A Net::Hotline::User object. \& OLD_ICON The user\*(Aqs previous icon number. \& NEW_ICON The user\*(Aqs new icon number. .Ve .IP "join_handler \s-1CODE\s0 (\s-1SELF, USER\s0)" 4 .IX Item "join_handler CODE (SELF, USER)" A user joined the server. .Sp .Vb 1 \& USER A Net::Hotline::User object. .Ve .IP "leave_handler \s-1CODE\s0 (\s-1SELF, USER\s0)" 4 .IX Item "leave_handler CODE (SELF, USER)" A user left the server. .Sp .Vb 1 \& USER A Net::Hotline::User object. .Ve .IP "msg_handler \s-1CODE\s0 (\s-1SELF, USER, TEXT,\s0 REPLY-TO)" 4 .IX Item "msg_handler CODE (SELF, USER, TEXT, REPLY-TO)" A private message arrived. .Sp .Vb 3 \& USER Reference to the sender\*(Aqs Net::Hotline::User object. \& TEXT Reference to the message text. \& REPLY\-TO Reference to the text to which this is a reply (if any) .Ve .IP "news_posted_handler \s-1CODE\s0 (\s-1SELF, TEXT\s0)" 4 .IX Item "news_posted_handler CODE (SELF, TEXT)" A news post was made by another user. .Sp .Vb 1 \& TEXT Reference to the news post text. .Ve .IP "nick_handler \s-1CODE\s0 (\s-1SELF, USER, OLD_NICK, NEW_NICK\s0)" 4 .IX Item "nick_handler CODE (SELF, USER, OLD_NICK, NEW_NICK)" A user changed nickname in the userlist. .Sp .Vb 3 \& USER A Net::Hotline::User object. \& OLD_NICK The user\*(Aqs previous nickname. \& NEW_NICK The user\*(Aqs new nickname. .Ve .IP "pchat_action_handler (\s-1SELF, REF, TEXT\s0)" 4 .IX Item "pchat_action_handler (SELF, REF, TEXT)" A new private chat action appeared. .Sp .Vb 2 \& REF Private chat reference number. \& TEXT Reference to the chat action text. .Ve .IP "pchat_chat_handler (\s-1SELF, REF, TEXT\s0)" 4 .IX Item "pchat_chat_handler (SELF, REF, TEXT)" New private chat appeared. .Sp .Vb 2 \& REF Private chat reference number. \& TEXT Reference to the chat text. .Ve .IP "pchat_invite_handler (\s-1SELF, REF, SOCKET, NICK\s0)" 4 .IX Item "pchat_invite_handler (SELF, REF, SOCKET, NICK)" An invitation to private chat arrived. .Sp .Vb 3 \& REF Private chat reference number. \& SOCKET Socket number of the inviting user. \& NICK Nick of the inviting user. .Ve .IP "pchat_join_handler (\s-1SELF, PCHAT, SOCKET\s0)" 4 .IX Item "pchat_join_handler (SELF, PCHAT, SOCKET)" A user joined a private chat. .Sp .Vb 2 \& PCHAT A Net::Hotline::PrivateChat object. \& SOCKET Socket number of the joining user. .Ve .IP "pchat_leave_handler (\s-1SELF, PCHAT, SOCKET\s0)" 4 .IX Item "pchat_leave_handler (SELF, PCHAT, SOCKET)" A user left a private chat. .Sp .Vb 2 \& PCHAT A Net::Hotline::PrivateChat object. \& SOCKET Socket number of the leaving user. .Ve .Sp Note that the user who left will no longer be in the private chat object's userlist. .IP "pchat_subject_handler (\s-1SELF, REF, TEXT\s0)" 4 .IX Item "pchat_subject_handler (SELF, REF, TEXT)" Private chat subject changed. .Sp .Vb 2 \& REF Private chat reference number. \& TEXT Reference to the subject text. .Ve .IP "quit_handler \s-1CODE\s0 (\s-1SELF, TEXT\s0)" 4 .IX Item "quit_handler CODE (SELF, TEXT)" The server was shutdown politely. .Sp .Vb 1 \& TEXT Reference to shutdown message text. .Ve .IP "server_msg_handler \s-1CODE\s0 (\s-1SELF, TEXT\s0)" 4 .IX Item "server_msg_handler CODE (SELF, TEXT)" A server message arrived. .Sp .Vb 1 \& TEXT Reference to the message text. .Ve .PP \fI\s-1TASKS\s0\fR .IX Subsection "TASKS" .IP "ban_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "ban_handler CODE (SELF, TASK)" Ban user task completed. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "delete_file_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "delete_file_handler CODE (SELF, TASK)" A file or folder was deleted. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "file_info_handler \s-1CODE\s0 (\s-1SELF, TASK, INFO\s0)" 4 .IX Item "file_info_handler CODE (SELF, TASK, INFO)" File information received. .Sp .Vb 2 \& TASK A Net::Hotline::Task object. \& INFO A Net::Hotline::FileInfoItem object. .Ve .IP "file_list_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "file_list_handler CODE (SELF, TASK)" File list received. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "get_file_handler \s-1CODE\s0 (\s-1SELF, TASK, REF, SIZE\s0)" 4 .IX Item "get_file_handler CODE (SELF, TASK, REF, SIZE)" A file download is ready to begin. .Sp .Vb 3 \& TASK A Net::Hotline::Task object. \& REF Download reference number. \& SIZE Size of download in bytes. .Ve .Sp If you do not set a handler for \f(CW\*(C`get_file()\*(C'\fR, a default handler will be used regardless of your \f(CW\*(C`default_handlers()\*(C'\fR setting. The default handler simply does: .Sp .Vb 1 \& SELF\->recv_file(TASK, REF, SIZE); .Ve .Sp which initiates the file download and does not return until the download has completed. If you want to download in the background, call \f(CW\*(C`fork()\*(C'\fR (or something similar) in your handler routine. .IP "kick_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "kick_handler CODE (SELF, TASK)" Disconnect user task completed. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "login_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "login_handler CODE (SELF, TASK)" Login task completed. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "move_file \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "move_file CODE (SELF, TASK)" A file or folder was moved. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "new_folder \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "new_folder CODE (SELF, TASK)" New folder created. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "news_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "news_handler CODE (SELF, TASK)" The news has arrived and is now available via the \f(CW\*(C`news()\*(C'\fR method. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "pchat_accept_handler (\s-1SELF, TASK, PCHAT\s0)" 4 .IX Item "pchat_accept_handler (SELF, TASK, PCHAT)" You have joined a private chat. .Sp .Vb 2 \& TASK A Net::Hotline::Task object. \& PCHAT A Net::Hotline::PrivateChat object. .Ve .IP "pchat_create (\s-1SELF, TASK, PCHAT\s0)" 4 .IX Item "pchat_create (SELF, TASK, PCHAT)" New private chat created. .Sp .Vb 2 \& TASK A Net::Hotline::Task object. \& PCHAT A Net::Hotline::PrivateChat object. .Ve .Sp Note that you do not have to save the private chat object yourself. The client object keeps track of all private chats it is currently engaged in (the list is accessible via the \f(CW\*(C`pchats()\*(C'\fR method), updates the userlists as users join and leave, and deletes the objects when you leave the private chat. .IP "post_news_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "post_news_handler CODE (SELF, TASK)" News post task completed. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "put_file_handler \s-1CODE\s0 (\s-1SELF, TASK, REF, SIZE, RFLT\s0)" 4 .IX Item "put_file_handler CODE (SELF, TASK, REF, SIZE, RFLT)" A file upload is ready to begin. .Sp .Vb 4 \& TASK A Net::Hotline::Task object. \& REF Download reference number. \& SIZE Size of the upload in bytes. \& RFLT Data needed to resume an upload. .Ve .Sp If you do not set a handler for \f(CW\*(C`put_file()\*(C'\fR, a default handler will be used regardless of your \f(CW\*(C`default_handlers()\*(C'\fR setting. The default handler simply does: .Sp .Vb 1 \& SELF\->send_file(TASK, REF, SIZE, RFLT); .Ve .Sp which initiates the file upload and does not return until the upload has completed. If you want to upload in the background, call \f(CW\*(C`fork()\*(C'\fR (or something similar) in your handler routine. .IP "send_msg_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "send_msg_handler CODE (SELF, TASK)" Private message sent. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "set_file_info_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "set_file_info_handler CODE (SELF, TASK)" File information set (this includes both renaming and setting file comments). .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "task_error_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "task_error_handler CODE (SELF, TASK)" A task error ocurred. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "user_info_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "user_info_handler CODE (SELF, TASK)" User information received. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .IP "user_list_handler \s-1CODE\s0 (\s-1SELF, TASK\s0)" 4 .IX Item "user_list_handler CODE (SELF, TASK)" User list received. .Sp .Vb 1 \& TASK A Net::Hotline::Task object. .Ve .SS "\s-1MISCELLANEOUS\s0" .IX Subsection "MISCELLANEOUS" .IP "debug \s-1EXPR\s0" 4 .IX Item "debug EXPR" If \s-1EXPR\s0 is omitted, returns the debugging status (off by default), otherwise sets debugging status to \s-1EXPR\s0 (true means debugging is on). .IP "version" 4 .IX Item "version" Returns the Net::Hotline::Client version string. .SH "TO DO" .IX Header "TO DO" .IP "\(bu" 4 User administration. .SH "BUGS" .IX Header "BUGS" Please send bug reports to siracusa@mindspring.com. .SH "AUTHOR" .IX Header "AUTHOR" John C. Siracusa (siracusa@mindspring.com) .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright(c) 1999 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.