Example #1
0
        public static object onParserBindOpMobileForReg(SessionPack sessionPack)
        {
            BindOpMobileResponse response = BindOpMobileResponse.ParseFrom(sessionPack.mResponseBuffer);

            if (response == null)
            {
                Log.e("Network", "BindOpMobileResponse parse failed. ");
                return(null);
            }
            if (response.BaseResponse.Ret == -301)
            {
                Log.i("Network", "Need to redirect IDC for BindOpMobileForReg...");
                HostService.updateAuthIDCHost(response.NewHostList);
                HostService.updateAuthBuiltinIP(response.BuiltinIPList);
                Connector.close();
            }
            return(response);
        }
Example #2
0
        public static object onParserNewAuthPack(SessionPack sessionPack)
        {
            NewAuthResponse response = NewAuthResponse.ParseFrom(sessionPack.mResponseBuffer);

            if (response == null)
            {
                Log.e("Network", "auth parse failed. ");
                return(null);
            }
            int      uin = (int)response.Uin;
            RetConst ret = (RetConst)response.BaseResponse.Ret;

            Log.d("Network", "auth parsed success. ");
            if ((uin != 0) && (((ret == RetConst.MM_OK) || (ret == RetConst.MM_ERR_CRITICALUPDATE)) || (ret == RetConst.MM_ERR_RECOMMENDEDUPDATE)))
            {
                Log.i("Network", "auth PASS, uin= " + uin);

                HostService.updateAuthBuiltinIP(response.BuiltinIPList);
                SessionPackMgr.setSessionKey(response.SessionKey.ToByteArray());
                SessionPackMgr.getAccount().AutoAuthKey = response.AutoAuthTicket;
                SessionPackMgr.getAccount().setUin(uin);
                SessionPackMgr.getAccount().Nickname = response.NickName.String;
                //SessionPackMgr.getAccount().Headimg=response.WTLoginRspBuff
                SessionPackMgr.setAuthStatus(2);
                return(response);
            }
            Log.e("Network", "auth Failed,ret = " + ret);
            switch (ret)
            {
            case RetConst.MM_ERR_NEEDREG:
                Log.i("Network", "auth result: need register");
                SessionPackMgr.mAuthTicket1 = response.Ticket;
                Connector.close();
                return(response);

            case RetConst.MM_ERR_IDC_REDIRECT:
                Log.i("Network", "Need to redirect IDC for auth ...");
                HostService.updateAuthIDCHost(response.NewHostList);
                HostService.updateAuthBuiltinIP(response.BuiltinIPList);
                Connector.close();
                return(response);

            case RetConst.MM_ERR_QQ_OK_NEED_MOBILE:
                SessionPackMgr.setSessionKey(null);
                return(response);

            default:
                SessionPackMgr.setSessionKey(null);
                SessionPackMgr.getAccount().reset();
                switch (ret)
                {
                case RetConst.MM_ERR_RECOMMENDEDUPDATE:
                    Log.e("Network", "Auth Failed: MM_ERR_RECOMMENDEDUPDATE ");
                    goto Label_022B;

                case RetConst.MM_ERR_CRITICALUPDATE:
                    Log.e("Network", "Auth Failed: MM_ERR_CRITICALUPDATE ");
                    goto Label_022B;

                case RetConst.MM_ERR_AUTH_ANOTHERPLACE:
                    Log.e("Network", "Auth Failed: MM_ERR_AUTH_ANOTHERPLACE ");
                    mKickMessage = response.KickResponse;
                    Sender.getInstance().closeSender();
                    goto Label_022B;

                case RetConst.MM_ERR_NEED_VERIFY:
                    Log.e("Network", "Auth Failed: MM_ERR_NEED_VERIFY ");
                    goto Label_022B;

                case RetConst.MM_ERR_NOUSER:
                    Log.e("Network", "Auth Failed: MM_ERR_NOUSER ");
                    goto Label_022B;

                case RetConst.MM_ERR_PASSWORD:
                    Log.e("Network", "Auth Failed: MM_ERR_PASSWORD ");
                    goto Label_022B;
                }
                break;
            }
Label_022B:
            Connector.close();
            return(response);
        }