Aswing IRC Client Component

10 views
Skip to first unread message

Skitsanos

unread,
Jan 14, 2008, 12:27:18 PM1/14/08
to ActionScript UI with AsWing
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();
}
}
}
}

iiley

unread,
Jan 14, 2008, 8:31:25 PM1/14/08
to as...@googlegroups.com
Great news, is there a online demo to play with? :)


--
iiley
AsWing http://www.aswing.org
Personal http://www.iiley.com

Skitsanos Labs

unread,
Jan 15, 2008, 8:40:41 AM1/15/08
to ActionScript UI with AsWing
not yet, but i (or someone who has more free time) will do it for
sure.

Skitsanos

unread,
Jan 18, 2008, 8:44:15 AM1/18/08
to ActionScript UI with AsWing
Guys,

I've uploaded some more updates for IrcClient on SVN, please update
your files.

There are couple of changes you have to know about,

in code snippet that posted initially in this forum thread you will
see

irc.addEventListener(IrcEvent.CONNECTED, __irc_connected);

ideally you better use

irc.addEventListener(IrcEvent.READY, __irc_connected);

This will make sure that your channel join request or any other
channel/user related command is performed on the right moment.

Cheers,
Evi.
Reply all
Reply to author
Forward
0 new messages