IRCBot Plugin API  v5
Public Attributes | List of all members
API_user Struct Reference

#include <plugins.h>

Public Attributes

USER *(* GetUser )(const char *hostmask)
 
USER *(* GetUserByNick )(const char *nick)
 
bool(* IsValidUserName )(const char *nick)
 Check to see if a user with the username 'nick' exists. More...
 
uint32(* GetUserCount )()
 Only returns users in your ircbot.db, not auth plugins. More...
 
void(* EnumUsersByLastHostmask )(EnumUsersByLastHostmaskCallback callback, const char *hostmask, void *ptr)
 
uint32(* GetUserFlags )(const char *hostmask)
 Get the user flags for a particular hostmask. If it matches a user it will return their flags, if not it will return the user-defined default flags. More...
 
USER *(* AddUser )(const char *nick, const char *pass, uint32 flags, bool temp)
 
void(* SetUserFlags )(USER *user, uint32 flags)
 Change a user's flags. More...
 
void(* AddUserFlags )(USER *user, uint32 flags)
 Add flags to a user. More...
 
void(* DelUserFlags )(USER *user, uint32 flags)
 Remove flags a user. More...
 
uint32(* GetDefaultFlags )()
 Returns the default flags for a user without a bot account. More...
 
bool(* uflag_have_any_of )(uint32 flags, uint32 wanted)
 
int(* uflag_compare )(uint32 flags1, uint32 flags2)
 
void(* uflag_to_string )(uint32 flags, char *buf, size_t bufSize)
 
uint32(* string_to_uflag )(const char *buf, uint32 cur)
 
bool(* Mask )(const char *hostmask, char *msgbuf, size_t bufSize, int type)
 
uint32(* GetLevelFlags )(int level)
 Returns the default flags for an old IRCBot user level. This is used by the LevelEmul plugin and shouldn't be used by other plugins. More...
 
void(* SetLevelFlags )(int level, uint32 flags)
 Sets the default flags for an old IRCBot user level. This is used by the LevelEmul plugin and shouldn't be used by other plugins. More...
 

Detailed Description

These functions are related to IRCBot user accounts and user flags.

See also
USER
COMMAND_ACL

Member Data Documentation

USER*(* API_user::GetUser)(const char *hostmask)

Get a handle to the user matching a certain hostmask.

Parameters
hostmaskThe hostmask to search for
Returns
A pointer to a USER structure if a user was found, NULL otherwise. Make sure to UnrefUser() the returned pointer if it's not NULL when you are done with it!
USER*(* API_user::GetUserByNick)(const char *nick)

Get a handle to the user with a certain IRCBot username. (Remember: their bot username isn't always the same as their IRC nick, so if at all possible it's better to use API_user::GetUser with a hostmask!)

Parameters
nickThe username to search for
Returns
A pointer to a USER structure if a user was found, NULL otherwise. Make sure to UnrefUser() the returned pointer if it's not NULL when you are done with it!
bool(* API_user::IsValidUserName)(const char *nick)

Check to see if a user with the username 'nick' exists.

uint32(* API_user::GetUserCount)()

Only returns users in your ircbot.db, not auth plugins.

void(* API_user::EnumUsersByLastHostmask)(EnumUsersByLastHostmaskCallback callback, const char *hostmask, void *ptr)
uint32(* API_user::GetUserFlags)(const char *hostmask)

Get the user flags for a particular hostmask. If it matches a user it will return their flags, if not it will return the user-defined default flags.

USER*(* API_user::AddUser)(const char *nick, const char *pass, uint32 flags, bool temp)
void(* API_user::SetUserFlags)(USER *user, uint32 flags)

Change a user's flags.

void(* API_user::AddUserFlags)(USER *user, uint32 flags)

Add flags to a user.

void(* API_user::DelUserFlags)(USER *user, uint32 flags)

Remove flags a user.

uint32(* API_user::GetDefaultFlags)()

Returns the default flags for a user without a bot account.

bool(* API_user::uflag_have_any_of)(uint32 flags, uint32 wanted)

Check if any of some wanted flag are in flags.

Parameters
flagsA user's flags
wantedThe flags you want them to have
Returns
true if they have them, false otherwise.
int(* API_user::uflag_compare)(uint32 flags1, uint32 flags2)

This function gives a general comparison of user rank based on their flags.

Parameters
flags1User 1's flags.
flags2User 2's flags.
Returns
1 if User 1 is a higher rank, 0 if they are equal, -1 if User 1 is a lower rank.
void(* API_user::uflag_to_string)(uint32 flags, char *buf, size_t bufSize)

Given numeric user flags, it will create a string version for display (ie. +abcdefg)

Parameters
flagsA user's flags
bufThe char buffer to output to.
bufSizeThe size of buf
uint32(* API_user::string_to_uflag)(const char *buf, uint32 cur)

Modifies user flags with a flag string and returns numerical user flags.
Strings must start with an operator: +, -, or =. As you would imagine + adds any following flags to the user's flags, - removes them, and = sets the flags obliterating any existing flags.
You can also mix and match operators inline.
Example: +abcdefg (adds abcdefg to user's flags)
Example: -abcdefg (removes abcdefg from user's flags)
Example: =abcdefg (sets user's flags to abcdefg, removing all others)
Example: +abc-def (adds abc to user's flags and removes def)

Parameters
bufThe flag modification string
curThe user's current flags.
Returns
The new user flags
bool(* API_user::Mask)(const char *hostmask, char *msgbuf, size_t bufSize, int type)

Given a full hostmask, alter into a wildcard matching hostmask
Type 0: *!*user@*.host
Type 1: *!*@*.host
Type 2: nick!*user@*.host
Type 3: nick!*@*.host

Parameters
hostmaskA full hostmask in nick!user@host form
msgbufThe buffer to load the altered hostmask in to
bufSizeThe size of your buffer
typeThe type of mask to apply, see list above.
Returns
true if the mask was altered successfully, false otherwise
uint32(* API_user::GetLevelFlags)(int level)

Returns the default flags for an old IRCBot user level. This is used by the LevelEmul plugin and shouldn't be used by other plugins.

void(* API_user::SetLevelFlags)(int level, uint32 flags)

Sets the default flags for an old IRCBot user level. This is used by the LevelEmul plugin and shouldn't be used by other plugins.


The documentation for this struct was generated from the following file: