|
Yate
|
A client contact. More...
#include <yatecbase.h>
Public Member Functions | |
| ClientContact (ClientAccount *owner, const char *id, const char *name=0, const char *uri=0) | |
| ClientContact (ClientAccount *owner, const NamedList ¶ms, const char *id=0, const char *uri=0) | |
| ClientAccount * | account () |
| const String & | accountName () const |
| const URI & | uri () const |
| void | setUri (const char *u) |
| ObjList & | resources () |
| bool | online () const |
| void | setOnline (bool on) |
| ObjList & | groups () |
| bool | local (bool defVal=false) const |
| void | setLocal (bool on) |
| bool | remote (bool defVal=false) const |
| void | setRemote (bool on) |
| void | setDockedChat (bool on) |
| void | getContactSection (String &buf) |
| virtual const String & | toString () const |
| virtual MucRoom * | mucRoom () |
| String & | buildInstanceId (String &dest, const String &inst=String::empty()) |
| void | buildIdHash (String &buf, const String &prefix=String::empty()) |
| 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 *¶ms, 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) |
| 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 ¶ms, 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 ¶m) |
| 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) |
Static Public Member Functions | |
| static String & | buildContactId (String &dest, const String &account, const String &contact) |
| static void | splitContactId (const String &src, String &account) |
| static void | splitContactInstanceId (const String &src, String &account, String &contact, String *instance=0) |
Public Attributes | |
| String | m_name |
| String | m_subscription |
| NamedList | m_params |
Static Public Attributes | |
| static String | s_chatPrefix |
| static String | s_dockedChatWnd |
| static String | s_dockedChatWidget |
| static String | s_mucsWnd |
| static String | s_chatInput |
Protected Member Functions | |
| ClientContact (ClientAccount *owner, const char *id, bool mucRoom) | |
| void | removeFromOwner () |
| virtual void | destroyed () |
Protected Attributes | |
| ClientAccount * | m_owner |
| bool | m_online |
| String | m_id |
| URI | m_uri |
| ObjList | m_resources |
| ObjList | m_groups |
| bool | m_dockedChat |
| String | m_chatWndName |
Friends | |
| class | ClientAccount |
A client contact.
A client contact The contact is using the owner's mutex to lock it's operations
| ClientContact | ( | ClientAccount * | owner, |
| const char * | id, | ||
| const char * | name = 0, |
||
| const char * | uri = 0 |
||
| ) | [explicit] |
Constructor. Append itself to the owner's list
| 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 |
| ClientContact | ( | ClientAccount * | owner, |
| const NamedList & | params, | ||
| const char * | id = 0, |
||
| const char * | uri = 0 |
||
| ) | [explicit] |
Constructor. Build a contact from a list of parameters. Append itself to the owner's list
| owner | The contact's owner |
| params | The list of parameters used to build this contact |
| id | Optional contact id |
| uri | Optional contact URI |
| ClientContact | ( | ClientAccount * | owner, |
| const char * | id, | ||
| bool | mucRoom | ||
| ) | [explicit, protected] |
Constructor. Append itself to the owner's list
| owner | The contact's owner |
| id | The contact's id |
| mucRoom | True if this contact is a MUC room |
| ClientAccount* account | ( | ) | [inline] |
Get this contact's account
| const String& accountName | ( | ) | const [inline] |
Get this contact account's name (id)
References String::empty(), and String::toString().
| virtual void addChatHistory | ( | const String & | what, |
| NamedList *& | params, | ||
| const String & | name = "history" |
||
| ) | [virtual] |
Add an entry to chat history
| what | Item to add (chat_in, chat_out, ...) |
| params | Chat history item parameters (it will be consumed and zeroed) |
| name | Chat history widget name |
| virtual bool appendGroup | ( | const String & | group | ) | [virtual] |
Append a group to this contact
| group | Group's name |
| virtual ClientResource* appendResource | ( | const String & | id | ) | [virtual] |
Append a resource having a given id
| id | The id of the desired resource |
Reimplemented in MucRoom.
| static String& buildContactId | ( | String & | dest, |
| const String & | account, | ||
| const String & | contact | ||
| ) | [inline, static] |
Build a contact id to be used in UI (all strings are URI escaped using extra '|' character)
| dest | Destination string |
| account | Account owning the contact |
| contact | The contact's id |
References String::toLower(), and String::uriEscape().
| void buildIdHash | ( | String & | buf, |
| const String & | prefix = String::empty() |
||
| ) | [inline] |
Build a string from prefix and contact id hash
| buf | Destination string |
| prefix | Optional prefix |
References MD5::hexDigest().
| String& buildInstanceId | ( | String & | dest, |
| const String & | inst = String::empty() |
||
| ) | [inline] |
Build a contact instance id to be used in UI
| dest | Destination string |
| inst | Instance name |
References String::uriEscape().
| virtual void createChatWindow | ( | bool | force = false, |
| const char * | name = 0 |
||
| ) | [virtual] |
Create the chat window
| force | True to destroy the current one if any |
| name | The window's name. Defaults to global name if empty |
| void destroyChatWindow | ( | ) |
Close the chat window or destroy docked chat item
| virtual void destroyed | ( | ) | [protected, virtual] |
| virtual ClientResource* findAudioResource | ( | bool | ref = false | ) | [virtual] |
Get the first resource with audio capability
| ref | True to obtain a referenced pointer |
| virtual ClientResource* findFileTransferResource | ( | bool | ref = false | ) | [virtual] |
Get the first resource with file transfer capability capability
| ref | True to obtain a referenced pointer |
Find a group this contact might belong to
| group | The name of the group to find |
| virtual ClientResource* findResource | ( | const String & | id, |
| bool | ref = false |
||
| ) | [virtual] |
Find a resource having a given id
| id | The id of the desired resource |
| ref | True to obtain a referenced pointer |
Reimplemented in MucRoom.
| virtual void flashChat | ( | bool | on = true | ) | [virtual] |
Flash chat window/item to notify the user
| on | True to start, false to stop flashing |
| virtual void getChatHistory | ( | String & | text, |
| bool | richText = false, |
||
| const String & | name = "history" |
||
| ) | [virtual] |
Retrieve the contents of the chat history widget
| text | Chat history text |
| richText | Retrieve rich/plain text flag |
| name | Chat history widget name |
| virtual void getChatInput | ( | String & | text, |
| const String & | name = "message" |
||
| ) | [virtual] |
Retrieve the contents of the chat input widget
| text | Chat input text |
| name | Chat input widget name |
| virtual void getChatProperty | ( | const String & | name, |
| const String & | prop, | ||
| String & | value | ||
| ) | [virtual] |
Retrieve a chat widget' property
| name | Widget name |
| prop | Property name |
| value | Destination buffer |
| Window* getChatWnd | ( | ) |
Get the chat window
| void getContactSection | ( | String & | buf | ) | [inline] |
Remove account prefix from contact id and URI unescape the result
| buf | Destination buffer |
References String::empty(), String::startSkip(), and String::uriUnescape().
Get the group list of this contact
| bool hasChat | ( | ) |
Check if this contact has a chat widget (window or docked item)
| virtual bool insertResource | ( | ClientResource * | res | ) | [virtual] |
Insert a resource in the list by its priority. If the resource is already there it will be extracted and re-inserted
| res | The resource to insert |
Reimplemented in MucRoom.
| virtual bool isChatActive | ( | ) | [virtual] |
Check if the contact chat is active
| bool isChatVisible | ( | ) | [inline] |
Check if this contact's chat window is visible
Check if a window is this contact's chat
| wnd | The window to check |
References Window::toString().
| bool local | ( | bool | defVal = false | ) | const [inline] |
Check if the contact is locally saved
| defVal | Default value to return if parameter is invalid |
References TelEngine::YSTRING().
| bool online | ( | ) | const [inline] |
Check if the contact is online (the online flag is set or has at least 1 resource in list)
References ObjList::skipNull().
| bool remote | ( | bool | defVal = false | ) | const [inline] |
Check if the contact is saved on server
| defVal | Default value to return if parameter is invalid |
References TelEngine::YSTRING().
| void removeFromOwner | ( | ) | [protected] |
Remove from owner
| virtual bool removeGroup | ( | const String & | group | ) | [virtual] |
Remove a contact's group
| group | Group's name |
| virtual bool removeResource | ( | const String & | id | ) | [virtual] |
Remove a resource having a given id
| id | The id of the desired resource |
Get the resource list of this contact
| virtual bool sendChat | ( | const char * | body, |
| const String & | res = String::empty(), |
||
| const String & | type = String::empty(), |
||
| const char * | state = "active" |
||
| ) | [virtual] |
Send chat to contact (enqueue a msg.execute message)
| body | Chat body |
| res | Optional target instance |
| type | Optional message type parameter |
| state | Optional chat state |
| virtual void setChatHistory | ( | const String & | text, |
| bool | richText = false, |
||
| const String & | name = "history" |
||
| ) | [virtual] |
Set the contents of the chat history widget
| text | Chat history text |
| richText | Set rich/plain text flag |
| name | Chat history widget name |
| virtual void setChatInput | ( | const String & | text = String::empty(), |
| const String & | name = "message" |
||
| ) | [virtual] |
Set the chat input widget text
| text | Chat input text |
| name | Chat input widget name |
| virtual void setChatProperty | ( | const String & | name, |
| const String & | prop, | ||
| const String & | value | ||
| ) | [virtual] |
Set a chat widget' property
| name | Widget name |
| prop | Property name |
| value | Property value |
| void setDockedChat | ( | bool | on | ) | [inline] |
Set/reset the docked chat flag for non MucRoom contact
| on | The new value for docked chat flag |
Replace contact's groups from a list of parameters
| list | The list of parameters |
| param | The parameter name to handle |
| void setLocal | ( | bool | on | ) | [inline] |
Set contact locally saved flag
| on | The new value for locally saved flag |
References String::boolText().
| void setOnline | ( | bool | on | ) | [inline] |
Set the online flag
| on | The new value for online flag |
| void setRemote | ( | bool | on | ) | [inline] |
Set contact server saved flag
| on | The new value for server saved flag |
References String::boolText().
| virtual bool showChat | ( | bool | visible, |
| bool | active = false |
||
| ) | [virtual] |
Show or hide this contact's chat window or docked item
| 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 |
| static void splitContactId | ( | const String & | src, |
| String & | account | ||
| ) | [inline, static] |
Retrieve the account part of a contact id
| src | Source string |
| account | Account id (URI unescaped) |
References String::find(), String::substr(), and String::uriUnescape().
| static void splitContactInstanceId | ( | const String & | src, |
| String & | account, | ||
| String & | contact, | ||
| String * | instance = 0 |
||
| ) | [static] |
| virtual ClientResource* status | ( | bool | ref = false | ) | [virtual] |
Find the resource with the lowest status
| ref | True to obtain a referenced pointer |
Reimplemented in MucRoom.
| virtual void updateChatWindow | ( | const NamedList & | params, |
| const char * | title = 0, |
||
| const char * | icon = 0 |
||
| ) | [virtual] |
Update contact parameters in chat window
| params | Parameters to set |
| title | Optional window title to set (ignored if docked) |
| icon | Optional window icon to set (ignored if docked) |
1.7.6.1