public SendTrackbacks(IBackgroundServiceService backgroundServiceService, ITrackbackOutboundService trackbackOutboundService)
            : base(backgroundServiceService)
        {
            this.trackbackOutboundService = trackbackOutboundService;

            ID       = new Guid("{67E3E02C-1522-4814-8693-2FBBD37F71B8}");
            Name     = "Oxite Trackback Sender";
            Category = "Background Services";
        }
Exemple #2
0
        private void PostSaved(IPluginContext context, object state)
        {
            //TODO: (erikpo) Move this decision out of the plugin itself and back into the plumbing
            if (context.Plugin.Enabled)
            {
                ITrackbackOutboundService trackbackOutboundService = context.Container.Resolve <ITrackbackOutboundService>();
                Post post = (Post)state;

                if (post.Published.HasValue)
                {
                    string postUrl = context.Container.Resolve <AbsolutePathHelper>().GetAbsolutePath(post);
                    IEnumerable <TrackbackOutbound> trackbacksToAdd    = extractTrackbacks(context, post, postUrl, post.Area.DisplayName);
                    IEnumerable <TrackbackOutbound> unsentTrackbacks   = trackbackOutboundService.GetUnsent(post.ID);
                    IEnumerable <TrackbackOutbound> trackbacksToRemove = trackbacksToAdd.Where(tb => !unsentTrackbacks.Contains(tb) && !tb.Sent.HasValue);

                    trackbackOutboundService.Remove(trackbacksToRemove);
                    trackbackOutboundService.Save(trackbacksToAdd);
                }
                else
                {
                    //TODO: (erikpo) Remove all outbound trackbacks
                }
            }
        }
 public SendTrackbacks(ITrackbackOutboundService trackbackOutboundService)
 {
     this.trackbackOutboundService = trackbackOutboundService;
 }