Exemple #1
0
        /// <summary>
        /// Send conversation to user.
        /// </summary>
        /// <param name="user">user.</param>
        /// <param name="interlocutor">interlocutor of user in conversation.</param>
        /// <exception cref="ConnectionInterruptedException"></exception>
        private void SendConversation(OnlineUser user, string interlocutor)
        {
            int interlocutorId = DBoperations.GetUserId(interlocutor);

            if (interlocutorId == 0)
            {
                return;
            }

            // get replies from db
            ConversationReply[] replies = DBoperations.GetConversation(user.Id, interlocutorId);

            if (replies != null)
            {
                foreach (var r in replies)
                {
                    user.Client.SendMessage(new OldReplyMessage
                    {
                        Interlocutor = interlocutor,
                        Author       = DBoperations.GetUserLogin(r.user_id),
                        Time         = r.time,
                        Text         = r.reply
                    });
                }
            }
        }