class ClientContact

# class ClientContact | A client contact. More...
Full name | `TelEngine::ClientContact`
Definition | `#include <yatecbase.h>`
Inherits | TelEngine::RefObject [public ]
Inherited by | MucRoom
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum Subscription { SubFrom = 0x01, SubTo = 0x02, }

#### Public Methods

- explicit ClientContact (ClientAccount* owner, const char* id, const char* name = 0, const char* uri = 0)
- explicit ClientContact (ClientAccount* owner, const NamedList& params, const char* id = 0, const char* uri = 0)
- inline ClientAccount* account ()
- inline const String& accountName () const
- inline const URI& uri () const
- inline void setUri (const char* u)
- inline const String& subscriptionStr () const
- inline bool subscriptionFrom () const
- inline bool subscriptionTo () const
- bool setSubscription (const String& value)
- inline ObjList& resources ()
- inline bool online () const
- inline void setOnline (bool on)
- inline ObjList& groups ()
- inline bool local (bool defVal = false) const
- inline void setLocal (bool on)
- inline bool remote (bool defVal = false) const
- inline void setRemote (bool on)
- inline void setDockedChat (bool on)
- inline void getContactSection (String& buf)
- virtual const String& toString () const
- virtual MucRoom* mucRoom ()
- inline String& buildInstanceId (String& dest, const String& inst = String::empty())
- inline void buildIdHash (String& buf, const String& prefix = String::empty())
- inline bool isChatWnd (Window* wnd)
- bool hasChat ()
- virtual void flashChat (bool on = true)
- virtual bool sendChat (const char* body, const String& res = String::empty(), const String& type = String::empty(), const char* state = "active")
- virtual void getChatInput (String& text, const String& name = "message")
- virtual void setChatInput (const String& text = String::empty(), const String& name = "message")
- virtual void getChatHistory (String& text, bool richText = false, const String& name = "history")
- virtual void setChatHistory (const String& text, bool richText = false, const String& name = "history")
- virtual void addChatHistory (const String& what, NamedList*& params, const String& name = "history")
- virtual void getChatProperty (const String& name, const String& prop, String& value)
- virtual void setChatProperty (const String& name, const String& prop, const String& value)
- inline bool isChatVisible ()
- virtual bool showChat (bool visible, bool active = false)
- Window* getChatWnd ()
- virtual void createChatWindow (bool force = false, const char* name = 0)
- virtual void updateChatWindow (const NamedList& params, const char* title = 0, const char* icon = 0)
- virtual bool isChatActive ()
- void destroyChatWindow ()
- virtual String* findGroup (const String& group)
- virtual bool appendGroup (const String& group)
- virtual bool removeGroup (const String& group)
- virtual bool setGroups (const NamedList& list, const String& param)
- virtual ClientResource* status (bool ref = false)
- virtual ClientResource* findResource (const String& id, bool ref = false)
- virtual ClientResource* findAudioResource (bool ref = false)
- virtual ClientResource* findFileTransferResource (bool ref = false)
- virtual ClientResource* appendResource (const String& id)
- virtual bool insertResource (ClientResource* res)
- virtual bool removeResource (const String& id)
- inline NamedList& share ()
- inline bool haveShare () const
- virtual void updateShare ()
- virtual void saveShare ()
- virtual void clearShare ()
- virtual bool setShareDir (const String& name, const String& path, bool save = true)
- virtual bool removeShare (const String& name, bool save = true)
- inline ObjList& shared ()
- bool haveShared () const
- virtual ClientDir* getShared (const String& name, bool create = false)
- virtual bool removeShared (const String& name = String::empty(), ClientDir** removed = 0)

#### Public Static Methods

- static inline String& buildContactId (String& dest, const String& account, const String& contact)
- static inline void splitContactId (const String& src, String& account)
- static void splitContactInstanceId (const String& src, String& account, String& contact, String* instance = 0)
- static inline String& buildContactInstanceId (String& dest, const String& cId, const String& inst = String::empty())

#### Public Members

- static String s_chatPrefix
- static String s_dockedChatWnd
- static String s_dockedChatWidget
- static String s_mucsWnd
- static String s_chatInput
- String m_name
- NamedList m_params

#### Protected Methods

- explicit ClientContact (ClientAccount* owner, const char* id, bool mucRoom)
- void removeFromOwner ()
- virtual void destroyed ()

#### Protected Members

- ClientAccount* m_owner
- bool m_online
- String m_id
- String m_subscription
- Flags32 m_sub
- URI m_uri
- ObjList m_resources
- ObjList m_groups
- bool m_dockedChat
- String m_chatWndName
- NamedList m_share
- ObjList m_shared

## Detailed Description

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

enum Subscription { SubFrom = 0x01, SubTo = 0x02, } | ### Subscription

Subscription flags

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:

owner | The contact's owner
id | The contact's id
name | Optional display name. Defaults to the id's value if 0
uri | Optional 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:

owner | The contact's owner
params | The list of parameters used to build this contact
id | Optional contact id
uri | Optional 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:

u | New contact URI

inline const String& subscriptionStr () | ### subscriptionStr

[const]

Retrieve contact subscription

