Commit 55085138 authored by deuce's avatar deuce
Browse files

Expose timedisplay() function in uifc... chat now does not overwrite the

top and bottom lines.
parent cd596094
......@@ -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);
......
......@@ -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));
......@@ -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:
......
......@@ -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;
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment