Пример #1
0
 private void DispatchEvents()
 {
     while (true)
     {
         try
         {
             Stanza stanza = this.stanzaQueue.Take(this.cancelDispatch.Token);
             if (stanza is S22.Xmpp.Core.Iq)
             {
                 CommonConfig.Logger.WriteInfo("IQ消息出列");
                 S22.Xmpp.Core.Iq iq = stanza as S22.Xmpp.Core.Iq;
                 this.Iq.Raise <IqEventArgs>(this, new IqEventArgs(stanza as S22.Xmpp.Core.Iq));
             }
             else if (stanza is S22.Xmpp.Core.Message)
             {
                 this.Message.Raise <MessageEventArgs>(this, new MessageEventArgs(stanza as S22.Xmpp.Core.Message));
             }
             else if (stanza is S22.Xmpp.Core.Presence)
             {
                 CommonConfig.Logger.WriteInfo("Presence消息出列");
                 this.Presence.Raise <PresenceEventArgs>(this, new PresenceEventArgs(stanza as S22.Xmpp.Core.Presence));
             }
         }
         catch (OperationCanceledException exception)
         {
             CommonConfig.Logger.WriteError("消息出列过程出错", exception);
             //CommonConfig.Logger.WriteError(exception);
             return;
         }
         catch (Exception exception2)
         {
             CommonConfig.Logger.WriteError("消息出列过程出错", exception2);
             //CommonConfig.Logger.WriteError(exception2);
         }
     }
 }
Пример #2
0
 private void Send(Stanza stanza)
 {
     stanza.ThrowIfNull <Stanza>("stanza");
     this.Send(stanza.ToString());
 }
Пример #3
0
		/// <summary>
		/// Sends the specified stanza to the server.
		/// </summary>
		/// <param name="stanza">The stanza to send.</param>
		/// <exception cref="ArgumentNullException">The stanza parameter is null.</exception>
		/// <exception cref="IOException">There was a failure while writing to
		/// the network.</exception>
		void Send(Stanza stanza) {
			stanza.ThrowIfNull("stanza");
			Send(stanza.ToString());
		}