Added send chat method to contact.

git-svn-id: http://voip.null.ro/svn/yate@3218 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2010-04-20 08:22:38 +00:00
parent 1e1e9ed5ba
commit 6272daa183
2 changed files with 23 additions and 0 deletions

View File

@ -3646,6 +3646,19 @@ ClientContact::ClientContact(ClientAccount* owner, NamedList& params, bool chat)
createChatWindow();
}
// Send chat to contact (enqueue a msg.execute message)
bool ClientContact::sendChat(const char* body, const String& res, const char* type)
{
Message* m = Client::buildMessage("msg.execute",accountName());
if (!TelEngine::null(type))
m->addParam("type",type);
m->addParam("called",m_uri);
if (res)
m->addParam("called_instance",res);
m->addParam("body",body);
return Engine::enqueue(m);
}
// Show or hide this contact's chat window
bool ClientContact::showChat(bool visible, bool active)
{

View File

@ -3093,6 +3093,16 @@ public:
inline bool hasChat()
{ return Client::self() && Client::self()->getWindow(m_chatWndName); }
/**
* Send chat to contact (enqueue a msg.execute message)
* @param body Chat body
* @param res Optional target instance
* @param type Optional message type parameter
* @return True on success
*/
virtual bool sendChat(const char* body, const String& res = String::empty(),
const char* type = 0);
/**
* Check if this contact's chat window is visible
* @return True if this contact's chat window is visible