/// <summary> /// Convertit la fiche d'identit� au format utilis� par la librairie agsXMPP /// </summary> /// <returns>Carte de visite</returns> public agsXMPP.protocol.iq.vcard.Vcard toVcard() { agsXMPP.protocol.iq.vcard.Vcard vcard = new agsXMPP.protocol.iq.vcard.Vcard(); vcard.Birthday = birthday; vcard.Description = description; vcard.Fullname = fullname; vcard.JabberId = new agsXMPP.Jid(jabberID.full); vcard.Name = new agsXMPP.protocol.iq.vcard.Name(name.lastname, name.firstname, name.middle); vcard.Nickname = nickname; vcard.Organization = new agsXMPP.protocol.iq.vcard.Organization(organization.name, organization.unit); if (photoFormat != null) { vcard.Photo = new agsXMPP.protocol.iq.vcard.Photo(photo, photoFormat); } else { vcard.Photo = null; } vcard.Role = role; vcard.Title = title; vcard.Url = url; foreach (Email m in email) { vcard.AddEmailAddress(new agsXMPP.protocol.iq.vcard.Email(Enumerations.EmailTypeConverter(m.type), m.address, false)); } foreach (Telehone t in telephone) { vcard.AddTelephoneNumber(new agsXMPP.protocol.iq.vcard.Telephone(Enumerations.LocationTypeConverter(t.location), Enumerations.PhoneTypeConverter(t.type), t.number)); } foreach (Address a in address) { agsXMPP.protocol.iq.vcard.Address ad = new agsXMPP.protocol.iq.vcard.Address(); ad.Country = a.country; ad.ExtraAddress = a.extra; ad.Locality = a.city; ad.Location = Enumerations.AddressLocationTypeConverter(a.location); ad.PostalCode = a.zipcode; ad.Region = a.region; ad.Street = a.street; vcard.AddAddress(ad); } return(vcard); }
/// <summary> /// /// </summary> /// <returns></returns> public Address[] GetAddresses() { ElementList el = SelectElements(typeof(Address)); int i = 0; Address[] result = new Address[el.Count]; foreach (Address add in el) { result[i] = add; i++; } return result; }
public void AddAddress(Address addr) { Address a = GetAddress(addr.Location); if (a != null) a.Remove(); this.AddChild(addr); }
/// <summary> /// Convertit la fiche d'identit� au format utilis� par la librairie agsXMPP /// </summary> /// <returns>Carte de visite</returns> public agsXMPP.protocol.iq.vcard.Vcard toVcard() { agsXMPP.protocol.iq.vcard.Vcard vcard = new agsXMPP.protocol.iq.vcard.Vcard(); vcard.Birthday = birthday; vcard.Description = description; vcard.Fullname = fullname; vcard.JabberId = new agsXMPP.Jid(jabberID.full); vcard.Name = new agsXMPP.protocol.iq.vcard.Name(name.lastname, name.firstname, name.middle); vcard.Nickname = nickname; vcard.Organization = new agsXMPP.protocol.iq.vcard.Organization(organization.name, organization.unit); if (photoFormat != null) { vcard.Photo = new agsXMPP.protocol.iq.vcard.Photo(photo, photoFormat); } else { vcard.Photo = null; } vcard.Role = role; vcard.Title = title; vcard.Url = url; foreach (Email m in email) { vcard.AddEmailAddress(new agsXMPP.protocol.iq.vcard.Email(Enumerations.EmailTypeConverter(m.type), m.address, false)); } foreach (Telehone t in telephone) { vcard.AddTelephoneNumber(new agsXMPP.protocol.iq.vcard.Telephone(Enumerations.LocationTypeConverter(t.location), Enumerations.PhoneTypeConverter(t.type), t.number)); } foreach (Address a in address) { agsXMPP.protocol.iq.vcard.Address ad = new agsXMPP.protocol.iq.vcard.Address(); ad.Country = a.country; ad.ExtraAddress = a.extra; ad.Locality = a.city; ad.Location = Enumerations.AddressLocationTypeConverter(a.location); ad.PostalCode = a.zipcode; ad.Region = a.region; ad.Street = a.street; vcard.AddAddress(ad); } return vcard; }