Exemplo n.º 1
0
        /// <summary>
        /// Sends a DiscoverNodeMetadataMessage to discover the node metadata.
        /// https://xmpp.org/extensions/xep-0060.html#entity-metadata
        /// </summary>
        /// <param name="to">The target pubsub server (can be null).</param>
        /// <param name="nodeName">The name of the node, the metadata should get queried for.</param>
        /// <param name="onMessage">The method that should get executed once the helper receives a new valid message (can be null).</param>
        /// <param name="onTimeout">The method that should get executed once the helper timeout gets triggered (can be null).</param>
        /// <returns>Returns a MessageResponseHelper listening for DiscoverNodeMetadataMessage answers.</returns>
        public MessageResponseHelper <IQMessage> requestNodeMetadata(string to, string nodeName, MessageResponseHelper <IQMessage> .OnMessageHandler onMessage, MessageResponseHelper <IQMessage> .OnTimeoutHandler onTimeout)
        {
            MessageResponseHelper <IQMessage> helper = new MessageResponseHelper <IQMessage>(CONNECTION, onMessage, onTimeout);
            PubSubDiscoverNodeMetadataMessage msg    = new PubSubDiscoverNodeMetadataMessage(CONNECTION.account.getFullJid(), to, nodeName);

            helper.start(msg);
            return(helper);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sends a DiscoverNodeMetadataMessage for discovering the node metadata.
        /// https://xmpp.org/extensions/xep-0060.html#entity-metadata
        /// </summary>
        /// <param name="to">The target pubsub server (can be null).</param>
        /// <param name="nodeName">The name of the node, the metadata should get queried for.</param>
        /// <param name="onMessage">The method that should get executed once the helper receives a new valid message (can be null).</param>
        /// <param name="onTimeout">The method that should get executed once the helper timeout gets triggered (can be null).</param>
        /// <returns>Returns a MessageResponseHelper listening for DiscoverNodeMetadataMessage answers.</returns>
        public MessageResponseHelper <IQMessage> requestNodeMetadata(string to, string nodeName, Func <IQMessage, bool> onMessage, Action onTimeout)
        {
            MessageResponseHelper <IQMessage> helper = new MessageResponseHelper <IQMessage>(CLIENT, onMessage, onTimeout);
            PubSubDiscoverNodeMetadataMessage msg    = new PubSubDiscoverNodeMetadataMessage(CLIENT.getXMPPAccount().getIdDomainAndResource(), to, nodeName);

            helper.start(msg);
            return(helper);
        }