Minor cleanup - this code crashes.

This commit is contained in:
Jan Vidar Krey 2009-05-19 09:15:14 +02:00
parent 6853e92f89
commit e120d5c76d
1 changed files with 10 additions and 12 deletions

View File

@ -339,41 +339,39 @@ void hub_send_password_challenge(struct hub_info* hub, struct user* u)
static void hub_event_dispatcher(void* callback_data, struct event_data* message) static void hub_event_dispatcher(void* callback_data, struct event_data* message)
{ {
struct hub_info* hub = (struct hub_info*) callback_data; struct hub_info* hub = (struct hub_info*) callback_data;
/* struct user* user = (struct user*) message->ptr;
hub_log(log_trace, "hub_event_dispatcher: %x (ptr=%p)", message->id, message->ptr); assert(hub != NULL);
*/
switch (message->id) switch (message->id)
{ {
case UHUB_EVENT_USER_JOIN: case UHUB_EVENT_USER_JOIN:
{ {
if (user_is_disconnecting((struct user*) message->ptr)) if (user_is_disconnecting(user))
break; break;
if (message->flags) if (message->flags)
{ {
hub_send_password_challenge(hub, (struct user*) message->ptr); hub_send_password_challenge(hub, user);
} }
else else
{ {
on_login_success(hub, (struct user*) message->ptr); on_login_success(hub, user);
} }
break; break;
} }
case UHUB_EVENT_USER_QUIT: case UHUB_EVENT_USER_QUIT:
{ {
uman_remove(hub, (struct user*) message->ptr); uman_remove(hub, user);
uman_send_quit_message(hub, (struct user*) message->ptr); uman_send_quit_message(hub, user);
on_logout_user(hub, (struct user*) message->ptr); on_logout_user(hub, user);
hub_schedule_destroy_user(hub, (struct user*) message->ptr); hub_schedule_destroy_user(hub, user);
break; break;
} }
case UHUB_EVENT_USER_DESTROY: case UHUB_EVENT_USER_DESTROY:
{ {
hub_log(log_trace, "hub_event_dispatcher: UHUB_EVENT_USER_DESTROY (ptr=%p)", message->ptr); user_destroy(user);
user_destroy((struct user*) message->ptr);
break; break;
} }