ClientLogic Class Reference

Base client functionality. More...

#include <yatecbase.h>

Inheritance diagram for ClientLogic:

GenObject

List of all members.

Public Member Functions

 ClientLogic ()
 ClientLogic (const char *name, int priority)
virtual ~ClientLogic ()
virtual const StringtoString () const
int priority () const
bool setParams (const NamedList &params)
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 setClientParam (const String &param, const String &value, bool save, bool update)
virtual bool callIncoming (Message &msg, const String &dest)
virtual bool callStart (NamedList &params, Window *wnd=0)
virtual bool digitPressed (NamedList &params, Window *wnd=0)
virtual bool line (const String &name, Window *wnd=0)
virtual bool display (NamedList &params, bool widget, Window *wnd=0)
virtual bool backspace (const String &name, Window *wnd=0)
virtual bool command (const String &name, Window *wnd=0)
virtual bool debug (const String &name, bool active, 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 (NamedList &params, bool save, bool update)
virtual bool callLogClear (const String &table, const String &direction)
virtual bool callLogCall (const String &billid)
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 handleResourceNotify (Message &msg, bool &stopLogic)
virtual bool handleResourceSubscribe (Message &msg, bool &stopLogic)
virtual bool handleXmppIq (Message &msg, bool &stopLogic)
virtual bool handleClientChanUpdate (Message &msg, bool &stopLogic)
virtual bool defaultMsgHandler (Message &msg, int id, bool &stopLogic)
virtual void updateSelectedChannel (const String *item=0)
bool addDurationUpdate (DurationUpdate *duration, bool autoDelete=false)
bool removeDurationUpdate (const String &name, bool delObj=false)
bool removeDurationUpdate (DurationUpdate *duration, bool delObj=false)
DurationUpdatefindDurationUpdate (const String &name, bool ref=true)
void clearDurationUpdate ()

Protected Member Functions

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)

Protected Attributes

String m_name
String m_selectedChannel
int m_prio
ObjList m_durationUpdate
Mutex m_durationMutex
String m_transferInitiated
bool m_accShowAdvanced

Friends

class Client


Detailed Description

Base client functionality.

This class implements the logic behind different actions in the client. It specifies the way the graphical interface of the client will behave in different circumstances.


Constructor & Destructor Documentation

ClientLogic (  ) 

Constructor. Append itself to the client's list

ClientLogic ( const char *  name,
int  priority 
)

Constructor. Append itself to the client's list

Parameters:
name The name of this logic (module)
priority The priority of this logic

virtual ~ClientLogic (  )  [virtual]

Destructor. Remove itself from the client's list


Member Function Documentation

