NAME
MP3::Napster::User - Object-oriented access to Napster users
SYNOPSIS
$user = $nap->whois('glimitz');
print $user->name,"\n";
print $user->sharing,"\n";
print $user->link,"\n";
print $user->link_code,"\n";
print $user->server,"\n";
print $user->current_channel,"\n";
print join ' ',$user->channels,"\n";
print $user->login_time,"\n";
print $user->time,"\n";
print $user->channels,"\n";
print $user->uploads,"\n";
print $user->downloads,"\n";
print $user->level,"\n";
print $user->last_seen,"\n";
print $user->profile,"\n";
$user->ping || warn "$user is unreachable";
$user->msg('Hello there!');
DESCRIPTION
MP3::Napster::User provides object-oriented access to other users on the Napster service.
OBJECT CONSTRUCTION
User objects are normally not constructed de novo, but are returned by the MPEG::Napster whois() and users() methods, as well as by several of the callbacks involving the Napster chat channels, specifically USER_JOINS and USER_DEPARTS.
OBJECT METHODS
Object methods provide access to various attributes of the User object, allow you to send private messages to users, to browse their files, and to ping them to determine if they are online.
- Accessors
-
The accessors provide read-only access to the following User attributes.
Accessor Description -------- ----------- $user->name User's (nick)name $user->link User's link speed as a string $user->link_code User's link speed as a numeric code $user->sharing Number of files user is sharing $user->current_channel User's current channel $user->channels List of channels that user is subscribed to $user->uploads Number of uploads the user is currently performing $user->downloads Number of downloads the user is currently performing $user->level The user's "level", one of "User" or "Admin" $user->status One of "Offline", "Active" or "Inactive" $user->last_seen The time the user was last seen, in seconds since the epoch $user->time The number of seconds that the user has been logged in $user->login_time The same, in a nice human-readable form $user->client The version of the user's Napster client $user->server The MP3::Napster that this User is attached to
- $result = $user->ping([$timeout])
-
The ping() method returns true if the user is reachable by a PING command. The default timeout for a positive response is defined by MP3::Napster, currently 5 seconds by default.
- @songs = $user->browse
-
Browse the user's shared files, returning an array of MP3::Napster::Song objects.
- $user->update
-
Update the user's attributes from the most current versions on the server. Withoug calling update() the values are always those present when the object was first created.
- $user->msg("text")
-
Send a private message to the user.
- $profile = $user->profile
-
Return a human readable profile like this one:
Name: OddBall187 Status: Active Sharing: 62 Link: CABLE Level: User Time: 53.5 min Channels: Themes,Alternative,Rap,Rock Uploads: 5 Downloads: 1 Client: v2.0
- String Overloading
-
If used in a string context, MPEG::Napster::User objects will invoke the name() method, allowing the objects to be directly interpolated into strings, printed, and pattern matched.
AUTHOR
Lincoln Stein <lstein@cshl.org>.
COPYRIGHT
Copyright (c) 2000 Cold Spring Harbor Laboratory. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
MP3::Napster, MP3::Napster::Song, MP3::Napster::Channel, and MPEG::Napster::Transfer