[Opensim-dev] Restructuring IClientAPI - thoughts wanted

dr scofield drscofield at xyzzyxyzzy.net
Sun Sep 14 18:31:15 UTC 2008


Frisby, Adam wrote:
>
> 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?
>
+1

-- 
dr dirk husemann ---- math & computer science ---- ibm zurich research lab
RL: hud at zurich.ibm.com - +41 44 724 8573 - http://www.zurich.ibm.com/~hud/ 
SL: drscofield at xyzzyxyzzy.net --------------------- http://xyzzyxyzzy.net/




More information about the Opensim-dev mailing list