Absolutely, I have my forums to pass the username all over my site, from private access pages, to Teamspeak logins, etc.
You will want to use a script like the Generic Threads Page that will grab all pertinent information, and then assign something like this at the top after requiring the library, etc:
$name = $user['U_Username'];
That is very generic, you can change $name to anything you desire.
After getting that up and working, wherever you have the "CLICK TO CHAT" link, simply call that variable, for example:
http://www.domain.com/chat.php?$chatname=$nameThat would be the URL that passes them to the chat page.
THEN...
On the chat page, you would want to "capture" that $chatname variable you passed over in the URL, and assign it to the login box.
OR
You can bypass going to the chat login page and simply pass the URL to log into your chat directly from your threads pages by passing the $name variable as the properly named 'chatname' variable.
Post with some more details on what chat if you need help.