/* IRCfs - IRC FileServ for *nix. * Copyright (C) 2002 Nick 'Zaf' Clifford * For licensing details, refer to the LICENSE file in the source * code directory. */ #ifndef __include_user_h__ #define __include_user_h__ #include "event.h" #include "magic.h" struct server; struct user; enum user_events { user_event_new, user_event_changed_nick, user_event_quit, user_event_destroy, user_event_msg, user_event_notice }; enum user_status { user_status_dead, user_status_alive, }; #define MAGIC_USER_EVENT_MSG 0x89317285 struct user_event_msg { MAGIC magic; struct user *user; struct server *server; char *txt; }; struct eventobj *user_get_event_obj(); struct user *user_create(struct server *server, const char *name); struct user *user_find(struct server *s, const char *name); enum user_status user_get_status(struct user *u); int user_changed_nick(struct user *u, const char *new_nick); int user_quit(struct user *u); const char *user_get_nick(struct user *u); const char *user_get_name(struct user *u); const char *user_get_username(struct user *u); const char *user_get_hostname(struct user *u); const char *user_get_info(struct user *u); struct server *user_get_server(struct user *u); struct user *user_grab(struct user *u); void user_release(struct user *u); int user_compare_byname(const char *nick, struct user *u); /* int user_compare_exact(name, user) * * Compares if the specified name (in either nick, or nick!user@host format) * matches the specifed user. * * If the name is in nick format, or the user doesn't have the user and host * fields, function will return 1 for a match, -1 for failure. * * If the name is in the nick!user@host format, function will return 0 for * a match, and -1 for failure * */ int user_compare_exact(const char *name, struct user *u); int user_update_info(struct user *u, const char *name); void user_dump_list(struct server *s); void user_dump_user(struct user *u); #endif