コード例 #1
0
 /// <summary>
 /// Sends a <seealso cref="DiscoRequestMessage"/> to the given target.
 /// </summary>
 /// <param name="target">The target e.g. '*****@*****.**'.</param>
 /// <param name="type">The disco type</param>
 /// <param name="onMessage">The method that should get executed once the helper receives a new valid message.</param>
 /// <param name="onTimeout">The method that should get executed once the helper timeout gets triggered.</param>
 /// <returns>Returns a <seealso cref="MessageResponseHelperResult"/> listening for <seealso cref="DiscoRequestMessage"/> answers.</returns>
 public MessageResponseHelper<IQMessage> createDisco(string target, DiscoType type, MessageResponseHelper<IQMessage>.OnMessageHandler onMessage, MessageResponseHelper<IQMessage>.OnTimeoutHandler onTimeout)
 {
     MessageResponseHelper<IQMessage> helper = new MessageResponseHelper<IQMessage>(CONNECTION, onMessage, onTimeout);
     DiscoRequestMessage disco = new DiscoRequestMessage(CONNECTION.account.getFullJid(), target, type);
     helper.start(disco);
     return helper;
 }
コード例 #2
0
 /// <summary>
 /// Sends a <seealso cref="DiscoRequestMessage"/> to the given target.
 /// </summary>
 /// <param name="target">The target e.g. '*****@*****.**'.</param>
 /// <param name="type">The disco type</param>
 /// <returns>Returns a <seealso cref="MessageResponseHelperResult"/> listening for <seealso cref="DiscoRequestMessage"/> answers.</returns>
 public async Task<MessageResponseHelperResult<IQMessage>> discoAsync(string target, DiscoType type)
 {
     Predicate<IQMessage> predicate = (x) => { return true; };
     AsyncMessageResponseHelper<IQMessage> helper = new AsyncMessageResponseHelper<IQMessage>(CONNECTION, predicate);
     DiscoRequestMessage msg = new DiscoRequestMessage(CONNECTION.account.getFullJid(), target, type);
     return await helper.startAsync(msg);
 }
コード例 #3
0
        /// <summary>
        /// Sends a DiscoRequestMessage to the given target to query all PubSub nodes.
        /// https://xmpp.org/extensions/xep-0060.html#entity-nodes
        /// </summary>
        /// <param name="to">The target e.g. '*****@*****.**' or 'pubsub.example.org'.</param>
        /// <returns>Returns a MessageResponseHelperResult listening for DiscoRequestMessage answers.</returns>
        public async Task <MessageResponseHelperResult <IQMessage> > discoNodesAsync(string to)
        {
            AsyncMessageResponseHelper <IQMessage> helper = new AsyncMessageResponseHelper <IQMessage>(CONNECTION);
            DiscoRequestMessage msg = new DiscoRequestMessage(CONNECTION.account.getFullJid(), to, DiscoType.ITEMS);

            return(await helper.startAsync(msg));
        }
コード例 #4
0
        /// <summary>
        /// Sends a <see cref="DiscoRequestMessage"/> to query for room information.
        /// See also: https://xmpp.org/extensions/xep-0045.html#disco-roominfo
        /// </summary>
        /// <param name="roomJId">The bare JID for the room that should be queried.</param>
        /// <returns>Returns the <see cref="MessageResponseHelper{ExtendedDiscoResponseMessage}"/> listening for answers to the request.</returns>
        public Task <MessageResponseHelperResult <ExtendedDiscoResponseMessage> > requestRoomInfoAsync(string roomJId)
        {
            AsyncMessageResponseHelper <ExtendedDiscoResponseMessage> helper = new AsyncMessageResponseHelper <ExtendedDiscoResponseMessage>(CONNECTION);
            DiscoRequestMessage disco = new DiscoRequestMessage(CONNECTION.account.getFullJid(), roomJId, DiscoType.INFO);

            return(helper.startAsync(disco));
        }
