コード例 #1
0
ファイル: XmppClient.cs プロジェクト: lcmxiaoya/xmpp-source
 private void LoadExtensions()
 {
     this.version                = this.im.LoadExtension <SoftwareVersion>();
     this.sdisco                 = this.im.LoadExtension <ServiceDiscovery>();
     this.ecapa                  = this.im.LoadExtension <EntityCapabilities>();
     this.ping                   = this.im.LoadExtension <S22.Xmpp.Extensions.Ping>();
     this.attention              = this.im.LoadExtension <Attention>();
     this.time                   = this.im.LoadExtension <EntityTime>();
     this.block                  = this.im.LoadExtension <BlockingCommand>();
     this.pep                    = this.im.LoadExtension <Pep>();
     this.userTune               = this.im.LoadExtension <UserTune>();
     this.userAvatar             = this.im.LoadExtension <UserAvatar>();
     this.userMood               = this.im.LoadExtension <UserMood>();
     this.dataForms              = this.im.LoadExtension <DataForms>();
     this.featureNegotiation     = this.im.LoadExtension <FeatureNegotiation>();
     this.streamInitiation       = this.im.LoadExtension <StreamInitiation>();
     this.siFileTransfer         = this.im.LoadExtension <SIFileTransfer>();
     this.inBandBytestreams      = this.im.LoadExtension <InBandBytestreams>();
     this.userActivity           = this.im.LoadExtension <UserActivity>();
     this.socks5Bytestreams      = this.im.LoadExtension <Socks5Bytestreams>();
     this.FileTransferSettings   = new S22.Xmpp.Client.FileTransferSettings(this.socks5Bytestreams, this.siFileTransfer);
     this.serverIpCheck          = this.im.LoadExtension <ServerIpCheck>();
     this.inBandRegistration     = this.im.LoadExtension <InBandRegistration>();
     this.chatStateNotifications = this.im.LoadExtension <ChatStateNotifications>();
     this.bitsOfBinary           = this.im.LoadExtension <BitsOfBinary>();
 }
コード例 #2
0
ファイル: XmppTransport.cs プロジェクト: pietpukkel/conversa
        /// <summary>
        /// Closes the connection.
        /// </summary>
        /// <returns></returns>
        public async Task CloseAsync()
        {
            if (this.isDisposed || this.State == XmppTransportState.Closed || this.State == XmppTransportState.Closing)
            {
                return;
            }

            try
            {
                await SoftCloseAsync().ConfigureAwait(false);
            }
            catch
            {
            }
            finally
            {
                this.DisposeSubscriptions();

                this.transport          = null;
                this.saslMechanism      = null;
                this.connectionString   = null;
                this.userAddress        = null;
                this.people             = null;
                this.activity           = null;
                this.capabilities       = null;
                this.personalEventing   = null;
                this.presence           = null;
                this.serverCapabilities = null;
                this.serverFeatures     = ServerFeatures.None;

                this.ReleaseSubjects();
            }
        }
コード例 #3
0
ファイル: XmppTransport.cs プロジェクト: pietpukkel/conversa
        /// <summary>
        /// Disposes the specified disposing.
        /// </summary>
        /// <param name="disposing">if set to <c>true</c> [disposing].</param>
        private void Dispose(bool disposing)
        {
            if (!this.isDisposed)
            {
                if (disposing)
                {
                    // Release managed resources here
                    this.CloseAsync().GetAwaiter().GetResult();
                }

                // Call the appropriate methods to clean up
                // unmanaged resources here.
                // If disposing is false,
                // only the following code is executed.
                this.connectionString   = null;
                this.userAddress        = null;
                this.saslMechanism      = null;
                this.people             = null;
                this.activity           = null;
                this.capabilities       = null;
                this.personalEventing   = null;
                this.presence           = null;
                this.serverCapabilities = null;
                this.serverFeatures     = ServerFeatures.None;
                this.state = XmppTransportState.Closed;
                this.CloseTransport();
                this.DisposeSubscriptions();
                this.ReleaseSubjects();
            }

            this.isDisposed = true;
        }
コード例 #4
0
ファイル: XmppTransport.cs プロジェクト: pietpukkel/conversa
 internal void RequestTransportInitialization()
 {
     this.subscriptions      = new ConcurrentDictionary <string, CompositeDisposable>();
     this.people             = new ContactList();
     this.activity           = new Activity();
     this.capabilities       = new ClientCapabilities();
     this.personalEventing   = new PersonalEventing();
     this.presence           = new XmppTransportPresence();
     this.Configuration      = new XmppTransportConfiguration();
     this.serverCapabilities = new EntityCapabilities();
 }
コード例 #5
0
        /// <summary>
        /// Setup SerializedProperty's and any labels used, tools tips etc.
        /// </summary>
        /// <param name="property"></param>
        private void Init(SerializedProperty property)
        {
            capabilities = property.FindPropertyRelative("capabilities");
            src          = new EntityCapabilities(capabilities.intValue);

            // Labels
            ammoLabel     = new GUIContent("Ammunition Supply", Tooltips.AmmoSupply);
            fuelLabel     = new GUIContent("Fuel Supply", Tooltips.FuelSupply);
            recoveryLabel = new GUIContent("Recovery Service", Tooltips.RecoveryService);
            repairLabel   = new GUIContent("Repair Service", Tooltips.RepairService);
            adsbLabel     = new GUIContent("ADS-B", Tooltips.ADSB);
        }
