From cd61f21a922fc18aa7a05d6fc1aaedd1dad6bdf2 Mon Sep 17 00:00:00 2001 From: dennydai Date: Mon, 15 Feb 2016 02:13:17 +0800 Subject: [PATCH] add WebQQ support. --- classes/WebQQ/Base.php | 48 ++++++++++++++++++++++++++++ classes/WebQQ/heartbeats.php | 61 ++++++++++++++++++++++++++++++++++++ classes/WebQQ/init.php | 13 ++++++++ config.php | 4 +++ 4 files changed, 126 insertions(+) create mode 100644 classes/WebQQ/Base.php create mode 100644 classes/WebQQ/heartbeats.php create mode 100644 classes/WebQQ/init.php diff --git a/classes/WebQQ/Base.php b/classes/WebQQ/Base.php new file mode 100644 index 0000000..5b0bd59 --- /dev/null +++ b/classes/WebQQ/Base.php @@ -0,0 +1,48 @@ + 1) { + $sp_num = floor(strlen($msg)/300); + for ($i=0; $i < $sp_num; $i++) { + $sp[$i] = substr($msg,$i*300,300); + } + foreach ($sp as $sps) { + if($isgroup){ + $this->post('http://d1.web2.qq.com/channel/send_qun_msg2','r={"group_uin":'.$id.',"content":"[\"'.$sps.'\",[\"font\",{\"name\":\"\",\"size\":10,\"style\":[0,0,0],\"color\":\"000000\"}]]","face":0,"clientid":53999199,"msg_id":0,"psessionid":""}'); + }else{ + $this->post('http://d1.web2.qq.com/channel/send_buddy_msg2','r={"to":'.$id.',"content":"[\"'.$sps.'\",[\"font\",{\"name\":\"\",\"size\":10,\"style\":[0,0,0],\"color\":\"000000\"}]]","face":0,"clientid":53999199,"msg_id":0,"psessionid":""}'); + } + } + }else{ + if($isgroup){ + $this->post('http://d1.web2.qq.com/channel/send_qun_msg2','r={"group_uin":'.$id.',"content":"[\"'.$msg.'\",[\"font\",{\"name\":\"\",\"size\":10,\"style\":[0,0,0],\"color\":\"000000\"}]]","face":0,"clientid":53999199,"msg_id":0,"psessionid":""}'); + }else{ + $this->post('http://d1.web2.qq.com/channel/send_buddy_msg2','r={"to":'.$id.',"content":"[\"'.$msg.'\",[\"font\",{\"name\":\"\",\"size\":10,\"style\":[0,0,0],\"color\":\"000000\"}]]","face":0,"clientid":53999199,"msg_id":0,"psessionid":""}'); + } + } + return 1; + } +} \ No newline at end of file diff --git a/classes/WebQQ/heartbeats.php b/classes/WebQQ/heartbeats.php new file mode 100644 index 0000000..0b22000 --- /dev/null +++ b/classes/WebQQ/heartbeats.php @@ -0,0 +1,61 @@ + 0, 'uin' => $from_uin, 'msg' => $content))); + echo json_encode(array('type' => 0, 'uin' => $from_uin, 'msg' => $content)); + Heartbeats(); + break; + case 'group_message': + $_content=$json['result'][0]['value']['content']; + unset($_content[0]); + $content=convert_multi_array($_content); + $from_uin=$json['result'][0]['value']['from_uin']; + post(ROOT_URL.'WebQQ.php',json_encode(array('type' => 0, 'uin' => $from_uin, 'msg' => $content))); + echo json_encode(array('type' => 1, 'uin' => $from_uin, 'msg' => $content)); + Heartbeats(); + break; + default: + Heartbeats(); + break; + } +} + + + +function convert_multi_array($array) { + $out = implode(array_map(function($a) {if (is_array($a)){return '';} return $a;},$array));//ignore old qq emoticon... + return $out; +} +Heartbeats(); +?> \ No newline at end of file diff --git a/classes/WebQQ/init.php b/classes/WebQQ/init.php new file mode 100644 index 0000000..fa30a8c --- /dev/null +++ b/classes/WebQQ/init.php @@ -0,0 +1,13 @@ +