Yate
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DefaultLogic Class Reference

The client's default logic. More...

#include <yatecbase.h>

Inheritance diagram for DefaultLogic:
ClientLogic GenObject

Public Member Functions

 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 Member Functions inherited from ClientLogic
virtual ~ClientLogic ()
 
const Stringname () const
 
int priority () const
 
virtual const StringtoString () const
 
bool setParams (const NamedList &params)
 
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 addDurationUpdate (DurationUpdate *duration, bool autoDelete=false)
 
virtual bool removeDurationUpdate (const String &name, bool delObj=false)
 
virtual bool removeDurationUpdate (DurationUpdate *duration, bool delObj=false)
 
virtual DurationUpdatefindDurationUpdate (const String &name, bool ref=true)
 
virtual void clearDurationUpdate ()
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual bool alive () const
 
virtual void * getObject (const String &name) const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Static Public Member Functions

static StringbuildAccountId (String &accId, const String &proto, const String &user, const String &host)
 
- Static Public Member Functions inherited from ClientLogic
static const StringcdrRemoteParty (const NamedList &params, bool outgoing)
 
static const StringcdrRemoteParty (const NamedList &params)
 
static void initStaticData ()
 
static bool saveContact (Configuration &cfg, ClientContact *c, bool save=true)
 
static bool clearContact (Configuration &cfg, ClientContact *c, bool save=true)
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 

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)
 
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 Member Functions inherited from ClientLogic
 ClientLogic (const char *name, int priority)
 

Protected Attributes

String m_selectedChannel
 
String m_transferInitiated
 
- Protected Attributes inherited from ClientLogic
ObjList m_durationUpdate
 
Mutex m_durationMutex
 

Additional Inherited Members

- Static Public Attributes inherited from ClientLogic
static ObjList s_accOptions
 
static const char * s_provParams []
 
static ObjList s_protocols
 
static Mutex s_protocolsMutex
 

Detailed Description

The client's default logic.

This class implements the default client behaviour.

Constructor & Destructor Documentation

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

Constructor

Parameters
nameThe name of this logic
prioThe priority of this logic

Destructor

Member Function Documentation

virtual bool acceptAccount ( NamedList params,
Window wnd = 0 
)
virtual

Called when the user wants to save account data

Parameters
paramsInitial parameters
wndOptional window containing the widget that triggered the action
Returns
True on success

Reimplemented from ClientLogic.

virtual bool acceptContact ( NamedList params,
Window wnd = 0 
)
virtual

Called when the user wants to save account data

Parameters
paramsInitial parameters
wndOptional window containing the widget that triggered the action
Returns
True on success

Reimplemented from ClientLogic.

virtual bool action ( Window wnd,
const String name,
NamedList params = 0 
)
virtual

Handle actions from user interface

Parameters
wndThe window in which the user did something
nameThe action's name
paramsOptional action parameters
Returns
True if the action was handled

Reimplemented from ClientLogic.

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

Build an account id from protocol, username, host

Parameters
accIdDestination string
protoAccount protocol
userAccount username
hostAccount host
Returns
Destination string address
virtual bool callContact ( NamedList params = 0,
Window wnd = 0 
)
virtual

Called when the user wants to call an existing contact

Parameters
paramsOptional parameters
wndOptional window containing the widget that triggered the action
Returns
True on success

Reimplemented from ClientLogic.

virtual bool callIncoming ( Message msg,
const String dest 
)
virtual

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

Parameters
msgThe call.execute message
destThe destination (target)
Returns
True if a channel was created and connected

Reimplemented from ClientLogic.

virtual bool callLogCall ( const String billid,
Window wnd = 0 
)
virtual

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

Parameters
billidThe bill id of the call
wndOptional window starting the action
Returns
True on success (call initiated)

Reimplemented from ClientLogic.

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
tableTebale to clear
directionThe 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.

virtual bool callLogCreateContact ( const String billid)
virtual

