better.doc
[tfs.git] / tools / tfsnd / SmartIrc4net / IrcClient / IrcUser.cs
bloba8eb30ef14343194148d8b55baa37c71dff4eb81
1 /*
2 * $Id: IrcUser.cs 198 2005-06-08 16:50:11Z meebey $
3 * $URL: svn://svn.qnetp.net/smartirc/SmartIrc4net/tags/0.4.0/src/IrcClient/IrcUser.cs $
4 * $Rev: 198 $
5 * $Author: meebey $
6 * $Date: 2005-06-08 18:50:11 +0200 (Wed, 08 Jun 2005) $
8 * SmartIrc4net - the IRC library for .NET/C# <http://smartirc4net.sf.net>
10 * Copyright (c) 2003-2005 Mirco Bauer <meebey@meebey.net> <http://www.meebey.net>
12 * Full LGPL License: <http://www.gnu.org/licenses/lgpl.txt>
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 using System.Collections.Specialized;
31 namespace Meebey.SmartIrc4net
33 /// <summary>
34 /// This class manages the user information.
35 /// </summary>
36 /// <remarks>
37 /// only used with channel sync
38 /// <seealso cref="IrcClient.ActiveChannelSyncing">
39 /// IrcClient.ActiveChannelSyncing
40 /// </seealso>
41 /// </remarks>
42 /// <threadsafety static="true" instance="true" />
43 public class IrcUser
45 private IrcClient _IrcClient;
46 private string _Nick = null;
47 private string _Ident = null;
48 private string _Host = null;
49 private string _Realname = null;
50 private bool _IsIrcOp = false;
51 private bool _IsAway = false;
52 private string _Server = null;
53 private int _HopCount = -1;
55 internal IrcUser(string nickname, IrcClient ircclient)
57 _IrcClient = ircclient;
58 _Nick = nickname;
61 #if LOG4NET
62 ~IrcUser()
64 Logger.ChannelSyncing.Debug("IrcUser ("+Nick+") destroyed");
66 #endif
68 /// <summary>
69 /// Gets or sets the nickname of the user.
70 /// </summary>
71 /// <remarks>
72 /// Do _not_ set this value, it will break channel sync!
73 /// </remarks>
74 public string Nick {
75 get {
76 return _Nick;
78 set {
79 _Nick = value;
83 /// <summary>
84 /// Gets or sets the identity (username) of the user which is used by some IRC networks for authentication.
85 /// </summary>
86 /// <remarks>
87 /// Do _not_ set this value, it will break channel sync!
88 /// </remarks>
89 public string Ident {
90 get {
91 return _Ident;
93 set {
94 _Ident = value;
98 /// <summary>
99 /// Gets or sets the hostname of the user.
100 /// </summary>
101 /// <remarks>
102 /// Do _not_ set this value, it will break channel sync!
103 /// </remarks>
104 public string Host {
105 get {
106 return _Host;
108 set {
109 _Host = value;
113 /// <summary>
114 /// Gets or sets the supposed real name of the user.
115 /// </summary>
116 /// <remarks>
117 /// Do _not_ set this value, it will break channel sync!
118 /// </remarks>
119 public string Realname {
120 get {
121 return _Realname;
123 set {
124 _Realname = value;
128 /// <summary>
129 /// Gets or sets the server operator status of the user
130 /// </summary>
131 /// <remarks>
132 /// Do _not_ set this value, it will break channel sync!
133 /// </remarks>
134 public bool IsIrcOp {
135 get {
136 return _IsIrcOp;
138 set {
139 _IsIrcOp = value;
143 /// <summary>
144 /// Gets or sets away status of the user
145 /// </summary>
146 /// <remarks>
147 /// Do _not_ set this value, it will break channel sync!
148 /// </remarks>
149 public bool IsAway {
150 get {
151 return _IsAway;
153 set {
154 _IsAway = value;
158 /// <summary>
159 /// Gets or sets the server the user is connected to
160 /// </summary>
161 /// <remarks>
162 /// Do _not_ set this value, it will break channel sync!
163 /// </remarks>
164 public string Server {
165 get {
166 return _Server;
168 set {
169 _Server = value;
173 /// <summary>
174 /// Gets or sets the count of hops between you and the user's server
175 /// </summary>
176 /// <remarks>
177 /// Do _not_ set this value, it will break channel sync!
178 /// </remarks>
179 public int HopCount {
180 get {
181 return _HopCount;
183 set {
184 _HopCount = value;
188 /// <summary>
189 /// Gets the list of channels the user has joined
190 /// </summary>
191 public string[] JoinedChannels {
192 get {
193 Channel channel;
194 string[] result;
195 string[] channels = _IrcClient.GetChannels();
196 StringCollection joinedchannels = new StringCollection();
197 foreach (string channelname in channels) {
198 channel = _IrcClient.GetChannel(channelname);
199 if (channel.UnsafeUsers.ContainsKey(_Nick)) {
200 joinedchannels.Add(channelname);
204 result = new string[joinedchannels.Count];
205 joinedchannels.CopyTo(result, 0);
206 return result;
207 //return joinedchannels;