Refactor: rename user to session

This commit is contained in:
gion 2020-04-04 17:56:21 +02:00
parent b3354ec637
commit f273995f5b
5 changed files with 169 additions and 169 deletions

View File

@ -19,8 +19,8 @@ namespace Emby.Server.Implementations.Syncplay
private enum BroadcastType
{
AllGroup = 0,
SingleUser = 1,
AllExceptUser = 2,
SingleSession = 1,
AllExceptSession = 2,
AllReady = 3
}
@ -95,32 +95,32 @@ namespace Emby.Server.Implementations.Syncplay
}
}
private SessionInfo[] FilterUsers(SessionInfo from, BroadcastType type)
private SessionInfo[] FilterSessions(SessionInfo from, BroadcastType type)
{
if (type == BroadcastType.SingleUser)
if (type == BroadcastType.SingleSession)
{
return new SessionInfo[] { from };
}
else if (type == BroadcastType.AllGroup)
{
return _group.Partecipants.Values.Select(
user => user.Session
session => session.Session
).ToArray();
}
else if (type == BroadcastType.AllExceptUser)
else if (type == BroadcastType.AllExceptSession)
{
return _group.Partecipants.Values.Select(
user => user.Session
session => session.Session
).Where(
user => !user.Id.Equals(from.Id)
session => !session.Id.Equals(from.Id)
).ToArray();
}
else if (type == BroadcastType.AllReady)
{
return _group.Partecipants.Values.Where(
user => !user.IsBuffering
session => !session.IsBuffering
).Select(
user => user.Session
session => session.Session
).ToArray();
}
else
@ -133,10 +133,10 @@ namespace Emby.Server.Implementations.Syncplay
{
IEnumerable<Task> GetTasks()
{
SessionInfo[] users = FilterUsers(from, type);
foreach (var user in users)
SessionInfo[] sessions = FilterSessions(from, type);
foreach (var session in sessions)
{
yield return _sessionManager.SendSyncplayGroupUpdate(user.Id.ToString(), message, CancellationToken.None);
yield return _sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), message, CancellationToken.None);
}
}
@ -147,10 +147,10 @@ namespace Emby.Server.Implementations.Syncplay
{
IEnumerable<Task> GetTasks()
{
SessionInfo[] users = FilterUsers(from, type);
foreach (var user in users)
SessionInfo[] sessions = FilterSessions(from, type);
foreach (var session in sessions)
{
yield return _sessionManager.SendSyncplayCommand(user.Id.ToString(), message, CancellationToken.None);
yield return _sessionManager.SendSyncplayCommand(session.Id.ToString(), message, CancellationToken.None);
}
}
@ -176,46 +176,46 @@ namespace Emby.Server.Implementations.Syncplay
}
/// <inheritdoc />
public void InitGroup(SessionInfo user)
public void InitGroup(SessionInfo session)
{
_group.AddUser(user);
_syncplayManager.MapUserToGroup(user, this);
_group.AddSession(session);
_syncplayManager.MapSessionToGroup(session, this);
_group.PlayingItem = user.FullNowPlayingItem;
_group.PlayingItem = session.FullNowPlayingItem;
_group.IsPaused = true;
_group.PositionTicks = user.PlayState.PositionTicks ??= 0;
_group.PositionTicks = session.PlayState.PositionTicks ??= 0;
_group.LastActivity = DateTime.UtcNow;
var updateUser = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.GroupJoined, DateTime.UtcNow.ToUniversalTime().ToString("o"));
SendGroupUpdate(user, BroadcastType.SingleUser, updateUser);
var updateSession = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.GroupJoined, DateTime.UtcNow.ToUniversalTime().ToString("o"));
SendGroupUpdate(session, BroadcastType.SingleSession, updateSession);
var pauseCommand = NewSyncplayCommand(SyncplayCommandType.Pause);
SendCommand(user, BroadcastType.SingleUser, pauseCommand);
SendCommand(session, BroadcastType.SingleSession, pauseCommand);
}
/// <inheritdoc />
public void UserJoin(SessionInfo user)
public void SessionJoin(SessionInfo session)
{
if (user.NowPlayingItem != null && user.NowPlayingItem.Id.Equals(_group.PlayingItem.Id))
if (session.NowPlayingItem != null && session.NowPlayingItem.Id.Equals(_group.PlayingItem.Id))
{
_group.AddUser(user);
_syncplayManager.MapUserToGroup(user, this);
_group.AddSession(session);
_syncplayManager.MapSessionToGroup(session, this);
var updateUser = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.GroupJoined, _group.PositionTicks);
SendGroupUpdate(user, BroadcastType.SingleUser, updateUser);
var updateSession = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.GroupJoined, _group.PositionTicks);
SendGroupUpdate(session, BroadcastType.SingleSession, updateSession);
var updateOthers = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.UserJoined, user.UserName);
SendGroupUpdate(user, BroadcastType.AllExceptUser, updateOthers);
var updateOthers = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.UserJoined, session.UserName);
SendGroupUpdate(session, BroadcastType.AllExceptSession, updateOthers);
// Client join and play, syncing will happen client side
if (!_group.IsPaused)
{
var playCommand = NewSyncplayCommand(SyncplayCommandType.Play);
SendCommand(user, BroadcastType.SingleUser, playCommand);
SendCommand(session, BroadcastType.SingleSession, playCommand);
}
else
{
var pauseCommand = NewSyncplayCommand(SyncplayCommandType.Pause);
SendCommand(user, BroadcastType.SingleUser, pauseCommand);
SendCommand(session, BroadcastType.SingleSession, pauseCommand);
}
}
else
@ -224,25 +224,25 @@ namespace Emby.Server.Implementations.Syncplay
playRequest.ItemIds = new Guid[] { _group.PlayingItem.Id };
playRequest.StartPositionTicks = _group.PositionTicks;
var update = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.PrepareSession, playRequest);
SendGroupUpdate(user, BroadcastType.SingleUser, update);
SendGroupUpdate(session, BroadcastType.SingleSession, update);
}
}
/// <inheritdoc />
public void UserLeave(SessionInfo user)
public void SessionLeave(SessionInfo session)
{
_group.RemoveUser(user);
_syncplayManager.UnmapUserFromGroup(user, this);
_group.RemoveSession(session);
_syncplayManager.UnmapSessionFromGroup(session, this);
var updateUser = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.GroupLeft, _group.PositionTicks);
SendGroupUpdate(user, BroadcastType.SingleUser, updateUser);
var updateSession = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.GroupLeft, _group.PositionTicks);
SendGroupUpdate(session, BroadcastType.SingleSession, updateSession);
var updateOthers = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.UserLeft, user.UserName);
SendGroupUpdate(user, BroadcastType.AllExceptUser, updateOthers);
var updateOthers = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.UserLeft, session.UserName);
SendGroupUpdate(session, BroadcastType.AllExceptSession, updateOthers);
}
/// <inheritdoc />
public void HandleRequest(SessionInfo user, SyncplayRequestInfo request)
public void HandleRequest(SessionInfo session, SyncplayRequestInfo request)
{
if (request.Type.Equals(SyncplayRequestType.Play))
{
@ -257,13 +257,13 @@ namespace Emby.Server.Implementations.Syncplay
);
var command = NewSyncplayCommand(SyncplayCommandType.Play);
SendCommand(user, BroadcastType.AllGroup, command);
SendCommand(session, BroadcastType.AllGroup, command);
}
else
{
// Client got lost
var command = NewSyncplayCommand(SyncplayCommandType.Play);
SendCommand(user, BroadcastType.SingleUser, command);
SendCommand(session, BroadcastType.SingleSession, command);
}
}
else if (request.Type.Equals(SyncplayRequestType.Pause))
@ -277,12 +277,12 @@ namespace Emby.Server.Implementations.Syncplay
_group.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
var command = NewSyncplayCommand(SyncplayCommandType.Pause);
SendCommand(user, BroadcastType.AllGroup, command);
SendCommand(session, BroadcastType.AllGroup, command);
}
else
{
var command = NewSyncplayCommand(SyncplayCommandType.Pause);
SendCommand(user, BroadcastType.SingleUser, command);
SendCommand(session, BroadcastType.SingleSession, command);
}
}
else if (request.Type.Equals(SyncplayRequestType.Seek))
@ -301,7 +301,7 @@ namespace Emby.Server.Implementations.Syncplay
_group.LastActivity = DateTime.UtcNow;
var command = NewSyncplayCommand(SyncplayCommandType.Seek);
SendCommand(user, BroadcastType.AllGroup, command);
SendCommand(session, BroadcastType.AllGroup, command);
}
// TODO: client does not implement this yet
else if (request.Type.Equals(SyncplayRequestType.Buffering))
@ -314,19 +314,19 @@ namespace Emby.Server.Implementations.Syncplay
_group.LastActivity = currentTime;
_group.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
_group.SetBuffering(user, true);
_group.SetBuffering(session, true);
// Send pause command to all non-buffering users
// Send pause command to all non-buffering sessions
var command = NewSyncplayCommand(SyncplayCommandType.Pause);
SendCommand(user, BroadcastType.AllReady, command);
SendCommand(session, BroadcastType.AllReady, command);
var updateOthers = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.GroupWait, user.UserName);
SendGroupUpdate(user, BroadcastType.AllExceptUser, updateOthers);
var updateOthers = NewSyncplayGroupUpdate(SyncplayGroupUpdateType.GroupWait, session.UserName);
SendGroupUpdate(session, BroadcastType.AllExceptSession, updateOthers);
}
else
{
var command = NewSyncplayCommand(SyncplayCommandType.Pause);
SendCommand(user, BroadcastType.SingleUser, command);
SendCommand(session, BroadcastType.SingleSession, command);
}
}
// TODO: client does not implement this yet
@ -334,7 +334,7 @@ namespace Emby.Server.Implementations.Syncplay
{
if (_group.IsPaused)
{
_group.SetBuffering(user, false);
_group.SetBuffering(session, false);
if (_group.IsBuffering()) {
// Others are buffering, tell this client to pause when ready
@ -348,7 +348,7 @@ namespace Emby.Server.Implementations.Syncplay
command.When = currentTime.AddMilliseconds(
delay
).ToUniversalTime().ToString("o");
SendCommand(user, BroadcastType.SingleUser, command);
SendCommand(session, BroadcastType.SingleSession, command);
}
else
{
@ -368,7 +368,7 @@ namespace Emby.Server.Implementations.Syncplay
delay
);
var command = NewSyncplayCommand(SyncplayCommandType.Play);
SendCommand(user, BroadcastType.AllExceptUser, command);
SendCommand(session, BroadcastType.AllExceptSession, command);
}
else
{
@ -381,7 +381,7 @@ namespace Emby.Server.Implementations.Syncplay
);
var command = NewSyncplayCommand(SyncplayCommandType.Play);
SendCommand(user, BroadcastType.AllGroup, command);
SendCommand(session, BroadcastType.AllGroup, command);
}
}
}
@ -389,17 +389,17 @@ namespace Emby.Server.Implementations.Syncplay
{
// Make sure client has latest group state
var command = NewSyncplayCommand(SyncplayCommandType.Play);
SendCommand(user, BroadcastType.SingleUser, command);
SendCommand(session, BroadcastType.SingleSession, command);
}
}
else if (request.Type.Equals(SyncplayRequestType.KeepAlive))
{
_group.UpdatePing(user, request.Ping ??= _group.DefaulPing);
_group.UpdatePing(session, request.Ping ??= _group.DefaulPing);
var keepAlive = new SyncplayGroupUpdate<string>();
keepAlive.GroupId = _group.GroupId.ToString();
keepAlive.Type = SyncplayGroupUpdateType.KeepAlive;
SendGroupUpdate(user, BroadcastType.SingleUser, keepAlive);
SendGroupUpdate(session, BroadcastType.SingleSession, keepAlive);
}
}
@ -411,7 +411,7 @@ namespace Emby.Server.Implementations.Syncplay
info.PlayingItemName = _group.PlayingItem.Name;
info.PlayingItemId = _group.PlayingItem.Id.ToString();
info.PositionTicks = _group.PositionTicks;
info.Partecipants = _group.Partecipants.Values.Select(user => user.Session.UserName).ToArray();
info.Partecipants = _group.Partecipants.Values.Select(session => session.Session.UserName).ToArray();
return info;
}
}

