a PV
This commit is contained in:
@ -58,6 +58,16 @@ namespace Yavsc
|
||||
Clients.All.addMessage("#"+name,message);
|
||||
}
|
||||
|
||||
|
||||
[Authorize]
|
||||
public void PV (string userId, string message)
|
||||
{
|
||||
var sender = Context.User.Identity.Name;
|
||||
// TODO personal black|white list +
|
||||
// Contact list allowed only +
|
||||
// only pro
|
||||
var hubCxContext = Clients.User(userId);
|
||||
var cli = Clients.Client(hubCxContext.ConnectionId);
|
||||
cli.addPV(sender,message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,18 @@
|
||||
<div class="container">
|
||||
<input type="text" id="message" />
|
||||
<input type="button" id="sendmessage" value="Send" />
|
||||
|
||||
<input type="hidden" id="displayname" />
|
||||
<select id="to" >
|
||||
@foreach (var contact in ViewBag.Contacts) {
|
||||
<option>@contact.UserName</option>
|
||||
}
|
||||
</select>
|
||||
|
||||
<ul id="discussion">
|
||||
</ul>
|
||||
<ul id="private">
|
||||
</ul>
|
||||
</div>
|
||||
@section scripts {
|
||||
<!--Script references. -->
|
||||
@ -27,6 +36,11 @@
|
||||
$('#discussion').append('<li><strong>' + htmlEncode(name)
|
||||
+ '</strong>: ' + htmlEncode(message) + '</li>');
|
||||
};
|
||||
chat.client.PV = function (name, message) {
|
||||
// Add the pv to the page.
|
||||
$('#private').append('<li><strong>' + htmlEncode(name)
|
||||
+ '</strong>: ' + htmlEncode(message) + '</li>');
|
||||
};
|
||||
// Get the user name and store it to prepend to messages.
|
||||
$('#displayname').val(prompt('Enter your name:', ''));
|
||||
// Set initial focus to message input box.
|
||||
@ -39,6 +53,12 @@
|
||||
// Clear text box and reset focus for next comment.
|
||||
$('#message').val('').focus();
|
||||
});
|
||||
$('#sendpv').click(function () {
|
||||
// Call the Send method on the hub.
|
||||
chat.server.sendPV($('#to').val(), $('#message').val());
|
||||
// Clear text box and reset focus for next comment.
|
||||
$('#message').val('').focus();
|
||||
});
|
||||
});
|
||||
});
|
||||
// This optional function html-encodes messages for display in the page.
|
||||
|
Reference in New Issue
Block a user