예제 #1
0
        private void buttonSendIM_Click(object sender, EventArgs e)
        {
            if (BuddyId == -1)
            {
                return;
            }

// get buddy data form _buddyId
            CBuddyRecord buddy = CBuddyList.getInstance()[BuddyId];

            if (buddy != null)
            {
// Invoke SIP stack wrapper function to send message
                SipekResources.Messenger.sendMessage(buddy.Number, textBoxChatInput.Text);

                richTextBoxChatHistory.Text += "(me) " + DateTime.Now;

//Font orgfnt = richTextBoxChatHistory.Font;
//Font fnt = new Font("Microsoft Sans Serif",16,FontStyle.Bold);
//richTextBoxChatHistory.Font = fnt;
                richTextBoxChatHistory.Text += ": " + textBoxChatInput.Text;
//richTextBoxChatHistory.Font = orgfnt;
                richTextBoxChatHistory.Text += Environment.NewLine;

                textBoxChatInput.Clear();
            }
        }
예제 #2
0
        private void MessageReceived(string from, string message)
        {
            // extract buddy ID
            string buddyId = parseFrom(from);

            // check if ChatForm already opened
            foreach (Form ctrl in Application.OpenForms)
            {
                if (ctrl.Name == "ChatForm")
                {
                    ((ChatForm)ctrl).BuddyName = buddyId;
                    ((ChatForm)ctrl).LastMessage = message;
                    ctrl.Focus();
                    return;
                }
            }

            // if not, create new instance
            ChatForm bf = new ChatForm(SipekResources);
            int id = CBuddyList.getInstance().getBuddyId(buddyId);
            if (id >= 0)
            {
                //_buddyId = id;        
                CBuddyRecord buddy = CBuddyList.getInstance()[id];
                //_titleText.Caption = buddy.FirstName + ", " + buddy.LastName;
                bf.BuddyId = (int)id;
            }
            bf.BuddyName = buddyId;
            bf.LastMessage = message;
            bf.ShowDialog();
        }
예제 #3
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            CBuddyRecord record;

            if (BuddyId >= 0)
            {
                record = CBuddyList.getInstance().getRecord(BuddyId);
                CBuddyList.getInstance().deleteRecord(BuddyId);
            }
            else
            {
                if (textBoxNumber.Text.Length == 0)
                {
                    return;
                }

                record = new CBuddyRecord();
            }
            record.FirstName = textBoxName.Text;
            //record.LastName = _lname.Caption;
            record.Number          = textBoxNumber.Text;
            record.PresenceEnabled = checkBoxPresence.Checked;

            CBuddyList.getInstance().addRecord(record);
            CBuddyList.getInstance().save();

            Close();
        }
예제 #4
0
    private void buttonOk_Click(object sender, EventArgs e)
    {
      CBuddyRecord record;

      if (BuddyId >= 0)
      {
        record = CBuddyList.getInstance().getRecord(BuddyId);
        CBuddyList.getInstance().deleteRecord(BuddyId);
      }
      else
      {
        if (textBoxNumber.Text.Length == 0) return;

        record = new CBuddyRecord();
      }
      record.FirstName = textBoxName.Text;
      //record.LastName = _lname.Caption;
      record.Number = textBoxNumber.Text;
      record.PresenceEnabled = checkBoxPresence.Checked;

      CBuddyList.getInstance().addRecord(record);
      CBuddyList.getInstance().save();

      Close();
    }
