Skip to content

Commit

Permalink
Made tuntox build with TokTok/c-toxcore
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedeer committed Dec 7, 2016
1 parent ae6ff81 commit e093c65
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
SOURCES = $(wildcard *.c)
DEPS=libtoxcore
DEPS=libsodium toxcore
CC=gcc
CFLAGS=-g #-std=c99
CFLAGS += $(shell pkg-config --cflags $(DEPS))
LDFLAGS=-g -pthread -lm -static -lrt
LDFLAGS += $(shell pkg-config --libs $(DEPS))
LDFLAGS += $(shell pkg-config --static --libs $(DEPS))
DSO_LDFLAGS=-g -pthread -lm -lrt
DSO_LDFLAGS += $(shell pkg-config --libs $(DEPS))
OBJECTS=$(SOURCES:.c=.o)
INCLUDES = $(wildcard *.h)

Expand All @@ -19,7 +21,10 @@ gitversion.c: gitversion.h
$(CC) $(CFLAGS) $< -c -o $@

tuntox: $(OBJECTS) $(INCLUDES)
$(CC) -o $@ $(OBJECTS) -ltoxcore -lpthread $(LDFLAGS) /usr/local/lib/libsodium.a /usr/local/lib/libtoxcore.a
$(CC) -o $@ $(OBJECTS) -lpthread $(LDFLAGS) /usr/local/lib/libtoxmessenger.a /usr/local/lib/libtoxcore.a

tuntox_nostatic: $(OBJECTS) $(INCLUDES)
$(CC) -o $@ $(OBJECTS) -lpthread $(DSO_LDFLAGS)

cscope.out:
cscope -bv ./*.[ch]
Expand Down
10 changes: 5 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ int send_frame(protocol_frame *frame, uint8_t *data)

for(j = 0; j < i; j++)
{
tox_iterate(tox);
tox_iterate(tox, NULL);
usleep(j * 10000);
}
}
Expand Down Expand Up @@ -904,7 +904,7 @@ int do_server_loop()
tunnel *tmp = NULL;
TOX_CONNECTION connected = 0;

tox_callback_friend_lossless_packet(tox, parse_lossless_packet, NULL);
tox_callback_friend_lossless_packet(tox, parse_lossless_packet);

tv.tv_sec = 0;
tv.tv_usec = 20000;
Expand All @@ -918,7 +918,7 @@ int do_server_loop()
int select_rv = 0;

/* Let tox do its stuff */
tox_iterate(tox);
tox_iterate(tox, NULL);

/* Get the desired sleep time, used in select() later */
tox_do_interval_ms = tox_iteration_interval(tox);
Expand Down Expand Up @@ -1378,7 +1378,7 @@ int main(int argc, char *argv[])
}

set_tox_username(tox);
tox_callback_self_connection_status(tox, handle_connection_status_change, NULL);
tox_callback_self_connection_status(tox, handle_connection_status_change);

do_bootstrap(tox);

Expand Down Expand Up @@ -1411,7 +1411,7 @@ int main(int argc, char *argv[])
tox_printable_id[TOX_ADDRESS_SIZE * 2] = '\0';
log_printf(L_INFO, "Using Tox ID: %s\n", tox_printable_id);

tox_callback_friend_request(tox, accept_friend_request, NULL);
tox_callback_friend_request(tox, accept_friend_request);
do_server_loop();
clear_rules();
}
Expand Down
2 changes: 2 additions & 0 deletions util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ void id_to_string(char_t *dest, const char_t *src);
int string_to_id(char_t *w, char_t *a);
void* file_raw(char *path, uint32_t *size);
const char *readable_connection_status(TOX_CONNECTION status);
int parse_local_port_forward(char *string, int *local_port, char **hostname, int *remote_port);
int parse_pipe_port_forward(char *string, char **hostname, int *remote_port);

#endif

0 comments on commit e093c65

Please sign in to comment.