internal static List <FriendCategory> GetList(DumbQQClient client) { DumbQQClient.Logger.Debug("开始获取好友列表"); var response = client.Client.Post(ApiUrl.GetFriendList, new JObject { { "vfwebqq", client.Vfwebqq }, { "hash", client.Hash } }); var result = (JObject)client.GetResponseJson(response)["result"]; //获得分组 var categories = result["categories"] as JArray; var categoryDictionary = new Dictionary <int, FriendCategory> { { 0, DefaultCategory() } }; for (var i = 0; categories != null && i < categories.Count; i++) { var category = categories[i].ToObject <FriendCategory>(); categoryDictionary.Add(category.Index, category); } foreach (var category in categoryDictionary.Values) { category.Client = client; } return(categoryDictionary.Select(_ => _.Value).ToList()); }
internal static List <FriendStatus> GetList(DumbQQClient client) { DumbQQClient.Logger.Debug("开始获取好友状态列表"); var response = client.Client.Get(ApiUrl.GetFriendStatus, client.Vfwebqq, client.Psessionid); return (((JArray)client.GetResponseJson(response)["result"]) .ToObject <List <FriendStatus> >()); }
internal static List <ChatHistory> GetList(DumbQQClient client) { DumbQQClient.Logger.Debug("开始获取最近聊天记录列表"); var response = client.Client.Post(ApiUrl.GetChatHistoryList, new JObject { { "vfwebqq", client.Vfwebqq }, { "clientid", DumbQQClient.ClientId }, { "psessionid", "" } }); return (((JArray)client.GetResponseJson(response)["result"]) .ToObject <List <ChatHistory> >()); }
internal static List <Discussion> GetList(DumbQQClient client) { DumbQQClient.Logger.Debug("开始获取讨论组列表"); var response = client.Client.Get(ApiUrl.GetDiscussionList, client.Psessionid, client.Vfwebqq, RandomHelper.GetRandomDouble()); var result = ((JArray)((JObject)client.GetResponseJson(response)["result"])["dnamelist"]) .ToObject <List <Discussion> >(); result.ForEach(_ => _.Client = client); return(result); }
internal static List <Group> GetList(DumbQQClient client) { DumbQQClient.Logger.Debug("开始获取群列表"); var response = client.Client.Post(ApiUrl.GetGroupList, new JObject { { "vfwebqq", client.Vfwebqq }, { "hash", client.Hash } }); var result = ((JArray)((JObject)client.GetResponseJson(response)["result"])["gnamelist"]) .ToObject <List <Group> >(); result.ForEach(_ => _.Client = client); return(result); }
internal static List <Friend> GetList(DumbQQClient client) { DumbQQClient.Logger.Debug("开始获取好友列表"); var response = client.Client.Post(ApiUrl.GetFriendList, new JObject { { "vfwebqq", client.Vfwebqq }, { "hash", client.Hash } }); var result = (JObject)client.GetResponseJson(response)["result"]; //获得好友信息 var friendDictionary = DumbQQClient.ParseFriendDictionary(result); var friends = result["friends"] as JArray; for (var i = 0; friends != null && i < friends.Count; i++) { var item = (JObject)friends[i]; friendDictionary[item["uin"].Value <long>()].CategoryIndex = item["categories"].Value <int>(); } var value = friendDictionary.Select(_ => _.Value).ToList(); value.ForEach(_ => _.Client = client); return(value); }