Yate
|
A client contact. More...
#include <yatecbase.h>
Public Types | |
enum | Subscription { SubFrom = 0x01, SubTo = 0x02 } |
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) |
const String & | subscriptionStr () const |
bool | subscriptionFrom () const |
bool | subscriptionTo () const |
bool | setSubscription (const String &value) |
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) |
NamedList & | share () |
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) |
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 Member Functions inherited from RefObject | |
RefObject () | |
virtual | ~RefObject () |
virtual void * | getObject (const String &name) const |
virtual bool | alive () const |
bool | ref () |
bool | deref () |
int | refcount () const |
virtual void | destruct () |
Public Member Functions inherited from GenObject | |
GenObject () | |
virtual | ~GenObject () |
NamedCounter * | getObjCounter () const |
NamedCounter * | setObjCounter (NamedCounter *counter) |
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) |
static String & | buildContactInstanceId (String &dest, const String &cId, const String &inst=String::empty()) |
Static Public Member Functions inherited from RefObject | |
static bool | alive (const RefObject *obj) |
static bool | efficientIncDec () |
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 () |
Public Attributes | |
String | m_name |
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 Member Functions inherited from RefObject | |
virtual void | zeroRefs () |
bool | resurrect () |
Protected Attributes | |
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 |
Friends | |
class | ClientAccount |
A client contact.
A client contact The contact is using the owner's mutex to lock it's operations
enum Subscription |
Subscription flags
|
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 |
|
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 |
|
explicitprotected |
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 |
|
inline |
Get this contact's account
|
inline |
Get this contact account's name (id)
References String::empty(), and ClientAccount::toString().
Referenced by MucRoom::buildMucRoom(), and ClientContact::getContactSection().
|
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 |
Append a group to this contact
group | Group's name |
|
virtual |
Append a resource having a given id
id | The id of the desired resource |
Reimplemented in MucRoom.
|
inlinestatic |
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().
Referenced by ClientContact::getContactSection().
|
inlinestatic |
Build a contact instance id to be used in UI
dest | Destination string |
cId | Contact id |
inst | Instance name |
References String::uriEscape().
Referenced by ClientContact::buildInstanceId().
|
inline |
Build a string from prefix and contact id hash
buf | Destination string |
prefix | Optional prefix |
References Hasher::hexDigest().
|
inline |
Build a contact instance id to be used in UI
dest | Destination string |
inst | Instance name |
References ClientContact::buildContactInstanceId().
|
virtual |
Clear share list
|
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
|
protectedvirtual |
|
virtual |
Get the first resource with audio capability
ref | True to obtain a referenced pointer |
|
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 |
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 |
Flash chat window/item to notify the user
on | True to start, false to stop flashing |
|
virtual |
Retrieve the contents of the chat history widget
text | Chat history text |
richText | Retrieve rich/plain text flag |
name | Chat history widget name |
Retrieve the contents of the chat input widget
text | Chat input text |
name | Chat input widget name |
Retrieve a chat widget' property
name | Widget name |
prop | Property name |
value | Destination buffer |
|
inline |
Remove account prefix from contact id and URI unescape the result
buf | Destination buffer |
References ClientContact::accountName(), ClientContact::buildContactId(), String::empty(), String::startSkip(), ClientContact::toString(), and String::uriUnescape().
Retrieve shared data for a given resource
name | Resource name |
create | True to create if not found |
|
inline |
Get the group list of this contact
bool hasChat | ( | ) |
Check if this contact has a chat widget (window or docked item)
|
inline |
Check if the list of share contains something
References NamedList::getParam().
bool haveShared | ( | ) | const |
Check if the list of shared contains something
|
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 |
Check if the contact chat is active
|
inline |
Check if this contact's chat window is visible
|
inline |
Check if a window is this contact's chat
wnd | The window to check |
References Window::toString().
|
inline |
Check if the contact is locally saved
defVal | Default value to return if parameter is invalid |
References NamedList::getBoolValue(), and TelEngine::YSTRING().
|
inlinevirtual |
Return a MucRoom contact from this one
Reimplemented in MucRoom.
Referenced by ClientContact::setDockedChat().
|
inline |
Check if the contact is online (the online flag is set or has at least 1 resource in list)
References ObjList::skipNull().
|
inline |
Check if the contact is saved on server
defVal | Default value to return if parameter is invalid |
References NamedList::getBoolValue(), and TelEngine::YSTRING().
|
protected |
Remove from owner
|
virtual |
Remove a contact's group
group | Group's name |
|
virtual |
Remove a resource having a given id
id | The id of the desired resource |
|
virtual |
Remove a share item
name | Share name |
save | True to save now if changed |
|
virtual |
Remove shared data
name | Resource name to remove, empty to remove all |
removed | Optional pointer to removed directory |
|
inline |
Get the resource list of this contact
|
virtual |
Save share list
|
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 |
Set the contents of the chat history widget
text | Chat history text |
richText | Set rich/plain text flag |
name | Chat history widget name |
|
virtual |
Set the chat input widget text
text | Chat input text |
name | Chat input widget name |
|
virtual |
Set a chat widget' property
name | Widget name |
prop | Property name |
value | Property value |
|
inline |
Set/reset the docked chat flag for non MucRoom contact
on | The new value for docked chat flag |
References ClientContact::mucRoom().
Replace contact's groups from a list of parameters
list | The list of parameters |
param | The parameter name to handle |
|
inline |
Set contact locally saved flag
on | The new value for locally saved flag |
References String::boolText(), and NamedList::setParam().
|
inline |
Set the online flag
on | The new value for online flag |
|
inline |
Set contact server saved flag
on | The new value for server saved flag |
References String::boolText(), and NamedList::setParam().
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
name | Share name |
path | Directory path |
save | True to save now if changed |
bool setSubscription | ( | const String & | value | ) |
Set contact's subscription
value | Subscription value |
|
inline |
Retrieve files and folders we share with this contact
|
inline |
Retrieve shared data
|
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 |
Retrieve the account part of a contact id
src | Source string |
account | Account id (URI unescaped) |
References String::find(), String::substr(), and String::uriUnescape().
|
virtual |
Find the resource with the lowest status
ref | True to obtain a referenced pointer |
Reimplemented in MucRoom.
|
inline |
Check if contact is subscribed to our presence
References Flags32::flag().
|
inline |
Retrieve contact subscription
|
inline |
Check we are subscribed to contact's presence
References Flags32::flag().
|
inlinevirtual |
Get a string representation of this object
Reimplemented from GenObject.
Referenced by ClientContact::getContactSection().
|
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) |
|
virtual |
(re)load share list
|
inline |