Beispiel #1
0
        internal static List <FriendCategory> GetList(SmartQQClientBuilder client)
        {
            Logger.Instance.Debug("开始获取好友列表");
            var response = client.Client.PostAsync(ApiUrl.GetFriendList,
                                                   new JObject {
                { "vfwebqq", client.Vfwebqq }, { "hash", client.Hash }
            });
            var result = (JObject)client.GetResponseJson(response.Result)["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());
        }
Beispiel #2
0
        public static List <FriendStatus> GetList(SmartQQClientBuilder client)
        {
            Logger.Instance.Debug("开始获取好友状态列表");
            var response = client.Client.GetAsync(ApiUrl.GetFriendStatus, client.Vfwebqq, client.Psessionid);

            return
                (((JArray)client.GetResponseJson(response.Result)["result"])
                 .ToObject <List <FriendStatus> >());
        }
Beispiel #3
0
        internal static List <ChatHistory> GetList(SmartQQClientBuilder client)
        {
            //SmartQQClient.Logger.Debug("开始获取最近聊天记录列表");
            var response = client.Client.PostAsync(ApiUrl.GetChatHistoryList,
                                                   new JObject {
                { "vfwebqq", client.Vfwebqq }, { "clientid", SmartQQClientBuilder.ClientId }, { "psessionid", "" }
            });

            return
                (((JArray)client.GetResponseJson(response.Result)["result"])
                 .ToObject <List <ChatHistory> >());
        }
Beispiel #4
0
        internal static List <Discussion> GetList(SmartQQClientBuilder client)
        {
            Logger.Instance.Debug("开始获取讨论组列表");
            var response = client.Client.GetAsync(ApiUrl.GetDiscussionList, client.Psessionid, client.Vfwebqq,
                                                  RandomHelper.GetRandomDouble());
            var result =
                ((JArray)((JObject)client.GetResponseJson(response.Result)["result"])["dnamelist"])
                .ToObject <List <Discussion> >();

            result.ForEach(_ => _.Client = client);
            return(result);
        }
Beispiel #5
0
        internal static List <Group> GetList(SmartQQClientBuilder client)
        {
            Logger.Instance.Debug("开始获取群列表");
            var response = client.Client.PostAsync(ApiUrl.GetGroupList,
                                                   new JObject {
                { "vfwebqq", client.Vfwebqq }, { "hash", client.Hash }
            });
            var result =
                ((JArray)((JObject)client.GetResponseJson(response.Result)["result"])["gnamelist"])
                .ToObject <List <Group> >();

            result.ForEach(_ => _.Client = client);
            return(result);
        }
Beispiel #6
0
        internal static List <Friend> GetList(SmartQQClientBuilder client)
        {
            Logger.Instance.Debug("开始获取好友列表");
            var response = client.Client.PostAsync(ApiUrl.GetFriendList,
                                                   new JObject {
                { "vfwebqq", client.Vfwebqq }, { "hash", client.Hash }
            });
            var result = (JObject)client.GetResponseJson(response.Result)["result"];
            //获得好友信息
            var friendDictionary = SmartQQClientBuilder.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);
        }