After an year of patching Joomla, SMF, JSMF bridge....
This is the code you are looking for:
global $context ;
if (isset($context){
if ( $context['user']['unread_messages'] > 0 ){
if ( strcasecmp( mosGetParam( $_REQUEST, 'action', '' ), 'pm' ) != 0 ){
echo '
<script>
<!--//
if (confirm("Ypu have ' . $context['user']['unread_messages'] .' personal messages. Press OK to read.")) {
parent.location="' . str_replace( '&', '&', $jsmf->fixLink( "index.php?action=pm" ) ) . '";
}
//-->
</script>';
}
}
}
Code should be added after "<body>" in your Joomla template. (Don't forget "<php" before and "?>" after code).