mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
changed some formatting, fixed the removal of x and y
This commit is contained in:
parent
3678b302db
commit
b9e3bf1fa6
|
@ -36,11 +36,12 @@
|
||||||
char lines[HISTORY][STRING_LENGTH];
|
char lines[HISTORY][STRING_LENGTH];
|
||||||
char line[STRING_LENGTH];
|
char line[STRING_LENGTH];
|
||||||
|
|
||||||
char *help = "[i] commands: /f ID (to add friend), /m friendnumber message (to send message), /s status (to change status)\n"
|
char *help = "[i] commands:\n/f ID (to add friend)\n/m friendnumber message "
|
||||||
"[i] /l list (list friends), /h for help, /i for info, /n nick (to change nickname), /q (to quit)";
|
"(to send message)\n/s status (to change status)\n[i] /l list (l"
|
||||||
|
"ist friends)\n/h for help\n/i for info\n/n nick (to change nick"
|
||||||
|
"name)\n/q (to quit)";
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
|
||||||
uint8_t pending_requests[256][CLIENT_ID_SIZE];
|
uint8_t pending_requests[256][CLIENT_ID_SIZE];
|
||||||
uint8_t num_requests = 0;
|
uint8_t num_requests = 0;
|
||||||
|
|
||||||
|
@ -126,7 +127,7 @@ char *format_message(char *message, int friendnum)
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void line_eval(char lines[HISTORY][STRING_LENGTH], char *line)
|
void line_eval(char *line)
|
||||||
{
|
{
|
||||||
if (line[0] == '/') {
|
if (line[0] == '/') {
|
||||||
char inpt_command = line[1];
|
char inpt_command = line[1];
|
||||||
|
@ -410,13 +411,16 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
char idstring[200];
|
char idstring[200];
|
||||||
get_id(idstring);
|
get_id(idstring);
|
||||||
|
|
||||||
initscr();
|
initscr();
|
||||||
noecho();
|
noecho();
|
||||||
raw();
|
raw();
|
||||||
getmaxyx(stdscr, y, x);
|
getmaxyx(stdscr, y, x);
|
||||||
|
|
||||||
|
new_lines("/h for list of commands");
|
||||||
new_lines(idstring);
|
new_lines(idstring);
|
||||||
new_lines(help);
|
|
||||||
strcpy(line, "");
|
strcpy(line, "");
|
||||||
|
|
||||||
IP_Port bootstrap_ip_port;
|
IP_Port bootstrap_ip_port;
|
||||||
bootstrap_ip_port.port = htons(atoi(argv[2]));
|
bootstrap_ip_port.port = htons(atoi(argv[2]));
|
||||||
int resolved_address = resolve_addr(argv[1]);
|
int resolved_address = resolve_addr(argv[1]);
|
||||||
|
@ -443,7 +447,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
getmaxyx(stdscr, y, x);
|
getmaxyx(stdscr, y, x);
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
line_eval(lines, line);
|
line_eval(line);
|
||||||
strcpy(line, "");
|
strcpy(line, "");
|
||||||
} else if (c == 127) {
|
} else if (c == 127) {
|
||||||
line[strlen(line)-1] = '\0';
|
line[strlen(line)-1] = '\0';
|
||||||
|
|
|
@ -37,12 +37,13 @@
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include "../core/Messenger.h"
|
#include "../core/Messenger.h"
|
||||||
#include "../core/network.h"
|
#include "../core/network.h"
|
||||||
|
|
||||||
#define STRING_LENGTH 256
|
#define STRING_LENGTH 256
|
||||||
#define HISTORY 50
|
#define HISTORY 50
|
||||||
#define PUB_KEY_BYTES 32
|
#define PUB_KEY_BYTES 32
|
||||||
|
|
||||||
void new_lines(char *line);
|
void new_lines(char *line);
|
||||||
void line_eval(char lines[HISTORY][STRING_LENGTH], char *line);
|
void line_eval(char *line);
|
||||||
void wrap(char output[STRING_LENGTH], char input[STRING_LENGTH], int line_width) ;
|
void wrap(char output[STRING_LENGTH], char input[STRING_LENGTH], int line_width) ;
|
||||||
int count_lines(char *string) ;
|
int count_lines(char *string) ;
|
||||||
char *appender(char *str, const char c);
|
char *appender(char *str, const char c);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user