Skip to content
Snippets Groups Projects
Commit 091a3ea3 authored by rswindell's avatar rswindell
Browse files

Displays the user's name and the sysop's name above the windows.

parent d4feef03
No related branches found
No related tags found
No related merge requests found
...@@ -87,7 +87,7 @@ void wsetcolor(WINDOW *win, int fg, int bg) { ...@@ -87,7 +87,7 @@ void wsetcolor(WINDOW *win, int fg, int bg) {
wbkgdset(win, colour); wbkgdset(win, colour);
} }
void drawchatwin(WINDOW **uwin, WINDOW **swin, box_t *boxch) { void drawchatwin(WINDOW **uwin, WINDOW **swin, box_t *boxch, const char* topnmae, const char* botname) {
int maxy,maxx; int maxy,maxx;
endwin(); endwin();
...@@ -98,7 +98,7 @@ void drawchatwin(WINDOW **uwin, WINDOW **swin, box_t *boxch) { ...@@ -98,7 +98,7 @@ void drawchatwin(WINDOW **uwin, WINDOW **swin, box_t *boxch) {
wclear(*uwin); wclear(*uwin);
wborder(*uwin, boxch->ls, boxch->rs, boxch->ts, boxch->bs, boxch->tl, boxch->tr, boxch->bl, boxch->br); wborder(*uwin, boxch->ls, boxch->rs, boxch->ts, boxch->bs, boxch->tl, boxch->tr, boxch->bl, boxch->br);
wmove(*uwin,0,5); wmove(*uwin,0,5);
waddstr(*uwin,"Remote User"); waddstr(*uwin,topname);
wmove(*uwin,1,2); wmove(*uwin,1,2);
scrollok(*uwin,TRUE); scrollok(*uwin,TRUE);
wrefresh(*uwin); wrefresh(*uwin);
...@@ -106,13 +106,13 @@ void drawchatwin(WINDOW **uwin, WINDOW **swin, box_t *boxch) { ...@@ -106,13 +106,13 @@ void drawchatwin(WINDOW **uwin, WINDOW **swin, box_t *boxch) {
wclear(*swin); wclear(*swin);
wborder(*swin, boxch->ls, boxch->rs, boxch->ts, boxch->bs, boxch->tl, boxch->tr, boxch->bl, boxch->br); wborder(*swin, boxch->ls, boxch->rs, boxch->ts, boxch->bs, boxch->tl, boxch->tr, boxch->bl, boxch->br);
wmove(*swin,0,5); wmove(*swin,0,5);
waddstr(*swin,"Sysop"); waddstr(*swin,botname);
wmove(*swin,1,2); wmove(*swin,1,2);
scrollok(*swin,TRUE); scrollok(*swin,TRUE);
wrefresh(*swin); wrefresh(*swin);
} }
int chatchar(WINDOW *win, int ch, box_t *boxch) { int chatchar(WINDOW *win, int ch, box_t *boxch, const char* name) {
int maxy,maxx; int maxy,maxx;
int cury,curx; int cury,curx;
getmaxyx(win,maxy,maxx); getmaxyx(win,maxy,maxx);
...@@ -139,7 +139,7 @@ int chatchar(WINDOW *win, int ch, box_t *boxch) { ...@@ -139,7 +139,7 @@ int chatchar(WINDOW *win, int ch, box_t *boxch) {
whline(win,' ',maxx-2); whline(win,' ',maxx-2);
wborder(win, boxch->ls, boxch->rs, boxch->ts, boxch->bs, boxch->tl, boxch->tr, boxch->bl, boxch->br); wborder(win, boxch->ls, boxch->rs, boxch->ts, boxch->bs, boxch->tl, boxch->tr, boxch->bl, boxch->br);
wmove(win,0,5); wmove(win,0,5);
waddstr(win,"Sysop"); waddstr(win,name);
wmove(win,cury,curx); wmove(win,cury,curx);
} }
wrefresh(win); wrefresh(win);
...@@ -163,7 +163,7 @@ int chatchar(WINDOW *win, int ch, box_t *boxch) { ...@@ -163,7 +163,7 @@ int chatchar(WINDOW *win, int ch, box_t *boxch) {
whline(win,' ',maxx-2); whline(win,' ',maxx-2);
wborder(win, boxch->ls, boxch->rs, boxch->ts, boxch->bs, boxch->tl, boxch->tr, boxch->bl, boxch->br); wborder(win, boxch->ls, boxch->rs, boxch->ts, boxch->bs, boxch->tl, boxch->tr, boxch->bl, boxch->br);
wmove(win,0,5); wmove(win,0,5);
waddstr(win,"Sysop"); waddstr(win,name);
} }
wmove(win,cury,curx); wmove(win,cury,curx);
} }
...@@ -178,10 +178,13 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallbac ...@@ -178,10 +178,13 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallbac
int in,out; int in,out;
char inpath[MAX_PATH]; char inpath[MAX_PATH];
char outpath[MAX_PATH]; char outpath[MAX_PATH];
char usrname[128];
char *p; char *p;
char ch; char ch;
drawchatwin(&uwin,&swin,boxch); username(cfg,node->useron,usrname);
drawchatwin(&uwin,&swin,boxch,usrname,cfg->sys_op);
if(getnodedat(cfg,nodenum,node,NULL)) { if(getnodedat(cfg,nodenum,node,NULL)) {
return(-1); return(-1);
...@@ -252,7 +255,7 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallbac ...@@ -252,7 +255,7 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallbac
case 1: case 1:
lseek(in,-1L,SEEK_CUR); lseek(in,-1L,SEEK_CUR);
if(ch) { if(ch) {
chatchar(uwin,ch,boxch); chatchar(uwin,ch,boxch,usrname);
ch=0; ch=0;
write(in,&ch,1); write(in,&ch,1);
} }
...@@ -275,7 +278,7 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallbac ...@@ -275,7 +278,7 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallbac
default: default:
if(lseek(out,0,SEEK_CUR)>=PCHAT_LEN) if(lseek(out,0,SEEK_CUR)>=PCHAT_LEN)
lseek(out,0,SEEK_SET); lseek(out,0,SEEK_SET);
chatchar(swin,ch,boxch); chatchar(swin,ch,boxch,cfg->sys_op);
switch(write(out,&ch,1)) { switch(write(out,&ch,1)) {
case -1: case -1:
close(in); close(in);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment