File/program/modules/confab/confab_common.php

Description

/program/modules/confab/confab_common.php - code shared between admin and view

This file defines various constants and subroutines used from both and confab_view.php.

Constants
CONFAB_ACTION_MESSAGE = 1 (line 55)
CONFAB_ACTION_REMOVE = 2 (line 56)
CONFAB_ANONYMOUS_POSTFIX = * (line 53)
CONFAB_BRAILLE = 0 (line 42)
CONFAB_MAX_CONVERSATION_LIMIT = 86400 (line 49)
CONFAB_MAX_PARTICIPANTS_LIMIT = 100 (line 50)
CONFAB_MAX_TRIES_LIMIT = 25 (line 51)
CONFAB_PERSONAL_NO = 0 (line 34)
CONFAB_PERSONAL_REGISTERED = 1 (line 35)
CONFAB_PERSONAL_YES = 2 (line 36)
CONFAB_REFRESH_LIMIT = 2 (line 52)
CONFAB_STATUS_CLOSED = 0 (line 30)
CONFAB_STATUS_OPENED = 2 (line 32)
CONFAB_STATUS_REGISTERED = 1 (line 31)
CONFAB_USER_STATUS_JOINED = 1 (line 39)
CONFAB_USER_STATUS_LEAVING = 2 (line 40)
CONFAB_USER_STATUS_NONE = 0 (line 38)
CONFAB_VISUAL = 1 (line 43)
CONFAB_VISUAL_BW = 2 (line 44)
CONFAB_VISUAL_BY = 4 (line 46)
CONFAB_VISUAL_RB = 3 (line 45)
Functions
confab_conversation_timeout (line 133)

check conversations for timeout and hard limit and maybe create a new participant_id

this is a dual-purpose routine. The first task is to check the validity of the current conversation. If the conversation started longer than CONFAB_MAX_CONVERSATION_LIMIT (24h) ago, we bluntly end the conversation by incrementing the last_conversation_id in the confab configuration. The same effect happens when the latest contribution to the conversation was more than $timeout_conversation (1h) ago.

If the conversation is no longer current, the last_conversation_id is incremented and also the last_participant_id is reset to 0. This information will be recorded in the database and also updated in the $config array (which was provided by reference, and not by value).

However... in order to save a trip to the database, we can also provide a new participant_id in the same go. This happens when $bump_participant is TRUE. The caller can be sure that in that case the value $config['last_participant_id'] can be used by the caller (provided the routine returns TRUE, indicating success).

If somehow something goes wrong, e.g. a database error, the $config record is untouched and the routine returns FALSE.

This routine should be called periodically, for instance - when a new participants wants to join a conversation - when a participant contributes to the conversation This keeps the conversation_id in line and makes sure that an ongoing conversation is stopped eventually.

  • return: TRUE on success, FALSE on error
bool confab_conversation_timeout (array &$config, [bool $bump_participant = FALSE])
  • array &$config: holds the confab configuration record
  • bool $bump_participant: if TRUE a new participant_id is made available
confab_get_participants (line 69)

retrieve all participants that joined the current conversation

  • return: participants records from database or array() if no participants
array confab_get_participants (array &$config)
  • array &$config: holds the confab configuration
confab_remote_addr (line 92)

shorthand for remote IP-address

  • return: remote IP address
string confab_remote_addr ()

Documentation generated on Tue, 28 Jun 2016 19:08:41 +0200 by phpDocumentor 1.4.0