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 >
{
2015-09-04 01:08:40 +12:00
[Category("\t\tServer info"), Description("IRC server address. Example: chat.freenode.net"), DefaultValue("chat.freenode.net")]
2015-08-25 04:38:35 +12:00
public string Server { get ; set ; } = "chat.freenode.net" ;
2015-09-04 07:29:23 +12:00
[Category("\t\tServer info"), Description("IRC server port. Default: 6667. Default SSL: 6697"), DefaultValue(6667)]
2015-08-25 04:38:35 +12:00
public int Port { get ; set ; } = 6667 ;
2015-09-05 18:51:38 +12:00
[Category("\t\tServer info"), Description("Will use SSL connection. You must use correct SSL port of the IRC server."), DefaultValue(false)]
2015-09-04 07:29:23 +12:00
public bool UseSSL { get ; set ; } = false ;
2015-09-05 18:51:38 +12:00
[Category("\t\tServer info"), Description("IRC server password. Can be used to identify in some servers."), PasswordPropertyText(true)]
2015-08-25 04:38:35 +12:00
public string Password { get ; set ; }
2015-09-04 01:08:40 +12:00
[Category("\tUser info"), Description("Nickname.")]
2015-08-25 04:38:35 +12:00
public string Nickname { get ; set ; }
2015-09-05 18:51:38 +12:00
[Category("\tUser info"), Description("Alternative nickname in case nickname is already in use. If it is empty then _ character will be added to the end of nickname.")]
2015-09-04 00:28:34 +12:00
public string Nickname2 { get ; set ; }
2015-09-05 18:51:38 +12:00
[Category("\tUser info"), Description("Username. This info is visible to everyone in the WHOIS result."), DefaultValue("username")]
2015-08-25 04:38:35 +12:00
public string Username { get ; set ; } = "username" ;
2015-09-05 18:51:38 +12:00
[Category("\tUser info"), Description("Realname. This info is visible to everyone in WHOIS result."), DefaultValue("realname")]
2015-08-25 04:38:35 +12:00
public string Realname { get ; set ; } = "realname" ;
2015-09-04 01:08:40 +12:00
[Category("\tUser info"), Description("IRC invisible mode."), DefaultValue(true)]
2015-08-25 04:38:35 +12:00
public bool Invisible { get ; set ; } = true ;
2015-09-04 01:08:40 +12:00
[Category("Options"), Description("When disconnected from server auto reconnect."), DefaultValue(true)]
2015-08-25 04:38:35 +12:00
public bool AutoReconnect { get ; set ; } = true ;
2015-09-04 01:08:40 +12:00
[Category("Options"), Description("Wait specific milliseconds before reconnecting."), DefaultValue(5000)]
2015-08-25 04:38:35 +12:00
public int AutoReconnectDelay { get ; set ; } = 5000 ;
2015-09-05 18:51:38 +12:00
[Category("Options"), Description("Auto rejoin when got kicked out from the channel."), DefaultValue(false)]
2015-08-25 04:38:35 +12:00
public bool AutoRejoinOnKick { get ; set ; }
2015-09-04 01:08:40 +12:00
[Category("Options"), Description("Don't show 'Message of the day' texts in output."), DefaultValue(false)]
public bool SuppressMOTD { get ; set ; } = false ;
2015-08-25 04:38:35 +12:00
2015-09-05 18:51:38 +12:00
[Category("Options"), Description("Message to show others when you disconnect from the server."), DefaultValue("Leaving")]
2015-08-25 04:38:35 +12:00
public string QuitReason { get ; set ; } = "Leaving" ;
2015-09-04 01:08:40 +12:00
[ Category ( "Options" ) , Description ( "When connected these commands will automatically execute." ) ,
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 > ConnectCommands { get ; set ; } = new List < string > ( ) ;
2015-09-04 01:08:40 +12:00
[ Category ( "Options" ) , Description ( "When connected automatically join these channels." ) ,
2015-08-25 05:41:31 +12:00
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-09-05 18:51:38 +12:00
[Category("Options"), Description("Wait for 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 ; }
2015-09-04 01:08:40 +12:00
[Category("Options"), Description("Enable/Disable auto response system which using AutoResponseList."), DefaultValue(false)]
2015-08-25 04:38:35 +12:00
public bool AutoResponse { get ; set ; }
2015-09-05 18:51:38 +12:00
[Category("Options"), Description("When specific message written in channel automatically respond with your message.")]
2015-08-25 04:38:35 +12:00
public List < AutoResponseInfo > AutoResponseList { get ; set ; } = new List < AutoResponseInfo > ( ) ;
2015-09-05 18:51:38 +12:00
[Category("Options"), Description("After successful auto response match how many milliseconds to wait for next auto response. Delay independant per response."), DefaultValue(10000)]
2015-09-04 01:08:40 +12:00
public int AutoResponseDelay { get ; set ; } = 10000 ;
2015-08-25 04:38:35 +12:00
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 ) ;
}
}
}