2 /* Circ.Lib : main library behind Circ
3 * Copyright (C) 2007 LAVAL Jérémie
5 * This file is licensed under the terms of the LGPL.
7 * For the complete licence see the file COPYING.
12 using Circ
.Controller
;
15 namespace Circ
.Plugins
17 [Mono
.Addins
.TypeExtensionPoint("/Circ/Plugins")]
18 public abstract class Plugin
20 #region Things that people should implement
22 /// Ask the names of the authors of the plugin
24 /// <return>The names of the authors</return>
25 public abstract string[] Authors { get; }
28 /// Ask the name of the plugin
30 /// <return>The name of the plugin</return>
31 public abstract string Name { get; }
34 /// Ask the description of the plugin
36 /// <return>The description of the plugin</return>
37 public abstract string Description { get; }
40 /// Ask the version in textual form of the plugin
42 /// <return>the version of the plugin</return>
43 public abstract string Version { get; }
46 /// This method is used by the plugin to allocate the ressource it might need
48 /// <return>Return true if the operation was successful, false if a problem happened</return>
49 /// <remarks>If the method return false, the Dispose method is called and the plugin isn't added to the factory</remarks>
50 public abstract bool InitializePlugin();
53 /// This method is used by the plugin to dispose its ressources
55 public abstract void Dispose();
59 /// If your plugin provides services via commands (like the classical ones i.e. /nick, /away etc...)
62 /// <remarks>Return just the name of the command (ex : foo and not /foo)</remarks>
63 public abstract string[] CommandsProvided { get; }
66 /// Give the command and its parameters to the plugin to allo it to do its job
68 /// <param name="cmd">the command and its parameter</param>
69 /// <remarks>The trailing slash (/) is stripped from the command (ex: "foo bar" and not "/foo bar"</remarks>
70 public abstract void ParseCommand(string cmd);
73 #region Common ways to interact with the connections
75 protected void ConnectNewServer(ConnectionInfo ci)
77 MainControlFactory.MainControl.ConnectNewServer(ci);
80 protected void JoinNewChan(string serverName, string chanName)
82 MainControlFactory.MainControl.GetConnectionControls(serverName).JoinChannel(chanName);
85 protected void SendMessageToChannel(string serverName, string channelName, string message)
87 MainControlFactory.MainControl.GetConnectionControls(serverName)
88 .GetChannelControl(channelName).SendMessage(message);
91 protected string[] ChannelOpened {
93 return MainControlFactory.MainControl.
97 protected event EventHandler NewChannelJoined;
98 protected event EventHandler NewServerJoined;
100 // In fact plugins worker can use GuiFactory and MainControlFactory now