Пример #1
0
 private void DoSendItem(Element element, WriteMode mode, Action done)
 {
     fInSending = true;
     sb.Length = 0;
     element.ToString(sb, new WriteOptions { Mode = mode, StreamPrefix = "stream" });
     byte[] data = Encoding.UTF8.GetBytes(sb.ToString());
     //Console.WriteLine("Sending: " + sb);
     try
     {
         Connection cn = fConnection;
         if (cn != null)
             cn.BeginWrite(data, 0, data.Length, new AsyncCallback(ItemSent), done);
     }
     catch
     {
     }
 }
Пример #2
0
        private void AuthReply(Element el)
        {
            EndTimeout();
            switch (el.Type)
            {
                case ElementType.SASLSuccess:

                    fState = XMPP.State.Authenticated;
                    fServerElementStack.Clear();
                    fServerRoot = null;
                    OnAuthenticated();
                    BeginTimeout();
                    BeginSend(fRootElement, WriteMode.Open, null);

                    break;
                case ElementType.SASLFailure:
                    OnError(new SaslFailureException((SaslFailure)el));
                    Close();
                    break;
                default:
                    OnError(new SaslFailureException("Invalid SASL reply: " + el.ToString()));
                    Close();
                    break;
            }
        }