LIBOMV-686 Implements new event patterns based on the Microsoft Framework Design Guidelines in AgentManager
* Many other code cleanups and example updates * BREAKING - this is a major shift in the way events are internally handled. git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3145 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -22,9 +22,8 @@ namespace IRCGateway
|
||||
{
|
||||
_Client = new GridClient();
|
||||
_Client.Network.OnLogin += new NetworkManager.LoginCallback(Network_OnLogin);
|
||||
_Client.Self.OnChat += new AgentManager.ChatCallback(Self_OnChat);
|
||||
_Client.Self.OnInstantMessage += new AgentManager.InstantMessageCallback(Self_OnInstantMessage);
|
||||
|
||||
_Client.Self.ChatFromSimulator += new EventHandler<ChatEventArgs>(Self_ChatFromSimulator);
|
||||
_Client.Self.IM += Self_IM;
|
||||
_ClientLogin = _Client.Network.DefaultLoginParams(args[0], args[1], args[2], "", "IRCGateway");
|
||||
|
||||
_AutoJoinChannel = args[6];
|
||||
@@ -39,6 +38,27 @@ namespace IRCGateway
|
||||
}
|
||||
}
|
||||
|
||||
static void Self_IM(object sender, InstantMessageEventArgs e)
|
||||
{
|
||||
if (e.IM.Dialog == InstantMessageDialog.RequestTeleport)
|
||||
{
|
||||
if (e.IM.FromAgentID == _MasterID)
|
||||
{
|
||||
_Client.Self.TeleportLureRespond(e.IM.FromAgentID, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Self_ChatFromSimulator(object sender, ChatEventArgs e)
|
||||
{
|
||||
if (e.FromName != _Client.Self.Name && e.Type == ChatType.Normal && e.AudibleLevel == ChatAudibleLevel.Fully)
|
||||
{
|
||||
string str = "<" + e.FromName + "> " + e.Message;
|
||||
_IRC.SendMessage(_AutoJoinChannel, str);
|
||||
Console.WriteLine("[SL->IRC] " + str);
|
||||
}
|
||||
}
|
||||
|
||||
static void _IRC_OnConnected()
|
||||
{
|
||||
_IRC.JoinChannel(_AutoJoinChannel);
|
||||
@@ -54,32 +74,10 @@ namespace IRCGateway
|
||||
Console.WriteLine("[IRC->SL] " + str);
|
||||
}
|
||||
}
|
||||
|
||||
static void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
|
||||
{
|
||||
if (im.Dialog == InstantMessageDialog.RequestTeleport)
|
||||
{
|
||||
if (im.FromAgentID == _MasterID)
|
||||
{
|
||||
_Client.Self.TeleportLureRespond(im.FromAgentID, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void Network_OnLogin(LoginStatus login, string message)
|
||||
{
|
||||
_IRC.SendMessage(_AutoJoinChannel, message);
|
||||
}
|
||||
|
||||
static void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position)
|
||||
{
|
||||
if (fromName != _Client.Self.Name && type == ChatType.Normal && audible == ChatAudibleLevel.Fully)
|
||||
{
|
||||
string str = "<" + fromName + "> " + message;
|
||||
_IRC.SendMessage(_AutoJoinChannel, str);
|
||||
Console.WriteLine("[SL->IRC] " + str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user