Exemple #1
0
        /*
         * Create a message and put it onto the FIFO OutMsgQueue
         */
        public override int CreateMessage(string contact, string body, string subject)
        {
            CommunicationMessage msg = new CommunicationMessage();

            msg.Sender.Name       = UserName;
            msg.Sender.NickName   = UserNick;
            msg.Sender.IP4Address = LocalIP;
            msg.Sender.MachineID  = MachineName;

            body = body.Trim();

            if (isEncrypted)
            {
                // we need to encrypt the message
                body = "[CRYPTOR]" + cryptor.EncryptString(body);
            }

            msg.Message = body.Trim();

            if (contact.Length > 0)
            {
                CommunicationRecipient s = new CommunicationRecipient();
                s.Name = UserName;
                msg.Recipient.Add(s);
            }

            OutMsgQueue.Add(msg);

            if (DebugLevel > 8)
            {
                WriteDebug(string.Format("Saving Name '{0}' and body '{1}'", msg.Sender.Name, msg.Message));
            }
            return(0);
        }
Exemple #2
0
 public override int CreateMessage(string contact, string body, string subject)
 {
     try
     {
         //WriteDebug(string.Format("Createmsg - Connected={0}", clientSocket.Connected));
         CommunicationMessage Msg = new CommunicationMessage();
         Msg.Message = body;
         OutMsgQueue.Add(Msg);
     }
     catch (Exception ex)
     {
         AddError(703, ex.Message, "GETMESSAGE");
     }
     return(0);
 }
Exemple #3
0
        /*
         * Create a message for outbound and add it to the out queue
         *
         * THOUGHTS
         *      If address len>0 then it's private message
         *      If subject len>0 then it's a message to another channel?  Is that allowed?
         *
         */
        public override int CreateMessage(string address, string body, string subject)
        {
            int Result = 0;

            try
            {
                CommunicationMessage   msg = new CommunicationMessage();
                CommunicationRecipient r   = new CommunicationRecipient();

                msg.Message = body;
                r.Name      = address;

                msg.Recipient.Add(r);
                OutMsgQueue.Add(msg);
            }
            catch (Exception ex)
            {
                AddError(Result = 16, ex.Message, GetType().Name + ".CREATEMESSAGE", "Failed to create message -> " + body);
            }

            return(Result);
        }