Change “your-plugin-shortcode” to the name of the shortcode for your plugin, or if you’re using a template tag instead, replace this:

echo do_shortcode('[your-plugin-shortcode]');

..with this:

return your_plugin_template_tag();

You may also want to customize the message that’s displayed (“Login required for chat.”) when visitors aren’t logged in. Notice the difference between echoing (for the shortcode) and returning (for the template tag) — an important distinction due to the way shortcodes work.