agsXMPP.XmppClientConnection.OnChangePasswordResult C# (CSharp) Method

OnChangePasswordResult() private method

private OnChangePasswordResult ( object sender, agsXMPP.protocol.client.IQ iq, object data ) : void
sender object
iq agsXMPP.protocol.client.IQ
data object contains the new password
return void
		private void OnChangePasswordResult(object sender, IQ iq, object data)
		{
			if (iq.Type == IqType.result)
			{
				if(OnPasswordChanged!=null)
					OnPasswordChanged(this);
				
				// Set the new password in the Password property on sucess
				m_Password = (string) data;
			}
			else if (iq.Type == IqType.error)
			{
				/*
				The server or service SHOULD NOT return the original XML sent in 
				IQ error stanzas related to password changes.

				Example 12. Host Informs Client of Failed Password Change (Bad Request)

				<iq type='error' from='somehost' to='user@host/resource' id='change1'>
				<error code='400' type='modify'>
					<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
				</error>
				</iq>
				    

				Example 13. Host Informs Client of Failed Password Change (Not Authorized)

				<iq type='error' from='somehost' to='user@host/resource' id='change1'>
				<error code='401' type='cancel'>
					<not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
				</error>
				</iq>
				    

				Example 14. Server Informs Client of Failed Password Change (Not Allowed)

				<iq type='error' from='somehost' to='user@host/resource' id='change1'>
				<error code='405' type='cancel'>
					<not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
				</error>
				</iq>
								  
				*/

				if(OnRegisterError!=null)
					OnRegisterError(this, iq);
			}
        }