sub
init {
my
$self
=
shift
;
my
$caller
=
shift
;
my
$opt
=
$self
->options;
unless
(
$opt
->{username} and
$opt
->{password} ) {
$caller
->setup_service ( {
package_name
=> __PACKAGE__,
require_args
=> [ {
username
=> {
label
=>
'Username'
,
description
=>
''
,
type
=>
'text'
}
},
{
password
=> {
label
=>
'Password'
,
description
=>
''
,
type
=>
'text'
} } ]
},
$opt
);
}
Jaipo->config->set_service_option(
'Plurk'
,
$opt
);
my
$plurk
= new WWW::Plurk;
unless
(
$plurk
) {
print
"plurk init failed\n"
;
}
$plurk
->login(
$opt
->{username} ,
$opt
->{password} );
$self
->core(
$plurk
);
}
sub
send_msg {
my
(
$self
,
$message
) =
@_
;
print
"Sending to Plurk..."
;
my
$result
=
$self
->core->add_plurk(
content
=>
$message
);
print
"Done\n"
;
}
sub
read_user_timeline {
my
$self
=
shift
;
my
@plurks
=
$self
->plurks;
for
(
@plurks
) {
printf
"%s %s %s"
,
$_
->{uid},
$_
->{date_from},
$_
->{date_offset};
}
}
sub
read_public_timeline {
my
$self
=
shift
;
}
sub
read_global_timeline {
my
$self
=
shift
;
}
1;