mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 14:35:59 +00:00
Support private messages
svn path=/trunk/; revision=13610
This commit is contained in:
parent
bdce06f005
commit
d57dd016c4
6 changed files with 147 additions and 26 deletions
|
@ -9,6 +9,7 @@ namespace TechBot.IRCLibrary
|
|||
{
|
||||
#region Private fields
|
||||
|
||||
private IrcClient owner;
|
||||
private string nickname;
|
||||
private string decoratedNickname;
|
||||
|
||||
|
@ -16,6 +17,17 @@ namespace TechBot.IRCLibrary
|
|||
|
||||
#region Public properties
|
||||
|
||||
/// <summary>
|
||||
/// Owner of this channel.
|
||||
/// </summary>
|
||||
public IrcClient Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return owner;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Nickname of user.
|
||||
/// </summary>
|
||||
|
@ -65,13 +77,37 @@ namespace TechBot.IRCLibrary
|
|||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="owner">Owner of this channel.</param>
|
||||
/// <param name="nickname">Nickname (possibly decorated) of user.</param>
|
||||
public IrcUser(string nickname)
|
||||
public IrcUser(IrcClient owner,
|
||||
string nickname)
|
||||
{
|
||||
if (owner == null)
|
||||
{
|
||||
throw new ArgumentNullException("owner", "Owner cannot be null.");
|
||||
}
|
||||
this.owner = owner;
|
||||
this.decoratedNickname = nickname.Trim();
|
||||
this.nickname = StripDecoration(decoratedNickname);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Talk to the user.
|
||||
/// </summary>
|
||||
/// <param name="text">Text to send to the user.</param>
|
||||
public void Talk(string text)
|
||||
{
|
||||
if (text == null)
|
||||
{
|
||||
throw new ArgumentNullException("text", "Text cannot be null.");
|
||||
}
|
||||
|
||||
owner.SendMessage(new IrcMessage(IRC.PRIVMSG,
|
||||
String.Format("{0} :{1}",
|
||||
nickname,
|
||||
text)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strip docoration of nickname.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue