diff --git a/src/Yavsc.Server/NotificationTypes.cs b/src/Yavsc.Abstract/Messaging/NotificationTypes.cs similarity index 79% rename from src/Yavsc.Server/NotificationTypes.cs rename to src/Yavsc.Abstract/Messaging/NotificationTypes.cs index 94568868..b0c82f31 100644 --- a/src/Yavsc.Server/NotificationTypes.cs +++ b/src/Yavsc.Abstract/Messaging/NotificationTypes.cs @@ -7,9 +7,10 @@ namespace Yavsc public const string UserPart = "userpart"; public const string UserJoin = "userjoin"; public const string PrivateMessageDenied = "deniedpv"; - public const string Error = "error"; - public const string BookQuery = "bookQuery"; + public const string ContactRefused = "contact refused"; + public const string ExistingUserName ="existing user name"; + } } diff --git a/src/Yavsc.Server/ErrorMessages.cs b/src/Yavsc.Server/ErrorMessages.cs deleted file mode 100644 index f49c3069..00000000 --- a/src/Yavsc.Server/ErrorMessages.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Yavsc -{ - public static class ErrorMessages { - public const string ContactRefused = "contact refused"; - } -} diff --git a/src/Yavsc/Controllers/Contracting/CommandController.cs b/src/Yavsc/Controllers/Contracting/CommandController.cs index 6248c2bc..b4224132 100644 --- a/src/Yavsc/Controllers/Contracting/CommandController.cs +++ b/src/Yavsc/Controllers/Contracting/CommandController.cs @@ -191,7 +191,7 @@ namespace Yavsc.Controllers nrep = new MessageWithPayloadResponse { failure=1, results = new MessageWithPayloadResponse.Result[] { new MessageWithPayloadResponse.Result { - error=ErrorMessages.ContactRefused, + error=NotificationTypes.ContactRefused, registration_id= pro.PerformerId } } }; diff --git a/src/Yavsc/Hubs/.ChatHub.cs.swp b/src/Yavsc/Hubs/.ChatHub.cs.swp new file mode 100644 index 00000000..81ceb92a Binary files /dev/null and b/src/Yavsc/Hubs/.ChatHub.cs.swp differ diff --git a/src/Yavsc/Hubs/ChatHub.cs b/src/Yavsc/Hubs/ChatHub.cs index 2bf31021..4eb2b229 100644 --- a/src/Yavsc/Hubs/ChatHub.cs +++ b/src/Yavsc/Hubs/ChatHub.cs @@ -189,6 +189,17 @@ namespace Yavsc public string Topic; } + public void Nick(string nickName) + { + var candidate = "?"+nickName; + if (ChatUserNames.Any(u=> u.Value == candidate )) + { + Clients.Caller.notify(NotificationTypes.ExistingUserName, "name already used:"+nickName); + return ; + } + ChatUserNames[ Context.ConnectionId ] = "?"+nickName; + } + public void JoinAsync(string roomName) { var info = Join(roomName);