use JSON;
use Webqq::Client::Util qw(console);
sub Webqq::Client::get_qq_from_uin{
my $self = shift;
my $uin = shift;
my $cache_data = $self->{cache_for_uin_to_qq}->retrieve($uin);
re
print $response->content(),"\n" if $self->{debug};
my $json = JSON->new->utf8->decode( $response->content() );
if($json->{retcode} !=0){
console "从指定uin: $uin 查询
$self->{cache_for_uin_to_qq}->store($uin,$json->{result}{account});
$self->{cache_for_qq_to_uin}->store($json->{result}{account},$uin);
return $json->{result}{account};
}
}
1;
use JSON;
use Webqq::Client::Util qw(console);
sub Webqq::Client::_relink{
my $self = shift;
$self->{login_state} = 'relink';
console "正在进行重新连接...\n";
my $ua = $self->{
for(my $i=0;$i<=$self->{ua_retry_times};$i++){
my $response = $ua->post($api_url,[r=>JSON->new->utf8->encode(\%r)], @headers);
if($response->is_success){
print $respon
ntent() if $self->{debug};
my $content = $response->content();
my $data = JSON->new->utf8->decode($content);
if($data->{retcode} ==0){
$self->{qq_pa
use JSON;
use Encode;
sub Webqq::Client::get_single_long_nick{
my $self = shift;
my $uin = shift;
my $cache_data = $self->{cache_for_single_long_nick}->retrieve($uin);
return
response->content(),"\n" if $self->{debug};
my $json = JSON->new->utf8->decode( $response->content() );
return undef if $json->{retcode} !=0;
#{"retcode":0,"result":[{"uin"
:308165330,"lnick":""}]}
my $single_long_nick = encode("utf8",$json->{result}[0]{lnick});
$self->{cache_for_single_long_nick}->store($uin,$single_long_nick);
return $single_lon
use JSON;
sub Webqq::Client::_get_recent_info {
my $self = shift;
my $ua = $self->{ua};
return undef if $self->{type} ne 'smartqq';
my $api_url = 'http://d.web2.qq.com/channel/get_re
a->post($api_url,[r=>JSON->new->utf8->encode(\%r)],@headers);
if($response->is_success){
print $response->content(),"\n" if $self->{debug};
my $json = JSON->new->utf8->decode($
());
return undef if $json->{retcode}!=0 ;
my %type = (0 => 'friend',1 => 'group', 2 => 'discuss');
my @recent;
for(@{$json->{result}}){
next unless
r::Session::CHI>,
L<Cookie|Dancer::Session::Cookie>,
L<DBIC|Dancer::Session::DBIC>,
L<JSON|Dancer::Session::JSON>,
L<Memcached|Dancer::Session::Memcached>,
L<Memcached::Fast|Dancer::Session::Memcache
use JSON;
use Webqq::Client::Util qw(code2state code2client);
sub Webqq::Client::_get_user_info{
my $self = shift;
my $webqq_api_url ='http://s.web2.qq.com/api/get_friend_info2';
my $sma
my $json = JSON->new->utf8->decode( $response->content() );
return undef if $json->{retcode} !=0;
$json->{result}{state} = $self->{qq_param}{state};
$json->{result}{
client_type} = 'web';
return $json->{result};
}
else{return undef}
}
1;
use JSON;
use Webqq::Client::Util qw(hash);
sub Webqq::Client::_get_user_friends{
my $self = shift;
my $api_url = 'http://s.web2.qq.com/api/get_user_friends2';
my $ua = $self->{ua};
my
$ua->post($api_url,[r=>JSON->new->utf8->encode(\%r)],@headers);
if($response->is_success){
print $response->content(),"\n" if $self->{debug};
my $json = JSON->new->utf8->decode($re
sponse->content());
return undef if $json->{retcode}!=0 ;
my $friends_state = $self->_get_friends_state();
my %categories ;
my %info;
my %marknames;
my
package Webqq::Client::Plugin::Perldoc;
use JSON;
use Webqq::Client::Util qw(console_stderr truncate);
if($^O !~ /linux/){
console_stderr "Webqq::Client::App::Perldoc只能运行在linux系统上\
e_api . $module,(),sub{
my $response = shift;
my $doc;
my $json;
my $code;
if($client->{debug}){
print "GET " . $metacpan
ponse->content;
}
eval{ $json = JSON->new->utf8->decode($response->content);};
unless($@){
if($json->{code} == 404){
return 0;
use JSON;
use Webqq::Client::Util qw(console);
sub Webqq::Client::_get_vfwebqq {
my $self = shift;
return 1 if $self->{type} ne 'smartqq';
console "获取vfwebqq值...\n";
my $api_url
print $response->content,"\n" if $self->{debug};
my $json = JSON->new->utf8->decode($response->content);
if($json->{retcode}!=0){
console "获取vfwebqq值失败...\n"
;
return 0;
}
$self->{qq_param}{vfwebqq} = $json->{result}{vfwebqq};
return $json->{result}{vfwebqq};
}
else{
console "获取vfwebqq值失败...\
use JSON ;
use Webqq::Client::Util qw(console);
sub Webqq::Client::_login2{
my $self = shift;
console "尝试进行登录(阶段2)...\n";
my $ua = $self->{ua};
my $api_url = 'http://d.
for(my $i=0;$i<=$self->{ua_retry_times};$i++){
my $response = $ua->post($api_url,[r=>JSON->new->utf8->encode(\%r)], @headers);
if($response->is_success){
print $respon
ntent() if $self->{debug};
my $content = $response->content();
my $data = JSON->new->utf8->decode($content);
if($data->{retcode} ==0){
$self->{qq_pa
use JSON;
use Encode;
use Webqq::Client::Util qw(code2client);
sub Webqq::Client::_get_discuss_info {
my $self = shift;
my $ua = $self->{ua};
my $did = shift;
return undef if $s
if($response->is_success){
print $response->content,"\n" if $self->{debug};
my $json;
eval{
#my $d = $response->content();
#$d=~s/\\u([a-zA-Z0-9]{4})/
$json = JSON->new->utf8->decode($response->content());
};
print $@ if $@ and $self->{debug};
$json = {} unless defined $json;
return undef if $json->{retcode}!
use JSON;
use Encode;
use Storable qw(dclone);
sub Webqq::Client::_send_discuss_message {
my $self = shift;
return if $self->{type} ne 'smartqq';
my $msg = shift;
my $ua = $self->{asyn
>{to_uin},
face => $self->{qq_database}{user}{face} || 591,
content => JSON->new->utf8->encode($content),
msg_id => $msg->{msg_id},
clientid => $self
);
$s{content} = decode("utf8",$s{content});
my $post_content = [
r => JSON->new->utf8->encode(\%s),
];
if($self->{debug}){
require URI;
my $uri
package Webqq::Client::Plugin::SmartReply;
use JSON;
use AE;
use Encode;
use POSIX qw(strftime);
use Webqq::Client::Util qw(truncate console);
my $API = 'http://www.tuling123.com/openapi/api';
my %lim
ring,"\n";
}
my $reply;
my $data = {};
eval{
$data = JSON->new->utf8->decode($res->content);
};
if($@){
print $@,"\n" if $clien
escape);
use JSON;
sub call{
my $self = shift;
my $client = $self->{client};
my $env = shift;
return [
200,
['Content-Type' => 'text/plain'],
[JSON->new->encod
use JSON;
use Encode;
sub Webqq::Client::_send_sess_message{
my($self,$msg) = @_;
return unless defined $msg->{group_sig};
my $ua = $self->{asyn_ua};
my $callback = sub{
my $re
,
face => $self->{qq_database}{user}{face} || 591,
content => JSON->new->utf8->encode($content),
msg_id => $msg->{msg_id},
service_type
$s{content} = decode("utf8",$s{content});
my $post_content = [
r => JSON->new->utf8->encode(\%s),
];
if($self->{type} eq 'webqq'){
push @$post_content,(
::Openqq::SendSessMessage;
use parent qw(Plack::Component);
use URI::Escape qw(uri_unescape);
use JSON;
use Encode;;
sub call{
my $self = shift;
my $client = $self->{client};
my $env = sh
};
my $json = JSON->new->utf8->encode($res);
$responder->([
200,
['Content-Type' => 'text/plain'],
[$json],
]);
owl jquery plugin):
[% SET growl_list = growls() %]
[%- IF growl_list.size %]
[% USE JSON.Escape %]
<script type="text/javascript">
$( document ).ready(function() {
in growl_list -%]
$.bootstrapGrowl("[% growl.message.dquote %]", [% growl.options.json %]);
[% END %]
});
</script>
[%- END %]
=head1 DESCRIPTION
This all
ackage VM::CloudAtCost;
use strict;
use warnings;
use Carp;
use LWP::UserAgent;
use JSON;
use Data::Clean::FromJSON;
use Exporter qw(import);
our $VERSION = "0.1";
sub new {
my ($class, %par
my $result = eval { from_json($response->content()) };
if ($response->is_success()) {
my $JSONcleaner=Data::Clean::FromJSON->new();
my $cleanJSON = $JSONcleaner->clean_in_place($
my $result = eval { from_json($response->content()) };
if ($response->is_success()) {
my $JSONcleaner=Data::Clean::FromJSON->new();
my $cleanJSON = $JSONcleaner->clean_in_place($
e decided by the
implementation, but server MUST support C<json> as the fallback. If unspecified,
default in most cases should also be C<json>, but server can default to other
format, like say L<HTML>
rializations are supported, client can perform an C<srvinfo>
action.
Server should fallback to C<json> if requested result format is not supported.
=back
=head2 Additional actions
=head3 Action: B
l": "http://localhost:5000/",
// supported formats
"fmt": ["Console","HTML","JSON","PHPSerialization","YAML","json"],
}
=head2 Parsing Riap request from HTTP request
Server can provide default
rotocol for requesting metadata and performing actions on code entities.
Examples are written in JSON (sometimes with added comments), but data
structures can actually be encoded using other formats.
1.2 (Oct 2014)
Version bumped to 1.2. This version addresses sending/receiving binary data over
JSON. In this version, client can send base64-encoded binary data in arguments
using C<ARGNAME:base64>
ase of L<Sub::Spec::HTTP::Server>.
=head1 SEE ALSO
L<Rinci>
JSON RPC, (version 1 at L<http://json-rpc.org>, version 2 at
L<http://jsonrpc.org>). First developed 2005, major revision to version 2 in