class ClientContact

A client contact. More...

Full nameTelEngine::ClientContact
Definition#include <yatecbase.h>
InheritsTelEngine::RefObject [public ]
Inherited byMucRoom
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods

Public Members

Protected Methods

Protected Members


Detailed Description

A client contact The contact is using the owner's mutex to lock it's operations

explicit  ClientContact (ClientAccount* owner, const char* id, const char* name = 0, const char* uri = 0)

ClientContact

Constructor. Append itself to the owner's list

Parameters:
ownerThe contact's owner
idThe contact's id
nameOptional display name. Defaults to the id's value if 0
uriOptional contact URI

explicit  ClientContact (ClientAccount* owner, const NamedList& params, const char* id = 0, const char* uri = 0)

ClientContact

Constructor. Build a contact from a list of parameters. Append itself to the owner's list

Parameters:
ownerThe contact's owner
paramsThe list of parameters used to build this contact
idOptional contact id
uriOptional contact URI

inline ClientAccount*  account ()

account

Get this contact's account

Returns: This contact's account

inline const String&  accountName ()

accountName

[const]

Get this contact account's name (id)

Returns: This contact account name (id) or an empty string if none

inline const URI&  uri ()

uri

[const]

Get this contact's URI

Returns: This contact's URI

inline void  setUri (const char* u)

setUri

Set this contact's URI

Parameters:
uNew contact URI

inline ObjList&  resources ()

resources

Get the resource list of this contact

Returns: The resource list of this contact

inline bool  online ()

online

[const]

Check if the contact is online (the online flag is set or has at least 1 resource in list)

Returns: True if the contact is online

inline void  setOnline (bool on)

setOnline

Set the online flag

Parameters:
onThe new value for online flag

inline ObjList&  groups ()

groups

Get the group list of this contact

Returns: The group list of this contact

inline bool  local (bool defVal = false)

local

[const]

Check if the contact is locally saved

Parameters:
defValDefault value to return if parameter is invalid

Returns: True if the contact is locally saved

inline void  setLocal (bool on)

setLocal

Set contact locally saved flag

Parameters:
onThe new value for locally saved flag

inline bool  remote (bool defVal = false)

remote

[const]

Check if the contact is saved on server

Parameters:
defValDefault value to return if parameter is invalid

Returns: True if the contact is saved on server

inline void  setRemote (bool on)

setRemote

Set contact server saved flag

Parameters:
onThe new value for server saved flag

inline void  setDockedChat (bool on)

setDockedChat

Set/reset the docked chat flag for non MucRoom contact

Parameters:
onThe new value for docked chat flag

inline void  getContactSection (String& buf)

getContactSection

Remove account prefix from contact id and URI unescape the result

Parameters:
bufDestination buffer

const String&  toString ()

toString

[const virtual]

Get a string representation of this object

Returns: The contact's id

Reimplemented from GenObject.

MucRoom*  mucRoom ()

mucRoom

[virtual]

Return a MucRoom contact from this one

Returns: MucRoom pointer or 0

inline String&  buildInstanceId (String& dest, const String& inst = String::empty())

buildInstanceId

Build a contact instance id to be used in UI

Parameters:
destDestination string
instInstance name

Returns: Destination string

inline void  buildIdHash (String& buf, const String& prefix = String::empty())

buildIdHash

Build a string from prefix and contact id hash

Parameters:
bufDestination string
prefixOptional prefix

inline bool  isChatWnd (Window* wnd)

isChatWnd

Check if a window is this contact's chat

Parameters:
wndThe window to check

Returns: True if the given window is this contact's chat

bool  hasChat ()

hasChat

Check if this contact has a chat widget (window or docked item)

Returns: True if this contact has a chat window or docked item

void  flashChat (bool on = true)

flashChat

[virtual]

Flash chat window/item to notify the user

Parameters:
onTrue to start, false to stop flashing

bool  sendChat (const char* body, const String& res = String::empty(), const String& type = String::empty(), const char* state = "active")

sendChat

[virtual]

Send chat to contact (enqueue a msg.execute message)

Parameters:
bodyChat body
resOptional target instance
typeOptional message type parameter
stateOptional chat state

Returns: True on success

void  getChatInput (String& text, const String& name = "message")

getChatInput

[virtual]

Retrieve the contents of the chat input widget

Parameters:
textChat input text
nameChat input widget name

void  setChatInput (const String& text = String::empty(), const String& name = "message")

setChatInput

[virtual]

Set the chat input widget text

Parameters:
textChat input text
nameChat input widget name

void  getChatHistory (String& text, bool richText = false, const String& name = "history")

getChatHistory

[virtual]

Retrieve the contents of the chat history widget

Parameters:
textChat history text
richTextRetrieve rich/plain text flag
nameChat history widget name

void  setChatHistory (const String& text, bool richText = false, const String& name = "history")

setChatHistory

[virtual]

Set the contents of the chat history widget

Parameters:
textChat history text
richTextSet rich/plain text flag
nameChat history widget name

void  addChatHistory (const String& what, NamedList*& params, const String& name = "history")

addChatHistory

[virtual]

Add an entry to chat history

Parameters:
whatItem to add (chat_in, chat_out, ...)
paramsChat history item parameters (it will be consumed and zeroed)
nameChat history widget name

void  getChatProperty (const String& name, const String& prop, String& value)

getChatProperty

[virtual]

Retrieve a chat widget' property

Parameters:
nameWidget name
propProperty name
valueDestination buffer

void  setChatProperty (const String& name, const String& prop, const String& value)

setChatProperty

