Guys,
Good news for you, i've started porting some of the components i've
made past few years for .NET framework into ActionScript, first thing
i want to present you is IRC Client Component for Aswing, i've
uploaded first beta on SVN already so basically you can start working
with it.
Below you can find sample of IRC bot made with IrcClient component:
package
{
import flash.display.Sprite;
import org.aswing.net.irc.IrcClient;
import org.aswing.net.irc.events.IrcEvent;
import org.aswing.util.StringUtils;
public class IrcClientTest extends Sprite
{
private var irc:IrcClient;
public function IrcClientTest():void
{
super();
irc = new IrcClient();
irc.server = "
irc.freenode.net";
irc.port = 6667;
irc.nickName = "as3_bot";
irc.realName = "ActionScript 3 Client";
irc.addEventListener(IrcEvent.ERROR, __irc_error);
irc.addEventListener(IrcEvent.CONNECTED, __irc_connected);
irc.addEventListener(IrcEvent.STATUS, __irc_status);
irc.addEventListener(IrcEvent.CHANNEL_MESSAGE,
__irc_channel_message);
irc.addEventListener(IrcEvent.PRIVATE_MESSAGE,
__irc_channel_message);
irc.connect();
}
private function __irc_connected(e:IrcEvent):void
{
irc.join("#aswing");
}
private function __irc_channel_message(e:IrcEvent):void
{
var channel:String = e.ircData.channel;
var msg:String = e.ircData.message;
if (StringUtils.startsWith(msg, "!"))
{
irc.say(channel, "i can't handle this commnad");
}
}
private function __irc_status(e:IrcEvent):void
{
//trace("status: " + e.ircData.message);
}
private function __irc_error(e:IrcEvent):void
{
trace("ERROR: "+e.ircData.message);
if (StringUtils.startsWith(e.ircData.message, "Closing Link"))
{
irc.connect();
}
}
}
}