#include <users.h>
Inheritance diagram for userrec:
Public Member Functions | |
userrec () | |
virtual | ~userrec () |
virtual char * | GetFullHost () |
Returns the full displayed host of the user This member function returns the hostname of the user as seen by other users on the server, in nick!identhost form. | |
virtual char * | GetFullRealHost () |
Returns the full real host of the user This member function returns the hostname of the user as seen by other users on the server, in nick!identhost form. | |
virtual bool | IsInvited (char *channel) |
Returns true if a user is invited to a channel. | |
virtual void | InviteTo (char *channel) |
Adds a channel to a users invite list (invites them to a channel). | |
virtual void | RemoveInvite (char *channel) |
Removes a channel from a users invite list. | |
virtual bool | HasPermission (char *command) |
Returns true or false for if a user can execute a privilaged oper command. | |
Public Attributes | |
char | nick [NICKMAX] |
The users nickname. | |
char | ident [64] |
The users ident reply. | |
char | dhost [256] |
The host displayed to non-opers (used for cloaking etc). | |
char | fullname [128] |
The users full name. | |
char | modes [MAXBUF] |
The user's mode string. | |
ucrec | chans [MAXCHANS] |
char | server [256] |
The server the user is connected to. | |
char | awaymsg [512] |
The user's away message. | |
char | result [256] |
Stores the result of the last GetFullHost or GetRealHost call. | |
int | flood |
Number of lines the user can place into the buffer (up to the global NetBufferSize bytes) before they are disconnected for excess flood. | |
unsigned long | timeout |
Number of seconds this user is given to send USER/NICK If they do not send their details in this time limit they will be disconnected. | |
char | oper [NICKMAX] |
The oper type they logged in as, if they are an oper. | |
Private Attributes | |
InvitedList | invites |
A list of channels the user has a pending invite to. |
Everything about a connection is stored here primarily, from the user's socket ID (file descriptor) through to the user's nickname and hostname. Use the Find method of the server class to locate a specific user by nickname.
Definition at line 78 of file users.h.
|
Definition at line 13 of file users.cpp. References connection::bytes_in, connection::bytes_out, ucrec::channel, chans, connection::cmds_in, connection::cmds_out, connection::fd, flood, connection::haspassed, connection::idle_lastmsg, invites, connection::lastping, connection::nping, connection::port, connection::registered, connection::signon, timeout, and ucrec::uc_modes.
00014 { 00015 // the PROPER way to do it, AVOID bzero at *ALL* costs 00016 strcpy(nick,""); 00017 strcpy(ip,"127.0.0.1"); 00018 timeout = 0; 00019 strcpy(ident,""); 00020 strcpy(host,""); 00021 strcpy(dhost,""); 00022 strcpy(fullname,""); 00023 strcpy(modes,""); 00024 strcpy(inbuf,""); 00025 strcpy(server,""); 00026 strcpy(awaymsg,""); 00027 fd = lastping = signon = idle_lastmsg = nping = registered = 0; 00028 flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0; 00029 haspassed = false; 00030 strcpy(result,""); 00031 for (int i = 0; i < MAXCHANS; i++) 00032 { 00033 this->chans[i].channel = NULL; 00034 this->chans[i].uc_modes = 0; 00035 } 00036 invites.clear(); 00037 } |
|
Definition at line 149 of file users.h.
00149 { } |
|
Returns the full displayed host of the user This member function returns the hostname of the user as seen by other users on the server, in nick!identhost form.
Definition at line 41 of file users.cpp. References result.
00042 { 00043 sprintf(result,"%s!%s@%s",nick,ident,dhost); 00044 return result; 00045 } |
|
Returns the full real host of the user This member function returns the hostname of the user as seen by other users on the server, in nick!identhost form. If any form of hostname cloaking is in operation, e.g. through a module, then this method will ignore it and return the true hostname. Definition at line 48 of file users.cpp. References result.
00049 { 00050 sprintf(result,"%s!%s@%s",nick,ident,host); 00051 return result; 00052 } |
|
Returns true or false for if a user can execute a privilaged oper command. This is done by looking up their oper type from userrec::oper, then referencing this to their oper classes and checking the commands they can execute. Definition at line 97 of file users.cpp.
00098 { 00099 char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF]; 00100 char* myclass; 00101 char* mycmd; 00102 char* savept; 00103 char* savept2; 00104 00105 // are they even an oper at all? 00106 if (strchr(this->modes,'o')) 00107 { 00108 log(DEBUG,"*** HasPermission: %s is an oper",this->nick); 00109 for (int j =0; j < ConfValueEnum("type",&config_f); j++) 00110 { 00111 ConfValue("type","name",j,TypeName,&config_f); 00112 if (!strcmp(TypeName,this->oper)) 00113 { 00114 log(DEBUG,"*** HasPermission: %s is an oper of type '%s'",this->nick,this->oper); 00115 ConfValue("type","classes",j,Classes,&config_f); 00116 char* myclass = strtok_r(Classes," ",&savept); 00117 //myclass = savept; 00118 while (myclass) 00119 { 00120 log(DEBUG,"*** HasPermission: checking classtype '%s'",myclass); 00121 for (int k =0; k < ConfValueEnum("class",&config_f); k++) 00122 { 00123 ConfValue("class","name",k,ClassName,&config_f); 00124 if (!strcmp(ClassName,myclass)) 00125 { 00126 ConfValue("class","commands",k,CommandList,&config_f); 00127 log(DEBUG,"*** HasPermission: found class named %s with commands: '%s'",ClassName,CommandList); 00128 00129 00130 mycmd = strtok_r(CommandList," ",&savept2); 00131 //mycmd = savept2; 00132 while (mycmd) 00133 { 00134 if (!strcasecmp(mycmd,command)) 00135 { 00136 log(DEBUG,"*** Command %s found, returning true",command); 00137 return true; 00138 } 00139 mycmd = strtok_r(NULL," ",&savept2); 00140 //mycmd = savept2; 00141 } 00142 } 00143 } 00144 myclass = strtok_r(NULL," ",&savept); 00145 //myclass = savept; 00146 } 00147 } 00148 } 00149 } 00150 return false; 00151 } |
|
Adds a channel to a users invite list (invites them to a channel).
Definition at line 68 of file users.cpp. References Invited::channel, and invites.
|
|
Returns true if a user is invited to a channel.
Definition at line 54 of file users.cpp. References invites.
|
|
Removes a channel from a users invite list. This member function is called on successfully joining an invite only channel to which the user has previously been invited, to clear the invitation. Definition at line 75 of file users.cpp. References invites.
00076 { 00077 log(DEBUG,"Removing invites"); 00078 if (channel) 00079 { 00080 if (invites.size()) 00081 { 00082 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) 00083 { 00084 if (i->channel) 00085 { 00086 if (!strcasecmp(i->channel,channel)) 00087 { 00088 invites.erase(i); 00089 return; 00090 } 00091 } 00092 } 00093 } 00094 } 00095 } |
|
The user's away message. If this string is empty, the user is not marked as away. |
|
Definition at line 112 of file users.h. Referenced by userrec(). |
|
The host displayed to non-opers (used for cloaking etc). This usually matches the value of userrec::host. |
|
Number of lines the user can place into the buffer (up to the global NetBufferSize bytes) before they are disconnected for excess flood.
Definition at line 132 of file users.h. Referenced by userrec(). |
|
The users full name.
|
|
The users ident reply.
|
|
A list of channels the user has a pending invite to.
Definition at line 84 of file users.h. Referenced by InviteTo(), IsInvited(), RemoveInvite(), and userrec(). |
|
The user's mode string. This may contain any of the following RFC characters: o, w, s, i Your module may define other mode characters as it sees fit. |
|
The users nickname. An invalid nickname indicates an unregistered connection prior to the NICK command. Definition at line 91 of file users.h. Referenced by Server::QuitUser(). |
|
The oper type they logged in as, if they are an oper. This is used to check permissions in operclasses, so that we can say 'yay' or 'nay' to any commands they issue. The value of this is the value of a valid 'type name=' tag. |
|
Stores the result of the last GetFullHost or GetRealHost call. You may use this to increase the speed of use of this class. Definition at line 126 of file users.h. Referenced by GetFullHost(), and GetFullRealHost(). |
|
The server the user is connected to.
|
|
Number of seconds this user is given to send USER/NICK If they do not send their details in this time limit they will be disconnected.
Definition at line 138 of file users.h. Referenced by userrec(). |