Community Videochat v.6.0
Installation/Integration manual

Home Handlers

What is a handler.

A handler is a server script, that returns data (usually in XML format) to the application upon request. For example, it can return user profile information or user authorization information.

All handlers can be edited in the application main settings file /flashcoms/videochat/settings/main.xml, however, make sure you’re not removing markers, like: {ROOT}, {NAME} and {UID}. These are system markers in which the application inserts the appropriate values.

Depending on the application and handler you may find several different markers. The most commonly used markers are:

ROOT root folder for all flashcoms applications (FLASHCOMS_HTTP_ROOT/flashcoms/).
NAME user name.
UID user identifier (used  when site authorization is not session/cookies based)

{ROOT} marker value ends with “/”, so if you change the path of the handler file to, for example, /avatar.php located in the FLASHCOMS_HTTP_ROOT folder, then the new address path should look like this: {ROOT}../avatar.php

Videochat handlers

Video chat handlers can be edited in the handlers sections of the main settings file (/flashcoms/videochat/settings/main.xml):

<handlers>

<registration><![CDATA[
{ROOT}registration.php
]]></registration>

<auth><![CDATA[
{ROOT}videochat/server/php/handlers.php?action=auth&user_name={NAME}&password={PASSWORD}&uid={UID}
]]></auth>

<checkGuestName><![CDATA[
{ROOT}videochat/server/php/handlers.php?action=check_guest_name&user_name={NAME}
]]></checkGuestName>

<getUserPhoto><![CDATA[
{ROOT}videochat/server/php/handlers.php?action=get_user_photo&user_name={NAME}
]]></getUserPhoto>

<profile><![CDATA[
{ROOT}videochat/server/php/handlers.php?action=profile&user_name={NAME}
]]></profile>

<logout><![CDATA[
{ROOT}videochat/server/php/handlers.php?action=logout&user_name={NAME}
]]></logout>

</handlers>

Authorization handler

<auth><![CDATA[
{ROOT}videochat/server/php/handlers.php?action=auth&user_name={NAME}&password={PASSWORD}&uid={UID}
]]></auth>

Authorization handler allows you to integrate the chat with your web site users' database.

Parameters:

NAME – user name
PASSWORD – user password
UID - user id (used with non session/cookie based web site authorization)

Format of the returned data

If authorization is passed successfully:

<auth>
<userName><![CDATA[USERNAME]]></userName>
<gender>male</gender>
<level>regular</level>
<photo><![CDATA[PATH_TO_USER_PHOTO]]></photo>
<photoModeImage><![CDATA[PATH_TO_USER_AVATAR_PHOTO]]></photoModeImage>
</auth>

where:

Node name Description
userName Required. User login name.
gender User's gender. Can take 'male', 'female' or 'couple' value. Required when avatar mode is set to "gender"
level User's authorization level. Required when limitation plugin is installed.
photo Path to user's photo/image file. Recommended image size 100x100 px.
photoModeImage Path to user's photo-avatar. Required when avatar mode is set to "photo". Recommended image size 30x30 px.

If not authorized:

<auth error="AUTH_ERROR" />

Authorization handler serves both Auto Login and Chat Authorization requests. Example code below illustrates the handler logic:

if($_REQUEST['user_name']!="" && $_REQUEST['password']!="")
{
//Chat authorization - a user has specified login/password on the chat welcome screen
}
else if ($_SESSION['uid']!="")
{
// Autologin session/cookie based authorization
}
else if ($_GET['uid']!="")
{
// Non session/cookie based autologin authorization
}
else
{
return '<auth error="AUTH_ERROR" />';
}


Profile handler

Returns user’s profile information.

Parameters:

name – user name.

Format of the returned data

<profile>
<paramName>value</paramName >
<paramName>value</paramName>

<paramName>value</paramName>
<paramName>value</paramName>
<info>Hello my name is …</info>
</profile>

Example:

<profile>
<name>SomeName</name>
<age>22</age>
<gender>male</gender>
<avatar>http://www.yourdomain.com/avatars/user_avatr.jpg</avatar>
<info>Hello my name is …</info>
</profile>

checkGuestName handler

This handler is used in non-integrated mode with chat authorization and guest mode enabled. It checks if the login name is available to be used under guest mode.

Parameters:

NAME – user name
Format of the returned data

If login name is taken (in use):

<checkGuestName error="AUTH_ERROR" />

If available:

<checkGuestName>
<photo><![CDATA[http://youdomain.com/users_images/no_photo.jpg]]></photo>
<photoModeImage><![CDATA[http://youdomain.com/users_images/no_photo.jpg]]></photoModeImage>
</checkGuestName>