From 5cf982dfa141d3d6f36c725ba5d5a3dcc553c756 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Tue, 27 Aug 2013 18:30:38 -0400 Subject: [PATCH] Removed dht window because it's not supported by the new public api --- build/Makefile.am | 4 +- src/dhtstatus.c | 104 ---------------------------------------------- src/dhtstatus.h | 8 ---- src/windows.c | 6 +-- 4 files changed, 2 insertions(+), 120 deletions(-) delete mode 100644 src/dhtstatus.c delete mode 100644 src/dhtstatus.h diff --git a/build/Makefile.am b/build/Makefile.am index 4e747ec..dc6a588 100644 --- a/build/Makefile.am +++ b/build/Makefile.am @@ -11,9 +11,7 @@ toxic_SOURCES = $(top_srcdir)/src/main.c \ $(top_srcdir)/src/friendlist.h \ $(top_srcdir)/src/friendlist.c \ $(top_srcdir)/src/toxic_windows.h \ - $(top_srcdir)/src/windows.c \ - $(top_srcdir)/src/dhtstatus.h \ - $(top_srcdir)/src/dhtstatus.c + $(top_srcdir)/src/windows.c toxic_CFLAGS = -I$(top_srcdir) \ $(NCURSES_CFLAGS) \ diff --git a/src/dhtstatus.c b/src/dhtstatus.c deleted file mode 100644 index 5df5666..0000000 --- a/src/dhtstatus.c +++ /dev/null @@ -1,104 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "dhtstatus.h" -#include "string.h" - -typedef uint8_t ipbuf[3 * 4 + 3 + 1]; -static int num_selected = 0; - -static void printip(ipbuf buf, tox_IP ip) -{ - sprintf((char *)buf, "%u.%u.%u.%u", ip.c[0], ip.c[1], ip.c[2], ip.c[3]); -} - -static void dhtstatus_onKey(ToxWindow *self, Tox *m, wint_t key) -{ - switch (key) { - case KEY_UP: - case 'k': - if (--num_selected < 0) - num_selected = TOX_CLIENT_ID_SIZE - 1; - - break; - - case KEY_DOWN: - case 'j': - num_selected = (num_selected + 1) % TOX_CLIENT_ID_SIZE; - break; - - case '\n': - break; - - default: - break; - } -} - -static void dhtstatus_onDraw(ToxWindow *self, Tox *m) -{ - /* - Client_data *close_clientlist = DHT_get_close_list(m->dht); - curs_set(0); - werase(self->window); - - uint64_t now = unix_time(); - uint32_t i, j; - ipbuf ipbuf; - wprintw(self->window, - "\n%llu ______________________ CLOSE LIST ________________________ ___ IP ADDR ___ _PRT_ LST PNG ____ SELF ____ _PRT_ LST\n\n", - now); - - for (i = 0; i < 32; i++) { /*Number of nodes in closelist*/ - /* - Client_data *client = close_clientlist + i; - - if (i == num_selected) wattron(self->window, COLOR_PAIR(3)); - - wprintw(self->window, "[%02i] ", i); - uint16_t port = ntohs(client->ip_port.port); - - if (port) { - for (j = 0; j < CLIENT_ID_SIZE; j++) - wprintw(self->window, "%02hhx", client->client_id[j]); - - printip(ipbuf, client->ip_port.ip); - wprintw(self->window, " %15s %5u ", ipbuf, port); - wprintw(self->window, " %3llu ", now - client->timestamp); - wprintw(self->window, " %3llu ", now - client->last_pinged); - - port = ntohs(client->ret_ip_port.port); - - if (port) { - printip(ipbuf, client->ret_ip_port.ip); - wprintw(self->window, " %15s %5u %3llu", ipbuf, port, now - close_clientlist[i].ret_timestamp); - } - } - - wprintw(self->window, "\n"); - - if (i == num_selected) wattroff(self->window, COLOR_PAIR(3)); - } - - wrefresh(self->window); - */ -} - -static void dhtstatus_onInit(ToxWindow *self, Tox *m) -{ - -} - -ToxWindow new_dhtstatus() -{ - ToxWindow ret; - memset(&ret, 0, sizeof(ret)); - - ret.onKey = &dhtstatus_onKey; - ret.onDraw = &dhtstatus_onDraw; - ret.onInit = &dhtstatus_onInit; - - strcpy(ret.title, "[dht status]"); - return ret; -} diff --git a/src/dhtstatus.h b/src/dhtstatus.h deleted file mode 100644 index 3c4a55c..0000000 --- a/src/dhtstatus.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _dhtstatus_h -#define _dhtstatus_h - -#include "toxic_windows.h" - -ToxWindow new_dhtstatus(); - -#endif diff --git a/src/windows.c b/src/windows.c index f2ddefb..ffa71f4 100644 --- a/src/windows.c +++ b/src/windows.c @@ -7,7 +7,6 @@ #include "friendlist.h" #include "prompt.h" -#include "dhtstatus.h" #include "toxic_windows.h" extern char *DATA_FILE; @@ -167,10 +166,7 @@ ToxWindow *init_windows() { int n_prompt = add_window(m, new_prompt()); - if (n_prompt == -1 - || add_window(m, new_friendlist()) == -1 - //|| add_window(m, new_dhtstatus()) == -1 - ) { + if (n_prompt == -1 || add_window(m, new_friendlist()) == -1) { fprintf(stderr, "add_window() failed.\n"); endwin(); exit(1);