public static Contact GetContact(RosterItem rosterItem)
        {
            Contact contact = null;

            try
            {
                using (SQLiteCommand command = _connection.CreateCommand())
                {
                    command.CommandText = "SELECT * FROM [Contact] WHERE [Jid]=@jid";

                    command.Parameters.Add(new SQLiteParameter("jid", rosterItem.Jid.Bare));

                    SQLiteDataReader reader = command.ExecuteReader();

                    if (reader.Read())
                    {
                        contact = new Contact(reader, rosterItem);
                    }

                    reader.Close();
                }
            }

            catch (Exception e)
            {
                Events.Instance.OnEvent(e, new EventError(e.Message, null));
            }

            return contact;
        }
        public Contact(Presence presence)
        {
            _rosterItem = new RosterItem();
            _rosterItem.Jid = presence.From;

            BuildSearchText();
        }
        public Contact(RosterItem rosterItem, int metaId)
        {
            _rosterItem = rosterItem;
            _metaId = metaId;

            AskForLastTime();

            BuildSearchText();
        }
        public Contact(IDataRecord reader, RosterItem rosterItem)
        {
            _rosterItem = rosterItem;
            _metaId = (int) (Int64) reader["MetaId"];

            if (!reader.IsDBNull(reader.GetOrdinal("CustomName")))
            {
                _customName = (string) reader["CustomName"];
            }

            AskForLastTime();

            BuildSearchText();
        }
Beispiel #5
0
    public ChatFriend(RosterItem item) {
      User = item;

      var groups = item.GetGroups();
      Group = groups.Item(0).InnerXml;
    }