public RegisterEventArgs(Register reg)
 {
     m_Register = reg;
 }
        private void OnRegistrationFieldsResult(object sender, IQ iq, object data)
        {
            if (iq.Type != IqType.error)
            {
                if (iq.Query != null && iq.Query.GetType() == typeof(Register))
                {
                    RegisterEventArgs args = new RegisterEventArgs(iq.Query as Register);
                    if (OnRegisterInformation != null)
                        OnRegisterInformation(this, args);

                    DoChangeXmppConnectionState(XmppConnectionState.Registering);

                    IQ regIq = new IQ(IqType.set);
                    regIq.GenerateId();
                    regIq.To = new Jid(base.Server);

                    //RegisterIq regIq = new RegisterIq(IqType.set, new Jid(base.Server));
                    if (args.Auto)
                    {
                        Register reg = new Register(this.m_Username, this.m_Password);
                        regIq.Query = reg;
                    }
                    else
                    {
                        regIq.Query = args.Register;
                    }
                    IqGrabber.SendIq(regIq, new IqCB(OnRegisterResult), data);
                }
            }
            else
            {
                if (OnRegisterError != null)
                    OnRegisterError(this, iq);
            }
        }