diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/CommunicationsManager.cs | 43 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 7 | ||||
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | 44 | ||||
-rw-r--r-- | OpenSim/Framework/GridInstantMessage.cs | 64 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 13 | ||||
-rw-r--r-- | OpenSim/Framework/IUserService.cs | 30 | ||||
-rw-r--r-- | OpenSim/Framework/sLLVector3.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 37 | ||||
-rw-r--r-- | OpenSim/Region/Communications/Local/LocalLoginService.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Environment/InstantMessageReceiver.cs | 28 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/FriendsModule.cs | 175 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/InstantMessageModule.cs | 45 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 41 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneEvents.cs | 36 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 3 | ||||
-rw-r--r-- | bin/inventory/Libraries.xml | 2 |
17 files changed, 587 insertions, 48 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 02c54e1..0c6d53f 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -152,6 +152,49 @@ namespace OpenSim.Framework.Communications | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | #region Friend Methods | ||
156 | /// <summary> | ||
157 | /// Adds a new friend to the database for XUser | ||
158 | /// </summary> | ||
159 | /// <param name="friendlistowner">The agent that who's friends list is being added to</param> | ||
160 | /// <param name="friend">The agent that being added to the friends list of the friends list owner</param> | ||
161 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
162 | public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) | ||
163 | { | ||
164 | m_userService.AddNewUserFriend(friendlistowner, friend, perms); | ||
165 | } | ||
166 | |||
167 | /// <summary> | ||
168 | /// Delete friend on friendlistowner's friendlist. | ||
169 | /// </summary> | ||
170 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
171 | /// <param name="friend">The Ex-friend agent</param> | ||
172 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) | ||
173 | { | ||
174 | m_userService.RemoveUserFriend(friendlistowner, friend); | ||
175 | } | ||
176 | |||
177 | /// <summary> | ||
178 | /// Update permissions for friend on friendlistowner's friendlist. | ||
179 | /// </summary> | ||
180 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
181 | /// <param name="friend">The agent that is getting or loosing permissions</param> | ||
182 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
183 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) | ||
184 | { | ||
185 | m_userService.UpdateUserFriendPerms(friendlistowner, friend, perms); | ||
186 | } | ||
187 | /// <summary> | ||
188 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner | ||
189 | /// </summary> | ||
190 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> | ||
191 | public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) | ||
192 | { | ||
193 | return m_userService.GetUserFriendList(friendlistowner); | ||
194 | } | ||
195 | |||
196 | #endregion | ||
197 | |||
155 | #region Packet Handlers | 198 | #region Packet Handlers |
156 | 199 | ||
157 | public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client) | 200 | public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client) |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index 779d050..a5e6da4 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs | |||
@@ -226,6 +226,13 @@ namespace OpenSim.Framework.Data.MySQL | |||
226 | param); | 226 | param); |
227 | updater.ExecuteNonQuery(); | 227 | updater.ExecuteNonQuery(); |
228 | 228 | ||
229 | updater = | ||
230 | database.Query( | ||
231 | "delete from userfriends " + | ||
232 | "where ownerID = ?friendID and friendID = ?ownerID", | ||
233 | param); | ||
234 | updater.ExecuteNonQuery(); | ||
235 | |||
229 | } | 236 | } |
230 | } | 237 | } |
231 | catch (Exception e) | 238 | catch (Exception e) |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index c97dc52..e9a8eca 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | |||
@@ -47,16 +47,20 @@ namespace OpenSim.Framework.Data.SQLite | |||
47 | /// </summary> | 47 | /// </summary> |
48 | private const string userSelect = "select * from users"; | 48 | private const string userSelect = "select * from users"; |
49 | private const string userFriendsSelect = "select a.ownerID as ownerID,a.friendID as friendID,a.friendPerms as friendPerms,b.friendPerms as ownerperms, b.ownerID as fownerID, b.friendID as ffriendID from userfriends as a, userfriends as b"; | 49 | private const string userFriendsSelect = "select a.ownerID as ownerID,a.friendID as friendID,a.friendPerms as friendPerms,b.friendPerms as ownerperms, b.ownerID as fownerID, b.friendID as ffriendID from userfriends as a, userfriends as b"; |
50 | 50 | ||
51 | private DataSet ds; | 51 | private DataSet ds; |
52 | private SqliteDataAdapter da; | 52 | private SqliteDataAdapter da; |
53 | private SqliteDataAdapter daf; | 53 | private SqliteDataAdapter daf; |
54 | SqliteConnection g_conn; | ||
54 | 55 | ||
55 | public void Initialise() | 56 | public void Initialise() |
56 | { | 57 | { |
57 | SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3"); | 58 | SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3"); |
58 | TestTables(conn); | 59 | TestTables(conn); |
59 | 60 | ||
61 | // This sucks, but It doesn't seem to work with the dataset Syncing :P | ||
62 | g_conn = conn; | ||
63 | |||
60 | ds = new DataSet(); | 64 | ds = new DataSet(); |
61 | da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); | 65 | da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); |
62 | daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn)); | 66 | daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn)); |
@@ -147,11 +151,11 @@ namespace OpenSim.Framework.Data.SQLite | |||
147 | 151 | ||
148 | 152 | ||
149 | DataRow row = friends.NewRow(); | 153 | DataRow row = friends.NewRow(); |
150 | fillFriendRow(row, friendlistowner,friend,perms); | 154 | fillFriendRow(row, friendlistowner.UUID.ToString(),friend.UUID.ToString(),perms); |
151 | friends.Rows.Add(row); | 155 | friends.Rows.Add(row); |
152 | 156 | ||
153 | row = friends.NewRow(); | 157 | row = friends.NewRow(); |
154 | fillFriendRow(row, friend, friendlistowner, perms); | 158 | fillFriendRow(row, friend.UUID.ToString(), friendlistowner.UUID.ToString(), perms); |
155 | friends.Rows.Add(row); | 159 | friends.Rows.Add(row); |
156 | 160 | ||
157 | MainLog.Instance.Verbose("SQLITE", | 161 | MainLog.Instance.Verbose("SQLITE", |
@@ -164,7 +168,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
164 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) | 168 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) |
165 | { | 169 | { |
166 | DataTable ua = ds.Tables["userfriends"]; | 170 | DataTable ua = ds.Tables["userfriends"]; |
167 | string select = "a.ownernID '" + friendlistowner.UUID.ToString() + "' and b.friendID ='" + friend.UUID.ToString() + "';"; | 171 | string select = "`ownerID` ='" + friendlistowner.UUID.ToString() + "' and `friendID` ='" + friend.UUID.ToString() + "'"; |
168 | lock (ds) | 172 | lock (ds) |
169 | { | 173 | { |
170 | DataRow[] rows = ds.Tables["userfriends"].Select(select); | 174 | DataRow[] rows = ds.Tables["userfriends"].Select(select); |
@@ -175,20 +179,44 @@ namespace OpenSim.Framework.Data.SQLite | |||
175 | { | 179 | { |
176 | for (int i = 0; i < rows.Length; i++) | 180 | for (int i = 0; i < rows.Length; i++) |
177 | { | 181 | { |
178 | FriendListItem user = new FriendListItem(); | ||
179 | DataRow row = rows[i]; | 182 | DataRow row = rows[i]; |
180 | row.Delete(); | 183 | row.Delete(); |
181 | } | 184 | } |
182 | daf.Update(ds, "userfriends"); | 185 | |
186 | } | ||
187 | } | ||
188 | } | ||
189 | select = "`ownerID` ='" + friend.UUID.ToString() + "' and `friendID` ='" + friendlistowner.UUID.ToString() + "'"; | ||
190 | lock (ds) | ||
191 | { | ||
192 | DataRow[] rows = ds.Tables["userfriends"].Select(select); | ||
193 | |||
194 | if (rows != null) | ||
195 | { | ||
196 | if (rows.Length > 0) | ||
197 | { | ||
198 | for (int i = 0; i < rows.Length; i++) | ||
199 | { | ||
200 | DataRow row = rows[i]; | ||
201 | row.Delete(); | ||
202 | } | ||
203 | |||
183 | } | 204 | } |
184 | } | 205 | } |
185 | } | 206 | } |
207 | SqliteCommand deletecommand = new SqliteCommand("delete from userfriends where `ownerID`='" + friendlistowner.UUID.ToString() + "' and `friendID` ='" + friend.UUID.ToString() + "'", g_conn); | ||
208 | g_conn.Open(); | ||
209 | deletecommand.ExecuteNonQuery(); | ||
210 | deletecommand = new SqliteCommand("delete from userfriends where `ownerID`='" + friend.UUID.ToString() + "' and `friendID` ='" + friendlistowner.UUID.ToString() + "'", g_conn); | ||
211 | deletecommand.ExecuteNonQuery(); | ||
212 | g_conn.Close(); | ||
213 | |||
186 | MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called"); | 214 | MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called"); |
187 | } | 215 | } |
188 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) | 216 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) |
189 | { | 217 | { |
190 | DataTable ua = ds.Tables["userfriends"]; | 218 | DataTable ua = ds.Tables["userfriends"]; |
191 | string select = "a.ownernID '" + friendlistowner.UUID.ToString() + "' and b.friendID ='" + friend.UUID.ToString() + "';"; | 219 | string select = "a.ownerID ='" + friendlistowner.UUID.ToString() + "' and b.friendID ='" + friend.UUID.ToString() + "'"; |
192 | lock (ds) | 220 | lock (ds) |
193 | { | 221 | { |
194 | DataRow[] rows = ds.Tables["userfriends"].Select(select); | 222 | DataRow[] rows = ds.Tables["userfriends"].Select(select); |
@@ -737,7 +765,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
737 | daf.UpdateCommand = createUpdateCommand("userfriends", "ownerID=:ownerID and friendID=:friendID", ds.Tables["userfriends"]); | 765 | daf.UpdateCommand = createUpdateCommand("userfriends", "ownerID=:ownerID and friendID=:friendID", ds.Tables["userfriends"]); |
738 | daf.UpdateCommand.Connection = conn; | 766 | daf.UpdateCommand.Connection = conn; |
739 | 767 | ||
740 | SqliteCommand delete = new SqliteCommand("delete from users where ownerID=:ownerID and friendID=:friendID"); | 768 | SqliteCommand delete = new SqliteCommand("delete from userfriends where ownerID=:ownerID and friendID=:friendID"); |
741 | delete.Parameters.Add(createSqliteParameter("ownerID", typeof(String))); | 769 | delete.Parameters.Add(createSqliteParameter("ownerID", typeof(String))); |
742 | delete.Parameters.Add(createSqliteParameter("friendID", typeof(String))); | 770 | delete.Parameters.Add(createSqliteParameter("friendID", typeof(String))); |
743 | delete.Connection = conn; | 771 | delete.Connection = conn; |
diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs new file mode 100644 index 0000000..6ae3424 --- /dev/null +++ b/OpenSim/Framework/GridInstantMessage.cs | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using OpenSim.Framework; | ||
31 | |||
32 | |||
33 | namespace OpenSim.Framework | ||
34 | { | ||
35 | |||
36 | [Serializable] | ||
37 | public class GridInstantMessage | ||
38 | { | ||
39 | public Guid fromAgentID; | ||
40 | public Guid fromAgentSession; | ||
41 | public Guid toAgentID; | ||
42 | public Guid imSessionID; | ||
43 | public uint timestamp; | ||
44 | public string fromAgentName; | ||
45 | |||
46 | public string message; | ||
47 | public byte dialog; | ||
48 | public bool fromGroup; | ||
49 | public byte offline; | ||
50 | |||
51 | public uint ParentEstateID; | ||
52 | |||
53 | public sLLVector3 Position; | ||
54 | |||
55 | public Guid RegionID; | ||
56 | |||
57 | public byte[] binaryBucket; | ||
58 | |||
59 | public GridInstantMessage() | ||
60 | { | ||
61 | |||
62 | } | ||
63 | } | ||
64 | } | ||
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 61a713a..c5e4809 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -395,6 +395,14 @@ namespace OpenSim.Framework | |||
395 | 395 | ||
396 | public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); | 396 | public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); |
397 | 397 | ||
398 | public delegate void FriendActionDelegate(IClientAPI remoteClient,LLUUID agentID,LLUUID transactionID,List<LLUUID> callingCardFolders); | ||
399 | |||
400 | public delegate void FriendshipTermination(IClientAPI remoteClient,LLUUID agentID, LLUUID ExID); | ||
401 | |||
402 | |||
403 | |||
404 | |||
405 | |||
398 | public delegate void ObjectPermissions( | 406 | public delegate void ObjectPermissions( |
399 | IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID, | 407 | IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID, |
400 | List<ObjectPermissionsPacket.ObjectDataBlock> permChanges); | 408 | List<ObjectPermissionsPacket.ObjectDataBlock> permChanges); |
@@ -490,6 +498,11 @@ namespace OpenSim.Framework | |||
490 | event RegionInfoRequest OnRegionInfoRequest; | 498 | event RegionInfoRequest OnRegionInfoRequest; |
491 | event EstateCovenantRequest OnEstateCovenantRequest; | 499 | event EstateCovenantRequest OnEstateCovenantRequest; |
492 | 500 | ||
501 | event FriendActionDelegate OnApproveFriendRequest; | ||
502 | event FriendActionDelegate OnDenyFriendRequest; | ||
503 | event FriendshipTermination OnTerminateFriendship; | ||
504 | |||
505 | |||
493 | LLVector3 StartPos { get; set; } | 506 | LLVector3 StartPos { get; set; } |
494 | 507 | ||
495 | LLUUID AgentId { get; } | 508 | LLUUID AgentId { get; } |
diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs index 2b08582..2b59c25 100644 --- a/OpenSim/Framework/IUserService.cs +++ b/OpenSim/Framework/IUserService.cs | |||
@@ -47,5 +47,35 @@ namespace OpenSim.Framework | |||
47 | /// </summary> | 47 | /// </summary> |
48 | /// <param name="user"></param> | 48 | /// <param name="user"></param> |
49 | LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); | 49 | LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); |
50 | |||
51 | |||
52 | /// <summary> | ||
53 | /// Adds a new friend to the database for XUser | ||
54 | /// </summary> | ||
55 | /// <param name="friendlistowner">The agent that who's friends list is being added to</param> | ||
56 | /// <param name="friend">The agent that being added to the friends list of the friends list owner</param> | ||
57 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
58 | void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Delete friend on friendlistowner's friendlist. | ||
62 | /// </summary> | ||
63 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
64 | /// <param name="friend">The Ex-friend agent</param> | ||
65 | void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend); | ||
66 | |||
67 | /// <summary> | ||
68 | /// Update permissions for friend on friendlistowner's friendlist. | ||
69 | /// </summary> | ||
70 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
71 | /// <param name="friend">The agent that is getting or loosing permissions</param> | ||
72 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
73 | void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms); | ||
74 | |||
75 | /// <summary> | ||
76 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner | ||
77 | /// </summary> | ||
78 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> | ||
79 | List<FriendListItem> GetUserFriendList(LLUUID friendlistowner); | ||
50 | } | 80 | } |
51 | } \ No newline at end of file | 81 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/sLLVector3.cs b/OpenSim/Framework/sLLVector3.cs index 2e2c005..8187597 100644 --- a/OpenSim/Framework/sLLVector3.cs +++ b/OpenSim/Framework/sLLVector3.cs | |||
@@ -45,8 +45,8 @@ namespace OpenSim.Framework | |||
45 | z = v.Z; | 45 | z = v.Z; |
46 | } | 46 | } |
47 | 47 | ||
48 | public float x; | 48 | public float x=0; |
49 | public float y; | 49 | public float y=0; |
50 | public float z; | 50 | public float z=0; |
51 | } | 51 | } |
52 | } \ No newline at end of file | 52 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 8bf807c..aa8ab1d 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -551,6 +551,10 @@ namespace OpenSim.Region.ClientStack | |||
551 | public event RegionInfoRequest OnRegionInfoRequest; | 551 | public event RegionInfoRequest OnRegionInfoRequest; |
552 | public event EstateCovenantRequest OnEstateCovenantRequest; | 552 | public event EstateCovenantRequest OnEstateCovenantRequest; |
553 | 553 | ||
554 | public event FriendActionDelegate OnApproveFriendRequest; | ||
555 | public event FriendActionDelegate OnDenyFriendRequest; | ||
556 | public event FriendshipTermination OnTerminateFriendship; | ||
557 | |||
554 | #region Scene/Avatar to Client | 558 | #region Scene/Avatar to Client |
555 | 559 | ||
556 | /// <summary> | 560 | /// <summary> |
@@ -2555,6 +2559,39 @@ namespace OpenSim.Region.ClientStack | |||
2555 | msgpack.MessageBlock.BinaryBucket); | 2559 | msgpack.MessageBlock.BinaryBucket); |
2556 | } | 2560 | } |
2557 | break; | 2561 | break; |
2562 | |||
2563 | case PacketType.AcceptFriendship: | ||
2564 | AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack; | ||
2565 | |||
2566 | // My guess is this is the folder to stick the calling card into | ||
2567 | List<LLUUID> callingCardFolders = new List<LLUUID>(); | ||
2568 | |||
2569 | LLUUID agentID = afriendpack.AgentData.AgentID; | ||
2570 | LLUUID transactionID = afriendpack.TransactionBlock.TransactionID; | ||
2571 | |||
2572 | for (int fi = 0; fi < afriendpack.FolderData.Length; fi++) | ||
2573 | { | ||
2574 | callingCardFolders.Add(afriendpack.FolderData[fi].FolderID); | ||
2575 | } | ||
2576 | |||
2577 | if (OnApproveFriendRequest != null) | ||
2578 | { | ||
2579 | OnApproveFriendRequest(this, agentID, transactionID, callingCardFolders); | ||
2580 | } | ||
2581 | |||
2582 | |||
2583 | break; | ||
2584 | case PacketType.TerminateFriendship: | ||
2585 | TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack; | ||
2586 | LLUUID listOwnerAgentID = tfriendpack.AgentData.AgentID; | ||
2587 | LLUUID exFriendID = tfriendpack.ExBlock.OtherID; | ||
2588 | |||
2589 | if (OnTerminateFriendship != null) | ||
2590 | { | ||
2591 | OnTerminateFriendship(this, listOwnerAgentID, exFriendID); | ||
2592 | } | ||
2593 | |||
2594 | break; | ||
2558 | case PacketType.RezObject: | 2595 | case PacketType.RezObject: |
2559 | RezObjectPacket rezPacket = (RezObjectPacket) Pack; | 2596 | RezObjectPacket rezPacket = (RezObjectPacket) Pack; |
2560 | if (OnRezObject != null) | 2597 | if (OnRezObject != null) |
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 0fb86af..2c92491 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs | |||
@@ -138,8 +138,8 @@ namespace OpenSim.Region.Communications.Local | |||
138 | theUser.currentAgent.currentHandle = reg.RegionHandle; | 138 | theUser.currentAgent.currentHandle = reg.RegionHandle; |
139 | 139 | ||
140 | LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList(); | 140 | LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList(); |
141 | buddyList.AddNewBuddy(new LoginResponse.BuddyList.BuddyInfo("11111111-1111-0000-0000-000100bba000")); | 141 | |
142 | response.BuddList = buddyList; | 142 | response.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(theUser.UUID)); |
143 | 143 | ||
144 | Login _login = new Login(); | 144 | Login _login = new Login(); |
145 | //copy data to login object | 145 | //copy data to login object |
@@ -162,7 +162,20 @@ namespace OpenSim.Region.Communications.Local | |||
162 | MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion); | 162 | MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL) | ||
166 | { | ||
167 | LoginResponse.BuddyList buddylistreturn = new LoginResponse.BuddyList(); | ||
168 | foreach (FriendListItem fl in LFL) | ||
169 | { | ||
170 | LoginResponse.BuddyList.BuddyInfo buddyitem = new LoginResponse.BuddyList.BuddyInfo(fl.Friend); | ||
171 | buddyitem.BuddyID = fl.Friend; | ||
172 | buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms; | ||
173 | buddyitem.BuddyRightsGiven = (int)fl.FriendPerms; | ||
174 | buddylistreturn.AddNewBuddy(buddyitem); | ||
165 | 175 | ||
176 | } | ||
177 | return buddylistreturn; | ||
178 | } | ||
166 | protected override InventoryData CreateInventoryData(LLUUID userID) | 179 | protected override InventoryData CreateInventoryData(LLUUID userID) |
167 | { | 180 | { |
168 | List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID); | 181 | List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID); |
@@ -207,6 +220,7 @@ namespace OpenSim.Region.Communications.Local | |||
207 | 220 | ||
208 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); | 221 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); |
209 | } | 222 | } |
223 | |||
210 | } | 224 | } |
211 | } | 225 | } |
212 | } \ No newline at end of file | 226 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 3a2e138..c205d08 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | |||
@@ -213,5 +213,48 @@ namespace OpenSim.Region.Communications.OGS1 | |||
213 | { | 213 | { |
214 | throw new Exception("The method or operation is not implemented."); | 214 | throw new Exception("The method or operation is not implemented."); |
215 | } | 215 | } |
216 | |||
217 | #region IUserServices Friend Methods | ||
218 | /// <summary> | ||
219 | /// Adds a new friend to the database for XUser | ||
220 | /// </summary> | ||
221 | /// <param name="friendlistowner">The agent that who's friends list is being added to</param> | ||
222 | /// <param name="friend">The agent that being added to the friends list of the friends list owner</param> | ||
223 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
224 | public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) | ||
225 | { | ||
226 | |||
227 | } | ||
228 | |||
229 | /// <summary> | ||
230 | /// Delete friend on friendlistowner's friendlist. | ||
231 | /// </summary> | ||
232 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
233 | /// <param name="friend">The Ex-friend agent</param> | ||
234 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) | ||
235 | { | ||
236 | |||
237 | } | ||
238 | |||
239 | /// <summary> | ||
240 | /// Update permissions for friend on friendlistowner's friendlist. | ||
241 | /// </summary> | ||
242 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
243 | /// <param name="friend">The agent that is getting or loosing permissions</param> | ||
244 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
245 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) | ||
246 | { | ||
247 | |||
248 | } | ||
249 | /// <summary> | ||
250 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner | ||
251 | /// </summary> | ||
252 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> | ||
253 | public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) | ||
254 | { | ||
255 | return new List<FriendListItem>(); | ||
256 | } | ||
257 | |||
258 | #endregion | ||
216 | } | 259 | } |
217 | } \ No newline at end of file | 260 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/InstantMessageReceiver.cs b/OpenSim/Region/Environment/InstantMessageReceiver.cs new file mode 100644 index 0000000..ecda399 --- /dev/null +++ b/OpenSim/Region/Environment/InstantMessageReceiver.cs | |||
@@ -0,0 +1,28 @@ | |||
1 | using System; | ||
2 | |||
3 | namespace OpenSim.Region.Environment | ||
4 | { | ||
5 | /// <summary> | ||
6 | /// Bit Vector for Which Modules to send an instant message to from the Scene or an Associated Module | ||
7 | /// </summary> | ||
8 | |||
9 | // This prevents the Modules from sending Instant messages to other modules through the scene | ||
10 | // and then receiving the same messages | ||
11 | |||
12 | // This is mostly here because on LLSL and the SecondLife Client, IMs,Groups and friends are linked | ||
13 | // inseparably | ||
14 | |||
15 | [Flags] | ||
16 | public enum InstantMessageReceiver : uint | ||
17 | { | ||
18 | /// <summary>None of them.. here for posterity and amusement</summary> | ||
19 | None = 0, | ||
20 | /// <summary>The IM Module</summary> | ||
21 | IMModule = 0x00000001, | ||
22 | /// <summary>The Friends Module</summary> | ||
23 | FriendsModule = 0x00000002, | ||
24 | /// <summary>The Groups Module</summary> | ||
25 | GroupsModule = 0x00000004 | ||
26 | |||
27 | } | ||
28 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index ee78f15..d6be63b 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -35,53 +35,180 @@ using OpenSim.Framework.Console; | |||
35 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
36 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
37 | using libsecondlife; | 37 | using libsecondlife; |
38 | using libsecondlife.Packets; | ||
39 | 38 | ||
40 | namespace OpenSim.Region.Environment.Modules | 39 | namespace OpenSim.Region.Environment.Modules |
41 | { | 40 | { |
42 | public class FriendsModule : IRegionModule | 41 | public class FriendsModule : IRegionModule |
43 | { | 42 | { |
44 | private List<Scene> m_scenes = new List<Scene>(); | 43 | |
45 | private LogBase m_log; | 44 | private LogBase m_log; |
46 | 45 | ||
46 | private Scene m_scene; | ||
47 | |||
48 | Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>(); | ||
49 | |||
47 | public void Initialise(Scene scene, IConfigSource config) | 50 | public void Initialise(Scene scene, IConfigSource config) |
48 | { | 51 | { |
49 | m_log = MainLog.Instance; | 52 | m_log = MainLog.Instance; |
50 | if (!m_scenes.Contains(scene)) | 53 | m_scene = scene; |
51 | { | 54 | scene.EventManager.OnNewClient += OnNewClient; |
52 | m_scenes.Add(scene); | 55 | scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage; |
53 | scene.EventManager.OnNewClient += OnNewClient; | ||
54 | } | ||
55 | } | 56 | } |
56 | 57 | ||
57 | private void OnNewClient(IClientAPI client) | 58 | private void OnNewClient(IClientAPI client) |
58 | { | 59 | { |
59 | //FormFriendship(client,new Guid("c43a67ab-b196-4d62-936c-b40369547dee")); | 60 | // All friends establishment protocol goes over instant message |
60 | //FormFriendship(client, new Guid("0a2f777b-f44c-4662-8b22-c90ae038a3e6")); | 61 | // There's no way to send a message from the sim |
61 | } | 62 | // to a user to 'add a friend' without causing dialog box spam |
63 | // | ||
64 | // The base set of friends are added when the user signs on in their XMLRPC response | ||
65 | // Generated by LoginService. The friends are retreived from the database by the UserManager | ||
62 | 66 | ||
63 | public void PostInitialise() | 67 | // Subscribe to instant messages |
68 | client.OnInstantMessage += OnInstantMessage; | ||
69 | client.OnApproveFriendRequest += OnApprovedFriendRequest; | ||
70 | client.OnDenyFriendRequest += OnDenyFriendRequest; | ||
71 | client.OnTerminateFriendship += OnTerminateFriendship; | ||
72 | |||
73 | |||
74 | } | ||
75 | private void OnInstantMessage(LLUUID fromAgentID, | ||
76 | LLUUID fromAgentSession, LLUUID toAgentID, | ||
77 | LLUUID imSessionID, uint timestamp, string fromAgentName, | ||
78 | string message, byte dialog, bool fromGroup, byte offline, | ||
79 | uint ParentEstateID, LLVector3 Position, LLUUID RegionID, | ||
80 | byte[] binaryBucket) | ||
64 | { | 81 | { |
82 | // Friend Requests go by Instant Message.. using the dialog param | ||
83 | // https://wiki.secondlife.com/wiki/ImprovedInstantMessage | ||
84 | |||
85 | // 38 == Offer friendship | ||
86 | if (dialog == (byte)38) | ||
87 | { | ||
88 | LLUUID friendTransactionID = LLUUID.Random(); | ||
89 | |||
90 | m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); | ||
91 | |||
92 | m_log.Verbose("FRIEND", "38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); | ||
93 | GridInstantMessage msg = new GridInstantMessage(); | ||
94 | msg.fromAgentID = fromAgentID.UUID; | ||
95 | msg.fromAgentSession = fromAgentSession.UUID; | ||
96 | msg.toAgentID = toAgentID.UUID; | ||
97 | msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here | ||
98 | m_log.Verbose("FRIEND","Filling Session: " + msg.imSessionID.ToString()); | ||
99 | msg.timestamp = timestamp; | ||
100 | msg.fromAgentName = fromAgentName; | ||
101 | msg.message = message; | ||
102 | msg.dialog = dialog; | ||
103 | msg.fromGroup = fromGroup; | ||
104 | msg.offline = offline; | ||
105 | msg.ParentEstateID = ParentEstateID; | ||
106 | msg.Position = new sLLVector3(Position); | ||
107 | msg.RegionID = RegionID.UUID; | ||
108 | msg.binaryBucket = binaryBucket; | ||
109 | m_scene.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); | ||
110 | } | ||
111 | if (dialog == (byte)39) | ||
112 | { | ||
113 | m_log.Verbose("FRIEND", "38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); | ||
114 | |||
115 | } | ||
116 | if (dialog == (byte)40) | ||
117 | { | ||
118 | m_log.Verbose("FRIEND", "38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); | ||
119 | } | ||
120 | |||
121 | // 39 == Accept Friendship | ||
122 | |||
123 | // 40 == Decline Friendship | ||
124 | |||
65 | } | 125 | } |
66 | 126 | ||
67 | private void FormFriendship(IClientAPI client, Guid friend) | 127 | private void OnApprovedFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List<LLUUID> callingCardFolders) |
68 | { | 128 | { |
69 | foreach (Scene scene in m_scenes) | 129 | if (m_pendingFriendRequests.ContainsKey(transactionID)) |
70 | { | 130 | { |
71 | if (scene.Entities.ContainsKey(client.AgentId) && scene.Entities[client.AgentId] is ScenePresence) | 131 | // Found Pending Friend Request with that Transaction.. |
72 | { | 132 | |
73 | OnlineNotificationPacket ONPack = new OnlineNotificationPacket(); | 133 | // Compose response to other agent. |
74 | OnlineNotificationPacket.AgentBlockBlock[] AgentBlock = new OnlineNotificationPacket.AgentBlockBlock[1]; | 134 | GridInstantMessage msg = new GridInstantMessage(); |
75 | 135 | msg.toAgentID = m_pendingFriendRequests[transactionID].UUID; | |
76 | AgentBlock[0] = new OnlineNotificationPacket.AgentBlockBlock(); | 136 | msg.fromAgentID = agentID.UUID; |
77 | AgentBlock[0].AgentID = new LLUUID(friend); | 137 | msg.fromAgentName = client.FirstName + " " + client.LastName; |
78 | ONPack.AgentBlock = AgentBlock; | 138 | msg.fromAgentSession = client.SessionId.UUID; |
79 | client.OutPacket(ONPack,ThrottleOutPacketType.Task); | 139 | msg.fromGroup = false; |
80 | } | 140 | msg.imSessionID = transactionID.UUID; |
141 | msg.message = agentID.UUID.ToString(); | ||
142 | msg.ParentEstateID = 0; | ||
143 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
144 | msg.RegionID = m_scene.RegionInfo.RegionID.UUID; | ||
145 | msg.dialog = (byte)39;// Approved friend request | ||
146 | msg.Position = new sLLVector3(); | ||
147 | msg.offline = (byte)0; | ||
148 | msg.binaryBucket = new byte[0]; | ||
149 | m_scene.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); | ||
150 | m_scene.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, (uint)1); | ||
151 | m_pendingFriendRequests.Remove(transactionID); | ||
152 | |||
153 | // TODO: Inform agent that the friend is online | ||
81 | } | 154 | } |
155 | } | ||
156 | private void OnDenyFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List<LLUUID> callingCardFolders) | ||
157 | { | ||
158 | if (m_pendingFriendRequests.ContainsKey(transactionID)) | ||
159 | { | ||
160 | // Found Pending Friend Request with that Transaction.. | ||
161 | |||
162 | // Compose response to other agent. | ||
163 | GridInstantMessage msg = new GridInstantMessage(); | ||
164 | msg.toAgentID = m_pendingFriendRequests[transactionID].UUID; | ||
165 | msg.fromAgentID = agentID.UUID; | ||
166 | msg.fromAgentName = client.FirstName + " " + client.LastName; | ||
167 | msg.fromAgentSession = client.SessionId.UUID; | ||
168 | msg.fromGroup = false; | ||
169 | msg.imSessionID = transactionID.UUID; | ||
170 | msg.message = agentID.UUID.ToString(); | ||
171 | msg.ParentEstateID = 0; | ||
172 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
173 | msg.RegionID = m_scene.RegionInfo.RegionID.UUID; | ||
174 | msg.dialog = (byte)40;// Deny friend request | ||
175 | msg.Position = new sLLVector3(); | ||
176 | msg.offline = (byte)0; | ||
177 | msg.binaryBucket = new byte[0]; | ||
178 | m_scene.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); | ||
179 | m_pendingFriendRequests.Remove(transactionID); | ||
180 | |||
181 | } | ||
182 | |||
183 | |||
184 | } | ||
185 | |||
186 | private void OnTerminateFriendship(IClientAPI client, LLUUID agent, LLUUID exfriendID) | ||
187 | { | ||
188 | m_scene.StoreRemoveFriendship(agent, exfriendID); | ||
189 | // TODO: Inform the client that the ExFriend is offline | ||
82 | 190 | ||
83 | } | 191 | } |
84 | 192 | ||
193 | |||
194 | private void OnGridInstantMessage(GridInstantMessage msg) | ||
195 | { | ||
196 | // Trigger the above event handler | ||
197 | OnInstantMessage(new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession), | ||
198 | new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName, | ||
199 | msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID, | ||
200 | new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID), | ||
201 | msg.binaryBucket); | ||
202 | |||
203 | } | ||
204 | |||
205 | |||
206 | public void PostInitialise() | ||
207 | { | ||
208 | } | ||
209 | |||
210 | |||
211 | |||
85 | public void Close() | 212 | public void Close() |
86 | { | 213 | { |
87 | } | 214 | } |
@@ -93,7 +220,7 @@ namespace OpenSim.Region.Environment.Modules | |||
93 | 220 | ||
94 | public bool IsSharedModule | 221 | public bool IsSharedModule |
95 | { | 222 | { |
96 | get { return true; } | 223 | get { return false; } |
97 | } | 224 | } |
98 | } | 225 | } |
99 | } \ No newline at end of file | 226 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 1e1d236..0967b70 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.Environment.Modules | |||
52 | { | 52 | { |
53 | m_scenes.Add(scene); | 53 | m_scenes.Add(scene); |
54 | scene.EventManager.OnNewClient += OnNewClient; | 54 | scene.EventManager.OnNewClient += OnNewClient; |
55 | scene.EventManager.OnGridInstantMessageToIMModule += OnGridInstantMessage; | ||
55 | } | 56 | } |
56 | } | 57 | } |
57 | 58 | ||
@@ -67,19 +68,29 @@ namespace OpenSim.Region.Environment.Modules | |||
67 | uint ParentEstateID, LLVector3 Position, LLUUID RegionID, | 68 | uint ParentEstateID, LLVector3 Position, LLUUID RegionID, |
68 | byte[] binaryBucket) | 69 | byte[] binaryBucket) |
69 | { | 70 | { |
70 | foreach (Scene scene in m_scenes) | 71 | |
72 | bool FriendDialog = ((dialog == (byte)38) || (dialog == (byte)39) || (dialog == (byte)40)); | ||
73 | |||
74 | // IM dialogs need to be pre-processed and have their sessionID filled by the server | ||
75 | // so the sim can match the transaction on the return packet. | ||
76 | |||
77 | // Don't send a Friend Dialog IM with a LLUUID.Zero session. | ||
78 | if (!(FriendDialog && imSessionID == LLUUID.Zero)) | ||
71 | { | 79 | { |
72 | if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) | 80 | foreach (Scene scene in m_scenes) |
73 | { | 81 | { |
74 | // Local message | 82 | if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) |
75 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | ||
76 | if (!user.IsChildAgent) | ||
77 | { | 83 | { |
78 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, | 84 | // Local message |
79 | toAgentID, imSessionID, fromAgentName, dialog, | 85 | ScenePresence user = (ScenePresence)scene.Entities[toAgentID]; |
80 | timestamp); | 86 | if (!user.IsChildAgent) |
81 | // Message sent | 87 | { |
82 | return; | 88 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, |
89 | toAgentID, imSessionID, fromAgentName, dialog, | ||
90 | timestamp); | ||
91 | // Message sent | ||
92 | return; | ||
93 | } | ||
83 | } | 94 | } |
84 | } | 95 | } |
85 | } | 96 | } |
@@ -87,6 +98,20 @@ namespace OpenSim.Region.Environment.Modules | |||
87 | // Still here, try send via Grid | 98 | // Still here, try send via Grid |
88 | // TODO | 99 | // TODO |
89 | } | 100 | } |
101 | |||
102 | // Trusty OSG1 called method. This method also gets called from the FriendsModule | ||
103 | // Turns out the sim has to send an instant message to the user to get it to show an accepted friend. | ||
104 | |||
105 | private void OnGridInstantMessage(GridInstantMessage msg) | ||
106 | { | ||
107 | // Trigger the above event handler | ||
108 | OnInstantMessage(new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession), | ||
109 | new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName, | ||
110 | msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID, | ||
111 | new LLVector3(msg.Position.x,msg.Position.y,msg.Position.z), new LLUUID(msg.RegionID), | ||
112 | msg.binaryBucket); | ||
113 | |||
114 | } | ||
90 | 115 | ||
91 | public void PostInitialise() | 116 | public void PostInitialise() |
92 | { | 117 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a0f19bd..ba99640 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1625,6 +1625,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1625 | } | 1625 | } |
1626 | } | 1626 | } |
1627 | 1627 | ||
1628 | |||
1629 | |||
1628 | #endregion | 1630 | #endregion |
1629 | 1631 | ||
1630 | #region Other Methods | 1632 | #region Other Methods |
@@ -1699,6 +1701,45 @@ namespace OpenSim.Region.Environment.Scenes | |||
1699 | } | 1701 | } |
1700 | } | 1702 | } |
1701 | 1703 | ||
1704 | /// <summary> | ||
1705 | /// This method is a way for the Friends Module to create an instant | ||
1706 | /// message to the avatar and for Instant Messages that travel across | ||
1707 | /// gridcomms to make it to the Instant Message Module. | ||
1708 | /// | ||
1709 | /// Friendship establishment and groups are unfortunately tied with instant messaging and | ||
1710 | /// there's no way to separate them completely. | ||
1711 | /// </summary> | ||
1712 | /// <param name="message">object containing the instant message data</param> | ||
1713 | /// <returns>void</returns> | ||
1714 | public void TriggerGridInstantMessage(GridInstantMessage message,InstantMessageReceiver options) | ||
1715 | { | ||
1716 | m_eventManager.TriggerGridInstantMessage(message,options); | ||
1717 | } | ||
1718 | |||
1719 | |||
1720 | public virtual void StoreAddFriendship(LLUUID ownerID, LLUUID friendID, uint perms) | ||
1721 | { | ||
1722 | // TODO: m_sceneGridService.DoStuff; | ||
1723 | CommsManager.AddNewUserFriend(ownerID, friendID, perms); | ||
1724 | } | ||
1725 | |||
1726 | public virtual void StoreUpdateFriendship(LLUUID ownerID, LLUUID friendID, uint perms) | ||
1727 | { | ||
1728 | // TODO: m_sceneGridService.DoStuff; | ||
1729 | CommsManager.UpdateUserFriendPerms(ownerID, friendID, perms); | ||
1730 | } | ||
1731 | |||
1732 | public virtual void StoreRemoveFriendship(LLUUID ownerID, LLUUID ExfriendID) | ||
1733 | { | ||
1734 | // TODO: m_sceneGridService.DoStuff; | ||
1735 | CommsManager.RemoveUserFriend(ownerID, ExfriendID); | ||
1736 | } | ||
1737 | public virtual List<FriendListItem> StoreGetFriendsForUser(LLUUID ownerID) | ||
1738 | { | ||
1739 | // TODO: m_sceneGridService.DoStuff; | ||
1740 | return CommsManager.GetUserFriendList(ownerID); | ||
1741 | } | ||
1742 | |||
1702 | #endregion | 1743 | #endregion |
1703 | 1744 | ||
1704 | #region Console Commands | 1745 | #region Console Commands |
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index a6a8fb6..5bf23ac 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -27,12 +27,14 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using System; | ||
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
31 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.Environment.Interfaces; |
32 | using OpenSim.Region.Environment.LandManagement; | 33 | using OpenSim.Region.Environment.LandManagement; |
33 | 34 | ||
34 | namespace OpenSim.Region.Environment.Scenes | 35 | namespace OpenSim.Region.Environment.Scenes |
35 | { | 36 | { |
37 | |||
36 | /// <summary> | 38 | /// <summary> |
37 | /// A class for triggering remote scene events. | 39 | /// A class for triggering remote scene events. |
38 | /// </summary> | 40 | /// </summary> |
@@ -115,6 +117,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
115 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; | 117 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; |
116 | 118 | ||
117 | 119 | ||
120 | public delegate void NewGridInstantMessage(GridInstantMessage message); | ||
121 | |||
122 | public event NewGridInstantMessage OnGridInstantMessageToIMModule; | ||
123 | |||
124 | public event NewGridInstantMessage OnGridInstantMessageToFriendsModule; | ||
125 | |||
126 | public event NewGridInstantMessage OnGridInstantMessageToGroupsModule; | ||
127 | |||
128 | |||
129 | |||
118 | public void TriggerOnClientMovement(ScenePresence avatar) | 130 | public void TriggerOnClientMovement(ScenePresence avatar) |
119 | { | 131 | { |
120 | if (OnClientMovement != null) | 132 | if (OnClientMovement != null) |
@@ -265,5 +277,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
265 | OnAvatarEnteringNewParcel(avatar, localLandID, regionID); | 277 | OnAvatarEnteringNewParcel(avatar, localLandID, regionID); |
266 | } | 278 | } |
267 | } | 279 | } |
280 | |||
281 | ///<summary>Used to pass instnat messages around between the Scene, the Friends Module and the Instant Messsage Module</summary> | ||
282 | ///<param name="message">Object containing the Instant Message Data</param> | ||
283 | ///<param name="whichModule">A bit vector containing the modules to send the message to</param> | ||
284 | public void TriggerGridInstantMessage(GridInstantMessage message, InstantMessageReceiver whichModule) | ||
285 | { | ||
286 | if ((whichModule & InstantMessageReceiver.IMModule) != 0) | ||
287 | { | ||
288 | |||
289 | if (OnGridInstantMessageToIMModule != null) | ||
290 | { | ||
291 | OnGridInstantMessageToIMModule(message); | ||
292 | } | ||
293 | } | ||
294 | if ((whichModule & InstantMessageReceiver.FriendsModule) != 0) | ||
295 | { | ||
296 | if (OnGridInstantMessageToFriendsModule != null) | ||
297 | { | ||
298 | OnGridInstantMessageToFriendsModule(message); | ||
299 | } | ||
300 | |||
301 | } | ||
302 | } | ||
303 | |||
268 | } | 304 | } |
269 | } \ No newline at end of file | 305 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 3e191b4..b6db4cc 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -139,6 +139,9 @@ namespace SimpleApp | |||
139 | public event RegionInfoRequest OnRegionInfoRequest; | 139 | public event RegionInfoRequest OnRegionInfoRequest; |
140 | public event EstateCovenantRequest OnEstateCovenantRequest; | 140 | public event EstateCovenantRequest OnEstateCovenantRequest; |
141 | 141 | ||
142 | public event FriendActionDelegate OnApproveFriendRequest; | ||
143 | public event FriendActionDelegate OnDenyFriendRequest; | ||
144 | public event FriendshipTermination OnTerminateFriendship; | ||
142 | 145 | ||
143 | #pragma warning restore 67 | 146 | #pragma warning restore 67 |
144 | 147 | ||
diff --git a/bin/inventory/Libraries.xml b/bin/inventory/Libraries.xml index 09270b5..eb3660d 100644 --- a/bin/inventory/Libraries.xml +++ b/bin/inventory/Libraries.xml | |||
@@ -7,7 +7,7 @@ | |||
7 | the hardcoded root library folder ("OpenSim Library") | 7 | the hardcoded root library folder ("OpenSim Library") |
8 | 8 | ||
9 | You can also add folders and items to the folders of libraries defined earlier on in this file --> | 9 | You can also add folders and items to the folders of libraries defined earlier on in this file --> |
10 | 10 | ||
11 | <!-- | 11 | <!-- |
12 | <Section Name="My Site Library"> | 12 | <Section Name="My Site Library"> |
13 | <Key Name="foldersFile" Value="MySiteLibrary/MySiteLibraryFolders.xml"/> | 13 | <Key Name="foldersFile" Value="MySiteLibrary/MySiteLibraryFolders.xml"/> |