Browse Source

- Update the favicon

- Fix the avatar in comments
- CSS fixs
- Add a SDPtoJingle library to convert easily the SDP in Jingle stanza + first shot
- Create a Visio.call() function to call directly the main window
- Create a generateKey() function to generate easily a random key
pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
819bbc2102
  1. 12
      app/assets/js/movim_rpc.js
  2. 8
      app/models/contact/Contact.php
  3. 2
      app/widgets/Connection/Connection.php
  4. 165
      app/widgets/Visio/visio.css
  5. 37
      app/widgets/Visio/visio.js
  6. 4
      app/widgets/Visio/webrtc.js
  7. 7
      app/widgets/VisioExt/VisioExt.php
  8. 3
      bootstrap.php
  9. 102
      lib/SDPtoJingle.php
  10. 10
      system/Sessionx.php
  11. 25
      system/Utils.php
  12. 1
      themes/movim/css/forms.css
  13. 1
      themes/movim/css/style.css
  14. BIN
      themes/movim/favicon.xcf
  15. BIN
      themes/movim/img/favicon.ico

12
app/assets/js/movim_rpc.js

@ -101,11 +101,13 @@ function MovimRPC()
for(h = 0; h < funcalls.length; h++) {
var funcall = funcalls[h];
try {
window[funcall.func](funcall.params);
}
catch(err) {
console.log("Error caught: " + err.toString() + " - " +funcall.func);
if(funcall.func) {
try {
window[funcall.func](funcall.params);
}
catch(err) {
console.log("Error caught: " + err.toString() + " - " +funcall.func);
}
}
}
}

8
app/models/contact/Contact.php

