Yate: Client Class Reference

Yate

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
Client Class Referenceabstract

Class that runs the User Interface. More...

`#include <yatecbase.h>`

Inheritance diagram for Client:

## Public Types
enum | MsgID { CallCdr = 0, UiAction, UserLogin, UserNotify, ResourceNotify, ResourceSubscribe, ClientChanUpdate, UserRoster, ContactInfo, ChanNotify, MucRoom, MsgExecute, EngineStart, TransferNotify, UserData, FileInfo, MsgIdCount }
enum | ClientToggle { OptMultiLines = 0, OptAutoAnswer, OptRingIn, OptRingOut, OptActivateLastOutCall, OptActivateLastInCall, OptActivateCallOnSelect, OptKeypadVisible, OptOpenIncomingUrl, OptAddAccountOnStartup, OptDockedChat, OptDestroyChat, OptNotifyChatState, OptShowEmptyChat, OptSendEmptyChat, OptCount }
enum | TrayIconType { TrayIconMain = 0, TrayIconInfo = 1000, TrayIconIncomingChat = 3000, TrayIconNotification = 5000, TrayIconIncomingCall = 10000 }

## Public Member Functions
| Client (const char *name=0)
virtual | ~Client ()
virtual bool | startup ()
virtual void | run ()
virtual void | cleanup ()
virtual void | main ()=0
virtual void | lock ()=0
virtual void | unlock ()=0
void | lockOther ()
void | unlockOther ()
void | setThread (Thread *th)
virtual void | allHidden ()=0
void | loadUI (const char *file=0, bool init=true)
virtual void | quit ()=0
bool | openUrlSafe (const String &url)
virtual bool | openUrl (const String &url)=0
virtual bool | received (Message &msg, int id)
virtual bool | createWindowSafe (const String &name, const String &alias=String::empty())
virtual bool | createDialog (const String &name, Window *parent, const String &title, const String &alias=String::empty(), const NamedList *params=0)
virtual bool | createObject (void **dest, const String &type, const char *name, NamedList *params=0)
virtual bool | closeWindow (const String &name, bool hide=true)
virtual bool | closeDialog (const String &name, Window *wnd, Window *skip=0)
virtual bool | debugHook (bool active)
virtual bool | addToLog (const String &text)
virtual bool | setStatus (const String &text, Window *wnd=0)
bool | setStatusLocked (const String &text, Window *wnd=0)
bool | setParams (const NamedList *params, Window *wnd=0, Window *skip=0)
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)
bool | oneThread () const
int | line () const
void | line (int newLine)
bool | hasElement (const String &name, Window *wnd=0, Window *skip=0)
bool | setActive (const String &name, bool active, Window *wnd=0, Window *skip=0)
bool | setFocus (const String &name, bool select=false, Window *wnd=0, Window *skip=0)
bool | setShow (const String &name, bool visible, Window *wnd=0, Window *skip=0)
bool | setText (const String &name, const String &text, bool richText=false, Window *wnd=0, Window *skip=0)
bool | setCheck (const String &name, bool checked, Window *wnd=0, Window *skip=0)
bool | setSelect (const String &name, const String &item, Window *wnd=0, Window *skip=0)
bool | setUrgent (const String &name, bool urgent, Window *wnd=0, Window *skip=0)
bool | hasOption (const String &name, const String &item, Window *wnd=0, Window *skip=0)
virtual bool | getOptions (const String &name, NamedList *items, Window *wnd=0, Window *skip=0)
bool | addOption (const String &name, const String &item, bool atStart, const String &text=String::empty(), Window *wnd=0, Window *skip=0)
bool | delOption (const String &name, const String &item, Window *wnd=0, Window *skip=0)
bool | addLines (const String &name, const NamedList *lines, unsigned int max, bool atStart=false, Window *wnd=0, Window *skip=0)
bool | addTableRow (const String &name, const String &item, const NamedList *data=0, bool atStart=false, Window *wnd=0, Window *skip=0)
bool | setMultipleRows (const String &name, const NamedList &data, const String &prefix=String::empty(), Window *wnd=0, Window *skip=0)
bool | insertTableRow (const String &name, const String &item, const String &before, const NamedList *data=0, Window *wnd=0, Window *skip=0)
bool | delTableRow (const String &name, const String &item, Window *wnd=0, Window *skip=0)
bool | setTableRow (const String &name, const String &item, const NamedList *data, Window *wnd=0, Window *skip=0)
bool | getTableRow (const String &name, const String &item, NamedList *data=0, Window *wnd=0, Window *skip=0)
bool | clearTable (const String &name, Window *wnd=0, Window *skip=0)
bool | updateTableRow (const String &name, const String &item, const NamedList *data=0, bool atStart=false, Window *wnd=0, Window *skip=0)
bool | updateTableRows (const String &name, const NamedList *data, bool atStart=false, Window *wnd=0, Window *skip=0)
bool | setBusy (const String &name, bool on, Window *wnd=0, Window *skip=0)
bool | getText (const String &name, String &text, bool richText=false, Window *wnd=0, Window *skip=0)
bool | getCheck (const String &name, bool &checked, Window *wnd=0, Window *skip=0)
bool | getSelect (const String &name, String &item, Window *wnd=0, Window *skip=0)
bool | getSelect (const String &name, NamedList &items, Window *wnd=0, Window *skip=0)
bool | buildMenu (const NamedList &params, Window *wnd=0, Window *skip=0)
bool | removeMenu (const NamedList &params, Window *wnd=0, Window *skip=0)
virtual bool | setImage (const String &name, const String &image, Window *wnd=0, Window *skip=0)
virtual bool | setImageFit (const String &name, const String &image, Window *wnd=0, Window *skip=0)
virtual bool | setProperty (const String &name, const String &item, const String &value, Window *wnd=0, Window *skip=0)
virtual bool | getProperty (const String &name, const String &item, String &value, Window *wnd=0, Window *skip=0)
void | moveRelated (const Window *wnd, int dx, int dy)
bool | initialized () const
void | idleActions ()
bool | postpone (const Message &msg, int id, bool copyUserData=false)
virtual bool | chooseFile (Window *parent, NamedList &params)
virtual bool | setClientParam (const String &param, const String &value, bool save, bool update)
virtual bool | backspace (const String &name, Window *wnd=0)
void | installRelay (const char *name, int id, int prio)
virtual bool | callRouting (Message &msg)
virtual bool | imRouting (Message &msg)
virtual bool | imExecute (Message &msg)
virtual bool | buildIncomingChannel (Message &msg, const String &dest)
virtual bool | buildOutgoingChannel (NamedList &params)
bool | callIncoming (Message &msg, const String &dest)
void | callAnswer (const String &id, bool setActive=true)
void | callTerminate (const String &id, const char *reason=0, const char *error=0)
ClientChannel * | getActiveChannel ()
virtual bool | ringer (bool in, bool on)
virtual bool | createSound (const char *name, const char *file, const char *device=0)
bool | emitDigits (const char *digits, const String &id=String::empty())
bool | emitDigit (char digit, const String &id=String::empty())
bool | getBoolOpt (ClientToggle toggle)
bool | setBoolOpt (ClientToggle toggle, bool value, bool updateUi=false)
virtual bool | formatDateTime (String &dest, unsigned int secs, const char *format, bool utc=false)
Public Member Functions inherited from GenObject
| GenObject ()
virtual | ~GenObject ()
virtual bool | alive () const
virtual void | destruct ()
virtual const String & | toString () const
virtual const String & | traceId () const
virtual void * | getObject (const String &name) const
NamedCounter * | getObjCounter () const
NamedCounter * | setObjCounter (NamedCounter *counter)

