[Bobbot-cvs] Bob/Core/Irc/Messages/Commands DccChatRequestMessage.cs,NONE,1.1 NoticeMessage.cs,NONE,
Status: Alpha
Brought to you by:
iainmckay
From: Iain M. <iai...@us...> - 2004-12-30 03:33:38
|
Update of /cvsroot/bobbot/Bob/Core/Irc/Messages/Commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8381/Core/Irc/Messages/Commands Added Files: DccChatRequestMessage.cs NoticeMessage.cs Log Message: Many new changes. Most notably host-based recognition. --- NEW FILE: DccChatRequestMessage.cs --- #region LGPL License /* Bastard of a Bot Library Copyright (C) 2004 Bastard of a Bot Team This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #endregion using System; using System.Net; using System.Text; using Bot.Core.Irc; using Bot.Core.Irc.Exceptions; namespace Bot.Core.Irc.Messages { /// <summary> /// Summary description for DccChatRequestMessage. /// </summary> public class DccChatRequestMessage : BaseMessage { #region Public properties public override string Command { get { return "DCC CHAT"; } } #endregion #region Private members #endregion #region Constructors public DccChatRequestMessage() : base() { } public DccChatRequestMessage(string dest, IPAddress address, int port) : this(new NetworkUser(dest), address, port) { } public DccChatRequestMessage(NetworkUser dest, IPAddress address, int port) { Parameters.Add(dest); Parameters.Add(address); Parameters.Add(port); } #endregion #region Public methods public override void Notify(NetworkConnection toNotify) { //toNotify.OnJoinChannel(new JoinChannelMessageEventArgs(this)); } public override string ToString() { string msgPart = String.Format( "\x0001DCC CHAT chat {0} {1}\x0001", KernelHelper.IPAddressToLong(KernelHelper.GetLocalHost()), Parameters[2]); return String.Format("PRIVMSG {0} :{1}", ((NetworkUser) Parameters[0]).Nickname, msgPart); } #endregion } public delegate void DccChatRequestMessageEventHandler(NetworkConnection network, DccChatRequestMessageEventArgs args); public class DccChatRequestMessageEventArgs : EventArgs { #region Public properties public DccChatRequestMessage Message { get { return m_Message; } } #endregion #region Channel members private DccChatRequestMessage m_Message; #endregion #region Constructor public DccChatRequestMessageEventArgs(DccChatRequestMessage message) { m_Message = message; } #endregion } } --- NEW FILE: NoticeMessage.cs --- #region LGPL License /* Bastard of a Bot Library Copyright (C) 2004 Bastard of a Bot Team This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #endregion using System; using Bot.Core.Irc; using Bot.Core.Irc.Exceptions; namespace Bot.Core.Irc.Messages { /// <summary> /// Summary description for NoticeMessage. /// </summary> public class NoticeMessage : BaseMessage { #region Public properties public override string Command { get { return "NOTICE"; } } public string Destination { get { return ((string) Parameters[0]); } set { if(!IrcHelper.IsValidNickname(value)) throw new InvalidNicknameException(); Parameters[0] = value; } } public string Message { get { return ((string) Parameters[1]); } set { Parameters[1] = value; } } #endregion #region Constructors public NoticeMessage() : base() { } public NoticeMessage(string dest, string message) : base() { if(!IrcHelper.IsValidNickname(dest)) throw new InvalidNicknameException(); Parameters.Add(dest); Parameters.Add(message); } public NoticeMessage(NetworkUser dest, string message) : this(dest.Nickname, message) { } #endregion #region Public methods public override void Notify(NetworkConnection toNotify) { //toNotify.OnNotice(new NoticeMessageEventArgs(this)); } #endregion } public delegate void NoticeMessageEventHandler(NetworkConnection network, NoticeMessageEventArgs args); public class NoticeMessageEventArgs : EventArgs { #region Public properties public NoticeMessage Message { get { return m_Message; } } #endregion #region Private members private NoticeMessage m_Message; #endregion #region Constructor public NoticeMessageEventArgs(NoticeMessage message) { m_Message = message; } #endregion } } |