//--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\ #region --Misc Methods (Public)-- /// <summary> /// Sends an OmemoRequestBundleInformationMessage to requests the OMEMO bundle information of the given target and deviceId. /// </summary> /// <param name="toBareJid">The bare JID of the target you want to request the OMEMO bundle information from. e.g. 'conference.jabber.org'</param> /// <param name="deviceId">The device id you want to request the OMEMO bundle information for.</param> /// <returns>The OmemoRequestBundleInformationMessage result.</returns> public Task <MessageResponseHelperResult <IQMessage> > requestBundleInformationAsync(string toBareJid, uint deviceId) { Predicate <IQMessage> predicate = (x) => { return(x is OmemoBundleInformationResultMessage || x is IQErrorMessage); }; AsyncMessageResponseHelper <IQMessage> helper = new AsyncMessageResponseHelper <IQMessage>(CONNECTION, predicate); OmemoRequestBundleInformationMessage msg = new OmemoRequestBundleInformationMessage(CONNECTION.account.getFullJid(), toBareJid, deviceId); return(helper.startAsync(msg)); }
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\ #region --Set-, Get- Methods-- #endregion //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\ #region --Misc Methods (Public)-- /// <summary> /// Sends a OmemoRequestBundleInformationMessage to requests the OMEMO bundle information of the given target and deviceId. /// </summary> /// <param name="to">The bare JID of the target you want to request the OMEMO bundle information from. e.g. 'conference.jabber.org'</param> /// <param name="deviceId">The device id you want to request the OMEMO bundle information for.</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 OmemoRequestBundleInformationMessage answers.</returns> public MessageResponseHelper <IQMessage> requestBundleInformation(string to, uint deviceId, Func <IQMessage, bool> onMessage, Action onTimeout) { MessageResponseHelper <IQMessage> helper = new MessageResponseHelper <IQMessage>(CLIENT, onMessage, onTimeout); OmemoRequestBundleInformationMessage msg = new OmemoRequestBundleInformationMessage(CLIENT.getXMPPAccount().getIdDomainAndResource(), to, deviceId); helper.start(msg); return(helper); }
private void requestBundleInformation() { setState(OmemoSessionBuildHelperState.REQUESTING_BUNDLE_INFORMATION); if (requestBundleInfoHelper != null) { requestBundleInfoHelper?.Dispose(); requestBundleInfoHelper = null; } requestBundleInfoHelper = new MessageResponseHelper <IQMessage>(CONNECTION, onRequestBundleInformationMessage, onTimeout); OmemoRequestBundleInformationMessage msg = new OmemoRequestBundleInformationMessage(FULL_ACCOUNT_JID, curAddress.getName(), curAddress.getDeviceId()); requestBundleInfoHelper.start(msg); }