Create a contact from a call log entry

Parameters
billidThe bill id of the call
Returns
True on success (address book popup window was displayed)

Reimplemented from ClientLogic.

virtual bool callLogDelete ( const String billid)
virtual

Remove a call log item

Parameters
billidThe bill id of the call
Returns
True on success

Reimplemented from ClientLogic.

virtual bool callLogUpdate ( const NamedList params,
bool  save,
bool  update 
)
virtual

Update the call log history

Parameters
paramsCall log data
saveTrue to save data to history file
updateTrue to update the interface
Returns
True

Reimplemented from ClientLogic.

virtual bool callStart ( NamedList params,
Window wnd = 0,
const String cmd = String::empty() 
)
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
paramsList of call parameters
wndOptional window containing the widget that triggered the action
cmdOptional command (widget name)
Returns
True on success

Reimplemented from ClientLogic.

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

Reimplemented from ClientLogic.

virtual void channelSelectionChanged ( const String old)
protectedvirtual

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

Parameters
oldThe old selection
virtual bool clearList ( const String action,
Window wnd 
)
protectedvirtual

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

Parameters
actionThe list. May contain an optional confirmation text to display. Format: 'list_name[:confirmation_text]'
wndWindow owning the list/table
Returns
True on success
virtual void closeInCallNotification ( const String id)
virtual

Close incoming call notification for a given id

Parameters
idThe notification id to close
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
msgReceived message
idMessage id
stopLogicSet 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.

virtual bool delAccount ( const String account,
Window wnd = 0 
)
virtual

Called when the user wants to delete an existing account

Parameters
accountThe account's name. Set to empty to delete the current selection
wndOptional window containing the widget that triggered the action
Returns
True on success

Reimplemented from ClientLogic.

virtual bool delContact ( const String contact,
Window wnd = 0 
)
virtual

Called when the user wants to delete an existing contact

Parameters
contactThe contact's id. Set to empty to delete the current selection
wndOptional window containing the widget that triggered the action
Returns
True on success

Reimplemented from ClientLogic.

virtual bool deleteCheckedItems ( const String list,
Window wnd,
bool  confirm 
)
protectedvirtual

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

Parameters
listThe list
wndWindow owning the list/table
confirmRequest confirmation for known list
Returns
True on success
virtual bool deleteItem ( const String list,
const String item,
Window wnd,
bool  confirm 
)
protectedvirtual

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

Parameters
listThe list
itemItem to delete
wndWindow owning the list/table
confirmRequest confirmation for known list
Returns
True on success
virtual bool deleteSelectedItem ( const String action,
Window wnd,
bool  checked = false 
)
protectedvirtual

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

Parameters
actionAction to handle. May contain an optional confirmation text to display. Format: 'list_name[:confirmation_text]'
wndWindow owning the list/table
checkedSet it to true to handle checked items deletion
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
paramsList of parameters. It should contain a 'digits' parameter
wndOptional window containing the widget that triggered the action
Returns
True on success
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
newAccTrue to add a new account, false to edit an exisiting one
paramsInitial parameters
wndOptional window containing the widget that triggered the action
Returns
True on success

Reimplemented from ClientLogic.

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
newContTrue to add a new contact, false to edit an existing one
paramsOptional initial parameters
wndOptional window containing the widget that triggered the action
Returns
True on success

Reimplemented from ClientLogic.

virtual bool enableCallActions ( const String id)
protectedvirtual

Enable call actions for a selected channel

Parameters
idChannel id
Returns
True on success
virtual void engineStart ( Message msg)
virtual

Engine start notification. Connect startup accounts

Parameters
msgThe engine.start message

Reimplemented from ClientLogic.

virtual void exitingClient ( )
virtual

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

Reimplemented from ClientLogic.

virtual bool fillCallStart ( NamedList p,
Window wnd = 0 
)
protectedvirtual

Fill call start parameter list from UI

