Browse Source

Update VERSION to 0.14rc

Fix warnings in Contact, CommunityData and in Tag
Handle properly 110 code in incoming MUC presences if there's more than one x tag
pull/716/head
Timothée Jaussoin 7 years ago
parent
commit
71bce06b8a
  1. 2
      VERSION
  2. 2
      app/Contact.php
  3. 2
      app/Tag.php
  4. 10
      app/widgets/CommunityData/CommunityData.php
  5. 29
      lib/moxl/src/Moxl/Xec/Payload/Presence.php

2
VERSION

@ -1 +1 @@
0.14beta
0.14rc

2
app/Contact.php

@ -59,7 +59,7 @@ class Contact extends Model
if (filter_var((string)$vcard->vCard->PHOTO, FILTER_VALIDATE_URL)) {
$this->photobin = base64_encode(
requestUrl((string)$vcard->vCard->PHOTO, 1));
} else {
} elseif ($vcard->vCard->PHOTO) {
$this->photobin = (string)$vcard->vCard->PHOTO->BINVAL;
$this->avatarhash = sha1(base64_decode($this->photobin));
}

2
app/Tag.php

@ -11,7 +11,7 @@ class Tag extends Model
static public function firstOrCreateSafe(array $attributes, array $values = [])
{
try {
static::firstOrCreate($attributes, $values);
return static::firstOrCreate($attributes, $values);
} catch (\PDOException $e) {
/*
* When an article is received the related tags can be saved

10
app/widgets/CommunityData/CommunityData.php

@ -26,11 +26,13 @@ class CommunityData extends \Movim\Widget\Base
->first();
$view->assign('info', $info);
$view->assign('num', ($info->items > 0)
? $info->items
: \App\Post::where('server', $origin)
$view->assign('num', $info ?
($info->items > 0)
? $info->items
: \App\Post::where('server', $origin)
->where('node', $node)
->count());
->count()
: 0);
return $view->draw('_communitydata');
}

29
lib/moxl/src/Moxl/Xec/Payload/Presence.php

@ -12,7 +12,7 @@ class Presence extends Payload
public function handle($stanza, $parent = false)
{
// Subscribe request
if((string)$stanza->attributes()->type == 'subscribe') {
if ((string)$stanza->attributes()->type == 'subscribe') {
$session = Session::start();
$notifs = $session->get('activenotifs');
$notifs[(string)$stanza->attributes()->from] = 'sub';
@ -30,24 +30,27 @@ class Presence extends Payload
$r->setTo((string)$refreshable)->request();
}
if($presence->muc
&& isset($stanza->x)
&& isset($stanza->x->status)) {
$code = (string)$stanza->x->status->attributes()->code;
if(isset($code) && $code == '110') {
if($presence->value != 5 && $presence->value != 6) {
$this->method('muc_handle');
$this->pack($presence);
} elseif($p->value == 5) {
$this->method('unavailable_handle');
$this->pack($presence);
if ($presence->muc
&& isset($stanza->x)) {
foreach ($stanza->x as $x) {
if ($x->attributes()->xmlns == 'http://jabber.org/protocol/muc#user'
&& isset($stanza->x->status)
&& (string)$stanza->x->status->attributes()->code == '110') {
if($presence->value != 5 && $presence->value != 6) {
$this->method('muc_handle');
$this->pack($presence);
} elseif($presence->value == 5) {
$this->method('unavailable_handle');
$this->pack($presence);
}
$this->deliver();
}
}
} else {
$this->pack($presence->roster);
if($presence->value == 5 /*|| $p->value == 6*/) {
if ($presence->value == 5 /*|| $p->value == 6*/) {
$presence->delete();
}
}

Loading…
Cancel
Save