Browse Source

- Use the username instead of the true name when adding a chatroom

pull/56/head
Jaussoin Timothée 10 years ago
parent
commit
a30bb591f1
  1. 24
      app/widgets/Rooms/Rooms.php
  2. 2
      app/widgets/Rooms/_rooms_add.tpl
  3. 9
      system/User.php

24
app/widgets/Rooms/Rooms.php

@ -52,7 +52,7 @@ class Rooms extends WidgetBase
$view = $this->tpl();
$cd = new \Modl\ContactDAO;
$view->assign('me', $cd->get());
$view->assign('username', $this->user->getUser());
Dialog::fill($view->draw('_rooms_add', true));
}
@ -95,7 +95,7 @@ class Rooms extends WidgetBase
$cd = new \modl\ConferenceDAO();
$cd->deleteNode($room);
$this->setBookmark();
}
@ -151,7 +151,7 @@ class Rooms extends WidgetBase
/**
* @brief Confirm the room add
*/
function ajaxChatroomAdd($form)
function ajaxChatroomAdd($form)
{
if(!filter_var($form['jid'], FILTER_VALIDATE_EMAIL)) {
Notification::append(null, $this->__('chatrooms.bad_nickname'));
@ -163,20 +163,20 @@ class Rooms extends WidgetBase
'name' => $form['name'],
'autojoin' => $form['autojoin'],
'nick' => $form['nick'],
'jid' => $form['jid']);
'jid' => $form['jid']);
$this->setBookmark($item);
RPC::call('Dialog.clear');
}
}
public function setBookmark($item = false)
public function setBookmark($item = false)
{
$arr = array();
if($item) {
array_push($arr, $item);
}
$sd = new \modl\SubscriptionDAO();
$cd = new \modl\ConferenceDAO();
@ -188,7 +188,7 @@ class Rooms extends WidgetBase
'title' => $s->title,
'subid' => $s->subid,
'tags' => unserialize($s->tags),
'node' => $s->node));
'node' => $s->node));
}
foreach($cd->getAll() as $c) {
@ -198,10 +198,10 @@ class Rooms extends WidgetBase
'name' => $c->name,
'autojoin' => $c->autojoin,
'nick' => $c->nick,
'jid' => $c->conference));
'jid' => $c->conference));
}
$b = new Set;
$b->setArr($arr)
->setTo($this->user->getLogin())
@ -243,7 +243,7 @@ class Rooms extends WidgetBase
}
/**
* @brief Validate the room
* @brief Validate the room
*
* @param string $room
*/
@ -255,7 +255,7 @@ class Rooms extends WidgetBase
}
/**
* @brief Validate the resource
* @brief Validate the resource
*
* @param string $resource
*/

2
app/widgets/Rooms/_rooms_add.tpl

@ -11,7 +11,7 @@
<label>{$c->__('chatrooms.name')}</label>
</div>
<div>
<input name="nick" placeholder="{$me->getTrueName()}" value="{$me->getTrueName()}"/>
<input name="nick" placeholder="{$username}" value="{$username}"/>
<label>{$c->__('chatrooms.nickname')}</label>
</div>
<!--

9
system/User.php

@ -38,9 +38,6 @@ class User {
if($session->active) {
$this->username = $session->user.'@'.$session->host;
//$this->reload();
//$this->sizelimit = (int)$config->sizelimit;
$this->userdir = DOCUMENT_ROOT.'/users/'.$this->username.'/';
$this->useruri = BASE_URI.'users/'.$this->username.'/';
}
@ -144,6 +141,12 @@ class User {
return $exp['server'];
}
function getUser()
{
$exp = explodeJid($this->username);
return $exp['username'];
}
function getPass()
{
return $this->password;

Loading…
Cancel
Save