Exemple #1
0
 /// <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);
 }
Exemple #2
0
        private void XmppOnOnRegistered(object sender)
        {
			Vcard v = new Vcard();
			Email e = new Email
			{
				UserId = _email,
				Type = EmailType.INTERNET,
				Value = _email
			};
			v.AddChild(e);
			v.JabberId = new Jid(this.Username + "@" + Host);
			VcardIq vc = new VcardIq(IqType.set, v);
			vc.To = Host;
			vc.GenerateId();
			Xmpp.Send(vc);
            if(OnRegisterComplete != null)
                OnRegisterComplete.Invoke(this,RegisterResults.Success);
        }
Exemple #3
0
        /// <summary>
        /// The xmpp on on registered.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        private void XmppOnOnRegistered(object sender)
        {
            this.myPresence.Type = PresenceType.available;
            this.myPresence.Show = ShowType.chat;
            this.MucManager = new MucManager(this.xmpp);
            var room = new Jid("lobby@conference." + this.Config.ChatHost);
            this.MucManager.AcceptDefaultConfiguration(room);

            // MucManager.JoinRoom(room,Username,Password,false);
            this.Me = new User(this.xmpp.MyJID);
            this.Me.SetStatus(UserStatus.Online);
            this.xmpp.PresenceManager.Subscribe(this.xmpp.MyJID);

            var v = new Vcard();
            var e = new Email { UserId = this.email, Type = EmailType.INTERNET, Value = this.email };
            v.AddChild(e);
            v.JabberId = new Jid(this.Username + "@" + this.Config.ChatHost);
            var vc = new VcardIq(IqType.set, v);
            vc.To = this.Config.ChatHost;
            vc.GenerateId();
            this.xmpp.Send(vc);
            if (this.OnRegisterComplete != null)
            {
                this.OnRegisterComplete.Invoke(this, RegisterResults.Success);
            }
        }
Exemple #4
0
 private void XmppOnOnRegistered(object sender)
 {
     Vcard v = new Vcard();
     v.AddEmailAddress(new Email(EmailType.HOME, _email,true));
     v.JabberId = new Jid(this.Username + "@server.octgn.info");
     VcardIq vc = new VcardIq(IqType.set,v);
     Xmpp.IqGrabber.SendIq(vc);
     if(OnRegisterComplete != null)
         OnRegisterComplete.Invoke(this,RegisterResults.Success);
 }
Exemple #5
0
 public VcardIq(IqType type, Jid to, Jid from, Vcard vcard) : this(type, to, from)
 {
     this.Vcard = vcard;
 }
Exemple #6
0
 public VcardIq(IqType type, Jid to, Vcard vcard) : this(type, to)
 {
     this.Vcard = vcard;
 }
Exemple #7
0
 public VcardIq(IqType type, Vcard vcard) : this(type)
 {
     this.Vcard = vcard;
 }
Exemple #8
0
		public VcardIq(IqType type, Jid to, Jid from, Vcard vcard) : this(type, to, from)
		{
			this.Vcard = vcard;
		}
Exemple #9
0
		public VcardIq(IqType type, Jid to, Vcard vcard) : this(type, to)
		{
			this.Vcard = vcard;
		}
Exemple #10
0
		public VcardIq(IqType type, Vcard vcard) : this(type)
		{			
			this.Vcard = vcard;
		}
Exemple #11
0
 public VCard(Vcard vcard, Jid jid)
 {
     _vcard = vcard;
     _jid = jid;
 }
        private void SetMyVcard(Vcard vcard)
        {
            if (vcard != null)
            {
                _image = Storage.ImageFromPhoto(vcard.Photo, out _avatarHash);

                _fullName = vcard.Fullname;
                _nickName = vcard.Nickname;

                NotifyPropertyChanged("FullName");
                NotifyPropertyChanged("NickName");
                NotifyPropertyChanged("DisplayName");

                Storage.CacheVCard(vcard, Jid.Bare);
            }

            if (_image == null)
            {
                _image = Storage.GetDefaultAvatar();
            }

            NotifyPropertyChanged("Image");
            NotifyPropertyChanged("IsImageTransparent");

            _card = new VCard(vcard, Jid);
        }
        public void SetVcard(Vcard vcard)
        {
            if (App.CheckAccessSafe())
            {
                _hasVCardRecieved = true;
                NotifyPropertyChanged("HasVCardRecieved");

                if (vcard != null)
                {
                    _fullName = vcard.Fullname;
                    _nickName = vcard.Nickname;

                    NotifyPropertyChanged("FullName");
                    NotifyPropertyChanged("NickName");
                    NotifyPropertyChanged("DisplayName");

                    BuildSearchText();

                    string hash;
                    Image = Storage.ImageFromPhoto(vcard.Photo, out hash);

                    if (Image != null)
                    {
                        _avatarHash = hash;
                        NotifyPropertyChanged("AvatarHash");
                    }

                    _card = new VCard(vcard, Jid);

                    NotifyPropertyChanged("Card");

                    Storage.CacheVCard(vcard, Jid.Bare);
                }
            }
            else
            {
                App.InvokeSafe(App._dispatcherPriority, new VcardHandler(SetVcard), vcard);
            }
        }
Exemple #14
0
 /// <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;
 }