Browse Source

Remove the echapJid helper

pull/1405/head
Timothée Jaussoin 8 months ago
parent
commit
aa2e12c343
  1. 1
      CHANGELOG.md
  2. 8
      app/Helpers/StringHelper.php
  3. 3
      app/Widgets/Chat/Chat.php
  4. 2
      app/Widgets/Chats/Chats.php
  5. 8
      app/Widgets/ContactData/ContactData.php
  6. 4
      app/Widgets/ContactHeader/ContactHeader.php
  7. 2
      app/Widgets/ContactSubscriptions/ContactSubscriptions.php
  8. 4
      app/Widgets/Notifications/Notifications.php
  9. 2
      app/Widgets/Stickers/Stickers.php
  10. 2
      src/Moxl/Stanza/Message.php
  11. 6
      src/Moxl/Xec/Action/Disco/Items.php

1
CHANGELOG.md

@ -7,6 +7,7 @@ v0.30 (master)
* Rename and append a hash when uploading files that have a very long file name
* Prepend files name with post_, chat_ and story_ before upload to simplify server file cleaning expliration
* Fix ordering when the Pubsub service doesn't return them "last-published-first" like with Prosody
* Remove the echapJid helper
v0.29.1
---------------------------

8
app/Helpers/StringHelper.php

@ -137,14 +137,6 @@ function getHashtags($string): array
return $hashtags;
}
/**
* @desc Echap the JID
*/
function echapJid($jid): string
{
return str_replace(' ', '\40', $jid);
}
/**
* @desc Echap the anti-slashs for Javascript
*/

3
app/Widgets/Chat/Chat.php

@ -571,7 +571,7 @@ class Chat extends \Movim\Widget\Base
$m->messageid = $m->id;
$m->replaceid = $replace ? $replace->originid : null;
$m->user_id = $this->user->id;
$m->jidto = echapJid($to);
$m->jidto = $to;
$m->jidfrom = $this->user->id;
$m->published = gmdate('Y-m-d H:i:s');
@ -605,7 +605,6 @@ class Chat extends \Movim\Widget\Base
$m->jidfrom = $to;
}
// We decode URL codes to send the correct message to the XMPP server
$p = new Publish;
$p->setTo($to);
$p->setReplace($m->replaceid);

2
app/Widgets/Chats/Chats.php

@ -192,7 +192,7 @@ class Chats extends Base
$g->setLimit(150);
$g->setBefore('');
$g->setJid(echapJid($jid));
$g->setJid($jid);
$g->request();
}
}

8
app/Widgets/ContactData/ContactData.php

@ -78,16 +78,16 @@ class ContactData extends Base
if (!$contact || $contact->isOld()) {
$a = new \Moxl\Xec\Action\Avatar\Get;
$a->setTo(echapJid($jid))->request();
$a->setTo($jid)->request();
$a = new \Moxl\Xec\Action\Banner\Get;
$a->setTo(echapJid($jid))->request();
$a->setTo($jid)->request();
$v = new \Moxl\Xec\Action\Vcard\Get;
$v->setTo(echapJid($jid))->request();
$v->setTo($jid)->request();
$r = new \Moxl\Xec\Action\Vcard4\Get;
$r->setTo(echapJid($jid))->request();
$r->setTo($jid)->request();
} else if ($contact) {
$this->rpc('Notif_ajaxGet');
}

4
app/Widgets/ContactHeader/ContactHeader.php

@ -7,8 +7,6 @@ use App\Widgets\Dialog\Dialog;
use Movim\Widget\Base;
use Moxl\Xec\Action\Roster\UpdateItem;
use Moxl\Xec\Action\Roster\RemoveItem;
use Moxl\Xec\Action\Presence\Unsubscribe;
class ContactHeader extends Base
{
@ -48,7 +46,7 @@ class ContactHeader extends Base
public function ajaxEditSubmit($form)
{
$rd = new UpdateItem;
$rd->setTo(echapJid($form->jid->value))
$rd->setTo($form->jid->value)
->setName($form->alias->value)
->setGroup($form->group->value)
->request();

2
app/Widgets/ContactSubscriptions/ContactSubscriptions.php

@ -38,7 +38,7 @@ class ContactSubscriptions extends Base
}
$ps = new GetPubsubSubscriptions;
$ps->setTo(echapJid($jid))->request();
$ps->setTo($jid)->request();
}
public function display()

4
app/Widgets/Notifications/Notifications.php

@ -153,8 +153,6 @@ class Notifications extends Base
public function ajaxAccept(string $jid)
{
$jid = echapJid($jid);
$roster = $this->user->session->contacts()->where('jid', $jid)->first();
$this->user->session->presences()
@ -183,8 +181,6 @@ class Notifications extends Base
public function ajaxRefuse(string $jid)
{
$jid = echapJid($jid);
if ($this->user->session->contacts()->where('jid', $jid)->exists()) {
$r = new RemoveItem;
$r->setTo($jid)

2
app/Widgets/Stickers/Stickers.php

@ -76,7 +76,7 @@ class Stickers extends \Movim\Widget\Base
// Creating a message
$m = new \App\Message;
$m->user_id = $this->user->id;
$m->jidto = echapJid($to);
$m->jidto = $to;
$m->jidfrom = $this->user->id;
$m->sticker_cid_hash = $sticker->cache_hash;
$m->sticker_cid_algorythm = $sticker->cache_hash_algorythm;

2
src/Moxl/Stanza/Message.php

@ -33,7 +33,7 @@ class Message
$dom = new \DOMDocument('1.0', 'UTF-8');
$root = $dom->createElementNS('jabber:client', 'message');
$dom->appendChild($root);
$root->setAttribute('to', str_replace(' ', '\40', $to));
$root->setAttribute('to', $to);
if ($type != null) {
$root->setAttribute('type', $type);

6
src/Moxl/Xec/Action/Disco/Items.php

@ -18,12 +18,6 @@ class Items extends Action
Disco::items($this->_to);
}
public function setTo($to)
{
$this->_to = echapJid($to);
return $this;
}
public function enableManual()
{
$this->_manual = true;

Loading…
Cancel
Save