mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge branch 'master' of git://github.com/irungentoo/ProjectTox-Core
This commit is contained in:
commit
da8996dbdd
@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 2.6.0)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
|
||||
if(UNIX)
|
||||
find_package(Curses REQUIRED)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
option(USE_NACL "Use NaCl library instead of libsodium")
|
||||
endif()
|
||||
|
22
INSTALL.md
22
INSTALL.md
@ -18,6 +18,14 @@ Build dependencies:
|
||||
```bash
|
||||
apt-get install build-essential libtool autotools-dev automake libconfig-dev ncurses-dev cmake checkinstall
|
||||
```
|
||||
|
||||
On Fedora:
|
||||
|
||||
```bash
|
||||
yum groupinstall "Development Tools"
|
||||
yum install libtool autoconf automake libconfig-devel ncurses-devel cmake
|
||||
```
|
||||
|
||||
Note that `libconfig-dev` should be >= 1.4.
|
||||
|
||||
You should get and install [libsodium](https://github.com/jedisct1/libsodium):
|
||||
@ -31,6 +39,20 @@ sudo checkinstall --install --pkgname libsodium --pkgversion 0.4.2 --nodoc
|
||||
sudo ldconfig
|
||||
```
|
||||
|
||||
Or if checkinstall is not easily available for your distribution (e.g. Fedora),
|
||||
this will install the libs to /usr/local/lib and the headers to /usr/local/include:
|
||||
|
||||
```bash
|
||||
git clone git://github.com/jedisct1/libsodium.git
|
||||
cd libsodium
|
||||
git checkout tags/0.4.2
|
||||
./autogen.sh
|
||||
./configure
|
||||
make check
|
||||
sudo make install
|
||||
```
|
||||
|
||||
|
||||
Then clone this repo and generate makefile:
|
||||
```bash
|
||||
git clone git://github.com/irungentoo/ProjectTox-Core.git
|
||||
|
@ -166,8 +166,8 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line)
|
||||
}
|
||||
else if (inpt_command == 'm') { //message command: /m friendnumber messsage
|
||||
size_t len = strlen(line);
|
||||
if(len < 3)
|
||||
return;
|
||||
if(len < 3)
|
||||
return;
|
||||
|
||||
char numstring[len-3];
|
||||
char message[len-3];
|
||||
@ -441,7 +441,7 @@ int main(int argc, char *argv[])
|
||||
if (c == '\n') {
|
||||
line_eval(lines, line);
|
||||
strcpy(line, "");
|
||||
} else if (c == 127) {
|
||||
} else if (c == 8 || c == 127) {
|
||||
line[strlen(line)-1] = '\0';
|
||||
} else if (isalnum(c) || ispunct(c) || c == ' ') {
|
||||
strcpy(line, appender(line, (char) c));
|
||||
|
@ -106,6 +106,7 @@ static void chat_onKey(ToxWindow* self, int key) {
|
||||
}
|
||||
|
||||
static void chat_onDraw(ToxWindow* self) {
|
||||
curs_set(1);
|
||||
int x, y;
|
||||
ChatContext* ctx = (ChatContext*) self->x;
|
||||
|
||||
@ -117,7 +118,7 @@ static void chat_onDraw(ToxWindow* self) {
|
||||
|
||||
wclear(ctx->linewin);
|
||||
mvwhline(ctx->linewin, 0, 0, '_', COLS);
|
||||
mvwprintw(ctx->linewin, 1, 0, "%s\n", ctx->line);
|
||||
mvwprintw(self->window, y-1, 0, "%s\n", ctx->line);
|
||||
|
||||
wrefresh(self->window);
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ static void friendlist_onKey(ToxWindow* self, int key) {
|
||||
}
|
||||
|
||||
static void friendlist_onDraw(ToxWindow* self) {
|
||||
curs_set(0);
|
||||
size_t i;
|
||||
|
||||
wclear(self->window);
|
||||
|
@ -280,26 +280,6 @@ void prepare_window(WINDOW* w) {
|
||||
wresize(w, LINES-2, COLS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Draws cursor relative to input on prompt window.
|
||||
* Removes cursor on friends window and chat windows.
|
||||
*
|
||||
* TODO: Make it work for chat windows
|
||||
*/
|
||||
void position_cursor(WINDOW* w, char* title)
|
||||
{
|
||||
curs_set(1);
|
||||
if (strcmp(title, "[prompt]") == 0) { // main/prompt window
|
||||
int x, y;
|
||||
getyx(w, y, x);
|
||||
move(y, x);
|
||||
}
|
||||
else if (strcmp(title, "[friends]") == 0) // friends window
|
||||
curs_set(0);
|
||||
else // any other window (i.e chat)
|
||||
curs_set(0);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int ch;
|
||||
ToxWindow* a;
|
||||
@ -317,9 +297,8 @@ int main(int argc, char* argv[]) {
|
||||
a = &windows[w_active];
|
||||
prepare_window(a->window);
|
||||
a->blink = false;
|
||||
a->onDraw(a);
|
||||
draw_bar();
|
||||
position_cursor(a->window, a->title);
|
||||
a->onDraw(a);
|
||||
|
||||
// Handle input.
|
||||
ch = getch();
|
||||
|
@ -140,6 +140,7 @@ static void execute(ToxWindow* self, char* cmd) {
|
||||
break;
|
||||
case -2:
|
||||
wprintw(self->window, "Please add a message to your request.\n");
|
||||
break;
|
||||
case -3:
|
||||
wprintw(self->window, "That appears to be your own ID.\n");
|
||||
break;
|
||||
@ -287,6 +288,7 @@ static void prompt_onKey(ToxWindow* self, int key) {
|
||||
}
|
||||
|
||||
static void prompt_onDraw(ToxWindow* self) {
|
||||
curs_set(1);
|
||||
int x, y;
|
||||
|
||||
getyx(self->window, y, x);
|
||||
|
Loading…
x
Reference in New Issue
Block a user