/// <summary> /// Sends an OmemoRequestDeviceListMessage to requests the OMEMO device list of the given target. /// </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 device list for.</param> /// <returns>The OmemoRequestDeviceListMessage result.</returns> public async Task <MessageResponseHelperResult <IQMessage> > requestDeviceListAsync(string toBareJid) { Predicate <IQMessage> predicate = (x) => { return(x is OmemoDeviceListResultMessage || x is IQErrorMessage); }; AsyncMessageResponseHelper <IQMessage> helper = new AsyncMessageResponseHelper <IQMessage>(CONNECTION, predicate); OmemoRequestDeviceListMessage msg = new OmemoRequestDeviceListMessage(CONNECTION.account.getFullJid(), toBareJid); return(await helper.startAsync(msg)); }
/// <summary> /// Sends a OmemoRequestDeviceListMessage to requests the OMEMO device list of the given target. /// </summary> /// <param name="to">The bare JID of the target you want to request the OMEMO device list from. 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 OmemoRequestDeviceListMessage answers.</returns> public MessageResponseHelper <IQMessage> requestDeviceList(string to, Func <IQMessage, bool> onMessage, Action onTimeout) { MessageResponseHelper <IQMessage> helper = new MessageResponseHelper <IQMessage>(CLIENT, onMessage, onTimeout); OmemoRequestDeviceListMessage msg = new OmemoRequestDeviceListMessage(CLIENT.getXMPPAccount().getIdDomainAndResource(), to); helper.start(msg); return(helper); }
/// <summary> /// Sends an OmemoRequestDeviceListMessage to requests the OMEMO device list of the given target. /// </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 device list for.</param> /// <returns>The OmemoRequestDeviceListMessage result.</returns> public Task <MessageResponseHelperResult <IQMessage> > requestDeviceListAsync(string toBareJid) { Logger.Info($"Requesting OMEMO device list for {toBareJid} ..."); Predicate <IQMessage> predicate = (x) => { return(x is OmemoDeviceListResultMessage || x is IQErrorMessage); }; AsyncMessageResponseHelper <IQMessage> helper = new AsyncMessageResponseHelper <IQMessage>(CONNECTION, predicate); OmemoRequestDeviceListMessage msg = new OmemoRequestDeviceListMessage(CONNECTION.account.getFullJid(), toBareJid); return(helper.startAsync(msg)); }
private void requestDeviceList() { setState(OmemoHelperState.REQUESTING_DEVICE_LIST); Logger.Info("[OMEMO HELPER](" + CONNECTION.account.getIdAndDomain() + ") Requesting device list."); if (requestDeviceListHelper != null) { requestDeviceListHelper.Dispose(); } requestDeviceListHelper = new MessageResponseHelper <IQMessage>(CONNECTION, onRequestDeviceListMsg, onTimeout); OmemoRequestDeviceListMessage msg = new OmemoRequestDeviceListMessage(CONNECTION.account.getIdDomainAndResource(), null); requestDeviceListHelper.start(msg); }
private void requestDeviceList() { setState(OmemoSessionBuildHelperState.REQUESTING_DEVICE_LIST); if (requestDeviceListHelper != null) { requestDeviceListHelper?.Dispose(); requestDeviceListHelper = null; } requestDeviceListHelper = new MessageResponseHelper <IQMessage>(CONNECTION, onRequestDeviceListMessage, onTimeout); OmemoRequestDeviceListMessage msg = new OmemoRequestDeviceListMessage(BARE_ACCOUNT_JID, CHAT_JID); requestDeviceListHelper.start(msg); }
public void requestDeviceListStateless(Action <bool, OmemoDevices> onResult) { requestDeviceListStatelessOnResult = onResult; if (requestDeviceListStatelessHelper != null) { requestDeviceListStatelessHelper.Dispose(); requestDeviceListStatelessHelper = null; } requestDeviceListStatelessHelper = new MessageResponseHelper <IQMessage>(CONNECTION, onRequestDeviceListStatelessMessage, onRequestDeviceListStatelessTimeout); OmemoRequestDeviceListMessage msg = new OmemoRequestDeviceListMessage(CONNECTION.account.getIdDomainAndResource(), null); requestDeviceListStatelessHelper.start(msg); }