aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authordahlia2013-12-06 15:58:51 -0800
committerdahlia2013-12-06 15:58:51 -0800
commitaba2a444538fc0ab5ae093004dc9994abab299e3 (patch)
tree21b1dc7790e08ba8de07c073dd7b6186ce10d938
parentuse System.IO.Compression.DeflateStream for mesh decompression in an attempt ... (diff)
parentAdd support for user preferences (im via email) (diff)
downloadopensim-SC_OLD-aba2a444538fc0ab5ae093004dc9994abab299e3.zip
opensim-SC_OLD-aba2a444538fc0ab5ae093004dc9994abab299e3.tar.gz
opensim-SC_OLD-aba2a444538fc0ab5ae093004dc9994abab299e3.tar.bz2
opensim-SC_OLD-aba2a444538fc0ab5ae093004dc9994abab299e3.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Data/IProfilesData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLUserProfilesData.cs41
-rw-r--r--OpenSim/Data/MySQL/Resources/UserProfiles.migrations10
-rw-r--r--OpenSim/Data/PGSQL/PGSQLRegionData.cs2
-rw-r--r--OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs31
-rw-r--r--OpenSim/Data/PGSQL/Resources/UserProfiles.migrations9
-rw-r--r--OpenSim/Data/SQLite/Resources/UserProfiles.migrations12
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserProfilesData.cs85
-rw-r--r--OpenSim/Framework/UserProfiles.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs18
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs67
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs7
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs53
-rw-r--r--OpenSim/Services/Interfaces/IUserProfilesService.cs5
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesService.cs12
18 files changed, 337 insertions, 54 deletions
diff --git a/OpenSim/Data/IProfilesData.cs b/OpenSim/Data/IProfilesData.cs
index 0de7f68..7fb075d 100644
--- a/OpenSim/Data/IProfilesData.cs
+++ b/OpenSim/Data/IProfilesData.cs
@@ -48,6 +48,8 @@ namespace OpenSim.Data
48 bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result); 48 bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result);
49 bool UpdateAvatarInterests(UserProfileProperties up, ref string result); 49 bool UpdateAvatarInterests(UserProfileProperties up, ref string result);
50 bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result); 50 bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result);
51 bool UpdateUserPreferences(ref UserPreferences pref, ref string result);
52 bool GetUserPreferences(ref UserPreferences pref, ref string result);
51 bool GetUserAppData(ref UserAppData props, ref string result); 53 bool GetUserAppData(ref UserAppData props, ref string result);
52 bool SetUserAppData(UserAppData props, ref string result); 54 bool SetUserAppData(UserAppData props, ref string result);
53 OSDArray GetUserImageAssets(UUID avatarId); 55 OSDArray GetUserImageAssets(UUID avatarId);
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index 4c6c8e3..63492c2 100644
--- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
@@ -736,7 +736,6 @@ namespace OpenSim.Data.MySQL
736 string query = string.Empty; 736 string query = string.Empty;
737 737
738 query += "UPDATE userprofile SET "; 738 query += "UPDATE userprofile SET ";
739 query += "profilePartner=?profilePartner, ";
740 query += "profileURL=?profileURL, "; 739 query += "profileURL=?profileURL, ";
741 query += "profileImage=?image, "; 740 query += "profileImage=?image, ";
742 query += "profileAboutText=?abouttext,"; 741 query += "profileAboutText=?abouttext,";
@@ -752,7 +751,6 @@ namespace OpenSim.Data.MySQL
752 using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) 751 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
753 { 752 {
754 cmd.Parameters.AddWithValue("?profileURL", props.WebUrl); 753 cmd.Parameters.AddWithValue("?profileURL", props.WebUrl);
755 cmd.Parameters.AddWithValue("?profilePartner", props.PartnerId.ToString());
756 cmd.Parameters.AddWithValue("?image", props.ImageId.ToString()); 754 cmd.Parameters.AddWithValue("?image", props.ImageId.ToString());
757 cmd.Parameters.AddWithValue("?abouttext", props.AboutText); 755 cmd.Parameters.AddWithValue("?abouttext", props.AboutText);
758 cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString()); 756 cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString());
@@ -897,7 +895,7 @@ namespace OpenSim.Data.MySQL
897 } 895 }
898 896
899 #region User Preferences 897 #region User Preferences
900 public OSDArray GetUserPreferences(UUID avatarId) 898 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
901 { 899 {
902 string query = string.Empty; 900 string query = string.Empty;
903 901
@@ -914,19 +912,16 @@ namespace OpenSim.Data.MySQL
914 dbcon.Open(); 912 dbcon.Open();
915 using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) 913 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
916 { 914 {
917 cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); 915 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
918 916
919 using (MySqlDataReader reader = cmd.ExecuteReader()) 917 using (MySqlDataReader reader = cmd.ExecuteReader())
920 { 918 {
921 if(reader.HasRows) 919 if(reader.HasRows)
922 { 920 {
923 reader.Read(); 921 reader.Read();
924 OSDMap record = new OSDMap(); 922 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
925 923 bool.TryParse((string)reader["visible"], out pref.Visible);
926 record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); 924 pref.EMail = (string)reader["email"];
927 record.Add("visible",OSD.FromString((string)reader["visible"]));
928 record.Add("email",OSD.FromString((string)reader["email"]));
929 data.Add(record);
930 } 925 }
931 else 926 else
932 { 927 {
@@ -949,17 +944,19 @@ namespace OpenSim.Data.MySQL
949 { 944 {
950 m_log.DebugFormat("[PROFILES_DATA]" + 945 m_log.DebugFormat("[PROFILES_DATA]" +
951 ": Get preferences exception {0}", e.Message); 946 ": Get preferences exception {0}", e.Message);
947 result = e.Message;
948 return false;
952 } 949 }
953 return data; 950 return true;
954 } 951 }
955 952
956 public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) 953 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
957 { 954 {
958 string query = string.Empty; 955 string query = string.Empty;
959 956
960 query += "UPDATE userpsettings SET "; 957 query += "UPDATE usersettings SET ";
961 query += "imviaemail=?ImViaEmail, "; 958 query += "imviaemail=?ImViaEmail, ";
962 query += "visible=?Visible,"; 959 query += "visible=?Visible ";
963 query += "WHERE useruuid=?uuid"; 960 query += "WHERE useruuid=?uuid";
964 961
965 try 962 try
@@ -969,14 +966,11 @@ namespace OpenSim.Data.MySQL
969 dbcon.Open(); 966 dbcon.Open();
970 using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) 967 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
971 { 968 {
972 cmd.Parameters.AddWithValue("?ImViaEmail", emailIm.ToString().ToLower ()); 969 cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail);
973 cmd.Parameters.AddWithValue("?WantText", visible.ToString().ToLower ()); 970 cmd.Parameters.AddWithValue("?Visible", pref.Visible);
974 cmd.Parameters.AddWithValue("?uuid", avatarId.ToString()); 971 cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
975 972
976 lock(Lock) 973 cmd.ExecuteNonQuery();
977 {
978 cmd.ExecuteNonQuery();
979 }
980 } 974 }
981 } 975 }
982 } 976 }
@@ -984,6 +978,7 @@ namespace OpenSim.Data.MySQL
984 { 978 {
985 m_log.DebugFormat("[PROFILES_DATA]" + 979 m_log.DebugFormat("[PROFILES_DATA]" +
986 ": AgentInterestsUpdate exception {0}", e.Message); 980 ": AgentInterestsUpdate exception {0}", e.Message);
981 result = e.Message;
987 return false; 982 return false;
988 } 983 }
989 return true; 984 return true;
diff --git a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
index c29f1ab..bd325da 100644
--- a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
@@ -81,3 +81,13 @@ CREATE TABLE IF NOT EXISTS `userdata` (
81 81
82commit; 82commit;
83 83
84:VERSION 3 # -------------------------------
85begin;
86CREATE TABLE IF NOT EXISTS `usersettings` (
87 `useruuid` varchar(36) NOT NULL,
88 `imviaemail` enum('true','false') NOT NULL,
89 `visible` enum('true','false') NOT NULL,
90 `email` varchar(254) NOT NULL,
91 PRIMARY KEY (`useruuid`)
92) ENGINE=MyISAM DEFAULT CHARSET=latin1;
93commit; \ No newline at end of file
diff --git a/OpenSim/Data/PGSQL/PGSQLRegionData.cs b/OpenSim/Data/PGSQL/PGSQLRegionData.cs
index f3e4064..b3076f0 100644
--- a/OpenSim/Data/PGSQL/PGSQLRegionData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLRegionData.cs
@@ -206,7 +206,7 @@ namespace OpenSim.Data.PGSQL
206 206
207 DataTable schemaTable = result.GetSchemaTable(); 207 DataTable schemaTable = result.GetSchemaTable();
208 foreach (DataRow row in schemaTable.Rows) 208 foreach (DataRow row in schemaTable.Rows)
209 m_ColumnNames.Add(row["column_name"].ToString()); 209 m_ColumnNames.Add(row["ColumnName"].ToString());
210 } 210 }
211 211
212 foreach (string s in m_ColumnNames) 212 foreach (string s in m_ColumnNames)
diff --git a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
index e3cbf7f..46f57d8 100644
--- a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
@@ -715,7 +715,6 @@ namespace OpenSim.Data.PGSQL
715 string query = string.Empty; 715 string query = string.Empty;
716 716
717 query += "UPDATE userprofile SET "; 717 query += "UPDATE userprofile SET ";
718 query += "profilePartner=:profilePartner, ";
719 query += "profileURL=:profileURL, "; 718 query += "profileURL=:profileURL, ";
720 query += "profileImage=:image, "; 719 query += "profileImage=:image, ";
721 query += "profileAboutText=:abouttext,"; 720 query += "profileAboutText=:abouttext,";
@@ -731,7 +730,6 @@ namespace OpenSim.Data.PGSQL
731 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 730 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
732 { 731 {
733 cmd.Parameters.AddWithValue("profileURL", props.WebUrl); 732 cmd.Parameters.AddWithValue("profileURL", props.WebUrl);
734 cmd.Parameters.AddWithValue("profilePartner", props.PartnerId.ToString());
735 cmd.Parameters.AddWithValue("image", props.ImageId.ToString()); 733 cmd.Parameters.AddWithValue("image", props.ImageId.ToString());
736 cmd.Parameters.AddWithValue("abouttext", props.AboutText); 734 cmd.Parameters.AddWithValue("abouttext", props.AboutText);
737 cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString()); 735 cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString());
@@ -876,7 +874,7 @@ namespace OpenSim.Data.PGSQL
876 } 874 }
877 875
878 #region User Preferences 876 #region User Preferences
879 public OSDArray GetUserPreferences(UUID avatarId) 877 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
880 { 878 {
881 string query = string.Empty; 879 string query = string.Empty;
882 880
@@ -893,19 +891,16 @@ namespace OpenSim.Data.PGSQL
893 dbcon.Open(); 891 dbcon.Open();
894 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 892 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
895 { 893 {
896 cmd.Parameters.AddWithValue("Id", avatarId.ToString()); 894 cmd.Parameters.AddWithValue("Id", pref.UserId.ToString());
897 895
898 using (NpgsqlDataReader reader = cmd.ExecuteReader()) 896 using (NpgsqlDataReader reader = cmd.ExecuteReader())
899 { 897 {
900 if(reader.HasRows) 898 if(reader.HasRows)
901 { 899 {
902 reader.Read(); 900 reader.Read();
903 OSDMap record = new OSDMap(); 901 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
904 902 bool.TryParse((string)reader["visible"], out pref.Visible);
905 record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); 903 pref.EMail = (string)reader["email"];
906 record.Add("visible",OSD.FromString((string)reader["visible"]));
907 record.Add("email",OSD.FromString((string)reader["email"]));
908 data.Add(record);
909 } 904 }
910 else 905 else
911 { 906 {
@@ -928,15 +923,16 @@ namespace OpenSim.Data.PGSQL
928 { 923 {
929 m_log.DebugFormat("[PROFILES_DATA]" + 924 m_log.DebugFormat("[PROFILES_DATA]" +
930 ": Get preferences exception {0}", e.Message); 925 ": Get preferences exception {0}", e.Message);
926 result = e.Message;
931 } 927 }
932 return data; 928 return true;
933 } 929 }
934 930
935 public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) 931 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
936 { 932 {
937 string query = string.Empty; 933 string query = string.Empty;
938 934
939 query += "UPDATE userpsettings SET "; 935 query += "UPDATE usersettings SET ";
940 query += "imviaemail=:ImViaEmail, "; 936 query += "imviaemail=:ImViaEmail, ";
941 query += "visible=:Visible,"; 937 query += "visible=:Visible,";
942 query += "WHERE useruuid=:uuid"; 938 query += "WHERE useruuid=:uuid";
@@ -948,9 +944,9 @@ namespace OpenSim.Data.PGSQL
948 dbcon.Open(); 944 dbcon.Open();
949 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 945 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
950 { 946 {
951 cmd.Parameters.AddWithValue("ImViaEmail", emailIm.ToString().ToLower ()); 947 cmd.Parameters.AddWithValue("ImViaEmail", pref.IMViaEmail.ToString().ToLower ());
952 cmd.Parameters.AddWithValue("WantText", visible.ToString().ToLower ()); 948 cmd.Parameters.AddWithValue("Visible", pref.Visible.ToString().ToLower ());
953 cmd.Parameters.AddWithValue("uuid", avatarId.ToString()); 949 cmd.Parameters.AddWithValue("uuid", pref.UserId.ToString());
954 950
955 lock(Lock) 951 lock(Lock)
956 { 952 {
@@ -963,6 +959,7 @@ namespace OpenSim.Data.PGSQL
963 { 959 {
964 m_log.DebugFormat("[PROFILES_DATA]" + 960 m_log.DebugFormat("[PROFILES_DATA]" +
965 ": AgentInterestsUpdate exception {0}", e.Message); 961 ": AgentInterestsUpdate exception {0}", e.Message);
962 result = e.Message;
966 return false; 963 return false;
967 } 964 }
968 return true; 965 return true;
diff --git a/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations b/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
index f23c870..4fcaa8e 100644
--- a/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
@@ -81,3 +81,12 @@ CREATE TABLE userdata (
81 81
82commit; 82commit;
83 83
84:VERSION 3 # -------------------------------
85begin;
86CREATE TABLE usersettings (
87 "useruuid" char(36) NOT NULL,
88 "imviaemail" bytea NOT NULL,
89 "visible" bytea NOT NULL,
90 PRIMARY KEY ("useruuid")
91);
92commit; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/Resources/UserProfiles.migrations b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations
index 16581f6..86434e8 100644
--- a/OpenSim/Data/SQLite/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations
@@ -88,3 +88,15 @@ CREATE TABLE IF NOT EXISTS userdata (
88 88
89commit; 89commit;
90 90
91
92:VERSION 3 # -------------------------------
93
94begin;
95CREATE TABLE IF NOT EXISTS usersettings (
96 useruuid char(36) NOT NULL,
97 imviaemail binary(1) NOT NULL,
98 visible binary(1) NOT NULL,
99 email varchar(254) NOT NULL,
100 PRIMARY KEY (useruuid)
101)
102commit; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
index cc1dac1..916a226 100644
--- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
@@ -679,7 +679,6 @@ namespace OpenSim.Data.SQLite
679 string query = string.Empty; 679 string query = string.Empty;
680 680
681 query += "UPDATE userprofile SET "; 681 query += "UPDATE userprofile SET ";
682 query += "profilePartner=:profilePartner, ";
683 query += "profileURL=:profileURL, "; 682 query += "profileURL=:profileURL, ";
684 query += "profileImage=:image, "; 683 query += "profileImage=:image, ";
685 query += "profileAboutText=:abouttext,"; 684 query += "profileAboutText=:abouttext,";
@@ -693,7 +692,6 @@ namespace OpenSim.Data.SQLite
693 { 692 {
694 cmd.CommandText = query; 693 cmd.CommandText = query;
695 cmd.Parameters.AddWithValue(":profileURL", props.WebUrl); 694 cmd.Parameters.AddWithValue(":profileURL", props.WebUrl);
696 cmd.Parameters.AddWithValue(":profilePartner", props.PartnerId.ToString());
697 cmd.Parameters.AddWithValue(":image", props.ImageId.ToString()); 695 cmd.Parameters.AddWithValue(":image", props.ImageId.ToString());
698 cmd.Parameters.AddWithValue(":abouttext", props.AboutText); 696 cmd.Parameters.AddWithValue(":abouttext", props.AboutText);
699 cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString()); 697 cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString());
@@ -749,6 +747,89 @@ namespace OpenSim.Data.SQLite
749 } 747 }
750 return true; 748 return true;
751 } 749 }
750
751 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
752 {
753 string query = string.Empty;
754
755 query += "UPDATE usersettings SET ";
756 query += "imviaemail=:ImViaEmail, ";
757 query += "visible=:Visible ";
758 query += "WHERE useruuid=:uuid";
759
760 try
761 {
762 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
763 {
764 cmd.CommandText = query;
765 cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail);
766 cmd.Parameters.AddWithValue(":Visible", pref.Visible);
767 cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString());
768
769 cmd.ExecuteNonQuery();
770 }
771 }
772 catch (Exception e)
773 {
774 m_log.DebugFormat("[PROFILES_DATA]" +
775 ": AgentInterestsUpdate exception {0}", e.Message);
776 result = e.Message;
777 return false;
778 }
779 return true;
780 }
781
782 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
783 {
784 IDataReader reader = null;
785 string query = string.Empty;
786
787 query += "SELECT imviaemail,visible,email FROM ";
788 query += "usersettings WHERE ";
789 query += "useruuid = :Id";
790
791 OSDArray data = new OSDArray();
792
793 try
794 {
795 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
796 {
797 cmd.CommandText = query;
798 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
799
800 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
801 {
802 if(reader.Read())
803 {
804 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
805 bool.TryParse((string)reader["visible"], out pref.Visible);
806 pref.EMail = (string)reader["email"];
807 }
808 else
809 {
810 query = "INSERT INTO usersettings VALUES ";
811 query += "(:Id,'false','false', '')";
812
813 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
814 {
815 put.Parameters.AddWithValue(":Id", pref.UserId.ToString());
816 put.ExecuteNonQuery();
817
818 }
819 }
820 }
821 }
822 }
823 catch (Exception e)
824 {
825 m_log.DebugFormat("[PROFILES_DATA]" +
826 ": Get preferences exception {0}", e.Message);
827 result = e.Message;
828 return false;
829 }
830 return true;
831 }
832
752 public bool GetUserAppData(ref UserAppData props, ref string result) 833 public bool GetUserAppData(ref UserAppData props, ref string result)
753 { 834 {
754 IDataReader reader = null; 835 IDataReader reader = null;
diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs
index 6133591..492f6b9 100644
--- a/OpenSim/Framework/UserProfiles.cs
+++ b/OpenSim/Framework/UserProfiles.cs
@@ -90,6 +90,14 @@ namespace OpenSim.Framework
90 public UUID TargetId; 90 public UUID TargetId;
91 public string Notes; 91 public string Notes;
92 } 92 }
93
94 public class UserPreferences
95 {
96 public UUID UserId;
97 public bool IMViaEmail = false;
98 public bool Visible = false;
99 public string EMail = string.Empty;
100 }
93 101
94 public class UserAccountProperties 102 public class UserAccountProperties
95 { 103 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 1d4c7f0..a4fe81c 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -498,24 +498,28 @@ namespace OpenSim.Region.ClientStack.Linden
498 498
499 if (inventoryType == "sound") 499 if (inventoryType == "sound")
500 { 500 {
501 inType = 1; 501 inType = (sbyte)InventoryType.Sound;
502 assType = 1; 502 assType = (sbyte)AssetType.Sound;
503 }
504 else if (inventoryType == "snapshot")
505 {
506 inType = (sbyte)InventoryType.Snapshot;
503 } 507 }
504 else if (inventoryType == "animation") 508 else if (inventoryType == "animation")
505 { 509 {
506 inType = 19; 510 inType = (sbyte)InventoryType.Animation;
507 assType = 20; 511 assType = (sbyte)AssetType.Animation;
508 } 512 }
509 else if (inventoryType == "wearable") 513 else if (inventoryType == "wearable")
510 { 514 {
511 inType = 18; 515 inType = (sbyte)InventoryType.Wearable;
512 switch (assetType) 516 switch (assetType)
513 { 517 {
514 case "bodypart": 518 case "bodypart":
515 assType = 13; 519 assType = (sbyte)AssetType.Bodypart;
516 break; 520 break;
517 case "clothing": 521 case "clothing":
518 assType = 5; 522 assType = (sbyte)AssetType.Clothing;
519 break; 523 break;
520 } 524 }
521 } 525 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index c1aae3f..a04ded5 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5091,7 +5091,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5091// acceleration = new Vector3(1, 0, 0); 5091// acceleration = new Vector3(1, 0, 0);
5092 5092
5093 angularVelocity = presence.AngularVelocity; 5093 angularVelocity = presence.AngularVelocity;
5094
5095 // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis
5096 // it rotates around.
5097 // In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted
5098 // excessive up and down movements of the camera when looking up and down.
5099 // See http://opensimulator.org/mantis/view.php?id=3274
5100 // This does not affect head movement, since this is controlled entirely by camera movement rather than
5101 // body rotation. It does not affect sitting avatar since it's the sitting part rotation that takes
5102 // effect, not the avatar rotation.
5094 rotation = presence.Rotation; 5103 rotation = presence.Rotation;
5104 rotation.X = 0;
5105 rotation.Y = 0;
5095 5106
5096 if (sendTexture) 5107 if (sendTexture)
5097 textureEntry = presence.Appearance.Texture.GetBytes(); 5108 textureEntry = presence.Appearance.Texture.GetBytes();
@@ -5207,7 +5218,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5207 data.OffsetPosition.ToBytes(objectData, 16); 5218 data.OffsetPosition.ToBytes(objectData, 16);
5208// data.Velocity.ToBytes(objectData, 28); 5219// data.Velocity.ToBytes(objectData, 28);
5209// data.Acceleration.ToBytes(objectData, 40); 5220// data.Acceleration.ToBytes(objectData, 40);
5210 data.Rotation.ToBytes(objectData, 52); 5221
5222 // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis
5223 // it rotates around.
5224 // In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted
5225 // excessive up and down movements of the camera when looking up and down.
5226 // See http://opensimulator.org/mantis/view.php?id=3274
5227 // This does not affect head movement, since this is controlled entirely by camera movement rather than
5228 // body rotation. It does not affect sitting avatar since it's the sitting part rotation that takes
5229 // effect, not the avatar rotation.
5230 Quaternion rot = data.Rotation;
5231 rot.X = 0;
5232 rot.Y = 0;
5233 rot.ToBytes(objectData, 52);
5211 //data.AngularVelocity.ToBytes(objectData, 64); 5234 //data.AngularVelocity.ToBytes(objectData, 64);
5212 5235
5213 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 5236 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 56ff2bd..b21082f 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -270,6 +270,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
270 // Notes 270 // Notes
271 client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest); 271 client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest);
272 client.OnAvatarNotesUpdate += NotesUpdate; 272 client.OnAvatarNotesUpdate += NotesUpdate;
273
274 // Preferences
275 client.OnUserInfoRequest += UserPreferencesRequest;
276 client.OnUpdateUserInfo += UpdateUserPreferences;
273 } 277 }
274 #endregion Region Event Handlers 278 #endregion Region Event Handlers
275 279
@@ -799,6 +803,69 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
799 } 803 }
800 #endregion Notes 804 #endregion Notes
801 805
806 #region User Preferences
807 /// <summary>
808 /// Updates the user preferences.
809 /// </summary>
810 /// <param name='imViaEmail'>
811 /// Im via email.
812 /// </param>
813 /// <param name='visible'>
814 /// Visible.
815 /// </param>
816 /// <param name='remoteClient'>
817 /// Remote client.
818 /// </param>
819 public void UpdateUserPreferences(bool imViaEmail, bool visible, IClientAPI remoteClient)
820 {
821 UserPreferences pref = new UserPreferences();
822
823 pref.UserId = remoteClient.AgentId;
824 pref.IMViaEmail = imViaEmail;
825 pref.Visible = visible;
826
827 string serverURI = string.Empty;
828 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
829
830 object Pref = pref;
831 if(!JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString()))
832 {
833 m_log.InfoFormat("[PROFILES]: UserPreferences update error");
834 remoteClient.SendAgentAlertMessage("Error updating preferences", false);
835 return;
836 }
837 }
838
839 /// <summary>
840 /// Users the preferences request.
841 /// </summary>
842 /// <param name='remoteClient'>
843 /// Remote client.
844 /// </param>
845 public void UserPreferencesRequest(IClientAPI remoteClient)
846 {
847 UserPreferences pref = new UserPreferences();
848
849 pref.UserId = remoteClient.AgentId;
850
851 string serverURI = string.Empty;
852 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
853
854
855 object Pref = (object)pref;
856 if(!JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString()))
857 {
858 m_log.InfoFormat("[PROFILES]: UserPreferences request error");
859 remoteClient.SendAgentAlertMessage("Error requesting preferences", false);
860 return;
861 }
862 pref = (UserPreferences) Pref;
863
864 remoteClient.SendUserInfoReply(pref.IMViaEmail, pref.Visible, pref.EMail);
865
866 }
867 #endregion User Preferences
868
802 #region Avatar Properties 869 #region Avatar Properties
803 /// <summary> 870 /// <summary>
804 /// Update the avatars interests . 871 /// Update the avatars interests .
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs
index 323535a..4701ee6 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs
@@ -153,6 +153,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
153 Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); 153 Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
154 Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); 154 Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
155 Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); 155 Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate);
156 Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate);
157 Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest);
156 Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); 158 Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest);
157 Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); 159 Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
158 Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); 160 Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1dc7e20..7ed3a4b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1648,12 +1648,13 @@ namespace OpenSim.Region.Framework.Scenes
1648 1648
1649 if (AllowMovement && !SitGround) 1649 if (AllowMovement && !SitGround)
1650 { 1650 {
1651 Quaternion bodyRotation = agentData.BodyRotation; 1651// m_log.DebugFormat("[SCENE PRESENCE]: Initial body rotation {0} for {1}", agentData.BodyRotation, Name);
1652
1652 bool update_rotation = false; 1653 bool update_rotation = false;
1653 1654
1654 if (bodyRotation != Rotation) 1655 if (agentData.BodyRotation != Rotation)
1655 { 1656 {
1656 Rotation = bodyRotation; 1657 Rotation = agentData.BodyRotation;
1657 update_rotation = true; 1658 update_rotation = true;
1658 } 1659 }
1659 1660
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
index 28dbbc2..6403882 100644
--- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
@@ -104,6 +104,8 @@ namespace OpenSim.Server.Handlers.Profiles
104 Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); 104 Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
105 Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); 105 Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
106 Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); 106 Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate);
107 Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate);
108 Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest);
107 Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); 109 Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest);
108 Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); 110 Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
109 Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); 111 Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
index f5f0794..d30cc22 100644
--- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
@@ -381,6 +381,59 @@ namespace OpenSim.Server.Handlers
381 } 381 }
382 #endregion Interests 382 #endregion Interests
383 383
384 #region User Preferences
385 public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response)
386 {
387 if(!json.ContainsKey("params"))
388 {
389 response.Error.Code = ErrorCode.ParseError;
390 m_log.DebugFormat ("User Preferences Request");
391 return false;
392 }
393
394 string result = string.Empty;
395 UserPreferences prefs = new UserPreferences();
396 object Prefs = (object)prefs;
397 OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]);
398 if(Service.UserPreferencesRequest(ref prefs, ref result))
399 {
400 response.Result = OSD.SerializeMembers(prefs);
401 return true;
402 }
403
404 response.Error.Code = ErrorCode.InternalError;
405 response.Error.Message = string.Format("{0}", result);
406 m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message);
407 return false;
408 }
409
410 public bool UserPreferenecesUpdate(OSDMap json, ref JsonRpcResponse response)
411 {
412 if(!json.ContainsKey("params"))
413 {
414 response.Error.Code = ErrorCode.ParseError;
415 response.Error.Message = "no parameters supplied";
416 m_log.DebugFormat ("User Preferences Update Request");
417 return false;
418 }
419
420 string result = string.Empty;
421 UserPreferences prefs = new UserPreferences();
422 object Prefs = (object)prefs;
423 OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]);
424 if(Service.UserPreferencesUpdate(ref prefs, ref result))
425 {
426 response.Result = OSD.SerializeMembers(prefs);
427 return true;
428 }
429
430 response.Error.Code = ErrorCode.InternalError;
431 response.Error.Message = string.Format("{0}", result);
432 m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message);
433 return false;
434 }
435 #endregion User Preferences
436
384 #region Utility 437 #region Utility
385 public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) 438 public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response)
386 { 439 {
diff --git a/OpenSim/Services/Interfaces/IUserProfilesService.cs b/OpenSim/Services/Interfaces/IUserProfilesService.cs
index 319d307..121baa8 100644
--- a/OpenSim/Services/Interfaces/IUserProfilesService.cs
+++ b/OpenSim/Services/Interfaces/IUserProfilesService.cs
@@ -57,6 +57,11 @@ namespace OpenSim.Services.Interfaces
57 bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); 57 bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result);
58 bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); 58 bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result);
59 #endregion Profile Properties 59 #endregion Profile Properties
60
61 #region User Preferences
62 bool UserPreferencesRequest(ref UserPreferences pref, ref string result);
63 bool UserPreferencesUpdate(ref UserPreferences pref, ref string result);
64 #endregion User Preferences
60 65
61 #region Interests 66 #region Interests
62 bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); 67 bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result);
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
index d00f34d..69c7b91 100644
--- a/OpenSim/Services/UserProfilesService/UserProfilesService.cs
+++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
@@ -163,6 +163,18 @@ namespace OpenSim.Services.ProfilesService
163 } 163 }
164 #endregion Interests 164 #endregion Interests
165 165
166 #region User Preferences
167 public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result)
168 {
169 return ProfilesData.UpdateUserPreferences(ref pref, ref result);
170 }
171
172 public bool UserPreferencesRequest(ref UserPreferences pref, ref string result)
173 {
174 return ProfilesData.GetUserPreferences(ref pref, ref result);
175 }
176 #endregion User Preferences
177
166 #region Utility 178 #region Utility
167 public OSD AvatarImageAssetsRequest(UUID avatarId) 179 public OSD AvatarImageAssetsRequest(UUID avatarId)
168 { 180 {