1 /*
2  * $Id$
3  * $URL$
4  * $Rev$
5  * $Author$
6  * $Date$
7  *
8  * SmartIrc4net - the IRC library for .NET/C# <http://smartirc4net.sf.net>
9  *
10  * Copyright (c) 2003-2005 Mirco Bauer <meebey@meebey.net> <http://www.meebey.net>
11  *
12  * Full LGPL License: <http://www.gnu.org/licenses/lgpl.txt>
13  *
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.
18  *
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.
23  *
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
27  */
28 
29 namespace Meebey.SmartIrc4net
30 {
31     /// <summary>
32     /// This class manages the information of a user within a channel.
33     /// </summary>
34     /// <remarks>
35     /// only used with channel sync
36     /// </remarks>
37     /// <threadsafety static="true" instance="true" />
38     public class ChannelUser
39     {
40         private string    _Channel;
41         private IrcUser   _IrcUser;
42         private bool      _IsOp;
43         private bool      _IsVoice;
44 
45         /// <summary>
46         ///
47         /// </summary>
48         /// <param name="channel"> </param>
49         /// <param name="ircuser"> </param>
ChannelUser(string channel, IrcUser ircuser)50         internal ChannelUser(string channel, IrcUser ircuser)
51         {
52             _Channel = channel;
53             _IrcUser = ircuser;
54         }
55 
56 #if LOG4NET
~ChannelUser()57         ~ChannelUser()
58         {
59             Logger.ChannelSyncing.Debug("ChannelUser ("+Channel+":"+IrcUser.Nick+") destroyed");
60         }
61 #endif
62 
63         /// <summary>
64         /// Gets the channel name
65         /// </summary>
66         public string Channel {
67             get {
68                 return _Channel;
69             }
70         }
71 
72         /// <summary>
73         /// Gets the server operator status of the user
74         /// </summary>
75         public bool IsIrcOp {
76             get {
77                 return _IrcUser.IsIrcOp;
78             }
79         }
80 
81         /// <summary>
82         /// Gets or sets the op flag of the user (+o)
83         /// </summary>
84         /// <remarks>
85         /// only used with channel sync
86         /// </remarks>
87         public bool IsOp {
88             get {
89                 return _IsOp;
90             }
91             set {
92                 _IsOp = value;
93             }
94         }
95 
96         /// <summary>
97         /// Gets or sets the voice flag of the user (+v)
98         /// </summary>
99         /// <remarks>
100         /// only used with channel sync
101         /// </remarks>
102         public bool IsVoice {
103             get {
104                 return _IsVoice;
105             }
106             set {
107                 _IsVoice = value;
108             }
109         }
110 
111         /// <summary>
112         /// Gets the away status of the user
113         /// </summary>
114         public bool IsAway {
115             get {
116                 return _IrcUser.IsAway;
117             }
118         }
119 
120         /// <summary>
121         /// Gets the underlaying IrcUser object
122         /// </summary>
123         public IrcUser IrcUser {
124             get {
125                 return _IrcUser;
126             }
127         }
128 
129         /// <summary>
130         /// Gets the nickname of the user
131         /// </summary>
132         public string Nick {
133             get {
134                 return _IrcUser.Nick;
135             }
136         }
137 
138         /// <summary>
139         /// Gets the identity (username) of the user, which is used by some IRC networks for authentication.
140         /// </summary>
141         public string Ident {
142             get {
143                 return _IrcUser.Ident;
144             }
145         }
146 
147         /// <summary>
148         /// Gets the hostname of the user,
149         /// </summary>
150         public string Host {
151             get {
152                 return _IrcUser.Host;
153             }
154         }
155 
156         /// <summary>
157         /// Gets the supposed real name of the user.
158         /// </summary>
159         public string Realname {
160             get {
161                 return _IrcUser.Realname;
162             }
163         }
164 
165         /// <summary>
166         /// Gets the server the user is connected to.
167         /// </summary>
168         /// <value> </value>
169         public string Server {
170             get {
171                 return _IrcUser.Server;
172             }
173         }
174 
175         /// <summary>
176         /// Gets or sets the count of hops between you and the user's server
177         /// </summary>
178         public int HopCount {
179             get {
180                 return _IrcUser.HopCount;
181             }
182         }
183 
184         /// <summary>
185         /// Gets the list of channels the user has joined
186         /// </summary>
187         public string[] JoinedChannels {
188             get {
189                 return _IrcUser.JoinedChannels;
190             }
191         }
192     }
193 }
194