[Opensim-dev] Restructuring IClientAPI - thoughts wanted
Frisby, Adam
adam at deepthink.com.au
Sun Sep 14 03:03:17 UTC 2008
My thoughts for that was along the lines of:
[SERVER] Client connecting at WW.XX.YY.ZZ, supports <InstantMessaging, Chat, Primitives>.
Adam
> -----Original Message-----
> From: opensim-dev-bounces at lists.berlios.de [mailto:opensim-dev-
> bounces at lists.berlios.de] On Behalf Of Melanie
> Sent: Saturday, 13 September 2008 8:10 PM
> To: opensim-dev at lists.berlios.de
> Subject: Re: [Opensim-dev] Restructuring IClientAPI - thoughts wanted
>
> Is there even a need to enumerate?
>
> Basically, each class is either an event consumer or a message
> sender. IN either case, they would know the interface they're
> looking for. So, enumeration seems unnecessary.
> If we do need to do it, it would be infrequent, so the performance
> hit of reflection seems very much acceptable.
>
> if (client is IInstantMessageService)
> ((IInstantMessageService)client).OnInstantMessage +=
> OnInstantMessage;
>
> Looks like a winner!
>
> +1
>
> Melanie
>
> Frisby, Adam wrote:
> > Slight correction suggestion, IClientAPI actually is redundant in
> that situation - there's no reason why we need to keep HasInterface as
> long as we can do "Client is <type/interface>". GetInterfaces() could
> be replaced with a quick search via reflection (GetTypes)
> >
> > Adam
> >
> > From: opensim-dev-bounces at lists.berlios.de [mailto:opensim-dev-
> bounces at lists.berlios.de] On Behalf Of Frisby, Adam
> > Sent: Saturday, 13 September 2008 7:41 PM
> > To: opensim-dev at lists.berlios.de
> > Subject: [Opensim-dev] Restructuring IClientAPI - thoughts wanted
> >
> > I'm in the process of adding support for some alternate clients to
> OpenSim, and one of the things I'm noticing is that there is one one
> chunk of OpenSim in particular that is highly "LL-Specific" in how it
> treats things - it's also comparatively a very small chunk of OpenSim
> that might actually be fixable quite easily.
> >
> > That is to say, IClientAPI - I'm thinking of replacing IClientAPI
> with a very small interface:
> >
> > bool IClientAPI.HasInterface<T>();
> > type[] IClientAPI.GetInterfaces();
> >
> > Then replacing the current web of .Xyz with smaller more discrete
> interfaces such as:
> >
> >
> > IClientInstantMessage {
> >
> > SendMessage(...);
> >
> > event OnNewMessage;
> >
> > }
> >
> > We can do checks on them in our modules, where once we did:
> >
> > OnNewClient(IClientAPI client) {
> > client.OnNewMessage += messageHandler;
> > }
> >
> > We replace with
> >
> >
> > OnNewClient(IClientAPI client) {
> >
> > If(client.HasInterface<IClientInstantMessage>()) {
> >
> > ((IClientInstantMessage)client).OnNewMessage +=
> messageHandler;
> >
> > }
> >
> > }
> >
> > The resulting code is then more friendly for third party clients, and
> clients don't need to support the full set of functionality to register
> as valid Clients inside of OpenSim.
> >
> > What's everyone's thoughts here?
> >
> > Good idea / bad / anyone got any better?
> >
> > Adam
> >
> >
> >
> > ---------------------------------------------------------------------
> ---
> >
> > _______________________________________________
> > Opensim-dev mailing list
> > Opensim-dev at lists.berlios.de
> > https://lists.berlios.de/mailman/listinfo/opensim-dev
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev
More information about the Opensim-dev
mailing list