コード例 #6
0
        private EntityCapabilities GetEntityCapabilities()
        {
            var capabilities = new EntityCapabilities();

            capabilities.HashAlgorithmName = XmppEntityCapabilities.DefaultHashAlgorithmName;
            capabilities.Node = Node;
            capabilities.VerificationString = BuildVerificationString();

            // Update the Verification String
            VerificationString = capabilities.VerificationString;

            return(capabilities);
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContactResource"/> class.
        /// </summary>
        internal ContactResource(XmppAddress address, Presence initialPresence, bool isDefaultResource = false)
        {
            this.address  = address;
            this.Presence = new ContactResourcePresence(this);

            if (!isDefaultResource && initialPresence.Capabilities != null)
            {
                this.capabilities = new EntityCapabilities(this.Address, initialPresence.Capabilities.DiscoveryNode);

                this.capabilities
                .CapsChangedStream
                .Take(1)
                .Subscribe(async caps => await OnCapabilitiesChangedAsync().ConfigureAwait(false));
            }

            this.UpdatePresence(initialPresence);
        }
コード例 #8
0
ファイル: XmppClient.cs プロジェクト: REPLDigital/Sharp.Xmpp
        /// <summary>
        /// Initializes the various XMPP extension modules.
        /// </summary>
        private void LoadExtensions()
        {
            version = im.LoadExtension<SoftwareVersion>();
            sdisco = im.LoadExtension<ServiceDiscovery>();
            ecapa = im.LoadExtension<EntityCapabilities>();
            ping = im.LoadExtension<Ping>();
            attention = im.LoadExtension<Attention>();
            time = im.LoadExtension<EntityTime>();
            block = im.LoadExtension<BlockingCommand>();
            pep = im.LoadExtension<Pep>();
            userTune = im.LoadExtension<UserTune>();
#if WINDOWSPLATFORM
            userAvatar = im.LoadExtension<UserAvatar>();
#endif
            userMood = im.LoadExtension<UserMood>();
            dataForms = im.LoadExtension<DataForms>();
            featureNegotiation = im.LoadExtension<FeatureNegotiation>();
            streamInitiation = im.LoadExtension<StreamInitiation>();
            siFileTransfer = im.LoadExtension<SIFileTransfer>();
            inBandBytestreams = im.LoadExtension<InBandBytestreams>();
            userActivity = im.LoadExtension<UserActivity>();
            socks5Bytestreams = im.LoadExtension<Socks5Bytestreams>();
            FileTransferSettings = new FileTransferSettings(socks5Bytestreams,
                siFileTransfer);
            serverIpCheck = im.LoadExtension<ServerIpCheck>();
            messageCarbons = im.LoadExtension<MessageCarbons>();
            inBandRegistration = im.LoadExtension<InBandRegistration>();
            chatStateNotifications = im.LoadExtension<ChatStateNotifications>();
            bitsOfBinary = im.LoadExtension<BitsOfBinary>();
            vcardAvatars = im.LoadExtension<VCardAvatars>();
            cusiqextension = im.LoadExtension<CustomIqExtension>();
            messageArchiving = im.LoadExtension<MessageArchiving>();
            messageArchiveManagement = im.LoadExtension<MessageArchiveManagement>();
            multiUserChat = im.LoadExtension<MultiUserChat>();
            serviceAdministration = im.LoadExtension<ServiceAdministration>();
            adHocCommands = im.LoadExtension<AdHocCommands>();
            directMucInvitations = im.LoadExtension<DirectMucInvitations>();
        }
コード例 #9
0
 /// <summary>
 /// Invoked after all extensions have been loaded.
 /// </summary>
 public override void Initialize()
 {
     ecapa = IM.GetExtension<EntityCapabilities>();
     bob = IM.GetExtension<BitsOfBinary>();
 }
コード例 #10
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;
     }
 }
コード例 #11
0
ファイル: MessageCarbons.cs プロジェクト: rafaneri/Sharp.Xmpp
 public override void Initialize()
 {
     ecapa = im.GetExtension<EntityCapabilities>();
 }
コード例 #12
0
ファイル: XmppClient.cs プロジェクト: BlueBasher/S22.Xmpp
		/// <summary>
		/// Initializes the various XMPP extension modules.
		/// </summary>
		void LoadExtensions() {
			version = im.LoadExtension<SoftwareVersion>();
			sdisco = im.LoadExtension<ServiceDiscovery>();
			ecapa = im.LoadExtension<EntityCapabilities>();
			ping = im.LoadExtension<Ping>();
			attention = im.LoadExtension<Attention>();
			time = im.LoadExtension<EntityTime>();
			block = im.LoadExtension<BlockingCommand>();
			pep = im.LoadExtension<Pep>();
			userTune = im.LoadExtension<UserTune>();
			userAvatar = im.LoadExtension<UserAvatar>();
			userMood = im.LoadExtension<UserMood>();
			dataForms = im.LoadExtension<DataForms>();
			featureNegotiation = im.LoadExtension<FeatureNegotiation>();
			streamInitiation = im.LoadExtension<StreamInitiation>();
			siFileTransfer = im.LoadExtension<SIFileTransfer>();
			inBandBytestreams = im.LoadExtension<InBandBytestreams>();
			userActivity = im.LoadExtension<UserActivity>();
			socks5Bytestreams = im.LoadExtension<Socks5Bytestreams>();
			FileTransferSettings = new FileTransferSettings(socks5Bytestreams,
				siFileTransfer);
			serverIpCheck = im.LoadExtension<ServerIpCheck>();
			inBandRegistration = im.LoadExtension<InBandRegistration>();
			chatStateNotifications = im.LoadExtension<ChatStateNotifications>();
			bitsOfBinary = im.LoadExtension<BitsOfBinary>();
		}