public List<IUserDTO> GetUsersDTOFromScreenNames(IEnumerable<string> userScreenNames)
        {
            List<IUserDTO> usersDTO = new List<IUserDTO>();

            for (int i = 0; i < userScreenNames.Count(); i += MAX_LOOKUP_USERS)
            {
                var userScreenNamesToLookup = userScreenNames.Skip(i).Take(MAX_LOOKUP_USERS).ToList();
                usersDTO.AddRangeSafely(LookupUserScreenNames(userScreenNamesToLookup));
            }

            return usersDTO;
        }
Esempio n. 2
0
        public List <IUserDTO> GetUsersDTOFromScreenNames(IEnumerable <string> userScreenNames)
        {
            List <IUserDTO> usersDTO = new List <IUserDTO>();

            for (int i = 0; i < userScreenNames.Count(); i += MAX_LOOKUP_USERS)
            {
                var userScreenNamesToLookup = userScreenNames.Skip(i).Take(MAX_LOOKUP_USERS).ToList();
                usersDTO.AddRangeSafely(LookupUserScreenNames(userScreenNamesToLookup));
            }

            return(usersDTO);
        }
Esempio n. 3
0
        // Get Multiple users
        public List <IUserDTO> GetUsersDTOFromIds(IEnumerable <long> userIds)
        {
            var usersDTO = new List <IUserDTO>();

            for (int i = 0; i < userIds.Count(); i += MAX_LOOKUP_USERS)
            {
                var userIdsToLookup = userIds.Skip(i).Take(MAX_LOOKUP_USERS).ToList();
                var retrievedUsers  = LookupUserIds(userIdsToLookup);
                usersDTO.AddRangeSafely(retrievedUsers);

                if (retrievedUsers == null)
                {
                    break;
                }
            }

            return(usersDTO);
        }
        // Get Multiple users
        public List<IUserDTO> GetUsersDTOFromIds(IEnumerable<long> userIds)
        {
            var usersDTO = new List<IUserDTO>();

            for (int i = 0; i < userIds.Count(); i += MAX_LOOKUP_USERS)
            {
                var userIdsToLookup = userIds.Skip(i).Take(MAX_LOOKUP_USERS).ToList();
                var retrievedUsers = LookupUserIds(userIdsToLookup);
                usersDTO.AddRangeSafely(retrievedUsers);

                if (retrievedUsers == null)
                {
                    break;
                }
            }

            return usersDTO;
        }
Esempio n. 5
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            var notifyEvents = new List <QQNotifyEvent>();
            var str          = response.GetResponseString();
            var json         = JObject.Parse(str);
            var retcode      = json["retcode"].ToObject <int>();

            switch (retcode)
            {
            case 0:
            {
                //有可能为  {"retcode":0,"result":"ok"}
                var result = json["result"] as JArray;
                if (result != null)
                {
                    var msgs = GetAllMessagesWhenPollSuccess(result);
                    notifyEvents.AddRangeSafely(msgs);
                }
                break;
            }

            case 102:
                // 接连正常,没有消息到达 {"retcode":102,"errmsg":""}
                // 继续进行下一个消息请求
                break;

            case 110:
            case 109:
                // 客户端主动退出
                Context.Session.State = QQSessionState.Offline;
                break;

            case 116:
                // 需要更新Ptwebqq值,暂时不知道干嘛用的
                // {"retcode":116,"p":"2c0d8375e6c09f2af3ce60c6e081bdf4db271a14d0d85060"}
                // if (a.retcode === 116) alloy.portal.Ptwebqq = a.p)
                Context.Session.Ptwebqq = json["p"].ToString();
                break;


            case 121:
            case 120:
            case 100:
            {
                // 121,120 : ReLinkFailure		100 : NotRelogin
                // 服务器需求重新认证
                // {"retcode":121,"t":"0"}
                /*			LOG.info("**** NEED_REAUTH retcode: " + retcode + " ****");*/
                //Context.Logger.LogWarning($"**** NEED_REAUTH retcode: {retcode} ****");
                Context.Session.State = QQSessionState.Offline;
                //NotifyActionEvent(QQActionEventType.EVT_ERROR, ex);
                //return;
                throw new QQException(QQErrorCode.InvalidLoginAuth);
            }

            case 103:     // 此时需要登录Smart QQ,确认能收到消息后点击设置-退出登录,就会恢复正常了
            {
                Thread.Sleep(1000 * 30);
                Context.Session.State = QQSessionState.Offline;
                throw new QQException(QQErrorCode.NeedToLogin, str);
            }

            //notifyEvents.Add(new QQNotifyEvent(QQNotifyEventType.NEED_REAUTH, null));
            default:
                notifyEvents.Add(new QQNotifyEvent(QQNotifyEventType.UnknownError, str));
                break;
            }
            NotifyActionEvent(QQActionEventType.EvtOK, notifyEvents);
        }