Yate
MucRoom Class Reference

An account's MUC room contact. More...

#include <yatecbase.h>

Inheritance diagram for MucRoom:
ClientContact RefObject GenObject

Public Member Functions

 MucRoom (ClientAccount *owner, const char *id, const char *name, const char *uri, const char *nick=0)
MucRoomMemberresource ()
bool ownMember (MucRoomMember *item) const
bool ownMember (const String &item) const
bool available () const
bool canChat () const
bool canChatPrivate () const
bool canChangeSubject () const
bool canInvite () const
bool canKick (MucRoomMember *member) const
bool canBan (MucRoomMember *member) const
MessagebuildMucRoom (const char *oper)
MessagebuildJoin (bool join, bool history=true, unsigned int sNewer=0)
virtual MucRoommucRoom ()
virtual ClientResourcestatus (bool ref=false)
MucRoomMemberfindMember (const String &nick)
MucRoomMemberfindMember (const String &contact, const String &instance)
MucRoomMemberfindMemberById (const String &id)
bool hasChat (const String &id)
virtual void flashChat (const String &id, bool on=true)
virtual void getChatInput (const String &id, String &text, const String &name="message")
virtual void setChatInput (const String &id, const String &text=String::empty(), const String &name="message")
virtual void getChatHistory (const String &id, String &text, bool richText=false, const String &name="history")
virtual void setChatHistory (const String &id, const String &text, bool richText=false, const String &name="history")
virtual void addChatHistory (const String &id, const String &what, NamedList *&params, const String &name="history")
virtual void setChatProperty (const String &id, const String &name, const String &prop, const String &value)
virtual bool showChat (const String &id, bool visible, bool active=false)
virtual void createChatWindow (const String &id, bool force=false, const char *name=0)
virtual void updateChatWindow (const String &id, const NamedList &params)
virtual bool isChatActive (const String &id)
void destroyChatWindow (const String &id=String::empty())
virtual ClientResourcefindResource (const String &id, bool ref=false)
virtual ClientResourceappendResource (const String &nick)
virtual bool insertResource (ClientResource *res)
virtual bool removeResource (const String &nick, bool delChat=false)
Public Member Functions inherited from ClientContact
 ClientContact (ClientAccount *owner, const char *id, const char *name=0, const char *uri=0)
 ClientContact (ClientAccount *owner, const NamedList &params, const char *id=0, const char *uri=0)
