Fix compile error and fix some style changes for merge request 368#

This commit is contained in:
Hylke Bons 2011-10-17 19:54:41 +02:00
parent 59d4a7367f
commit 363209cd15

View file

@ -43,19 +43,17 @@ namespace SparkleLib {
// with a number, so prefix an alphabetic character // with a number, so prefix an alphabetic character
this.nick = "s" + this.nick.Substring (0, 7); this.nick = "s" + this.nick.Substring (0, 7);
// Key to turn the channel access more safely. // Optional password to make the channel access more safe
this.announcements_password = this.announcements_password =
SparkleConfig.DefaultConfig.GetConfigOption ("announcements_password"); SparkleConfig.DefaultConfig.GetConfigOption ("announcements_password");
// Identifier to define access in IRC channel when no key is defined // Option to allow access to channel when no password is defined
this.allow_passwordless_join = try {
SparkleConfig.DefaultConfig.GetConfigOption ("allow_passwordless_join"); this.allow_passwordless_join = Convert.ToBoolean (
SparkleConfig.DefaultConfig.GetConfigOption ("allow_passwordless_join"));
// This action ensures that the Sparkleshare function normally when the key is not defined.
// It is recommended that the user asked a question to see whether or not to allow access } catch (Exception) {
// to the channel without a key. this.allow_passwordless_join = true;
if (this.allow_passwordless_join == null) {
this.allow_passwordless_join = true
} }
base.channels.Add ("#" + folder_identifier); base.channels.Add ("#" + folder_identifier);
@ -119,24 +117,31 @@ namespace SparkleLib {
try { try {
// Connect, login, and join the channel // Connect, login, and join the channel
int port = base.server.Port; int port = base.server.Port;
if (port < 0) port = 6667;
if (port < 0)
port = 6667;
this.client.Connect (base.server.Host, port); this.client.Connect (base.server.Host, port);
this.client.Login (this.nick, this.nick, 8, this.nick); this.client.Login (this.nick, this.nick, 8, this.nick);
foreach (string channel in base.channels) { foreach (string channel in base.channels) {
SparkleHelpers.DebugInfo ("ListenerIrc", "Joining channel " + channel); SparkleHelpers.DebugInfo ("ListenerIrc", "Joining channel " + channel);
if (this.announcements_password != null) {
if (!string.IsNullOrEmpty (this.announcements_password)) {
SparkleHelpers.DebugInfo ("ListenerIrc", "Password set to access the channel"); SparkleHelpers.DebugInfo ("ListenerIrc", "Password set to access the channel");
this.client.RfcJoin (channel, this.announcements_password); this.client.RfcJoin (channel, this.announcements_password);
this.client.RfcMode (channel, "+k " + this.announcements_password); this.client.RfcMode (channel, "+k " + this.announcements_password);
} else { } else {
if (allow_passwordless_join) { if (this.allow_passwordless_join) {
SparkleHelpers.DebugInfo ("ListenerIrc", "Accessing a dangerous channel change the setting to not access"); SparkleHelpers.DebugInfo ("ListenerIrc", "Accessing a dangerous channel, change the setting to not access");
this.client.RfcJoin (channel); this.client.RfcJoin (channel);
} else { } else {
SparkleHelpers.DebugInfo ("ListenerIrc", "Dangerous channel, change the setting to access"); SparkleHelpers.DebugInfo ("ListenerIrc", "Dangerous channel, change the setting to access");
} }
} }
this.client.RfcMode (channel, "+s"); this.client.RfcMode (channel, "+s");
} }