コード例 #1
0
ファイル: Class.cs プロジェクト: JGunning/OpenAIM
 public override bool Hook_BeforeIgnore(Extension.MessageArgs _IgnoreArgs)
 {
     if (_IgnoreArgs.user == null)
     {
         collector.scrollback.InsertText("{" + _IgnoreArgs.window.WindowName + "} " + _IgnoreArgs.text, ContentLine.MessageStyle.Message, false, _IgnoreArgs.date, true);
         return true;
     }
     collector.scrollback.InsertText("{" + _IgnoreArgs.window.WindowName + "} " + Protocol.PRIVMSG(_IgnoreArgs.user.Nick, _IgnoreArgs.text), ContentLine.MessageStyle.Message, false, _IgnoreArgs.date, true);
     return true;
 }
コード例 #2
0
ファイル: Events.cs プロジェクト: JGunning/OpenAIM
 /// <summary>
 /// This function is called by a related handler and should not be called anywhere else
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public static void TriggerBeforeConnect(object sender, Extension.NetworkInfo e)
 {
     try
     {
         if (BeforeConnect != null)
         {
             BeforeConnect(sender, e);
         }
     }
     catch (Exception fail)
     {
         Core.handleException(fail);
     }
 }
コード例 #3
0
ファイル: Search.cs プロジェクト: JGunning/OpenAIM
 public override void Hook_BeforeTextMenu(Extension.ScrollbackArgs Args)
 {
     text = Args.scrollback.SelectedText;
     Gtk.SeparatorMenuItem xx = new Gtk.SeparatorMenuItem();
     xx.Show();
     Args.menu.Add(xx);
     Gtk.MenuItem wiki = new Gtk.MenuItem("Search using wiki");
     wiki.Activated += new EventHandler(SearchWiki);
     wiki.Show();
     Args.menu.Add(wiki);
     Gtk.MenuItem goog = new Gtk.MenuItem("Search using google");
     goog.Show();
     goog.Activated += new EventHandler(SearchGoogle);
     Args.menu.Add(goog);
 }
コード例 #4
0
ファイル: TopicDiff.cs プロジェクト: JGunning/OpenAIM
        public override bool Hook_Topic(Extension.TopicArgs _TopicArgs)
        {
            string old_topic = _TopicArgs.channel.Topic;
            if (old_topic == null)
            {
                // there is nothing to make a diff from
                return true;
            }

            string length_info = "No change in length";

            if (_TopicArgs.Topic.Length != old_topic.Length)
            {
                int size = _TopicArgs.Topic.Length - old_topic.Length;
                if (size > 0)
                {
                    length_info = "New topic has " + size.ToString() + " more characters";
                }
                else
                {
                    length_info = "New topic has " + size.ToString() + " less characters";
                }
            }

            List<string> rm = new List<string>();
            List<string> add = new List<string>();
            List<string> words_new = new List<string>();
            words_new.AddRange(_TopicArgs.Topic.Split('.', ' ', ',', '(', ')'));
            List<string> words_old = new List<string>();
            words_old.AddRange(old_topic.Split('.', ' ', ',', '(', ')'));

            foreach (string word in words_old)
            {
                if (!words_new.Contains(word))
                {
                    rm.Add(word);
                }
            }

            foreach (string word in words_new)
            {
                if (!words_old.Contains(word))
                {
                    add.Add(word);
                }
            }

            string word_info = "No words changed";

            if (add.Count > 0 || rm.Count > 0)
            {
                word_info = "";
                if (add.Count > 0)
                {
                    word_info += "added: ";
                    foreach (string data in add)
                    {
                        word_info += data + " ";
                    }
                }
                if (rm.Count > 0)
                {
                    word_info += "removed: ";
                    foreach (string data in rm)
                    {
                        word_info += data + " ";
                    }
                }
            }

            Graphics.Window window = _TopicArgs.channel.RetrieveWindow();

            if (window != null)
            {
                window.scrollback.InsertText("Topic change: " + length_info + ", " + word_info, ContentLine.MessageStyle.System, true, _TopicArgs.date);
                window.scrollback.InsertText("Old topic: " + old_topic, ContentLine.MessageStyle.System, true, _TopicArgs.date);
                window.scrollback.InsertText("New topic: " + _TopicArgs.Topic, ContentLine.MessageStyle.System, true, _TopicArgs.date);
            }

            return true;
        }
コード例 #5
0
ファイル: Events.cs プロジェクト: JGunning/OpenAIM
 /// <summary>
 /// This function is called by a related handler and should not be called anywhere else
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public static void TriggerBeforeUserMenu(object sender, Extension.BeforeUserMenuArgs e)
 {
     try
     {
         if (BeforeUserMenu != null)
         {
             BeforeUserMenu(sender, e);
         }
     }
     catch (Exception fail)
     {
         Core.handleException(fail);
     }
 }
コード例 #6
0
ファイル: Events.cs プロジェクト: JGunning/OpenAIM
 /// <summary>
 /// This function is called by a related handler and should not be called anywhere else
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public static void TriggerInitialise(object sender, Extension.SystemInitialiseArgs e)
 {
     try
     {
         if (Initialise != null)
         {
             Initialise(sender, e);
         }
     }
     catch (Exception fail)
     {
         Core.handleException(fail);
     }
 }
コード例 #7
0
ファイル: Events.cs プロジェクト: JGunning/OpenAIM
 /// <summary>
 /// This function is called by a related handler and should not be called anywhere else
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public static void TriggerMouseHover(object sender, Extension.MouseHoverArgs e)
 {
     try
     {
         if (OnMouseHover != null)
         {
             OnMouseHover(sender, e);
         }
     }
     catch (Exception fail)
     {
         Core.handleException(fail);
     }
 }
コード例 #8
0
ファイル: Core_Modules.cs プロジェクト: JGunning/OpenAIM
 /// <summary>
 /// Register a new plugin
 /// </summary>
 /// <param name="plugin"></param>
 /// <returns></returns>
 public static bool RegisterPlugin(Extension plugin)
 {
     if (plugin._Status == Extension.Status.Loading)
     {
         lock (Extensions)
         {
             if (Extensions.Contains(plugin))
             {
                 return false;
             }
             Extensions.Add(plugin);
         }
         if (plugin.Hook_OnRegister())
         {
             plugin.Load();
             if (Core.SystemForm != null)
             {
                 Core.SystemForm.main.scrollback.InsertText("Loaded plugin " + plugin.Name + " (v. " + plugin.Version + ")", Client.ContentLine.MessageStyle.System, false);
             }
             return true;
         }
         return false;
     }
     return true;
 }