{
char buf[SIZ];
+ /** JavaScript function to alert the user that popups are probably blocked */
+ wprintf("<script type=\"text/javascript\"> "
+ "function PopUpFailed() { "
+ " alert(\"%s\"); "
+ "} "
+ "</script>\n",
+ _("You have one or more instant messages waiting, but the Citadel Instant Messenger "
+ "window failed to open. This is probably because you have a popup blocker "
+ "installed. Please configure your popup blocker to allow popups from this site "
+ "if you wish to receive instant messages.")
+ );
+
/** First, do the check as part of our page load. */
serv_puts("NOOP");
serv_getln(buf, sizeof buf);
if (buf[3] == '*') {
if ((time(NULL) - WC->last_pager_check) > 60) {
wprintf("<script type=\"text/javascript\">"
- " window.open('static/instant_messenger.html', 'CTDL_MESSENGER', "
- " 'width=700,height=400');"
+ " var oWin = window.open('static/instant_messenger.html', "
+ " 'CTDL_MESSENGER', 'width=700,height=400'); "
+ " if (oWin==null || typeof(oWin)==\"undefined\") { "
+ " PopUpFailed(); "
+ " } "
"</script>"
);
}
}
/** Then schedule it to happen again a minute from now if the user is idle. */
- wprintf("<script type=\"text/javascript\"> \n"
- " function HandleSslp(sslg_xmlresponse) { \n"
- " sslg_response = sslg_xmlresponse.responseText.substr(0, 1); \n"
- " if (sslg_response == 'Y') { \n"
- " window.open('static/instant_messenger.html', 'CTDL_MESSENGER', \n"
- " 'width=700,height=400'); \n"
- " } \n"
- " } \n"
- " function CheckPager() { \n"
- " new Ajax.Request('sslg', { method: 'get', parameters: Math.random(), \n"
- " onSuccess: HandleSslp } ); \n"
- " } \n"
- " new PeriodicalExecuter(CheckPager, 30); \n"
- "</script> \n"
+ wprintf("<script type=\"text/javascript\"> "
+ " function HandleSslp(sslg_xmlresponse) { "
+ " sslg_response = sslg_xmlresponse.responseText.substr(0, 1); "
+ " if (sslg_response == 'Y') { "
+ " var oWin = window.open('static/instant_messenger.html', 'CTDL_MESSENGER', "
+ " 'width=700,height=400'); "
+ " if (oWin==null || typeof(oWin)==\"undefined\") { "
+ " PopUpFailed(); "
+ " } "
+ " } "
+ " } "
+ " function CheckPager() { "
+ " new Ajax.Request('sslg', { method: 'get', parameters: Math.random(), "
+ " onSuccess: HandleSslp } ); "
+ " } "
+ " new PeriodicalExecuter(CheckPager, 30); "
+ "</script> "
);
}