agsXMPP.XmppClientConnection.StreamParserOnStreamElement C# (CSharp) Method

StreamParserOnStreamElement() public method

public StreamParserOnStreamElement ( object sender, agsXMPP.Xml.Dom.Node e ) : void
sender object
e agsXMPP.Xml.Dom.Node
return void
		public override void StreamParserOnStreamElement(object sender, Node e)
		{
			base.StreamParserOnStreamElement(sender, e);

			if ( e.GetType() == typeof(IQ) )
			{
				if (OnIq != null)
					OnIq(this, e as IQ);
					
				IQ iq = e as IQ;
				if ( iq != null && iq.Query != null)
				{
					// Roster
                    if (iq.Query is Roster)
                        OnRosterIQ(iq);                   
				}	
			}
			else if ( e.GetType() == typeof(Message) )
			{
				if (OnMessage != null)
					OnMessage(this, e as Message);
			}
			else if ( e.GetType() == typeof(Presence) )
			{
				if (OnPresence != null)
					OnPresence(this, e as Presence);
			}
			else if ( e.GetType() == typeof (Features) )
			{
				// Stream Features
				// StartTLS stuff
				Features f = e as Features;
                if (m_UseCompression &&
                    f.SupportsCompression &&
                    f.Compression.SupportsMethod(CompressionMethod.zlib))
                {
                    // Check for Stream Compression
                    // we support only ZLIB because its a free algorithm without patents
                    // yes ePatents suck                                       
                    DoChangeXmppConnectionState(XmppConnectionState.StartCompression);
                    this.Send(new Compress(CompressionMethod.zlib));                    
                }
#if SSL || MONOSSL
				else if (f.SupportsStartTls && m_UseStartTLS)
				{
					DoChangeXmppConnectionState(XmppConnectionState.Securing);
					this.Send(new StartTls());
				}
#endif
                else if (f.SupportsRegistration && m_RegisterAccount)
                {
                    // Do registration after TLS when possible
                    if (f.SupportsRegistration)
                        GetRegistrationFields(e);
                    else
                    {
                        // registration is not enabled on this server                        
                        FireOnError(this, new RegisterException("Registration is not allowed on this server"));
                        Close();
                        // Close the stream
                    }
                }
            }
#if SSL || MONOSSL
            else if ( e.GetType() == typeof (Proceed) )
			{	
				StreamParser.Reset();			
				ClientSocket.StartTls();				
				SendStreamHeader(false);				
				DoChangeXmppConnectionState(XmppConnectionState.Authenticating);
            }
#endif
            else if ( e.GetType() == typeof (Compressed) )
			{
                //DoChangeXmppConnectionState(XmppConnectionState.StartCompression);
				StreamParser.Reset();
                ClientSocket.StartCompression();                
                // Start new Stream Header compressed.
                SendStreamHeader(false);

                DoChangeXmppConnectionState(XmppConnectionState.Compressed);
			}

		}