Skip to content

Commit

Permalink
Detects destinations of incoming data and directs them to their buf
Browse files Browse the repository at this point in the history
Bug: silently drops to-user PRIVMSGs (/msg)
  • Loading branch information
Sound and Fury committed Jul 28, 2010
1 parent d81b37c commit e3c326b
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 140 deletions.
23 changes: 12 additions & 11 deletions buffer.c
Expand Up @@ -101,18 +101,19 @@ int redraw_buffer(int buf)

int buf_print(int buf, colour lc, char *lt, bool nl)
{
setcolour(lc);
if(nl) printf(CLA "\n");
printf(LOCATE, height-2, 1);
printf("%s" CLR "\n", lt);
resetcol();
printf(CLA "\n");
if(buf)
return(add_to_buffer(buf, lc, lt));
return(0);
if(buf==cbuf)
{
setcolour(lc);
if(nl) printf(CLA "\n");
printf(LOCATE, height-2, 1);
printf("%s" CLR "\n", lt);
resetcol();
printf(CLA "\n");
}
return(add_to_buffer(buf, lc, lt));
}

void in_update(char *inp, int cbuf)
void in_update(char *inp)
{
printf(LOCATE, height-1, 1);
// tab strip
Expand Down Expand Up @@ -163,7 +164,7 @@ void in_update(char *inp, int cbuf)
putchar(brack[1]);
resetcol();
}
putchar('\n');
printf(CLR "\n");
// input
int ino=inp?strlen(inp):0;
if(ino>78)
Expand Down
3 changes: 2 additions & 1 deletion buffer.h
Expand Up @@ -48,11 +48,12 @@ typedef struct _buf
buffer;

int nbufs;
int cbuf;
buffer *bufs;

int init_buffer(int buf, btype type, char *bname, int nlines);
int free_buffer(int buf, int *cbuf);
int add_to_buffer(int buf, colour lc, char *lt);
int redraw_buffer(int buf);
int buf_print(int buf, colour lc, char *lt, bool nl); // don't include trailing \n, because buf_print appends CLR \n
void in_update(char *inp, int cbuf);
void in_update(char *inp);

0 comments on commit e3c326b

Please sign in to comment.