31 using System.Collections;
32 using System.Collections.Generic;
33 using System.Globalization;
35 using System.Net.Sockets;
36 using System.Reflection;
39 using OpenMetaverse.StructuredData;
43 using OpenSim.Framework;
44 using OpenSim.Region.Framework.Interfaces;
45 using OpenSim.Region.Framework.Scenes;
46 using OpenSim.Services.Interfaces;
48 using OpenSim.Services.Connectors.Hypergrid;
49 using OpenSim.Framework.Servers.HttpServer;
50 using OpenSim.Services.UserProfilesService;
52 using Microsoft.CSharp;
56 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"UserProfilesModule")]
62 static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
67 Dictionary<UUID, UUID> m_classifiedCache =
new Dictionary<UUID, UUID>();
68 Dictionary<UUID, int> m_classifiedInterest =
new Dictionary<UUID, int>();
83 public IConfigSource Config
95 public string ProfileServerUri
124 public string MyGatekeeper
130 #region IRegionModuleBase implementation
131 public void Initialise(IConfigSource source)
144 IConfig profileConfig = Config.Configs[
"UserProfiles"];
146 if (profileConfig == null)
148 m_log.Debug(
"[PROFILES]: UserProfiles disabled, no configuration");
155 ProfileServerUri = profileConfig.GetString(
"ProfileServiceURL",
"");
156 if (ProfileServerUri ==
"")
162 m_log.Debug(
"[PROFILES]: Full Profiles Enabled");
163 ReplaceableInterface = null;
166 MyGatekeeper = Util.GetConfigVarFromSections<
string>(source,
"GatekeeperURI",
167 new string[] {
"Startup",
"Hypergrid",
"UserProfiles" }, String.Empty);
183 Scene.EventManager.OnNewClient += OnNewClient;
184 Scene.EventManager.OnMakeRootAgent += HandleOnMakeRootAgent;
186 UserManagementModule = Scene.RequestModuleInterface<
IUserManagement>();
194 Util.FireAndForget(delegate
197 }, null,
"UserProfileModule.GetImageAssets");
238 public Type ReplaceableInterface
258 get {
return "UserProfileModule"; }
260 #endregion IRegionModuleBase implementation
262 #region Region Event Handlers
273 client.OnUpdateAvatarProperties += AvatarPropertiesUpdate;
274 client.OnAvatarInterestUpdate += AvatarInterestsUpdate;
277 client.AddGenericPacketHandler(
"avatarclassifiedsrequest", ClassifiedsRequest);
283 client.AddGenericPacketHandler(
"avatarpicksrequest", PicksRequest);
284 client.AddGenericPacketHandler(
"pickinforequest", PickInfoRequest);
289 client.AddGenericPacketHandler(
"avatarnotesrequest", NotesRequest);
290 client.OnAvatarNotesUpdate += NotesUpdate;
293 client.OnUserInfoRequest += UserPreferencesRequest;
294 client.OnUpdateUserInfo += UpdateUserPreferences;
296 #endregion Region Event Handlers
299 public void ClassifiedsRequest(Object sender,
string method, List<String> args)
317 IClientAPI remoteClient = (IClientAPI)sender;
320 UUID.TryParse(args[0], out targetID);
331 string serverURI = string.Empty;
332 GetUserProfileServerURI(targetID, out serverURI);
333 UUID creatorId = UUID.Zero;
334 Dictionary<UUID, string> classifieds =
new Dictionary<UUID, string>();
337 UUID.TryParse(args[0], out creatorId);
338 parameters.Add(
"creatorId", OSD.FromUUID(creatorId));
339 OSD Params = (
OSD)parameters;
340 if(!rpc.JsonRpcRequest(ref Params,
"avatarclassifiedsrequest", serverURI,
UUID.Random().ToString()))
342 remoteClient.SendAvatarClassifiedReply(
new UUID(args[0]), classifieds);
346 parameters = (
OSDMap)Params;
351 foreach(
OSD map
in list)
354 UUID cid = m[
"classifieduuid"].AsUUID();
355 string name = m[
"name"].AsString();
357 classifieds[cid] = name;
359 lock (m_classifiedCache)
361 if (!m_classifiedCache.ContainsKey(cid))
363 m_classifiedCache.Add(cid,creatorId);
364 m_classifiedInterest.Add(cid, 0);
367 m_classifiedInterest[cid]++;
371 remoteClient.SendAvatarClassifiedReply(
new UUID(args[0]), classifieds);
376 UUID target = remoteClient.AgentId;
378 ad.ClassifiedId = queryClassifiedID;
380 lock (m_classifiedCache)
382 if (m_classifiedCache.ContainsKey(queryClassifiedID))
384 target = m_classifiedCache[queryClassifiedID];
386 m_classifiedInterest[queryClassifiedID] --;
388 if (m_classifiedInterest[queryClassifiedID] == 0)
390 m_classifiedInterest.Remove(queryClassifiedID);
391 m_classifiedCache.Remove(queryClassifiedID);
396 string serverURI = string.Empty;
397 GetUserProfileServerURI(target, out serverURI);
399 object Ad = (object)ad;
400 if(!rpc.JsonRpcRequest(ref Ad,
"classifieds_info_query", serverURI,
UUID.Random().ToString()))
402 remoteClient.SendAgentAlertMessage(
403 "Error getting classified info",
false);
411 Vector3 globalPos =
new Vector3();
412 Vector3.TryParse(ad.GlobalPos, out globalPos);
414 remoteClient.SendClassifiedInfoReply(ad.ClassifiedId, ad.CreatorId, (uint)ad.
CreationDate, (uint)ad.ExpirationDate,
416 ad.SnapshotId, ad.SimName, globalPos, ad.ParcelName, ad.Flags, ad.Price);
456 public void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory,
string queryName,
string queryDescription, UUID queryParcelID,
457 uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags,
458 int queryclassifiedPrice, IClientAPI remoteClient)
465 if (!
money.AmountCovered(remoteClient.
AgentId, queryclassifiedPrice))
467 remoteClient.SendAgentAlertMessage(
"You do not have enough money to create requested classified.",
false);
470 money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
475 Vector3 pos = remoteClient.SceneAgent.AbsolutePosition;
476 ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);
479 string serverURI = string.Empty;
480 GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
484 ad.ParcelName = string.Empty;
488 ad.ParcelName = land.LandData.Name;
491 ad.CreatorId = remoteClient.AgentId;
492 ad.ClassifiedId = queryclassifiedID;
493 ad.Category = Convert.ToInt32(queryCategory);
495 ad.Description = queryDescription;
496 ad.ParentEstate = Convert.ToInt32(queryParentEstate);
497 ad.SnapshotId = querySnapshotID;
498 ad.SimName = remoteClient.Scene.RegionInfo.RegionName;
499 ad.GlobalPos = queryGlobalPos.ToString ();
500 ad.Flags = queryclassifiedFlags;
501 ad.Price = queryclassifiedPrice;
502 ad.ParcelId = p.currentParcelUUID;
506 OSD.SerializeMembers(Ad);
508 if(!rpc.JsonRpcRequest(ref Ad,
"classified_update", serverURI,
UUID.Random().ToString()))
510 remoteClient.SendAgentAlertMessage(
511 "Error updating classified",
false);
527 string serverURI = string.Empty;
528 GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
532 UUID.TryParse(queryClassifiedID.ToString(), out classifiedId);
533 parameters.Add(
"classifiedId", OSD.FromUUID(classifiedId));
534 OSD Params = (
OSD)parameters;
535 if(!rpc.JsonRpcRequest(ref Params,
"classified_delete", serverURI,
UUID.Random().ToString()))
537 remoteClient.SendAgentAlertMessage(
538 "Error classified delete",
false);
542 parameters = (
OSDMap)Params;
544 #endregion Classified
547 public void PicksRequest(Object sender,
string method, List<String> args)
561 if (!(sender is IClientAPI))
564 IClientAPI remoteClient = (IClientAPI)sender;
567 UUID.TryParse(args[0], out targetId);
578 string serverURI = string.Empty;
579 GetUserProfileServerURI(targetId, out serverURI);
581 Dictionary<UUID, string> picks =
new Dictionary<UUID, string>();
584 parameters.Add(
"creatorId", OSD.FromUUID(targetId));
585 OSD Params = (
OSD)parameters;
586 if(!rpc.JsonRpcRequest(ref Params,
"avatarpicksrequest", serverURI,
UUID.Random().ToString()))
588 remoteClient.SendAvatarPicksReply(
new UUID(args[0]), picks);
592 parameters = (
OSDMap)Params;
596 foreach(
OSD map
in list)
599 UUID cid = m[
"pickuuid"].AsUUID();
600 string name = m[
"name"].AsString();
602 m_log.DebugFormat(
"[PROFILES]: PicksRequest {0}", name);
606 remoteClient.SendAvatarPicksReply(
new UUID(args[0]), picks);
623 if (!(sender is IClientAPI))
627 UUID.TryParse (args [0], out targetID);
628 string serverURI = string.Empty;
629 GetUserProfileServerURI (targetID, out serverURI);
631 string theirGatekeeperURI;
632 GetUserGatekeeperURI (targetID, out theirGatekeeperURI);
634 IClientAPI remoteClient = (IClientAPI)sender;
637 UUID.TryParse (args [0], out pick.CreatorId);
638 UUID.TryParse (args [1], out pick.PickId);
641 object Pick = (object)pick;
642 if (!rpc.JsonRpcRequest (ref Pick,
"pickinforequest", serverURI,
UUID.Random ().ToString ())) {
643 remoteClient.SendAgentAlertMessage (
644 "Error selecting pick",
false);
649 Vector3 globalPos =
new Vector3(Vector3.Zero);
654 Vector3.TryParse(pick.GlobalPos,out globalPos);
659 string region = string.Format(
"{0} {1}",pick.Gatekeeper,pick.SimName);
660 GridRegion target = Scene.GridService.GetRegionByName(Scene.RegionInfo.ScopeID, region);
669 int x = target.RegionLocX;
670 int y = target.RegionLocY;
674 globalPos.X = synthX;
678 globalPos.Y = synthY;
682 m_log.DebugFormat(
"[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.
SnapshotId.ToString());
685 remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name,
686 pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName,
687 globalPos,pick.SortOrder,pick.Enabled);
720 public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID,
bool topPick,
string name,
string desc, UUID snapshotID,
int sortOrder,
bool enabled)
723 m_log.DebugFormat(
"[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString());
726 string serverURI = string.Empty;
727 GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
730 Vector3 avaPos = p.AbsolutePosition;
736 string landParcelName =
"My Parcel";
737 UUID landParcelID = p.currentParcelUUID;
739 ILandObject land = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y);
744 landParcelName = land.LandData.Name;
745 landParcelID = land.LandData.GlobalID;
750 "[PROFILES]: PickInfoUpdate found no parcel info at {0},{1} in {2}",
751 avaPos.X, avaPos.Y, p.Scene.Name);
755 pick.PickId = pickID;
756 pick.CreatorId = creatorID;
757 pick.TopPick = topPick;
760 pick.ParcelId = landParcelID;
761 pick.SnapshotId = snapshotID;
762 pick.ParcelName = landParcelName;
763 pick.SimName = remoteClient.Scene.RegionInfo.RegionName;
764 pick.Gatekeeper = MyGatekeeper;
765 pick.GlobalPos = posGlobal.ToString();
766 pick.SortOrder = sortOrder;
767 pick.Enabled = enabled;
769 object Pick = (object)pick;
770 if(!rpc.JsonRpcRequest(ref Pick,
"picks_update", serverURI,
UUID.Random().ToString()))
772 remoteClient.SendAgentAlertMessage(
773 "Error updating pick",
false);
777 m_log.DebugFormat(
"[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString());
789 public void PickDelete(IClientAPI remoteClient, UUID queryPickID)
791 string serverURI = string.Empty;
792 GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
795 parameters.Add(
"pickId", OSD.FromUUID(queryPickID));
796 OSD Params = (
OSD)parameters;
797 if(!rpc.JsonRpcRequest(ref Params,
"picks_delete", serverURI,
UUID.Random().ToString()))
799 remoteClient.SendAgentAlertMessage(
800 "Error picks delete",
false);
807 public void NotesRequest(Object sender,
string method, List<String> args)
823 if (!(sender is IClientAPI))
826 IClientAPI remoteClient = (IClientAPI)sender;
827 string serverURI = string.Empty;
828 GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
829 note.UserId = remoteClient.AgentId;
830 UUID.TryParse(args[0], out note.TargetId);
832 object Note = (object)note;
833 if(!rpc.JsonRpcRequest(ref Note,
"avatarnotesrequest", serverURI,
UUID.Random().ToString()))
835 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes);
840 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes);
855 public void NotesUpdate(IClientAPI remoteClient, UUID queryTargetID,
string queryNotes)
859 note.UserId = remoteClient.AgentId;
860 note.TargetId = queryTargetID;
861 note.Notes = queryNotes;
863 string serverURI = string.Empty;
864 GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
867 if(!rpc.JsonRpcRequest(ref Note,
"avatar_notes_update", serverURI,
UUID.Random().ToString()))
869 remoteClient.SendAgentAlertMessage(
870 "Error updating note",
false);
877 #region User Preferences
878 public void UpdateUserPreferences(
bool imViaEmail,
bool visible, IClientAPI remoteClient)
894 pref.UserId = remoteClient.AgentId;
895 pref.IMViaEmail = imViaEmail;
896 pref.Visible = visible;
898 string serverURI = string.Empty;
899 bool foreign = GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
902 if(!rpc.JsonRpcRequest(ref Pref,
"user_preferences_update", serverURI,
UUID.Random().ToString()))
904 m_log.InfoFormat(
"[PROFILES]: UserPreferences update error");
905 remoteClient.SendAgentAlertMessage(
"Error updating preferences",
false);
920 pref.UserId = remoteClient.AgentId;
922 string serverURI = string.Empty;
923 bool foreign = GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
926 object Pref = (object)pref;
927 if(!rpc.JsonRpcRequest(ref Pref,
"user_preferences_request", serverURI,
UUID.Random().ToString()))
935 remoteClient.SendUserInfoReply(pref.IMViaEmail, pref.Visible, pref.EMail);
938 #endregion User Preferences
940 #region Avatar Properties
941 public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask,
string wanttext, uint skillsmask,
string skillstext,
string languages)
966 prop.UserId = remoteClient.AgentId;
967 prop.WantToMask = (int)wantmask;
968 prop.WantToText = wanttext;
969 prop.SkillsMask = (int)skillsmask;
970 prop.SkillsText = skillstext;
971 prop.Language = languages;
973 string serverURI = string.Empty;
974 GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
977 if(!rpc.JsonRpcRequest(ref Param,
"avatar_interests_update", serverURI,
UUID.Random().ToString()))
979 remoteClient.SendAgentAlertMessage(
980 "Error updating interests",
false);
987 if (
String.IsNullOrEmpty(avatarID.ToString()) ||
String.IsNullOrEmpty(remoteClient.
AgentId.ToString()))
990 m_log.DebugFormat(
"[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID);
1003 string serverURI = string.Empty;
1004 bool foreign = GetUserProfileServerURI(avatarID, out serverURI);
1007 Dictionary<string,object> userInfo;
1011 account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, avatarID);
1015 userInfo =
new Dictionary<string, object>();
1018 Byte[] charterMember =
new Byte[1];
1019 string born = String.Empty;
1022 if (null != account)
1026 charterMember[0] = (Byte)((account.
UserFlags & 0xf00) >> 8);
1030 charterMember = Utils.StringToBytes(account.UserTitle);
1033 born = Util.ToDateTime(account.Created).ToString(
1034 "M/d/yyyy", CultureInfo.InvariantCulture);
1035 flags = (uint)(account.
UserFlags & 0xff);
1039 if (GetUserAccountData(avatarID, out userInfo) ==
true)
1041 if ((
string)userInfo[
"user_title"] ==
"")
1043 charterMember[0] = (Byte)(((Byte)userInfo[
"user_flags"] & 0xf00) >> 8);
1047 charterMember = Utils.StringToBytes((string)userInfo[
"user_title"]);
1050 int val_born = (int)userInfo[
"user_created"];
1051 born = Util.ToDateTime(val_born).ToString(
1052 "M/d/yyyy", CultureInfo.InvariantCulture);
1055 int val_flags = (int)userInfo[
"user_flags"];
1056 flags = (uint)(val_flags & 0xff);
1061 string result = string.Empty;
1063 props.UserId = avatarID;
1065 if (!GetProfileData(ref props, foreign, out result))
1071 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags,
1072 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId);
1075 remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, (uint)props.SkillsMask,
1076 props.SkillsText, props.Language);
1090 if (remoteClient.
AgentId == newProfile.
ID)
1094 prop.UserId = remoteClient.AgentId;
1095 prop.WebUrl = newProfile.ProfileUrl;
1096 prop.ImageId = newProfile.Image;
1097 prop.AboutText = newProfile.AboutText;
1098 prop.FirstLifeImageId = newProfile.FirstLifeImage;
1099 prop.FirstLifeText = newProfile.FirstLifeAboutText;
1101 string serverURI = string.Empty;
1102 GetUserProfileServerURI(remoteClient.
AgentId, out serverURI);
1106 if(!rpc.JsonRpcRequest(ref Prop,
"avatar_properties_update", serverURI,
UUID.Random().ToString()))
1108 remoteClient.SendAgentAlertMessage(
1109 "Error updating properties",
false);
1132 message =
"Id points to NPC";
1137 string serverURI = string.Empty;
1138 GetUserProfileServerURI(properties.UserId, out serverURI);
1142 if (
String.IsNullOrEmpty(serverURI))
1144 message =
"No Presence - foreign friend";
1148 object Prop = (object)properties;
1149 if (!rpc.JsonRpcRequest(ref Prop,
"avatar_properties_request", serverURI,
UUID.Random().ToString()))
1152 bool secondChanceSuccess =
false;
1159 secondChanceSuccess =
true;
1165 "[PROFILES]: Request using the OpenProfile API for user {0} to {1} failed",
1166 properties.UserId, serverURI),
1175 if (!secondChanceSuccess)
1177 message = string.Format(
"JsonRpcRequest for user {0} to {1} failed", properties.UserId, serverURI);
1178 m_log.DebugFormat(
"[PROFILES]: {0}", message);
1187 message =
"Success";
1190 #endregion Avatar Properties
1193 bool GetImageAssets(UUID avatarId)
1195 string profileServerURI = string.Empty;
1196 string assetServerURI = string.Empty;
1198 bool foreign = GetUserProfileServerURI(avatarId, out profileServerURI);
1203 assetServerURI = UserManagementModule.GetUserServerURL(avatarId,
"AssetServerURI");
1205 if(
string.IsNullOrEmpty(profileServerURI) || string.IsNullOrEmpty(assetServerURI))
1209 parameters.Add(
"avatarId", OSD.FromUUID(avatarId));
1210 OSD Params = (
OSD)parameters;
1211 if(!rpc.JsonRpcRequest(ref Params,
"image_assets_request", profileServerURI,
UUID.Random().ToString()))
1216 parameters = (
OSDMap)Params;
1218 if (parameters.ContainsKey(
"result"))
1222 foreach (
OSD asset
in list)
1224 OSDString assetId = (OSDString)asset;
1226 Scene.AssetService.Get(string.Format(
"{0}/{1}", assetServerURI, assetId.AsString()));
1232 m_log.ErrorFormat(
"[PROFILES]: Problematic response for image_assets_request from {0}", profileServerURI);
1249 bool GetUserAccountData(UUID userID, out Dictionary<string, object> userInfo)
1251 Dictionary<string,object> info =
new Dictionary<string, object>();
1253 if (UserManagementModule.IsLocalGridUser(userID))
1257 UserAccount account = uas.GetUserAccount(Scene.RegionInfo.ScopeID, userID);
1259 info[
"user_flags"] = account.UserFlags;
1260 info[
"user_created"] = account.Created;
1265 info[
"user_title"] =
"";
1274 string home_url = UserManagementModule.GetUserServerURL(userID,
"HomeURI");
1276 if (
String.IsNullOrEmpty(home_url))
1278 info[
"user_flags"] = 0;
1279 info[
"user_created"] = 0;
1280 info[
"user_title"] =
"Unavailable";
1288 Dictionary<string, object> account;
1291 account = uConn.GetUserInfo(userID);
1295 m_log.Debug(
"[PROFILES]: GetUserInfo call failed ", e);
1296 account =
new Dictionary<string, object>();
1299 if (account.Count > 0)
1301 if (account.ContainsKey(
"user_flags"))
1302 info[
"user_flags"] = account[
"user_flags"];
1304 info[
"user_flags"] =
"";
1306 if (account.ContainsKey(
"user_created"))
1307 info[
"user_created"] = account[
"user_created"];
1309 info[
"user_created"] =
"";
1311 info[
"user_title"] =
"HG Visitor";
1315 info[
"user_flags"] = 0;
1316 info[
"user_created"] = 0;
1317 info[
"user_title"] =
"HG Visitor";
1336 bool GetUserGatekeeperURI(UUID userID, out
string serverURI)
1339 local = UserManagementModule.IsLocalGridUser(userID);
1343 serverURI = UserManagementModule.GetUserServerURL(userID,
"GatekeeperURI");
1349 serverURI = MyGatekeeper;
1367 bool GetUserProfileServerURI(UUID userID, out
string serverURI)
1370 local = UserManagementModule.IsLocalGridUser(userID);
1374 serverURI = UserManagementModule.GetUserServerURL(userID,
"ProfileServerURI");
1380 serverURI = ProfileServerUri;
1399 p = Scene.GetScenePresence(clientID);
1408 bool JsonRpcRequest(ref
object parameters,
string method,
string uri,
string jsonId)
1429 throw new ArgumentNullException (
"jsonId");
1431 throw new ArgumentNullException (
"uri");
1433 throw new ArgumentNullException (
"method");
1434 if (parameters == null)
1435 throw new ArgumentNullException (
"parameters");
1440 json.Add(
"jsonrpc", OSD.FromString(
"2.0"));
1441 json.Add(
"id", OSD.FromString(jsonId));
1442 json.Add(
"method", OSD.FromString(method));
1444 json.Add(
"params", OSD.SerializeMembers(parameters));
1446 string jsonRequestData = OSDParser.SerializeJsonString(json);
1447 byte[] content = Encoding.UTF8.GetBytes(jsonRequestData);
1449 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);
1451 webRequest.ContentType =
"application/json-rpc";
1452 webRequest.Method =
"POST";
1454 Stream dataStream = webRequest.GetRequestStream();
1455 dataStream.Write(content, 0, content.Length);
1458 WebResponse webResponse = null;
1461 webResponse = webRequest.GetResponse();
1463 catch (WebException e)
1465 Console.WriteLine(
"Web Error" + e.Message);
1466 Console.WriteLine (
"Please check input");
1472 using (Stream rstream = webResponse.GetResponseStream())
1476 mret = (
OSDMap)OSDParser.DeserializeJson(rstream);
1480 m_log.DebugFormat(
"[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message);
1481 if (webResponse != null)
1482 webResponse.Close();
1487 if (webResponse != null)
1488 webResponse.Close();
1490 if (mret.ContainsKey(
"error"))
1494 OSD.DeserializeMembers(ref parameters, (
OSDMap) mret[
"result"]);
1516 bool JsonRpcRequest(ref
OSD data,
string method,
string uri,
string jsonId)
1520 map[
"jsonrpc"] =
"2.0";
1521 if(
string.IsNullOrEmpty(jsonId))
1522 map[
"id"] = UUID.Random().ToString();
1526 map[
"method"] = method;
1527 map[
"params"] = data;
1529 string jsonRequestData = OSDParser.SerializeJsonString(map);
1530 byte[] content = Encoding.UTF8.GetBytes(jsonRequestData);
1532 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);
1533 webRequest.ContentType =
"application/json-rpc";
1534 webRequest.Method =
"POST";
1536 Stream dataStream = webRequest.GetRequestStream();
1537 dataStream.Write(content, 0, content.Length);
1540 WebResponse webResponse = null;
1543 webResponse = webRequest.GetResponse();
1545 catch (WebException e)
1547 Console.WriteLine(
"Web Error" + e.Message);
1548 Console.WriteLine (
"Please check input");
1554 using (Stream rstream = webResponse.GetResponseStream())
1558 response = (
OSDMap)OSDParser.DeserializeJson(rstream);
1562 m_log.DebugFormat(
"[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message);
1563 if (webResponse != null)
1564 webResponse.Close();
1569 if (webResponse != null)
1570 webResponse.Close();
1572 if(response.ContainsKey(
"error"))
1574 data = response[
"error"];
void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient)
Classifieds delete.
delegate void PickInfoUpdate(IClientAPI client, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled)
OpenMetaverse.StructuredData.OSDArray OSDArray
void RemoveRegion(Scene scene)
Removes the region.
void PickDelete(IClientAPI remoteClient, UUID queryPickID)
Delete a Pick
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
OpenMetaverse.StructuredData.OSDMap OSDMap
delegate void ClassifiedInfoUpdate(UUID classifiedID, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, Vector3 globalPos, byte classifiedFlags, int price, IClientAPI client)
OpenSim.Services.Interfaces.GridRegion GridRegion
A client for accessing a profile server using the OpenProfile protocol.
PresenceType
Indicate the type of ScenePresence.
bool RequestAvatarPropertiesUsingOpenProfile(ref UserProfileProperties props)
Gets an avatar's profile using the OpenProfile protocol.
void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient)
void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
Json rpc request manager.
void Close()
Called as the instance is closed.
Information about a particular user known to the userserver
OpenMetaverse.StructuredData.OSD OSD
void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled)
Updates the userpicks
void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory, string queryName, string queryDescription, UUID queryParcelID, uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags, int queryclassifiedPrice, IClientAPI remoteClient)
Classifieds info update.
Interactive OpenSim region server
PresenceType PresenceType
void AddRegion(Scene scene)
Adds the region.
void PickInfoRequest(Object sender, string method, List< String > args)
Handles the pick info request.
delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client)
delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client)
delegate void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
delegate void PickDelete(IClientAPI client, UUID pickID)
void NotesUpdate(IClientAPI remoteClient, UUID queryTargetID, string queryNotes)
Avatars the notes update.
void UserPreferencesRequest(IClientAPI remoteClient)
Users the preferences request.
void AvatarPropertiesUpdate(IClientAPI remoteClient, UserProfileData newProfile)
Updates the avatar properties.
This maintains the relationship between a UUID and a user name.