Ejemplo n.º 1
0
        public MessageForm(User user, DGPContact contact, Socket socket)
        {
            initData();

            this.user			= user;
            this._contact		= contact;
            this._clientSocket	= socket;
            this.SetDGPContactName( _contact.Name);

            //this.DisplayMessage("Till : " + contact.Name + "\n", Color.Purple, "");
        }
Ejemplo n.º 2
0
        private void UpdateContact(string message)
        {
            // messageBuffer[0] == ID
            // messageBuffer[1] == Name
            // messageBuffer[2][0] == Status
            string [] messageBuffer = message.Split('\n');

            DGPContact contact = new DGPContact(messageBuffer[0], messageBuffer[1], messageBuffer[2][0]);

            if (updateContact != null)
            {
                updateContact(this, new ContactUpdateArgs(contact));
            }
        }
Ejemplo n.º 3
0
        private void UpdateContactList(string contactsString)
        {
            Contacts.Clear();

            string [] contactList = contactsString.Split('\n');

            if (contactList.Length > 2)
            {
                for (int i = 0; i < contactList.Length; i += 3)
                {
                    DGPContact contact = new DGPContact(contactList[i], contactList[i + 1], contactList[i + 2][0]);
                    Contacts.Add(contact);
                    updateContact(this, new ContactUpdateArgs(contact));
                }
            }
        }
Ejemplo n.º 4
0
        public MessageForm(Conversation conv, string mail)
        {
            initData();

            this.SetConversation( conv );
            this._contact		= new DGPContact(mail, "", 'Z');

            this.UpdateMsnContactName();

            //this.DisplayMessage("Till : " + contact.Name + "\n", Color.Purple, "");
        }
Ejemplo n.º 5
0
        public MessageForm(string contactId)
        {
            initData();

            this.user.DisplayName = "NULL";
            this._contact		= new DGPContact(contactId, "NULL", 'Z');

            this.SetDGPContactName(contactId);
        }
Ejemplo n.º 6
0
        private void UpdateContactList(string contactsString)
        {
            Contacts.Clear();

            string [] contactList = contactsString.Split('\n');

            if(contactList.Length > 2)
            {
                for(int i = 0; i < contactList.Length; i += 3)
                {
                    DGPContact contact = new DGPContact(contactList[i], contactList[i+1], contactList[i+2][0]);
                    Contacts.Add(contact);
                    updateContact(this, new ContactUpdateArgs(contact));
                }
            }
        }
Ejemplo n.º 7
0
        private void UpdateContact(string message)
        {
            // messageBuffer[0] == ID
            // messageBuffer[1] == Name
            // messageBuffer[2][0] == Status
            string [] messageBuffer = message.Split('\n');

            DGPContact contact = new DGPContact(messageBuffer[0], messageBuffer[1], messageBuffer[2][0]);

            if(updateContact != null)
            {
                updateContact(this, new ContactUpdateArgs(contact));
            }
        }
Ejemplo n.º 8
0
        private void UpdateContact(DGPContact contact)
        {
            bool found = false;
            for(int i = 0; i < this.Contacts.Count && !found; i++)
            {
                DGPContact listContact = (DGPContact)Contacts[i];
                if(contact.IsMSNContact == listContact.IsMSNContact)
                {
                    if(contact.IsMSNContact)
                    {
                        if(contact.MSNContact.Mail == listContact.MSNContact.Mail)
                        {
                            listContact = contact;
                            found = true;
                        }
                    }
                    else
                    {
                        if(contact.Id == listContact.Id)
                        {
                            listContact = contact;
                            found = true;
                        }
                    }
                }
            }

            if(!found)
            {
                Contacts.Add(contact);
            }

            SortListBox();
        }
Ejemplo n.º 9
0
        private void SortListBox()
        {
            listBox1.SuspendLayout();

            //ArrayList contacts = new ArrayList(D);
            ArrayList onlineContacts = new ArrayList();
            ArrayList offlineContacts = new ArrayList();

            DGPContact onlineGroupHeader = new DGPContact("-1", "Online", OnlineStatus.ONLINE);
            DGPContact offlineGroupHeader = new DGPContact("-2", "Offline", OnlineStatus.ONLINE);

            foreach(DGPContact con in Contacts)
            {
                if(con.IsMSNContact)
                {
                    if(con.MSNContact.Status != MSNStatus.Offline)
                    {
                        onlineContacts.Add(con);
                    }
                    else
                    {
                        offlineContacts.Add(con);
                    }
                }
                else
                {
                    if(con.DGPStatus.Status != OnlineStatus.OFFLINE)
                    {
                        onlineContacts.Add(con);
                    }
                    else
                    {
                        offlineContacts.Add(con);
                    }
                }
            }

            foreach(DGPContact con in listBox1.Items)
            {
                if(con.Id != "")
                {
                    int id = int.Parse(con.Id);
                    if(id < 0)
                    {
                        switch(id)
                        {
                            case -1: onlineGroupHeader = con; break;
                            case -2: offlineGroupHeader = con; break;
                        }
                    }
                }
            }

            listBox1.Items.Clear();

            onlineGroupHeader.Name = "Online (" + onlineContacts.Count.ToString()+")";
            listBox1.Items.Add(onlineGroupHeader);
            if(onlineGroupHeader.DGPStatus.Status == OnlineStatus.ONLINE)
            {
                if(onlineContacts.Count == 0)
                {
                    listBox1.Items.Add(new DGPContact("-3", "Ingen", OnlineStatus.ONLINE));
                }
                else
                {
                    listBox1.Items.AddRange((DGPContact []) onlineContacts.ToArray(typeof(DGPContact)));

                }
            }

            offlineGroupHeader.Name = "Offline (" + offlineContacts.Count.ToString()+")";
            listBox1.Items.Add(offlineGroupHeader);
            if(offlineGroupHeader.DGPStatus.Status == OnlineStatus.ONLINE)
            {
                if(offlineContacts.Count == 0)
                {
                    listBox1.Items.Add(new DGPContact("-3", "Ingen", OnlineStatus.ONLINE));
                }
                else
                {
                    listBox1.Items.AddRange((DGPContact []) offlineContacts.ToArray(typeof(DGPContact)));
                }
            }

            listBox1.ResumeLayout(true);
        }
Ejemplo n.º 10
0
        private MessageForm NewMessageForm(User user, string contactId, Socket socket, bool activate)
        {
            DGPContact contact = new DGPContact(contactId, contactId, OnlineStatus.OFFLINE);
            foreach(DGPContact fr in listBox1.Items)
            {
                if(fr.Id == contactId)
                {
                    contact = fr;
                }
            }

            MessageForm messageForm = new MessageForm(user, contact, socket);

            NewMessageFormCreated(messageForm);

            messageForm.Active		= activate;

            if(activate)
            {
                messageForm.BringToFront();
            }
            return messageForm;
        }
Ejemplo n.º 11
0
 public ContactUpdateArgs(DGPContact init)
 {
     contact = init;
 }
Ejemplo n.º 12
0
 public ContactUpdateArgs(DGPContact init)
 {
     contact = init;
 }