Skip to content

Commit

Permalink
* some smaller changes
Browse files Browse the repository at this point in the history
* added .gitignore
  • Loading branch information
Thomas Bruderer committed Feb 15, 2011
1 parent f41adcc commit f9863db
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.crc
_ReSharper.IrcD.Net
bin
obj
/IrcD.Net.5.0.ReSharper.user
/IrcD.Net.suo
8 changes: 7 additions & 1 deletion IrcD.Net/Commands/CommandList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IrcD.ServerReplies;
using IrcD.Utils;

namespace IrcD.Commands
Expand All @@ -47,7 +48,12 @@ public IEnumerable<string> Supported()
return commandList.SelectMany(m => m.Value.Support(ircDaemon));
}

public void Handle(string command, UserInfo info, List<string> args)
public void Handle(UserInfo info, string prefix, ReplyCode replyCode, List<string> args)
{
throw new NotImplementedException();
}

public void Handle(UserInfo info, string prefix, string command, List<string> args)
{
CommandBase commandObject;

Expand Down
2 changes: 1 addition & 1 deletion IrcD.Net/Commands/Join.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void PartAll(UserInfo info)
}
partargs.Add(command.ToString());
partargs.Add(IrcDaemon.Options.StandardPartMessage);
IrcDaemon.Commands.Handle("PART", info, partargs);
IrcDaemon.Commands.Handle(info, info.Usermask, "PART", partargs);
}

private void SendTopic(UserInfo info, ChannelInfo chan)
Expand Down
1 change: 0 additions & 1 deletion IrcD.Net/Commands/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ public override IEnumerable<string> Support(IrcDaemon ircDaemon)
{
return Enumerable.Repeat("LANGUAGE=" + ircDaemon.Options.MaxLanguages, 1);
}

}
}
3 changes: 2 additions & 1 deletion IrcD.Net/Commands/Quit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

using System.Collections.Generic;
using System.Linq;

namespace IrcD.Commands
{
Expand All @@ -35,7 +36,7 @@ public override void Handle(UserInfo info, List<string> args)
IrcDaemon.Replies.SendNotRegistered(info);
}

var message = (args.Count > 0) ? args[0] : IrcDaemon.Options.StandardQuitMessage;
var message = (args.Count > 0) ? args.First() : IrcDaemon.Options.StandardQuitMessage;
info.Remove(message);
}
}
Expand Down
5 changes: 4 additions & 1 deletion IrcD.Net/Database/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ namespace IrcD.Database
{
partial class Setting
{

public override string ToString()
{
return _key + " => " + _value;
}
}
}
#endif
13 changes: 10 additions & 3 deletions IrcD.Net/IrcDaemon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ private void Parser(string line, Socket sock, UserInfo info)

string prefix = null;
string command = null;
var replycode = ReplyCode.Null;
var replyCode = ReplyCode.Null;
var args = new List<string>();

try
Expand All @@ -458,7 +458,7 @@ private void Parser(string line, Socket sock, UserInfo info)
/*command might be numeric (xxx) or command */
if (char.IsDigit(line[i + 1]) && char.IsDigit(line[i + 2]) && char.IsDigit(line[i + 3]))
{
replycode = (ReplyCode)int.Parse(line.Substring(i + 1, 3));
replyCode = (ReplyCode)int.Parse(line.Substring(i + 1, 3));
i += 4;
}
else
Expand Down Expand Up @@ -505,7 +505,14 @@ private void Parser(string line, Socket sock, UserInfo info)
return;

FilterArgs(args);
commands.Handle(command, info, args);
if (replyCode == ReplyCode.Null)
{
commands.Handle(info, prefix, command, args);
}
else
{
commands.Handle(info, prefix, replyCode, args);
}
}


Expand Down
7 changes: 4 additions & 3 deletions IrcD.Net/Modes/ChannelModes/ModeTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public override bool HandleEvent(IrcCommandType ircCommand, ChannelInfo channel,

if (ircCommand == IrcCommandType.Join)
{
user.IrcDaemon.Send.Notice(user, user, channel.Name, "This channel automatically translates your messages, user the LANGUAGE command to set your preferred language");
user.IrcDaemon.Send.Notice(user, user, channel.Name, "This channel automatically translates your messages, use the LANGUAGE command to set your preferred language");
}
if (ircCommand == IrcCommandType.PrivateMessage || ircCommand == IrcCommandType.Notice)
{
Expand All @@ -58,8 +58,8 @@ public override bool HandleEvent(IrcCommandType ircCommand, ChannelInfo channel,
return false;
}

var t = new GoogleTranslate.TranslateMultipleDelegate(translator.TranslateText);
t.BeginInvoke(args[1], channel.Users.Select(u => u.Languages.First()).Distinct(), TranslateCallBack, Utils.Tuple.Create(channel, user, ircCommand));
var translateDelegate = new GoogleTranslate.TranslateMultipleDelegate(translator.TranslateText);
translateDelegate.BeginInvoke(args[1], channel.Users.Select(u => u.Languages.First()).Distinct(), TranslateCallBack, Utils.Tuple.Create(channel, user, ircCommand));

onlyOnce = false;
return false;
Expand Down Expand Up @@ -97,6 +97,7 @@ private static void TranslateCallBack(IAsyncResult asyncResult)
// This should never happen: There must be always at least the Original in the result
message = "BUG: Translation failed miserably";
}

switch (state.Item3)
{
case IrcCommandType.PrivateMessage:
Expand Down

0 comments on commit f9863db

Please sign in to comment.