Example #1
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();
        }
Example #2
0
 private void toolStripMenuItemIM_Click(object sender, EventArgs e)
 {
     if (listViewBuddies.SelectedItems.Count > 0)
     {
         ListViewItem lvi = listViewBuddies.SelectedItems[0];
         ChatForm     bf  = new ChatForm(SipekResources);
         bf.BuddyId = ((CBuddyRecord)lvi.Tag).Id;
         bf.ShowDialog();
     }
 }
Example #3
0
 private void sendInstantMessageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listViewCallRegister.SelectedItems.Count > 0)
     {
         ListViewItem lvi = listViewCallRegister.SelectedItems[0];
         CCallRecord record = (CCallRecord)lvi.Tag;
         int id = CBuddyList.getInstance().getBuddyId(record.Number);
         if (id > 0)
         {
             ChatForm bf = new ChatForm(SipekResources);
             bf.BuddyId = id;
             bf.ShowDialog();
         }
     }
 }
Example #4
0
 private void sendInstantMessageToolStripMenuItem_Click(object sender, EventArgs e)
 {
   if (listViewCallRegister.SelectedItems.Count > 0)
   {
     ListViewItem lvi = listViewCallRegister.SelectedItems[0];
     CCallRecord record = (CCallRecord)lvi.Tag;
     int id = CBuddyList.getInstance().getBuddyId(record.Number);
     if (id > 0)
     {
       ChatForm bf = new ChatForm(SipekResources);
       bf.BuddyId = id;
       bf.ShowDialog();
     }
   }
 }
Example #5
0
    private void toolStripMenuItemIM_Click(object sender, EventArgs e)
    {
      if (listViewBuddies.SelectedItems.Count > 0)
      {
        ListViewItem lvi = listViewBuddies.SelectedItems[0];
        ChatForm bf = new ChatForm(SipekResources);
        bf.BuddyId = ((CBuddyRecord)lvi.Tag).Id;
        bf.ShowDialog();
      }

    }
Example #6
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();
    }