예제 #5
0
        public void initialize()
        {
            XmlDocument xmlDocument = new XmlDocument();

            try
            {
                xmlDocument.Load(XMLPhonebookFile);
            }
            catch (System.IO.FileNotFoundException ee)
            {
                System.Console.WriteLine(ee.Message);

                XmlNode root = xmlDocument.CreateNode("element", "Phonebook", "");
                xmlDocument.AppendChild(root);
            }
            catch (System.Xml.XmlException e) { System.Console.WriteLine(e.Message); }


            XmlNodeList list = xmlDocument.SelectNodes("/Phonebook/Record");

            foreach (XmlNode item in list)
            {
                CBuddyRecord record = new CBuddyRecord();

                XmlNode snode = item.SelectSingleNode(FIRSTNAME);
                if ((snode != null) && (snode.FirstChild.Value != null))
                {
                    record.FirstName = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(LASTNAME);
                if ((snode != null) && (snode.FirstChild != null) && (snode.FirstChild.Value != null))
                {
                    record.LastName = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(PHONE_NUMBER);
                if ((snode != null) && (snode.FirstChild.Value != null))
                {
                    record.Number = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(PHONE_URI);
                if ((snode != null) && (snode.FirstChild != null))
                {
                    record.Uri = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(PHONE_PRESENCE);
                if ((snode != null) && (snode.FirstChild != null))
                {
                    record.PresenceEnabled = (snode.FirstChild.Value == "" ? false : true);
                }

                this.addRecord(record);
            }
        }
예제 #6
0
        private void toolStripMenuItemRemove_Click(object sender, EventArgs e)
        {
            if (listViewBuddies.SelectedItems.Count > 0)
            {
                CBuddyRecord item = (CBuddyRecord)listViewBuddies.SelectedItems[0].Tag;

                CBuddyList.getInstance().deleteRecord(item.Id);
                UpdateBuddyList();
            }
        }
예제 #7
0
        private void initialize()
        {
            XmlDocument xmlDocument = new XmlDocument();

            try
            {
                xmlDocument.Load(XMLPhonebookFile);
            }
            catch (System.IO.FileNotFoundException ee)
            {
                System.Console.WriteLine(ee.Message);

                XmlNode root = xmlDocument.CreateNode("element", "Phonebook", "");
                xmlDocument.AppendChild(root);
            }
            catch (System.Xml.XmlException e) { System.Console.WriteLine(e.Message); }


            // initialize internal list
            _buddyList = new Dictionary <int, CBuddyRecord>();

            XmlNodeList list = xmlDocument.SelectNodes("/Phonebook/Record");

            foreach (XmlNode item in list)
            {
                CBuddyRecord record = new CBuddyRecord();

                XmlNode snode = item.SelectSingleNode(FIRSTNAME);
                if ((snode != null) && (snode.FirstChild.Value != null))
                {
                    record.FirstName = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(LASTNAME);
                if ((snode != null) && (snode.FirstChild.Value != null))
                {
                    record.LastName = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(PHONE_NUMBER);
                if ((snode != null) && (snode.FirstChild.Value != null))
                {
                    record.Number = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(PHONE_URI);
                if ((snode != null) && (snode.FirstChild != null))
                {
                    record.Uri = snode.FirstChild.Value;
                }

                //_buddyList.Add(record.Id, record);
                this.addRecord(record);
            }
        }
예제 #8
0
        private void BuddyStateChanged(int buddyId, int status, string text)
        {
            CBuddyRecord record = CBuddyList.getInstance()[buddyId];

            if (null == record) return;

            record.Status = status;
            record.StatusText = text;

            // update list...
            UpdateBuddyList();
        }
예제 #9
0
        /// <summary>
        ///
        /// </summary>
        private void UpdateCallRegister()
        {
            lock (this)
            {
                listViewCallRegister.Items.Clear();
                // Update Dial field
                toolStripComboDial.Items.Clear();

                Stack <CCallRecord> results = SipekResources.CallLogger.getList();

                int cnt = 0; int dialedcnt = 0;
                foreach (CCallRecord item in results)
                {
                    string duration = item.Duration.ToString();
                    if (duration.IndexOf('.') > 0)
                    {
                        duration = duration.Remove(duration.IndexOf('.'));                  // remove miliseconds
                    }
                    string       recorditem = item.Number;
                    CBuddyRecord rec        = null;
                    int          buddyId    = CBuddyList.getInstance().getBuddyId(item.Number);
                    if (buddyId > -1)
                    {
                        string name = "";
                        rec        = CBuddyList.getInstance()[buddyId];
                        name       = rec.FirstName + " " + rec.LastName;
                        name       = name.Trim();
                        recorditem = name + ", " + item.Number;
                    }
                    else if (item.Name.Length > 0)
                    {
                        recorditem = item.Name + ", " + item.Number;
                    }

                    ListViewItem lvi = new ListViewItem(new string[] {
                        item.Type.ToString(), recorditem.Trim(), item.Time.ToString(), duration
                    });

                    lvi.Tag = item;

                    listViewCallRegister.Items.Insert(cnt, lvi);

                    // add item to dial combo (if dialed)
                    if (item.Type == ECallType.EDialed)
                    {
                        toolStripComboDial.Items.Insert(dialedcnt++, item.Number);
                    }
                    // increase counter
                    cnt++;
                }
            }
        }
예제 #10
0
        private void placeACallToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listViewBuddies.SelectedItems.Count > 0)
            {
                ListViewItem lvi = listViewBuddies.SelectedItems[0];

                CBuddyRecord rec = (CBuddyRecord)lvi.Tag;
                if (rec != null)
                {
                    SipekResources.CallManager.createOutboundCall(rec.Number);
                }
            }
        }
예제 #11
0
        private void ChatForm_Shown(object sender, EventArgs e)
        {
// get buddy data form _buddyId
            CBuddyRecord buddy = CBuddyList.getInstance()[BuddyId];

            if (buddy != null)
            {
                tabPageChat.Text = "Chat with " + buddy.FirstName;
            }
            else
            {
                tabPageChat.Text = "Chat with " + BuddyName;
            }
        }
예제 #12
0
        private void BuddyForm_Activated(object sender, EventArgs e)
        {
            CBuddyRecord record = CBuddyList.getInstance().getRecord(BuddyId);

            if (record == null)
            {
                return;
            }

            textBoxName.Text = record.FirstName;
            //textBoxName.Caption = record.LastName;
            textBoxNumber.Text = record.Number;

            checkBoxPresence.Checked = record.PresenceEnabled;
        }
예제 #13
0
        public void addRecord(CBuddyRecord record)
        {
            int buddyindex = -1;

            buddyindex = Messenger.addBuddy(record.Number, record.PresenceEnabled);

            // shouldn't happen!!!!
            if (buddyindex == -1)
            {
                return;             //System.Diagnostics.Debug.WriteLine("");
            }
            record.Id = buddyindex;
            // add record to buddylist
            _buddyList.Add(record.Id, record);
        }
예제 #14
0
파일: menus.cs 프로젝트: erdincay/sipek-1
        public override void onEntry()
        {
            base.onEntry();

            CBuddyRecord record = CBuddyList.getInstance().getRecord(BuddyId);

            if (record == null)
            {
                return;
            }

            _fname.Caption  = record.FirstName;
            _lname.Caption  = record.LastName;
            _number.Caption = record.Number;
        }
예제 #15
0
파일: menus.cs 프로젝트: erdincay/sipek-1
        bool sendLink_Softkey(int keyId)
        {
            if (_buddyId == -1)
            {
                return(true);
            }
            // get buddy data form _buddyId
            CBuddyRecord buddy = CBuddyList.getInstance()[_buddyId];

            if (buddy != null)
            {
                // Invoke SIP stack wrapper function to send message
                CCallManager.CommonProxy.sendMessage(buddy.Number, _editBox.Caption);
            }
            _controller.previousPage();
            return(true);
        }
예제 #16
0
파일: menus.cs 프로젝트: erdincay/sipek-1
        public override void onEntry()
        {
            if (_buddyId != -1)
            {
                // get buddy data form _buddyId
                CBuddyRecord buddy = CBuddyList.getInstance()[_buddyId];
                if (buddy != null)
                {
                    _titleText.Caption = buddy.FirstName + ", " + buddy.LastName;

                    //_buddyName.Caption = buddy.Id;

                    _textBox.Caption = buddy.LastMessage;
                }
            }

            base.onEntry();
        }
예제 #17
0
        public void addRecord(CBuddyRecord record)
        {
            // Call stack to add buddy and get buddy id
            // TODO
            int buddyindex = Telephony.CCallManager.CommonProxy.addBuddy(record.Number);

            if (buddyindex == -1)
            {
                Random rnd = new System.Random(DateTime.Now.Millisecond);
                buddyindex = rnd.Next(10000);
                for (int i = 0; i < 30000; i++)
                {
                    buddyindex = rnd.Next(10000);
                }
            }
            record.Id = buddyindex;
            // add record to buddylist
            _buddyList.Add(record.Id, record);
        }
예제 #18
0
파일: menus.cs 프로젝트: erdincay/sipek-1
        public override void onEntry()
        {
            _buddyId = -1;

            // parse from string
            string buddykey = parseFrom(_fromString);
            int    id       = CBuddyList.getInstance().getBuddy(buddykey);

            if (id >= 0)
            {
                _buddyId = id;

                CBuddyRecord buddy = CBuddyList.getInstance()[_buddyId];
                _titleText.Caption = buddy.FirstName + ", " + buddy.LastName;
            }

            _textBox.Caption = _textString;

            base.onEntry();
        }
예제 #19
0
파일: menus.cs 프로젝트: erdincay/sipek-1
        bool saveLink_Softkey(int keyId)
        {
            CBuddyRecord record;

            if (BuddyId >= 0)
            {
                record = CBuddyList.getInstance().getRecord(BuddyId);
                CBuddyList.getInstance().deleteRecord(BuddyId);
            }
            else
            {
                record = new CBuddyRecord();
            }
            record.FirstName = _fname.Caption;
            record.LastName  = _lname.Caption;
            record.Number    = _number.Caption;

            CBuddyList.getInstance().addRecord(record);
            CBuddyList.getInstance().save();

            _controller.previousPage();
            return(true);
        }
예제 #20
0
 public void addRecord(CBuddyRecord record)
 {
     // Call stack to add buddy and get buddy id
       // TODO
       int buddyindex = Telephony.CCallManager.CommonProxy.addBuddy(record.Number);
       if (buddyindex == -1)
       {
     Random rnd = new System.Random(DateTime.Now.Millisecond);
     buddyindex = rnd.Next(10000);
     for (int i = 0; i < 30000; i++)
     {
       buddyindex = rnd.Next(10000);
     }
       }
       record.Id = buddyindex;
       // add record to buddylist
       _buddyList.Add(record.Id, record);
 }
예제 #21
0
        private void initialize()
        {
            XmlDocument xmlDocument = new XmlDocument();
              try
              {
            xmlDocument.Load(XMLPhonebookFile);
              }
              catch (System.IO.FileNotFoundException ee)
              {
            System.Console.WriteLine(ee.Message);

            XmlNode root = xmlDocument.CreateNode("element", "Phonebook", "");
            xmlDocument.AppendChild(root);

              }
              catch (System.Xml.XmlException e) { System.Console.WriteLine(e.Message); }

              // initialize internal list
              _buddyList = new Dictionary<int, CBuddyRecord>();

              XmlNodeList list = xmlDocument.SelectNodes("/Phonebook/Record");

              foreach (XmlNode item in list)
              {
            CBuddyRecord record = new CBuddyRecord();

            XmlNode snode = item.SelectSingleNode(FIRSTNAME);
            if ((snode != null) && (snode.FirstChild.Value != null)) record.FirstName = snode.FirstChild.Value;

            snode = item.SelectSingleNode(LASTNAME);
            if ((snode != null) && (snode.FirstChild.Value != null)) record.LastName = snode.FirstChild.Value;

            snode = item.SelectSingleNode(PHONE_NUMBER);
            if ((snode != null) && (snode.FirstChild.Value != null)) record.Number = snode.FirstChild.Value;

            snode = item.SelectSingleNode(PHONE_URI);
            if ((snode != null) && (snode.FirstChild != null)) record.Uri = snode.FirstChild.Value;

            //_buddyList.Add(record.Id, record);
            this.addRecord(record);
              }
        }
예제 #22
0
파일: menus.cs 프로젝트: AngieToro/sipek
        bool saveLink_Softkey(int keyId)
        {
            CBuddyRecord record;

              if (BuddyId >= 0)
              {
            record = CBuddyList.getInstance().getRecord(BuddyId);
            CBuddyList.getInstance().deleteRecord(BuddyId);
              }
              else
              {
            record = new CBuddyRecord();
              }
              record.FirstName = _fname.Caption;
              record.LastName = _lname.Caption;
              record.Number = _number.Caption;

              CBuddyList.getInstance().addRecord(record);
              CBuddyList.getInstance().save();

              _controller.previousPage();
              return true;
        }
예제 #23
0
    public void initialize()
    {
      XmlDocument xmlDocument = new XmlDocument();
      try
      {
        xmlDocument.Load(XMLPhonebookFile);
      }
      catch (System.IO.FileNotFoundException ee) 
      { 
        System.Console.WriteLine(ee.Message);

        XmlNode root = xmlDocument.CreateNode("element", "Phonebook", "");
        xmlDocument.AppendChild(root);

      }
      catch (System.Xml.XmlException e) { System.Console.WriteLine(e.Message); }


      XmlNodeList list = xmlDocument.SelectNodes("/Phonebook/Record");

      foreach (XmlNode item in list)
      {
        CBuddyRecord record = new CBuddyRecord();

        XmlNode snode = item.SelectSingleNode(FIRSTNAME);
        if ((snode != null) && (snode.FirstChild.Value != null)) record.FirstName = snode.FirstChild.Value;

        snode = item.SelectSingleNode(LASTNAME);
        if ((snode != null) && (snode.FirstChild != null) && (snode.FirstChild.Value != null)) record.LastName = snode.FirstChild.Value;

        snode = item.SelectSingleNode(PHONE_NUMBER);
        if ((snode != null) && (snode.FirstChild.Value != null)) record.Number = snode.FirstChild.Value;

        snode = item.SelectSingleNode(PHONE_URI);
        if ((snode != null) && (snode.FirstChild != null)) record.Uri = snode.FirstChild.Value;

        snode = item.SelectSingleNode(PHONE_PRESENCE);
        if ((snode != null) && (snode.FirstChild != null)) record.PresenceEnabled = (snode.FirstChild.Value == "" ? false : true);

        this.addRecord(record);
      }
    }
예제 #24
0
    public void addRecord(CBuddyRecord record)
    {
      int buddyindex = -1;

      buddyindex = Messenger.addBuddy(record.Number, record.PresenceEnabled);

      // shouldn't happen!!!!
      if (buddyindex == -1) return; //System.Diagnostics.Debug.WriteLine("");

      record.Id = buddyindex;
      // add record to buddylist
      _buddyList.Add(record.Id, record);
    }