Exemplo n.º 1
0
 public void markMessageAsRead(ChatMessageTable msg)
 {
     msg.state = MessageState.READ;
     dB.InsertOrReplace(msg);
     msg.onChanged();
     ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(msg, false));
 }
Exemplo n.º 2
0
 //--------------------------------------------------------Events:---------------------------------------------------------------------\\
 #region --Events--
 private void INSTANCE_ChatMessageChanged(ChatDBManager handler, ChatMessageChangedEventArgs args)
 {
     if (string.Equals(Chat?.id, args.MESSAGE.chatId))
     {
         ChatMessageChanged?.Invoke(this, args);
     }
 }
Exemplo n.º 3
0
 private void markMessageAsRead(ChatMessageTable msg)
 {
     msg.state = MessageState.READ;
     update(msg);
     msg.onChanged();
     ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(msg));
 }
Exemplo n.º 4
0
        public void updateChatMessageState(string msgId, MessageState state)
        {
            dB.Execute("UPDATE " + DBTableConsts.CHAT_MESSAGE_TABLE + " SET state = ? WHERE id = ?", state, msgId);
            List <ChatMessageTable> list = dB.Query <ChatMessageTable>(true, "SELECT * FROM " + DBTableConsts.CHAT_MESSAGE_TABLE + " WHERE id = ?;", msgId);

            Parallel.ForEach(list, (msg) =>
            {
                ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(msg, false));
            });
        }
Exemplo n.º 5
0
 //--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
 #region --Set-, Get- Methods--
 public void setMessageAsDeliverd(string id, bool triggerMessageChanged)
 {
     dB.Execute("UPDATE " + DBTableConsts.CHAT_MESSAGE_TABLE + " SET state = ? WHERE id = ?", MessageState.DELIVERED, id);
     if (triggerMessageChanged)
     {
         ChatMessageTable msg = getChatMessageById(id);
         if (msg != null)
         {
             ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(msg, false));
         }
     }
 }
Exemplo n.º 6
0
 public void setChatMessage(ChatMessageTable message, bool triggerNewChatMessage, bool triggerMessageChanged)
 {
     dB.InsertOrReplace(message);
     if (triggerNewChatMessage)
     {
         NewChatMessage?.Invoke(this, new NewChatMessageEventArgs(message));
         if (message.isImage && !Settings.getSettingBoolean(SettingsConsts.DISABLE_IMAGE_AUTO_DOWNLOAD))
         {
             cacheImage(message);
         }
     }
     if (triggerMessageChanged)
     {
         ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(message, false));
     }
 }
Exemplo n.º 7
0
 public void setChatMessage(ChatMessageTable message, bool triggerNewChatMessage, bool triggerMessageChanged)
 {
     update(message);
     if (triggerNewChatMessage)
     {
         NewChatMessage?.Invoke(this, new NewChatMessageEventArgs(message));
         if (message.isImage)
         {
             cacheImage(message);
         }
     }
     if (triggerMessageChanged)
     {
         ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(message));
     }
 }
Exemplo n.º 8
0
        public async Task deleteChatMessageAsync(ChatMessageTable message, bool triggerMessageChanged)
        {
            if (message.isImage)
            {
                await ImageDBManager.INSTANCE.deleteImageAsync(message);
            }

            if (string.Equals(message.type, DirectMUCInvitationMessage.TYPE_MUC_DIRECT_INVITATION))
            {
                deleteMucDirectInvite(message);
            }

            dB.Delete(message);
            if (triggerMessageChanged)
            {
                ChatMessageChanged?.Invoke(this, new ChatMessageChangedEventArgs(message, true));
            }
        }
Exemplo n.º 9
0
        //--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
        #region --Set-, Get- Methods--


        #endregion
        //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
        #region --Misc Methods (Public)--
        /// <summary>
        /// Triggers the ChatMessageChanged event.
        /// </summary>
        public void onChanged()
        {
            ChatMessageChanged?.Invoke(this, new EventArgs());
        }