Browse Source

- Put the default Messages as type 'chat'

- New feature, you can now click on a nickname in a MUC to quote it
- Fix the pubsub post retraction handle
- Display more clearly if we are connected on a MUC, or not
pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
9df441e073
  1. 9
      app/models/message/Message.php
  2. 4
      app/models/postn/PostnDAO.php
  3. 4
      app/widgets/Chat/chat.css
  4. 12
      app/widgets/Chat/chat.js
  5. 8
      app/widgets/Menu/Menu.php
  6. 2
      app/widgets/Rooms/Rooms.php
  7. 2
      app/widgets/Rooms/_rooms.tpl
  8. 2
      app/widgets/Rooms/_rooms_list.tpl

9
app/models/message/Message.php

@ -67,9 +67,12 @@ class Message extends Model {
if(isset($jid[1]))
$this->resource = $jid[1];
$this->type = (string)$stanza->attributes()->type;
$this->type = 'chat';
if($stanza->attributes()->type) {
$this->type = (string)$stanza->attributes()->type;
}
$this->body = (string)$stanza->body;
$this->subject = (string)$stanza->subject;

4
app/models/postn/PostnDAO.php

@ -174,7 +174,7 @@ class PostnDAO extends SQL {
)
);
return $this->run('Message');
return $this->run('Postn');
}
function deleteNode($origin, $node) {
@ -191,7 +191,7 @@ class PostnDAO extends SQL {
)
);
return $this->run('Message');
return $this->run('Postn');
}
function getNode($from, $node, $limitf = false, $limitr = false) {

4
app/widgets/Chat/chat.css

@ -76,6 +76,10 @@
margin-right: 1rem;
}
#chat_widget li.room span.user:hover {
cursor: pointer;
}
#chat_widget .placeholder {
padding-top: 37em;
background-size: 35rem 35rem;

12
app/widgets/Chat/chat.js

@ -52,7 +52,8 @@ var Chat = {
var id = null;
if(message.type == 'groupchat') {
bubble = Chat.room;
bubble = Chat.room.cloneNode(true);
id = message.jidfrom + '_conversation';
if(message.body.match(/^\/me/)) {
@ -63,9 +64,16 @@ var Chat = {
bubble.querySelector('div').innerHTML = message.body;
bubble.querySelector('span.info').innerHTML = message.published;
bubble.querySelector('span.user').className = 'user ' + message.color;
bubble.querySelector('span.user').onclick = function(n) {
var textarea = document.querySelector('#chat_textarea');
textarea.value = this.innerHTML + ', ' + textarea.value;
textarea.focus();
};
bubble.querySelector('span.user').innerHTML = message.resource;
movim_append(id, bubble.outerHTML);
document.getElementById(id).appendChild(bubble);
bubble.querySelector('div').className = '';
} else {
if(message.session == message.jidfrom) {

8
app/widgets/Menu/Menu.php

@ -9,9 +9,15 @@ class Menu extends WidgetBase
function load()
{
$this->registerEvent('post', 'onPost');
$this->registerEvent('post_retract', 'onRetract');
$this->addjs('menu.js');
}
function onRetract($packet)
{
$this->ajaxGetAll();
}
function onStream($count)
{
$view = $this->tpl();
@ -31,7 +37,7 @@ class Menu extends WidgetBase
$post = $packet->content;
if($post->isMicroblog()) {
$cd = new \Modl\ContactDAO;
$contact = $cd->get($post->jid);
$contact = $cd->get($post->origin);
if($post->title == null) {
$title = __('post.default_title');

2
app/widgets/Rooms/Rooms.php

@ -35,12 +35,12 @@ class Rooms extends WidgetBase
$c->ajaxGet();
$this->refreshRooms();
Notification::append(null, $this->__('chatrooms.disconnected'));
}
private function refreshRooms()
{
RPC::call('movim_fill', 'rooms_widget', $this->prepareRooms());
Notification::append(null, $this->__('chatrooms.disconnected'));
RPC::call('Rooms.refresh');
}

2
app/widgets/Rooms/_rooms.tpl

@ -12,7 +12,7 @@
{if="$connected"}
<span class="icon bubble color {$value->name|stringToColor}"><i class="md md-people"></i></span>
{else}
<span class="icon bubble color {$value->name|stringToColor}"><i class="md md-people-outline"></i></span>
<span class="disabled icon bubble color {$value->name|stringToColor}"><i class="md md-people-outline"></i></span>
{/if}
<span>{$value->name}</span>
<p>{$value->conference}</p>

2
app/widgets/Rooms/_rooms_list.tpl

@ -40,6 +40,6 @@
</section>
<div>
<a onclick="Dialog.clear()" class="button flat">
{$c->__('button.cancel')}
{$c->__('button.close')}
</a>
</div>
Loading…
Cancel
Save