View File

@ -27,9 +27,9 @@ namespace Emby.Server.Implementations.Syncplay
private readonly ISessionManager _sessionManager;
/// <summary>
/// The map between users and groups.
/// The map between sessions and groups.
/// </summary>
private readonly ConcurrentDictionary<string, ISyncplayController> _userToGroupMap =
private readonly ConcurrentDictionary<string, ISyncplayController> _sessionToGroupMap =
new ConcurrentDictionary<string, ISyncplayController>(StringComparer.OrdinalIgnoreCase);
/// <summary>
@ -91,27 +91,27 @@ namespace Emby.Server.Implementations.Syncplay
void _sessionManager_SessionEnded(object sender, SessionEventArgs e)
{
var user = e.SessionInfo;
if (!IsUserInGroup(user)) return;
LeaveGroup(user);
var session = e.SessionInfo;
if (!IsSessionInGroup(session)) return;
LeaveGroup(session);
}
void _sessionManager_PlaybackStopped(object sender, PlaybackStopEventArgs e)
{
var user = e.Session;
if (!IsUserInGroup(user)) return;
LeaveGroup(user);
var session = e.Session;
if (!IsSessionInGroup(session)) return;
LeaveGroup(session);
}
private bool IsUserInGroup(SessionInfo user)
private bool IsSessionInGroup(SessionInfo session)
{
return _userToGroupMap.ContainsKey(user.Id);
return _sessionToGroupMap.ContainsKey(session.Id);
}
private Guid? GetUserGroup(SessionInfo user)
private Guid? GetSessionGroup(SessionInfo session)
{
ISyncplayController group;
_userToGroupMap.TryGetValue(user.Id, out group);
_sessionToGroupMap.TryGetValue(session.Id, out group);
if (group != null)
{
return group.GetGroupId();
@ -123,26 +123,26 @@ namespace Emby.Server.Implementations.Syncplay
}
/// <inheritdoc />
public void NewGroup(SessionInfo user)
public void NewGroup(SessionInfo session)
{
if (IsUserInGroup(user))
{
LeaveGroup(user);
if (IsSessionInGroup(session))
LeaveGroup(session);
}
var group = new SyncplayController(_logger, _sessionManager, this);
_groups[group.GetGroupId().ToString()] = group;
group.InitGroup(user);
group.InitGroup(session);
}
/// <inheritdoc />
public void JoinGroup(SessionInfo user, string groupId)
public void JoinGroup(SessionInfo session, string groupId)
{
if (IsUserInGroup(user))
if (IsSessionInGroup(session))
{
if (GetUserGroup(user).Equals(groupId)) return;
LeaveGroup(user);
if (GetSessionGroup(session).Equals(groupId)) return;
LeaveGroup(session);
}
ISyncplayController group;
@ -154,28 +154,28 @@ namespace Emby.Server.Implementations.Syncplay
var update = new SyncplayGroupUpdate<string>();
update.Type = SyncplayGroupUpdateType.NotInGroup;
_sessionManager.SendSyncplayGroupUpdate(user.Id.ToString(), update, CancellationToken.None);
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), update, CancellationToken.None);
return;
}
group.UserJoin(user);
group.SessionJoin(session);
}
/// <inheritdoc />
public void LeaveGroup(SessionInfo user)
public void LeaveGroup(SessionInfo session)
{
ISyncplayController group;
_userToGroupMap.TryGetValue(user.Id, out group);
_sessionToGroupMap.TryGetValue(session.Id, out group);
if (group == null)
{
_logger.LogWarning("Syncplaymanager HandleRequest: " + user.Id + " not in group.");
_logger.LogWarning("Syncplaymanager HandleRequest: " + session.Id + " not in group.");
var update = new SyncplayGroupUpdate<string>();
update.Type = SyncplayGroupUpdateType.NotInGroup;
_sessionManager.SendSyncplayGroupUpdate(user.Id.ToString(), update, CancellationToken.None);
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), update, CancellationToken.None);
return;
}
group.UserLeave(user);
group.SessionLeave(session);
if (group.IsGroupEmpty())
{
@ -184,13 +184,13 @@ namespace Emby.Server.Implementations.Syncplay
}
/// <inheritdoc />
public List<GroupInfoView> ListGroups(SessionInfo user)
public List<GroupInfoView> ListGroups(SessionInfo session)
{
// Filter by playing item if the user is viewing something already
if (user.NowPlayingItem != null)
if (session.NowPlayingItem != null)
{
return _groups.Values.Where(
group => group.GetPlayingItemId().Equals(user.FullNowPlayingItem.Id)
group => group.GetPlayingItemId().Equals(session.FullNowPlayingItem.Id)
).Select(
group => group.GetInfo()
).ToList();
@ -205,47 +205,47 @@ namespace Emby.Server.Implementations.Syncplay
}
/// <inheritdoc />
public void HandleRequest(SessionInfo user, SyncplayRequestInfo request)
public void HandleRequest(SessionInfo session, SyncplayRequestInfo request)
{
ISyncplayController group;
_userToGroupMap.TryGetValue(user.Id, out group);
_sessionToGroupMap.TryGetValue(session.Id, out group);
if (group == null)
{
_logger.LogWarning("Syncplaymanager HandleRequest: " + user.Id + " not in group.");
_logger.LogWarning("Syncplaymanager HandleRequest: " + session.Id + " not in group.");
var update = new SyncplayGroupUpdate<string>();
update.Type = SyncplayGroupUpdateType.NotInGroup;
_sessionManager.SendSyncplayGroupUpdate(user.Id.ToString(), update, CancellationToken.None);
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), update, CancellationToken.None);
return;
}
group.HandleRequest(user, request);
group.HandleRequest(session, request);
}
/// <inheritdoc />
public void MapUserToGroup(SessionInfo user, ISyncplayController group)
public void MapSessionToGroup(SessionInfo session, ISyncplayController group)
{
if (IsUserInGroup(user))
if (IsSessionInGroup(session))
{
throw new InvalidOperationException("User in other group already!");
throw new InvalidOperationException("Session in other group already!");
}
_userToGroupMap[user.Id] = group;
_sessionToGroupMap[session.Id] = group;
}
/// <inheritdoc />
public void UnmapUserFromGroup(SessionInfo user, ISyncplayController group)
public void UnmapSessionFromGroup(SessionInfo session, ISyncplayController group)
{
if (!IsUserInGroup(user))
if (!IsSessionInGroup(session))
{
throw new InvalidOperationException("User not in any group!");
throw new InvalidOperationException("Session not in any group!");
}
ISyncplayController tempGroup;
_userToGroupMap.Remove(user.Id, out tempGroup);
_sessionToGroupMap.Remove(session.Id, out tempGroup);
if (!tempGroup.GetGroupId().Equals(group.GetGroupId()))
{
throw new InvalidOperationException("User was in wrong group!");
throw new InvalidOperationException("Session was in wrong group!");
}
}
}

