Exemplo n.º 1
0
		public SubscriptionResource(Subscription subscription, Publication publication, IEnumerable<string> categories, ExpiresList expiresList, uint expires)
        {
			this.proccessingSubscribe = true;
            this.Subscription = subscription;
            this.Publication = publication;
            this.SubsCategories = new List<string>(categories);
            this.expiresList = expiresList;
            this.expires = expires;
            this.tickCount = Environment.TickCount;

            this.Subscription.AddResource(this);
            this.Publication.AddResource(this);
            this.expiresList.AddResource(this);
        }
Exemplo n.º 2
0
		public List<OutContent> ProcessSubscription(string uri, string dialogId, BatchSubscribe batchSubs, uint expires, string endpointId, object param)
		{
			Rlmi rlmi = null;
			List<Categories> categories;
			List<OutContent> multipart = null;

			lock (sync)
			{
				try
				{
					Subscription subscription;
					if (subscriptions.TryGetValue(dialogId, out subscription) == false)
					{
						subscription = new Subscription(uri, endpointId, param);
						subscriptions.Add(dialogId, subscription);
					}

					subscription.Process(batchSubs, expireList, expires, out rlmi, out categories);

					if (rlmi != null)
					{
						multipart = new List<OutContent>();

						multipart.Add(new OutContent(rlmi, this.sync));

						if (categories != null)
							categories.ForEach(item => multipart.Add(new OutContent(item, this.sync)));
					}

					return multipart;
				}
				catch (Exception e)
				{
					throw new EnhancedPresenceException("ProcessSubscription failed", e);
				}
				finally
				{
					if (rlmi != null)
						rlmi.Dispose();
				}
			}
		}