## Static Public Member Functions
static Client * | self ()
static void | setSelf (Client *client)
static bool | valid ()
static bool | isClientMsg (Message &msg)
static bool | changing ()
static Window * | getWindow (const String &name)
static bool | setVisible (const String &name, bool show=true, bool activate=false)
static bool | getVisible (const String &name)
static bool | openPopup (const String &name, const NamedList *params=0, const Window *parent=0)
static bool | openMessage (const char *text, const Window *parent=0, const char *context=0)
static bool | openConfirm (const char *text, const Window *parent=0, const char *context=0)
static ObjList * | listWindows ()
static bool | exiting ()
static bool | getActive (const String &name)
static Message * | buildMessage (const char *msg, const String &account, const char *oper=0)
static Message * | buildNotify (bool online, const String &account, const ClientResource *from=0)
static Message * | buildSubscribe (bool request, bool ok, const String &account, const String &contact, const char *proto=0)
static Message * | buildUserRoster (bool update, const String &account, const String &contact, const char *proto=0)
static bool | addLogic (ClientLogic *logic)
static void | removeLogic (ClientLogic *logic)
static ClientLogic * | findLogic (const String &name)
static Message * | eventMessage (const String &event, Window *wnd=0, const char *name=0, NamedList *params=0)
static bool | save (Configuration &cfg, Window *parent=0, bool showErr=true)
static ClientToggle | getBoolOpt (const String &name)
static void | setLogicsTick ()
static void | appendEscape (String &buf, ObjList &list, char sep= ',', bool force=false)
static ObjList * | splitUnescape (const String &buf, char sep= ',', bool emptyOk=false)
static void | removeChars (String &buf, const char *chars)
static void | fixPhoneNumber (String &number, const char *chars=0)
static bool | addTrayIcon (const String &wndName, int prio, NamedList *params)
static bool | removeTrayIcon (const String &wndName, const String &name)
static bool | updateTrayIcon (const String &wndName)
static void | generateGuid (String &buf, const String &extra=String::empty())
static void | plain2html (String &buf, bool spaceEol=false)
static NamedString * | findParamByValue (NamedList &list, const String &value, NamedString *skip=0)
static int | decodeFlags (const TokenDict *dict, const NamedList &params, const String &prefix=String::empty())
static int | decodeFlags (const TokenDict *dict, const String &flags, int defVal=0)
static void | addPathSep (String &dest, const String &path, char sep=0)
static void | fixPathSep (String &path)
static bool | removeEndsWithPathSep (String &dest, const String &path, char sep=0)
static bool | getLastNameInPath (String &dest, const String &path, char sep=0)
static bool | removeLastNameInPath (String &dest, const String &path, char sep=0, const String &equalOnly=String::empty())
static bool | addToLogFormatted (const char *format,...)
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 NamedCounter * | getObjCounter (const String &name, bool create=true)
static ObjList & | getObjCounters ()

