internal static OSD ChatterBoxSessionStartReply(UUID sessionID, string SessionName) { OSDMap body = new OSDMap(); OSDMap sessionInfo = new OSDMap(); //OSDMap infoDetail = new OSDMap(); OSDMap moderatedMode = new OSDMap(); moderatedMode.Add("voice", OSD.FromBoolean(true)); sessionInfo.Add("moderated_mode", sessionInfo); sessionInfo.Add("session_name", OSD.FromString(SessionName)); sessionInfo.Add("type", OSD.FromInteger(0)); sessionInfo.Add("voice_enabled", OSD.FromBoolean(true)); body.Add("session_info", sessionInfo); body.Add("temp_session_id", OSD.FromUUID(sessionID)); body.Add("success", OSD.FromBoolean(true)); OSDMap chatterBoxSessionAgentListUpdates = new OSDMap(); chatterBoxSessionAgentListUpdates.Add("message", OSD.FromString("ChatterBoxSessionStartReply")); chatterBoxSessionAgentListUpdates.Add("body", body); return(chatterBoxSessionAgentListUpdates); }
public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket) { OSDMap groupUpdate = new OSDMap(); groupUpdate.Add("message", OSD.FromString("AgentGroupDataUpdate")); OSDMap body = new OSDMap(); OSDArray agentData = new OSDArray(); OSDMap agentDataMap = new OSDMap(); agentDataMap.Add("AgentID", OSD.FromUUID(groupUpdatePacket.AgentData.AgentID)); agentData.Add(agentDataMap); body.Add("AgentData", agentData); OSDArray groupData = new OSDArray(); foreach (AgentGroupDataUpdatePacket.GroupDataBlock groupDataBlock in groupUpdatePacket.GroupData) { OSDMap groupDataMap = new OSDMap(); groupDataMap.Add("ListInProfile", OSD.FromBoolean(false)); groupDataMap.Add("GroupID", OSD.FromUUID(groupDataBlock.GroupID)); groupDataMap.Add("GroupInsigniaID", OSD.FromUUID(groupDataBlock.GroupInsigniaID)); groupDataMap.Add("Contribution", OSD.FromInteger(groupDataBlock.Contribution)); groupDataMap.Add("GroupPowers", OSD.FromBinary(ulongToByteArray(groupDataBlock.GroupPowers))); groupDataMap.Add("GroupName", OSD.FromString(Utils.BytesToString(groupDataBlock.GroupName))); groupDataMap.Add("AcceptNotices", OSD.FromBoolean(groupDataBlock.AcceptNotices)); groupData.Add(groupDataMap); } body.Add("GroupData", groupData); groupUpdate.Add("body", body); return(groupUpdate); }
public OSDMap Pack() { OSDMap args = new OSDMap(); args["message_type"] = OSD.FromString("AgentPosition"); args["region_handle"] = OSD.FromString(RegionHandle.ToString()); args["circuit_code"] = OSD.FromString(CircuitCode.ToString()); args["agent_uuid"] = OSD.FromUUID(AgentID); args["session_uuid"] = OSD.FromUUID(SessionID); args["position"] = OSD.FromString(Position.ToString()); args["velocity"] = OSD.FromString(Velocity.ToString()); args["center"] = OSD.FromString(Center.ToString()); args["size"] = OSD.FromString(Size.ToString()); args["at_axis"] = OSD.FromString(AtAxis.ToString()); args["left_axis"] = OSD.FromString(LeftAxis.ToString()); args["up_axis"] = OSD.FromString(UpAxis.ToString()); args["far"] = OSD.FromReal(Far); args["changed_grid"] = OSD.FromBoolean(ChangedGrid); if ((Throttles != null) && (Throttles.Length > 0)) { args["throttles"] = OSD.FromBinary(Throttles); } return(args); }
void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID) { if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); } OSDMap moderatedMap = new OSDMap(4); moderatedMap.Add("voice", OSD.FromBoolean(false)); OSDMap sessionMap = new OSDMap(4); sessionMap.Add("moderated_mode", moderatedMap); sessionMap.Add("session_name", OSD.FromString(groupName)); sessionMap.Add("type", OSD.FromInteger(0)); sessionMap.Add("voice_enabled", OSD.FromBoolean(false)); OSDMap bodyMap = new OSDMap(4); bodyMap.Add("session_id", OSD.FromUUID(groupID)); bodyMap.Add("temp_session_id", OSD.FromUUID(groupID)); bodyMap.Add("success", OSD.FromBoolean(true)); bodyMap.Add("session_info", sessionMap); IEventQueue queue = remoteClient.Scene.RequestModuleInterface <IEventQueue>(); if (queue != null) { queue.Enqueue(EventQueueHelper.buildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId); } }
/// <summary> /// Serialize to OSD /// </summary> /// <returns>OSDMap with the serialized data</returns> public OSDMap GetOSD() { OSDMap map = new OSDMap(); map["alt_image_enable"] = OSD.FromBoolean(EnableAlterntiveImage); map["auto_loop"] = OSD.FromBoolean(AutoLoop); map["auto_play"] = OSD.FromBoolean(AutoPlay); map["auto_scale"] = OSD.FromBoolean(AutoScale); map["auto_zoom"] = OSD.FromBoolean(AutoZoom); map["controls"] = OSD.FromInteger((int)Controls); map["current_url"] = OSD.FromString(CurrentURL); map["first_click_interact"] = OSD.FromBoolean(InteractOnFirstClick); map["height_pixels"] = OSD.FromInteger(Height); map["home_url"] = OSD.FromString(HomeURL); map["perms_control"] = OSD.FromInteger((int)ControlPermissions); map["perms_interact"] = OSD.FromInteger((int)InteractPermissions); List <OSD> wl = new List <OSD>(); if (WhiteList != null && WhiteList.Length > 0) { for (int i = 0; i < WhiteList.Length; i++) { wl.Add(OSD.FromString(WhiteList[i])); } } map["whitelist"] = new OSDArray(wl); map["whitelist_enable"] = OSD.FromBoolean(EnableWhiteList); map["width_pixels"] = OSD.FromInteger(Width); return(map); }
/// <summary> /// Tell the user about an update /// </summary> /// <param name = "newDisplayName"></param> /// <param name = "oldDisplayName"></param> /// <param name = "ID"></param> /// <param name = "isDefault"></param> /// <param name = "First"></param> /// <param name = "Last"></param> /// <param name = "Account"></param> /// <returns></returns> public OSD DisplayNameUpdate(string newDisplayName, string oldDisplayName, UUID ID, bool isDefault, string First, string Last, string Account) { OSDMap nameReply = new OSDMap { { "message", OSD.FromString("DisplayNameUpdate") } }; OSDMap body = new OSDMap(); OSDMap agentData = new OSDMap { { "display_name", OSD.FromString(newDisplayName) }, { "display_name_next_update", OSD.FromDate( DateTime.ParseExact("1970-01-01 00:00:00 +0", "yyyy-MM-dd hh:mm:ss z", DateTimeFormatInfo.InvariantInfo).ToUniversalTime()) }, { "id", OSD.FromUUID(ID) }, { "is_display_name_default", OSD.FromBoolean(isDefault) }, { "legacy_first_name", OSD.FromString(First) }, { "legacy_last_name", OSD.FromString(Last) }, { "username", OSD.FromString(Account) } }; body.Add("agent", agentData); body.Add("agent_id", OSD.FromUUID(ID)); body.Add("old_display_name", OSD.FromString(oldDisplayName)); nameReply.Add("body", body); return(nameReply); }
private void InitializeConfig() { Settings s = instance.GlobalSettings; var serializer = new JavaScriptSerializer(); if (s["chat_timestamps"].Type == OSDType.Unknown) { s["chat_timestamps"] = OSD.FromBoolean(true); } if (s["chat_fonts"].Type == OSDType.Unknown) { try { s["chat_fonts"] = serializer.Serialize(Settings.DefaultFontSettings); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Failed to save default font settings: " + ex.Message); } } try { fontSettings = serializer.Deserialize <Dictionary <string, Settings.FontSetting> >(s["chat_fonts"]); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Failed to read chat font settings: " + ex.Message); } showTimestamps = s["chat_timestamps"].AsBoolean(); s.OnSettingChanged += new Settings.SettingChangedCallback(s_OnSettingChanged); }
byte[] ChangePassword(OSDMap map) { string Password = map["Password"].AsString(); string newPassword = map["NewPassword"].AsString(); ILoginService loginService = m_registry.RequestModuleInterface <ILoginService>(); UUID secureSessionID; UUID userID = map["UUID"].AsUUID(); IAuthenticationService auths = m_registry.RequestModuleInterface <IAuthenticationService>(); LoginResponse loginresp = loginService.VerifyClient(userID, Password, UUID.Zero, false, "", "", "", out secureSessionID); OSDMap resp = new OSDMap(); //Null means it went through without an error bool Verified = loginresp == null; if ((auths.Authenticate(userID, Password, 100) != string.Empty) && (Verified)) { auths.SetPassword(userID, newPassword); resp["Verified"] = OSD.FromBoolean(Verified); } string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
byte[] ForgotPassword(OSDMap map) { UUID UUDI = map["UUID"].AsUUID(); string Password = map["Password"].AsString(); IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService>(); UserAccount user = accountService.GetUserAccount(UUID.Zero, UUDI); OSDMap resp = new OSDMap(); bool verified = user != null; resp["Verified"] = OSD.FromBoolean(verified); resp["UserLevel"] = OSD.FromInteger(0); if (verified) { resp["UserLevel"] = OSD.FromInteger(user.UserLevel); if (user.UserLevel >= 0) { IAuthenticationService auths = m_registry.RequestModuleInterface <IAuthenticationService>(); auths.SetPassword(user.PrincipalID, Password); } else { resp["Verified"] = OSD.FromBoolean(false); } } string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
private byte[] ProcessAdminLogin(OSDMap map) { bool Verified = false; string Name = map["Name"].AsString(); string Password = map["Password"].AsString(); ILoginService loginService = m_registry.RequestModuleInterface <ILoginService>(); UUID secureSessionID; UUID userID = UUID.Zero; LoginResponse loginresp = loginService.VerifyClient(Name, Password, UUID.Zero, false, "", "", "", out secureSessionID); //Null means it went through without an error Verified = loginresp == null; if (Verified) { UserAccount account = m_registry.RequestModuleInterface <IUserAccountService>().GetUserAccount(UUID.Zero, Name); if ((account.UserFlags & 2048) == 2048) //Admin flag { userID = account.PrincipalID; } } OSDMap resp = new OSDMap(); resp["Verified"] = OSD.FromBoolean(Verified); resp["UUID"] = OSD.FromUUID(userID); string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
/// <summary> /// Gets user information for change user info page on site /// </summary> /// <param name="map">UUID</param> /// <returns>Verified, HomeName, HomeUUID, Online, Email, FirstName, LastName</returns> byte[] GetGridUserInfo(OSDMap map) { string uuid = String.Empty; uuid = map["UUID"].AsString(); IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService>(); UserAccount user = accountService.GetUserAccount(UUID.Zero, map["UUID"].AsUUID()); IAgentInfoService agentService = m_registry.RequestModuleInterface <IAgentInfoService>(); UserInfo userinfo; OSDMap resp = new OSDMap(); bool verified = user != null; resp["Verified"] = OSD.FromBoolean(verified); if (verified) { userinfo = agentService.GetUserInfo(uuid); IGridService gs = m_registry.RequestModuleInterface <IGridService>(); Services.Interfaces.GridRegion gr = gs.GetRegionByUUID(UUID.Zero, userinfo.HomeRegionID); resp["HomeUUID"] = OSD.FromUUID(userinfo.HomeRegionID); resp["HomeName"] = OSD.FromString(gr.RegionName); resp["Online"] = OSD.FromBoolean(userinfo.IsOnline); resp["Email"] = OSD.FromString(user.Email); resp["Name"] = OSD.FromString(user.Name); } string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
byte[] FindUsers(OSDMap map) { OSDMap resp = new OSDMap(); int start = map["Start"].AsInteger(); int end = map["End"].AsInteger(); string Query = map["Query"].AsString(); List <UserAccount> accounts = m_registry.RequestModuleInterface <IUserAccountService>().GetUserAccounts(UUID.Zero, Query); OSDArray users = new OSDArray(); for (int i = start; i < end && i < accounts.Count; i++) { UserAccount acc = accounts[i]; OSDMap userInfo = new OSDMap(); userInfo["PrincipalID"] = acc.PrincipalID; userInfo["UserName"] = acc.Name; userInfo["Created"] = acc.Created; userInfo["UserFlags"] = acc.UserFlags; users.Add(userInfo); } resp["Users"] = users; resp["Finished"] = OSD.FromBoolean(true); string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
/// <summary> /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json /// </summary> /// <returns>map of the agent circuit data</returns> public OSDMap PackAgentCircuitData() { OSDMap args = new OSDMap(); args["agent_id"] = OSD.FromUUID(AgentID); args["caps_path"] = OSD.FromString(CapsPath); args["child"] = OSD.FromBoolean(child); args["circuit_code"] = OSD.FromString(circuitcode.ToString()); args["secure_session_id"] = OSD.FromUUID(SecureSessionID); args["session_id"] = OSD.FromUUID(SessionID); args["service_session_id"] = OSD.FromString(ServiceSessionID); args["start_pos"] = OSD.FromString(startpos.ToString()); args["client_ip"] = OSD.FromString(IPAddress); args["otherInfo"] = OSDParser.SerializeLLSDXmlString(OtherInformation); args["teleport_flags"] = OSD.FromUInteger(teleportFlags); if (Appearance != null) { args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); OSDMap appmap = Appearance.Pack(); args["packed_appearance"] = appmap; } return(args); }
internal static OSD ChatterBoxSessionAgentListUpdates(UUID sessionID, OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock[] agentUpdatesBlock, string Transition) { OSDMap body = new OSDMap(); OSDMap agentUpdates = new OSDMap(); OSDMap infoDetail = new OSDMap(); OSDMap mutes = new OSDMap(); foreach (OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block in agentUpdatesBlock) { infoDetail = new OSDMap(); mutes = new OSDMap(); mutes.Add("text", OSD.FromBoolean(block.MuteText)); mutes.Add("voice", OSD.FromBoolean(block.MuteVoice)); infoDetail.Add("can_voice_chat", OSD.FromBoolean(block.CanVoiceChat)); infoDetail.Add("is_moderator", OSD.FromBoolean(block.IsModerator)); infoDetail.Add("mutes", mutes); OSDMap info = new OSDMap(); info.Add("info", infoDetail); if (Transition != string.Empty) { info.Add("transition", OSD.FromString(Transition)); } agentUpdates.Add(block.AgentID.ToString(), info); } body.Add("agent_updates", agentUpdates); body.Add("session_id", OSD.FromUUID(sessionID)); body.Add("updates", new OSD()); OSDMap chatterBoxSessionAgentListUpdates = new OSDMap(); chatterBoxSessionAgentListUpdates.Add("message", OSD.FromString("ChatterBoxSessionAgentListUpdates")); chatterBoxSessionAgentListUpdates.Add("body", body); return(chatterBoxSessionAgentListUpdates); }
OSDMap ForgotPassword(OSDMap map) { UUID UUDI = map ["UUID"].AsUUID(); string Password = map ["Password"].AsString(); IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService> (); UserAccount user = accountService.GetUserAccount(null, UUDI); OSDMap resp = new OSDMap(); bool verified = user != null; resp ["Verified"] = OSD.FromBoolean(verified); resp ["UserLevel"] = OSD.FromInteger(0); if (verified) { resp ["UserLevel"] = OSD.FromInteger(user.UserLevel); if (user.UserLevel >= 0) { IAuthenticationService auths = m_registry.RequestModuleInterface <IAuthenticationService> (); auths.SetPassword(user.PrincipalID, "UserAccount", Password); } else { resp ["Verified"] = OSD.FromBoolean(false); } } return(resp); }
byte[] GetAvatarArchives(OSDMap map) { OSDMap resp = new OSDMap(); List <AvatarArchive> temp = DataManager.RequestPlugin <IAvatarArchiverConnector>().GetAvatarArchives(true); string names = ""; string snapshot = ""; foreach (AvatarArchive a in temp) { names += a.Name + ","; snapshot += a.Snapshot + ","; } if (names.Length > 0) { resp["names"] = names.Substring(0, names.Length - 1); resp["snapshot"] = snapshot.Substring(0, snapshot.Length - 1); resp["Verified"] = OSD.FromBoolean(true); } else { resp["Verified"] = OSD.FromBoolean(false); } string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
OSDMap SetUserLevel(OSDMap map) //just sets a user level { OSDMap resp = new OSDMap(); UUID agentID = map ["UserID"].AsUUID(); int userLevel = map ["UserLevel"].AsInteger(); IUserAccountService userService = m_registry.RequestModuleInterface <IUserAccountService> (); UserAccount account = userService.GetUserAccount(null, agentID); if (account != null) //found { account.UserLevel = userLevel; userService.StoreUserAccount(account); resp ["UserFound"] = OSD.FromBoolean(true); resp ["Updated"] = OSD.FromBoolean(true); } else //not found { resp ["UserFound"] = OSD.FromBoolean(false); resp ["Updated"] = OSD.FromBoolean(false); } return(resp); }
byte[] TempBanUser(OSDMap map) { OSDMap resp = new OSDMap(); UUID agentID = map["UserID"].AsUUID(); IAgentInfo GetAgent = DataManager.RequestPlugin <IAgentConnector>().GetAgent(agentID); if (GetAgent == null) { resp["Finished"] = OSD.FromBoolean(true); string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); } else { GetAgent.Flags &= ~IAgentFlags.TempBan; GetAgent.OtherAgentInformation["TemperaryBanInfo"] = resp["BannedUntil"]; DataManager.RequestPlugin <IAgentConnector>().UpdateAgent(GetAgent); resp["Finished"] = OSD.FromBoolean(true); string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); } }
/// <summary> /// Send back a user's display name /// </summary> /// <param name = "newDisplayName"></param> /// <param name = "oldDisplayName"></param> /// <param name = "ID"></param> /// <param name = "isDefault"></param> /// <param name = "First"></param> /// <param name = "Last"></param> /// <param name = "Account"></param> /// <returns></returns> public OSD DisplayNameReply(string newDisplayName, string oldDisplayName, UUID ID, bool isDefault, string First, string Last, string Account) { OSDMap nameReply = new OSDMap(); OSDMap body = new OSDMap(); OSDMap content = new OSDMap(); OSDMap agentData = new OSDMap(); content.Add("display_name", OSD.FromString(newDisplayName)); content.Add("display_name_next_update", OSD.FromDate( DateTime.ParseExact("1970-01-01 00:00:00 +0", "yyyy-MM-dd hh:mm:ss z", DateTimeFormatInfo.InvariantInfo).ToUniversalTime())); content.Add("id", OSD.FromUUID(ID)); content.Add("is_display_name_default", OSD.FromBoolean(isDefault)); content.Add("legacy_first_name", OSD.FromString(First)); content.Add("legacy_last_name", OSD.FromString(Last)); content.Add("username", OSD.FromString(Account)); body.Add("content", content); body.Add("agent", agentData); body.Add("reason", OSD.FromString("OK")); body.Add("status", OSD.FromInteger(200)); nameReply.Add("body", body); nameReply.Add("message", OSD.FromString("SetDisplayNameReply")); return(nameReply); }
/// <summary> /// /// </summary> public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) { // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start"); string uri = destination.ServerURI + ObjectPath() + sog.UUID + "/"; try { OSDMap args = new OSDMap(2); args["sog"] = OSD.FromString(sog.ToXml2()); args["extra"] = OSD.FromString(sog.ExtraToXmlString()); args["modified"] = OSD.FromBoolean(sog.HasGroupChanged); string state = sog.GetStateSnapshot(); if (state.Length > 0) { args["state"] = OSD.FromString(state); } // Add the input general arguments args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); WebUtil.PostToService(uri, args, 40000); } catch (Exception e) { m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}", e.ToString()); } return(true); }
public FriendsConsole(RadegastInstance instance) { InitializeComponent(); Disposed += new EventHandler(FriendsConsole_Disposed); this.instance = instance; if (instance.GlobalSettings["show_friends_online_notifications"].Type == OSDType.Unknown) { instance.GlobalSettings["show_friends_online_notifications"] = OSD.FromBoolean(true); } if (instance.GlobalSettings["friends_notification_highlight"].Type == OSDType.Unknown) { instance.GlobalSettings["friends_notification_highlight"] = new OSDBoolean(true); } // Callbacks client.Friends.FriendOffline += new EventHandler <FriendInfoEventArgs>(Friends_FriendOffline); client.Friends.FriendOnline += new EventHandler <FriendInfoEventArgs>(Friends_FriendOnline); client.Friends.FriendshipTerminated += new EventHandler <FriendshipTerminatedEventArgs>(Friends_FriendshipTerminated); client.Friends.FriendshipResponse += new EventHandler <FriendshipResponseEventArgs>(Friends_FriendshipResponse); client.Friends.FriendNames += new EventHandler <FriendNamesEventArgs>(Friends_FriendNames); Load += new EventHandler(FriendsConsole_Load); instance.Names.NameUpdated += new EventHandler <UUIDNameReplyEventArgs>(Names_NameUpdated); GUI.GuiHelpers.ApplyGuiFixes(this); }
public static OSD ChatterBoxSessionStartReply(string groupName, UUID groupID) { OSDMap moderatedMap = new OSDMap(4) { { "voice", OSD.FromBoolean(false) } }; OSDMap sessionMap = new OSDMap(4) { { "moderated_mode", moderatedMap }, { "session_name", OSD.FromString(groupName) }, { "type", OSD.FromInteger(0) }, { "voice_enabled", OSD.FromBoolean(false) } }; OSDMap bodyMap = new OSDMap(4) { { "session_id", OSD.FromUUID(groupID) }, { "temp_session_id", OSD.FromUUID(groupID) }, { "success", OSD.FromBoolean(true) }, { "session_info", sessionMap } }; return(buildEvent("ChatterBoxSessionStartReply", bodyMap)); }
private byte[] CreateMetadata(UUID creatorID, string contentType, bool local, bool temporary, byte[] data, Dictionary <string, string> extraHeaders) { using (MemoryStream stream = new MemoryStream()) { OSDMap metadata = new OSDMap(); metadata["local"] = OSD.FromBoolean(local); metadata["temporary"] = OSD.FromBoolean(temporary); metadata["content_type"] = OSD.FromString(contentType); metadata["creator_id"] = OSD.FromUUID(creatorID); metadata["creation_date"] = OSD.FromDate(DateTime.UtcNow); metadata["sha256"] = OSD.FromBinary(Utils.SHA256(data)); if (extraHeaders != null && extraHeaders.Count > 0) { OSDMap headerMap = new OSDMap(extraHeaders.Count); foreach (KeyValuePair <string, string> kvp in extraHeaders) { headerMap.Add(kvp.Key, OSD.FromString(kvp.Value)); } metadata["extra_headers"] = headerMap; } return(Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(metadata))); } }
public OSDMap PackRegionInfoData() { OSDMap args = new OSDMap(); args["region_id"] = OSD.FromUUID(RegionID); if ((RegionName != null) && !RegionName.Equals("")) { args["region_name"] = OSD.FromString(RegionName); } args["external_host_name"] = OSD.FromString(ExternalHostName); args["http_port"] = OSD.FromString(HttpPort.ToString()); args["region_xloc"] = OSD.FromString(RegionLocX.ToString()); args["region_yloc"] = OSD.FromString(RegionLocY.ToString()); args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString()); args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString()); if ((RemotingAddress != null) && !RemotingAddress.Equals("")) { args["remoting_address"] = OSD.FromString(RemotingAddress); } args["remoting_port"] = OSD.FromString(RemotingPort.ToString()); args["allow_alt_ports"] = OSD.FromBoolean(m_allow_alternate_ports); if ((proxyUrl != null) && !proxyUrl.Equals("")) { args["proxy_url"] = OSD.FromString(proxyUrl); } if (OutsideIP != null) { args["outside_ip"] = OSD.FromString(OutsideIP); } return(args); }
public static OSD ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID agentID, bool canVoiceChat, bool isModerator, bool textMute) { OSDMap body = new OSDMap(); OSDMap agentUpdates = new OSDMap(); OSDMap infoDetail = new OSDMap(); OSDMap mutes = new OSDMap(); mutes.Add("text", OSD.FromBoolean(textMute)); infoDetail.Add("can_voice_chat", OSD.FromBoolean(canVoiceChat)); infoDetail.Add("is_moderator", OSD.FromBoolean(isModerator)); infoDetail.Add("mutes", mutes); OSDMap info = new OSDMap(); info.Add("info", infoDetail); agentUpdates.Add(agentID.ToString(), info); body.Add("agent_updates", agentUpdates); body.Add("session_id", OSD.FromUUID(sessionID)); body.Add("updates", new OSD()); OSDMap chatterBoxSessionAgentListUpdates = new OSDMap(); chatterBoxSessionAgentListUpdates.Add("message", OSD.FromString("ChatterBoxSessionAgentListUpdates")); chatterBoxSessionAgentListUpdates.Add("body", body); return(chatterBoxSessionAgentListUpdates); }
/// <summary> /// Send back a user's display name /// </summary> /// <param name="newDisplayName"></param> /// <param name="oldDisplayName"></param> /// <param name="iD"></param> /// <param name="isDefault"></param> /// <param name="first"></param> /// <param name="last"></param> /// <param name="account"></param> /// <returns></returns> public OSD DisplayNameReply(string newDisplayName, string oldDisplayName, UUID iD, bool isDefault, string first, string last, string account) { OSDMap nameReply = new OSDMap(); OSDMap body = new OSDMap(); OSDMap content = new OSDMap(); OSDMap agentData = new OSDMap(); content.Add("display_name", OSD.FromString(newDisplayName)); content.Add("display_name_next_update", OSD.FromDate( DateTime.UtcNow.AddDays(8))); content.Add("id", OSD.FromUUID(iD)); content.Add("is_display_name_default", OSD.FromBoolean(isDefault)); content.Add("legacy_first_name", OSD.FromString(first)); content.Add("legacy_last_name", OSD.FromString(last)); content.Add("username", OSD.FromString(account)); body.Add("content", content); body.Add("agent", agentData); body.Add("reason", OSD.FromString("OK")); body.Add("status", OSD.FromInteger(200)); nameReply.Add("body", body); nameReply.Add("message", OSD.FromString("SetDisplayNameReply")); return(nameReply); }
byte[] HomeLocation(Stream request, UUID agentID) { OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml(HttpServerHandlerHelpers.ReadFully(request)); OSDMap HomeLocation = rm ["HomeLocation"] as OSDMap; if (HomeLocation != null) { OSDMap pos = HomeLocation ["LocationPos"] as OSDMap; Vector3 position = new Vector3( (float)pos ["X"].AsReal(), (float)pos ["Y"].AsReal(), (float)pos ["Z"].AsReal()); OSDMap lookat = HomeLocation ["LocationLookAt"] as OSDMap; Vector3 lookAt = new Vector3( (float)lookat ["X"].AsReal(), (float)lookat ["Y"].AsReal(), (float)lookat ["Z"].AsReal()); //int locationID = HomeLocation["LocationId"].AsInteger(); m_agentInfoService.SetHomePosition(agentID.ToString(), m_service.Region.RegionID, position, lookAt); } rm.Add("success", OSD.FromBoolean(true)); return(OSDParser.SerializeLLSDXmlBytes(rm)); }
/// <summary> /// This method creates a smaller OSD that /// does not contain sensitive information /// if the trusted boolean is false /// </summary> /// <param name="trusted"></param> /// <returns></returns> public OSDMap ToOSD(bool trusted) { OSDMap map = new OSDMap { { "PrincipalID", OSD.FromUUID(PrincipalID) }, { "AllowPublish", OSD.FromBoolean(AllowPublish) }, { "MaturePublish", OSD.FromBoolean(MaturePublish) }, { "WantToMask", OSD.FromUInteger(Interests.WantToMask) }, { "WantToText", OSD.FromString(Interests.WantToText) }, { "CanDoMask", OSD.FromUInteger(Interests.CanDoMask) }, { "CanDoText", OSD.FromString(Interests.CanDoText) }, { "Languages", OSD.FromString(Interests.Languages) }, { "AboutText", OSD.FromString(AboutText) }, { "FirstLifeImage", OSD.FromUUID(FirstLifeImage) }, { "FirstLifeAboutText", OSD.FromString(FirstLifeAboutText) }, { "Image", OSD.FromUUID(Image) }, { "WebURL", OSD.FromString(WebURL) }, { "Created", OSD.FromInteger(Created) }, { "DisplayName", OSD.FromString(DisplayName) }, { "DisplayNameUpdated", OSD.FromDate(DisplayNameUpdated) }, { "Partner", OSD.FromUUID(Partner) }, { "Visible", OSD.FromBoolean(Visible) }, { "CustomType", OSD.FromString(CustomType) } }; if (trusted) { map.Add("AArchiveName", OSD.FromString(AArchiveName)); map.Add("IMViaEmail", OSD.FromBoolean(IMViaEmail)); map.Add("IsNewUser", OSD.FromBoolean(IsNewUser)); map.Add("MembershipGroup", OSD.FromString(MembershipGroup)); } map.Add("Notes", OSD.FromString(OSDParser.SerializeJsonString(Notes))); return(map); }
OSDMap ChangePassword(OSDMap map) { string Password = map ["Password"].AsString(); string newPassword = map ["NewPassword"].AsString(); UserAccount userAcct; OSDMap resp = new OSDMap(); ILoginService loginService = m_registry.RequestModuleInterface <ILoginService> (); IUserAccountService acctService = m_registry.RequestModuleInterface <IUserAccountService> (); UUID userID = map ["UUID"].AsUUID(); if (acctService != null) { userAcct = acctService.GetUserAccount(null, userID); bool cliVerified = loginService.VerifyClient(userAcct.PrincipalID, userAcct.Name, "UserAccount", Password); resp ["Verified"] = OSD.FromBoolean(cliVerified); if (cliVerified) { IAuthenticationService auths = m_registry.RequestModuleInterface <IAuthenticationService> (); if (auths != null) { if ((auths.Authenticate(userID, "UserAccount", Util.Md5Hash(Password), 100) != string.Empty) && (cliVerified)) { auths.SetPassword(userID, "UserAccount", newPassword); } } resp ["Verified"] = OSD.FromBoolean(false); } } return(resp); }
OSDMap Authenticated(OSDMap map) { IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService> (); UserAccount userAcct = accountService.GetUserAccount(null, map ["UUID"].AsUUID()); bool Verified = userAcct.Valid; OSDMap resp = new OSDMap(); resp ["Verified"] = OSD.FromBoolean(Verified); if (Verified) { userAcct.UserLevel = 0; accountService.StoreUserAccount(userAcct); IAgentConnector con = DataPlugins.RequestPlugin <IAgentConnector> (); IAgentInfo agent = con.GetAgent(userAcct.PrincipalID); if (agent != null && agent.OtherAgentInformation.ContainsKey("WebUIActivationToken")) { agent.OtherAgentInformation.Remove("WebUIActivationToken"); con.UpdateAgent(agent); } } return(resp); }