Пример #1
0
 public override void Initialize()
 {
     this.streamInitiation = base.im.GetExtension <StreamInitiation>();
     this.streamInitiation.RegisterProfile("http://jabber.org/protocol/si/profile/file-transfer", new Func <Jid, XmlElement, XmlElement>(this.OnStreamInitiationRequest));
     this.ecapa = base.im.GetExtension <EntityCapabilities>();
     foreach (Type type in supportedMethods)
     {
         XmppExtension extension = base.im.GetExtension(type);
         if (!((extension != null) && (extension is IDataStream)))
         {
             throw new XmppException("Invalid data-stream type: " + type);
         }
         IDataStream stream = extension as IDataStream;
         stream.BytesTransferred += new EventHandler <BytesTransferredEventArgs>(this.OnBytesTransferred);
         stream.TransferAborted  += new EventHandler <TransferAbortedEventArgs>(this.OnTransferAborted);
     }
 }
Пример #2
0
        private IEnumerable <string> GetStreamMethods()
        {
            ISet <string> set = new HashSet <string>();

            foreach (Type type in supportedMethods)
            {
                if (((!this.ForceInBandBytestreams || !(type != typeof(InBandBytestreams))) && ((CommonConfig.FileTranType != 0) || !(type != typeof(InBandBytestreams)))) && ((CommonConfig.FileTranType != 1) || !(type != typeof(Socks5Bytestreams))))
                {
                    XmppExtension extension = base.im.GetExtension(type);
                    if (extension != null)
                    {
                        foreach (string str in extension.Namespaces)
                        {
                            set.Add(str);
                        }
                    }
                }
            }
            return(set);
        }