Exemple #1
0
 /// <summary>
 /// Calculates the rough length, in bytes, of a queued message
 /// </summary>
 /// <param name="qm"></param>
 /// <returns></returns>
 static int calculateByteLength(QueuedMessage qm)
 {
     // PRIVMSG #channelname :My message here (10 + destination + message)
     // NOTICE #channelname :My message here (9 + dest + msg)
     if (qm.type == SendType.Notice)
         return 11 + System.Text.ASCIIEncoding.Unicode.GetByteCount(qm.message)
             + System.Text.ASCIIEncoding.Unicode.GetByteCount(qm.destination);
     else
         return 12 + System.Text.ASCIIEncoding.Unicode.GetByteCount(qm.message)
             + System.Text.ASCIIEncoding.Unicode.GetByteCount(qm.destination);
 }
Exemple #2
0
        /// <summary>
        /// Route all irc.SendMessage() calls through this to use the queue
        /// </summary>
        public static void SendMessageF(SendType type, string destination, string message, bool IsDroppable, bool IsPriority)
        {
            QueuedMessage qm = new QueuedMessage();
            qm.type = type;
            qm.message = message;
            qm.destination = destination;
            qm.SentTime = DateTime.Now.Ticks;
            qm.IsDroppable = IsDroppable;

            if (IsPriority)
                lock (priQueue)
                    priQueue.Enqueue(qm);
            else
                lock (fcQueue)
                    fcQueue.Enqueue(qm);

            //logger.Info("Queued item");
        }