Commit 6f62d49b authored by fred's avatar fred

chat: make it possible to kick

parent eaa4ffbb
......@@ -1963,3 +1963,18 @@ div#CurrentlyChatting {
div.description-emission-chat {
margin-bottom: 2em;
}
div.chatPart h3 {
padding-top: 0;
}
div#chat.moderation .msg-in span.from {
cursor: pointer;
}
div#chat.moderation .msg-in span.from:hover::after {
padding-left: 1ex;
font-family: FontAwesome;
content: "\f056";
font-size: 80%;
}
......@@ -552,10 +552,29 @@ $(function() {
/* CHAT */
if ($('#chat').length) {
var moderator = ($('#panikdb').length > 0);
var $msg = $('input#msg');
var $send = $('button#send');
var chat_roster = Object();
if (moderator) {
$('#chat').addClass('moderation');
$('#chat').on('click', 'span.from', function() {
var name = $(this).text();
if (confirm('Kick ' + name + ' ?')) {
var muc = $('div#chat').data('chatroom');
connection.muc.kick(muc + '@conf.panik', name,
'no reason',
function(iq) {
},
function(iq) {
doLog('error kicking', 'error');
}
);
}
});
}
if (window.localStorage['pa-nick'] !== undefined) {
$('.nick input').val(window.localStorage['pa-nick']);
}
......@@ -612,8 +631,21 @@ $(function() {
return true;
},
function(pres) {
var nick = $('.nick input').val()
var muc = $('div#chat').data('chatroom');
if (pres.getElementsByTagName('status').length == 1 &&
pres.getElementsByTagName('status')[0].attributes.code.value == '307') {
/* kicked */
var kicked = pres.getElementsByTagName('item')[0].attributes.nick.value;
var new_msg = $('<div class="msg info new"><span class="content">' + kicked + ' a été mis dehors.</span></div>').prependTo($('#chat'));
new_msg[0].offsetHeight; /* trigger reflow */
new_msg.removeClass('new');
if (kicked == nick) {
connection.disconnect();
$('div.nick').css('visibility', 'hidden');
}
}
if (pres.getElementsByTagName('conflict').length == 1) {
var nick = $('.nick input').val()
$('.nick input').val(nick + '_');
connection.disconnect();
$('.nick button').trigger('click');
......
......@@ -22,7 +22,7 @@
<div class="wrapper navigation">
<div class="leftPart">
<div class="leftPart chatPart">
{% if emission.subtitle %}<h3>{{ emission.subtitle }}</h3>{% endif %}
{% if emission.text %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment