diff --git a/rc-num.txt b/rc-num.txt
index 8a0f05e1..9e22bcb8 100644
--- a/rc-num.txt
+++ b/rc-num.txt
@@ -1 +1 @@
-01
+02
diff --git a/src/Yavsc/Hubs/ChatHub.cs b/src/Yavsc/Hubs/ChatHub.cs
index 81834394..09cd85d1 100644
--- a/src/Yavsc/Hubs/ChatHub.cs
+++ b/src/Yavsc/Hubs/ChatHub.cs
@@ -19,19 +19,17 @@
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see .
using Microsoft.AspNet.SignalR;
-using Microsoft.AspNet.SignalR.Hosting;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
+using System;
+using System.Collections.Concurrent;
+using Microsoft.Data.Entity;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
namespace Yavsc
{
- using System;
- using System.Collections.Concurrent;
- using Microsoft.AspNet.WebUtilities;
- using Microsoft.Data.Entity;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Logging;
using Models;
using Models.Chat;
@@ -113,7 +111,12 @@ namespace Yavsc
return Context.User.Identity.Name;
}
anonymousSequence++;
- var aname = $"{Constants.AnonymousUserNamePrefix}{anonymousSequence}";
+ var reqKeys = Context.Request.QueryString.Select(pv => pv.Key);
+ _logger.LogInformation(string.Join(" ", reqKeys));
+
+ var queryUname = Context.Request.QueryString[Constants.KeyParamChatUserName] ;
+
+ var aname = $"{Constants.AnonymousUserNamePrefix}{queryUname}{anonymousSequence}";
ChatUserNames[Context.ConnectionId]=aname;
_logger.LogInformation($"Anonymous chat user name set to : {aname}");
return aname;
diff --git a/src/Yavsc/Views/Home/Chat.cshtml b/src/Yavsc/Views/Home/Chat.cshtml
index 2ea78f1e..ef1bae5f 100644
--- a/src/Yavsc/Views/Home/Chat.cshtml
+++ b/src/Yavsc/Views/Home/Chat.cshtml
@@ -13,11 +13,10 @@
@if (!ViewBag.IsAuthenticated) { // Get the user name and store it to prepend to messages.
-}
+}
-
}
diff --git a/src/Yavsc/wwwroot/js/chat.js b/src/Yavsc/wwwroot/js/chat.js
index 53a963c6..1a2256fd 100644
--- a/src/Yavsc/wwwroot/js/chat.js
+++ b/src/Yavsc/wwwroot/js/chat.js
@@ -32,7 +32,6 @@
{
if (!full) throw "not implemented";
-
var chat = $.connection.chatHub
// Create a function that the hub can call back to display messages.
chat.client.addMessage = function (name, room, message) {
@@ -72,8 +71,7 @@
chat.client.onJoined = function (rinfo)
{
console.log(rinfo);
- $('#inp_'+rinfo.Name).prop('enable',true)
-
+ setActiveRoom(rinfo.Name);
}
$.fn.filterByData = function (prop, val) {
@@ -82,44 +80,54 @@
)
}
- var roomlist = $("
");
+ var activeRoom;
+ var activeRoomName;
+ var setActiveRoom = function(room) {
+ if (activeRoom) {
+ // TODO animate
+ activeRoom.addClass("hidden");
+ $("sel_"+activeRoomName).addClass("btn-primary");
+ }
+ activeRoom=$("#vroom_"+room);
+ activeRoomName=room;
+ activeRoom.removeClass("hidden");
+ }
+ var roomlist = $('');
roomlist.appendTo($view);
+ var chatlist = $('');
+ chatlist.appendTo($view);
var buildRoom = function (room)
{
- console.log('building:'+room);
-
- var roomTag = $(""+room+"");
- roomTag.addClass('btn').addClass('default')
+ var roomTag = $(""+room+"").addClass("btn").addClass("btn-primary");
+ roomTag.prop("id","sel_"+room)
.click(function(){
- setRoom(room)
+ setActiveRoom(room);
+ $(this).removeClass("btn-primary");
});
-
- var roomview = $("");
-
roomTag.appendTo(roomlist);
+ var roomview = $("").addClass("container");
+ roomview.appendTo(chatlist);
roomview.prop('id',"vroom_"+room);
- var msglist = $("
");
+ var msglist = $("
").addClass("mesglist");
msglist.prop('id',"room_"+room);
msglist.appendTo(roomview);
-
$("")
.prop('id','inp_'+room)
.prop('enable',false)
.prop('hint','hello')
.prop('title','send to '+room)
- .keydown(function(ev){
+ .addClass('form-control')
+ .keydown(function(ev) {
if (ev.which == 13) {
- console.log('sending:'+room+' '+this.value);
- chat.server.send(room, this.value)
- this.value=""
- }
- }).appendTo(roomview);
+ if (this.value.length==0) return;
+ console.log("sending to "+room+" "+this.value)
+ chat.server.send(room, this.value);
+ this.value="";
+ }}).appendTo(roomview);
chans.push(room);
- roomview.appendTo($view);
- console.log('done with built:');
- console.log(chans);
+ setActiveRoom(room);
}
// build a channel list
@@ -151,6 +159,7 @@
})
$.connection.hub.disconnected(function () {
+
onDisCx()
setTimeout(function () {
$.connection.hub.start().done(function () {
@@ -160,16 +169,19 @@
})
})
+
+
$("")
.appendTo($view);
var chanName = $("");
chanName.appendTo($view);
-
chanName.keydown(
function (event) {
if (event.which == 13) {
+ if (this.value.length==0) return;
buildRoom(this.value);
+ chat.server.join(this.value);
this.value=""
} else {
// TODO showRoomInfo(this.value);
@@ -180,15 +192,7 @@
ulist.appendTo($view);
- var activeRoom;
- var setRoom = function(room) {
- if (activeRoom) {
- // TODO animate
- activeRoom.addClass("hidden");
- }
- activeRoom=$("#vroom_"+room);
- activeRoom.removeClass("hidden")
- }
+
var pvuis
// TODO get this data from the chatview element
var audio = new Audio('/sounds/bell.mp3')
diff --git a/src/Yavsc/wwwroot/js/chat.min.js b/src/Yavsc/wwwroot/js/chat.min.js
index 2d40bb60..f748c643 100644
--- a/src/Yavsc/wwwroot/js/chat.min.js
+++ b/src/Yavsc/wwwroot/js/chat.min.js
@@ -1 +1 @@
-!function(t){var s,e=new Audio("/sounds/bell.mp3");function a(n,s){t('").data("name",n).data("cxids",s).css("cursor","pointer").click(function(){i(this)}).appendTo("#userlist")}function n(){setTimeout(function(){t("#userlist").empty(),t("#to").empty(),t.get("/api/chat/users").done(function(n){t.each(n,function(){var n=this,s=t("#userlist li").filterByData("name",n.UserName);0").text(n).html()}var i=function(n){t("#sendmessagebox").addClass("hidden"),t("#sendpvbox").removeClass("hidden"),s={CXs:t(n).data("cxids"),UserName:t(n).data("name")},t("#sendpvdest").html(s.UserName),t("#pv").focus()},c=function(){t("#sendmessagebox").removeClass("hidden"),t("#sendpvbox").addClass("hidden"),t("#message").focus()};t("#pubChan").css("cursor","pointer"),t("#pubChan").click(c),c();var d=t.connection.chatHub;d.client.addMessage=function(n,s){t("#discussion").append('
"),t("#pv").val("")};t.connection.hub.start().done(function(){n(),t("#sendmessage").click(function(){u(),t("#message").focus()}),t("#message").keydown(function(n){13==n.which&&u()}),t("#pv").keydown(function(n){13==n.which&&l()}),t("#sendpv").click(function(){l(),t("#sendpv").focus()})}),t.connection.hub.disconnected(function(){t("#chatview").addClass("disabled"),t("#sendmessage").prop("disabled",!0),t("#sendpv").prop("disabled",!0),setTimeout(function(){t.connection.hub.start().done(function(){t("#mySignalRConnectionIdHidden").val(t.connection.hub.id),n()},3e4)})}),t(window).unload(function(){d.server.abort()})}(jQuery);
\ No newline at end of file
+!function(C){var e=function(o,n){if(!n)throw"not implemented";var a=C.connection.chatHub;a.client.addMessage=function(n,e,i){C("#room_"+e).append('