Esempio n. 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);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Invoked after all extensions have been loaded.
 /// </summary>
 public override void Initialize()
 {
     streamInitiation = im.GetExtension <StreamInitiation>();
     // Register the 'file-transfer' profile.
     streamInitiation.RegisterProfile(
         "http://jabber.org/protocol/si/profile/file-transfer",
         OnStreamInitiationRequest
         );
     ecapa = im.GetExtension <EntityCapabilities>();
     // Sign up for the 'BytesTransferred' and 'TransferAborted' events of each
     // data-stream extension that we support.
     foreach (var type in supportedMethods)
     {
         var ext = im.GetExtension(type);
         if (ext == null || !(ext is IDataStream))
         {
             throw new XmppException("Invalid data-stream type: " + type);
         }
         IDataStream dataStream = ext as IDataStream;
         dataStream.BytesTransferred += OnBytesTransferred;
         dataStream.TransferAborted  += OnTransferAborted;
     }
 }