Net::Lyskom - Perl module used to talk to LysKOM servers.
use Net::Lyskom; $a = Net::Lyskom->new(); $conf = 6; $a->login(pers_no => 437, password => "God", invisible => 1) or die "Failed to log in: $a->err_string\n"; $b = $a->send_message(7680, "Oook!"); $b = $a->create_text( subject => "Testsubject", body => "A nice and tidy message body.", recpt => [437], ); if ($b) { print "Text number $b created.\n"; } else { print "Text creation failed: $a->err_string.\n"; }
Net::Lyskom is a module used to talk to LysKOM servers. This far it lacks a lot of functions, but there are enough functions implemented to program statistics robots and such.
Looks at a response from the server and decides if it is an error message and if that is the case sets some variables in the object and returns true.
Calls die() if the response does not look as a server response at all.
die()
This sub is intended for internal use.
Creates a new Net::Lyskom object and connect to a LysKOM server. By default it connects to the server at Lysator (kom.lysator.liu.se, port 4894). To connect to another server, use named arguments.
$a = Net::Lyskom->new(Host => "kom.csd.uu.se", Port => 4894);
If the connection succeded, an object is returned, if not undef is returned.
undef
Get responses and asynchronous messages from the server. The asynchronous messages is passed to handle_async(). This method is intended for internal use, and shall normally not be used anywhere else then in this module.
handle_async()
Helper function to getres(). Be careful and understand what you are up to before using it.
getres()
Is automaticly called when a asynchronous message is returned from the server. Currently this routine does nothing.
Log out from LysKOM, this call does not disconnect the session, which means you can login again without the need of calling another new.
$a->logout();
Changes current conference of the session.
$a->change_conference(4711);
Change name of the person or conference numbered $conference to $new_name.
$a->change_name(46, 'Sweden (the strange land)');
Tells the server what the logged-in user is doing. You are encouraged to use this call creatively.
$a->change_what_i_am_doing('Eating smorgasbord');
Set the privbits on person $person. User can specify one or more privileges by name. Privs not specified default to false.
Changes the password of $person to $new_pwd.
$old is the password of the currently logged in person. All three arguments are required.
Deletes the conference with number $conf. If $conf is a mailbox, the corresponding user is also deleted.
$a->delete_conf(42);
Removes the person $pers_no from the membership list of conference $conf_no.
$a->sub_member(42,4711);
Set the text $text_no as presentation for $conf_no. To remove a presentation, use $text_no = 0
$a->set_presentation(42,4711);
Sets the messages of the day on the conference or person $conf_no to $text_no and removes the old message.
$a->set_etc_motd(6,1);
Set person/conference $admin as supervisor for the conference $conf_no
Set $perm_sub as permitted subscribers for $conf_no. If $perm_sub = 0, all users are welcome to write in the conference.
Sets the conference $super_conf as super conference for $conf_no
Sets the garb time for the conference $conf_no to $nice days.
$a->set_garb_nice(42,7);
Get a text from the server, the first argument, text, is the global text number for the text to get. The retrival stars at position start_char (the first character in the text is numbered 0) and ends at position end_char.
text
start_char
end_char
Default is 0 for start_char and 2147483647 for end_char. This means that a complete message is fetched, unless otherwise stated.
Also note that you can get an entire text, pre-split into subject and body, via the object returned from the get_text_stat method.
get_text_stat
To get the first 100 chars from text 4711:
my $text = $a->get_text(text => 4711, start_char => 0, end_char => 100);
Deletes the text with the global text number $text from the database.
Add a recipient to a text. $type can be one of "recpt", "cc" or "bcc". If not given (or if set to something other than one of those three strings) it defaults to "recpt". text_no and conf_no are required.
text_no
conf_no
Remove a recipient from a text.
Add a comment link between the text comment-to and the text text-no (text-no becomes a comment to the text comment-to). This call is used to add comment links after a text has been created.
Ask the server for the current time. Returns a Net::Lyskom::Time object.
Only read the $no_of_unread texts in the conference $conf_no.
Sets the login message of LysKOM, can only be executed by a privileged person, with the proper privileges enabled.
Sets the security level for the current session to $level.
This call instructs the LysKOM server to make sure the permanent copy of its databas is current. This call is privileged in most implementations.
$a->sync_kom();
Instructs the server to save all data and shut down. The variable $exit_val is currently not used.
Get status for a person from the server. Returns a Net::Lyskom::Person object.
Get a list of conference numbers in which the person $pers_no may have unread texts.
my @unread_confs = $a->get_unread_confs(7);
Sends the message $message to all members of $recipient that is currently logged in. If $recipient is 0, the message is sent to all sessions that are logged in.
Get the session number of the current session.
my $session_number = $a->who_am_i();
$time should be given a as a unix time_t (that is, as the number of seconds since 00:00:00 01 Jan 1970 UCT).
Returns the global number of the readable text that follows the text $text_no.
$text_no
Returns the global number of the readable text that precedes the text $text_no.
Log in to LysKOM. $persno is the number of the person which is to be logged in. $pwd is the password of that person. If $invis is true, a secret login is done (the session is not visible in who-is-on-lists et al.)
Tells the server that this is the software $client_name and the version $client_version.
$a->set_client_version('My-cool-software','0.001 beta');
Ask the server for the name of the client software logged in with session number $session.
Ask the server for the version of the client software logged in with session number $session.
Ask the server for the version info of the server software itself. Returns a three-element array with the protocol version, server software name and server software version.
Lookup the name $name in the server, returns a list of all matching conferences and/or persons, in the form of Net::Lyskom::ConfZInfo objects. The server database is searched with standard kom name expansion.
If $want_pers is true, the server includes persons in the answer, if $want_conf is true, conferences is included.
Regexp lookup of the name $name in the server, returns a list of all matching conferences and/or persons, in the form of Net::Lyskom::ConfZInfo objects.
Tells the server that the user is active.
Returns a list of Net::Lyskom::DynamicSession objects. If want_visible is true, the visible users are included in the answer. If want_invisible is true, invisible users are included.
want_visible
want_invisible
Only the users active the last active_last seconds are included in the answer. If active_last is zero, all users (who match the visibility limits) are returned.
active_last
If not given, want_visible defaults to true, want_invisible defaults to false and active_last defaults to 0.
Returns a Net::Lyskom::StaticSession object holding details on the specified session.
Net::Lyskom::StaticSession
Creates texts. Takes arguments as indicated in the synopsis just above (that is, as a hash with zero or more of the given keys and strings or arrayrefs as values, as appropriate). Any of the arguments can be left out, but a text without at least one recipient is not very useful (nor is one with neither subject nor body). The aux argument should be a reference to a list of Net::Lyskom::AuxInfo objects.
aux
If the aux list is not given, or given but not containing a content-type item, an item with content type text/x-kom-basic;charset=utf-8 will be added. In this case, the subject and body will also be converted from Perl's internal encoding to UTF-8 before being sent out over the network.
text/x-kom-basic;charset=utf-8
Example:
$k->create_text( subject => "Test", body => "Body", recpt => [437], aux => [ Net::Lyskom::AuxItem->new( tag => content_type, data => "text/plain" ) ]);
Fetch the status for a text from the server. Returns a Net::Lyskom::TextStat object.
Get status for one or more conferences from the server. Returns a Net::Lyskom::Conference object in scalar context and a list of such objects in list context.
Add and/or delete aux items to/from a text. delete should be a reference to an array of aux_info order numbers to remove from the text. add should be a reference to an array of Net::Lyskom::AuxInfo objects to add to the text.
delete
add
Net::Lyskom::AuxInfo
Adds a fast-reply auxitem with the contents $data to the text $text. Now implemented in terms of modify_text_info, name retained for backwards compatibility.
modify_text_info
Ask the server which predefined aux items that exists in the server.
Get a membership list for person, in the form of a list of Net::Lyskom::Membership objects. Start at position first in the membership list and get no_of_confs conferences. If want_read_texts is true the server will also send information about read texts in the conference.
person
first
no_of_confs
want_read_texts
Given a local text number and an integer smaller than 256, returns a Net::Lyskom::TextMapping object detailing the mapping between the local and global text numbers of up to that many texts. All arguments are required.
Given a local text number and an integer smaller than 256, returns a Net::Lyskom::TextMapping object detailing the mapping between texts written by pers_no and global text numbers of up to that many texts. All arguments are required.
pers_no
Set the membership flags for user pers in conference conf.
pers
conf
Add person number pers as a member of conference number conf, at priority priority and at position where. invitation, passive and secret specify the membership type.
priority
where
invitation
passive
secret
Return information on which texts person $pers has read in conference $conf. Returns an Net::Lyskom::Membership object.
Net::Lyskom::Membership
Set the garb-nice value for conference $conf to $expire.
$conf
$expire
Sets a mark of (numerical) type $mark on text number $text.
$mark
$text
Returns an array of (text_no, mark_type) pairs, showing the texts the current user has marked.
Remove any marks on the specified text.
Tell the server that the current user has read everything up to local number $local_no in conference number $conf.
$local_no
Set the type of conference conf. conf is required, the rest default to false if not specified.
Marks the texts specified by the local text numbers in @texts as read in the conference $conf.
@texts
Removes $text from $comments list of comments.
$comment
Makes text number $text be a footnote to text number $footnote_to.
$footnote_to
Makes text number $text not be a footnote to text number $footnote_to.
Make session number $session lose its connection with the server, given sufficient privilege. Session zero is always interpreted as the current session.
$session
Make text number $text_no be the user area for user number $pers_no.
$pers_no
Get a subset of all information for conference number $conf. Returns a Net::Lyskom::Conference object with only some fields filled.
Sets server information.
Tell the server to send the asynchronous calls with the numbers specified in @call_numbers.
@call_numbers
Ask server which asynchronous calls are turned on for this session. Returns a list of integers.
Get the active collate table from the server.
Exactly the same as create_text, except that it uses the call to create the text anonymously.
create_text
Create a conference.
Create a person.
Delete and/or add aux items to a conference. $del_array_ref is a reference to an array of aux item numbers to delete. $add_array_ref is a reference to an array of aux items to add.
$del_array_ref
$add_array_ref
Add and/or delete aux items for the server itself. Similar arguments as above.
Set the keep_commented field for conference number $conf to $keep.
keep_commented
$keep
Set the personal flags for person number person. At the moment there is only one such flag, but this method uses the many-args calling convention for ease of future expansion.
Get the server info. Returns a Net::Lyskom::Info object.
Net::Lyskom::Info
Net::Lyskom::AuxItem, Net::Lyskom::ConfZInfo, Net::Lyskom::Conference, Net::Lyskom::Membership, Net::Lyskom::Object, Net::Lyskom::Person, Net::Lyskom::TextMapping, Net::Lyskom::Time, Net::Lyskom::Util
2 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
To install Net::Lyskom, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Lyskom
CPAN shell
perl -MCPAN -e shell install Net::Lyskom
For more information on module installation, please visit the detailed CPAN module installation guide.