生一个监听本地指定端口的HTTP服务器,用于接收api请求
返回数据完全为JSON格式,接口包括:
获取个人信息 /openqq/get_user_info
获取好友信息
use JSON;
use Webqq::Client::Util qw(code2state);
sub Webqq::Client::_get_friend_info{
my $self = shift;
my $uin = shift;
my $api_url = 'http://s.web2.qq.com/api/get_friend_info2';
my
" if $self->{debug};
my $json = JSON->new->utf8->decode( $response->content() );
return undef if $json->{retcode} !=0;
my $user_info = $json->{result};
for my $key
escape);
use JSON;
sub call{
my $self = shift;
my $client = $self->{client};
my $env = shift;
return [
200,
['Content-Type' => 'text/plain'],
[JSON->new->encod
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
::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],
]);
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;
:App::Openqq::SendMessage;
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 = shi
};
my $json = JSON->new->utf8->encode($res);
$responder->([
200,
['Content-Type' => 'text/plain'],
[$json],
]);
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 Webqq::Client::Util qw(console);
sub Webqq::Client::change_state{
my $self = shift;
return undef if $self->{type} ne 'smartqq';
my $state = shift;
my $api_url = 'http://d
response->content(),"\n" if $self->{debug};
my $json = JSON->new->utf8->decode( $response->content() );
return undef if $json->{retcode} !=0;
console "登录状态已修改
escape);
use JSON;
sub call{
my $self = shift;
my $client = $self->{client};
my $env = shift;
return [
200,
['Content-Type' => 'text/plain'],
[JSON->new->encod
penqq::SendDiscussMessage;
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 = shi
};
my $json = JSON->new->utf8->encode($res);
$responder->([
200,
['Content-Type' => 'text/plain'],
[$json],
]);
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
package Webqq::Client;
use strict;
use JSON;
use Encode;
use Time::HiRes qw(gettimeofday);
use LWP::Protocol::https;
use Storable qw(dclone);
use List::Util qw(first);
use base qw(Webqq::Message Webqq
escape);
use JSON;
sub call{
my $self = shift;
my $client = $self->{client};
my $env = shift;
return [
200,
['Content-Type' => 'text/plain'],
[JSON->new->encod
生一个监听本地指定端口的HTTP服务器,用于接收api请求
返回数据完全为JSON格式,接口包括:
获取个人信息 /openqq/get_user_info
获取好友信息
escape);
use JSON;
sub call{
my $self = shift;
my $client = $self->{client};
my $env = shift;
return [
200,
['Content-Type' => 'text/plain'],
[JSON->new->encod
:Openqq::SendGroupMessage;
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 = shi
};
my $json = JSON->new->utf8->encode($res);
$responder->([
200,
['Content-Type' => 'text/plain'],
[$json],
]);
escape);
use JSON;
sub call{
my $self = shift;
my $client = $self->{client};
my $env = shift;
return [
200,
['Content-Type' => 'text/plain'],
[JSON->new->encod
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,(