/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { Regex pt = new Regex(QQConstants.REGXP_LOGIN); Match mc = pt.Match(response.getResponseString()); if (mc.Success) { int ret = int.Parse(mc.Groups[1].Value); switch (ret) { case 0: notifyActionEvent(QQActionEvent.Type.EVT_OK, mc.Groups[3].Value); break; case 3: throw new QQException(QQWpfApplication1.evt.QQException.QQErrorCode.WRONG_PASSWORD, mc.group(5)); case 4: throw new QQException(QQWpfApplication1.evt.QQException.QQErrorCode.WRONG_CAPTCHA, mc.group(5)); case 7: throw new QQException(QQWpfApplication1.evt.QQException.QQErrorCode.IO_ERROR, mc.Groups[5].Value); default: throw new QQException(QQWpfApplication1.evt.QQException.QQErrorCode.INVALID_USER, mc.Groups[5].Value); } } else { throw new QQException(QQWpfApplication1.evt.QQException.QQErrorCode.UNEXPECTED_RESPONSE) } }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { /* * {"retcode":0,"result": * {"face":0,"birthday":{"month":0,"year":0,"day":0}, * "phone":"","occupation":"","allow":1,"college":"","uin":2842465527,"blood":0, * "constel":0,"homepage":"","stat":10,"country":"","city":"","personal":"","nick":"平凡", * "shengxiao":0,"email":"","token":"d04e802bda6ff115e31c3792199f15aa74f92eb435e75d93", * "client_type":1,"province":"","gender":"male","mobile":"-"}} */ try{ JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { JSONObject obj = json.getJSONObject("result"); //try { // user.setBirthday(DateUtils.parse(obj.getJSONObject("birthday"))); //} catch (ParseException e) { // user.setBirthday(null); //} user.setOccupation(obj.getString("occupation")); user.setPhone(obj.getString("phone")); //user.setAllow(QQAllow.values()[obj.getInt("allow")]); user.setCollege(obj.getString("college")); if (obj.has("reg_time")) { user.setRegTime(obj.getInt("reg_time")); } user.setUin(obj.getLong("uin")); user.setConstel(obj.getInt("constel")); user.setBlood(obj.getInt("blood")); user.setHomepage(obj.getString("homepage")); user.setStat(obj.getInt("stat")); if (obj.has("vip_info")) { user.setVipLevel(obj.getInt("vip_info")); // VIP等级 0为非VIP } user.setCountry(obj.getString("country")); user.setCity(obj.getString("city")); user.setPersonal(obj.getString("personal")); user.setNickname(obj.getString("nick")); user.setChineseZodiac(obj.getInt("shengxiao")); user.setEmail("email"); user.setProvince(obj.getString("province")); user.setGender(obj.getString("gender")); user.setMobile(obj.getString("mobile")); // if (obj.has("client_type")) { // user.setClientType(QQClientType.valueOfRaw(obj.getInt("client_type"))); // } } } catch (Exception e) { } notifyActionEvent(QQActionEvent.Type.EVT_OK, user); }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { JSONObject obj = json.getJSONObject("result"); buddy.setQQ(obj.getLong("account")); } notifyActionEvent(QQActionEvent.Type.EVT_OK, buddy); }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { JSONArray result = json.getJSONArray("result"); JSONObject obj = result.getJSONObject(0); buddy.setSign(obj.getString("lnick")); } notifyActionEvent(QQActionEvent.Type.EVT_OK, buddy); }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { // {"result":null,"retcode":0} JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { notifyActionEvent(QQActionEvent.Type.EVT_OK, getContext().getStore().getGroupList()); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, QQWpfApplication1.action.QQException.QQErrorCode.UNEXPECTED_RESPONSE); } }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { getContext().getAccount().setStatus(status); notifyActionEvent(QQActionEvent.Type.EVT_OK, status); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, new QQException(QQWpfApplication1.action.QQException.QQErrorCode.UNEXPECTED_RESPONSE, response.getResponseString())); } }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); int retcode = json.getInt("retcode"); if (retcode == 0) { String result = json.getString("result"); if (result.Equals("ok")) { notifyActionEvent(QQActionEvent.Type.EVT_OK, msg); return; } } notifyActionEvent(QQActionEvent.Type.EVT_ERROR, new QQException(QQWpfApplication1.action.QQException.QQErrorCode.UNEXPECTED_RESPONSE, json.ToString())); }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(new JSONTokener(new StringReader(response.getResponseString()))); String isOK = json.getString("result"); if (json.getInt("retcode") == 0) { if (isOK.Equals("ok", StringComparison.OrdinalIgnoreCase)) { notifyActionEvent(QQActionEvent.Type.EVT_OK, isOK); return; } } notifyActionEvent(QQActionEvent.Type.EVT_ERROR, isOK); }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { Regex pt = new Regex(QQConstants.REGXP_LOGIN_SIG); Match mc = pt.Match(response.getResponseString()); if (mc.Success) { QQSession session = getContext().getSession(); session.setLoginSig(mc.Groups[1].Value); notifyActionEvent(QQActionEvent.Type.EVT_OK, session.getLoginSig()); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, new QQException(QQWpfApplication1.action.QQException.QQErrorCode.INVALID_RESPONSE, "Login Sig Not Found!!")); } }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { // {"retcode":0,"result":{"gmasklist":[{"gid":1000,"mask":0},{"gid":1638195794,"mask":0},{"gid":321105219,"mask":0}], // "gnamelist":[{"flag":16777217,"name":"iQQ","gid":1638195794,"code":2357062609},{"flag":1048577,"name":"iQQ核心开发区","gid":321105219,"code":640215156}],"gmarklist":[]}} QQStore store = getContext().getStore(); JSONObject json = new JSONObject(response.getResponseString()); int retcode = json.getInt("retcode"); if (retcode == 0) { // 处理好友列表 JSONObject results = json.getJSONObject("result"); JSONArray groupJsonList = results.getJSONArray("gnamelist"); // 群列表 JSONArray groupMaskJsonList = results.getJSONArray("gmasklist"); //禁止接收群消息标志:正常 0, 接收不提醒 1, 完全屏蔽 2 for (int i = 0; i < groupJsonList.length(); i++) { JSONObject groupJson = groupJsonList.getJSONObject(i); QQGroup group = new QQGroup(); group.setGin(groupJson.getLong("gid")); group.setCode(groupJson.getLong("code")); group.setFlag(groupJson.getInt("flag")); group.setName(groupJson.getString("name")); //添加到Store store.addGroup(group); } for (int i = 0; i < groupMaskJsonList.length(); i++) { JSONObject maskObj = groupMaskJsonList.getJSONObject(i); long gid = maskObj.getLong("gid"); int mask = maskObj.getInt("mask"); QQGroup group = store.getGroupByGin(gid); if (group != null) { group.setMask(mask); } } notifyActionEvent(QQActionEvent.Type.EVT_OK, store.getGroupList()); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, null); } }
public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); List <Object> recents = new List <Object>(); QQStore store = getContext().getStore(); if (json.getInt("retcode") == 0) { JSONArray result = json.getJSONArray("result"); for (int i = 0; i < result.length(); i++) { JSONObject rejson = result.getJSONObject(i); switch (rejson.getInt("type")) { case 0: { //好友 QQBuddy buddy = store.getBuddyByUin(rejson.getLong("uin")); if (buddy != null) { recents.Add(buddy); } } break; case 1: { //群 QQGroup group = store.getGroupByCode(rejson.getLong("uin")); if (group != null) { recents.Add(group); } } break; case 2: { //讨论组 QQDiscuz discuz = store.getDiscuzByDid(rejson.getLong("uin")); if (discuz != null) { recents.Add(discuz); } break; } } } notifyActionEvent(QQActionEvent.Type.EVT_OK, recents); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, new QQException(QQWpfApplication1.action.QQException.QQErrorCode.UNEXPECTED_RESPONSE)); } }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { QQSession session = getContext().getSession(); JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { JSONObject obj = json.getJSONObject("result"); session.setCfaceKey(obj.getString("gface_key")); session.setCfaceSig(obj.getString("gface_sig")); notifyActionEvent(QQActionEvent.Type.EVT_OK, session); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, new QQException(QQWpfApplication1.action.QQException.QQErrorCode.UNEXPECTED_RESPONSE, response.getResponseString())); } }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { JSONObject result = json.getJSONObject("result"); QQLevel level = user.getLevel(); level.setLevel(result.getInt("level")); level.setDays(result.getInt("days")); level.setHours(result.getInt("hours")); level.setRemainDays(result.getInt("remainDays")); notifyActionEvent(QQActionEvent.Type.EVT_OK, user); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, new QQException(QQWpfApplication1.action.QQException.QQErrorCode.UNEXPECTED_RESPONSE, response.getResponseString())); } }
public override void onHttpStatusOK(QQHttpResponse response) { // {"retcode":0,"result":{"type":0,"value":"sig","flags":{"text":1,"pic":1,"file":1,"audio":1,"video":1}}} JSONObject json = new JSONObject(response.getResponseString()); int retcode = json.getInt("retcode"); if (retcode == 0) { JSONObject result = json.getJSONObject("result"); if (result.has("value")) { user.setGroupSig(result.getString("value")); notifyActionEvent(QQActionEvent.Type.EVT_OK, user); return; } } notifyActionEvent(QQActionEvent.Type.EVT_ERROR, new QQException( QQWpfApplication1.action.QQException.QQErrorCode.UNEXPECTED_RESPONSE, json.ToString())); }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { JSONObject obj = json.getJSONObject("result"); //buddy.setBirthday(DateTime.FromBinary(obj.getJSONObject("birthday"))); buddy.setOccupation(obj.getString("occupation")); buddy.setPhone(obj.getString("phone")); //buddy.setAllow(QQAllow.values()[obj.getInt("allow")]); buddy.setCollege(obj.getString("college")); if (!obj.isNull("reg_time")) { buddy.setRegTime(obj.getInt("reg_time")); } buddy.setUin(obj.getLong("uin")); buddy.setConstel(obj.getInt("constel")); buddy.setBlood(obj.getInt("blood")); buddy.setHomepage(obj.getString("homepage")); buddy.setStat(obj.getInt("stat")); buddy.setVipLevel(obj.getInt("vip_info")); // VIP等级 0为非VIP buddy.setCountry(obj.getString("country")); buddy.setCity(obj.getString("city")); buddy.setPersonal(obj.getString("personal")); buddy.setNickname(obj.getString("nick")); buddy.setChineseZodiac(obj.getInt("shengxiao")); buddy.setEmail(obj.getString("email")); buddy.setProvince(obj.getString("province")); buddy.setGender(obj.getString("gender")); buddy.setMobile(obj.getString("mobile")); if (!obj.isNull("client_type")) { //buddy.setClientType(QQClientType.valueOfRaw(obj.getInt("client_type"))); } } notifyActionEvent(QQActionEvent.Type.EVT_OK, buddy); }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); QQStore store = getContext().getStore(); if (json.getInt("retcode") == 0) { JSONArray result = json.getJSONArray("result"); for (int i = 0; i < result.length(); i++) { JSONObject obj = result.getJSONObject(i); long uin = obj.getLong("uin"); String status = obj.getString("status"); int clientType = obj.getInt("client_type"); QQBuddy buddy = store.getBuddyByUin(uin); //buddy.setStatus(QQStatus.valueOfRaw(status)); //buddy.setClientType(QQClientType.valueOfRaw(clientType)); } } notifyActionEvent(QQActionEvent.Type.EVT_OK, store.getOnlineBuddyList()); }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { json = json.getJSONObject("result"); // 消除所有成员状态,如果不在线的,webqq是不会返回的。 foreach (QQGroupMember member in group.getMembers()) { member.setStatus(QQStatus.OFFLINE); //member.setClientType(QQClientType.UNKNOWN); } //result/stats JSONArray stats = json.getJSONArray("stats"); for (int i = 0; i < stats.length(); i++) { // 下面重新设置最新状态 JSONObject stat = stats.getJSONObject(i); QQGroupMember member = group.getMemberByUin(stat.getLong("uin")); if (member != null) { //member.setClientType(QQClientType.valueOfRaw(stat.getInt("client_type"))); //member.setStatus(QQStatus.valueOfRaw(stat.getInt("stat"))); } } notifyActionEvent(QQActionEvent.Type.EVT_OK, group); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, QQWpfApplication1.action.QQException.QQErrorCode.UNEXPECTED_RESPONSE); } }
public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); if (json.getInt("retcode") == 0) { json = json.getJSONObject("result"); JSONObject ginfo = json.getJSONObject("ginfo"); group.setMemo(ginfo.getString("memo")); group.setLevel(ginfo.getInt("level")); group.setCreateTime(DateTime.FromBinary(ginfo.getInt("createtime"))); JSONArray members = ginfo.getJSONArray("members"); for (int i = 0; i < members.length(); i++) { JSONObject memjson = members.getJSONObject(i); QQGroupMember member = group.getMemberByUin(memjson.getLong("muin")); if (member == null) { member = new QQGroupMember(); group.getMembers().Add(member); } member.setUin(memjson.getLong("muin")); member.setGroup(group); //memjson.getLong("mflag"); //TODO ... } //result/minfo JSONArray minfos = json.getJSONArray("minfo"); for (int i = 0; i < minfos.length(); i++) { JSONObject minfo = minfos.getJSONObject(i); QQGroupMember member = group.getMemberByUin(minfo.getLong("uin")); member.setNickname(minfo.getString("nick")); member.setProvince(minfo.getString("province")); member.setCountry(minfo.getString("country")); member.setCity(minfo.getString("city")); member.setGender(minfo.getString("gender")); } //result/stats JSONArray stats = json.getJSONArray("stats"); for (int i = 0; i < stats.length(); i++) { // 下面重新设置最新状态 JSONObject stat = stats.getJSONObject(i); QQGroupMember member = group.getMemberByUin(stat.getLong("uin")); //member.setClientType(QQClientType.valueOfRaw(stat.getInt("client_type"))); //member.setStatus(QQStatus.valueOfRaw(stat.getInt("stat"))); } //results/cards if (json.has("cards")) { JSONArray cards = json.getJSONArray("cards"); for (int i = 0; i < cards.length(); i++) { JSONObject card = cards.getJSONObject(i); QQGroupMember member = group.getMemberByUin(card.getLong("muin")); if (card != null && card.has("card") && member != null) { member.setCard(card.getString("card")); } } } //results/vipinfo JSONArray vipinfos = json.getJSONArray("vipinfo"); for (int i = 0; i < vipinfos.length(); i++) { JSONObject vipinfo = vipinfos.getJSONObject(i); QQGroupMember member = group.getMemberByUin(vipinfo.getLong("u")); member.setVipLevel(vipinfo.getInt("vip_level")); member.setVip(vipinfo.getInt("is_vip") == 1); } notifyActionEvent(QQActionEvent.Type.EVT_OK, group); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, QQWpfApplication1.action.QQException.QQErrorCode.UNEXPECTED_RESPONSE); } }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { QQStore store = getContext().getStore(); List <QQNotifyEvent> notifyEvents = new List <QQNotifyEvent>(); JSONObject json = new JSONObject(new JSONTokener(new StringReader(response.getResponseString()))); int retcode = json.getInt("retcode"); if (retcode == 0) { // 有可能为 {"retcode"in0,"result"in"ok"} if (!json.isNull("result") && json.get("result") is JSONArray) { JSONArray results = json.getJSONArray("result"); // 消息下载来的列表中是倒过来的,那我直接倒过来取,编位回来 for (int i = results.length() - 1; i >= 0; i--) { JSONObject poll = results.getJSONObject(i); String pollType = poll.getString("poll_type"); JSONObject pollData = poll.getJSONObject("value"); if (pollType.Equals("input_notify")) { long fromUin = pollData.getLong("from_uin"); QQBuddy buddy = store.getBuddyByUin(fromUin); notifyEvents.Add(new QQNotifyEvent(QQNotifyEvent.Type.BUDDY_INPUT, buddy)); } else if (pollType.Equals("message")) { // 好友消息 notifyEvents.Add(processBuddyMsg(pollData)); } else if (pollType.Equals("group_message")) { // 群消息 // 被管理员禁言10分钟{"retcode"in0,"result"in[{"poll_type"in"group_message","value"in{"msg_id"in20986,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in128032,"msg_type"in43,"reply_ip"in176756755,"group_code"in2227416282,"send_uin"in1900986400,"seq"in221,"time"in1419225537,"info_seq"in126658727,"content"in[["font",{"size"in10,"color"in"000000","style"in[0,0,0],"name"in"\u5B8B\u4F53"}],"\u674E\u519B(1002053815) \u88AB\u7BA1\u7406\u5458\u7981\u8A0010\u5206\u949F "]}}]} // 被管理员禁言1小时 // {"retcode"in0,"result"in[{"poll_type"in"group_message","value"in{"msg_id"in49336,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in198014,"msg_type"in43,"reply_ip"in176756884,"group_code"in2227416282,"send_uin"in1900986400,"seq"in224,"time"in1419225732,"info_seq"in126658727,"content"in[["font",{"size"in10,"color"in"000000","style"in[0,0,0],"name"in"\u5B8B\u4F53"}],"\u674E\u519B(1002053815) \u88AB\u7BA1\u7406\u5458\u7981\u8A001\u5C0F\u65F6 "]}}]} // 被管理员禁言解除 // {"retcode"in0,"result"in[{"poll_type"in"group_message","value"in{"msg_id"in60841,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in340248,"msg_type"in43,"reply_ip"in176498277,"group_code"in2227416282,"send_uin"in1900986400,"seq"in223,"time"in1419225681,"info_seq"in126658727,"content"in[["font",{"size"in10,"color"in"000000","style"in[0,0,0],"name"in"\u5B8B\u4F53"}],"\u674E\u519B(1002053815) \u88AB\u7BA1\u7406\u5458\u89E3\u9664\u7981\u8A00 "]}}]} // 群单纯图片消息 // {"retcode"in0,"result"in[{"poll_type"in"group_message","value"in{"msg_id"in14154,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in483355,"msg_type"in43,"reply_ip"in176489607,"group_code"in2227416282,"send_uin"in2388435354,"seq"in226,"time"in1419225894,"info_seq"in126658727,"content"in[["font",{"size"in10,"color"in"000000","style"in[0,0,0],"name"in"\u5FAE\u8F6F\u96C5\u9ED1"}],["cface",{"name"in"{99820253-D7C7-8EDC-3F1E-53B08AE5C390}.jpg","file_id"in2610173877,"key"in" ","server"in"183.60.50.34in80"}]," "]}}]} // 群文字与表情消息 // {"retcode"in0,"result"in[{"poll_type"in"group_message","value"in{"msg_id"in14155,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in279741,"msg_type"in43,"reply_ip"in176886363,"group_code"in2227416282,"send_uin"in2388435354,"seq"in227,"time"in1419226485,"info_seq"in126658727,"content"in[["font",{"size"in10,"color"in"000000","style"in[0,0,0],"name"in"\u5FAE\u8F6F\u96C5\u9ED1"}],"aa",["face",14]," "]}}]} // 超级表情 // {"retcode"in0,"result"in[{"poll_type"in"group_message","value"in{"msg_id"in57841,"from_uin"in2901943685,"to_uin"in1002053815,"msg_id2"in683745,"msg_type"in32,"reply_ip"in179898740,"group_code"in1226655265,"t_gcode"in260334785,"send_uin"in569398403,"seq"in19,"time"in1425015233,"info_seq"in37,"content"in[""]}}]} notifyEvents.Add(processGroupMsg(pollData)); } else if (pollType.Equals("discu_message")) { // 讨论组消息 notifyEvents.Add(processDiscuzMsg(pollData)); } else if (pollType.Equals("sess_message")) { // 临时会话消息 notifyEvents.Add(processSessionMsg(pollData)); } else if (pollType.Equals("shake_message")) { // 窗口震动 long fromUin = pollData.getLong("from_uin"); QQUser user = getContext().getStore().getBuddyByUin(fromUin); notifyEvents.Add(new QQNotifyEvent(QQNotifyEvent.Type.SHAKE_WINDOW, user)); } else if (pollType.Equals("kick_message")) { // 被踢下线 getContext().getAccount().setStatus(QQStatus.OFFLINE); getContext().getSession().setState(QQSession.State.KICKED); notifyEvents.Add(new QQNotifyEvent(QQNotifyEvent.Type.KICK_OFFLINE, pollData.getString("reason"))); } else if (pollType.Equals("buddies_status_change")) { notifyEvents.Add(processBuddyStatusChange(pollData)); } else if (pollType.Equals("group_web_message")) { // 点歌 // {"retcode"in0,"result"in[{"poll_type"in"group_web_message","value"in{"msg_id"in65528,"from_uin"in2901943685,"to_uin"in1002053815,"msg_id2"in751439,"msg_type"in45,"reply_ip"in176886319,"group_code"in1226655265,"group_type"in1,"ver"in1,"send_uin"in3706930015,"xml"in"\u0001\u0000\u0001 \u0000\t\u00D4 \u0000\u000F\u00C9\u00CB\u00D0\u00C4\u032B\u01BD\u00D1\u00F3-\u00C0\u00D7\u00E6\u00C3\u0000\u00EDtencentin//miniplayer/?cmd=1\u0026fuin=569398403\u0026frienduin=569398403\u0026groupid=4150334785\u0026groupcode=260334785\u0026action=\u0027accept\u0027\u0026mdlurl=\u0027httpin//scenecgi.chatshow.qq.com/fcgi-bin/gm_qry_music_info.fcg?songcount=1\u0026songidlist=644128\u0026version=207\u0026cmd=1\u0027\u0000\u00EDtencentin//miniplayer/?cmd=1\u0026fuin=569398403\u0026frienduin=569398403\u0026groupid=4150334785\u0026groupcode=260334785\u0026action=\u0027refuse\u0027\u0026mdlurl=\u0027httpin//scenecgi.chatshow.qq.com/fcgi-bin/gm_qry_music_info.fcg?songcount=1\u0026songidlist=644128\u0026version=207\u0026cmd=1\u0027"}}]} } else if (pollType.Equals("system_message")) { // 其他人 添加你为好友 // {"retcode"in0,"result"in[{"poll_type"in"system_message","value"in{"seq"in49219,"type"in"Added_buddy_sig","uiuin"in"","from_uin"in2388435354,"account"in569398403,"sig"in"Ub\u008A\u00B8\u00D4\u0001\u008B\u0092Q\u001D\"*W\u00F6b\u00EA\u001E\u00F0\u009A\u0016gqb\u00C7","stat"in20}}]} } else if (pollType.Equals("sys_g_msg")) { // 设置你为群管理员 // {"retcode"in0,"result"in[{"poll_type"in"sys_g_msg","value"in{"msg_id"in58825,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in584526,"msg_type"in44,"reply_ip"in180061855,"type"in"group_admin_op","gcode"in2227416282,"t_gcode"in126658727,"op_type"in1,"uin"in1002053815,"t_uin"in1002053815,"uin_flag"in1}}]} // 取消你为群管理员 // {"retcode"in0,"result"in[{"poll_type"in"sys_g_msg","value"in{"msg_id"in9211,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in265670,"msg_type"in44,"reply_ip"in176757008,"type"in"group_admin_op","gcode"in2227416282,"t_gcode"in126658727,"op_type"in0,"uin"in1002053815,"t_uin"in1002053815,"uin_flag"in0}}]} // 设置群成员为群管理员 // {"retcode"in0,"result"in[{"poll_type"in"sys_g_msg","value"in{"msg_id"in40322,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in183897,"msg_type"in44,"reply_ip"in179406747,"type"in"group_admin_op","gcode"in2227416282,"t_gcode"in126658727,"op_type"in1,"uin"in3904214993,"t_uin"in2564781987,"uin_flag"in1}}]} // 取消群成员为群管理员 // {"retcode"in0,"result"in[{"poll_type"in"sys_g_msg","value"in{"msg_id"in13045,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in15288,"msg_type"in44,"reply_ip"in176756443,"type"in"group_admin_op","gcode"in2227416282,"t_gcode"in126658727,"op_type"in0,"uin"in3904214993,"t_uin"in2564781987,"uin_flag"in0}}]} // 你已经被移除群 // {"retcode"in0,"result"in[{"poll_type"in"sys_g_msg","value"in{"msg_id"in5515,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in634857,"msg_type"in34,"reply_ip"in176488602,"type"in"group_leave","gcode"in2227416282,"t_gcode"in126658727,"op_type"in3,"old_member"in1002053815,"t_old_member"in"","admin_uin"in2388435354,"t_admin_uin"in"","admin_nick"in"\u521B\u5EFA\u8005"}}]} // 某人申请加入群 // {"retcode"in0,"result"in[{"poll_type"in"sys_g_msg","value"in{"msg_id"in9564,"from_uin"in848492696,"to_uin"in1002053815,"msg_id2"in366710,"msg_type"in35,"reply_ip"in176884836,"type"in"group_request_join","gcode"in2227416282,"t_gcode"in126658727,"request_uin"in3904214993,"t_request_uin"in"","msg"in"gggggg"}}]} } else { } } } // end recode == 0 } else if (retcode == 102) { // 接连正常,没有消息到达 {"retcode"in102,"errmsg"in""} // 继续进行下一个消息请求 } else if (retcode == 110 || retcode == 109) // 客户端主动退出 { getContext().getSession().setState(QQSession.State.OFFLINE); } else if (retcode == 116) { // 需要更新Ptwebqq值,暂时不知道干嘛用的 // {"retcode"in116,"p"in"2c0d8375e6c09f2af3ce60c6e081bdf4db271a14d0d85060"} // if (a.retcode === 116) alloy.portal.setPtwebqq(a.p) getContext().getSession().setPtwebqq(json.getString("p")); } else if (retcode == 121 || retcode == 120 || retcode == 100) // 121,120 // in // ReLinkFailure // 100 // in // NotReLogin // 服务器需求重新认证 // {"retcode"in121,"t"in"0"} { getContext().getSession().setState(QQSession.State.OFFLINE); QQException ex = new QQException(QQException.QQErrorCode.INVALID_LOGIN_AUTH); notifyActionEvent(QQActionEvent.Type.EVT_ERROR, ex); return; // notifyEvents.Add(new // QQNotifyEvent(QQNotifyEvent.Type.NEED_REAUTH, null)); } else { // 返回错误,核心遇到未知recode // getCxt().getSession().setState(QQSession.State.ERROR); notifyEvents.Add(new QQNotifyEvent(QQNotifyEvent.Type.UNKNOWN_ERROR, json)); } notifyActionEvent(QQActionEvent.Type.EVT_OK, notifyEvents); }
/** {@inheritDoc} */ public override void onHttpStatusOK(QQHttpResponse response) { JSONObject json = new JSONObject(response.getResponseString()); int retcode = json.getInt("retcode"); QQStore store = getContext().getStore(); if (retcode == 0) { // 处理好友列表 JSONObject results = json.getJSONObject("result"); // 获取JSON列表信息 JSONArray jsonCategories = results.getJSONArray("categories"); // 获取JSON好友基本信息列表 flag/uin/categories JSONArray jsonFriends = results.getJSONArray("friends"); // face/flag/nick/uin JSONArray jsonInfo = results.getJSONArray("info"); // uin/markname/ JSONArray jsonMarknames = results.getJSONArray("marknames"); // vip_level/u/is_vip JSONArray jsonVipinfo = results.getJSONArray("vipinfo"); // 默认好友列表 QQCategory c = new QQCategory(); c.setIndex(0); c.setName("我的好友"); c.setSort(0); store.addCategory(c); // 初始化好友列表 for (int i = 0; i < jsonCategories.length(); i++) { JSONObject jsonCategory = jsonCategories.getJSONObject(i); QQCategory qqc = new QQCategory(); qqc.setIndex(jsonCategory.getInt("index")); qqc.setName(jsonCategory.getString("name")); qqc.setSort(jsonCategory.getInt("sort")); store.addCategory(qqc); } // 处理好友基本信息列表 flag/uin/categories for (int i = 0; i < jsonFriends.length(); i++) { QQBuddy buddy = new QQBuddy(); JSONObject jsonFriend = jsonFriends.getJSONObject(i); long uin = jsonFriend.getLong("uin"); buddy.setUin(uin); buddy.setStatus(QQStatus.OFFLINE); // 添加到列表中 int category = jsonFriend.getInt("categories"); QQCategory qqCategory = store.getCategoryByIndex(category); buddy.setCategory(qqCategory); qqCategory.getBuddyList().Add(buddy); // 记录引用 store.addBuddy(buddy); } // face/flag/nick/uin for (int i = 0; i < jsonInfo.length(); i++) { JSONObject info = jsonInfo.getJSONObject(i); long uin = info.getLong("uin"); QQBuddy buddy = store.getBuddyByUin(uin); buddy.setNickname(info.getString("nick")); } // uin/markname for (int i = 0; i < jsonMarknames.length(); i++) { JSONObject jsonMarkname = jsonMarknames.getJSONObject(i); long uin = jsonMarkname.getLong("uin"); QQBuddy buddy = store.getBuddyByUin(uin); if(buddy != null){ buddy.setMarkname(jsonMarkname.getString("markname")); } } // vip_level/u/is_vip for (int i = 0; i < jsonVipinfo.length(); i++) { JSONObject vipInfo = jsonVipinfo.getJSONObject(i); long uin = vipInfo.getLong("u"); QQBuddy buddy = store.getBuddyByUin(uin); buddy.setVipLevel(vipInfo.getInt("vip_level")); int isVip = vipInfo.getInt("is_vip"); if(isVip != 0) { buddy.setVip(true); } else { buddy.setVip(false); } } notifyActionEvent(QQActionEvent.Type.EVT_OK, store.getCategoryList()); } else { notifyActionEvent(QQActionEvent.Type.EVT_ERROR, null); } }