Exemplo n.º 1
0
        static void session_OnImReceived(AccSession session, IAccImSession imSession, IAccParticipant sender, IAccIm im)
        {
            //convert IM to a String
            String strReceive = im.GetConvertedText(MIME_TYPE);

            //get timestamp
            String time = im.get_Property(AccImProp.AccImProp_Timestamp).ToString();

            time = time.Substring(time.IndexOf(":") - 2).Trim();

            //get if this is an auto-response
            if (Enum.GetName(typeof(AccImFlags), im.get_Property((AccImProp)AccImFlags.AccImFlags_AutoResponse)) == AccImFlags.AccImFlags_AutoResponse.ToString())
            {
                //add users sn and auto-response to the front of the text
                strReceive = "<font color=\"red\">AUTO RESPONSE FROM " + sender.Name + " (" + time + ")</font>: " + strReceive;
            }
            else
            {
                //add the users sn to the front of the text
                strReceive = "<font color=\"red\">" + sender.Name + " (" + time + ")</font>: " + strReceive;
            }

            //raise the event
            if (InstantMessageReceived != null)
            {
                InstantMessageReceived.Invoke(sender.Name, strReceive, imSession);
            }
        }
 protected virtual void OnInstantMessageReceived(InstantMessageEventArgs e)
 {
     InstantMessageReceived?.Invoke(this, e);
 }