Anope IRC Services  Version 1.8
Macros | Functions | Variables
users.c File Reference
#include "services.h"
Include dependency graph for users.c:

Go to the source code of this file.

Macros

#define HASH(nick)   (((nick)[0]&31)<<5 | ((nick)[1]&31))
 
#define HASH2(nick)   (((nick)[0]&31)<<5 | ((nick)[1]&31))
 

Functions

static Usernew_user (const char *nick)
 
static void change_user_nick (User *user, const char *nick)
 
void update_host (User *user)
 
void change_user_host (User *user, const char *host)
 
void change_user_realname (User *user, const char *realname)
 
void change_user_username (User *user, const char *username)
 
void delete_user (User *user)
 
void get_user_stats (long *nusers, long *memuse)
 
Userfinduser (const char *nick)
 
Userfirstuser (void)
 
Usernextuser (void)
 
Userfind_byuid (const char *uid)
 
Userfirst_uid (void)
 
Usernext_uid (void)
 
Uidnew_uid (const char *nick, char *uid)
 
Uidfind_uid (const char *nick)
 
Uidfind_nickuid (const char *uid)
 
Userdo_nick (const char *source, char *nick, char *username, char *host, char *server, char *realname, time_t ts, uint32 svid, uint32 ip, char *vhost, char *uid)
 
void do_umode (const char *source, int ac, char **av)
 
void do_umode2 (const char *source, int ac, char **av)
 
void do_quit (const char *source, int ac, char **av)
 
void do_kill (char *nick, char *msg)
 
int is_protected (User *user)
 
int is_oper (User *user)
 
int is_excepted (ChannelInfo *ci, User *user)
 
int is_excepted_mask (ChannelInfo *ci, char *mask)
 
static int _match_usermask (const char *mask, User *user, boolean full)
 
int match_usermask (const char *mask, User *user)
 
int match_usermask_full (const char *mask, User *user, boolean full)
 
int match_userip (const char *mask, User *user, char *iphost)
 
void split_usermask (const char *mask, char **nick, char **user, char **host)
 
char * create_mask (User *u)
 

Variables

Useruserlist [1024]
 
Uiduidlist [1024]
 
int32 usercnt = 0
 
int32 opcnt = 0
 
uint32 maxusercnt = 0
 
time_t maxusertime
 
static Usercurrent
 
static int next_index
 
static Usercurrent_uid
 
static int next_index_uid
 

Macro Definition Documentation

#define HASH (   nick)    (((nick)[0]&31)<<5 | ((nick)[1]&31))

Definition at line 16 of file users.c.

Referenced by change_user_nick(), delete_user(), finduser(), and new_user().

#define HASH2 (   nick)    (((nick)[0]&31)<<5 | ((nick)[1]&31))

Definition at line 19 of file users.c.

Referenced by new_uid().

Function Documentation

static int _match_usermask ( const char *  mask,
User user,
boolean  full 
)
static
void change_user_host ( User user,
const char *  host 
)
static void change_user_nick ( User user,
const char *  nick 
)
static

Definition at line 65 of file users.c.

References findnick(), HASH, user_::na, user_::next, user_::nick, NICKMAX, user_::prev, stricmp(), strscpy(), and nickalias_::u.

Referenced by do_nick().

void change_user_realname ( User user,
const char *  realname 
)
void change_user_username ( User user,
const char *  username 
)
char* create_mask ( User u)

Definition at line 1122 of file users.c.

References common_get_vhost(), common_get_vident(), smalloc(), sstrdup(), strspn(), and USERMAX.

Referenced by do_confirm(), and get_idealban().

void delete_user ( User user)
void do_kill ( char *  nick,
char *  msg 
)
User* do_nick ( const char *  source,
char *  nick,
char *  username,
char *  host,
char *  server,
char *  realname,
time_t  ts,
uint32  svid,
uint32  ip,
char *  vhost,
char *  uid 
)

Adds a new user to anopes internal userlist.

