Growl.Daemon.SubscriptionResponse gntpListener_SubscribeReceived(Growl.Daemon.Subscriber subscriber, Growl.Connector.RequestInfo requestInfo)
        {
            bool alertUser = true;
            int ttl = Properties.Settings.Default.SubscriptionTTL;

            SubscribedForwardDestination subscribedComputer = null;
            if (this.forwards.ContainsKey(subscriber.ID))
            {
                ForwardDestination fc = this.forwards[subscriber.ID];
                subscribedComputer = fc as SubscribedForwardDestination;
                if (subscribedComputer != null)
                {
                    alertUser = false;
                }
            }

            if (subscribedComputer == null)
            {
                subscribedComputer = new SubscribedForwardDestination(subscriber, ttl);
                subscribedComputer.Unsubscribed += new SubscribedForwardDestination.SubscribingComputerUnscubscribedEventHandler(sfc_Unsubscribed);
                AddForwardDestination(subscribedComputer);
            }

            subscribedComputer.Renew();

            if (alertUser)
            {
                string title = Properties.Resources.SystemNotification_ClientSubscribed_Title;
                string text = String.Format(Properties.Resources.SystemNotification_ClientSubscribed_Text, subscriber.Name);
                SendSystemNotification(title, text);
            }

            Growl.Daemon.SubscriptionResponse response = new Growl.Daemon.SubscriptionResponse(ttl);

            // SUBSCRIBE requests are *not* forwarded (it could cause an endless loop, and it doesnt make sense anyway)

            return response;
        }
Exemple #2
0
 Growl.Daemon.SubscriptionResponse server_SubscribeReceived(Growl.Daemon.Subscriber subscriber, Growl.Connector.RequestInfo requestInfo)
 {
     Growl.Daemon.SubscriptionResponse r = new Growl.Daemon.SubscriptionResponse(300);
     return r;
 }