You'd think i'd have got it right by now
This commit is contained in:
parent
3b3cc6557b
commit
b13da799d1
50
mail_menu.c
50
mail_menu.c
@ -820,38 +820,50 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
|
||||
ansi = z;
|
||||
while (strchr("ABCDEFGHIGJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", body[z]) == NULL)
|
||||
z++;
|
||||
if (body[z] == 'm' || body[z] == 'C' || body[z] == 'D') {
|
||||
if (body[z] == 'm') {
|
||||
strncpy(buffer, &body[ansi], (z - ansi) + 1);
|
||||
buffer[z - ansi + 1] = '\0';
|
||||
s_putstring(socket, buffer);
|
||||
}
|
||||
if (body[z] == 'A') {
|
||||
if (lines >= atoi(&body[ansi + 2])) {
|
||||
lines -= atoi(&body[ansi + 2]);
|
||||
strncpy(buffer, &body[ansi], (z - ansi) + 1);
|
||||
buffer[z - ansi + 1] = '\0';
|
||||
s_putstring(socket, buffer);
|
||||
for (i=0;i<atoi(&body[ansi + 2]);i++) {
|
||||
if (lines - (i + 1) > 0) {
|
||||
s_putstring(socket, "\e[1A");
|
||||
lines--;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (body[z] == 'C') {
|
||||
chars += atoi(&body[ansi + 2]);
|
||||
if (chars > 79) {
|
||||
lines++;
|
||||
chars -= 79;
|
||||
for (i=0;i<atoi(&body[ansi + 2]);i++) {
|
||||
if (chars + (i + 1) < 79) {
|
||||
s_putstring(socket, "\e[1C");
|
||||
chars++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (body[z] == 'B') {
|
||||
lines += atoi(&body[ansi + 2]);
|
||||
if (lines <= 17) {
|
||||
strncpy(buffer, &body[ansi], (z - ansi) + 1);
|
||||
buffer[z - ansi + 1] = '\0';
|
||||
s_putstring(socket, buffer);
|
||||
}
|
||||
}
|
||||
for (i=0;i<atoi(&body[ansi + 2]);i++) {
|
||||
if (lines + (i + 1) < 17) {
|
||||
s_putstring(socket, "\e[1B");
|
||||
lines++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} }
|
||||
if (body[z] == 'D') {
|
||||
chars -= atoi(&body[ansi + 2]);
|
||||
for (i=0;i<atoi(&body[ansi + 2]);i++) {
|
||||
if (chars - (i + 1) > 0) {
|
||||
s_putstring(socket, "\e[1D");
|
||||
chars--;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (body[z] != '\n') {
|
||||
chars++;
|
||||
s_putchar(socket, body[z]);
|
||||
|
Reference in New Issue
Block a user