Browse Source

- Replace ressource with resource

pull/16/head
Christine Ho 11 years ago
parent
commit
933a32e64f
  1. 4
      app/helpers/StringHelper.php
  2. 8
      app/models/contact/Contact.php
  3. 4
      app/models/contact/ContactDAO.php
  4. 4
      app/models/message/Message.php
  5. 6
      app/models/message/MessageDAO.php
  6. 10
      app/models/presence/Presence.php
  7. 14
      app/models/presence/PresenceDAO.php
  8. 4
      app/models/sessionx/Sessionx.php
  9. 10
      app/models/sessionx/SessionxDAO.php
  10. 10
      app/widgets/Chat/Chat.php
  11. 4
      app/widgets/Chat/_chat_messages.tpl
  12. 6
      app/widgets/Presence/Presence.php
  13. 2
      app/widgets/Roster/roster.css
  14. 18
      app/widgets/Roster/roster.js
  15. 40
      app/widgets/Visio/Visio.php
  16. 8
      app/widgets/Visio/visio.js
  17. 6
      app/widgets/Visio/webrtc.js
  18. 22
      app/widgets/VisioExt/VisioExt.php
  19. 8
      system/Sessionx.php

4
app/helpers/StringHelper.php

@ -197,7 +197,7 @@ function echapJid($jid)
}
/*
* Clean the ressource of a jid
* Clean the resource of a jid
*/
function cleanJid($jid)
{
@ -215,7 +215,7 @@ function explodeJid($jid)
return array(
'username' => $username,
'server' => $server,
'ressource' => $resource
'resource' => $resource
);
}

8
app/models/contact/Contact.php

