示例#1
0
        private async Task CheckDiscoFeaturesDomainPartAsync(DiscoResponseMessage disco, string discoTarget)
        {
            AddFeaturesForTarget(disco.FEATURES, discoTarget);
            DicoFeaturesDicovered?.Invoke(this, new DicoFeaturesDicoveredEventArgs(DISCO_INFO_RESULT[discoTarget], discoTarget));

            if (CONNECTION.account.connectionConfiguration.disableMessageCarbons)
            {
                CONNECTION.account.CONNECTION_INFO.msgCarbonsState = MessageCarbonsState.DISABLED;
                Logger.Info("No need to enable message carbons for '" + CONNECTION.account.getBareJid() + "' - message carbons are disabled.");
                return;
            }

            // Check if the server supports 'XEP-0280: Message Carbons':
            bool supportsCarbons = HasFeature(Consts.XML_XEP_0280_NAMESPACE, discoTarget);

            if (supportsCarbons)
            {
                await CONNECTION.EnableMessageCarbonsAsync();
            }
            else
            {
                CONNECTION.account.CONNECTION_INFO.msgCarbonsState = MessageCarbonsState.NOT_SUPPORTED;
                Logger.Warn("Unable to enable message carbons for '" + CONNECTION.account.getBareJid() + "' - not supported by the server.");
            }
        }
        private async Task CheckDiscoFeaturesDomainPartAsync(List <DiscoFeature> features, string discoTarget)
        {
            AddFeaturesForTarget(features, discoTarget);

            if (CONNECTION.account.connectionConfiguration.disableMessageCarbons)
            {
                CONNECTION.account.CONNECTION_INFO.msgCarbonsState = MessageCarbonsState.DISABLED;
                Logger.Info("No need to enable message carbons for '" + CONNECTION.account.getBareJid() + "' - message carbons are disabled.");
                return;
            }

            // Check if the server supports 'XEP-0280: Message Carbons':
            bool supportsCarbons = HasFeature(Consts.XML_XEP_0280_NAMESPACE, discoTarget);

            if (supportsCarbons)
            {
                await CONNECTION.EnableMessageCarbonsAsync();
            }
            else
            {
                CONNECTION.account.CONNECTION_INFO.msgCarbonsState = MessageCarbonsState.NOT_SUPPORTED;
                Logger.Warn("Unable to enable message carbons for '" + CONNECTION.account.getBareJid() + "' - not supported by the server.");
            }
        }