diff --git a/README.md b/README.md
index b1c8b81..c3cbdaf 100644
--- a/README.md
+++ b/README.md
@@ -5,14 +5,11 @@ Movim is a decentralized social network, written in PHP and HTML5 and based on t
Warning: BETA.
-Current Movim version : 20150818.
+Current Movim version : 20150824.
**Changelog**
-0.8.1b 2015-08-24
-- Revert to Movim 20150818 to fix a bug (instant disconnect after login)
-
-0.8b 2015-08-23
+0.8b 2015-08-24
- Added language selection : ar, de, es, it, ja, nl, ru
- Fix URL in manifest.json (was https://https://...)
- Public/Private policy changed. The SSO portal is not used anymore
@@ -20,7 +17,7 @@ Current Movim version : 20150818.
This change was necessary for public content (blog)
- Add dedicated php-fpm pool for Movim
- Protect /log and /config properly
-- Update to upstream Movim 20150821
+- Update to upstream Movim 20150824
- Fix #6 and #7
0.7b 2015-08-20
diff --git a/sources/app/helpers/StringHelper.php b/sources/app/helpers/StringHelper.php
index 3bd3ff3..3a6edce 100644
--- a/sources/app/helpers/StringHelper.php
+++ b/sources/app/helpers/StringHelper.php
@@ -224,7 +224,12 @@ function cleanJid($jid)
*/
function explodeJid($jid)
{
- list($jid, $resource) = explode('/', $jid);
+ $arr = explode('/', $jid);
+ $jid = $arr[0];
+
+ if(isset($arr[1])) $resource = $arr[1];
+ else $resource = null;
+
list($username, $server) = explode('@', $jid);
return array(
diff --git a/sources/app/models/contact/Contact.php b/sources/app/models/contact/Contact.php
index 3da798b..d657101 100644
--- a/sources/app/models/contact/Contact.php
+++ b/sources/app/models/contact/Contact.php
@@ -259,9 +259,9 @@ class Contact extends Model {
}
public function setVcard4($vcard) {
- if(isset($vcard->bday->date) && !empty((string)$vcard->bday->date))
+ if(isset($vcard->bday->date))
$this->date = (string)$vcard->bday->date;
- else
+ if(empty($this->date))
$this->date = null;
$this->name = (string)$vcard->nickname->text;
diff --git a/sources/app/models/postn/PostnDAO.php b/sources/app/models/postn/PostnDAO.php
index bc135d3..3889783 100644
--- a/sources/app/models/postn/PostnDAO.php
+++ b/sources/app/models/postn/PostnDAO.php
@@ -359,6 +359,28 @@ class PostnDAO extends SQL {
return $this->run('ContactPostn');
}
+
+ function getMe($limitf = false, $limitr = false) {
+ $this->_sql = '
+ select *, postn.aid, privacy.value as privacy from postn
+ left outer join contact on postn.aid = contact.jid
+ left outer join privacy on postn.nodeid = privacy.pkey
+ where postn.origin = :origin and postn.node = \'urn:xmpp:microblog:0\'
+ order by postn.published desc
+ ';
+
+ if($limitr)
+ $this->_sql = $this->_sql.' limit '.$limitr.' offset '.$limitf;
+
+ $this->prepare(
+ 'Postn',
+ array(
+ 'origin' => $this->_user
+ )
+ );
+
+ return $this->run('ContactPostn');
+ }
function getPublic($origin, $node, $limitf = false, $limitr = false) {
$this->_sql = '
select *, postn.aid, privacy.value as privacy from postn
diff --git a/sources/app/widgets/Chat/chat.css b/sources/app/widgets/Chat/chat.css
index 3477028..d2c7144 100644
--- a/sources/app/widgets/Chat/chat.css
+++ b/sources/app/widgets/Chat/chat.css
@@ -1,7 +1,7 @@
#chat_header.encrypted:after{
content: "";
display: inline-block;
- font-family: "Material Design Iconic Font";
+ font-family: "Material Design Iconic Font";
content: "\f041";
font-size: 2.5rem;
margin-left: 1rem;
@@ -19,7 +19,7 @@
#chat_widget .chat_box ul {
margin: 0 auto;
max-width: 100rem;
- margin-left: calc(50% - 51rem);
+ margin-left: calc(45% - 49rem);
}
#chat_widget .chat_box form {
@@ -61,12 +61,16 @@
margin-top: 0.85rem;
}
-#chat_widget li img {
+#chat_widget li img:not(.emoji) {
max-height: 30rem;
max-width: 100%;
display: block;
}
+#chat_widget li img.emoji {
+ padding: 0 0.25rem;
+}
+
#chat_widget li.room {
min-height: 3rem;
margin-bottom: 0.5rem;
diff --git a/sources/app/widgets/Chat/chat.js b/sources/app/widgets/Chat/chat.js
index 9531754..afa727d 100644
--- a/sources/app/widgets/Chat/chat.js
+++ b/sources/app/widgets/Chat/chat.js
@@ -121,6 +121,13 @@ var Chat = {
}
}
+MovimWebsocket.attach(function() {
+ var jid = document.querySelector('#chat_widget').dataset.jid;
+ if(jid) {
+ Chat_ajaxGet(jid);
+ }
+});
+
Upload.attach(function() {
var textarea = document.querySelector('#chat_textarea');
textarea.value = Upload.get + ' ' + textarea.value;
diff --git a/sources/app/widgets/Chat/chat.tpl b/sources/app/widgets/Chat/chat.tpl
index a21c0aa..2d520c6 100644
--- a/sources/app/widgets/Chat/chat.tpl
+++ b/sources/app/widgets/Chat/chat.tpl
@@ -1,10 +1,3 @@
-
+
{$c->prepareEmpty()}
- {if="$jid"}
-
- {/if}
diff --git a/sources/app/widgets/Chats/Chats.php b/sources/app/widgets/Chats/Chats.php
index 1c8c823..6c3f920 100644
--- a/sources/app/widgets/Chats/Chats.php
+++ b/sources/app/widgets/Chats/Chats.php
@@ -15,6 +15,8 @@ class Chats extends WidgetBase
$this->registerEvent('carbons', 'onMessage');
$this->registerEvent('message', 'onMessage');
$this->registerEvent('presence', 'onPresence', 'chat');
+ $this->registerEvent('composing', 'onComposing');
+ $this->registerEvent('paused', 'onPaused');
}
function onMessage($packet)
@@ -56,6 +58,29 @@ class Chats extends WidgetBase
}
}
+ function onComposing($array)
+ {
+ $this->setState($array, $this->__('chats.composing'));
+ }
+
+ function onPaused($array)
+ {
+ $this->setState($array, $this->__('chats.paused'));
+ }
+
+ private function setState($array, $message)
+ {
+ list($from, $to) = $array;
+ if($from == $this->user->getLogin()) {
+ $jid = $to;
+ } else {
+ $jid = $from;
+ }
+
+ RPC::call('movim_replace', $jid.'_chat_item', $this->prepareChat($jid, $message));
+ RPC::call('Chats.refresh');
+ }
+
/**
* @brief Get history
*/
@@ -67,7 +92,7 @@ class Chats extends WidgetBase
$messages = $md->getContact(echapJid($jid), 0, 1);
$g = new \Moxl\Xec\Action\MAM\Get;
- $g->setJid($jid);
+ $g->setJid(echapJid($jid));
if(!empty($messages)) {
$g->setStart(strtotime($messages[0]->published));
@@ -156,7 +181,7 @@ class Chats extends WidgetBase
return $view->draw('_chats', true);
}
- function prepareChat($jid)
+ function prepareChat($jid, $status = null)
{
if(!$this->validateJid($jid)) return;
@@ -180,6 +205,8 @@ class Chats extends WidgetBase
$view->assign('caps', null);
}
+ $view->assign('status', $status);
+
$m = $md->getContact($jid, 0, 1);
if(isset($m)) {
$view->assign('message', $m[0]);
diff --git a/sources/app/widgets/Chats/_chats_item.tpl b/sources/app/widgets/Chats/_chats_item.tpl
index 798f6b9..cb566fd 100644
--- a/sources/app/widgets/Chats/_chats_item.tpl
+++ b/sources/app/widgets/Chats/_chats_item.tpl
@@ -26,12 +26,16 @@
{/if}
{$contact->getTrueName()}
- {if="isset($message)"}
-
{$message->published|strtotime|prepareDate}
- {if="preg_match('#^\?OTR#', $message->body)"}
-
{$c->__('message.encrypted')}
- {else}
-
{$message->body|prepareString|strip_tags}
+ {if="isset($status)"}
+
{$status}
+ {else}
+ {if="isset($message)"}
+
{$message->published|strtotime|prepareDate}
+ {if="preg_match('#^\?OTR#', $message->body)"}
+
{$c->__('message.encrypted')}
+ {else}
+
{$message->body|prepareString|strip_tags}
+ {/if}
{/if}
{/if}
diff --git a/sources/app/widgets/Chats/locales.ini b/sources/app/widgets/Chats/locales.ini
index 46e51c3..18770ee 100644
--- a/sources/app/widgets/Chats/locales.ini
+++ b/sources/app/widgets/Chats/locales.ini
@@ -4,6 +4,8 @@ empty = Open a new conversation by clicking on the plus button bello
add = Chat with a contact
frequent = Frequent contacts
more = Load more contacts
+composing = Composing...
+paused = Paused...
[message]
encrypted = Encrypted message
diff --git a/sources/app/widgets/Group/locales.ini b/sources/app/widgets/Group/locales.ini
index 9dec033..40a499b 100644
--- a/sources/app/widgets/Group/locales.ini
+++ b/sources/app/widgets/Group/locales.ini
@@ -20,6 +20,6 @@ subscriptions = Subscriptions
servers = Groups servers
search_server = Search for a new server
help_info1 = "Groups are the perfect way to share posts about topics that you like with all the other Movim's users."
-help_info2 = Choose a server and a Group and subscribe to it using the %s button in the header. You can alse create a new one using the %s button.
+help_info2 = Choose a server and a Group and subscribe to it using the %s button in the header. You can also create a new one using the %s button.
help_info3 = Done? You can now publish a new post in the Group by using the %s button.
help_info4 = You will find a list of all your subscribed Groups in My Subscriptions and receive instantly all the new incoming posts in the %sNews%s page.
diff --git a/sources/app/widgets/Header/_header_news.tpl b/sources/app/widgets/Header/_header_news.tpl
index 1d48633..e8f8425 100644
--- a/sources/app/widgets/Header/_header_news.tpl
+++ b/sources/app/widgets/Header/_header_news.tpl
@@ -6,8 +6,9 @@
{$c->__('menu.all')}
- {$c->__('menu.groups')}
- {$c->__('menu.contacts')}
+ {$c->__('menu.groups')}
+ {$c->__('menu.contacts')}
+ {$c->__('menu.me')}
diff --git a/sources/app/widgets/Header/locales.ini b/sources/app/widgets/Header/locales.ini
index b660792..1f4ddc5 100644
--- a/sources/app/widgets/Header/locales.ini
+++ b/sources/app/widgets/Header/locales.ini
@@ -3,6 +3,7 @@ all = All
groups = Groups
contacts = Contacts
refresh = Refresh all the streams
+me = My publications
[roster]
search = Search in your contacts
diff --git a/sources/app/widgets/Menu/Menu.php b/sources/app/widgets/Menu/Menu.php
index f2f4b11..cad6d22 100644
--- a/sources/app/widgets/Menu/Menu.php
+++ b/sources/app/widgets/Menu/Menu.php
@@ -75,6 +75,11 @@ class Menu extends WidgetBase
$this->ajaxGet('node', $server, $node, $page);
}
+ function ajaxGetMe($page = 0)
+ {
+ $this->ajaxGet('me', null, null, $page);
+ }
+
function ajaxGet($type = 'all', $server = null, $node = null, $page = 0)
{
$html = $this->prepareList($type, $server, $node, $page);
@@ -129,6 +134,10 @@ class Menu extends WidgetBase
$view->assign('history', $this->call('ajaxGetFeed', $next));
$items = $pd->getFeed($page * $this->_paging + $count, $this->_paging);
break;
+ case 'me' :
+ $view->assign('history', $this->call('ajaxGetMe', $next));
+ $items = $pd->getMe($page * $this->_paging + $count, $this->_paging);
+ break;
case 'node' :
$view->assign('history', $this->call('ajaxGetNode', '"'.$server.'"', '"'.$node.'"', '"'.$next.'"'));
$items = $pd->getNode($server, $node, $page * $this->_paging + $count, $this->_paging);
diff --git a/sources/app/widgets/Navigation/navigation.tpl b/sources/app/widgets/Navigation/navigation.tpl
index 4f42def..efd6f20 100644
--- a/sources/app/widgets/Navigation/navigation.tpl
+++ b/sources/app/widgets/Navigation/navigation.tpl
@@ -27,7 +27,7 @@
-
+
{$c->__('page.contacts')}
diff --git a/sources/app/widgets/Notification/notification.js b/sources/app/widgets/Notification/notification.js
index 9d409c8..6a8cf24 100644
--- a/sources/app/widgets/Notification/notification.js
+++ b/sources/app/widgets/Notification/notification.js
@@ -76,11 +76,11 @@ var Notification = {
},
toast : function(html) {
target = document.getElementById('toast');
-
+
if(target) {
target.innerHTML = html;
}
-
+
setTimeout(function() {
target = document.getElementById('toast');
target.innerHTML = '';
@@ -91,11 +91,11 @@ var Notification = {
if(Notification.inhibed == true) return;
target = document.getElementById('snackbar');
-
+
if(target) {
target.innerHTML = html;
}
-
+
setTimeout(function() {
target = document.getElementById('snackbar');
target.innerHTML = '';
@@ -105,7 +105,7 @@ var Notification = {
desktop : function(title, body, picture) {
if(Notification.inhibed == true
|| Notification.focused) return;
-
+console.log(DesktopNotification);
var notification = new DesktopNotification(title, { icon: picture, body: body });
}
}
diff --git a/sources/app/widgets/Notifs/Notifs.php b/sources/app/widgets/Notifs/Notifs.php
index 0fd7ea5..72c466f 100644
--- a/sources/app/widgets/Notifs/Notifs.php
+++ b/sources/app/widgets/Notifs/Notifs.php
@@ -37,11 +37,20 @@ class Notifs extends WidgetBase
$this->registerEvent('presence_subscribed_handle', 'onNotifs');
}
- function onNotifs($packet = false)
+ function onNotifs($from = false)
{
$html = $this->prepareNotifs();
RPC::call('movim_fill', 'notifs_widget', $html);
RPC::call('Notifs.refresh');
+
+ if(is_string($from)) {
+ $cd = new \Modl\ContactDAO;
+ $contact = $cd->get($from);
+
+ $avatar = $contact->getPhoto('s');
+ if($avatar == false) $avatar = null;
+ Notification::append('invite|'.$from, $contact->getTrueName(), $this->__('notifs.wants_to_talk', $contact->getTrueName()), $avatar, 4);
+ }
}
function ajaxGet()
@@ -118,6 +127,7 @@ class Notifs extends WidgetBase
unset($notifs[$jid]);
$session->set('activenotifs', $notifs);
+ Notification::ajaxClear('invite|'.$jid);
}
function ajaxRefuse($jid)
@@ -137,15 +147,6 @@ class Notifs extends WidgetBase
$session->set('activenotifs', $notifs);
$this->onNotifs();
- }
-
- function genCallAccept($jid)
- {
- return $this->call('ajaxAccept', "'".$jid."'");
- }
-
- function genCallRefuse($jid)
- {
- return $this->call('ajaxRefuse', "'".$jid."'");
+ Notification::ajaxClear('invite|'.$jid);
}
}
diff --git a/sources/app/widgets/Rooms/Rooms.php b/sources/app/widgets/Rooms/Rooms.php
index 3e3b200..aaea47a 100644
--- a/sources/app/widgets/Rooms/Rooms.php
+++ b/sources/app/widgets/Rooms/Rooms.php
@@ -12,6 +12,7 @@ class Rooms extends WidgetBase
function load()
{
$this->addjs('rooms.js');
+ $this->addcss('rooms.css');
$this->registerEvent('bookmark_set_handle', 'onBookmark');
$this->registerEvent('presence_muc_handle', 'onConnected');
$this->registerEvent('presence_unavailable_handle', 'onDisconnected');
diff --git a/sources/app/widgets/Rooms/_rooms.tpl b/sources/app/widgets/Rooms/_rooms.tpl
index bd82f66..6f03f8c 100644
--- a/sources/app/widgets/Rooms/_rooms.tpl
+++ b/sources/app/widgets/Rooms/_rooms.tpl
@@ -1,5 +1,5 @@
{if="!$c->supported('anonymous') && $c->getView() != 'room'"}
-