Update of /cvsroot/ccnetcontrib/ccnetcontrib/src/MSNPublisher
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32524/src/MSNPublisher
Added Files:
MSNPublisher.cs MSNPublisher.csproj MSNUser.cs AssemblyInfo.cs
.cvsignore
Log Message:
Stephen Tunney's MSN Publisher
--- NEW FILE: .cvsignore ---
bin
obj
MSNPublisher.csproj.user
--- NEW FILE: MSNUser.cs ---
///
/// Written By Stephen R. Tunney <s_t...@ya...>
/// Dec. 1, 2004
///
using System;
using Exortech.NetReflector;
namespace ThoughtWorks.CruiseControl.Contrib.MSNPublisher
{
/// <summary>
/// MSNUser is a representation of the
/// users that would subsbribe to
/// msn messenger notifications.
/// </summary>
/// <example>
/// This XSD node belongs under the msn node in the ccnet.xsd.
///
/// <xs:element name="msnusers">
/// <xs:complexType>
/// <xs:sequence>
/// <xs:element maxOccurs="unbounded" name="msnuser">
/// <xs:complexType>
/// <xs:attribute name="name" type="xs:string" use="required" />
/// <xs:attribute name="email" type="xs:string" use="required" />
/// </xs:complexType>
/// </xs:element>
/// </xs:sequence>
/// </xs:complexType>
/// </xs:element>
/// </example>
[ReflectorType("msnuser")]
public class MSNUser
{
private string _email;
private string _name;
/// <summary>
/// Default Constructor.
/// </summary>
public MSNUser() {}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="email">
/// The email address of the user.
/// </param>
/// <param name="name">
/// The name of the user.
/// </param>
public MSNUser( string email, string name )
{
_email = email;
_name = name;
}
/// <summary>
/// Gets or sets the email address
/// of the user.
/// </summary>
[ReflectorProperty("email")]
public string Email
{
get{ return( _email ); }
set{ _email = value; }
}
/// <summary>
/// Gets or sets the name of
/// the user.
/// </summary>
[ReflectorProperty("name")]
public string Name
{
get{ return( _name ); }
set{ _name = value; }
}
public override bool Equals(Object o)
{
if (o == null || o.GetType() != this.GetType())
{
return false;
}
MSNUser m = (MSNUser)o;
return Name == m.Name && Email == m.Email;
}
public override int GetHashCode()
{
return String.Concat(Name, Email).GetHashCode();
}
public override string ToString()
{
return String.Format( "MSNUser: [name: {0}, email: {1}]", _name, _email );
}
}
}
--- NEW FILE: MSNPublisher.csproj ---
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{8D8C5C2B-D25A-4298-8847-8E2B9828A791}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "ccnet.msnpublisher.plugin"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "ThoughtWorks.CruiseControl.Contrib.MSNPublisher"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Build"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "..\..\build\MSNPublisher\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
<Reference
Name = "ThoughtWorks.CruiseControl.Remote"
AssemblyName = "ThoughtWorks.CruiseControl.Remote"
HintPath = "..\..\lib\ThoughtWorks.CruiseControl.Remote.dll"
/>
<Reference
Name = "NetReflector"
AssemblyName = "NetReflector"
HintPath = "..\..\lib\NetReflector.dll"
/>
<Reference
Name = "ThoughtWorks.CruiseControl.Core"
AssemblyName = "ThoughtWorks.CruiseControl.Core"
HintPath = "..\..\lib\ThoughtWorks.CruiseControl.Core.dll"
/>
<Reference
Name = "SendMSN"
AssemblyName = "SendMSN"
HintPath = "..\..\lib\MSNPublisher\SendMSN.dll"
/>
<Reference
Name = "DotMSN"
AssemblyName = "DotMSN"
HintPath = "..\..\lib\MSNPublisher\DotMSN.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "MSNPublisher.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "MSNUser.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>
--- NEW FILE: MSNPublisher.cs ---
///
/// Written By Stephen R. Tunney <s_t...@ya...>
/// Dec. 1, 2004
///
using System;
using System.Collections;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core;
using ThoughtWorks.CruiseControl.Core.Publishers;
using ThoughtWorks.CruiseControl.Remote;
namespace ThoughtWorks.CruiseControl.Contrib.MSNPublisher
{
/// <summary>
/// Summary description for MSNPublisher.
/// </summary>
/// <example>
/// <xs:element name="msn" minOccurs="0" maxOccurs="1">
/// <xs:complexType>
/// <xs:sequence>
/// <xs:element name="screenname" type="xs:string" minOccurs="1" maxOccurs="1" />
/// <xs:element name="login" type="xs:string" minOccurs="1" maxOccurs="1" />
/// <xs:element name="password" type="xs:string" minOccurs="1" maxOccurs="1" />
/// <xs:element name="connecttimeout" type="xs:int" minOccurs="1" maxOccurs="1" />
/// <xs:element name="conversationtimeout" type="xs:int" minOccurs="1" maxOccurs="1" />
/// <!-- msnusers node belogs here <see cref="MSNUser"/> -->
/// </xs:sequence>
/// </xs:complexType>
/// </xs:element>
/// </example>
[ReflectorType("msn")]
public class MSNPublisher : PublisherBase
{
private string _screenName;
private string _login;
private string _password;
private Int32 _connectTimeout;
private Int32 _conversationTimeout;
private Hashtable _users = new Hashtable();
public MSNPublisher() {}
public MSNPublisher( string screenName,
string login,
string password,
Int32 connectTimeout,
Int32 conversationTimeout )
{
_screenName = screenName;
_login = login;
_password = password;
_connectTimeout = connectTimeout;
_conversationTimeout = conversationTimeout;
}
[ReflectorProperty("screenname")]
public string ScreenName
{
get{ return( _screenName ); }
set{ _screenName = value; }
}
[ReflectorProperty("login")]
public string Login
{
get{ return( _login ); }
set{ _login = value; }
}
[ReflectorProperty("password")]
public string Password
{
get{ return( _password ); }
set{ _password = value; }
}
[ReflectorProperty("connecttimeout")]
public Int32 ConnectTimeout
{
get{ return( _connectTimeout ); }
set{ _connectTimeout = value; }
}
[ReflectorProperty("conversationtimeout")]
public Int32 ConversationTimeout
{
get{ return( _conversationTimeout ); }
set{ _conversationTimeout = value; }
}
[ReflectorHash( "msnusers", "name" )]
public Hashtable MSNUsers
{
get{ return( _users ); }
set{ _users = value; }
}
public MSNUser GetMSNUser( string username )
{
if( null == username ) return( null );
return( (MSNUser)_users[username] );
}
internal virtual void SendMessage( string message )
{
SendMSN.SendMSN messenger = null;
try
{
SendMSN.MSNConfiguration config = new SendMSN.MSNConfiguration( _connectTimeout, _conversationTimeout );
SendMSN.MSNCredentials who = new SendMSN.MSNCredentials( _screenName, _login, _password );
messenger = new SendMSN.SendMSN( who, config );
string[] recipients = CreateNotifyList();
messenger.SendMessage( message, recipients );
}
catch( Exception )
{
throw;
}
finally
{
if( null != messenger )
{
messenger.Finish();
}
}
}
public override void PublishIntegrationResults(IIntegrationResult result)
{
switch( result.Status )
{
case IntegrationStatus.Unknown:
break;
default:
IMessageBuilder messageBuilder = new HtmlLinkMessageBuilder( false );
string message = messageBuilder.BuildMessage( result, result.ProjectUrl );
SendMessage( message );
break;
};
}
internal string[] CreateNotifyList()
{
ArrayList userList = new ArrayList();
foreach( MSNUser user in MSNUsers.Values )
{
userList.Add( user.Email );
}
return (string[])userList.ToArray( typeof(string) );
}
private bool BuildStateChanged(IIntegrationResult result)
{
return result.LastIntegrationStatus != result.Status;
}
}
}
--- NEW FILE: AssemblyInfo.cs ---
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
|