From 4946c809d75ebec360d3f34b7518fb5f0948c925 Mon Sep 17 00:00:00 2001 From: Aaron Lipinski Date: Tue, 13 Aug 2013 12:32:09 +1200 Subject: remove temporary callbacks from refactoring --- testing/toxic/chat.c | 5 +---- testing/toxic/chat.h | 3 +-- testing/toxic/friendlist.c | 13 ++++--------- testing/toxic/friendlist.h | 6 ++---- testing/toxic/windows.c | 2 +- testing/toxic/windows.h | 3 +++ 6 files changed, 12 insertions(+), 20 deletions(-) (limited to 'testing') diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c index 6811569b..e4da9484 100644 --- a/testing/toxic/chat.c +++ b/testing/toxic/chat.c @@ -26,8 +26,6 @@ typedef struct { WINDOW* linewin; } ChatContext; -static delWindowFn *del_window; - void print_help(ChatContext *self); void execute(ToxWindow *self, ChatContext *ctx, Messenger *m, char *cmd); @@ -370,9 +368,8 @@ void print_help(ChatContext *self) wattroff(self->history, COLOR_PAIR(2)); } -ToxWindow new_chat(Messenger *m, int friendnum, delWindowFn *f) +ToxWindow new_chat(Messenger *m, int friendnum) { - del_window = f; ToxWindow ret; memset(&ret, 0, sizeof(ret)); diff --git a/testing/toxic/chat.h b/testing/toxic/chat.h index dcd5b3ba..7599d462 100644 --- a/testing/toxic/chat.h +++ b/testing/toxic/chat.h @@ -1,7 +1,6 @@ #ifndef CHAT_H_6489PZ13 #define CHAT_H_6489PZ13 -typedef void (delWindowFn)(ToxWindow *w, int f_num); -ToxWindow new_chat(Messenger *m, int friendnum, delWindowFn f); +ToxWindow new_chat(Messenger *m, int friendnum); #endif /* end of include guard: CHAT_H_6489PZ13 */ diff --git a/testing/toxic/friendlist.c b/testing/toxic/friendlist.c index 5b79fdef..e7504fbf 100644 --- a/testing/toxic/friendlist.c +++ b/testing/toxic/friendlist.c @@ -10,11 +10,9 @@ #include "../../core/Messenger.h" #include "../../core/network.h" +#include "windows.h" #include "friendlist.h" -static delWindowFn *del_window; -static setActiveWindowFn *set_active_window; -static addWindowFn *add_window; static char * WINDOW_STATUS; typedef struct { @@ -53,7 +51,7 @@ void friendlist_onMessage(ToxWindow *self, Messenger *m, int num, uint8_t *str, for (i = N_DEFAULT_WINS; i < MAX_WINDOW_SLOTS; ++i) { if (WINDOW_STATUS[i] == -1) { WINDOW_STATUS[i] = num; - add_window(m, new_chat(m, num, del_window), i); + add_window(m, new_chat(m, num), i); break; } } @@ -119,7 +117,7 @@ static void friendlist_onKey(ToxWindow *self, Messenger *m, int key) if (WINDOW_STATUS[i] == -1) { WINDOW_STATUS[i] = num_selected; friends[num_selected].chatwin = num_selected; - add_window(m, new_chat(m, num_selected, del_window), i); + add_window(m, new_chat(m, num_selected), i); break; } } @@ -166,10 +164,7 @@ static void friendlist_onInit(ToxWindow *self, Messenger *m) } -ToxWindow new_friendlist(delWindowFn dw, setActiveWindowFn saw, addWindowFn aw, char * ws) { - del_window = dw; - set_active_window = saw; - add_window = aw; +ToxWindow new_friendlist(char * ws) { WINDOW_STATUS = ws; ToxWindow ret; memset(&ret, 0, sizeof(ret)); diff --git a/testing/toxic/friendlist.h b/testing/toxic/friendlist.h index e8b93aef..c3d8dac7 100644 --- a/testing/toxic/friendlist.h +++ b/testing/toxic/friendlist.h @@ -1,12 +1,10 @@ #ifndef FRIENDLIST_H_53I41IM #define FRIENDLIST_H_53I41IM - #include "windows.h" #include "chat.h" -typedef void (setActiveWindowFn)(int ch); -typedef int (addWindowFn)(Messenger *m, ToxWindow w, int n); -ToxWindow new_friendlist(delWindowFn dw, setActiveWindowFn saw, addWindowFn aw, char * ws); + +ToxWindow new_friendlist(char * ws); int friendlist_onFriendAdded(Messenger *m, int num); void disable_chatwin(int f_num); void fix_name(uint8_t *name); diff --git a/testing/toxic/windows.c b/testing/toxic/windows.c index c3952432..d19392ac 100644 --- a/testing/toxic/windows.c +++ b/testing/toxic/windows.c @@ -165,7 +165,7 @@ ToxWindow * init_windows() int n_prompt = 0; int n_friendslist = 1; if (add_window(m, new_prompt(on_friendadded), n_prompt) == -1 - || add_window(m, new_friendlist(del_window, set_active_window, add_window, WINDOW_STATUS), n_friendslist) == -1) { + || add_window(m, new_friendlist(WINDOW_STATUS), n_friendslist) == -1) { fprintf(stderr, "add_window() failed.\n"); endwin(); exit(1); diff --git a/testing/toxic/windows.h b/testing/toxic/windows.h index 613fa3b3..37f3e9da 100644 --- a/testing/toxic/windows.h +++ b/testing/toxic/windows.h @@ -46,5 +46,8 @@ void on_statuschange(Messenger *m, int friendnumber, uint8_t *string, uint16_t l void init_window_status(); ToxWindow * init_windows(); void draw_active_window(Messenger * m); +int add_window(Messenger *m, ToxWindow w, int n); +void del_window(ToxWindow *w, int f_num); +void set_active_window(int ch); #endif -- cgit v1.2.3