Browse Source

- Complete the MUC implementation

- Fix compatibility with HipChat 
- Implement xHTML messages support
- Fix MUC div toggle
pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
1691f8d545
  1. 3
      app/models/message/Message.php
  2. 5
      app/models/message/MessageDAO.php
  3. 6
      app/models/session/SessionDAO.php
  4. 11
      app/widgets/Bookmark/Bookmark.php
  5. 26
      app/widgets/Chat/Chat.php
  6. 6
      app/widgets/Chat/chat.css
  7. 5
      app/widgets/Notification/Notification.php
  8. 2
      system/Session.php
  9. 2
      system/Utils.php

3
app/models/message/Message.php

@ -14,6 +14,7 @@ class Message extends ModlModel {
public $subject;
public $thread;
public $body;
public $html;
public $published;
public $delivered;
@ -37,6 +38,8 @@ class Message extends ModlModel {
{"type":"string", "size":128 },
"body" :
{"type":"text"},
"html" :
{"type":"text"},
"published" :
{"type":"date"},
"delivered" :

5
app/models/message/MessageDAO.php

@ -15,6 +15,7 @@ class MessageDAO extends ModlSQL {
subject,
thread,
body,
html,
published,
delivered)
values(
@ -26,6 +27,7 @@ class MessageDAO extends ModlSQL {
:subject,
:thread,
:body,
:html,
:published,
:delivered
)';
@ -41,8 +43,9 @@ class MessageDAO extends ModlSQL {
'subject' => $message->subject,
'thread' => $message->thread,
'body' => $message->body,
'html' => $message->html,
'published' => $message->published,
'delivered' =>$message->delivered
'delivered' => $message->delivered
)
);

6
app/models/session/SessionDAO.php

@ -3,8 +3,8 @@
namespace modl;
class SessionDAO extends ModlSQL {
function set($session, $container, $name, $value, $timestamp) {
$timestamp = date(DATE_ISO8601, $timestamp);
function set($session, $container, $name, $value) {
$timestamp = date(DATE_ISO8601);
$this->_sql = '
update session
@ -48,7 +48,7 @@ class SessionDAO extends ModlSQL {
}
}
function get($session, $container, $name) {
function get($session, $container, $name) {
$this->_sql = '
select * from session
where

11
app/widgets/Bookmark/Bookmark.php

@ -27,6 +27,8 @@ class Bookmark extends WidgetBase
$this->addcss('bookmark.css');
$this->registerEvent('bookmark', 'onBookmark');
$this->registerEvent('bookmarkerror', 'onBookmarkError');
//$this->registerEvent('mucrole', 'onMucRole');
$this->registerEvent('groupsubscribed', 'onGroupSubscribed');
$this->registerEvent('groupunsubscribed', 'onGroupUnsubscribed');
@ -118,13 +120,16 @@ class Bookmark extends WidgetBase
function onBookmark()
{
//Cache::c('bookmark', $arr);
$html = $this->prepareBookmark();
RPC::call('movim_fill', 'bookmarks', $html);
Notification::appendNotification(t('Bookmarks updated'), 'info');
}
/*
function onMucRole($arr)
{
}
*/
function onBookmarkError($error)
{
Notification::appendNotification(t('An error occured : ').$error, 'error');

26
app/widgets/Chat/Chat.php

@ -356,8 +356,14 @@ class Chat extends WidgetBase
'<div class="message ';
if($message->session == $message->jidfrom)
$html.= 'me';
$content = $message->body;
if(isset($message->html)) {
$type = 'html';
$content = $message->html;
} else {
$type = '';
$content = prepareString(htmlentities($message->body, ENT_COMPAT, "UTF-8"));
}
if(preg_match("#^/me#", $message->body)) {
$html .= ' own ';
@ -383,8 +389,8 @@ class Chat extends WidgetBase
</span>';
$html .=
'<div class="content">'.
prepareString(htmlentities($content, ENT_COMPAT, "UTF-8")).
'<div class="content '.$type.'">'.
$content.
'</div>
</div>';
return $html;
@ -536,8 +542,8 @@ class Chat extends WidgetBase
));
$sess = \Session::start(APP_NAME);
$state = $sess->get('muc'.$jid);
$state = $sess->get(md5('muc'.$jid));
$mucview->assign('conference', $conference);
$mucview->assign('muclist', $this->prepareMucList($jid));
@ -567,12 +573,14 @@ class Chat extends WidgetBase
function ajaxToggleMuc($jid)
{
$hash = md5('muc'.$jid);
$sess = \Session::start(APP_NAME);
$state = $sess->get('muc'.$jid);
$state = $sess->get($hash);
if($state == 1)
$sess->set('muc'.$jid, 0);
$sess->set($hash, 0);
else
$sess->set('muc'.$jid, 1);
$sess->set($hash, 1);
}
function colorNameMuc($ressource)

6
app/widgets/Chat/chat.css

@ -193,7 +193,7 @@
clear: both;
}
#chats .chat .panel .messages .message .content {
#chats .chat .panel .messages .message .content:not(.html) {
white-space: pre-wrap;
}
@ -293,6 +293,10 @@
#chats .muc .list ul li {
line-height: 1.5em;
padding: 0 0.5em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#chats .muc .panel:after {

5
app/widgets/Notification/Notification.php

@ -25,6 +25,7 @@ class Notification extends WidgetCommon
$this->addcss('notification.css');
$this->addjs('notification.js');
$this->registerEvent('pubsuberror', 'onPubsubError');
$this->registerEvent('moxlerror', 'onMoxlError');
}
static function appendNotification($message, $type = 'info')
@ -42,6 +43,10 @@ class Notification extends WidgetCommon
function onPubsubError($error) {
Notification::appendNotification($error, 'error');
}
function onMoxlError($arr) {
Notification::appendNotification($arr[1], 'error');
}
function build()
{

2
system/Session.php

@ -97,7 +97,7 @@ class Session
$value = base64_encode(serialize($value));
$sd = new modl\SessionDAO();
$sd->set(self::$sid, $this->container, $varname, $value, time());
$sd->set(self::$sid, $this->container, $varname, $value);
return $value;
}

2
system/Utils.php

@ -705,7 +705,7 @@ function movim_log($log) {
\system\Logs\Logger::log($log);
openlog('movim', LOG_NDELAY, LOG_USER);
$errlines = explode("\n", serialize($log));
$errlines = explode("\n", $log);
foreach ($errlines as $txt) { syslog(LOG_DEBUG, $txt); }
closelog();
}

Loading…
Cancel
Save