Exemplo n.º 1
0
        public bool DeleteBuddyRequest(Profile from, Profile to)
        {
            var redis_hash_key = "add_req_" + to.Id;
            var db             = presenceStatusDatabase.GetDatabase();

            if (db.KeyExists(redis_hash_key))
            {
                db.KeyDelete(redis_hash_key);
                return(true);
            }
            return(false);
        }
        private async Task <PresenceProfileStatus> GetStatusFromProfile(Profile profile)
        {
            PresenceProfileStatus status = new PresenceProfileStatus();
            var redis_hash_key           = "status_" + profile.Id;
            var db = presenceStatusDatabase.GetDatabase();

            status.IP = db.HashGet(redis_hash_key, "address");
            ushort.TryParse(db.HashGet(redis_hash_key, "port"), out status.Port);
            uint.TryParse(db.HashGet(redis_hash_key, "status"), out status.statusFlags);
            uint.TryParse(db.HashGet(redis_hash_key, "quiet_flags"), out status.quietFlags);
            status.statusText   = db.HashGet(redis_hash_key, "status_string");
            status.locationText = db.HashGet(redis_hash_key, "location_string");
            status.profile      = profile;

            var userLookup = new UserLookup();

            userLookup.id = profile.Userid;
            var user = (await this.userRepository.Lookup(userLookup)).FirstOrDefault();

            status.user = user;
            return(status);
        }