/// <summary> /// Constructeur /// </summary> public Contact(agsXMPP.Jid jid, string nickname, agsXMPP.Xml.Dom.ElementList grps) { _identity = new Identity(jid); if (nickname != null && nickname.Trim() != string.Empty) { _identity.nickname = nickname; } if (grps != null) { foreach (agsXMPP.protocol.Base.Group g in grps) { if (!_groups.Contains(g.Name)) { _groups.Add(g.Name); } } } _status = new Status(); _status.type = Enums.StatusType.Unavailable; _status.message = string.Empty; _mood = new Mood(); _mood.type = Enums.MoodType.none; _mood.text = string.Empty; _activity = new Activity(); _activity.type = Enums.ActivityType.none; _activity.text = string.Empty; _location = new Location(); _location.altitude = 0; _location.latitude = 0; _location.longitude = 0; _location.bearing = 0; _location.error = 0; _location.speed = 0; _location.area = string.Empty; _location.building = string.Empty; _location.country = string.Empty; _location.datum = string.Empty; _location.description = string.Empty; _location.floor = string.Empty; _location.locality = string.Empty; _location.postalcode = string.Empty; _location.region = string.Empty; _location.room = string.Empty; _location.street = string.Empty; _location.text = string.Empty; _location.timestamp = new DateTime(); _location.uri = string.Empty; _tune = new Tune(); _tune.artist = string.Empty; _tune.length = 0; _tune.rating = 1; _tune.source = string.Empty; _tune.title = string.Empty; _tune.track = 0; _tune.uri = string.Empty; }
public static string GetAvatarImagePath(Identity contactIdentity) { if (contactIdentity == null) { return string.Empty; } string tmpFileName = String.Format(thumbDir + "avatar_{0}.png", GetSafeFileName(contactIdentity.jabberID)); if (File.Exists(tmpFileName)) { return tmpFileName; } else { return String.Empty; } }
public static void SaveAvatarImage(Identity contactIdentity) { try { if (!Directory.Exists(thumbDir)) { Directory.CreateDirectory(thumbDir); } if (contactIdentity.photo != null) { contactIdentity.photo.Save(String.Format(thumbDir + "avatar_{0}.png", GetSafeFileName(contactIdentity.jabberID))); Log.Info("{0}: Avatar Image for '{1}' downloaded!", new string[] { Helper.PLUGIN_NAME, contactIdentity.jabberID.bare}); } } catch (Exception e) { Log.Error(e); } }
/// <summary> /// Se produit lorsque le flux XMPP est disponible /// </summary> /// <param name="sender">Objet parent</param> private void xmppOnLogin(object sender) { Jabber.xmpp.DiscoInfo = Queries.getDiscoInfo(); xmppDiscoServer(); _queries = new Queries(); _privacy = new Privacy(); _bookmarks = new Bookmarks(); _identity = new Identity(xmpp.MyJID); _identity.retrieve(); _roster = new Roster(); _presence = new Presence(); OnConnected(); xmpp.RequestRoster(); }
/// <summary> /// Se produit lorsque le flux XMPP est fermé /// </summary> /// <param name="sender">Objet parent</param> private void xmppOnClose(object sender) { if (_bookmarks != null) { _bookmarks.Dispose(); _bookmarks = null; } if (_privacy != null) { _privacy.Dispose(); _privacy = null; } if (_identity != null) { _identity.Dispose(); _identity = null; } if (_roster != null) { _roster.Dispose(); _roster = null; } if (_presence != null) { _presence.Dispose(); _presence = null; } if (_queries != null) { _queries.Dispose(); _queries = null; } OnDisconnected(); }
/// <summary> /// Destructeur /// </summary> public void Dispose() { if (_identity != null) { //_identity.save(); _identity.Dispose(); _identity = null; } }