virtual bool acceptAccount ( NamedList params,
Window wnd = 0 
) [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

virtual bool acceptContact ( NamedList params,
Window wnd = 0 
) [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

virtual bool action ( Window wnd,
const String name,
NamedList params = 0 
) [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

bool addDurationUpdate ( DurationUpdate duration,
bool  autoDelete = false 
)

Add a duration object to this client's list

Parameters:
duration The object to add
autoDelete True to delete the object when the list is cleared
Returns:
True on success

virtual bool backspace ( const String name,
Window wnd = 0 
) [virtual]

Called when the user pressed the backspace key. The default behaviour is to erase the last digit from the "callto" box

Parameters:
name The active widget (it might be the window itself)
wnd Optional window containing the widget that triggered the action
Returns:
True on success

virtual bool callContact ( NamedList params = 0,
Window wnd = 0 
) [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

virtual bool callIncoming ( Message msg,
const String dest 
) [inline, 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

virtual bool callLogCall ( const String billid  )  [virtual]

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

Parameters:
billid The bill id of the call
Returns:
True on success (call initiated)

virtual bool callLogClear ( const String table,
const String direction 
) [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

virtual bool callLogCreateContact ( const String billid  )  [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)

virtual bool callLogUpdate ( NamedList params,
bool  save,
bool  update 
) [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

virtual bool callStart ( NamedList params,
Window wnd = 0 
) [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
Returns:
True on success

virtual bool calltoLoaded (  )  [virtual]

Called by the client after loaded the callto history file

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

virtual void channelSelectionChanged ( const String old  )  [protected, virtual]

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

Parameters:
old The old selection

void clearDurationUpdate (  ) 

Remove all duration objects

virtual bool command ( const String name,
Window wnd = 0 
) [virtual]

Called when the user pressed a command action. The default behaviour is to enqueue an engine.command message

Parameters:
name The command name
wnd Optional window containing the widget that triggered the action
Returns:
True on success

virtual bool debug ( const String name,
bool  active,
Window wnd = 0 
) [virtual]

Called when the user changed the toggled state of a "debug:" widget. The default behaviour is to enqueue an engine.debug message

Parameters:
name The debug action content (following the prefix)
active The widget's state
wnd Optional window containing the widget that triggered the action
Returns:
True on success

virtual bool defaultMsgHandler ( Message msg,
int  id,
bool &  stopLogic 
) [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

virtual bool delAccount ( const String account,
Window wnd = 0 
) [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

virtual bool delContact ( const String contact,
Window wnd = 0 
) [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

virtual bool digitPressed ( NamedList params,
Window wnd = 0 
) [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

virtual bool display ( NamedList params,
bool  widget,
Window wnd = 0 
) [virtual]

Show/hide widget(s) or window(s) on 'display'/'show' action

Parameters:
params Widget(s) or window(s) to show/hide
widget True if the operation indicates widget(s), false otherwise
wnd Optional window owning the action sender
Returns:
False if failed to show/hide all widgets/windows

virtual bool editAccount ( bool  newAcc,
NamedList params,
Window wnd = 0 
) [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

virtual bool editContact ( bool  newCont,
NamedList params = 0,
Window wnd = 0 
) [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

virtual bool enableCallActions ( const String id  )  [protected, virtual]

Enable call actions for a selected channel

Parameters:
id Channel id
Returns:
True on success

virtual void exitingClient (  )  [virtual]

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

virtual bool fillCallStart ( NamedList p,
Window wnd = 0 
) [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

DurationUpdate* findDurationUpdate ( const String name,
bool  ref = true 
)

Find a duration update by its name

Parameters:
name The name of the object to find
ref True to increase its reference counter before returning
Returns:
DurationUpdate pointer or 0

virtual bool handleCallCdr ( Message msg,
bool &  stopLogic 
) [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

virtual bool handleClientChanUpdate ( Message msg,
bool &  stopLogic 
) [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

virtual bool handleResourceNotify ( Message msg,
bool &  stopLogic 
) [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

virtual bool handleResourceSubscribe ( Message msg,
bool &  stopLogic 
) [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

virtual bool handleUiAction ( Message msg,
bool &  stopLogic 
) [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

virtual bool handleUserLogin ( Message msg,
bool &  stopLogic 
) [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

virtual bool handleUserNotify ( Message msg,
bool &  stopLogic 
) [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

virtual bool handleXmppIq ( Message msg,
bool &  stopLogic 
) [inline, virtual]

Process xmpp.iq 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

virtual bool help ( const String action,
Window wnd 
) [virtual]

Process help related actions

Parameters:
action The action's name
wnd The window owning the control
Returns:
True on success

virtual void idleTimerTick ( Time time  )  [protected, virtual]

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

Parameters:
time The current time

virtual bool 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

virtual void initializedWindows (  )  [virtual]

Called by the client after loaded and intialized the windows

virtual bool line ( const String name,
Window wnd = 0 
) [virtual]

Called when the user selected a line

Parameters:
name The line name
wnd Optional window containing the widget that triggered the action
Returns:
True on success

virtual void loadedWindows (  )  [inline, virtual]

Called by the client after loaded the windows

virtual bool loginAccount ( const NamedList account,
bool  login 
) [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

int priority (  )  const [inline]

Get the priority of this logic

Returns:
This logic's priority

bool removeDurationUpdate ( DurationUpdate duration,
bool  delObj = false 
)

Remove a duration object from list

Parameters:
duration The object to remove
delObj True to destroy the object, false to remove it
Returns:
True on success

bool removeDurationUpdate ( const String name,
bool  delObj = false 
)

Remove a duration object from list

Parameters:
name The name of the object to remove
delObj True to destroy the object, false to remove it
Returns:
True on success

virtual bool select ( Window wnd,
const String name,
const String item,
const String text = String::empty() 
) [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

virtual bool setClientParam ( const String param,
const String value,
bool  save,
bool  update 
) [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

bool setParams ( const NamedList params  ) 

Process a request to set client parameters

Parameters:
params The parameter list
Returns:
True on success

virtual bool toggle ( Window wnd,
const String name,
bool  active 
) [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

virtual const String& toString (  )  const [virtual]

Function that returns the name of the logic

Returns:
The name of this client logic

Reimplemented from GenObject.

virtual bool updateAccount ( const NamedList account,
bool  login,
bool  save 
) [virtual]

Add/set an account. Login if required

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

virtual bool updateContact ( const NamedList contact,
bool  save,
bool  update 
) [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

virtual bool updateProviders ( const NamedList provider,
bool  save,
bool  update 
) [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

virtual void updateSelectedChannel ( const String item = 0  )  [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


The documentation for this class was generated from the following file:

Generated on Sun Dec 7 21:36:12 2008 for Yate by  doxygen 1.5.7.1