public override Boolean ProcessMessage() { Boolean retVal = true; this.SMSAdress = this.SenderAddress; this.ImageFile = Contacts.Instance.getImageFile(this.SenderAddress, null); this.PhoneNumber = Contacts.rawNumber(this.SenderAddress); runScript("OnSMSAlert"); if (!Directory.Exists(ApplicationSettings.Instance.LocalDataPath + @"\SMS")) { Directory.CreateDirectory(ApplicationSettings.Instance.LocalDataPath + @"\SMS"); } string rawPhoneNumber = Contacts.rawNumber(this.SenderAddress); string smsFile = string.Format(@"{0}\SMS\{1}.xml", ApplicationSettings.Instance.LocalDataPath, rawPhoneNumber); string xml = this.XML; XmlDocument smsXmlDoc = new XmlDocument(); if (File.Exists(smsFile)) { smsXmlDoc.Load(smsFile); } else { smsXmlDoc.LoadXml("<BlurtsData><Messages/></BlurtsData>"); } XmlDocument msgXmlDoc = new XmlDocument(); msgXmlDoc.LoadXml(xml); XmlNode smsNode = msgXmlDoc.DocumentElement.FirstChild; XmlNode messagesNode = smsXmlDoc.DocumentElement.FirstChild; XmlNode newNode = smsXmlDoc.ImportNode(smsNode, true); XmlElement newElement = (XmlElement)newNode; newElement.SetAttribute("timestamp", DateTime.Now.ToString()); messagesNode.AppendChild(newNode); smsXmlDoc.Save(smsFile); AlertHistory.Instance.AddAlert(XML); //FIX m_form.Invoke(new EventHandler(m_form.FireSMSEvent)); return(retVal); }
public override Boolean ProcessMessage() { this.PhoneNumber = Contacts.rawNumber(this.FormattedNumber); this.ImageFile = Contacts.Instance.getImageFile(this.FormattedNumber, null); this.PlaySound = false; this.Priority = this.HighPriority; if (this.Action != this.Disconnected) { this.DisplayInterval = 120 * 1000; } runScript("OnCallAlert"); AlertHistory.Instance.AddAlert(XML); return(true); }
public void setFileName(string address) { m_ident = Contacts.rawNumber(address); m_xmlFilepath = string.Format(@"{0}\SMS\{1}.xml", ApplicationSettings.Instance.LocalDataPath, m_ident); }