Example #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="_network"></param>
 /// <param name="_text"></param>
 /// <param name="_pong"></param>
 /// <param name="_date">Date of this message, if you specify 0 the current time will be used</param>
 /// <param name="updated">If true this text will be considered as newly obtained information</param>
 public ProcessorIRC(Network _network, string _text, ref DateTime _pong, long _date = 0, bool updated = true)
 {
     _Network = _network;
     _Protocol = _network._Protocol;
     text = _text;
     pong = _pong;
     date = _date;
     updated_text = updated;
     if (_network._Protocol.GetType() == typeof(ProtocolSv))
     {
         isServices = true;
     }
 }
Example #2
0
 /// <summary>
 /// This hook is started before you connect to a protocol
 /// </summary>
 /// <param name="protocol"></param>
 public virtual void Hook_BeforeConnect(Protocol protocol)
 {
     return;
 }
Example #3
0
        /// <summary>
        /// Destroy this class, be careful, it can't be used in any way after you
        /// call this
        /// </summary>
        public void Destroy()
        {
            if (IsDestroyed)
            {
                // avoid calling this function multiple times, otherwise it could crash
                Core.DebugLog("Destroy() called multiple times on " + ServerName);
                return;
            }

            Core.DebugLog("Destroying network " + ServerName);

            isDestroyed = true;

            lock (ChannelList)
            {
                ChannelList.Clear();
            }

            if (wChannelList != null)
            {
                wChannelList.Hide();
                wChannelList.Dispose();
                wChannelList = null;
            }

            lock (PrivateChat)
            {
                // release all windows
                foreach (User user in PrivateChat)
                {
                    user.Destroy();
                }
                PrivateChat.Clear();
            }

            lock (Channels)
            {
                foreach (Channel xx in Channels)
                {
                    xx.Destroy();
                }
                Channels.Clear();
            }

            lock (PrivateWins)
            {
                foreach (Graphics.Window cw in PrivateWins.Values)
                {
                    cw._Destroy();
                }
                PrivateWins.Clear();
            }

            _Protocol = null;
            SystemWindow = null;

            lock (Descriptions)
            {
                Descriptions.Clear();
            }

            Core.SystemForm.ChannelList.RemoveServer(this);
        }
Example #4
0
        /// <summary>
        /// Creates a new network, requires name and protocol type
        /// </summary>
        /// <param name="Server">Server name</param>
        /// <param name="protocol">Protocol that own this instance</param>
        public Network(string Server, Protocol protocol)
        {
            randomuqid = Core.RetrieveRandom();
            lock (Descriptions)
            {
                Descriptions.Clear();
                Descriptions.Add('n', "no /knock is allowed on channel");
                Descriptions.Add('r', "registered channel");
                Descriptions.Add('m', "talking is restricted");
                Descriptions.Add('i', "users need to be invited to join");
                Descriptions.Add('s', "channel is secret (doesn't appear on list)");
                Descriptions.Add('p', "channel is private");
                Descriptions.Add('A', "admins only");
                Descriptions.Add('O', "opers chan");
                Descriptions.Add('t', "topic changes can be done only by operators");
            }
            _Protocol = protocol;
            ServerName = Server;
            Quit = Configuration.UserData.quit;
            Nickname = Configuration.UserData.nick;

            UserName = Configuration.UserData.user;
            Ident = Configuration.UserData.ident;
            if (protocol.GetType() == typeof(ProtocolSv))
            {
                SystemWindow = protocol.CreateChat("!" + ServerName, false, this, false, "!" + randomuqid + ServerName, false, true);
                Core.SystemForm.ChannelList.InsertNetwork(this, (ProtocolSv)protocol);
            }
            else
            {
                SystemWindow = protocol.CreateChat("!system", true, this, false, null, false, true);
                Core.SystemForm.ChannelList.InsertNetwork(this);
            }
            Hooks._Network.CreatingNetwork(this);
        }
Example #5
0
 /// <summary>
 /// This hook allow you to call functions before you open connection
 /// </summary>
 /// <param name="protocol"></param>
 public static void BeforeConnect(Protocol protocol)
 {
     foreach (Extension extension in Core.Extensions)
     {
         try
         {
             if (extension._Status == Extension.Status.Active)
             {
                 extension.Hook_BeforeConnect(protocol);
             }
         }
         catch (Exception mf)
         {
             Core.DebugLog("Error in hook BeforeConnect(string, string) module " + extension.Name);
             Core.handleException(mf);
         }
     }
     return;
 }
Example #6
0
 /// <summary>
 /// Events to happen before command, can't be stopped
 /// </summary>
 /// <param name="protocol"></param>
 /// <param name="command"></param>
 public static void BeforeCommand(Protocol protocol, string command)
 {
     return;
 }