Safer display in chat

This commit is contained in:
Michiel Broek 2006-03-06 20:30:09 +00:00
parent 49a8f5ed69
commit fa036b00b7
3 changed files with 16 additions and 7 deletions

View File

@ -29,6 +29,7 @@ v0.83.14 23-Feb-2006
mbmon:
Better user input checking in chat.
Safer display in chat.
mbsetup:
Added archiver selection for nodes in node setup.

View File

@ -480,8 +480,8 @@ void Showline(int y, int x, char *msg)
int i, done = FALSE;
if (strlen(msg)) {
mbse_locate(y, x);
if (msg[0] == '<') {
mbse_locate(y, x);
mbse_colour(LIGHTCYAN, BLACK);
putchar('<');
mbse_colour(LIGHTBLUE, BLACK);
@ -504,10 +504,12 @@ void Showline(int y, int x, char *msg)
} else {
mbse_colour(LIGHTMAGENTA, BLACK);
}
mbse_mvprintw(y, x, msg);
for (i = 0; i < strlen(msg); i++)
putchar(msg[i]);
} else {
mbse_colour(GREEN, BLACK);
mbse_mvprintw(y, x, msg);
for (i = 0; i < strlen(msg); i++)
putchar(msg[i]);
}
}
}
@ -537,7 +539,8 @@ void DispMsg(char *msg)
for (i = 0; i <= rsize; i++) {
mbse_locate(i+4,1);
clrtoeol();
snprintf(rbuf[i], 81, "%s", rbuf[i+1]);
strncpy(rbuf[i], rbuf[i+1], 81);
// snprintf(rbuf[i], 81, "%s", rbuf[i+1]);
Showline(i+4, 1, rbuf[i]);
}
} else {

View File

@ -508,7 +508,7 @@ void chat_close_r(char *data, char *buf)
void chat_put_r(char *data, char *buf)
{
char *p, *pid, *msg, *cmd, *mbuf, *flags, temp[81];
char *p, *q, *pid, *msg, *cmd, *mbuf, *flags, temp[81];
int first, count, owner = FALSE, found;
usr_list *tmpu, *tmp;
chn_list *tmpc;
@ -588,8 +588,13 @@ void chat_put_r(char *data, char *buf)
system_msg(tmpu->pid, mbuf);
}
first = FALSE;
snprintf(mbuf, 200, "%3d %-20s %-54s", tmpc->users, tmpc->name, tmpc->topic);
system_msg(tmpu->pid, mbuf);
q = calloc(81, sizeof(char));
snprintf(q, 81, "%3d %-20s ", tmpc->users, tmpc->name);
p = xstrcpy(q);
p = xstrcat(p, tmpc->topic);
system_msg(tmpu->pid, p);
free(p);
free(q);
}
if (first) {
snprintf(mbuf, 200, "No active channels to list");