Parameters
pThe list of parameters to fill
wndOptional window owning the widget triggering the action
Returns
True on success
virtual void fillContactEditActive ( NamedList list,
bool  active,
const String item = 0,
bool  del = true 
)
protectedvirtual

Fill contact edit/delete active parameters

Parameters
listDestination list
activeTrue to activate, false to deactivate
itemOptional selected item to check in contacts list if active
delTrue to fill delete active parameter
virtual void fillLogContactActive ( NamedList list,
bool  active,
const String item = 0 
)
protectedvirtual

Fill log contact active parameter

Parameters
listDestination list
activeTrue to activate, false to deactivate
itemOptional selected item to check in calls log list if active
virtual bool handleCallCdr ( Message msg,
bool &  stopLogic 
)
virtual

Process call.cdr message

Parameters
msgReceived message
stopLogicSet 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.

virtual bool handleClientChanUpdate ( Message msg,
bool &  stopLogic 
)
virtual

Process clientchan.update message

Parameters
msgReceived message
stopLogicSet 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.

virtual bool handleContactInfo ( Message msg,
bool &  stopLogic 
)
virtual

Process contact.info message

Parameters
msgReceived message
stopLogicSet 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.

virtual bool handleFileInfo ( Message msg,
bool &  stopLogic 
)
protectedvirtual

Handle file.info messages.

Parameters
msgThe message
stopLogicStop notifying other logics if set to true on return
Returns
True if handled
virtual bool handleFileTransferAction ( const String name,
Window wnd,
NamedList params = 0 
)
protectedvirtual

Handle file transfer actions

Parameters
nameAction name
wndWindow notifying the event
paramsOptional action parameters
Returns
True if handled
virtual bool handleFileTransferNotify ( Message msg,
bool &  stopLogic 
)
protectedvirtual

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

Parameters
msgNotification message
stopLogicStop notifying other logics if set to true on return
Returns
True if handled
virtual bool handleResourceNotify ( Message msg,
bool &  stopLogic 
)
virtual

Process resource.notify message

Parameters
msgReceived message
stopLogicSet 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.

virtual bool handleResourceSubscribe ( Message msg,
bool &  stopLogic 
)
virtual

Process resource.subscribe message

Parameters
msgReceived message
stopLogicSet 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.

virtual bool handleTextChanged ( NamedList params,
Window wnd 
)
protectedvirtual

Handle text changed notification

Parameters
paramsNotification parameters
wndWindow notifying the event
Returns
True if handled
virtual bool handleUiAction ( Message msg,
bool &  stopLogic 
)
virtual

Process ui.action message

Parameters
msgReceived message
stopLogicSet 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.

virtual bool handleUserData ( Message msg,
bool &  stopLogic 
)
protectedvirtual

Handle user.data messages.

Parameters
msgThe message
stopLogicStop notifying other logics if set to true on return
Returns
True if handled
virtual bool handleUserLogin ( Message msg,
bool &  stopLogic 
)
virtual

Process user.login message

Parameters
msgReceived message
stopLogicSet 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.

virtual bool handleUserNotify ( Message msg,
bool &  stopLogic 
)
virtual

Process user.notify message

Parameters
msgReceived message
stopLogicSet 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.

virtual bool handleUserRoster ( Message msg,
bool &  stopLogic 
)
virtual

Process user.roster message

Parameters
msgReceived message
stopLogicSet 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.

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

Process help related actions

Parameters
actionThe action's name
wndThe window owning the control
Returns
True on success

Reimplemented from ClientLogic.

virtual void idleTimerTick ( Time time)
protectedvirtual

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

Parameters
timeThe current time

Reimplemented from ClientLogic.

virtual bool imIncoming ( Message msg)
virtual

Process an IM message

Parameters
msgThe im.execute of chan.text message

Reimplemented from ClientLogic.

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

Reimplemented from ClientLogic.

virtual void initializedWindows ( )
virtual