@ -177,14 +177,14 @@ class Contact extends ModlModel {
if($size == 'email') {
$str = BASE_URI.'cache/'.strtolower($this->jid).'_email.jpg';
} else {
$jid = strtolower($jid);
if($jid != false) {
$jid = strtolower($jid);
if($jid != false && file_exists(CACHE_PATH.$jid.'_'.$size.'.jpg')) {
$str = BASE_URI.'cache/'.strtolower($jid).'_'.$size.'.jpg';
} elseif(
isset($this->phototype)
&& isset($this->photobin)
&& $this->phototype != ''
&& $this->photobin != ''
&& (string)$this->phototype != ''
&& (string)$this->photobin != ''
) {
$str = BASE_URI.'cache/'.strtolower($this->jid).'_'.$size.'.jpg';
} else {

2
app/widgets/Connection/Connection.php

@ -31,8 +31,6 @@ class Connection extends WidgetBase
if($value >= 10) {
$value = floor(($value-10)/10);
RPC::call('Session.rollback');
if($value == 0)
RPC::call('movim_fill', 'countdown', '');
else {

165
app/widgets/Visio/visio.css

@ -26,9 +26,6 @@ body {
}
#visio #camera-stream {
/*display: block;
width: auto;
height: 100%;*/
width: 100%;
}
@ -42,165 +39,3 @@ body {
#visio #log div {
margin-bottom: 1em;
}
/*body {
margin: 0px;
background-color: #333;
font-family: sans-serif;
}
#connection {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
background-color: rgba(0, 0, 0, 0.6);
display: none;
color: white;
font-size: 1.5em;
text-align: center;
line-height: 5em;
}
#chatpop {
height: 100%;
width: 100%;
position: fixed;
top: 0px;
left: 0px;
}
#chatpop #chatpoplist label {
display: block;
}
#chatpop #chatpoplist li input[type=radio] {
display: none;
}
#chatpop #chatpoplist li input[type=radio]:checked ~ .content {
display: block;
}
#chatpop #chatpoplist input[type=radio]:checked ~ label {
background-color: #111;
}
#chatpop #chatpoplist {
width: 25%;
height: 100%;
list-style-type: none;
margin: 0px;
overflow-y: auto;
display: block;
padding: 0px;
}
#chatpop #chatpoplist li {
margin: 0px;
padding: 0px;
}
#chatpop #chatpoplist li .tab {
white-space: nowrap;
width: auto;
overflow: hidden;
color: #BBB;
line-height: 30px;
font-size: 13px;
text-overflow: ellipsis;
}
#chatpop #chatpoplist li:hover .tab {
background-color: #222;
cursor: pointer;
}
#chatpop #chatpoplist li .tab img.avatar {
float: left;
margin-right: 5px;
width: 30px;
}
#chatpop #chatpoplist li .content {
position: fixed;
top: 0px;
right: 0px;
height: 90%;
width: 75%;
display: none;
background-color: white;
overflow-y: auto;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
}
#chatpop #chatpoplist li .content .text {
position: fixed;
bottom: 0px;
right: 0px;
width: 75%;
background-color: red;
min-height: 10%;
border-top: 1px solid #333;
background-color: white;
}
#chatpop #chatpoplist li .content .text textarea {
width: 100%;
margin: 0px;
padding: 0px;
border: 0px;
height: auto;
background-color: white;
resize: none;
}
#chatpop #chatpoplist li .content .messages {
font-size: 13px;
}
#chatpop #chatpoplist li .content .messages .message {
margin: 10px;
margin-right: 30px;
background-color: #FFE8CC;
padding: 5px;
min-height: 25px;
}
#chatpop #chatpoplist li .content .messages .message.me {
margin-left: 30px;
margin-right: 10px;
background-color: #FFFFCC;
}
#chatpop #chatpoplist li .content .messages .message .date {
float: right;
color: #888;
font-size: 11px;
padding-left: 10px;
}
#chatpop #chatpoplist li .content .messages .message.presence {
background-color: transparent;
font-weight: bold;
min-height: 0px;
}
#chatpop #chatpoplist span.chatbutton {
width: 28px;
height: 28px;
background-repeat: no-repeat;
background-position: center center;
position: fixed;
bottom: 0px;
left: 0px;
}
#chatpop #chatpoplist span.chatbutton:hover {
cursor: pointer;
}
#chatpop #chatpoplist li span.chatbutton.cross {
background-image: url(img/cross.png);
}
*/

37
app/widgets/Visio/visio.js

@ -23,29 +23,6 @@ window.onunload = function() {
//self.opener.Roster_ajaxToggleChat();
};
/*function scrollAllTalks() {
var mes = document.querySelectorAll('.content');
for (var i=0; i<mes.length; i++){
// We add 200px to prevent smiley loading
mes.item(i).scrollTop = mes.item(i).scrollHeight + 200;
}
}
function sendMessage(n, jid)
{
var text = n.value;
n.value = "";
n.focus();
// We escape the text to prevent XML errors
return encodeURIComponent(text);
}*/
//setInterval( scrollAllTalks, 200 );
var Visio = {
fullScreen: function() {
var elem = document.getElementById("visio");
@ -77,6 +54,20 @@ var Visio = {
+ date.getHours() + ":"+date.getMinutes() + ":"+date.getSeconds() + "] "
+ content +
"</div>"]);
},
/*
* @brief Call a function in the main window
* @param Array, array[0] is the name of the function, then the params
*/
call: function(args) {
if( self.opener && !self.opener.closed ) {
// The popup is open so call it
var func = args[0];
args.shift();
var params = args;
self.opener[func].apply(null, params);
}
}
}

4
app/widgets/Visio/webrtc.js

@ -49,7 +49,9 @@ function onOfferCreated(description) {
function sendMessage(offer) {
var msgString = JSON.stringify(offer);
Visio.log('C->S: ' + msgString);
//Visio.log('C->S: ' + msgString);
Visio.log('Send the proposal.');
Visio.call(['VisioExt_ajaxSendProposal', msgString]);
}
function onSetSessionDescriptionSuccess() {

7
app/widgets/VisioExt/VisioExt.php

@ -26,6 +26,13 @@ class VisioExt extends WidgetBase
$this->addjs('visioext.js');
}
function ajaxSendProposal($proposal) {
$p = json_decode($proposal);
$stj = new SDPtoJingle($p->sdp, $this->user->getLogin());
\movim_log(\moxl\cleanXML($stj->generate()));
}
function build() {
}

3
bootstrap.php

@ -177,6 +177,9 @@ class Bootstrap {
private function loadCommonLibraries() {
// XMPPtoForm lib
require_once(LIB_PATH . "XMPPtoForm.php");
// SDPtoJingle lib
require_once(LIB_PATH . "SDPtoJingle.php");
// Markdown lib
require_once(LIB_PATH . "Markdown.php");

102
lib/SDPtoJingle.php

@ -0,0 +1,102 @@
<?php
class SDPtoJingle {
private $sdp;
private $jingle;
private $jid;
private $iceufrag;
private $icepwd;
function __construct($sdp, $jid = '') {
$this->sdp = $sdp;
$this->jingle = new SimpleXMLElement('<jingle></jingle>');
$this->jingle->addAttribute('xmlns', 'urn:xmpp:jingle:1');
$this->jingle->addAttribute('action','session-initiate');
$this->jingle->addAttribute('initiator',$jid);
}
function generate() {
$arr = explode("\r", str_replace("\n", "", $this->sdp));
$m = false;
foreach($arr as $l) {
list($key, $line) = explode('=', $l);
switch($key) {
case 'm':
$expl = explode(' ', $line);
$content = $this->jingle->addChild('content');
$content->addAttribute('creator', 'initiator');
$content->addAttribute('name', $expl[0]);
// The description node
$description = $content->addChild('description');
$description->addAttribute('xmlns', "urn:xmpp:jingle:apps:rtp:11");
// The transport node
$transport = $content->addChild('transport');
$transport->addAttribute('xmlns', "xmlns='urn:xmpp:jingle:transports:ice-udp:1");
$transport->addAttribute('pwd', $this->icepwd);
$transport->addAttribute('ufrag', $this->iceufrag);
$m = true;
break;
case 'a':
if($m) {
$expl = explode(' ', $line);
// We have a new candidate !
if(count($expl) > 5) {
// We explode the candidate:0 or :1
$candidexpl = explode(':', $expl[0]);
$candidate = $transport->addChild('candidate');
$candidate->addAttribute('componenent', $candidexpl[1]);
$candidate->addAttribute('foundation', $expl[1]);
$candidate->addAttribute('generation', 0);
$candidate->addAttribute('protocol', $expl[2]);
$candidate->addAttribute('priority', $expl[3]);
$candidate->addAttribute('ip', $expl[4]);
$candidate->addAttribute('port', $expl[5]);
$candidate->addAttribute('type', $expl[7]);
$candidate->addAttribute('id', \generateKey(10));
if(isset($expl[9]))
$candidate->addAttribute('rel-addr', $expl[9]);
if(isset($expl[11]))
$candidate->addAttribute('rel-port', $expl[11]);
}
$expl = explode(':', $exp[1]);
switch($expl[0]) {
// We have a new codec !
case 'rtpmap':
$rtpmap = explode(' ', $expl[1]);
list($codec, $freq) = explode('/',$rtpmap[1]);
$payloadtype = $description->addChild('payload-type');
$payloadtype->addAttribute('id', $rtpmap[0]);
$payloadtype->addAttribute('name', $codec);
$payloadtype->addAttribute('clockrate', $freq);
break;
}
} else {
$expl = explode(':', $line);
// Some ICE ids
switch($expl[0]) {
case 'ice-pwd':
$this->icepwd = $expl[1];
break;
case 'ice-ufrag':
$this->iceufrag = $expl[1];
break;
}
}
break;
}
}
return $this->jingle->asXML();
}
}

10
system/Sessionx.php

@ -56,15 +56,7 @@ class Sessionx {
protected function regenerate()
{
// Generating the session cookie's hash.
$hash_chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$hash = "";
for($i = 0; $i < 64; $i++) {
$r = mt_rand(0, strlen($hash_chars) - 1);
$hash.= $hash_chars[$r];
}
self::$_sessionid = $hash;
self::$_sessionid = \generateKey(64);
setcookie('MOVIM_SESSION_ID', self::$_sessionid, time() + $this->_max_age);
}

25
system/Utils.php

@ -690,10 +690,10 @@ function generateUUID($string = false) {
function movim_log($log) {
\system\Logs\Logger::log($log);
/* openlog('movim', LOG_NDELAY, LOG_USER);
$errlines = explode("\n",$log);
foreach ($errlines as $txt) { syslog(LOG_DEBUG, $txt); }
closelog();*/
openlog('movim', LOG_NDELAY, LOG_USER);
$errlines = explode("\n",$log);
foreach ($errlines as $txt) { syslog(LOG_DEBUG, $txt); }
closelog();
}
/**
@ -727,4 +727,21 @@ function getFlagTitle($color){
}
return $title;
}
/*
* @desc Generate a simple random key
* @params The size of the key
*/
function generateKey($size) {
// Generating the session cookie's hash.
$hash_chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$hash = "";
for($i = 0; $i < $size; $i++) {
$r = mt_rand(0, strlen($hash_chars) - 1);
$hash.= $hash_chars[$r];
}
return $hash;
}
?>

1
themes/movim/css/forms.css

@ -272,6 +272,7 @@ legend {
font-weight: bold;
font-size: 0.8em;
line-height: 2.4em;
font-family: helvetica, sans-serif;
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2);
box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.3);

1
themes/movim/css/style.css

@ -312,6 +312,7 @@ ul.clean li {
#left a:link,
#left a:visited {
color: #94A6B0;
text-decoration: none;
}
#left ul {

BIN
themes/movim/favicon.xcf

BIN
themes/movim/img/favicon.ico

Loading…
Cancel
Save