line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
sub Mojo::Webqq::_send_discuss_message { |
2
|
0
|
|
|
0
|
|
|
my $self = shift; |
3
|
0
|
|
|
|
|
|
my $msg = shift; |
4
|
0
|
0
|
|
|
|
|
my $api_url = ($self->security?'https':'http') . '://d1.web2.qq.com/channel/send_discu_msg2'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my $callback = sub{ |
7
|
0
|
|
|
0
|
|
|
my $json = shift; |
8
|
0
|
|
|
|
|
|
$msg->parse_send_status_msg( $json ); |
9
|
0
|
0
|
0
|
|
|
|
if(!$msg->is_success and $msg->code != -3 and $msg->ttl > 0){ |
|
|
|
0
|
|
|
|
|
10
|
0
|
|
|
|
|
|
$self->debug("消息[ " .$msg->id . " ]发送失败,尝试重新发送,当前TTL: " . $msg->ttl); |
11
|
0
|
|
|
|
|
|
$self->message_queue->put($msg); |
12
|
|
|
|
|
|
|
#$self->send_discuss_message($msg); |
13
|
0
|
|
|
|
|
|
return; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
else{ |
16
|
0
|
0
|
|
|
|
|
if(ref $msg->cb eq 'CODE'){ |
17
|
0
|
|
|
|
|
|
$msg->cb->( |
18
|
|
|
|
|
|
|
$self, |
19
|
|
|
|
|
|
|
$msg, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
0
|
|
|
|
|
|
$self->emit(send_message => |
23
|
|
|
|
|
|
|
$msg, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
} |
26
|
0
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $headers = { |
29
|
|
|
|
|
|
|
Referer => 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2', |
30
|
|
|
|
|
|
|
json => 1, |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
my @content = map { |
33
|
0
|
0
|
|
|
|
|
if($_->{type} eq "txt"){$_->{content}} |
|
0
|
0
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
elsif($_->{type} eq "face"){["face",0+$_->{id}]} |
35
|
0
|
|
|
|
|
|
} @{$msg->raw_content}; |
|
0
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#for(my $i=0;$i<@content;$i++){ |
37
|
|
|
|
|
|
|
# if(ref $content[$i] eq "ARRAY"){ |
38
|
|
|
|
|
|
|
# if(ref $content[$i] eq "ARRAY"){ |
39
|
|
|
|
|
|
|
# splice @content,$i+1,0," "; |
40
|
|
|
|
|
|
|
# } |
41
|
|
|
|
|
|
|
# else{ |
42
|
|
|
|
|
|
|
# $content[$i+1] = " " . $content[$i+1]; |
43
|
|
|
|
|
|
|
# } |
44
|
|
|
|
|
|
|
# } |
45
|
|
|
|
|
|
|
#} |
46
|
0
|
|
|
|
|
|
my $content = [@content,["font",{name=>"宋体",size=>10,style=>[0,0,0],color=>"000000"}]]; |
47
|
0
|
|
0
|
|
|
|
my %s = ( |
48
|
|
|
|
|
|
|
did => $msg->discuss_id, |
49
|
|
|
|
|
|
|
face => $self->user->face || 591, |
50
|
|
|
|
|
|
|
content => $self->to_json($content), |
51
|
|
|
|
|
|
|
msg_id => $msg->id, |
52
|
|
|
|
|
|
|
clientid => $self->clientid, |
53
|
|
|
|
|
|
|
psessionid => $self->psessionid, |
54
|
|
|
|
|
|
|
); |
55
|
0
|
|
|
|
|
|
$self->http_post( |
56
|
|
|
|
|
|
|
$api_url, |
57
|
|
|
|
|
|
|
$headers, |
58
|
|
|
|
|
|
|
form=>{r=>$self->to_json(\%s)}, |
59
|
|
|
|
|
|
|
$callback, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
1; |