From 5508513854677c756abace0c71ee27d7ef3499a7 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Fri, 16 May 2003 02:20:38 +0000
Subject: [PATCH] Expose timedisplay() function in uifc... chat now does not
 overwrite the top and bottom lines.

---
 src/sbbs3/umonitor/chat.c     | 8 +++++---
 src/sbbs3/umonitor/chat.h     | 3 ++-
 src/sbbs3/umonitor/umonitor.c | 6 +++---
 src/uifc/uifc.h               | 6 ++++++
 src/uifc/uifcc.c              | 2 ++
 5 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/sbbs3/umonitor/chat.c b/src/sbbs3/umonitor/chat.c
index 6ca2a087a2..3465fc1db3 100644
--- a/src/sbbs3/umonitor/chat.c
+++ b/src/sbbs3/umonitor/chat.c
@@ -92,8 +92,8 @@ void drawchatwin(WINDOW **uwin, WINDOW **swin, box_t *boxch) {
 
 	endwin();
 	getmaxyx(stdscr,maxy,maxx);
-	*uwin=newwin(maxy/2,maxx,0,0);
-	*swin=newwin(0,maxx,maxy/2,0);
+	*uwin=newwin(maxy/2-1,maxx,1,0);
+	*swin=newwin(maxy-maxy/2-1,maxx,maxy/2,0);
 	wsetcolor(*uwin,YELLOW,BLUE);
 	wclear(*uwin);
 	wborder(*uwin,  boxch->ls, boxch->rs, boxch->ts, boxch->bs, boxch->tl, boxch->tr, boxch->bl, boxch->br);
@@ -167,7 +167,7 @@ int chatchar(WINDOW *win, int ch, box_t *boxch) {
 	return(0);
 }
 
-int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch) {
+int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallback)(void)) {
 	WINDOW	*uwin;
 	WINDOW	*swin;
 	int		in,out;
@@ -211,6 +211,8 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch) {
 	togglechat(cfg,nodenum,node,TRUE);
 
 	while(in != -1) {
+		if(timecallback != NULL)
+			timecallback();
 		utime(outpath,NULL);
 		utime(inpath,NULL);
 		
diff --git a/src/sbbs3/umonitor/chat.h b/src/sbbs3/umonitor/chat.h
index 1fae638d4b..4abcfa8cd1 100644
--- a/src/sbbs3/umonitor/chat.h
+++ b/src/sbbs3/umonitor/chat.h
@@ -41,4 +41,5 @@ typedef struct {
 	chtype ls, rs, ts, bs, tl, tr, bl, br;
 } box_t;
 
-int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch);
+int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallback)(void));
+
diff --git a/src/sbbs3/umonitor/umonitor.c b/src/sbbs3/umonitor/umonitor.c
index 140e9921cc..a443c5b144 100644
--- a/src/sbbs3/umonitor/umonitor.c
+++ b/src/sbbs3/umonitor/umonitor.c
@@ -412,7 +412,7 @@ int main(int argc, char** argv)  {
 			if((j=getnodedat(&cfg,i,&node,NULL)))
 				sprintf(mopt[i-1],"Error reading node data (%d)!",j);
 			else
-				nodestatus(&cfg,&node,mopt[i-1],72);
+				sprintf(mopt[i-1],"%3d: %s",i,nodestatus(&cfg,&node,str,71));
 		}
 		mopt[i-1][0]=0;
 
@@ -467,7 +467,7 @@ int main(int argc, char** argv)  {
 				continue;
 			}
 			if((node.status&NODE_INUSE) && node.useron)
-				chat(&cfg,main_dflt+1,&node,&boxch);
+				chat(&cfg,main_dflt+1,&node,&boxch,uifc.timedisplay);
 			continue;
 		}
 
@@ -577,7 +577,7 @@ int main(int argc, char** argv)  {
 					break;
 
 				case 4:
-					chat(&cfg,main_dflt+1,&node,&boxch);
+					chat(&cfg,main_dflt+1,&node,&boxch,uifc.timedisplay);
 					break;
 				
 				case -1:
diff --git a/src/uifc/uifc.h b/src/uifc/uifc.h
index acfe323232..a52b9b43a2 100644
--- a/src/uifc/uifc.h
+++ b/src/uifc/uifc.h
@@ -356,6 +356,12 @@ typedef struct {
 /****************************************************************************/
 	void (*showbuf)(char *buf, char *title, BOOL markup);
 
+/****************************************************************************/
+/* Updates time in upper left corner of screen with current time in ASCII/  */
+/* Unix format																*/
+/****************************************************************************/
+	void (*timedisplay)(void);
+
 #endif
 } uifcapi_t;
 
diff --git a/src/uifc/uifcc.c b/src/uifc/uifcc.c
index 9821d0ac8f..c8382ef408 100644
--- a/src/uifc/uifcc.c
+++ b/src/uifc/uifcc.c
@@ -121,6 +121,7 @@ static int cprintf(char *fmat, ...);
 static void cputs(char *str);
 static void gotoxy(int x, int y);
 static void _putch(unsigned char ch, BOOL refresh);
+static void timedisplay(void);
 #define putch(x)	_putch(x,TRUE)
 
 /* API routines */
@@ -184,6 +185,7 @@ int uifcinic(uifcapi_t* uifcapi)
 #ifdef __unix__
     api->showhelp=help;
 	api->showbuf=showbuf;
+	api->timedisplay=timedisplay;
 #endif
 
 #if defined(LOCALE)
-- 
GitLab