From 76cd65ce9486d32a8943a1940a69dacd3f6c7da6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 29 Aug 2009 23:23:29 +0000 Subject: [PATCH] * implement paging hooks in a templated way so it can be called from them. --- webcit/paging.c | 43 +++---------------------- webcit/static/t/page_now.html | 7 ++++ webcit/static/t/paging.html | 1 + webcit/static/t/paging_anchor.html | 16 +++++++++ webcit/static/t/paging_failed_hook.html | 5 +++ webcit/webcit.c | 3 +- 6 files changed, 34 insertions(+), 41 deletions(-) create mode 100644 webcit/static/t/page_now.html create mode 100644 webcit/static/t/paging.html create mode 100644 webcit/static/t/paging_anchor.html create mode 100644 webcit/static/t/paging_failed_hook.html diff --git a/webcit/paging.c b/webcit/paging.c index e93ac646b..856ed018c 100644 --- a/webcit/paging.c +++ b/webcit/paging.c @@ -139,58 +139,22 @@ void do_chat(void) * If there are instant messages waiting, and we notice that we haven't checked them in * a while, it probably means that we need to open the instant messenger window. */ -void page_popup(void) +int Conditional_PAGE_WAITING(StrBuf *Target, WCTemplputParams *TP) { int len; char buf[SIZ]; /** JavaScript function to alert the user that popups are probably blocked */ - wprintf("\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"); len = serv_getln(buf, sizeof buf); if ((len >= 3) && (buf[3] == '*')) { if ((time(NULL) - WC->last_pager_check) > 60) { - wprintf("" - ); + return 1; } } - + return 0; /** Then schedule it to happen again a minute from now if the user is idle. */ - wprintf(" " - ); } @@ -528,6 +492,7 @@ InitModule_PAGING WebcitAddUrlHandler(HKEY("chat_recv"), chat_recv, 0); WebcitAddUrlHandler(HKEY("chat_send"), chat_send, 0); WebcitAddUrlHandler(HKEY("ajax_send_instant_message"), ajax_send_instant_message, AJAX); + RegisterConditional(HKEY("COND:PAGE:WAITING"), 0, Conditional_PAGE_WAITING, CTX_NONE); } diff --git a/webcit/static/t/page_now.html b/webcit/static/t/page_now.html new file mode 100644 index 000000000..dab1c4f8a --- /dev/null +++ b/webcit/static/t/page_now.html @@ -0,0 +1,7 @@ + diff --git a/webcit/static/t/paging.html b/webcit/static/t/paging.html new file mode 100644 index 000000000..5ae351292 --- /dev/null +++ b/webcit/static/t/paging.html @@ -0,0 +1 @@ + diff --git a/webcit/static/t/paging_anchor.html b/webcit/static/t/paging_anchor.html new file mode 100644 index 000000000..15a0bab89 --- /dev/null +++ b/webcit/static/t/paging_anchor.html @@ -0,0 +1,16 @@ + diff --git a/webcit/static/t/paging_failed_hook.html b/webcit/static/t/paging_failed_hook.html new file mode 100644 index 000000000..d814fcb6a --- /dev/null +++ b/webcit/static/t/paging_failed_hook.html @@ -0,0 +1,5 @@ + diff --git a/webcit/webcit.c b/webcit/webcit.c index 869793a2c..391370bca 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -209,8 +209,7 @@ void output_headers( int do_httpheaders, /* 1 = output HTTP headers FlushStrBuf(WCC->ImportantMsg); } if ( (WCC->logged_in) && (!unset_cookies) ) { - /*DoTemplate(HKEY("iconbar"), NULL, &NoCtx);*/ - page_popup(); + DoTemplate(HKEY("paging"), NULL, &NoCtx); } if (do_room_banner == 1) { -- 2.39.2