Called by the client after loaded and intialized the windows

Reimplemented from ClientLogic.

virtual void joinRoom ( MucRoom room,
bool  force = false 
)
protectedvirtual

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

Parameters
roomThe room
forceTrue to disconnect if connecting or online and re-connect
virtual void loadedWindows ( )
inlinevirtual

Called by the client after loaded the windows

Reimplemented from ClientLogic.

virtual bool loginAccount ( const NamedList account,
bool  login 
)
virtual

Login/logout an account

Parameters
accountThe account's parameters. The name of the list must be the account's name
loginTrue to login the account, false to logout
Returns
True on success

Reimplemented from ClientLogic.

virtual void notifyGenericError ( const String text,
const String account = String::empty(),
const String contact = String::empty(),
const char *  title = "Error" 
)
protectedvirtual

Show a generic notification

Parameters
textNotification text
accountOptional concerned account
contactOptional concerned contact
titleNotification title
virtual void notifyNoAudio ( bool  show,
bool  micOk = false,
bool  speakerOk = false,
ClientChannel chan = 0 
)
protectedvirtual

Show/hide no audio notification

Parameters
showShow or hide notification
micOkFalse if microphone open failed
speakerOkFalse if speaker open failed
chanOptional failed channel
virtual bool select ( Window wnd,
const String name,
const String item,
const String text = String::empty() 
)
virtual

Handle 'select' actions from user interface

Parameters
wndThe window in which the user did something
nameThe object's name
itemItem identifying the selection
textSelection's text
Returns
True if the action was handled

Reimplemented from ClientLogic.

virtual bool select ( Window wnd,
const String name,
const NamedList items 
)
virtual

Handle 'select' with multiple items actions from user interface

Parameters
wndThe window in which the user did something
nameThe object's name
itemsList of selected items
Returns
True if the action was handled

Reimplemented from ClientLogic.

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
paramParameter's name
valueThe value of the parameter
saveTrue to save the configuration file
updateTrue to update the interface
Returns
True on success

Reimplemented from ClientLogic.

virtual void showInCallNotification ( ClientChannel chan)
virtual

Show incoming call notification for a given channel

Parameters
chanThe channel
virtual bool toggle ( Window wnd,
const String name,
bool  active 
)
virtual

Handle actions from checkable widgets

Parameters
wndThe window in which the user did something
nameThe object's name
activeObject's state
Returns
True if the action was handled by a client logic

Reimplemented from ClientLogic.

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

Add/set an account

Parameters
accountThe account's parameters. The name of the list must be the account's name
loginTrue to login the account
saveTrue to save the accounts file. If true and file save fails the method will fail
Returns
True on success

Reimplemented from ClientLogic.

virtual void updateChatRoomsContactList ( bool  load,
ClientAccount acc,
MucRoom room = 0 
)
protectedvirtual

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

Parameters
loadTrue to load, false to unload
accThe account owning the chat rooms
roomThe room to update, ignored if acc is not 0
virtual bool updateContact ( const NamedList contact,
bool  save,
bool  update 
)
virtual

Add/set a contact

Parameters
contactThe 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
saveTrue to save data to contacts file
updateTrue to update the interface
Returns
True on success

Reimplemented from ClientLogic.

virtual bool updateProviders ( const NamedList provider,
bool  save,
bool  update 
)
virtual

Add/set account providers data

Parameters
providerThe provider's parameters. The name of the list must be the provider's id (name)
saveTrue to save data to providers file
updateTrue to update the interface
Returns
True on success

Reimplemented from ClientLogic.

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
itemOptional new value for current selection. Set to 0 to upadte from UI
virtual bool validateCall ( NamedList params,
Window wnd = 0 
)
virtual

Check presence of all necessary data to make a call

Parameters
paramsList of call parameters
wndOptional window containing the widget that triggered the action
Returns
True on success

Reimplemented from ClientLogic.


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