/!\ Warning: this commit doesn't compile /!
[circ.git] / Circ.Lib / Backend / ConnectionInfo.cs
blob964f7177628cdfeb68d59ce3fe1ed98d8cf1cc2f
1 #region License
2 /* Circ.Lib : main library behind Circ
3 * Copyright (C) 2007 LAVAL Jérémie
5 * This file is licensed under the terms of the LGPL.
7 * For the complete licence see the file COPYING.
8 */
9 #endregion
10 using System;
11 using System.Text;
13 /* Tapioca IRC reference :
14 account :
15 server :
16 fullname : telepathy-idle user http://telepathy.freedesktop.org
17 port : 6667
18 password :
19 charset : UTF-8
20 quit-message : So long and thanks for all the IRC - telepathy-idle IRC Connection Manager for Telepathy - http://telepathy.freedesktop.org
21 use-ssl : False
24 namespace Circ.Backend
26 /// <summary>
27 /// This struct store all the information needed by IrcConnection
28 /// </summary>
29 /// <remarks>If the password is null or empty, it is ignored</remarks>
30 public class ConnectionInfo: ICloneable
32 readonly string server;
33 readonly int port;
34 readonly string password;
35 readonly string realName;
36 string pseudo;
37 Encoding charset;
38 bool useSsl;
39 string quitMessage;
40 bool passiveMode;
44 /// <summary>
45 /// Initalize a new instance of ConnectionInfo
46 /// </summary>
47 /// <param name="server">The hostname of the server</param>
48 /// <param name="port">The port of the server</param>
49 /// <param name="pseudo">The pseudonyme of the user</param>
50 /// <param name="pass">The password for the server</param>
51 /// <param name="realName">The real name of the irc user</param>
52 public ConnectionInfo(string server, int port, string pseudo, string pass, string realName)
54 this.server = server;
55 this.port = port;
56 this.pseudo = pseudo;
57 this.password = pass;
58 this.realName = realName;
59 this.charset = Encoding.UTF8;
60 this.useSsl = false;
61 this.quitMessage = "Powered by Monologue";
62 this.passiveMode = true;
65 /// <summary>
66 /// The hostname of the server
67 /// </summary>
68 public string Server {
69 get {
70 return server;
74 /// <summary>
75 /// The port used to connect to the server
76 /// </summary>
77 public int Port {
78 get {
79 return port;
83 /// <summary>
84 /// The pseudo that will be used on the server
85 /// </summary>
86 public string Pseudo {
87 get {
88 return pseudo;
90 set {
91 if (value == null)
92 throw new ArgumentNullException("value");
93 pseudo = value;
97 /// <summary>
98 /// The password used to identify on Irc
99 /// </summary>
100 /// <remarks>Can be null or empty</remarks>
101 public string Password {
102 get {
103 return password;
107 /// <summary>
108 /// The real name of the irc user. ex: Larry The Cow
109 /// </summary>
110 public string RealName {
111 get {
112 return realName;
116 /// <summary>
117 /// The charset used to display characters
118 /// </summary>
119 public Encoding Charset {
120 get {
121 return charset;
123 set {
124 charset = value;
128 /// <summary>
129 /// Do we use a secure connection ?
130 /// </summary>
131 public bool UseSsl {
132 get {
133 return useSsl;
135 set {
136 useSsl = value;
140 public bool UsePassiveMode {
141 get {
142 return passiveMode;
144 set {
145 passiveMode = value;
149 /// <summary>
150 /// Message that will be displayed when exitingIRC
151 /// </summary>
152 public string QuitMessage {
153 get {
154 return quitMessage;
156 set {
157 quitMessage = value;
161 public static ConnectionInfo GetDefault(string serv, string nick)
163 Circ.Backend.ConnectionInfo ci = new Circ.Backend.ConnectionInfo(serv, 6667, nick, string.Empty, nick);
164 ci.QuitMessage = "Powered by Circ";
165 return ci;
168 public object Clone()
170 return this.MemberwiseClone();