<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>liblinphone: Chat room and Messaging</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">liblinphone  <span id="projectnumber">3.5.2</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.1.2 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#typedef-members">Typedefs</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">Chat room and Messaging</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2><a name="typedef-members"></a> Typedefs</h2></td></tr> <tr class="memitem:ga37902f3fc715b7f6451c241d0efd0299"><td class="memItemLeft" align="right" valign="top">typedef struct _LinphoneChatRoom </td><td class="memItemRight" valign="bottom"><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a></td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:ga02c675b2181e77397694e801cd606e85"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__chatroom.html#ga02c675b2181e77397694e801cd606e85">linphone_core_create_chat_room</a> (<a class="el" href="group__initializing.html#gaa5cf635b82dd338e7ee2dd3599d05f0a">LinphoneCore</a> *lc, const char *to)</td></tr> <tr class="memitem:gaa2ae6260190b412b2183d5b70b7c7ea9"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__chatroom.html#gaa2ae6260190b412b2183d5b70b7c7ea9">linphone_chat_room_destroy</a> (<a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> *cr)</td></tr> <tr class="memitem:gaf3de508d63bbc8b1d51f56886846d526"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="group__linphone__address.html#gaa017e66840f5ee578168bd469b6c3e91">LinphoneAddress</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__chatroom.html#gaf3de508d63bbc8b1d51f56886846d526">linphone_chat_room_get_peer_address</a> (<a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> *cr)</td></tr> <tr class="memitem:ga5d70a868f932e0793991c8aca1289591"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__chatroom.html#ga5d70a868f932e0793991c8aca1289591">linphone_chat_room_send_message</a> (<a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> *cr, const char *msg)</td></tr> </table> <a name="details" id="details"></a><h2>Detailed Description</h2> <p><b> Exchanging text messages</b> <br/> Messages are sent using <a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> object. First step is to create a <a class="el" href="group__chatroom.html#ga02c675b2181e77397694e801cd606e85">chat room </a> from a peer sip uri. </p> <div class="fragment"><div class="line"><a class="code" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a>* chat_room = <a class="code" href="group__chatroom.html#ga02c675b2181e77397694e801cd606e85">linphone_core_create_chat_room</a>(lc,<span class="stringliteral">"sip:joe@sip.linphone.org"</span>);</div> </div><!-- fragment --><p><br/> Once created, messages are sent using function <a class="el" href="group__chatroom.html#ga5d70a868f932e0793991c8aca1289591">linphone_chat_room_send_message()</a> . </p> <div class="fragment"><div class="line"><a class="code" href="group__chatroom.html#ga5d70a868f932e0793991c8aca1289591">linphone_chat_room_send_message</a>(chat_room,<span class="stringliteral">"Hello world"</span>); <span class="comment">/*sending message*/</span></div> </div><!-- fragment --><p> <br/> Incoming message are received from call back <a class="el" href="struct__LinphoneVTable.html#aa2d467de0d6fcf1ca5c74b55b14da44e">LinphoneCoreVTable.text_received</a> </p> <div class="fragment"><div class="line"><span class="keywordtype">void</span> text_received(<a class="code" href="group__initializing.html#gaa5cf635b82dd338e7ee2dd3599d05f0a">LinphoneCore</a> *lc, <a class="code" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> *room, <span class="keyword">const</span> <a class="code" href="group__linphone__address.html#gaa017e66840f5ee578168bd469b6c3e91">LinphoneAddress</a> *from, <span class="keyword">const</span> <span class="keywordtype">char</span> *message) {</div> <div class="line"> printf(<span class="stringliteral">" Message [%s] received from [%s] \n"</span>,message,<a class="code" href="group__linphone__address.html#ga24c1a16f49f8b72f2bab65cc5d8a51af">linphone_address_as_string</a> (from));</div> <div class="line">}</div> </div><!-- fragment --><p> <br/> A complete tutorial can be found at : <a class="el" href="group__chatroom__tuto.html">Chat room tutorial</a> </p> <h2>Typedef Documentation</h2> <a class="anchor" id="ga37902f3fc715b7f6451c241d0efd0299"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef struct _LinphoneChatRoom <a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a></td> </tr> </table> </div><div class="memdoc"> <p>A chat room is the place where text messages are exchanged. <br/> Can be created by <a class="el" href="group__chatroom.html#ga02c675b2181e77397694e801cd606e85">linphone_core_create_chat_room()</a>. </p> </div> </div> <h2>Function Documentation</h2> <a class="anchor" id="ga02c675b2181e77397694e801cd606e85"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a>* linphone_core_create_chat_room </td> <td>(</td> <td class="paramtype"><a class="el" href="group__initializing.html#gaa5cf635b82dd338e7ee2dd3599d05f0a">LinphoneCore</a> * </td> <td class="paramname"><em>lc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"><em>to</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Create a new chat room for messaging from a sip uri like sip:<a href="#" onclick="location.href='mai'+'lto:'+'joe'+'@s'+'ip.'+'li'+'nph'+'on'+'e.o'+'rg'; return false;">joe@s<span style="display: none;">.nosp@m.</span>ip.l<span style="display: none;">.nosp@m.</span>inpho<span style="display: none;">.nosp@m.</span>ne.o<span style="display: none;">.nosp@m.</span>rg</a> </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">lc</td><td><a class="el" href="group__initializing.html#gaa5cf635b82dd338e7ee2dd3599d05f0a">LinphoneCore</a> object </td></tr> <tr><td class="paramname">to</td><td>destination address for messages </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> where messaging can take place. </dd></dl> </div> </div> <a class="anchor" id="gaa2ae6260190b412b2183d5b70b7c7ea9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void linphone_chat_room_destroy </td> <td>(</td> <td class="paramtype"><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> * </td> <td class="paramname"><em>cr</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Destructor </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cr</td><td><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> object </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="gaf3de508d63bbc8b1d51f56886846d526"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="group__linphone__address.html#gaa017e66840f5ee578168bd469b6c3e91">LinphoneAddress</a>* linphone_chat_room_get_peer_address </td> <td>(</td> <td class="paramtype"><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> * </td> <td class="paramname"><em>cr</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>get peer address <a class="el" href="group__chatroom.html#ga02c675b2181e77397694e801cd606e85">associated to </a> this <a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cr</td><td><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> object </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__linphone__address.html#gaa017e66840f5ee578168bd469b6c3e91">LinphoneAddress</a> peer address </dd></dl> </div> </div> <a class="anchor" id="ga5d70a868f932e0793991c8aca1289591"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void linphone_chat_room_send_message </td> <td>(</td> <td class="paramtype"><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> * </td> <td class="paramname"><em>cr</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"><em>msg</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>send a message to peer member of this chat room. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cr</td><td><a class="el" href="group__chatroom.html#ga37902f3fc715b7f6451c241d0efd0299">LinphoneChatRoom</a> object </td></tr> <tr><td class="paramname">msg</td><td>message to be sent </td></tr> </table> </dd> </dl> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.1.2 </small></address> </body> </html>