[virtual]

Set a chat widget' property

Parameters:
nameWidget name
propProperty name
valueProperty value

inline bool  isChatVisible ()

isChatVisible

Check if this contact's chat window is visible

Returns: True if this contact's chat window is visible

bool  showChat (bool visible, bool active = false)

showChat

[virtual]

Show or hide this contact's chat window or docked item

Parameters:
visibleTrue to show, false to hide the window or destroy the docked item
activeTrue to activate the window or select the docked item if shown

Returns: True on success

Window*  getChatWnd ()

getChatWnd

Get the chat window

Returns: Valid Window pointer or 0

void  createChatWindow (bool force = false, const char* name = 0)

createChatWindow

[virtual]

Create the chat window

Parameters:
forceTrue to destroy the current one if any
nameThe window's name. Defaults to global name if empty

void  updateChatWindow (const NamedList& params, const char* title = 0, const char* icon = 0)

updateChatWindow

[virtual]

Update contact parameters in chat window

Parameters:
paramsParameters to set
titleOptional window title to set (ignored if docked)
iconOptional window icon to set (ignored if docked)

bool  isChatActive ()

isChatActive

[virtual]

Check if the contact chat is active

Returns: True if the contact's chat window/page is active

void  destroyChatWindow ()

destroyChatWindow

Close the chat window or destroy docked chat item

String*  findGroup (const String& group)

findGroup

[virtual]

Find a group this contact might belong to

Parameters:
groupThe name of the group to find

Returns: String pointer or 0 if not found

bool  appendGroup (const String& group)

appendGroup

[virtual]

Append a group to this contact

Parameters:
groupGroup's name

Returns: False if the group already exists

bool  removeGroup (const String& group)

removeGroup

[virtual]

Remove a contact's group

Parameters:
groupGroup's name

Returns: False if the group was not found

bool  setGroups (const NamedList& list, const String& param)

setGroups

[virtual]

Replace contact's groups from a list of parameters

Parameters:
listThe list of parameters
paramThe parameter name to handle

Returns: True if the list changed

ClientResource*  status (bool ref = false)

status

[virtual]

Find the resource with the lowest status

Parameters:
refTrue to obtain a referenced pointer

Returns: ClientResource pointer or 0 if not found

ClientResource*  findResource (const String& id, bool ref = false)

findResource

[virtual]

Find a resource having a given id

Parameters:
idThe id of the desired resource
refTrue to obtain a referenced pointer

Returns: ClientResource pointer or 0 if not found

ClientResource*  findAudioResource (bool ref = false)

findAudioResource

[virtual]

Get the first resource with audio capability

Parameters:
refTrue to obtain a referenced pointer

Returns: ClientResource pointer or 0 if not found

ClientResource*  findFileTransferResource (bool ref = false)

findFileTransferResource

[virtual]

Get the first resource with file transfer capability capability

Parameters:
refTrue to obtain a referenced pointer

Returns: ClientResource pointer or 0 if not found

ClientResource*  appendResource (const String& id)

appendResource

[virtual]

Append a resource having a given id

Parameters:
idThe id of the desired resource

Returns: ClientResource pointer or 0 if a resource with the given name already exists

bool  insertResource (ClientResource* res)

insertResource

[virtual]

Insert a resource in the list by its priority. If the resource is already there it will be extracted and re-inserted

Parameters:
resThe resource to insert

Returns: True on success, false a resource with the same name already exists

bool  removeResource (const String& id)

removeResource

[virtual]

Remove a resource having a given id

Parameters:
idThe id of the desired resource

Returns: True if the resource was removed

inline String&  buildContactId (String& dest, const String& account, const String& contact)

buildContactId

[static]

Build a contact id to be used in UI (all strings are URI escaped using extra '|' character)

Parameters:
destDestination string
accountAccount owning the contact
contactThe contact's id

Returns: Destination string

inline void  splitContactId (const String& src, String& account)

splitContactId

[static]

Retrieve the account part of a contact id

Parameters:
srcSource string
accountAccount id (URI unescaped)

void  splitContactInstanceId (const String& src, String& account, String& contact, String* instance = 0)

splitContactInstanceId

[static]

Split a contact instance id in account/contact/instance parts

Parameters:
srcSource string
accountAccount id (URI unescaped)
contactContact id
instanceOptional pointer to a String to be filled with instance id (URI unescaped)

static String s_chatPrefix

s_chatPrefix

static String s_dockedChatWnd

s_dockedChatWnd

static String s_dockedChatWidget

s_dockedChatWidget

static String s_mucsWnd

s_mucsWnd

static String s_chatInput

s_chatInput

String m_name

m_name

String m_subscription

m_subscription

NamedList m_params

m_params

explicit  ClientContact (ClientAccount* owner, const char* id, bool mucRoom)

ClientContact

[protected]

Constructor. Append itself to the owner's list

Parameters:
ownerThe contact's owner
idThe contact's id
mucRoomTrue if this contact is a MUC room

void  removeFromOwner ()

removeFromOwner

[protected]

Remove from owner

void  destroyed ()

destroyed

[protected virtual]

Remove from owner. Destroy the chat window. Release data

Reimplemented from RefObject.

ClientAccount* m_owner

m_owner

[protected]

bool m_online

m_online

[protected]

String m_id

m_id

[protected]

URI m_uri

m_uri

[protected]

ObjList m_resources

m_resources

[protected]

ObjList m_groups

m_groups

[protected]

bool m_dockedChat

m_dockedChat

[protected]

String m_chatWndName

m_chatWndName

[protected]


Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.