\UBMessenger
Ubilling instant messenger API
Synopsis
class UBMessenger
{
- // constants
- const TABLE_MESSAGES = 'ub_im';
- const TABLE_PINNED = 'ub_im_pinned';
- const URL_ME = '?module=ubim';
- const URL_AVATAR_CONTROL = '?module=avacontrol';
- const ROUTE_THREAD = 'showthread';
- const ROUTE_GOTHREAD = 'gothread';
- const ROUTE_REFRESH = 'checknew';
- const ROUTE_PIN = 'pincontact';
- const ROUTE_UNPIN = 'unpincontact';
- const PROUTE_MSG_TO = 'im_message_to';
- const PROUTE_MSG_TEXT = 'im_message_text';
- const SCOPE_THREAD = 'rtubimthread';
- const SCOPE_CONTACTS = 'rtubimcontacts';
- const KEY_ADMS_ONLINE = 'UBIM_ADM_ONLINE';
- const KEY_MSG_COUNT = 'UBIM_MSGCOUNT_';
- const KEY_MSG_THREADS = 'UBIM_MSG_TH_';
- const KEY_ADMS_LIST = 'UBIM_ADM_LIST';
- const KEY_PINNED_CONTACTS = 'UBIM_PINNED_CONTACTS';
- const OPT_NOLINKIFY = 'UBIM_NO_LINKIFY';
- const OPT_NOAJAXSEND = 'UBIM_MSGSEND_NATIVE';
- const OPT_MONTHDEPTH = 'UBIM_DEPTH_LIMIT';
- const OPT_MUTE = 'UBIM_MSG_MUTE';
- // members
- protected string $myLogin = '';
- protected $messagesDb = '';
- protected $pinnedDb = '';
- protected array $altCfg = ;
- protected array $allEmployeeNames = ;
- protected array $allAdmins = ;
- protected array $allPinnedContacts = ;
- protected integer $refreshInterval = 2000;
- protected integer $refreshContacts = 5000;
- protected integer $onlineTimeout = 10;
- protected integer $threadMonthDepth = 0;
- protected bool $noLinkifyFlag = false;
- protected bool $nativeSendFlag = false;
- protected bool $muteFlag = false;
- protected $threadsFlow = '';
- protected $contactsFlow = '';
- protected $cache = '';
- protected integer $cachingTimeout = 3600;
- protected $messages = '';
- protected string $currentThread = '';
- protected string $messageSound = 'modules/jsc/sounds/message.mp3';
- // methods
- public void __construct()
- protected void setMyLogin()
- protected void loadConfigs()
- protected void setOptions()
- protected void initMessages()
- protected void initCache()
- protected void loadEmployeeNames()
- protected void initDb()
- protected void loadAdmins()
- protected void loadPinnedContacts()
- public void pinContact()
- public void unpinContact()
- protected bool isContactPinned()
- public string renderZenThread()
- protected void renderZenContacts()
- public void createMessage()
- protected void flushCachedData()
- public void deleteMessage()
- protected void threadMarkAsRead()
- public array getAllUnreadMessagesUsers()
- protected string renderContactList()
- public string renderMainWindow()
- public string renderConversationForm()
- protected array getThreadMessages()
- public string renderThreadContent()
- public int checkForUnreadMessages()
- protected array getActiveAdmins()
- public string renderMainWinTitle()
Constants
| Name | Value |
|---|---|
| TABLE_MESSAGES | 'ub_im' |
| TABLE_PINNED | 'ub_im_pinned' |
| URL_ME | '?module=ubim' |
| URL_AVATAR_CONTROL | '?module=avacontrol' |
| ROUTE_THREAD | 'showthread' |
| ROUTE_GOTHREAD | 'gothread' |
| ROUTE_REFRESH | 'checknew' |
| ROUTE_PIN | 'pincontact' |
| ROUTE_UNPIN | 'unpincontact' |
| PROUTE_MSG_TO | 'im_message_to' |
| PROUTE_MSG_TEXT | 'im_message_text' |
| SCOPE_THREAD | 'rtubimthread' |
| SCOPE_CONTACTS | 'rtubimcontacts' |
| KEY_ADMS_ONLINE | 'UBIM_ADM_ONLINE' |
| KEY_MSG_COUNT | 'UBIM_MSGCOUNT_' |
| KEY_MSG_THREADS | 'UBIM_MSG_TH_' |
| KEY_ADMS_LIST | 'UBIM_ADM_LIST' |
| KEY_PINNED_CONTACTS | 'UBIM_PINNED_CONTACTS' |
| OPT_NOLINKIFY | 'UBIM_NO_LINKIFY' |
| OPT_NOAJAXSEND | 'UBIM_MSGSEND_NATIVE' |
| OPT_MONTHDEPTH | 'UBIM_DEPTH_LIMIT' |
| OPT_MUTE | 'UBIM_MSG_MUTE' |
Members
protected
- $allAdmins
—
array
Contains available administrators - $allEmployeeNames
—
array
Contains all cached employee names as login=>name - $allPinnedContacts
—
array
Contains all pinned contacts as login=>loginsArray - $altCfg
—
array
Constains system alter config as key=>value - $cache
—
Contains caching object instance - $cachingTimeout
—
int
Contains default cacning timeout in seconds - $contactsFlow
—
Undocumented variable - $currentThread
—
string
Contains current thread ID - $messageSound
—
string
Contains message sound notification path - $messages
—
System messages helper instance - $messagesDb
—
Messages database abstraction layer - $muteFlag
—
bool
Flag that disables sounds behaviour around sending/receiving messages - $myLogin
—
string
Current user instance login - $nativeSendFlag
—
bool
Flag that diables AJAX messages sending and replace it with native POST method. - $noLinkifyFlag
—
bool
Contains flag that disables thread messages linkification - $onlineTimeout
—
int
Admin online timeout interval in minutes - $pinnedDb
—
Pinned contacts database abstraction layer - $refreshContacts
—
int
Contacts refresh interval in ms. - $refreshInterval
—
int
Threads refresh interval in ms. - $threadMonthDepth
—
int
Contains month count that means depth for loaded thread messages - $threadsFlow
—
ZenFlow instance for refreshing messages data
Methods
protected
- flushCachedData() — Flushes all relative to sent message cache keys
- getActiveAdmins() — Returns array of "active" administrators
- getThreadMessages() — Returns all messages array from thread with some specified admin
- initCache() — Inits caching engine
- initDb() — Inits database abstraction layer
- initMessages() — Inits message helper
- isContactPinned() — Checks if some contact is pinned
- loadAdmins() — Loads existing administrators
- loadConfigs() — Loads required configs
- loadEmployeeNames() — Preloads existing employee names
- loadPinnedContacts() — Loads all pinned contacts into protected property
- renderContactList() — Return contact list with some available users
- renderZenContacts() — Returns self-refreshing contacts list
- setMyLogin() — Sets current instance administrator login
- setOptions() — Sets instance properties depend on config options
- threadMarkAsRead() — mark thread as read by sender
public
- __construct()
- checkForUnreadMessages() — Checks how many unread messages we have?
- createMessage() — Creates new message for some user
- deleteMessage() — Deletes message by its ID
- getAllUnreadMessagesUsers() — Returns array of users from which we have some unread messages as login=>count
- pinContact() — Pins some contact
- renderConversationForm() — Return conversation form for some thread
- renderMainWinTitle() — Returns primary messenger window title
- renderMainWindow() — Return messenger main window grid
- renderThreadContent() — Shows thread for me with some user
- renderZenThread() — Renders self-refreshing thread content
- unpinContact() — Unpins some contact