Example #1
0
        private async Task sendAllOutstandingMessagesAsync(OmemoSessions omemoSessions)
        {
            Tuple <List <OmemoEncryptedMessage>, OmemoSessionBuildHelper> cache = MESSAGE_CACHE[omemoSessions.DST_DEVICE_GROUP.BARE_JID];

            foreach (OmemoEncryptedMessage msg in cache.Item1)
            {
                try
                {
                    msg.encrypt(CONNECTION.account.omemoDeviceId, CONNECTION.account.omemoIdentityKey, OMEMO_STORAGE, omemoSessions.toList());
                    await CONNECTION.SendAsync(msg, false);
                }
                catch (Exception e)
                {
                    Logger.Error("[OMEMO HELPER] Failed to encrypt and send OMEMO message with: ", e);
                }
            }
            MESSAGE_CACHE.Remove(omemoSessions.DST_DEVICE_GROUP.BARE_JID);
            Logger.Info("[OMEMO HELPER] Send all outstanding OMEMO messages for: " + omemoSessions.DST_DEVICE_GROUP.BARE_JID + " to " + omemoSessions.SRC_DEVICE_GROUP.SESSIONS.Count + " own and " + omemoSessions.DST_DEVICE_GROUP.SESSIONS.Count + " remote recipient(s).");
        }
 //--------------------------------------------------------Constructor:----------------------------------------------------------------\\
 #region --Constructors--
 internal OmemoSessionBuildResult(OmemoSessions session)
 {
     SESSIONS = session;
     SUCCESS  = true;
 }