New /invite
This commit is contained in:
@@ -1697,6 +1697,22 @@ class Databap extends PhpObject
|
||||
$this->addMessage('quitte '.($asPm['is_pm']?'le chan privé':'#'.$sChanName), self::MESSAGE_CONN, $iChanId);
|
||||
}
|
||||
}
|
||||
|
||||
public function inviteChan($iUserId, $sChanName)
|
||||
{
|
||||
$sSafeChanName = $this->getChanSafeName($sChanName);
|
||||
$bSuccess = false;
|
||||
if($iUserId>0 && $this->checkChanAuth($sSafeChanName, $iUserId))
|
||||
{
|
||||
$sType = self::MESSAGE_INVITE;
|
||||
$sMessage = $iUserId;
|
||||
$sChanId = $this->getChanId($sChanName);
|
||||
$bSuccess = $this->addMessage($sMessage, $sType, $sChanId);
|
||||
if($bSuccess) $sDesc = 'Invitation envoyée';
|
||||
}
|
||||
else $sDesc = 'Désolé, cette personne n\'est pas autorisé sur ce channel';
|
||||
return $this->getJsonPostResult($bSuccess, $sDesc);
|
||||
}
|
||||
|
||||
private function getActiveChannels()
|
||||
{
|
||||
@@ -1907,16 +1923,6 @@ class Databap extends PhpObject
|
||||
$sType = self::MESSAGE_REBOOT;
|
||||
$sChanName = self::ALL_CHAN_TEXT;
|
||||
}
|
||||
elseif(mb_substr($sMessage, 0, 8) == '/invite ' && mb_strlen($sMessage)>8)
|
||||
{
|
||||
$sSafeChanName = $this->getChanSafeName($sChanName);
|
||||
$iUserId = $this->getUserIdFromNickName(trim(mb_substr($sMessage, 8)));
|
||||
if($iUserId>0 && $this->checkChanAuth($sSafeChanName, $iUserId))
|
||||
{
|
||||
$sType = self::MESSAGE_INVITE;
|
||||
$sMessage = $iUserId;
|
||||
}
|
||||
}
|
||||
elseif(mb_substr($sMessage, 0, 6) == '/news ' && mb_strlen($sMessage)>6)
|
||||
{
|
||||
$sType = self::MESSAGE_NEWS;
|
||||
|
||||
Reference in New Issue
Block a user