예제 #1
0
        private static bool IsStopProcess()
        {
            string value = FoeServerRegistry.Get("EndFoeRssFeedUpdater");

            if ((value != null) && (value.ToUpper().CompareTo("T") == 0))
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        public static PopServer GetDefaultPopServer()
        {
            PopServer server = new PopServer();

            server.ServerName = FoeServerRegistry.Get("PopServerName");
            server.Port       = Convert.ToInt32(FoeServerRegistry.Get("PopPort"));
            server.SslEnabled = (FoeServerRegistry.Get("PopSslEnabled").ToUpper().CompareTo("T") == 0);
            server.UserName   = FoeServerRegistry.Get("PopUserName");
            server.Password   = FoeServerRegistry.Get("PopPassword");

            return(server);
        }
예제 #3
0
        public static SmtpServer GetDefaultSmtpServer()
        {
            SmtpServer server = new SmtpServer();

            server.ServerName   = FoeServerRegistry.Get("SmtpServerName");
            server.Port         = Convert.ToInt32(FoeServerRegistry.Get("SmtpPort"));
            server.AuthRequired = (FoeServerRegistry.Get("SmtpAuthRequired").ToUpper().CompareTo("T") == 0);
            server.SslEnabled   = (FoeServerRegistry.Get("SmtpSslEnabled").ToUpper().CompareTo("T") == 0);
            server.UserName     = FoeServerRegistry.Get("SmtpUserName");
            server.Password     = FoeServerRegistry.Get("SmtpPassword");

            return(server);
        }
예제 #4
0
 private static void ResetRegistryFlag()
 {
     // Reset the EndRegistrationProcessor to false.
     // When it's true, this process will stop, so we need to make sure it is set to false in the beginning.
     FoeServerRegistry.Set("EndFoeRssFeedUpdater", "F");
 }
예제 #5
0
        public static void SendRssCache(string catalogCode, string userEmail, string requestId, bool isAutoSubscription)
        {
            // Load RSS
            string rss = FoeServerCatalog.GetRssCache(catalogCode);

            if (rss == null)
            {
                throw new Exception("RSS feed " + catalogCode + " does not exist.");
            }

            // Load User info
            FoeUser user = FoeServerUser.GetUser(userEmail);

            if (user == null)
            {
                throw new Exception("User " + userEmail + " does not exist.");
            }

            // Prepare Foe Message

            /*
             * string rssBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(feed.Rss));
             * FoeMessage foeMessage = new FoeMessage();
             * foeMessage.Add(new FoeMessageItem("CatalogCode", feed.Code));
             * foeMessage.Add(new FoeMessageItem("Rss", rssBase64));
             */

            FoeDebug.Print("Generated Foe Message.");

            // Send reply to user
            try
            {
                FoeServerMessage.SendMessage(
                    FoeServerMessage.GetDefaultSmtpServer(),
                    FoeServerRegistry.Get("ProcessorEmail"),
                    userEmail,
                    SubjectGenerator.ReplySubject(RequestType.Content, catalogCode, requestId, FoeServerUser.GetUser(userEmail).UserId),
                    rss);

                FoeDebug.Print("Sent reply to user.");

                // Add user to auto-subscription list
                if (!isAutoSubscription)
                {
                    FoeServerAutoSubscribe.Add(userEmail, catalogCode, requestId);
                }
                else
                {
                    // If the caller function is just processing AutoSubscription, then
                    // we don't want to recreate the subscription, simply update the
                    // current subscription.
                    FoeServerAutoSubscribe.Update(userEmail, catalogCode, requestId);
                }

                FoeDebug.Print("Added user to Auto Subscription.");
            }
            catch (Exception except)
            {
                FoeDebug.Print("FoeServerCatalog: Error sending email.");
                FoeDebug.Print(except.ToString());
            }
        }
예제 #6
0
 /// <summary>
 /// Assign a mail process to the user.
 /// </summary>
 /// <param name="email">User's email address</param>
 /// <returns>The email address of the mail processor</returns>
 public static string AssignProcessorEmail(string email)
 {
     // get the processor from registry
     return(FoeServerRegistry.Get("ProcessorEmail"));
 }