If the SVID passed is 2, the user will not be marked registered or requested to ID. This is an addition to accomodate IRCds where we cannot determine this based on the NICK or UID command. Some IRCd's keep +r on when changing nicks and do not use SVID (ex. InspIRCd 1.2). Instead we get a METADATA command containing the accountname the user was last identified to. Since this is received after the user is introduced to us we should not yet mark the user as identified or ask him to identify. We will mark him as recognized for the time being and let him keep his +r if he has it. It is the responsibility of the protocol module to make sure that this is either invalidated, or changed to identified. ~ Viper

Ugly swap routine for Flop's bug :)

End of ugly swap

DefCon AKILL system, if we want to akill all connecting user's here's where to do it then force check_akill again on them...

Definition at line 500 of file users.c.

References add_akill(), add_session(), alog(), anope_cmd_nc_change(), anope_cmd_svid_umode(), anope_cmd_svid_umode2(), anope_cmd_svid_umode3(), Anope_Free, cancel_user(), change_user_nick(), check_akill(), check_memos(), ircdvars_::check_nick_id, check_sgline(), check_sqline(), check_szline(), checkDefCon(), user_::chost, common_get_vhost(), common_get_vident(), debug, DEFCON_AKILL_NEW_CLIENTS, DefConAKILL, DefConAkillReason, display_news(), dotime(), EVENT_CHANGE_NICK, EVENT_NEWNICK, find_byuid(), findserver(), finduser(), user_::host, user_::hostip, HOSTMAX, ircd, is_oper(), is_sync(), is_ulined(), user_::isSuperAdmin, nickalias_::last_seen, nickalias_::last_usermask, LimitSessions, LogUsers, user_::my_signon, user_::na, server_::name, nickalias_::nc, new_user(), NEWS_LOGON, NEWS_RANDOM, user_::nick, nick_identified(), nick_recognized(), ircdvars_::nickip, ircdvars_::nickvhost, normalizeBuffer(), NS_IDENTIFIED, NS_RECOGNIZED, NS_TRANSGROUP, nsCheckNickTracking(), NSNickTracking, nsStartNickTracking(), ntoa(), user_::realname, s_NickServ, s_OperServ, send_event(), user_::server, servlist, ircdvars_::sgline, smalloc(), snprintf(), ircdvars_::sqline, sstrdup(), nickalias_::status, stricmp(), user_::svid, ircdvars_::szline, user_::timestamp, ircdvars_::ts6, user_::uid, USERMAX, user_::username, UseTS6, validate_user(), ircdvars_::vhost, user_::vhost, and user_::vident.

Referenced by anope_event_client(), anope_event_euid(), anope_event_nick(), anope_event_snick(), and anope_event_uid().

void do_quit ( const char *  source,
int  ac,
char **  av 
)
void do_umode ( const char *  source,
int  ac,
char **  av 
)

Definition at line 816 of file users.c.

References alog(), anope_set_umode(), finduser(), and merge_args().

Referenced by anope_event_mode().

void do_umode2 ( const char *  source,
int  ac,
char **  av 
)

Definition at line 834 of file users.c.

References alog(), anope_set_umode(), finduser(), and merge_args().

Referenced by anope_event_mode(), and anope_event_umode2().

User* find_byuid ( const char *  uid)
Uid* find_nickuid ( const char *  uid)
Uid* find_uid ( const char *  nick)

Definition at line 453 of file users.c.

References uid_::next, uid_::nick, and stricmp().

