Example #1
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="server"></param>
 /// <param name="numeric"></param>
 /// <param name="nick"></param>
 /// <param name="ident"></param>
 /// <param name="host"></param>
 /// <param name="name"></param>
 /// <param name="connectionTimestamp"></param>
 /// <param name="base64IP"></param>
 public User(IServer server, string numeric, string nick, string ident, 
     string host, string name, UnixTimestamp connectionTimestamp, 
     string base64IP, IRCServicePlugin plugin = null)
 {
     Numeric = numeric;
     Nick = nick;
     Ident = ident;
     Host = host;
     Name = name;
     Base64IP = base64IP;
     Server = server;
     ConnectionTimestamp = connectionTimestamp;
     FakeIdent = "";
     FakeHost = "";
     Login = "";
     Plugin = plugin;
     channels = new Dictionary<string, ChannelEntry>
         (StringComparer.OrdinalIgnoreCase);
     if (Server.IsControlled)
     {
         action = new UserAction(this);
     }
 }
Example #2
0
 /// <summary>
 /// Sends an action to the registered plugins
 /// </summary>
 /// <param name="action">The action to be taken</param>
 /// <param name="exclude">Plugin that should not receive the action</param>
 public void SendActionToPlugins(Action<IRCServicePlugin> action, 
     IRCServicePlugin exclude = null)
 {
     foreach (var item in plugins)
     {
         if (item != exclude)
         {
             action(item);
         }
     }
 }
Example #3
0
 /// <summary>
 /// Registers a plugin
 /// </summary>
 /// <param name="plugin"></param>
 public virtual void RegisterPlugin(IRCServicePlugin plugin)
 {
     lock (lockObject)
     {
         if (MainServer == null)
         {
             throw new NotPreparedForPluginsException();
         }
         if (Status != ServiceStatus.Disconnected)
         {
             throw new CannotRegisterPluginException();
         }
         plugins.Add(plugin);
     }
 }
Example #4
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="server"></param>
 /// <param name="numeric"></param>
 /// <param name="nick"></param>
 /// <param name="ident"></param>
 /// <param name="host"></param>
 /// <param name="name"></param>
 /// <param name="connectionTimestamp"></param>
 /// <param name="IPAddress"></param>
 public User(IServer server, string numeric, string nick, string ident, 
     string host, string name, UnixTimestamp connectionTimestamp, 
     IPAddress IPAddress, IRCServicePlugin plugin = null)
     : this(server, numeric, nick, ident, host, name, 
     connectionTimestamp, "", plugin)
 {            
     if (IPAddress.AddressFamily == 
         System.Net.Sockets.AddressFamily.InterNetworkV6)
     {
         throw new NotSupportedException("IPv6 is not yet supported");
     }
     this.IPAddress = IPAddress;
     var split = IPAddress.ToString().Split('.');
     Int64 integerIP = 0;
     integerIP |= (Convert.ToInt64(split[0]) << 24);
     integerIP |= (Convert.ToInt64(split[1]) << 16);
     integerIP |= (Convert.ToInt64(split[2]) << 8);
     integerIP |= (Convert.ToInt64(split[3]));
     Base64IP = Base64Converter.IntToNumeric(integerIP, 6);
 }