private void ProcessCommand(Message message, Command command) { try { switch(command.ctype) { case "login": this.Login(command.GetContent("username"), command.GetContent("password"), message); break; case "logout": this.Logout(command.GetContent("username"), message); break; case "register": this.Register(command.GetContent("username"), command.GetContent("password"), command.GetContent("alias")); break; case "status": this.Status(command.GetContent("username"), message); throw new Exception("Punching out so we don't send an error."); break; case "information": this.UserInformation(command.GetContent("username"), message); break; default: throw new UnknownType("Command not valid."); break; } } catch(IrisIMException e) { Message resp = new Message(); resp.creator_plugin_hash = this._hash_code; resp.destination_plugin_hash = message.creator_plugin_hash; resp.type = Message.Type.ServerToUserPlugin; Response content = new Response(); content.rtype = "failure"; content.AddContent("command", command.ctype); content.AddContent("reason", e.Message); resp.content = content; message.origin.Write(resp); } catch(Exception e) { Message resp = new Message(); resp.creator_plugin_hash = this._hash_code; resp.destination_plugin_hash = message.creator_plugin_hash; resp.type = Message.Type.ServerToUserPlugin; Response content = new Response(); content.rtype = "failure"; content.AddContent("command", command.ctype); content.AddContent("reason", e.Message); resp.content = content; message.origin.Write(resp); Logger.log("UserManager ProcessCommand error:", Logger.Verbosity.moderate); Logger.log(e.Message+"\n"+e.StackTrace, Logger.Verbosity.moderate); } }