예제 #1
0
        public override string Extension_DumpHtml(Channel channel)
        {
            string HTML = "";

            DebugLog("Getting html for " + channel.Name);
            try
            {
                if (GetConfig(channel, "RC.Enabled", false))
                {
                    RecentChanges rc = (RecentChanges)channel.RetrieveObject("RC");
                    if (rc != null)
                    {
                        HTML = rc.ToTable();
                    }
                    else
                    {
                        Syslog.ErrorLog("NULL rc for " + channel.Name);
                    }
                }
                else
                {
                    DebugLog("RC is disabled for " + channel.Name, 2);
                }
            }
            catch (Exception fail)
            {
                HandleException(fail);
            }
            return(HTML);
        }
예제 #2
0
        public override void Hook_ChannelDrop(Channel chan)
        {
            RecentChanges rc = (RecentChanges)chan.RetrieveObject("RC");

            if (rc != null && RecentChanges.recentChangesList.Contains(rc))
            {
                RecentChanges.recentChangesList.Remove(rc);
            }
            if (File.Exists(Variables.ConfigurationDirectory + Path.DirectorySeparatorChar + chan.Name + ".list"))
            {
                Log("Removing db of " + chan.Name + " RC feed");
                File.Delete(Variables.ConfigurationDirectory + Path.DirectorySeparatorChar + chan.Name + ".list");
            }
        }
예제 #3
0
 public override void Load()
 {
     try
     {
         Log("Loading feed");
         RecentChanges.Connect();
         RecentChanges.Provider.On_Error     += OnError;
         RecentChanges.Provider.On_Change    += OnChange;
         RecentChanges.Provider.On_Timeout   += Provider_On_Timeout;
         RecentChanges.Provider.On_Exception += Provider_On_Exception;
         while (Core.IsRunning)
         {
             System.Threading.Thread.Sleep(200);
         }
     }
     catch (System.Threading.ThreadAbortException)
     {
     }
     catch (Exception fail)
     {
         HandleException(fail);
     }
 }
예제 #4
0
        public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
        {
            if (message.StartsWith(Configuration.System.CommandPrefix + "RC-"))
            {
                if (channel.SystemUsers.IsApproved(invoker, "recentchanges-remove"))
                {
                    if (GetConfig(channel, "RC.Enabled", false))
                    {
                        string[] a = message.Split(' ');
                        if (a.Length < 3)
                        {
                            IRC.DeliverMessage(messages.Localize("Feed8", channel.Language, new List <string> {
                                invoker.Nick
                            }), channel.Name);
                            return;
                        }
                        string        wiki = a[1];
                        string        Page = a[2];
                        RecentChanges rc   = (RecentChanges)channel.RetrieveObject("RC");
                        if (rc != null)
                        {
                            rc.RemovePage(wiki, Page);
                        }
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("Feed3", channel.Language), channel);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel);
                }
                return;
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "RC+ "))
            {
                if (channel.SystemUsers.IsApproved(invoker, "recentchanges-add"))
                {
                    if (GetConfig(channel, "RC.Enabled", false))
                    {
                        string[] a = message.Split(' ');
                        if (a.Length < 3)
                        {
                            IRC.DeliverMessage(messages.Localize("Feed4", channel.Language) + invoker.Nick + messages.Localize("Feed5", channel.Language), channel);
                            return;
                        }
                        string wiki = a[1];
                        string Page = a[2];
                        if (wiki.Contains("_"))
                        {
                            IRC.DeliverMessage("Underscore in wiki name is not supported, new format is for example: en.wikipedia.org instead of en_wikipedia", channel);
                            return;
                        }
                        RecentChanges rc = (RecentChanges)channel.RetrieveObject("RC");
                        if (rc != null)
                        {
                            rc.MonitorPage(wiki, Page);
                        }
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("Feed3", channel.Language), channel);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel);
                }
                return;
            }
        }