2015-08-25 04:38:35 +12:00
#region License Information ( GPL v3 )
/ *
ShareX - A program that allows you to take screenshots and share any file type
Copyright ( c ) 2007 - 2015 ShareX Team
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
Optionally you can also view the license at < http : //www.gnu.org/licenses/>.
* /
#endregion License Information ( GPL v3 )
using ShareX.HelpersLib ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Drawing.Design ;
namespace ShareX.IRCLib
{
public class IRCInfo : SettingsBase < IRCInfo >
{
[Description("IRC server address."), DefaultValue("chat.freenode.net")]
public string Server { get ; set ; } = "chat.freenode.net" ;
[Description("IRC server port."), DefaultValue(6667)]
public int Port { get ; set ; } = 6667 ;
2015-08-25 05:41:31 +12:00
[Description("IRC server password. In some servers can be used to identify."), PasswordPropertyText(true)]
2015-08-25 04:38:35 +12:00
public string Password { get ; set ; }
[Description("Nickname.")]
public string Nickname { get ; set ; }
2015-09-04 00:28:34 +12:00
[Description("Alternative nickname in case nickname already in use. If it is empty then _ character will be added end of nickname.")]
public string Nickname2 { get ; set ; }
2015-08-25 05:41:31 +12:00
[Description("Username. This show up in WHOIS result."), DefaultValue("username")]
2015-08-25 04:38:35 +12:00
public string Username { get ; set ; } = "username" ;
2015-08-25 06:05:35 +12:00
[Description("Realname. This show up in WHOIS result."), DefaultValue("realname")]
2015-08-25 04:38:35 +12:00
public string Realname { get ; set ; } = "realname" ;
[Description("IRC invisible mode."), DefaultValue(true)]
public bool Invisible { get ; set ; } = true ;
[Description("When disconnected from server auto reconnect."), DefaultValue(true)]
public bool AutoReconnect { get ; set ; } = true ;
[Description("Wait specific milliseconds before reconnecting."), DefaultValue(5000)]
public int AutoReconnectDelay { get ; set ; } = 5000 ;
2015-08-25 05:41:31 +12:00
[Description("When got kicked from channel auto rejoin."), DefaultValue(false)]
2015-08-25 04:38:35 +12:00
public bool AutoRejoinOnKick { get ; set ; }
2015-08-25 05:41:31 +12:00
[Description("Don't show 'Message of the day' texts in output."), DefaultValue(true)]
2015-08-25 04:38:35 +12:00
public bool SuppressMOTD { get ; set ; } = true ;
[Description("When you disconnect what message gonna show to other people."), DefaultValue("Leaving")]
public string QuitReason { get ; set ; } = "Leaving" ;
[ Description ( "When connected these commands will automatically execute." ) ,
Editor ( "System.Windows.Forms.Design.StringCollectionEditor,System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" , typeof ( UITypeEditor ) ) ]
public List < string > ConnectCommands { get ; set ; } = new List < string > ( ) ;
2015-08-25 05:41:31 +12:00
[ Description ( "When connected automatically join these channels." ) ,
TypeConverter ( typeof ( StringCollectionToStringTypeConverter ) ) ,
2015-08-25 04:38:35 +12:00
Editor ( "System.Windows.Forms.Design.StringCollectionEditor,System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" , typeof ( UITypeEditor ) ) ]
public List < string > AutoJoinChannels { get ; set ; } = new List < string > ( ) { "#ShareX" } ;
2015-08-25 09:40:57 +12:00
[Description("Wait identify confirmation before auto join channels. Currently only works in Freenode server because each server sends different response after identify."), DefaultValue(false)]
2015-08-25 04:38:35 +12:00
public bool AutoJoinWaitIdentify { get ; set ; }
[Description("Enable/Disable auto response system which using AutoResponseList."), DefaultValue(false)]
public bool AutoResponse { get ; set ; }
2015-08-25 05:41:31 +12:00
[Description("After successful auto response match how much milliseconds wait for next auto response. Delay independant per response."), DefaultValue(10000)]
2015-08-25 04:38:35 +12:00
public int AutoResponseDelay { get ; set ; } = 10000 ;
2015-08-25 05:41:31 +12:00
[Description("When specific message written in channel automatically response with your message.")]
2015-08-25 04:38:35 +12:00
public List < AutoResponseInfo > AutoResponseList { get ; set ; } = new List < AutoResponseInfo > ( ) ;
public string GetAutoResponses ( )
{
List < string > messages = new List < string > ( ) ;
foreach ( AutoResponseInfo autoResponseInfo in AutoResponseList )
{
if ( autoResponseInfo . Messages . Count > 1 )
{
messages . Add ( $"[{string.Join(" , ", autoResponseInfo.Messages)}]" ) ;
}
else if ( autoResponseInfo . Messages . Count = = 1 )
{
messages . Add ( autoResponseInfo . Messages [ 0 ] ) ;
}
}
return string . Join ( ", " , messages ) ;
}
}
}