ClientAccount * account ()
const StringaccountName () const
const URIuri () const
void setUri (const char *u)
const StringsubscriptionStr () const
bool subscriptionFrom () const
bool subscriptionTo () const
bool setSubscription (const String &value)
ObjListresources ()
bool online () const
void setOnline (bool on)
ObjListgroups ()
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 StringtoString () const
StringbuildInstanceId (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 *&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)
bool isChatVisible ()
virtual bool showChat (bool visible, bool active=false)
WindowgetChatWnd ()
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 StringfindGroup (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 ClientResourcefindAudioResource (bool ref=false)
virtual ClientResourcefindFileTransferResource (bool ref=false)
virtual bool removeResource (const String &id)
NamedListshare ()
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)
ObjListshared ()
bool haveShared () const
virtual ClientDirgetShared (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 ()
virtual const StringtraceId () const
NamedCountergetObjCounter () const
NamedCountersetObjCounter (NamedCounter *counter)

Public Attributes

String m_password
Public Attributes inherited from ClientContact
String m_name
NamedList m_params

Protected Member Functions

virtual void destroyed ()
Protected Member Functions inherited from ClientContact
 ClientContact (ClientAccount *owner, const char *id, bool mucRoom)
void removeFromOwner ()
Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
bool resurrect ()

Additional Inherited Members

Public Types inherited from ClientContact
enum  Subscription { SubFrom = 0x01 , SubTo = 0x02 }
Static Public Member Functions inherited from ClientContact
static StringbuildContactId (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 StringbuildContactInstanceId (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 NamedCountergetObjCounter (const String &name, bool create=true)
static ObjListgetObjCounters ()
Static Public Attributes inherited from ClientContact
static String s_chatPrefix
static String s_dockedChatWnd
static String s_dockedChatWidget
static String s_mucsWnd
static String s_chatInput
Protected Attributes inherited from ClientContact
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

An account's MUC room contact.

This class holds a client account's MUC room contact. The list of resources contains MucRoomMember items. Contact nick is held by own MucRoomMember name The contact uri is the room uri The contact name is the room name The contact resource member uri is the account's uri

Constructor & Destructor Documentation

◆ MucRoom()

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

Constructor. Append itself to the owner's list

Parameters
ownerThe contact's owner
idThe contact's id
nameRoom name
uriRoom uri
nickOptional room nick

References ClientContact::uri().

Referenced by mucRoom().

Member Function Documentation

◆ addChatHistory()

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

Add an entry to chat history

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

◆ appendResource()

virtual ClientResource * appendResource ( const String & nick)
virtual

Append a member having a given nick

Parameters
nickMember nick
Returns
ClientResource pointer or 0 if a resource with the given name already exists

Reimplemented from ClientContact.

◆ available()

bool available ( ) const
inline

Check if the user has joined the room

Returns
True if the user is in the room

Referenced by canChangeSubject(), canChat(), canChatPrivate(), and canInvite().

◆ buildJoin()

Message * buildJoin ( bool join,
bool history = true,
unsigned int sNewer = 0 )

Build a muc.room message used to login/logoff

Parameters
joinTrue to login, false to logoff
historyTrue to request room history. Ignored if join is false
sNewerRequest history newer then given seconds. Ignored if 0 or history is false
Returns
Message pointer

◆ buildMucRoom()

Message * buildMucRoom ( const char * oper)
inline

Build a muc.room message. Add the room parameter

Parameters
operOperation parameter
Returns
Message pointer

References ClientContact::accountName(), NamedList::addParam(), Client::buildMessage(), and ClientContact::uri().

◆ canBan()

bool canBan ( MucRoomMember * member) const

Check if the user can ban a given room member

Parameters
memberRoom member
Returns
True if the user can ban the member

◆ canChangeSubject()

bool canChangeSubject ( ) const
inline

Check if the user can change room subject

Returns
True if the user can change room subject

References available().

◆ canChat()

bool canChat ( ) const
inline

Check if room chat can be sent

Returns
True if the user is allowed to send chat to room

References available().

◆ canChatPrivate()

bool canChatPrivate ( ) const
inline

Check if private chat can be sent

Returns
True if the user is allowed to send private chat

References available().

◆ canInvite()

bool canInvite ( ) const
inline

Check if join invitations can be sent

Returns
True if the user is allowed to invite contacts

References available().

◆ canKick()

bool canKick ( MucRoomMember * member) const

Check if the user can kick a given room member

Parameters
memberRoom member
Returns
True if the user can kick the member

◆ createChatWindow()

virtual void createChatWindow ( const String & id,
bool force = false,
const char * name = 0 )
virtual

Create a member's chat

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

◆ destroyChatWindow()

void destroyChatWindow ( const String & id = String::empty())

Close a member's chat or all chats

Parameters
idMember id. Let it empty to clear all chats

References String::empty().

◆ destroyed()

virtual void destroyed ( )
protectedvirtual

Remove from owner. Destroy the chat window. Release data

Reimplemented from ClientContact.

◆ findMember() [1/2]

MucRoomMember * findMember ( const String & contact,
const String & instance )

Retrieve a room member (or own member) by its contact and instance

Parameters
contactMember's contact
instanceMember's instance
Returns
MucRoomMember pointer or 0 if not found

◆ findMember() [2/2]

MucRoomMember * findMember ( const String & nick)

Retrieve a room member (or own member) by its nick

Parameters
nickNick to find
Returns
MucRoomMember pointer or 0 if not found

◆ findMemberById()

MucRoomMember * findMemberById ( const String & id)

Retrieve a room member (or own member) by its id

Parameters
idMember id to find
Returns
MucRoomMember pointer or 0 if not found

◆ findResource()

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

Retrieve a room member (or own member) by its id

Parameters
idThe id of the desired member
refTrue to obtain a referenced pointer
Returns
ClientResource pointer or 0 if not found

Reimplemented from ClientContact.

References RefObject::ref().

◆ flashChat()

virtual void flashChat ( const String & id,
bool on = true )
virtual

Flash chat window/item to notify the user

Parameters
idMember id
onTrue to start, false to stop flashing

◆ getChatHistory()

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

Retrieve the contents of the chat history widget

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

◆ getChatInput()

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

Retrieve the contents of the chat input widget

Parameters
idMember id
textChat input text
nameChat input widget name

◆ hasChat()

bool hasChat ( const String & id)

Check if a given member has chat displayed

Parameters
idMember id
Returns
True if the member has chat displayed

◆ insertResource()

virtual bool insertResource ( ClientResource * res)
inlinevirtual

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

Reimplemented from ClientContact.

◆ isChatActive()

virtual bool isChatActive ( const String & id)
virtual

Check if a member's chat is active

Returns
True if the members's chat page is active

◆ mucRoom()

virtual MucRoom * mucRoom ( )
inlinevirtual

Return a MucRoom contact from this one

Returns
MucRoom pointer or 0

Reimplemented from ClientContact.

References MucRoom().

◆ ownMember() [1/2]

bool ownMember ( const String & item) const
inline

Check if a given resource is the contact's member

Parameters
itemMember id to check
Returns
True if the given resource member is the contact itself

◆ ownMember() [2/2]

bool ownMember ( MucRoomMember * item) const
inline

Check if a given resource is the contact's member

Parameters
itemMember pointer to check
Returns
True if the given resource member is the contact itself

◆ removeResource()

virtual bool removeResource ( const String & nick,
bool delChat = false )
virtual

Remove a contact having a given nick

Parameters
nickThe contact nick
delChatTrue to delete the chat
Returns
True if the contact was removed

◆ resource()

MucRoomMember & resource ( )
inline

Retrieve room resource

Returns
Room resource

◆ setChatHistory()

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

Set the contents of the chat history widget

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

◆ setChatInput()

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

Set the chat input widget text

Parameters
idMember id
textChat input text
nameChat input widget name

References String::empty().

◆ setChatProperty()

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

Set a chat widget' property

Parameters
idMember id
nameWidget name
propProperty name
valueProperty value

◆ showChat()

virtual bool showChat ( const String & id,
bool visible,
bool active = false )
virtual

Show or hide a member's chat

Parameters
idMember id
visibleTrue to show, false to hide
activeTrue to activate the chat
Returns
True on success

◆ status()

virtual ClientResource * status ( bool ref = false)
inlinevirtual

Find the resource with the lowest status (room resource)

Parameters
refTrue to obtain a referenced pointer
Returns
ClientResource pointer or 0 if not found

Reimplemented from ClientContact.

References RefObject::ref().

◆ updateChatWindow()

virtual void updateChatWindow ( const String & id,
const NamedList & params )
virtual

Update member parameters in chat window

Parameters
idMember id
paramsParameters to set

Member Data Documentation

◆ m_password

String m_password

Room password


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