## Static Public Attributes
static Configuration | s_settings
static Configuration | s_actions
static Configuration | s_accounts
static Configuration | s_contacts
static Configuration | s_providers
static Configuration | s_history
static Configuration | s_calltoHistory
static Regexp | s_notSelected
static Regexp | s_guidRegexp
static String | s_skinPath
static String | s_soundPath
static String | s_ringInName
static String | s_ringOutName
static String | s_statusWidget
static String | s_debugWidget
static String | s_toggles [OptCount]
static int | s_maxConfPeers
static bool | s_engineStarted

## Protected Member Functions
virtual ClientLogic * | createDefaultLogic ()
virtual bool | createWindow (const String &name, const String &alias=String::empty())=0
virtual void | loadWindows (const char *file=0)=0
virtual void | initWindows ()
virtual void | initClient ()
virtual void | exitClient ()
virtual bool | isUIThread ()
bool | needProxy () const
bool | driverLockLoop ()

## Static Protected Member Functions
static bool | driverLock (long maxwait=0)
static void | driverUnlock ()

## Protected Attributes
ObjList | m_windows
bool | m_initialized
int | m_line
bool | m_oneThread
bool | m_toggles [OptCount]
ObjList | m_relays
ClientLogic * | m_defaultLogic
Thread * | m_clientThread

## Static Protected Attributes
static bool | s_exiting
static Client * | s_client
static int | s_changing
static ObjList | s_logics
static bool | s_idleLogicsTick

## Friends
class | Window
class | ClientChannel
class | ClientDriver
class | ClientLogic

## Detailed Description

Class that runs the User Interface.

Singleton class that holds the User Interface's main methods

## Member Enumeration Documentation

enum ClientToggle

Client boolean options mapped to UI toggles

enum MsgID

Message relays installed by this receiver.

enum TrayIconType

Tray icon valuers used in stack

## Constructor & Destructor Documentation

Client | ( | const char * | name = `0` | ) |
| explicit

Constructor

Parameters

  name | The client's name

virtual ~Client | ( |  | ) |
| virtual

Destructor

## Member Function Documentation

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

Handle actions from user interface. Enqueue an ui.event message if the action is not handled by a client logic

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 by a client logic