View File

@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Syncplay
public class GroupInfo
{
/// <summary>
/// Default ping value used for users.
/// Default ping value used for sessions.
/// </summary>
public readonly long DefaulPing = 500;
/// <summary>
@ -53,85 +53,85 @@ namespace MediaBrowser.Controller.Syncplay
new ConcurrentDictionary<string, GroupMember>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Checks if a user is in this group.
/// Checks if a session is in this group.
/// </summary>
/// <value><c>true</c> if the user is in this group; <c>false</c> otherwise.</value>
public bool ContainsUser(string sessionId)
/// <value><c>true</c> if the session is in this group; <c>false</c> otherwise.</value>
public bool ContainsSession(string sessionId)
{
return Partecipants.ContainsKey(sessionId);
}
/// <summary>
/// Adds the user to the group.
/// Adds the session to the group.
/// </summary>
/// <param name="user">The session.</param>
public void AddUser(SessionInfo user)
/// <param name="session">The session.</param>
public void AddSession(SessionInfo session)
{
if (ContainsUser(user.Id.ToString())) return;
if (ContainsSession(session.Id.ToString())) return;
var member = new GroupMember();
member.Session = user;
member.Session = session;
member.Ping = DefaulPing;
member.IsBuffering = false;
Partecipants[user.Id.ToString()] = member;
Partecipants[session.Id.ToString()] = member;
}
/// <summary>
/// Removes the user from the group.
/// Removes the session from the group.
/// </summary>
/// <param name="user">The session.</param>
/// <param name="session">The session.</param>
public void RemoveUser(SessionInfo user)
public void RemoveSession(SessionInfo session)
{
if (!ContainsUser(user.Id.ToString())) return;
if (!ContainsSession(session.Id.ToString())) return;
GroupMember member;
Partecipants.Remove(user.Id.ToString(), out member);
Partecipants.Remove(session.Id.ToString(), out member);
}
/// <summary>
/// Updates the ping of a user.
/// Updates the ping of a session.
/// </summary>
/// <param name="user">The session.</param>
/// <param name="session">The session.</param>
/// <param name="ping">The ping.</param>
public void UpdatePing(SessionInfo user, long ping)
public void UpdatePing(SessionInfo session, long ping)
{
if (!ContainsUser(user.Id.ToString())) return;
Partecipants[user.Id.ToString()].Ping = ping;
if (!ContainsSession(session.Id.ToString())) return;
Partecipants[session.Id.ToString()].Ping = ping;
}
/// <summary>
/// Gets the highest ping in the group.
/// </summary>
/// <value name="user">The highest ping in the group.</value>
/// <value name="session">The highest ping in the group.</value>
public long GetHighestPing()
{
long max = Int64.MinValue;
foreach (var user in Partecipants.Values)
foreach (var session in Partecipants.Values)
{
max = Math.Max(max, user.Ping);
max = Math.Max(max, session.Ping);
}
return max;
}
/// <summary>
/// Sets the user's buffering state.
/// Sets the session's buffering state.
/// </summary>
/// <param name="user">The session.</param>
/// <param name="session">The session.</param>
/// <param name="isBuffering">The state.</param>
public void SetBuffering(SessionInfo user, bool isBuffering)
public void SetBuffering(SessionInfo session, bool isBuffering)
{
if (!ContainsUser(user.Id.ToString())) return;
Partecipants[user.Id.ToString()].IsBuffering = isBuffering;
if (!ContainsSession(session.Id.ToString())) return;
Partecipants[session.Id.ToString()].IsBuffering = isBuffering;
}
/// <summary>
/// Gets the group buffering state.
/// </summary>
/// <value><c>true</c> if there is a user buffering in the group; <c>false</c> otherwise.</value>
/// <value><c>true</c> if there is a session buffering in the group; <c>false</c> otherwise.</value>
public bool IsBuffering()
{
foreach (var user in Partecipants.Values)
foreach (var session in Partecipants.Values)
{
if (user.IsBuffering) return true;
if (session.IsBuffering) return true;
}
return false;
}

View File

@ -28,29 +28,29 @@ namespace MediaBrowser.Controller.Syncplay
bool IsGroupEmpty();
/// <summary>
/// Initializes the group with the user's info.
/// Initializes the group with the session's info.
/// </summary>
/// <param name="user">The session.</param>
void InitGroup(SessionInfo user);
/// <param name="session">The session.</param>
void InitGroup(SessionInfo session);
/// <summary>
/// Adds the user to the group.
/// Adds the session to the group.
/// </summary>
/// <param name="user">The session.</param>
void UserJoin(SessionInfo user);
/// <param name="session">The session.</param>
void SessionJoin(SessionInfo session);
/// <summary>
/// Removes the user from the group.
/// Removes the session from the group.
/// </summary>
/// <param name="user">The session.</param>
void UserLeave(SessionInfo user);
/// <param name="session">The session.</param>
void SessionLeave(SessionInfo session);
/// <summary>
/// Handles the requested action by the user.
/// Handles the requested action by the session.
/// </summary>
/// <param name="user">The session.</param>
/// <param name="session">The session.</param>
/// <param name="request">The requested action.</param>
void HandleRequest(SessionInfo user, SyncplayRequestInfo request);
void HandleRequest(SessionInfo session, SyncplayRequestInfo request);
/// <summary>
/// Gets the info about the group for the clients.

View File

@ -13,50 +13,50 @@ namespace MediaBrowser.Controller.Syncplay
/// <summary>
/// Creates a new group.
/// </summary>
/// <param name="user">The user that's creating the group.</param>
void NewGroup(SessionInfo user);
/// <param name="session">The session that's creating the group.</param>
void NewGroup(SessionInfo session);
/// <summary>
/// Adds the user to a group.
/// Adds the session to a group.
/// </summary>
/// <param name="user">The session.</param>
/// <param name="session">The session.</param>
/// <param name="groupId">The group id.</param>
void JoinGroup(SessionInfo user, string groupId);
void JoinGroup(SessionInfo session, string groupId);
/// <summary>
/// Removes the user from a group.
/// Removes the session from a group.
/// </summary>
/// <param name="user">The session.</param>
void LeaveGroup(SessionInfo user);
/// <param name="session">The session.</param>
void LeaveGroup(SessionInfo session);
/// <summary>
/// Gets list of available groups for a user.
/// Gets list of available groups for a session.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="session">The session.</param>
/// <value>The list of available groups.</value>
List<GroupInfoView> ListGroups(SessionInfo user);
List<GroupInfoView> ListGroups(SessionInfo session);
/// <summary>
/// Handle a request by a user in a group.
/// Handle a request by a session in a group.
/// </summary>
/// <param name="user">The session.</param>
/// <param name="session">The session.</param>
/// <param name="request">The request.</param>
void HandleRequest(SessionInfo user, SyncplayRequestInfo request);
void HandleRequest(SessionInfo session, SyncplayRequestInfo request);
/// <summary>
/// Maps a user to a group.
/// Maps a session to a group.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="session">The session.</param>
/// <param name="group">The group.</param>
/// <exception cref="InvalidOperationException"></exception>
void MapUserToGroup(SessionInfo user, ISyncplayController group);
void MapSessionToGroup(SessionInfo session, ISyncplayController group);
/// <summary>
/// Unmaps a user from a group.
/// Unmaps a session from a group.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="session">The session.</param>
/// <param name="group">The group.</param>
/// <exception cref="InvalidOperationException"></exception>
void UnmapUserFromGroup(SessionInfo user, ISyncplayController group);
void UnmapSessionFromGroup(SessionInfo session, ISyncplayController group);
}
}