Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…c2-4a08-a3b7-d3cc9173df77
  • Loading branch information
FreeApophis committed May 24, 2010
1 parent 8d3a195 commit b85aee3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 149 deletions.
1 change: 1 addition & 0 deletions IrcD.Net/Database/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ namespace IrcD.Database
{
partial class Main
{

}
}
1 change: 1 addition & 0 deletions IrcD.Net/Database/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ namespace IrcD.Database
{
partial class User
{

}
}
2 changes: 2 additions & 0 deletions IrcD.Net/IrcD.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<Compile Include="Database\DatabaseCommon.cs" />
<Compile Include="Database\DatabaseModel.cs" />
<Compile Include="Database\Log.cs" />
<Compile Include="Database\Main.cs" />
<Compile Include="Database\Nick.cs" />
<Compile Include="Database\Setting.cs" />
<Compile Include="Database\User.cs" />
Expand All @@ -152,6 +153,7 @@
<Compile Include="Modes\ChannelRanks\ModeVoice.cs" />
<Compile Include="Modes\ChannelRank.cs" />
<Compile Include="Modes\Mode.cs" />
<Compile Include="Modes\ModeFactory.cs" />
<Compile Include="Modes\ModeList.cs" />
<Compile Include="Modes\RankList.cs" />
<Compile Include="Modes\UserMode.cs" />
Expand Down
102 changes: 0 additions & 102 deletions IrcD.Net/IrcDaemon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,108 +363,6 @@ private string[] GetSubArgument(string arg)
return arg.Split(new[] { ',' });
}

private Dictionary<char, bool> ParseUserMode(string umode)
{
var changemodes = new Dictionary<char, bool>();
bool plus = true; // if + or - is ommited at beginning we treat it as +
foreach (char c in umode)
{
switch (c)
{
case '+': plus = true;
break;
case '-': plus = false;
break;
default: changemodes.Add(c, plus);
break;
}
}
return changemodes;
}

private readonly List<char> modeWithParams = new List<char> { 'b', 'e', 'h', 'I', 'k', 'l', 'o', 'O', 'v' };

private class ModeElement
{
public ModeElement(char mode, bool? plus, string param)
{
this.mode = mode;
this.plus = plus;
this.param = param;
}

private char mode;

public char Mode
{
get { return mode; }
}

private bool? plus;

public bool? Plus
{
get { return plus; }
}

private string param;

public string Param
{
get { return param; }
}

}

private List<ModeElement> ParseChannelModes(List<string> cmode)
{
var changemodes = new List<ModeElement>();
bool? plus;
int arg = 1;
int paramsNeeded;
while (arg < cmode.Count)
{
plus = null; paramsNeeded = 0;
foreach (char c in cmode[arg])
{
if (c == '+')
{
plus = true;
}
else if (c == '-')
{
plus = false;
}
else
{
if (modeWithParams.Contains(c))
{
paramsNeeded++;
if (plus == null)
{
changemodes.Add(new ModeElement(c, plus, null));
}
else
{
try
{
changemodes.Add(new ModeElement(c, plus, cmode[arg + paramsNeeded]));
}
catch (ArgumentOutOfRangeException) { }
}
}
else
{
changemodes.Add(new ModeElement(c, plus, null));
}

}
}
arg = arg + paramsNeeded + 1;
}

return changemodes;
}

/// <summary>
/// Check if an IRC Operatur status can be granted upon user and pass
Expand Down
55 changes: 8 additions & 47 deletions IrcD.Net/UserInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using System.Linq;
using System.Net.Sockets;
using System.Text;
using IrcD.Database;
using IrcD.Modes;
using IrcD.Utils;

Expand All @@ -34,12 +35,12 @@ public class UserInfo : InfoBase
public UserInfo(IrcDaemon ircDaemon, Socket socket, string host, bool isAcceptSocket, bool passAccepted)
: base(ircDaemon)
{
AwayMsg = null;
Realname = null;
//AwayMsg = null;
//Realname = null;
IsService = false;
Registered = false;
PassAccepted = passAccepted;
this.host = host;
//this.host = host;
this.isAcceptSocket = isAcceptSocket;
this.socket = socket;
}
Expand Down Expand Up @@ -70,52 +71,14 @@ public bool IsAcceptSocket

public bool IsService { get; set; }

private string nick = null;

public string Nick
{
get
{
return nick;
}
internal set
{
nick = value;
}
}

public string Realname { get; internal set; }


private string user;

public string User
{
get
{
return user;
}
internal set
{
user = value;
}
}

private readonly string host;

public string Host
{
get
{
return host;
}
}
private User data;

public string Usermask
{
get
{
return nick + "!" + user + "@" + host;
{
//return nick + "!" + user + "@" + host;
return
}
}

Expand All @@ -127,8 +90,6 @@ public string Prefix
}
}

public string AwayMsg { get; set; }

private DateTime lastAction = DateTime.Now;

public DateTime LastAction
Expand Down
Binary file modified IrcD.Net/ircd.db
Binary file not shown.

0 comments on commit b85aee3

Please sign in to comment.