bool addLines | ( | const String & | name,
|  | const NamedList * | lines,
|  | unsigned int | max,
|  | bool | atStart = `false`,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Append or insert text lines to a widget

Parameters

  name | The name of the widget
  lines | List containing the lines
  max | The maximum number of lines allowed to be displayed. Set to 0 to ignore
  atStart | True to insert, false to append
  wnd | Optional window owning the widget
  skip | Optional window to skip if wnd is 0

Returns
  True on success

static bool addLogic | ( | ClientLogic * | logic | ) |
| static

Add a logic to the list. The added object is not owned by the client

Parameters

  logic | Pointer to the logic to add

Returns
  True on success. False if the pointer is 0 or already added

static void addPathSep | ( | String & | dest,
|  | const String & | path,
|  | char | sep = `0`
| ) |  |
| static

Add path separator at string end. Set destination string. Source and dstination may be the same string

Parameters

  dest | Destination string
  path | Source string
  sep | Path separator, use Engine::pathSeparator() if 0

virtual bool addToLog | ( | const String & | text | ) |
| virtual

Add a log line

Parameters

  text | Text to add

Returns
  True on success

static bool addToLogFormatted | ( | const char * | format,
|  |  | ...
| ) |  |
| static

Add a formatted log line

Parameters

  format | Text format

Returns
  True on success

static bool addTrayIcon | ( | const String & | wndName,
|  | int | prio,
|  | NamedList * | params
| ) |  |
| static

Add a tray icon to a window's stack. Update it if already there. Show it if it's the first one and the client is started. This method must be called from client's thread

Parameters

  wndName | The window owning the icon
  prio | Tray icon priority. The list is kept in ascending order
  params | Tray icon parameters. It will be consumed

Returns
  True on success

virtual void allHidden | ( |  | ) |
| pure virtual

Handle all windows closed event from UI

static void appendEscape | ( | String & | buf,
|  | ObjList & | list,
|  | char | sep = `','`,
|  | bool | force = `false`
| ) |  |
| static

Append URI escaped String items to a String buffer

Parameters

  buf | Destination string
  list | Source list
  sep | Destination list separator. It will be escaped in each added string
  force | True to allow appending empty strings

virtual bool backspace | ( | const String & | name,
|  | Window * | wnd = `0`
| ) |  |
| virtual

Remove the last character of the given widget

Parameters

  name | The widget (it might be the window itself)
  wnd | Optional window containing the widget that triggered the action

Returns
  True on success

virtual bool buildIncomingChannel | ( | Message & | msg,
|  | const String & | dest
| ) |  |
| virtual

Build an incoming channel. Answer it if succesfully connected and auto answer is set. Reject it if multiline is false and the driver is busy. Set the active one if requested by config and there is no active channel. Start the ringer if there is no active channel

Parameters

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

Returns
  True if a channel was created and connected

bool buildMenu | ( | const NamedList & | params,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Build a menu from a list of parameters and add it to a target.

Parameters

  params | Menu build parameters (list name is the menu name). Each menu item is indicated by a parameter item:[item_name]=[display_text]. A separator will be added if 'item_name' is empty. A new item will be created if 'display_text' is not empty. Set 'display_text' to empty string to use an existing item. Item image can be set by an 'image:item_name' parameter. If the item parameter is a NamedPointer carrying a NamedList a submenu will be created. Menu item properties can be set from parameters with format property:item_name:property_name=value. The following parameters can be set: title: menu display text (defaults to menu name) owner: optional menu owner (the window building the menu is assumed to be the owner if this parameter is empty) target: optional menu target (defaults to owner) before: optional item to insert before if the target is a menu container (another menu or a menu bar) before_separator: check if a separator already exists before the item 'before' and insert the menu before the separator
  wnd | Optional target window
  skip | Optional window to skip if wnd is 0

Returns
  True on success

static Message* buildMessage | ( | const char * | msg,
|  | const String & | account,
|  | const char * | oper = `0`
| ) |  |
| static

Build a message to be sent by the client. Add module, line and operation parameters

Parameters

  msg | Message name
  account | The account sending the message
  oper | Optional operation parameter

Returns
  Message pointer

Referenced by MucRoom::buildMucRoom().

static Message* buildNotify | ( | bool | online,
|  | const String & | account,
|  | const ClientResource * | from = `0`
| ) |  |
| static

Build a resource.notify message

Parameters

  online | True to build an 'online' message, false to build an 'offline' one
  account | The account sending the message
  from | Optional resource to add to message

Returns
  Message pointer

virtual bool buildOutgoingChannel | ( | NamedList & | params | ) |
| virtual

Build an outgoing channel

Parameters

  params | Call parameters

Returns
  True if a channel was created its router started

static Message* buildSubscribe | ( | bool | request,
|  | bool | ok,
|  | const String & | account,
|  | const String & | contact,
|  | const char * | proto = `0`
| ) |  |
| static

Build a resource.subscribe or resource.notify message to request a subscription or respond to a request

Parameters

  request | True to build a request, false to build a response
  ok | True to build a subscribe(d) message, false to build an unsubscribe(d) message
  account | The account to use for the message
  contact | The destination contact
  proto | Optional protocol

Returns
  Valid Message pointer

static Message* buildUserRoster | ( | bool | update,
|  | const String & | account,
|  | const String & | contact,
|  | const char * | proto = `0`
| ) |  |
| static

Build an user.roster message

Parameters

  update | True to build an update, false to build a delete request
  account | The account to use for the message
  contact | The contact to update or delete
  proto | Optional protocol

Returns
  Valid Message pointer

void callAnswer | ( | const String & | id,
|  | bool | setActive = `true`
| ) |  |

Answer an incoming call

Parameters

  id | The accepted channel's id
  setActive | True to activate the answered channel

Returns
  True on success

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

Call execute handler called by the driver. Ask the logics to create the channel

Parameters

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

Returns
  True if a channel was created and connected

virtual bool callRouting | ( | Message & | msg | ) |
| inlinevirtual

Call routing handler called by the driver

Parameters

  msg | The call.route message

void callTerminate | ( | const String & | id,
|  | const char * | reason = `0`,
|  | const char * | error = `0`
| ) |  |

Terminate a call

Parameters

  id | The channel's id
  reason | Optional termination reason
  error | Optional termination error

Returns
  True on success

virtual bool chooseFile | ( | Window * | parent,
|  | NamedList & | params
| ) |  |
| inlinevirtual

Show a file open/save dialog window This method isn't using the proxy thread since it's usually called on UI action

Parameters

  parent | Dialog window's parent
  params | Dialog window's params. Parameters that can be specified include 'caption', 'dir', 'filters', 'selectedfilter', 'confirmoverwrite', 'choosedir'.

Returns
  True on success

virtual void cleanup | ( |  | ) |
| virtual

Cleanup when thread terminates

virtual bool closeDialog | ( | const String & | name,
|  | Window * | wnd,
|  | Window * | skip = `0`
| ) |  |
| virtual

Destroy a modal dialog

Parameters

  name | Dialog name
  wnd | Window owning the dialog
  skip | Optional window to skip if wnd is null

Returns
  True on success

virtual bool closeWindow | ( | const String & | name,
|  | bool | hide = `true`
| ) |  |
| virtual

Hide/destroy a window with a given name

Parameters

  name | The window's name
  hide | True to hide, false to close

Returns
  True on success

virtual ClientLogic* createDefaultLogic | ( |  | ) |
| protectedvirtual

Create the default logic The default implementation creates a DefaultLogic object

Returns
  ClientLogic pointer or 0

virtual bool createDialog | ( | const String & | name,
|  | Window * | parent,
|  | const String & | title,
|  | const String & | alias = `String::empty()`,
|  | const NamedList * | params = `0`
| ) |  |
| virtual

Create a modal dialog owned by a given window

Parameters

  name | Dialog name (resource config section)
  parent | Parent window
  title | Dialog title
  alias | Optional dialog alias (used as dialog object name)
  params | Optional dialog parameters

Returns
  True on success

virtual bool createObject | ( | void ** | dest,
|  | const String & | type,
|  | const char * | name,
|  | NamedList * | params = `0`
| ) |  |
| virtual

Ask to an UI factory to create an object in the UI's thread

Parameters

  dest | Destination to be filled with the newly create object's address
  type | Object's type
  name | Object's name
  params | Optional object parameters

Returns
  True on success

virtual bool createSound | ( | const char * | name,
|  | const char * | file,
|  | const char * | device = `0`
| ) |  |
| inlinevirtual

Create a sound object. Append it to the global list

Parameters

  name | The name of sound object
  file | The file to play (should contain the whole path and the file name)
  device | Optional device used to play the file. Set to 0 to use the default one

Returns
  True on success, false if a sound with the given name already exists

virtual bool createWindowSafe | ( | const String & | name,
|  | const String & | alias = `String::empty()`
| ) |  |
| virtual

Create a window with a given name

Parameters

  name | The window's name
  alias | Window name alias after succesfully loaded. Set to empty string to use the given name

Returns
  True on success

virtual bool debugHook | ( | bool | active | ) |
| virtual

Install/uninstall a debugger output hook

Parameters

  active | True to install, false to uninstall the hook

Returns
  True on success

static int decodeFlags | ( | const TokenDict * | dict,
|  | const NamedList & | params,
|  | const String & | prefix = `String::empty()`
| ) |  |
| static

Decode flags from dictionary values found in a list of parameters Flags are allowed to begin with '!' to reset

Parameters

  dict | The dictionary containing the flags
  params | The list of parameters used to update the flags
  prefix | Optional parameter prefix

Returns
  Decoded flags

static int decodeFlags | ( | const TokenDict * | dict,
|  | const String & | flags,
|  | int | defVal = `0`
| ) |  |
| static

Decode flags from dictionary values and comma separated list. Flags are allowed to begin with '!' to reset

Parameters

  dict | The dictionary containing the flags
  flags | The list of flags
  defVal | Default value to return if empty or no non 0 value is found in dictionary

Returns
  Decoded flags

bool emitDigit | ( | char | digit,
|  | const String & | id = `String::empty()`
| ) |  |
| inline

Send a digit on selected channel

Parameters

  digit | The digit to send
  id | The channel id. Use the active one if empty

Returns
  True on success

References Client::emitDigits().

bool emitDigits | ( | const char * | digits,
|  | const String & | id = `String::empty()`
| ) |  |

Send digits on selected channel

Parameters

  digits | The digits to send
  id | The channel id. Use the active one if empty

Returns
  True on success

Referenced by Client::emitDigit().

static Message* eventMessage | ( | const String & | event,
|  | Window * | wnd = `0`,
|  | const char * | name = `0`,
|  | NamedList * | params = `0`
| ) |  |
| static

Build an 'ui.event' message

Parameters

  event | Event's name
  wnd | Optional window to add to message
  name | Optional 'name' parameter value
  params | Other optional parameters to be added to the message

Returns
  Valid Message pointer

static bool exiting | ( |  | ) |
| inlinestatic

Check if the client is exiting

Returns
  True if the client therad is exiting

Referenced by Client::valid().

static ClientLogic* findLogic | ( | const String & | name | ) |
| static

Convenience method to retrieve a logic

Parameters

  name | The logic's name

Returns
  ClientLogic pointer or 0

static NamedString* findParamByValue | ( | NamedList & | list,
|  | const String & | value,
|  | NamedString * | skip = `0`
| ) |  |
| static

Find a list parameter by its value

Parameters

  list | The list
  value | Parameter value
  skip | Optional parameter to skip

Returns
  NamedString pointer, 0 if not found

static void fixPathSep | ( | String & | path | ) |
| static

Fix path separator. Set it to platform default

Parameters

  path | The path

static void fixPhoneNumber | ( | String & | number,
|  | const char * | chars = `0`
| ) |  |
| static

Fix a phone number. Remove extra '+' from begining. Remove requested characters. Adding '+' to characters to remove won't remove the plus sign from the begining. Clear the number if a non digit char is found

Parameters

  number | Phone number to fix
  chars | Optional characters to remove from number

virtual bool formatDateTime | ( | String & | dest,
|  | unsigned int | secs,
|  | const char * | format,
|  | bool | utc = `false`
| ) |  |
| inlinevirtual

Build a date/time string from UTC time

Parameters

  dest | Destination string
  secs | Seconds since EPOCH
  format | Format string used to build the destination
  utc | True to build UTC time instead of local time

Returns
  True on success

static void generateGuid | ( | String & | buf,
|  | const String & | extra = `String::empty()`
| ) |  |
| static

Generate a GUID string in the format 8*HEX-4*HEX-4*HEX-4*HEX-12*HEX

Parameters

  buf | Destination string
  extra | Optional string whose hash will be inserted in the GUID

static bool getActive | ( | const String & | name | ) |
| static

Retrieve the active state of a window

Parameters

  name | Window name

Returns
  True if the window is found and it's active

ClientChannel* getActiveChannel | ( |  | ) |

Get the active channel if any

Returns
  Referenced pointer to the active channel or 0

bool getBoolOpt | ( | ClientToggle | toggle | ) |
| inline

Get a boolean option of this client

Parameters

  toggle | Options's id to retrieve

Returns
  True on success

References Client::toggle().

static ClientToggle getBoolOpt | ( | const String & | name | ) |
| static

Check if a string names a client's boolean option

Parameters

  name | String to check

Returns
  Valid client option index or OptCount if not found

static bool getLastNameInPath | ( | String & | dest,
|  | const String & | path,
|  | char | sep = `0`
| ) |  |
| static

Set destination from last item in path. Source and dstination may be the same string

Parameters

  dest | Destination string
  path | Source string
  sep | Path separator, use Engine::pathSeparator() if 0

Returns
  True if destination string is not empty

virtual bool getOptions | ( | const String & | name,
|  | NamedList * | items,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |
| virtual

Get an element's items

Parameters

  name | Name of the element to search for
  items | List to fill with element's items
  wnd | Optional window owning the element
  skip | Optional window to skip when searching for the element

Returns
  True if the element exists

virtual bool getProperty | ( | const String & | name,
|  | const String & | item,
|  | String & | value,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |
| virtual

Get a property

Parameters

  name | Name of the element
  item | Property's name
  value | Property's value
  wnd | Optional target window
  skip | Optional window to skip if wnd is 0

Returns
  True on success

bool getSelect | ( | const String & | name,
|  | NamedList & | items,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Retrieve an element's multiple selection

Parameters

  name | Name of the element
  items | List to be to filled with selection's contents
  wnd | Optional window owning the element
  skip | Optional window to skip if wnd is 0

Returns
  True if the operation was successfull

bool getText | ( | const String & | name,
|  | String & | text,
|  | bool | richText = `false`,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Get an element's text

Parameters

  name | Name of the element
  text | The destination string
  richText | True to get the element's roch text if supported.
  wnd | Optional window owning the element
  skip | Optional window to skip if wnd is 0

Returns
  True if the operation was successfull

virtual bool imExecute | ( | Message & | msg | ) |
| virtual

Process an IM message

Parameters

  msg | The im.execute of chan.text message

virtual bool imRouting | ( | Message & | msg | ) |
| inlinevirtual

IM message routing handler called by the driver

Parameters

  msg | The im.route message

bool insertTableRow | ( | const String & | name,
|  | const String & | item,
|  | const String & | before,
|  | const NamedList * | data = `0`,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Insert a row into a table owned by this window

Parameters

  name | Name of the element
  item | Name of the item to insert
  before | Name of the item to insert before
  data | Table's columns to set
  wnd | Optional window owning the element
  skip | Optional window to skip if wnd is 0

Returns
  True if the operation was successfull

void installRelay | ( | const char * | name,
|  | int | id,
|  | int | prio
| ) |  |

Create and install a message relay owned by this client. The new relay will be unistalled when the client is terminated

Parameters

  name | Message name
  id | Relay id
  prio | Message priority

static bool isClientMsg | ( | Message & | msg | ) |
| static

Check if a message is sent by the client

Parameters

  msg | The message to check

Returns
  True if the message has a 'module' parameter with the client driver's name

int line | ( |  | ) | const
| inline

Get the currently selected line

Returns
  The selected line

void line | ( | int | newLine | ) |

Set the selected line

Parameters

  newLine | The selected line

void loadUI | ( | const char * | file = `0`,
|  | bool | init = `true`
| ) |  |

Load windows and optionally (re)initialize the client's options.

Parameters

  file | The resource file describing the windows. Set to 0 to use the default one
  init | True to (re)initialize the client

virtual void lock | ( |  | ) |
| pure virtual

Lock the client

Referenced by Client::lockOther().

void lockOther | ( |  | ) |
| inline

Lock the client only if we are using more then 1 thread

References Client::lock().

virtual void main | ( |  | ) |
| pure virtual

Execute the client

bool oneThread | ( |  | ) | const
| inline

Check if the client is using more then 1 thread

Returns
  True if the client is using more then 1 thread

virtual bool openUrl | ( | const String & | url | ) |
| pure virtual

Open an URL (link)

Parameters

  url | The URL to open

Returns
  True on success

bool openUrlSafe | ( | const String & | url | ) |

Open an URL (link) in the client's thread

Parameters

  url | The URL to open

Returns
  True on success

static void plain2html | ( | String & | buf,
|  | bool | spaceEol = `false`
| ) |  |
| static

Replace plain text chars with HTML escape or markup

Parameters

  buf | Destination string
  spaceEol | True to replace end of line with space instead of html markup

bool postpone | ( | const Message & | msg,
|  | int | id,
|  | bool | copyUserData = `false`
| ) |  |

Postpone a copy of a message to be dispatched from the UI thread

Parameters

  msg | Message to be postponed
  id | Identifier of the message to be used on dispatch
  copyUserData | Copy source user data in postponed message

Returns
  True if the UI thread was not current so the message was postponed

virtual void quit | ( |  | ) |
| pure virtual

Terminate application

virtual bool received | ( | Message & | msg,
|  | int | id
| ) |  |
| virtual

Process a received message. Check for a logic to process it

Parameters

  msg | Received message
  id | Message id

Returns
  True if a logic processed the message (stop dispatching it)

Implements MessageReceiver.

static void removeChars | ( | String & | buf,
|  | const char * | chars
| ) |  |
| static

Remove characters from a given string

Parameters

  buf | Source string
  chars | Characters to remove from input string

static bool removeEndsWithPathSep | ( | String & | dest,
|  | const String & | path,
|  | char | sep = `0`
| ) |  |
| static

Remove path separator from string end. Set destination string. Source and dstination may be the same string

Parameters

  dest | Destination string
  path | Source string
  sep | Path separator, use Engine::pathSeparator() if 0

Returns
  True if destination string is not empty

static bool removeLastNameInPath | ( | String & | dest,
|  | const String & | path,
|  | char | sep = `0`,
|  | const String & | equalOnly = `String::empty()`
| ) |  |
| static

Remove last name in path, set destination from remaining. If the path ends with 'sep', only 'sep' is removed If the path don't contain 'sep' dest is set to empty. Source and dstination may be the same string

Parameters

  dest | Destination string
  path | Source string
  sep | Path separator, use Engine::pathSeparator() if 0
  equalOnly | Optional string to match last item. Don't remove (set destination to empty) if not equal

Returns
  True if removed

static void removeLogic | ( | ClientLogic * | logic | ) |
| static

Remove a logic from the list without destroying it

Parameters

  logic | Pointer to the logic to remove

bool removeMenu | ( | const NamedList & | params,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Remove a menu (from UI and memory)

Parameters

  params | Menu remove parameters. The following parameters can be set: owner: optional menu owner (the window building the menu is assumed to be the owner if this parameter is empty)
  wnd | Optional target window
  skip | Optional window to skip if wnd is 0

Returns
  True on success

static bool removeTrayIcon | ( | const String & | wndName,
|  | const String & | name
| ) |  |
| static

Remove a tray icon from a window's stack. Show the next one if it's the first This method must be called from client's thread

Parameters

  wndName | The window owning the icon
  name | Tray icon name

Returns
  True on success

virtual bool ringer | ( | bool | in,
|  | bool | on
| ) |  |
| virtual

Start/stop ringer. The ringer is started only if not disabled

Parameters

  in | True if the request is for the incoming call alert, false if it is for the outgoing call ringing alert
  on | True to start, false to stop the sound

Returns
  True on success

virtual void run | ( |  | ) |
| virtual

Run the client's main loop

static bool save | ( | Configuration & | cfg,
|  | Window * | parent = `0`,
|  | bool | showErr = `true`
| ) |  |
| static

Save a configuration file. Call openMessage() on failure

Parameters

  cfg | The configuration file to save
  parent | The parent of the error window if needded
  showErr | True to open a message popup on failure

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. Enqueue an ui.event message if the action is not handled by a client logic

Parameters

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

Returns
  True if the action was handled by a client logic

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

Handle 'select' with multiple items actions from user interface. Enqueue an ui.event message if the action is not handled by a client logic

Parameters

  wnd | The window in which the user selected the object
  name | The action's name
  items | List containing the selection

Returns
  True if the action was handled by a client logic

bool setBoolOpt | ( | ClientToggle | toggle,
|  | bool | value,
|  | bool | updateUi = `false`
| ) |  |

Set a boolean option of this client

Parameters

  toggle | Options's id to set
  value | Value to set
  updateUi | True to update UI

Returns
  True if the option's value changed

bool setBusy | ( | const String & | name,
|  | bool | on,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Show or hide control busy state

Parameters

  name | Name of the element
  on | True to show, false to hide
  wnd | Optional window owning the element
  skip | Optional window to skip if wnd is 0

Returns
  True if all the operations were successfull

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

Request to a logic to 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, false if the parameter doesn't exist, the value is incorrect or failed to save the file

virtual bool setImage | ( | const String & | name,
|  | const String & | image,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |
| virtual

Set an element's image

Parameters

  name | Name of the element
  image | Image to set
  wnd | Optional target window
  skip | Optional window to skip if wnd is 0

Returns
  True on success

virtual bool setImageFit | ( | const String & | name,
|  | const String & | image,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |
| virtual

Set an element's image. Request to fit the image in element

Parameters

  name | Name of the element
  image | Image to set
  wnd | Optional target window
  skip | Optional window to skip if wnd is 0

Returns
  True on success

static void setLogicsTick | ( |  | ) |
| inlinestatic

Set the flag indicating that the client should tick the logics

bool setMultipleRows | ( | const String & | name,
|  | const NamedList & | data,
|  | const String & | prefix = `String::empty()`,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Append or update several table rows at once

Parameters

  name | Name of the element
  data | Parameters to initialize the rows with
  prefix | Prefix to match (and remove) in parameter names
  wnd | Optional window owning the element
  skip | Optional window to skip if wnd is 0

Returns
  True if all the operations were successfull

bool setParams | ( | const NamedList * | params,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Set multiple window parameters

Parameters

  params | The parameter list
  wnd | Optional window whose params are to be set
  skip | Optional window to skip if wnd is 0

Returns
  True on success

virtual bool setProperty | ( | const String & | name,
|  | const String & | item,
|  | const String & | value,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |
| virtual

Set a property

Parameters

  name | Name of the element
  item | Property's name
  value | Property's value
  wnd | Optional target window
  skip | Optional window to skip if wnd is 0

Returns
  True on success

virtual bool setStatus | ( | const String & | text,
|  | Window * | wnd = `0`
| ) |  |
| virtual

Set the status text

Parameters

  text | Status text
  wnd | Optional window owning the status control

Returns
  True on success

bool setStatusLocked | ( | const String & | text,
|  | Window * | wnd = `0`
| ) |  |

Set the status text safely

Parameters

  text | Status text
  wnd | Optional window owning the status control

Returns
  True on success

void setThread | ( | Thread * | th | ) |
| inline

Set the client's thread

Parameters

  th | The thread on which the client will run on

static ObjList* splitUnescape | ( | const String & | buf,
|  | char | sep = `','`,
|  | bool | emptyOk = `false`
| ) |  |
| static

Splits a string at a delimiter character. URI unescape each string in result

Parameters

  buf | Source string
  sep | Character where to split the string. It will be unescaped in each string
  emptyOk | True if empty strings should be inserted in list

Returns
  A newly allocated list of strings, must be deleted after use

virtual bool startup | ( |  | ) |
| virtual

Start up the client thread

Returns
  True if the client thread is started, false otherwise

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

Handle actions from checkable widgets. Enqueue an ui.event message if the action is not handled by a client logic

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

Referenced by Client::getBoolOpt().

virtual void unlock | ( |  | ) |
| pure virtual

Unlock the client

Referenced by Client::unlockOther().

void unlockOther | ( |  | ) |
| inline

Unlock the client only if we are using more then 1 thread

References Client::unlock().

bool updateTableRow | ( | const String & | name,
|  | const String & | item,
|  | const NamedList * | data = `0`,
|  | bool | atStart = `false`,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Set a table row or add a new one if not found

Parameters

  name | Name of the element
  item | Table item to set/add
  data | Optional list of parameters used to set row data
  atStart | True to add item at start, false to add them to the end
  wnd | Optional window owning the element
  skip | Optional window to skip if wnd is 0

Returns
  True if the operation was successfull

bool updateTableRows | ( | const String & | name,
|  | const NamedList * | data,
|  | bool | atStart = `false`,
|  | Window * | wnd = `0`,
|  | Window * | skip = `0`
| ) |  |

Add or set one or more table row(s). Screen update is locked while changing the table. Each data list element is a NamedPointer carrying a NamedList with item parameters. The name of an element is the item to update. Set element's value to boolean value 'true' to add a new item if not found or 'false' to set an existing one. Set it to empty string to delete the item

Parameters

  name | Name of the table
  data | The list of items to add/set/delete
  atStart | True to add new items at start, false to add them to the end
  wnd | Optional window owning the element
  skip | Optional window to skip if wnd is 0

Returns
  True if the operation was successfull

static bool updateTrayIcon | ( | const String & | wndName | ) |
| static

Update the first tray icon in a window's stack. Remove any existing icon the the stack is empty This method must be called from client's thread

Parameters

  wndName | The window owning the icon

Returns
  True on success

static bool valid | ( |  | ) |
| inlinestatic

Check if the client object still exists and the client or engine is not exiting

Returns
  True if the client is valid (running) or the method is called from client's thread

References Engine::exiting(), and Client::exiting().

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

- yatecbase.h