Remove unused code that is related with invitations

This commit is contained in:
Dmitriy Simushev 2014-05-21 07:55:55 +00:00
parent ff0e1060e9
commit 938c4cbd69
4 changed files with 0 additions and 217 deletions

View File

@ -1,57 +0,0 @@
<?php
/*
* Copyright 2005-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Mibew\API\Interaction;
/**
* Implements Mibew Core - Mibew invitation waiting window interaction
*/
class InviteInteraction extends AbstractInteraction
{
/**
* Returns reserved (system) functions' names.
*
* @return array
* @see \Mibew\API\Interaction\AbstractInteraction::getReservedFunctionsNames
*/
public function getReservedFunctionsNames()
{
return array(
'result',
);
}
/**
* Defines mandatory arguments and default values for them.
*
* @return array
* @see \Mibew\API\Interaction\AbstractInteraction::mandatoryArguments
*/
protected function mandatoryArguments()
{
return array(
'*' => array(
'references' => array(),
'return' => array(),
'visitorId' => null,
),
'result' => array(
'errorCode' => 0,
),
);
}
}

View File

@ -1,29 +0,0 @@
<?php
/*
* Copyright 2005-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Mibew\RequestProcessor\Exception;
/**
* Class for {@link \Mibew\RequestProcessor\InviteRequestProcessor} exceptions
*/
class InviteProcessorException extends AbstractProcessorException
{
/**
* Operator is not logged in
*/
const ERROR_AGENT_NOT_LOGGED_IN = 1;
}

View File

@ -1,110 +0,0 @@
<?php
/*
* Copyright 2005-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Mibew\RequestProcessor;
// Import namespaces and classes of the core
use Mibew\API\API as MibewAPI;
use Mibew\RequestProcessor\Exception\InviteProcessorException;
/**
* Incapsulates invitation awaiting related api functions.
*
* Events triggered by the class (see description of the RequestProcessor class
* for details):
* - inviteRequestReceived
* - inviteReceiveRequestError
* - inviteCallError
* - inviteFunctionCall
*/
class InviteProcessor extends ClientSideProcessor
{
/**
* Class constructor
*/
protected function __construct()
{
parent::__construct(array(
'signature' => '',
'trusted_signatures' => array(''),
'event_prefix' => 'invite'
));
}
/**
* Creates and returns an instance of the \Mibew\API\API class.
*
* @return \Mibew\API\API
*/
protected function getMibewAPIInstance()
{
return MibewAPI::getAPI('\\Mibew\\API\\Interaction\\InviteInteraction');
}
/**
* Stub for sendAsyncRequest method.
*
* Actually request not send to client side. This method is ONLY STUB.
*
* @return boolean Always true
*/
protected function sendAsyncRequest()
{
return true;
}
/**
* Stub for call method.
*
* Actually nothing can be called at client side. This method is ONLY STUB.
*
* @return boolean Always false.
*/
public function call()
{
return false;
}
/**
* Returns visitor invitation state. API function
*
* @param array $args Associative array of arguments. It must contains
* following keys:
* - 'visitorId': Id of the invited visitor
* @return array Array of results. It contains following keys:
* - 'invited': boolean, indicates if visitor is invited
* - 'threadId': thread id related to visitor or false if there is no
* thread
*/
protected function apiInvitationState($args)
{
$operator = get_logged_in();
if (!$operator) {
throw new InviteProcessorException(
"Operator not logged in!",
InviteProcessorException::ERROR_AGENT_NOT_LOGGED_IN
);
}
$invitation = invitation_state($args['visitorId']);
return array(
'invited' => (bool) $invitation['invited'],
'threadId' => ($invitation['threadid'] ? $invitation['threadid'] : false),
);
}
}

View File

@ -1,21 +0,0 @@
<?php
/*
* Copyright 2005-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once(dirname(dirname(__FILE__)) . '/libs/init.php');
$processor = \Mibew\RequestProcessor\InviteProcessor::getInstance();
$processor->receiveRequest($_POST['data']);