line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
my %FACE_MAP = qw( |
2
|
|
|
|
|
|
|
0 惊讶 |
3
|
|
|
|
|
|
|
1 撇嘴 |
4
|
|
|
|
|
|
|
2 色 |
5
|
|
|
|
|
|
|
3 发呆 |
6
|
|
|
|
|
|
|
4 得意 |
7
|
|
|
|
|
|
|
5 流泪 |
8
|
|
|
|
|
|
|
6 害羞 |
9
|
|
|
|
|
|
|
7 闭嘴 |
10
|
|
|
|
|
|
|
8 睡 |
11
|
|
|
|
|
|
|
9 大哭 |
12
|
|
|
|
|
|
|
10 尴尬 |
13
|
|
|
|
|
|
|
11 发怒 |
14
|
|
|
|
|
|
|
12 调皮 |
15
|
|
|
|
|
|
|
13 呲牙 |
16
|
|
|
|
|
|
|
14 微笑 |
17
|
|
|
|
|
|
|
21 飞吻 |
18
|
|
|
|
|
|
|
23 跳跳 |
19
|
|
|
|
|
|
|
25 发抖 |
20
|
|
|
|
|
|
|
26 怄火 |
21
|
|
|
|
|
|
|
27 爱情 |
22
|
|
|
|
|
|
|
29 足球 |
23
|
|
|
|
|
|
|
32 西瓜 |
24
|
|
|
|
|
|
|
33 玫瑰 |
25
|
|
|
|
|
|
|
34 凋谢 |
26
|
|
|
|
|
|
|
36 爱心 |
27
|
|
|
|
|
|
|
37 心碎 |
28
|
|
|
|
|
|
|
38 蛋糕 |
29
|
|
|
|
|
|
|
39 礼物 |
30
|
|
|
|
|
|
|
42 太阳 |
31
|
|
|
|
|
|
|
45 月亮 |
32
|
|
|
|
|
|
|
46 强 |
33
|
|
|
|
|
|
|
47 弱 |
34
|
|
|
|
|
|
|
50 难过 |
35
|
|
|
|
|
|
|
51 酷 |
36
|
|
|
|
|
|
|
53 抓狂 |
37
|
|
|
|
|
|
|
54 吐 |
38
|
|
|
|
|
|
|
55 惊恐 |
39
|
|
|
|
|
|
|
56 流汗 |
40
|
|
|
|
|
|
|
57 憨笑 |
41
|
|
|
|
|
|
|
58 大兵 |
42
|
|
|
|
|
|
|
59 猪头 |
43
|
|
|
|
|
|
|
62 拥抱 |
44
|
|
|
|
|
|
|
63 咖啡 |
45
|
|
|
|
|
|
|
64 饭 |
46
|
|
|
|
|
|
|
71 握手 |
47
|
|
|
|
|
|
|
72 便便 |
48
|
|
|
|
|
|
|
73 偷笑 |
49
|
|
|
|
|
|
|
74 可爱 |
50
|
|
|
|
|
|
|
75 白眼 |
51
|
|
|
|
|
|
|
76 傲慢 |
52
|
|
|
|
|
|
|
77 饥饿 |
53
|
|
|
|
|
|
|
78 困 |
54
|
|
|
|
|
|
|
79 奋斗 |
55
|
|
|
|
|
|
|
80 咒骂 |
56
|
|
|
|
|
|
|
81 疑问 |
57
|
|
|
|
|
|
|
82 嘘 |
58
|
|
|
|
|
|
|
83 晕 |
59
|
|
|
|
|
|
|
84 折磨 |
60
|
|
|
|
|
|
|
85 衰 |
61
|
|
|
|
|
|
|
86 骷髅 |
62
|
|
|
|
|
|
|
87 敲打 |
63
|
|
|
|
|
|
|
88 再见 |
64
|
|
|
|
|
|
|
91 闪电 |
65
|
|
|
|
|
|
|
92 炸弹 |
66
|
|
|
|
|
|
|
93 刀 |
67
|
|
|
|
|
|
|
95 胜利 |
68
|
|
|
|
|
|
|
96 冷汗 |
69
|
|
|
|
|
|
|
97 擦汗 |
70
|
|
|
|
|
|
|
98 抠鼻 |
71
|
|
|
|
|
|
|
99 鼓掌 |
72
|
|
|
|
|
|
|
100 糗大了 |
73
|
|
|
|
|
|
|
101 坏笑 |
74
|
|
|
|
|
|
|
102 左哼哼 |
75
|
|
|
|
|
|
|
103 右哼哼 |
76
|
|
|
|
|
|
|
104 哈欠 |
77
|
|
|
|
|
|
|
105 鄙视 |
78
|
|
|
|
|
|
|
106 委屈 |
79
|
|
|
|
|
|
|
107 快哭了 |
80
|
|
|
|
|
|
|
108 阴险 |
81
|
|
|
|
|
|
|
109 亲亲 |
82
|
|
|
|
|
|
|
110 吓 |
83
|
|
|
|
|
|
|
111 可怜 |
84
|
|
|
|
|
|
|
112 菜刀 |
85
|
|
|
|
|
|
|
113 啤酒 |
86
|
|
|
|
|
|
|
114 篮球 |
87
|
|
|
|
|
|
|
115 乒乓 |
88
|
|
|
|
|
|
|
116 示爱 |
89
|
|
|
|
|
|
|
117 瓢虫 |
90
|
|
|
|
|
|
|
118 抱拳 |
91
|
|
|
|
|
|
|
119 勾引 |
92
|
|
|
|
|
|
|
120 拳头 |
93
|
|
|
|
|
|
|
121 差劲 |
94
|
|
|
|
|
|
|
122 爱你 |
95
|
|
|
|
|
|
|
123 NO |
96
|
|
|
|
|
|
|
124 OK |
97
|
|
|
|
|
|
|
125 转圈 |
98
|
|
|
|
|
|
|
126 磕头 |
99
|
|
|
|
|
|
|
127 回头 |
100
|
|
|
|
|
|
|
128 跳绳 |
101
|
|
|
|
|
|
|
129 挥手 |
102
|
|
|
|
|
|
|
130 激动 |
103
|
|
|
|
|
|
|
131 街舞 |
104
|
|
|
|
|
|
|
132 献吻 |
105
|
|
|
|
|
|
|
133 左太极 |
106
|
|
|
|
|
|
|
134 右太极 |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
my %FACEID_MAP = reverse %FACE_MAP; |
109
|
|
|
|
|
|
|
sub Mojo::Webqq::face_to_txt{ |
110
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
111
|
0
|
|
|
|
|
|
my $face = shift; |
112
|
0
|
0
|
|
|
|
|
if(ref $face eq 'ARRAY'){ |
113
|
0
|
0
|
|
|
|
|
return "[未知表情]" if $face->[0] ne "face"; |
114
|
0
|
0
|
|
|
|
|
return "[表情]" if $face->[1] == 0; |
115
|
0
|
0
|
|
|
|
|
return "[表情]" unless exists $FACE_MAP{$face->[1]}; |
116
|
0
|
|
|
|
|
|
return "[" . $FACE_MAP{$face->[1]} . "]"; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
else{ |
119
|
0
|
|
|
|
|
|
return $face; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
sub Mojo::Webqq::face_parse { |
123
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
124
|
0
|
|
|
|
|
|
my $data = shift; |
125
|
0
|
|
|
|
|
|
my @result; |
126
|
0
|
|
|
|
|
|
my $index = 0; |
127
|
0
|
|
|
|
|
|
my $last_face_start = undef; |
128
|
0
|
|
|
|
|
|
my $last_face_end = undef; |
129
|
0
|
|
|
|
|
|
while($data=~/\[[^\[\]]+\]/g){ |
130
|
0
|
|
|
|
|
|
my $face = substr($&,1,length($&)-2); |
131
|
0
|
0
|
|
|
|
|
if(exists $FACEID_MAP{$face}){ |
132
|
0
|
|
|
|
|
|
$last_face_start = $-[0]; |
133
|
0
|
|
|
|
|
|
$last_face_end = $+[0]-1; |
134
|
0
|
0
|
|
|
|
|
push @result,{content=>substr($data,$index,$-[0]-$index),type=>"txt"} if $-[0]-$index >0; |
135
|
0
|
|
|
|
|
|
push @result,{content=>$&,id=>$FACEID_MAP{$face},type=>"face"}; |
136
|
0
|
|
|
|
|
|
$index = $+[0]; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
} |
139
|
0
|
0
|
|
|
|
|
if(defined $last_face_end){ |
140
|
0
|
0
|
|
|
|
|
push @result,{content=>substr($data,$last_face_end+1),type=>"txt"} if $last_face_end+1 < length($data); |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
else{ |
143
|
0
|
|
|
|
|
|
push @result,{content=>$data,type=>"txt"}; |
144
|
|
|
|
|
|
|
} |
145
|
0
|
|
|
|
|
|
return \@result; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
1; |