# class DefaultLogic | The client's default logic. More...
Full name | `TelEngine::DefaultLogic`
Definition | `#include <yatecbase.h>`
Inherits | TelEngine::ClientLogic [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- explicit DefaultLogic (const char* name = "default", int prio = -100)
- ~DefaultLogic ()
- virtual bool action (Window* wnd, const String& name, NamedList* params = 0)
- virtual bool toggle (Window* wnd, const String& name, bool active)
- virtual bool select (Window* wnd, const String& name, const String& item, const String& text = String::empty())
- virtual bool select (Window* wnd, const String& name, const NamedList& items)
- virtual bool setClientParam (const String& param, const String& value, bool save, bool update)
- virtual bool imIncoming (Message& msg)
- virtual bool callIncoming (Message& msg, const String& dest)
- virtual bool validateCall (NamedList& params, Window* wnd = 0)
- virtual bool callStart (NamedList& params, Window* wnd = 0, const String& cmd = String::empty())
- virtual bool digitPressed (NamedList& params, Window* wnd = 0)
- virtual bool editAccount (bool newAcc, NamedList* params, Window* wnd = 0)
- virtual bool acceptAccount (NamedList* params, Window* wnd = 0)
- virtual bool delAccount (const String& account, Window* wnd = 0)
- virtual bool updateAccount (const NamedList& account, bool login, bool save)
- virtual bool loginAccount (const NamedList& account, bool login)
- virtual bool updateContact (const NamedList& contact, bool save, bool update)
- virtual bool acceptContact (NamedList* params, Window* wnd = 0)
- virtual bool editContact (bool newCont, NamedList* params = 0, Window* wnd = 0)
- virtual bool delContact (const String& contact, Window* wnd = 0)
- virtual bool callContact (NamedList* params = 0, Window* wnd = 0)
- virtual bool updateProviders (const NamedList& provider, bool save, bool update)
- virtual bool callLogUpdate (const NamedList& params, bool save, bool update)
- virtual bool callLogDelete (const String& billid)
- virtual bool callLogClear (const String& table, const String& direction)
- virtual bool callLogCall (const String& billid, Window* wnd = 0)
- virtual bool callLogCreateContact (const String& billid)
- virtual bool help (const String& action, Window* wnd)
- virtual bool calltoLoaded ()
- virtual void loadedWindows ()
- virtual void initializedWindows ()
- virtual bool initializedClient ()
- virtual void exitingClient ()
- virtual bool handleUiAction (Message& msg, bool& stopLogic)
- virtual bool handleCallCdr (Message& msg, bool& stopLogic)
- virtual bool handleUserLogin (Message& msg, bool& stopLogic)
- virtual bool handleUserNotify (Message& msg, bool& stopLogic)
- virtual bool handleUserRoster (Message& msg, bool& stopLogic)
- virtual bool handleResourceNotify (Message& msg, bool& stopLogic)
- virtual bool handleResourceSubscribe (Message& msg, bool& stopLogic)
- virtual bool handleClientChanUpdate (Message& msg, bool& stopLogic)
- virtual bool handleContactInfo (Message& msg, bool& stopLogic)
- virtual bool defaultMsgHandler (Message& msg, int id, bool& stopLogic)
- virtual void updateSelectedChannel (const String* item = 0)
- virtual void engineStart (Message& msg)
- virtual void showInCallNotification (ClientChannel* chan)
- virtual void closeInCallNotification (const String& id)

#### Public Static Methods

- static inline String& buildAccountId (String& accId, const String& proto, const String& user, const String& host)

#### Protected Methods

- virtual void idleTimerTick (Time& time)
- virtual bool enableCallActions (const String& id)
- virtual bool fillCallStart (NamedList& p, Window* wnd = 0)
- virtual void channelSelectionChanged (const String& old)
- virtual void fillContactEditActive (NamedList& list, bool active, const String* item = 0, bool del = true)
- virtual void fillLogContactActive (NamedList& list, bool active, const String* item = 0)
- virtual bool clearList (const String& action, Window* wnd)
- virtual bool deleteItem (const String& list, const String& item, Window* wnd, bool confirm)
- virtual bool deleteCheckedItems (const String& list, Window* wnd, bool confirm)
- virtual bool deleteSelectedItem (const String& action, Window* wnd, bool checked = false)
- virtual bool handleTextChanged (NamedList* params, Window* wnd)
- virtual bool handleFileTransferAction (const String& name, Window* wnd, NamedList* params = 0)
- virtual bool handleFileTransferNotify (Message& msg, bool& stopLogic)
- virtual bool handleUserData (Message& msg, bool& stopLogic)
- virtual bool handleFileInfo (Message& msg, bool& stopLogic)
- virtual void notifyGenericError (const String& text, const String& account = String::empty(), const String& contact = String::empty(), const char* title = "Error")
- virtual void notifyNoAudio (bool show, bool micOk = false, bool speakerOk = false, ClientChannel* chan = 0)
- virtual void updateChatRoomsContactList (bool load, ClientAccount* acc, MucRoom* room = 0)
- virtual void joinRoom (MucRoom* room, bool force = false)

#### Protected Members

- String m_selectedChannel
- String m_transferInitiated

## Detailed Description

This class implements the default client behaviour.

explicit DefaultLogic (const char* name = "default", int prio = -100) | ### DefaultLogic

Constructor

Parameters:

name | The name of this logic
prio | The priority of this logic

~DefaultLogic () | ### ~DefaultLogic

Destructor

bool action (Window* wnd, const String& name, NamedList* params = 0) | ### action

[virtual]

Handle actions from user interface

Parameters:

wnd | The window in which the user did something
name | The action's name
params | Optional action parameters

Returns: True if the action was handled

Reimplemented from ClientLogic.

bool toggle (Window* wnd, const String& name, bool active) | ### toggle

[virtual]

Handle actions from checkable widgets

Parameters:

wnd | The window in which the user did something
name | The object's name
active | Object's state

Returns: True if the action was handled by a client logic

Reimplemented from ClientLogic.

bool select (Window* wnd, const String& name, const String& item, const String& text = String::empty()) | ### select

[virtual]

Handle 'select' actions from user interface

Parameters:

wnd | The window in which the user did something
name | The object's name
item | Item identifying the selection
text | Selection's text

Returns: True if the action was handled

Reimplemented from ClientLogic.

bool select (Window* wnd, const String& name, const NamedList& items) | ### select

[virtual]

Handle 'select' with multiple items actions from user interface

Parameters:

wnd | The window in which the user did something
name | The object's name
items | List of selected items

Returns: True if the action was handled

Reimplemented from ClientLogic.

bool setClientParam (const String& param, const String& value, bool save, bool update) | ### setClientParam

[virtual]

Set a client's parameter. Save the settings file and/or update interface

Parameters:

param | Parameter's name
value | The value of the parameter
save | True to save the configuration file
update | True to update the interface

Returns: True on success

Reimplemented from ClientLogic.

bool imIncoming (Message& msg) | ### imIncoming

[virtual]

Process an IM message

Parameters:

msg | The im.execute of chan.text message

Reimplemented from ClientLogic.

bool callIncoming (Message& msg, const String& dest) | ### callIncoming

[virtual]

Call execute handler called by the client. The default logic ask the client to build an incoming channel

Parameters:

msg | The call.execute message
dest | The destination (target)

Returns: True if a channel was created and connected

Reimplemented from ClientLogic.

bool validateCall (NamedList& params, Window* wnd = 0) | ### validateCall

[virtual]

Check presence of all necessary data to make a call

Parameters:

params | List of call parameters
wnd | Optional window containing the widget that triggered the action

Returns: True on success

Reimplemented from ClientLogic.

bool callStart (NamedList& params, Window* wnd = 0, const String& cmd = String::empty()) | ### callStart

[virtual]

Called when the user trigger a call start action The default logic fill the parameter list and ask the client to create an outgoing channel

Parameters:

params | List of call parameters
wnd | Optional window containing the widget that triggered the action
cmd | Optional command (widget name)

Returns: True on success

Reimplemented from ClientLogic.

bool digitPressed (NamedList& params, Window* wnd = 0) | ### digitPressed

[virtual]

Called when a digit is pressed. The default logic will send the digit(s) as DTMFs on the active channel

Parameters:

params | List of parameters. It should contain a 'digits' parameter
wnd | Optional window containing the widget that triggered the action

Returns: True on success

bool editAccount (bool newAcc, NamedList* params, Window* wnd = 0) | ### editAccount

[virtual]

Called when the user wants to add a new account or edit an existing one

Parameters:

newAcc | True to add a new account, false to edit an exisiting one
params | Initial parameters
wnd | Optional window containing the widget that triggered the action

Returns: True on success

Reimplemented from ClientLogic.

bool acceptAccount (NamedList* params, Window* wnd = 0) | ### acceptAccount

[virtual]

Called when the user wants to save account data

Parameters:

params | Initial parameters
wnd | Optional window containing the widget that triggered the action

Returns: True on success

Reimplemented from ClientLogic.

bool delAccount (const String& account, Window* wnd = 0) | ### delAccount

[virtual]

Called when the user wants to delete an existing account

Parameters:

account | The account's name. Set to empty to delete the current selection
wnd | Optional window containing the widget that triggered the action

Returns: True on success

Reimplemented from ClientLogic.

bool updateAccount (const NamedList& account, bool login, bool save) | ### updateAccount

[virtual]

Add/set an account

Parameters:

account | The account's parameters. The name of the list must be the account's name
login | True to login the account
save | True to save the accounts file. If true and file save fails the method will fail

Returns: True on success

Reimplemented from ClientLogic.

bool loginAccount (const NamedList& account, bool login) | ### loginAccount

[virtual]

Login/logout an account

Parameters:

account | The account's parameters. The name of the list must be the account's name
login | True to login the account, false to logout

Returns: True on success

Reimplemented from ClientLogic.

bool updateContact (const NamedList& contact, bool save, bool update) | ### updateContact

[virtual]

Add/set a contact

Parameters:

contact | The contact's parameters. The name of the list must be the contacts's id (name). If it starts with 'client/' this is a contact updated from server: it can't be changed
save | True to save data to contacts file
update | True to update the interface

Returns: True on success

Reimplemented from ClientLogic.

bool acceptContact (NamedList* params, Window* wnd = 0) | ### acceptContact

[virtual]

Called when the user wants to save account data

Parameters:

params | Initial parameters
wnd | Optional window containing the widget that triggered the action

Returns: True on success

Reimplemented from ClientLogic.

bool editContact (bool newCont, NamedList* params = 0, Window* wnd = 0) | ### editContact

[virtual]

Called when the user wants to add a new contact or edit an existing one

Parameters:

newCont | True to add a new contact, false to edit an existing one
params | Optional initial parameters
wnd | Optional window containing the widget that triggered the action

Returns: True on success

Reimplemented from ClientLogic.

bool delContact (const String& contact, Window* wnd = 0) | ### delContact

[virtual]

Called when the user wants to delete an existing contact

Parameters:

contact | The contact's id. Set to empty to delete the current selection
wnd | Optional window containing the widget that triggered the action

Returns: True on success

Reimplemented from ClientLogic.

bool callContact (NamedList* params = 0, Window* wnd = 0) | ### callContact

[virtual]

Called when the user wants to call an existing contact

Parameters:

params | Optional parameters
wnd | Optional window containing the widget that triggered the action

Returns: True on success

Reimplemented from ClientLogic.

bool updateProviders (const NamedList& provider, bool save, bool update) | ### updateProviders

[virtual]

Add/set account providers data

Parameters:

provider | The provider's parameters. The name of the list must be the provider's id (name)
save | True to save data to providers file
update | True to update the interface

Returns: True on success

Reimplemented from ClientLogic.

bool callLogUpdate (const NamedList& params, bool save, bool update) | ### callLogUpdate

[virtual]

Update the call log history

Parameters:

params | Call log data
save | True to save data to history file
update | True to update the interface

Returns: True

Reimplemented from ClientLogic.

bool callLogDelete (const String& billid) | ### callLogDelete

[virtual]

Remove a call log item

Parameters:

billid | The bill id of the call

Returns: True on success

Reimplemented from ClientLogic.

bool callLogClear (const String& table, const String& direction) | ### callLogClear

[virtual]

Clear the specified log and the entries from the history file and save the history file

Parameters:

table | Tebale to clear
direction | The call direction to clear (incoming,outgoing). Note that the direction is the value saved from call.cdr messages. If empty, all log entries will be cleared

Returns: True

Reimplemented from ClientLogic.

bool callLogCall (const String& billid, Window* wnd = 0) | ### callLogCall

[virtual]

Make an outgoing call to a target picked from the call log

Parameters:

billid | The bill id of the call
wnd | Optional window starting the action

Returns: True on success (call initiated)

Reimplemented from ClientLogic.

bool callLogCreateContact (const String& billid) | ### callLogCreateContact

[virtual]

Create a contact from a call log entry

Parameters:

billid | The bill id of the call

Returns: True on success (address book popup window was displayed)

Reimplemented from ClientLogic.

bool help (const String& action, Window* wnd) | ### help

[virtual]

Process help related actions

Parameters:

action | The action's name
wnd | The window owning the control

Returns: True on success

Reimplemented from ClientLogic.

bool calltoLoaded () | ### calltoLoaded

[virtual]

Called by the client after loaded the callto history file

Returns: True to tell the client to stop notifying other logics

Reimplemented from ClientLogic.

void loadedWindows () | ### loadedWindows

[virtual]

Called by the client after loaded the windows

Reimplemented from ClientLogic.

void initializedWindows () | ### initializedWindows

[virtual]

Called by the client after loaded and intialized the windows

Reimplemented from ClientLogic.

bool initializedClient () | ### initializedClient

[virtual]

Called by the client after loaded and intialized the windows and loaded configuration files. The default logic update client settings

Returns: True to stop processing this notification

Reimplemented from ClientLogic.

void exitingClient () | ### exitingClient

[virtual]

Called by the client before exiting. The default logic save client settings

Reimplemented from ClientLogic.

bool handleUiAction (Message& msg, bool& stopLogic) | ### handleUiAction

[virtual]

Process ui.action message

Parameters:

msg | Received message
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

bool handleCallCdr (Message& msg, bool& stopLogic) | ### handleCallCdr

[virtual]

Process call.cdr message

Parameters:

msg | Received message
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

bool handleUserLogin (Message& msg, bool& stopLogic) | ### handleUserLogin

[virtual]

Process user.login message

Parameters:

msg | Received message
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

bool handleUserNotify (Message& msg, bool& stopLogic) | ### handleUserNotify

[virtual]

Process user.notify message

Parameters:

msg | Received message
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

bool handleUserRoster (Message& msg, bool& stopLogic) | ### handleUserRoster

[virtual]

Process user.roster message

Parameters:

msg | Received message
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

bool handleResourceNotify (Message& msg, bool& stopLogic) | ### handleResourceNotify

[virtual]

Process resource.notify message

Parameters:

msg | Received message
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

bool handleResourceSubscribe (Message& msg, bool& stopLogic) | ### handleResourceSubscribe

[virtual]

Process resource.subscribe message

Parameters:

msg | Received message
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

bool handleClientChanUpdate (Message& msg, bool& stopLogic) | ### handleClientChanUpdate

[virtual]

Process clientchan.update message

Parameters:

msg | Received message
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

bool handleContactInfo (Message& msg, bool& stopLogic) | ### handleContactInfo

[virtual]

Process contact.info message

Parameters:

msg | Received message
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

bool defaultMsgHandler (Message& msg, int id, bool& stopLogic) | ### defaultMsgHandler

[virtual]

Default message processor called for id's not defined in client. Descendants may override it to process custom messages installed by them and relayed through the client

Parameters:

msg | Received message
id | Message id
stopLogic | Set to true on exit to tell the client to stop asking other logics

Returns: True to stop further processing by the engine

Reimplemented from ClientLogic.

void updateSelectedChannel (const String* item = 0) | ### updateSelectedChannel

[virtual]

Update from UI or from a given value the selected item in channels list. The selected channel may not be the active one

Parameters:

item | Optional new value for current selection. Set to 0 to upadte from UI

void engineStart (Message& msg) | ### engineStart

[virtual]

Engine start notification. Connect startup accounts

Parameters:

msg | The engine.start message

Reimplemented from ClientLogic.

void showInCallNotification (ClientChannel* chan) | ### showInCallNotification

[virtual]

Show incoming call notification for a given channel

Parameters:

chan | The channel

void closeInCallNotification (const String& id) | ### closeInCallNotification

[virtual]

Close incoming call notification for a given id

Parameters:

id | The notification id to close

inline String& buildAccountId (String& accId, const String& proto, const String& user, const String& host) | ### buildAccountId

[static]

Build an account id from protocol, username, host

Parameters:

accId | Destination string
proto | Account protocol
user | Account username
host | Account host

Returns: Destination string address

void idleTimerTick (Time& time) | ### idleTimerTick

[protected virtual]

Method called by the client when idle. This method is called in the UI's thread

Parameters:

time | The current time

Reimplemented from ClientLogic.

bool enableCallActions (const String& id) | ### enableCallActions

[protected virtual]

Enable call actions for a selected channel

Parameters:

id | Channel id

Returns: True on success

bool fillCallStart (NamedList& p, Window* wnd = 0) | ### fillCallStart

[protected virtual]

Fill call start parameter list from UI

Parameters:

p | The list of parameters to fill
wnd | Optional window owning the widget triggering the action

Returns: True on success

void channelSelectionChanged (const String& old) | ### channelSelectionChanged

[protected virtual]

Notification on selection changes in channels list. Enable call actions for currently selected channel

Parameters:

old | The old selection

void fillContactEditActive (NamedList& list, bool active, const String* item = 0, bool del = true) | ### fillContactEditActive

[protected virtual]

Fill contact edit/delete active parameters

Parameters:

list | Destination list
active | True to activate, false to deactivate
item | Optional selected item to check in contacts list if active
del | True to fill delete active parameter

void fillLogContactActive (NamedList& list, bool active, const String* item = 0) | ### fillLogContactActive

[protected virtual]

Fill log contact active parameter

Parameters:

list | Destination list
active | True to activate, false to deactivate
item | Optional selected item to check in calls log list if active

bool clearList (const String& action, Window* wnd) | ### clearList

[protected virtual]

Clear a list/table. Handle specific lists like CDR, accounts, contacts

Parameters:

action | The list. May contain an optional confirmation text to display. Format: 'list_name[:confirmation_text]'
wnd | Window owning the list/table

Returns: True on success

bool deleteItem (const String& list, const String& item, Window* wnd, bool confirm) | ### deleteItem

[protected virtual]

Delete a list/table item. Handle specific lists like CDR, accounts, contacts, mucs

Parameters:

list | The list
item | Item to delete
wnd | Window owning the list/table
confirm | Request confirmation for known list

Returns: True on success

bool deleteCheckedItems (const String& list, Window* wnd, bool confirm) | ### deleteCheckedItems

[protected virtual]

Handle list/table checked items deletion. Handle specific lists like CDR, accounts, contacts

Parameters:

list | The list
wnd | Window owning the list/table
confirm | Request confirmation for known list

Returns: True on success

bool deleteSelectedItem (const String& action, Window* wnd, bool checked = false) | ### deleteSelectedItem

[protected virtual]

Handle list/table selection or checked items deletion. Handle specific lists like CDR, accounts, contacts

Parameters:

action | Action to handle. May contain an optional confirmation text to display. Format: 'list_name[:confirmation_text]'
wnd | Window owning the list/table
checked | Set it to true to handle checked items deletion

Returns: True on success

bool handleTextChanged (NamedList* params, Window* wnd) | ### handleTextChanged

[protected virtual]

Handle text changed notification

Parameters:

params | Notification parameters
wnd | Window notifying the event

Returns: True if handled

bool handleFileTransferAction (const String& name, Window* wnd, NamedList* params = 0) | ### handleFileTransferAction

[protected virtual]

Handle file transfer actions

Parameters:

name | Action name
wnd | Window notifying the event
params | Optional action parameters

Returns: True if handled

bool handleFileTransferNotify (Message& msg, bool& stopLogic) | ### handleFileTransferNotify

[protected virtual]

Handle file transfer notifications. This method is called from logic message handler

Parameters:

msg | Notification message
stopLogic | Stop notifying other logics if set to true on return

Returns: True if handled

bool handleUserData (Message& msg, bool& stopLogic) | ### handleUserData

[protected virtual]

Handle user.data messages.

Parameters:

msg | The message
stopLogic | Stop notifying other logics if set to true on return

Returns: True if handled

bool handleFileInfo (Message& msg, bool& stopLogic) | ### handleFileInfo

[protected virtual]

Handle file.info messages.

Parameters:

msg | The message
stopLogic | Stop notifying other logics if set to true on return

Returns: True if handled

void notifyGenericError (const String& text, const String& account = String::empty(), const String& contact = String::empty(), const char* title = "Error") | ### notifyGenericError

[protected virtual]

Show a generic notification

Parameters:

text | Notification text
account | Optional concerned account
contact | Optional concerned contact
title | Notification title

void notifyNoAudio (bool show, bool micOk = false, bool speakerOk = false, ClientChannel* chan = 0) | ### notifyNoAudio

[protected virtual]

Show/hide no audio notification

Parameters:

show | Show or hide notification
micOk | False if microphone open failed
speakerOk | False if speaker open failed
chan | Optional failed channel

void updateChatRoomsContactList (bool load, ClientAccount* acc, MucRoom* room = 0) | ### updateChatRoomsContactList

[protected virtual]

(Un)Load account's saved chat rooms or a specific room in contact list

Parameters:

load | True to load, false to unload
acc | The account owning the chat rooms
room | The room to update, ignored if acc is not 0

void joinRoom (MucRoom* room, bool force = false) | ### joinRoom

[protected virtual]

Join a MUC room. Create/show chat. Update its status

Parameters:

room | The room
force | True to disconnect if connecting or online and re-connect

String m_selectedChannel | ### m_selectedChannel

[protected]

String m_transferInitiated | ### m_transferInitiated

[protected]

Generated by: paulc on bussard on Fri May 8 12:37:22 2015, using kdoc 2.0a54.