/** * <p> * processGroupMsg. * </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 processGroupMsg(JSONObject pollData) { // {"retcode"in0,"result"in[{"poll_type"in"group_message", // "value"in{"msg_id"in6175,"from_uin"in3924684389,"to_uin"in1070772010,"msg_id2"in992858,"msg_type"in43,"reply_ip"in176621921, // "group_code"in3439321257,"send_uin"in1843694270,"seq"in875,"time"in1365934781,"info_seq"in170125666,"content"in[["font",{"size"in10,"color"in"3b3b3b","style"in[0,0,0],"name"in"\u5FAE\u8F6F\u96C5\u9ED1"}],"eeeeeeeee "]}}]} QQStore store = getContext().getStore(); QQMsg msg = new QQMsg(); msg.setId(pollData.getLong("msg_id")); msg.setId2(pollData.getLong("msg_id2")); int msgType = pollData.getInt("msg_type"); long gin = pollData.getLong("from_uin"); long fromUin = pollData.getLong("send_uin"); long groupCode = pollData.getLong("group_code"); QQGroup group = store.getGroupByCode(groupCode); long groupID = -1; if (group == null) { group = new QQGroup(); group.setGin(gin); group.setCode(groupCode); // put to store store.addGroup(group); } switch (msgType) { case 32: { // 魔法、超级、涂鸦表情 groupID = pollData.getLong("t_gcode"); // 真实群号码 break; } case 43: // 一般消息 groupID = pollData.getLong("info_seq"); // 真实群号码 msg.parseContentList(pollData.getJSONArray("content").ToString()); msg.setType(QQMsg.Type.GROUP_MSG); msg.setDate(new DateTime(pollData.getLong("time") * 1000)); break; default: break; } if (group.getGid() <= 0) { group.setGid(groupID); } msg.setGroup(group); if (group != null) { msg.setFrom(group.getMemberByUin(fromUin)); } msg.setTo(getContext().getAccount()); if (msg.getFrom() == null) { QQGroupMember member = new QQGroupMember(); member.setUin(fromUin); msg.setFrom(member); if (group != null) { group.getMembers().Add(member); } } return(new QQNotifyEvent(QQNotifyEvent.Type.CHAT_MSG, msg)); }