Referenced by charybdis_cmd_akill(), charybdis_cmd_bot_chan_mode(), charybdis_cmd_chg_nick(), charybdis_cmd_global(), charybdis_cmd_global_legacy(), charybdis_cmd_invite(), charybdis_cmd_join(), charybdis_cmd_kick(), charybdis_cmd_mode(), charybdis_cmd_notice(), charybdis_cmd_notice2(), charybdis_cmd_notice_ops(), charybdis_cmd_part(), charybdis_cmd_privmsg(), charybdis_cmd_privmsg2(), charybdis_cmd_quit(), charybdis_cmd_remove_akill(), charybdis_cmd_sgline(), charybdis_cmd_sqline(), charybdis_cmd_svskill(), charybdis_cmd_topic(), charybdis_cmd_unsgline(), charybdis_cmd_unsqline(), inspircd_cmd_chg_nick(), inspircd_cmd_chghost(), inspircd_cmd_chgident(), inspircd_cmd_ctcp(), inspircd_cmd_global(), inspircd_cmd_global_legacy(), inspircd_cmd_invite(), inspircd_cmd_join(), inspircd_cmd_kick(), inspircd_cmd_mode(), inspircd_cmd_notice(), inspircd_cmd_notice2(), inspircd_cmd_notice_ops(), inspircd_cmd_part(), inspircd_cmd_privmsg(), inspircd_cmd_privmsg2(), inspircd_cmd_quit(), inspircd_cmd_release_svshold(), inspircd_cmd_remove_akill(), inspircd_cmd_serv_notice(), inspircd_cmd_serv_privmsg(), inspircd_cmd_svshold(), inspircd_cmd_svsjoin(), inspircd_cmd_svskill(), inspircd_cmd_svsmode(), inspircd_cmd_svspart(), inspircd_cmd_topic(), my_privmsg(), ratbox_cmd_akill(), ratbox_cmd_bot_chan_mode(), ratbox_cmd_chg_nick(), ratbox_cmd_global(), ratbox_cmd_global_legacy(), ratbox_cmd_invite(), ratbox_cmd_join(), ratbox_cmd_kick(), ratbox_cmd_mode(), ratbox_cmd_notice(), ratbox_cmd_notice2(), ratbox_cmd_part(), ratbox_cmd_privmsg(), ratbox_cmd_privmsg2(), ratbox_cmd_quit(), ratbox_cmd_remove_akill(), ratbox_cmd_sgline(), ratbox_cmd_sqline(), ratbox_cmd_svskill(), ratbox_cmd_topic(), ratbox_cmd_unsgline(), ratbox_cmd_unsqline(), shadowircd_cmd_akill(), shadowircd_cmd_bot_chan_mode(), shadowircd_cmd_chg_nick(), shadowircd_cmd_global(), shadowircd_cmd_global_legacy(), shadowircd_cmd_invite(), shadowircd_cmd_join(), shadowircd_cmd_kick(), shadowircd_cmd_mode(), shadowircd_cmd_notice(), shadowircd_cmd_notice2(), shadowircd_cmd_part(), shadowircd_cmd_privmsg(), shadowircd_cmd_privmsg2(), shadowircd_cmd_quit(), shadowircd_cmd_remove_akill(), shadowircd_cmd_svskill(), and shadowircd_cmd_topic().

User* finduser ( const char *  nick)

Definition at line 323 of file users.c.

References alog(), debug, HASH, user_::next, user_::nick, and stricmp().

Referenced by _common_unban(), add_ignore(), anope_event_chghost(), anope_event_chgident(), anope_event_chgname(), anope_event_encap(), anope_event_newmask(), anope_event_opertype(), anope_event_sethost(), anope_event_setident(), anope_event_setname(), anope_event_vhost(), anope_event_vs(), bot_raw_ban(), bot_raw_kick(), bot_raw_mode(), chan_set_modes(), charybdis_cmd_invite(), charybdis_cmd_kick(), charybdis_cmd_notice(), charybdis_cmd_notice2(), charybdis_cmd_svsnick(), collide(), delete_ignore(), do_ban(), do_chanlist(), do_confirm(), do_cs_kick(), do_fantasy(), do_forbid(), do_ghost(), do_join(), do_kick(), do_kill(), do_logout(), do_nick(), do_operoline(), do_operumodes(), do_part(), do_quit(), do_recover(), do_sjoin(), do_staff(), do_status(), do_suspend(), do_svsnick(), do_tban(), do_umode(), do_umode2(), do_util(), EnforceQlinedNick(), get_ignore(), hybrid_cmd_vhost_on(), inspircd_cmd_211(), inspircd_cmd_219(), inspircd_cmd_242(), inspircd_cmd_243(), inspircd_cmd_250(), inspircd_cmd_307(), inspircd_cmd_311(), inspircd_cmd_312(), inspircd_cmd_317(), inspircd_cmd_318(), inspircd_cmd_351(), inspircd_cmd_372(), inspircd_cmd_372_error(), inspircd_cmd_375(), inspircd_cmd_376(), inspircd_cmd_401(), inspircd_cmd_ctcp(), inspircd_cmd_kick(), inspircd_cmd_notice(), inspircd_cmd_notice2(), inspircd_cmd_privmsg(), inspircd_cmd_privmsg2(), inspircd_cmd_svsjoin(), inspircd_cmd_svskill(), inspircd_cmd_svsnick(), inspircd_cmd_svspart(), inspircd_cmd_swhois(), kill_user(), m_away(), m_motd(), m_privmsg(), m_stats(), m_time(), m_version(), m_whois(), memo_send_from(), my_memo_lang(), my_privmsg(), opers_list(), plexus_cmd_svsnick(), plexus_cmd_vhost_on(), ptlink_cmd_vhost_on(), ratbox_cmd_invite(), ratbox_cmd_kick(), ratbox_cmd_notice(), ratbox_cmd_notice2(), shadowircd_cmd_invite(), shadowircd_cmd_kick(), shadowircd_cmd_notice(), and shadowircd_cmd_notice2().

