/** * <p> * processDiscuzMsg. * </p> * * @param pollData * a {@link org.json.JSONObject} object. * @throws org.json.JSONException * if any. * @throws iqq.im.QQException * if any. * @return a {@link iqq.im.event.QQNotifyEvent} object. */ public QQNotifyEvent processDiscuzMsg(JSONObject pollData) { QQStore store = getContext().getStore(); QQMsg msg = new QQMsg(); long fromUin = pollData.getLong("send_uin"); long did = pollData.getLong("did"); msg.parseContentList(pollData.getJSONArray("content").ToString()); msg.setType(QQMsg.Type.DISCUZ_MSG); msg.setDiscuz(store.getDiscuzByDid(did)); msg.setTo(getContext().getAccount()); msg.setDate(new DateTime(pollData.getLong("time") * 1000)); if (msg.getDiscuz() != null) { msg.setFrom(msg.getDiscuz().getMemberByUin(fromUin)); } if (msg.getFrom() == null) { QQDiscuzMember member = new QQDiscuzMember(); member.setUin(fromUin); msg.setFrom(member); if (msg.getDiscuz() != null) { msg.getDiscuz().getMembers().Add(member); } } return(new QQNotifyEvent(QQNotifyEvent.Type.CHAT_MSG, msg)); }
/** {@inheritDoc} */ public override QQHttpRequest onBuildRequest() { // r:{"to":2982077931,"face":0,"content":"[\"123\",[\"face\",1],\"456\",[\"face\",0],\"\",\"\\n【提示:此用户正在使用Q+ Web:http://web.qq.com/】\",[\"font\",{\"name\":\"微软雅黑\",\"size\":\"11\",\"style\":[0,0,0],\"color\":\"ffcc99\"}]]","msg_id":91310001,"clientid":"74131454","psessionid":"8368046764001e636f6e6e7365727665725f77656271714031302e3133332e34312e3230320000230700001f01026e04002aafd23f6d0000000a40484a526f4866467a476d00000028d954c71693cd99ae8c0c64b651519e88f55ce5075140346da7d957f3abefb51d0becc25c425d7cf5"} // r:{"group_uin":3408869879,"content":"[\"群消息发送测试\",[\"face\",13],\"\",\"\\n【提示:此用户正在使用Q+ Web:http://web.qq.com/】\",[\"font\",{\"name\":\"微软雅黑\",\"size\":\"11\",\"style\":[0,0,0],\"color\":\"ffcc99\"}]]","msg_id":91310002,"clientid":"74131454","psessionid":"8368046764001e636f6e6e7365727665725f77656271714031302e3133332e34312e3230320000230700001f01026e04002aafd23f6d0000000a40484a526f4866467a476d00000028d954c71693cd99ae8c0c64b651519e88f55ce5075140346da7d957f3abefb51d0becc25c425d7cf5"} // clientid、psessionid QQSession session = getContext().getSession(); JSONObject json = new JSONObject(); QQHttpRequest req = null; if (msg.getType() == QQMsg.Type.BUDDY_MSG) { req = createHttpRequest("POST", QQConstants.URL_SEND_BUDDY_MSG); json.put("to", msg.getTo().getUin()); json.put("face", 0); // 这个是干嘛的?? } else if (msg.getType() == QQMsg.Type.GROUP_MSG) { req = createHttpRequest("POST", QQConstants.URL_SEND_GROUP_MSG); json.put("group_uin", msg.getGroup().getGin()); // json.put("key", session.getCfaceKey()); // json.put("sig", session.getCfaceSig()); } else if (msg.getType() == QQMsg.Type.DISCUZ_MSG) { req = createHttpRequest("POST", QQConstants.URL_SEND_DISCUZ_MSG); json.put("did", msg.getDiscuz().getDid()); json.put("key", session.getCfaceKey()); json.put("sig", session.getCfaceSig()); } else if (msg.getType() == QQMsg.Type.SESSION_MSG) // 临时会话消息 { req = createHttpRequest("POST", QQConstants.URL_SEND_SESSION_MSG); QQStranger member = (QQStranger)msg.getTo(); json.put("to", member.getUin()); json.put("face", 0); // 这个是干嘛的?? json.put("group_sig", member.getGroupSig()); json.put("service_type", member.getServiceType() + ""); } else { } json.put("content", msg.packContentList()); json.put("msg_id", 91310001 + ""); json.put("clientid", session.getClientId()); json.put("psessionid", session.getSessionId()); req.addPostValue("r", json.ToString()); req.addPostValue("clientid", session.getClientId() + ""); req.addPostValue("psessionid", session.getSessionId()); req.addHeader("Referer", QQConstants.REFFER); return(req); }
/* (non-Javadoc) * @see iqq.im.action.AbstractHttpAction#onBuildRequest() */ /** {@inheritDoc} */ public override QQHttpRequest onBuildRequest() { QQHttpRequest req = createHttpRequest("GET", QQConstants.URL_GET_GROUP_PIC); // fid 3648788200 // gid 2890126166 // pic {F2B04C26-9087-437D-4FD9-6A0ED84155FD}.jpg // rip 123.138.154.167 // rport 8000 // t 1365343106 // type 0 // uin 3559750777 // vfwebqq 70b5f77bfb1db1367a2ec483ece317ea9ef119b9b59e542b2e8586f7ede6030ff56f7ba8798ba34b // "cface", // { // "name": "{F2B04C26-9087-437D-4FD9-6A0ED84155FD}.jpg", // "file_id": 3648788200, // "key": "pcm4N6IKmQ852Pus", // "server": "123.138.154.167:8000" // } QQSession session = getContext().getSession(); req.addGetValue("fid", cface.getFileId() + ""); req.addGetValue("gid", (msg.getGroup() != null ? msg.getGroup().getCode(): msg.getDiscuz().getDid()) + ""); req.addGetValue("pic", cface.getFileName()); String[] parts = cface.getServer().Split(':'); req.addGetValue("rip", parts[0]); req.addGetValue("rport", parts[1]); req.addGetValue("t", DateTime.Now.Ticks / 1000 + ""); req.addGetValue("type", msg.getGroup() != null ? "0" : "1"); req.addGetValue("uin", msg.getFrom().getUin() + ""); req.addGetValue("vfwebqq", session.getVfwebqq()); //req.setOutputStream(picOut); return(req); }