From e76e3245de4cddee3d7921cc67f1bfd30ce9cabd Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Wed, 28 Sep 2011 19:18:26 +0200 Subject: Revert "find_by_id: Fix lookup" This reverts commit c1cf0a71cfd8aa3441e57592e17de0d34823d305. --- src/commands.c | 31 +++++-------------------------- src/commands.h | 3 +-- src/io.c | 2 +- src/util.c | 2 +- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/commands.c b/src/commands.c index 31cc263..b89c5a4 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1,6 +1,5 @@ #include "../config.h" #include "commands.h" -#include "util.h" #include "cmumble.h" #include @@ -10,8 +9,7 @@ #include static void -list_users(struct cmumble_context *ctx, - int argc, const char *argv) +list_users(struct cmumble_context *ctx) { struct cmumble_user *user = NULL; GList *l; @@ -24,8 +22,7 @@ list_users(struct cmumble_context *ctx, } static void -list_channels(struct cmumble_context *ctx, - int argc, const char *argv) +list_channels(struct cmumble_context *ctx) { struct cmumble_channel *channel = NULL; GList *l; @@ -38,16 +35,14 @@ list_channels(struct cmumble_context *ctx, } static void -quit(struct cmumble_context *ctx, - int argc, const char *argv) +quit(struct cmumble_context *ctx) { rl_already_prompted = 1; g_main_loop_quit(ctx->loop); } static void -clear(struct cmumble_context *ctx, - int argc, const char *argv) +clear(struct cmumble_context *ctx) { rl_clear_screen(0,0); rl_reset_line_state(); @@ -55,8 +50,7 @@ clear(struct cmumble_context *ctx, } static void -help(struct cmumble_context *ctx, - int argc, const char *argv) +help(struct cmumble_context *ctx) { int i; @@ -65,27 +59,12 @@ help(struct cmumble_context *ctx, ctx->commands[i].name, ctx->commands[i].description); } -static void -msg(struct cmumble_context *ctx, - int argc, const char *argv) -{ -} - -static void -test(struct cmumble_context *ctx, - int argc, const char *argv) -{ - g_print("find user 1: %p\n", find_user(ctx, 1)); -} - static const struct cmumble_command commands[] = { { "lu", list_users, "list users" }, { "lc", list_channels, "list channels" }, { "clear", clear, "clear screen" }, - { "msg", msg, "Send broadcast message" }, { "help", help, "show this help" }, { "quit", quit, "quit " PACKAGE }, - { "test", test, "test" }, { NULL, NULL , NULL} }; diff --git a/src/commands.h b/src/commands.h index a348f17..6ea8c67 100644 --- a/src/commands.h +++ b/src/commands.h @@ -5,8 +5,7 @@ struct cmumble_context; struct cmumble_command { const char *name; - void (*callback)(struct cmumble_context *, - int argc, const char *argv); + void (*callback)(struct cmumble_context *); const char *description; }; diff --git a/src/io.c b/src/io.c index b3227eb..e3b9bcb 100644 --- a/src/io.c +++ b/src/io.c @@ -105,7 +105,7 @@ process_line(char *line) cmd[strlen(ctx->commands[i].name)] != ' ') continue; - ctx->commands[i].callback(ctx, 0, NULL); + ctx->commands[i].callback(ctx); break; } } diff --git a/src/util.c b/src/util.c index b2549af..a98731b 100644 --- a/src/util.c +++ b/src/util.c @@ -8,7 +8,7 @@ cmumble_find_by_id(GList *list, gsize member_offset, guint id) GList *l; for (l = list; l; l = l->next) { - if (G_STRUCT_MEMBER(uint32_t, l->data, member_offset) == id) { + if (G_STRUCT_MEMBER(uint32_t, l, member_offset) == id) { el = l->data; break; } -- cgit