User* first_uid ( void  )

Definition at line 404 of file users.c.

References alog(), current_uid, debug, next_index_uid, user_::nick, and user_::uid.

Referenced by find_byuid().

User* firstuser ( void  )

Definition at line 352 of file users.c.

References alog(), current, debug, next_index, and user_::nick.

Referenced by add_sgline(), add_sqline(), delete_server(), do_noop(), and services_shutdown().

void get_user_stats ( long *  nusers,
long *  memuse 
)
int is_excepted ( ChannelInfo ci,
User user 
)

Definition at line 950 of file users.c.

References chaninfo_::c, elist_match_user(), ircdvars_::except, channel_::excepts, and ircd.

Referenced by bot_raw_ban(), canBanUser(), check_kick(), and do_ban().

int is_excepted_mask ( ChannelInfo ci,
char *  mask 
)

Definition at line 964 of file users.c.

References chaninfo_::c, elist_match_mask(), ircdvars_::except, channel_::excepts, and ircd.

Referenced by do_akick().

int is_oper ( User user)
int is_protected ( User user)
int match_userip ( const char *  mask,
User user,
char *  iphost 
)

Definition at line 1038 of file users.c.

References match_wild_nocase(), user_::nick, result, sstrdup(), user_::username, and user_::vhost.

int match_usermask ( const char *  mask,
User user 
)

Definition at line 1024 of file users.c.

References _match_usermask().

Referenced by check_kick(), and do_akick().

int match_usermask_full ( const char *  mask,
User user,
boolean  full 
)

Definition at line 1029 of file users.c.

References _match_usermask().

Referenced by get_ignore().

Uid* new_uid ( const char *  nick,
char *  uid 
)
static User* new_user ( const char *  nick)
static
User* next_uid ( void  )

Definition at line 419 of file users.c.

References alog(), current_uid, debug, user_::next, next_index_uid, user_::nick, and user_::uid.

Referenced by find_byuid().

User* nextuser ( void  )

Definition at line 364 of file users.c.

References alog(), current, debug, user_::next, next_index, and user_::nick.

Referenced by add_sgline(), add_sqline(), delete_server(), do_noop(), and services_shutdown().

void split_usermask ( const char *  mask,
char **  nick,
char **  user,
char **  host 
)

Definition at line 1085 of file users.c.

References sstrdup().

Referenced by do_akick().

void update_host ( User user)

Variable Documentation

User* current
static

Definition at line 349 of file users.c.

Referenced by firstuser(), and nextuser().

User* current_uid
static

Definition at line 401 of file users.c.

Referenced by first_uid(), and next_uid().

uint32 maxusercnt = 0

Definition at line 23 of file users.c.

Referenced by new_user().

time_t maxusertime

Definition at line 24 of file users.c.

Referenced by new_user().

int next_index
static

Definition at line 350 of file users.c.

Referenced by firstuser(), and nextuser().

int next_index_uid
static

Definition at line 402 of file users.c.

Referenced by first_uid(), and next_uid().

int32 opcnt = 0

Definition at line 22 of file users.c.

Referenced by delete_user().

Uid* uidlist[1024]

Definition at line 20 of file users.c.

int32 usercnt = 0

Definition at line 22 of file users.c.

Referenced by delete_user(), and new_user().

User* userlist[1024]

Definition at line 17 of file users.c.