コード例 #5
0
        /// <summary>
        /// Sends a DiscoRequestMessage and requests the MUC room info for the given room.
        /// </summary>
        /// <param name="roomJid">The bare JID if the room you would like to request the information for. e.g. '*****@*****.**'</param>
        /// <param name="onMessage">The method that should get executed once the helper receives a new valid message.</param>
        /// <param name="onTimeout">The method that should get executed once the helper timeout gets triggered.</param>
        /// <returns>Returns a MessageResponseHelper listening for DiscoRequestMessage answers.</returns>
        public MessageResponseHelper <ExtendedDiscoResponseMessage> requestRoomInfo(string roomJid, MessageResponseHelper <ExtendedDiscoResponseMessage> .OnMessageHandler onMessage, MessageResponseHelper <ExtendedDiscoResponseMessage> .OnTimeoutHandler onTimeout)
        {
            MessageResponseHelper <ExtendedDiscoResponseMessage> helper = new MessageResponseHelper <ExtendedDiscoResponseMessage>(CONNECTION, onMessage, onTimeout);
            DiscoRequestMessage disco = new DiscoRequestMessage(CONNECTION.account.getFullJid(), roomJid, DiscoType.INFO);

            helper.start(disco);
            return(helper);
        }
コード例 #6
0
ファイル: XMPPClient.cs プロジェクト: vbprofi/UWPX-Client
        public async Task <string> createDiscoAsync(string target, DiscoType type)
        {
            XMPPAccount         account = connection.account;
            DiscoRequestMessage disco   = new DiscoRequestMessage(account.getIdDomainAndResource(), target, type);
            await connection.sendAsync(disco, false, false);

            return(disco.ID);
        }
コード例 #7
0
        /// <summary>
        /// Sends a DiscoRequestMessage and requests the MUC room info for the given room.
        /// </summary>
        /// <param name="roomJid">The bare JID if the room you would like to request the information for. e.g. '*****@*****.**'</param>
        /// <param name="onMessage">The method that should get executed once the helper receives a new valid message.</param>
        /// <param name="onTimeout">The method that should get executed once the helper timeout gets triggered.</param>
        /// <returns>Returns a MessageResponseHelper listening for DiscoRequestMessage answers.</returns>
        public MessageResponseHelper <ExtendedDiscoResponseMessage> requestRoomInfo(string roomJid, Func <ExtendedDiscoResponseMessage, bool> onMessage, Action onTimeout)
        {
            MessageResponseHelper <ExtendedDiscoResponseMessage> helper = new MessageResponseHelper <ExtendedDiscoResponseMessage>(CLIENT, onMessage, onTimeout);
            DiscoRequestMessage disco = new DiscoRequestMessage(CLIENT.getXMPPAccount().getIdDomainAndResource(), roomJid, DiscoType.INFO);

            helper.start(disco);
            return(helper);
        }
コード例 #8
0
        //--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
        #region --Set-, Get- Methods--


        #endregion
        //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
        #region --Misc Methods (Public)--
        /// <summary>
        /// Sends a DiscoRequestMessage and requests all MUC rooms for the given server.
        /// </summary>
        /// <param name="server">The server the rooms should get requested for. e.g. 'conference.jabber.org'</param>
        /// <param name="onMessage">The method that should get executed once the helper receives a new valid message.</param>
        /// <param name="onTimeout">The method that should get executed once the helper timeout gets triggered.</param>
        /// <returns>Returns a MessageResponseHelper listening for DiscoRequestMessage answers.</returns>
        public MessageResponseHelper <IQMessage> requestRooms(string server, Func <IQMessage, bool> onMessage, Action onTimeout)
        {
            MessageResponseHelper <IQMessage> helper = new MessageResponseHelper <IQMessage>(CLIENT, onMessage, onTimeout);
            DiscoRequestMessage disco = new DiscoRequestMessage(CLIENT.getXMPPAccount().getIdDomainAndResource(), server, DiscoType.ITEMS);

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