Ejemplo n.º 1
0
 public void Join(string channel)
 {
     lock (WriteLock)
     {
         if (Rfc2812Util.IsValidChannelName(channel))
         {
             if (!sIgnoreChannel.IsIgnore(channel))
             {
                 sSendMessage.WriteLine("JOIN {0}", channel);
             }
             else
             {
                 Log.Warning("Sender", sLConsole.GetString("Channel {0}'s access is denied!"), channel);
             }
         }
         else
         {
             Log.Warning("Sender", sLConsole.GetString("{0} is not a valid channel name!"), channel);
         }
     }
 }
Ejemplo n.º 2
0
        public void JoinChannels()
        {
            if (sIrcBase.Networks[_servername].IsAllJoin)
            {
                return;
            }

            sIrcBase.Networks[_servername].IsAllJoin = true;

            Log.Debug("MyChannelInfo", sLConsole.GetString("Connecting to channels.."));
            bool error = false;

            foreach (var channel in _ChannelList)
            {
                if (channel.Value.IsNullOrEmpty())
                {
                    sSender.Join(channel.Key);
                }
                else
                {
                    sSender.Join(channel.Key, channel.Value.Trim());
                }

                if (sIgnoreChannel.IsIgnore(channel.Key))
                {
                    error = true;
                }
                else
                {
                    SchumixBase.DManager.Update("channels", "Enabled = 'true', Error = ''", string.Format("Channel = '{0}' And ServerName = '{1}'", channel.Key, _servername));
                }
            }

            ChannelFunctionsReload();
            var db = SchumixBase.DManager.Query("SELECT Enabled FROM channels WHERE ServerName = '{0}'", _servername);

            if (!db.IsNull())
            {
                foreach (DataRow row in db.Rows)
                {
                    if (!row["Enabled"].ToBoolean())
                    {
                        error = true;
                    }
                }
            }
            else
            {
                Log.Error("MyChannelInfo", sLConsole.GetString("JoinChannel: Failure request!"));
            }

            if (!error)
            {
                Log.Success("MyChannelInfo", sLConsole.GetString("Successfully connected to channels."));
            }
            else
            {
                Log.Warning("MyChannelInfo", sLConsole.GetString("Some connection unsuccessful!"));
            }

            if (IRCConfig.List[_servername].IgnoreChannels.Length > 0)
            {
                Log.Notice("MyChannelInfo", sLConsole.GetString("Banned channels: {0}"), IRCConfig.List[_servername].IgnoreChannels);
            }

            if (SchumixBase.STime)
            {
                SchumixBase.STime = false;
                SchumixBase.sTimer.Stop();
            }
        }