@ -399,7 +399,7 @@ class Contact extends Model {
'rostername' => $this->rostername,
'groupname' => $this->groupname,
'status' => $this->status,
'ressource' => $this->ressource,
'resource' => $this->resource,
'value' => $this->value
);
}
@ -409,7 +409,7 @@ class RosterContact extends Contact {
protected $rostername;
protected $groupname;
protected $status;
protected $ressource;
protected $resource;
protected $value;
protected $delay;
protected $chaton;
@ -432,7 +432,7 @@ class RosterContact extends Contact {
{'type':'string', 'size':128 },
'groupname' :
{'type':'string', 'size':128 },
'ressource' :
'resource' :
{'type':'string', 'size':128, 'key':true },
'value' :
{'type':'int', 'size':11, 'mandatory':true },
@ -461,7 +461,7 @@ class RosterContact extends Contact {
// This method is only use on the connection
public function setPresence($p) {
$this->ressource = $p->ressource;
$this->resource = $p->resource;
$this->value = $p->value;
$this->status = $p->status;
$this->delay = $p->delay;

4
app/models/contact/ContactDAO.php

@ -393,7 +393,7 @@ class ContactDAO extends SQL {
rosterlink.groupname,
rosterlink.chaton,
presence.status,
presence.ressource,
presence.resource,
presence.value,
presence.delay,
presence.node,
@ -473,7 +473,7 @@ class ContactDAO extends SQL {
rosterlink.groupname,
rosterlink.chaton,
presence.status,
presence.ressource,
presence.resource,
presence.value,
presence.delay,
presence.node,

4
app/models/message/Message.php

@ -7,7 +7,7 @@ class Message extends Model {
public $jidto;
public $jidfrom;
public $ressource;
public $resource;
public $type;
@ -28,7 +28,7 @@ class Message extends Model {
{"type":"string", "size":128, "mandatory":true },
"jidfrom" :
{"type":"string", "size":128, "mandatory":true },
"ressource" :
"resource" :
{"type":"string", "size":128 },
"type" :
{"type":"string", "size":20 },

6
app/models/message/MessageDAO.php

@ -10,7 +10,7 @@ class MessageDAO extends SQL {
session,
jidto,
jidfrom,
ressource,
resource,
type,
subject,
thread,
@ -22,7 +22,7 @@ class MessageDAO extends SQL {
:session,
:jidto,
:jidfrom,
:ressource,
:resource,
:type,
:subject,
:thread,
@ -38,7 +38,7 @@ class MessageDAO extends SQL {
'session' => $this->_user,
'jidto' => $message->jidto,
'jidfrom' => $message->jidfrom,
'ressource' => $message->ressource,
'resource' => $message->resource,
'type' => $message->type,
'subject' => $message->subject,
'thread' => $message->thread,

10
app/models/presence/Presence.php

@ -9,7 +9,7 @@ class Presence extends Model {
protected $jid;
// General presence informations
protected $ressource;
protected $resource;
protected $value;
protected $priority;
protected $status;
@ -39,7 +39,7 @@ class Presence extends Model {
{"type":"string", "size":64, "mandatory":true, "key":true },
"jid" :
{"type":"string", "size":64, "mandatory":true, "key":true },
"ressource" :
"resource" :
{"type":"string", "size":64, "key":true },
"value" :
{"type":"int", "size":11, "mandatory":true },
@ -79,9 +79,9 @@ class Presence extends Model {
$this->session = $to;
$this->jid = $jid[0];
if(isset($jid[1]))
$this->ressource = $jid[1];
$this->resource = $jid[1];
else
$this->ressource = 'default';
$this->resource = 'default';
$this->status = (string)$stanza->status;
@ -152,7 +152,7 @@ class Presence extends Model {
$arr = array();
$arr['jid'] = $this->jid;
$arr['ressource'] = $this->ressource;
$arr['resource'] = $this->resource;
$arr['presence'] = $this->value;
$arr['presence_txt'] = $txt[$this->value];
$arr['priority'] = $this->priority;

14
app/models/presence/PresenceDAO.php

@ -11,7 +11,7 @@ class PresenceDAO extends SQL {
$id = sha1(
$presence->session.
$presence->jid.
$presence->ressource
$presence->resource
);
$this->_sql = '
@ -55,7 +55,7 @@ class PresenceDAO extends SQL {
(id,
session,
jid,
ressource,
resource,
value,
priority,
status,
@ -71,7 +71,7 @@ class PresenceDAO extends SQL {
:id,
:session,
:jid,
:ressource,
:resource,
:value,
:priority,
:status,
@ -90,7 +90,7 @@ class PresenceDAO extends SQL {
'id' => $id,
'session' => $presence->session,
'jid' => $presence->jid,
'ressource' => $presence->ressource,
'resource' => $presence->resource,
'value' => $presence->value,
'priority' => $presence->priority,
'status' => $presence->status,
@ -119,20 +119,20 @@ class PresenceDAO extends SQL {
}
function getPresence($jid, $ressource) {
function getPresence($jid, $resource) {
$this->_sql = '
select * from presence
where
session = :session
and jid = :jid
and ressource = :ressource';
and resource = :resource';
$this->prepare(
'Presence',
array(
'session' => $this->_user,
'jid' => $jid,
'ressource' => $ressource
'resource' => $resource
)
);

4
app/models/sessionx/Sessionx.php

@ -6,7 +6,7 @@ class Sessionx extends Model {
public $session;
public $username;
public $password;
public $ressource;
public $resource;
public $rid;
public $sid;
public $id;
@ -28,7 +28,7 @@ class Sessionx extends Model {
{"type":"string", "size":64 },
"password" :
{"type":"string", "size":64 },
"ressource" :
"resource" :
{"type":"string", "size":64 },
"rid" :
{"type":"int", "size":8, "mandatory":true },

10
app/models/sessionx/SessionxDAO.php

@ -8,7 +8,7 @@ class SessionxDAO extends SQL {
update sessionx
set username = :username,
password = :password,
ressource = :ressource,
resource = :resource,
rid = :rid,
sid = :sid,
id = :id,
@ -28,7 +28,7 @@ class SessionxDAO extends SQL {
'session' => $s->session,
'username' => $s->username,
'password' => $s->password,
'ressource' => $s->ressource,
'resource' => $s->resource,
'rid' => $s->rid,
'sid' => $s->sid,
'id' => $s->id,
@ -51,7 +51,7 @@ class SessionxDAO extends SQL {
(session,
username,
password,
ressource,
resource,
rid,
sid,
id,
@ -67,7 +67,7 @@ class SessionxDAO extends SQL {
(:session,
:username,
:password,
:ressource,
:resource,
:rid,
:sid,
:id,
@ -86,7 +86,7 @@ class SessionxDAO extends SQL {
'session' => $s->session,
'username' => $s->username,
'password' => $s->password,
'ressource' => $s->ressource,
'resource' => $s->resource,
'rid' => $s->rid,
'sid' => $s->sid,
'id' => $s->id,

10
app/widgets/Chat/Chat.php

@ -105,7 +105,7 @@ class Chat extends WidgetCommon
* @param string $message
* @return void
*/
function ajaxSendMessage($to, $message, $muc = false, $ressource = false) {
function ajaxSendMessage($to, $message, $muc = false, $resource = false) {
if($message == '')
return;
@ -117,11 +117,11 @@ class Chat extends WidgetCommon
$session = \Sessionx::start();
$m->type = 'chat';
$m->ressource = $session->ressource;
$m->resource = $session->resource;
if($muc) {
$m->type = 'groupchat';
$m->ressource = $session->user;
$m->resource = $session->user;
$m->jidfrom = $to;
}
@ -137,8 +137,8 @@ class Chat extends WidgetCommon
$packet->content = $m;
$this->onMessage($packet, true);
if($ressource != false) {
$to = $to . '/' . $ressource;
if($resource != false) {
$to = $to . '/' . $resource;
}
// We decode URL codes to send the correct message to the XMPP server

4
app/widgets/Chat/_chat_messages.tpl

@ -1,12 +1,12 @@
<ul class="middle">
{loop="$messages"}
<li {if="$value->jidfrom == $jid"}class="oppose"{/if}>
<span class="icon bubble {if="$contact == null"}color {$value->ressource|stringToColor}{/if}">
<span class="icon bubble {if="$contact == null"}color {$value->resource|stringToColor}{/if}">
{if="$value->jidfrom == $jid"}
{if="$contact != null"}
<img src="{$contact->getPhoto('s')}">
{else}
{$value->ressource|firstLetterCapitalize}
{$value->resource|firstLetterCapitalize}
{/if}
{else}
<img src="{$me->getPhoto('s')}">

6
app/widgets/Presence/Presence.php

@ -109,7 +109,7 @@ class Presence extends WidgetBase
$session = \Sessionx::start();
$p = new Unavailable;
$p->setType('terminate')
->setRessource($session->ressource)
->setResource($session->resource)
->setTo($this->user->getLogin())
->request();
@ -152,7 +152,7 @@ class Presence extends WidgetBase
$pd = new \Modl\PresenceDAO();
$session = \Sessionx::start();
$presence = $pd->getPresence($this->user->getLogin(), $session->ressource);
$presence = $pd->getPresence($this->user->getLogin(), $session->resource);
$presencetpl = $this->tpl();
@ -178,7 +178,7 @@ class Presence extends WidgetBase
$session = \Sessionx::start();
$pd = new \Modl\PresenceDAO();
$p = $pd->getPresence($this->user->getLogin(), $session->ressource);
$p = $pd->getPresence($this->user->getLogin(), $session->resource);
$cd = new \Modl\ContactDAO();
$contact = $cd->get($this->user->getLogin());

2
app/widgets/Roster/roster.css

@ -173,7 +173,7 @@
text-shadow: 0px -0.1em 0px rgba(0, 0, 0, 0.5);
}
#roster ul#rosterlist ul.contact li a span.ressource {
#roster ul#rosterlist ul.contact li a span.resource {
display: block;
font-size: 0.8em;
color: #777;

18
app/widgets/Roster/roster.js

@ -66,9 +66,9 @@
};
$scope.pushInPlace(el, $scope.lookupgroups[list[i].groupname].agroupitems, jidAvalCompare);
}
/* New ressource (can't just push the whole set of same jid because there is no set) */
if(!$scope.isInJidItems(list[i].jid, list[i].ressource)){
$scope.pushInPlace(list[i], $scope.lookupjid[list[i].jid].ajiditems, ressourceCompare);
/* New resource (can't just push the whole set of same jid because there is no set) */
if(!$scope.isInJidItems(list[i].jid, list[i].resource)){
$scope.pushInPlace(list[i], $scope.lookupjid[list[i].jid].ajiditems, resourceCompare);
}
}
//}
@ -111,10 +111,10 @@
$scope.$apply();
};
$scope.isInJidItems = function(jid, ressource){
$scope.isInJidItems = function(jid, resource){
l = $scope.lookupjid[jid].ajiditems.length;
for(var i = 0; i < l; i++){
if($scope.lookupjid[jid].ajiditems[i].ressource == ressource)
if($scope.lookupjid[jid].ajiditems[i].resource == resource)
return true;
}
return false;
@ -206,7 +206,7 @@
this.postJingleAction = function(c){
Popup.close();
Popup.open(c.jid + "/" + c.ressource);
Popup.open(c.jid + "/" + c.resource);
};
this.groupIsShown = function(grp){
@ -236,10 +236,10 @@
return liclass;
};
this.getJidStatusRessource = function(c){
this.getJidStatusResource = function(c){
lititle = c.jid;
if(c.status != '') lititle += " - " + c.status;
lititle += " - " + c.ressource;
lititle += " - " + c.resource;
return lititle;
};
@ -318,7 +318,7 @@ var groupnameCompare = function(a, b) {
return a.agroup.localeCompare(b.agroup);
};
var ressourceCompare = function(a, b) {
var resourceCompare = function(a, b) {
n = a.value - b.value;
return n ? n < 0 ? -1 : 1 : 0;
};

40
app/widgets/Visio/Visio.php

@ -19,13 +19,13 @@ use Moxl\Xec\Action\Jingle\SessionTerminate;
class Visio extends WidgetBase
{
function load()
{
$this->addcss('visio.css');
$this->addjs('visio.js');
$this->addjs('adapter.js');
$this->addjs('webrtc.js');
$this->addjs('turn.js');
function load()
{
$this->addcss('visio.css');
$this->addjs('visio.js');
$this->addjs('adapter.js');
$this->addjs('webrtc.js');
$this->addjs('turn.js');
$this->registerEvent('jinglesessioninitiate', 'onSessionInitiate');
$this->registerEvent('jingle_sessioninitiate_erroritemnotfound', 'onInitiationError');
@ -132,12 +132,12 @@ class Visio extends WidgetBase
$stj = new SDPtoJingle(
$p->sdp,
$this->user->getLogin().'/'.$sd->ressource,
$p->jid.'/'.$p->ressource,
$this->user->getLogin().'/'.$sd->resource,
$p->jid.'/'.$p->resource,
'session-initiate');
$r = new SessionInitiate;
$r->setTo($p->jid.'/'.$p->ressource)
$r->setTo($p->jid.'/'.$p->resource)
->setOffer($stj->generate())
->request();
@ -153,22 +153,22 @@ class Visio extends WidgetBase
$stj = new SDPtoJingle(
$p->sdp,
$this->user->getLogin().'/'.$sd->ressource,
$p->jid.'/'.$p->ressource,
$this->user->getLogin().'/'.$sd->resource,
$p->jid.'/'.$p->resource,
'session-accept');
$r = new SessionInitiate;
$r->setTo($p->jid.'/'.$p->ressource)
$r->setTo($p->jid.'/'.$p->resource)
->setOffer($stj->generate())
->request();
}
function ajaxSendSessionTerminate($jid, $ressource, $reason = null) {
function ajaxSendSessionTerminate($jid, $resource, $reason = null) {
$s = Session::start();
$jingleSid = $s->get("jingleSid");
$r = new SessionTerminate;
$r->setTo($jid.'/'.$ressource);
$r->setTo($jid.'/'.$resource);
$r->setJingleSid($jingleSid);
if(isset($reason))
@ -187,12 +187,12 @@ class Visio extends WidgetBase
$stj = new SDPtoJingle(
$sdp,
$this->user->getLogin().'/'.$sd->ressource,
$p->jid.'/'.$p->ressource,
$this->user->getLogin().'/'.$sd->resource,
$p->jid.'/'.$p->resource,
'transport-info');
$r = new SessionInitiate;
$r->setTo($p->jid.'/'.$p->ressource)
$r->setTo($p->jid.'/'.$p->resource)
->setOffer($stj->generate())
->request();
}
@ -211,7 +211,7 @@ class Visio extends WidgetBase
function display()
{
//if(isset($_GET['f'])) {
// list($jid, $ressource) = explode('/', htmlentities($_GET['f']));
// list($jid, $resource) = explode('/', htmlentities($_GET['f']));
$json = requestURL('https://computeengineondemand.appspot.com/turn?username=93773443&key=4080218913', 1);
$this->view->assign('turn_list' , $json);
@ -225,7 +225,7 @@ class Visio extends WidgetBase
$this->view->assign('avatar',$contact->getPhoto('l'));
$this->view->assign('name' ,$contact->getTrueName());
$this->view->assign('jid' ,$jid);
$this->view->assign('ressource' ,$ressource);
$this->view->assign('resource' ,$resource);
}*/
}
}

8
app/widgets/Visio/visio.js

@ -1,6 +1,6 @@
function notifyOpener() {
document.querySelector('#connection').style.display = 'none';
if(self.opener || !self.opener.Popup.win)
if(self.opener || !self.opener.Popup.win)
self.opener.Popup.win = self;
}
@ -9,13 +9,13 @@ setInterval( notifyOpener, 200 );
self.focus();
VISIO_JID = '';
VISIO_RESSOURCE = '';
VISIO_RESOURCE = '';
/**
* When an error occured
*/
window.onerror = function() {
document.querySelector('#connection').style.display = 'block';
document.querySelector('#connection').style.display = 'block';
};
/**
@ -129,7 +129,7 @@ var Visio = {
if(stack.jid != null) {
jid = stack.jid.split('/');
VISIO_JID = jid[0];
VISIO_RESSOURCE = jid[1];
VISIO_RESOURCE = jid[1];
delete stack.jid;
}

6
app/widgets/Visio/webrtc.js

@ -94,7 +94,7 @@ function onIceCandidate(event) {
candidate.line = event.candidate.sdpMLineIndex;
candidate.jid = VISIO_JID;
candidate.ressource = VISIO_RESSOURCE;
candidate.resource = VISIO_RESOURCE;
var msgString = JSON.stringify(candidate);
@ -104,7 +104,7 @@ function onIceCandidate(event) {
}
function sendTerminate(reason) {
Visio_ajaxSendSessionTerminate(VISIO_JID, VISIO_RESSOURCE, reason);
Visio_ajaxSendSessionTerminate(VISIO_JID, VISIO_RESOURCE, reason);
}
function sendMessage(msg, accept) {
@ -112,7 +112,7 @@ function sendMessage(msg, accept) {
offer.sdp = msg.sdp;
offer.jid = VISIO_JID;
offer.ressource = VISIO_RESSOURCE;
offer.resource = VISIO_RESOURCE;
document.getElementById('visio').className = 'calling';

22
app/widgets/VisioExt/VisioExt.php

@ -124,12 +124,12 @@ class VisioExt extends WidgetBase
$stj = new SDPtoJingle(
$p->sdp,
$this->user->getLogin().'/'.$sd->ressource,
$p->jid.'/'.$p->ressource,
$this->user->getLogin().'/'.$sd->refsource,
$p->jid.'/'.$p->resource,
'session-initiate');
$r = new SessionInitiate;
$r->setTo($p->jid.'/'.$p->ressource)
$r->setTo($p->jid.'/'.$p->resource)
->setOffer($stj->generate())
->request();
@ -145,22 +145,22 @@ class VisioExt extends WidgetBase
$stj = new SDPtoJingle(
$p->sdp,
$this->user->getLogin().'/'.$sd->ressource,
$p->jid.'/'.$p->ressource,
$this->user->getLogin().'/'.$sd->resource,
$p->jid.'/'.$p->resource,
'session-accept');
$r = new SessionInitiate;
$r->setTo($p->jid.'/'.$p->ressource)
$r->setTo($p->jid.'/'.$p->resource)
->setOffer($stj->generate())
->request();
}
function ajaxSendSessionTerminate($jid, $ressource, $reason = null) {
function ajaxSendSessionTerminate($jid, $resource, $reason = null) {
$s = Session::start('movim');
$jingleSid = $s->get("jingleSid");
$r = new SessionTerminate;
$r->setTo($jid.'/'.$ressource);
$r->setTo($jid.'/'.$resource);
$r->setJingleSid($jingleSid);
if(isset($reason))
@ -179,12 +179,12 @@ class VisioExt extends WidgetBase
$stj = new SDPtoJingle(
$sdp,
$this->user->getLogin().'/'.$sd->ressource,
$p->jid.'/'.$p->ressource,
$this->user->getLogin().'/'.$sd->resource,
$p->jid.'/'.$p->resource,
'transport-info');
$r = new SessionInitiate;
$r->setTo($p->jid.'/'.$p->ressource)
$r->setTo($p->jid.'/'.$p->resource)
->setOffer($stj->generate())
->request();
}*/

8
system/Sessionx.php

@ -29,7 +29,7 @@ class Sessionx {
private $_user;
private $_password;
private $_ressource;
private $_resource;
private $_sid;
private $_url;
private $_port;
@ -79,7 +79,7 @@ class Sessionx {
$s->session = self::$_sessionid;
$s->username = $this->_user;
$s->password = $this->_password;
$s->ressource = $this->_ressource;
$s->resource = $this->_resource;
$s->rid = $this->_rid;
$s->sid = $this->_sid;
$s->id = $this->_id;
@ -104,7 +104,7 @@ class Sessionx {
$this->_domain = $domain;
$this->_user = $user;
$this->_password = $pass;
$this->_ressource = 'moxl'.\generateKey(6);
$this->_resource = 'moxl'.\generateKey(6);
$this->_start = date(DATE_ISO8601);
$this->_rid = rand(1, 2048);
@ -122,7 +122,7 @@ class Sessionx {
if(isset($session)) {
$this->_user = $session->username;
$this->_password = $session->password;
$this->_ressource = $session->ressource;
$this->_resource = $session->resource;
$this->_rid = $session->rid;
$this->_sid = $session->sid;
$this->_id = $session->id;

Loading…
Cancel
Save