Returns: Contact subscription string

inline bool subscriptionFrom () | ### subscriptionFrom

[const]

Check if contact is subscribed to our presence

Returns: True if contact is subscribed to our presence

inline bool subscriptionTo () | ### subscriptionTo

[const]

Check we are subscribed to contact's presence

Returns: True if we are subscribed to contact's presence

bool setSubscription (const String& value) | ### setSubscription

Set contact's subscription

Parameters:

value | Subscription value

Returns: True if changed

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:

on | The 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:

defVal | Default 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:

on | The new value for locally saved flag

inline bool remote (bool defVal = false) | ### remote

[const]

Check if the contact is saved on server

Parameters:

defVal | Default 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:

on | The new value for server saved flag

inline void setDockedChat (bool on) | ### setDockedChat

Set/reset the docked chat flag for non MucRoom contact

Parameters:

on | The new value for docked chat flag

inline void getContactSection (String& buf) | ### getContactSection

Remove account prefix from contact id and URI unescape the result

Parameters:

buf | Destination 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:

dest | Destination string
inst | Instance 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:

buf | Destination string
prefix | Optional prefix

inline bool isChatWnd (Window* wnd) | ### isChatWnd

Check if a window is this contact's chat

Parameters:

wnd | The 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:

on | True 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:

body | Chat body
res | Optional target instance
type | Optional message type parameter
state | Optional 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:

text | Chat input text
name | Chat input widget name

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

[virtual]

Set the chat input widget text

Parameters:

text | Chat input text
name | Chat 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:

text | Chat history text
richText | Retrieve rich/plain text flag
name | Chat 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:

text | Chat history text
richText | Set rich/plain text flag
name | Chat history widget name

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

[virtual]

Add an entry to chat history

Parameters:

what | Item to add (chat_in, chat_out, ...)
params | Chat history item parameters (it will be consumed and zeroed)
name | Chat history widget name

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

[virtual]

Retrieve a chat widget' property

Parameters:

name | Widget name
prop | Property name
value | Destination buffer

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

[virtual]

Set a chat widget' property

Parameters:

name | Widget name
prop | Property name
value | Property 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:

visible | True to show, false to hide the window or destroy the docked item
active | True 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:

force | True to destroy the current one if any
name | The 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:

params | Parameters to set
title | Optional window title to set (ignored if docked)
icon | Optional 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:

group | The 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:

group | Group's name

Returns: False if the group already exists

bool removeGroup (const String& group) | ### removeGroup

[virtual]

Remove a contact's group

Parameters:

group | Group'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:

list | The list of parameters
param | The 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:

ref | True 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:

id | The id of the desired resource
ref | True 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:

ref | True 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:

ref | True 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:

id | The 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:

res | The 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:

id | The id of the desired resource

Returns: True if the resource was removed

inline NamedList& share () | ### share

Retrieve files and folders we share with this contact

Returns: List of files and folders we share with this contact

inline bool haveShare () | ### haveShare

[const]

Check if the list of share contains something

Returns: True if share list is not empty

void updateShare () | ### updateShare

[virtual]

(re)load share list

void saveShare () | ### saveShare

[virtual]

Save share list

void clearShare () | ### clearShare

[virtual]

Clear share list

bool setShareDir (const String& name, const String& path, bool save = true) | ### setShareDir

[virtual]

Set a directory we share with this contact If share name is not empty it must be unique. Fails if another share has the same name

Parameters:

name | Share name
path | Directory path
save | True to save now if changed

Returns: True if changed

bool removeShare (const String& name, bool save = true) | ### removeShare

[virtual]

Remove a share item

Parameters:

name | Share name
save | True to save now if changed

Returns: True if changed

inline ObjList& shared () | ### shared

Retrieve shared data

Returns: Shared data list

bool haveShared () | ### haveShared

[const]

Check if the list of shared contains something

Returns: True if shared list is not empty

ClientDir* getShared (const String& name, bool create = false) | ### getShared

[virtual]

Retrieve shared data for a given resource

Parameters:

name | Resource name
create | True to create if not found

Returns: True if changed

bool removeShared (const String& name = String::empty(), ClientDir** removed = 0) | ### removeShared

[virtual]

Remove shared data

Parameters:

name | Resource name to remove, empty to remove all
removed | Optional pointer to removed directory

Returns: True if changed

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:

dest | Destination string
account | Account owning the contact
contact | The 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:

src | Source string
account | Account 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:

src | Source string
account | Account id (URI unescaped)
contact | Contact id
instance | Optional pointer to a String to be filled with instance id (URI unescaped)

inline String& buildContactInstanceId (String& dest, const String& cId, const String& inst = String::empty()) | ### buildContactInstanceId

[static]

Build a contact instance id to be used in UI

Parameters:

dest | Destination string
cId | Contact id
inst | Instance name

Returns: Destination string

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

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:

owner | The contact's owner
id | The contact's id
mucRoom | True 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]

String m_subscription | ### m_subscription

[protected]

Flags32 m_sub | ### m_sub

[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]

NamedList m_share | ### m_share

[protected]

ObjList m_shared | ### m_shared

[protected]

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