From 1899777c6d86544a7775bc96175283957a763326 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 30 Apr 2004 14:47:34 +0000 Subject: Added base.cpp, fixed documentation for userrec::HasPermission git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@757 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/users_8cpp-source.html | 230 +++++++++++++++++++++------------ 1 file changed, 145 insertions(+), 85 deletions(-) (limited to 'docs/module-doc/users_8cpp-source.html') diff --git a/docs/module-doc/users_8cpp-source.html b/docs/module-doc/users_8cpp-source.html index 088c5ffe4..d6aca8a62 100644 --- a/docs/module-doc/users_8cpp-source.html +++ b/docs/module-doc/users_8cpp-source.html @@ -7,7 +7,7 @@
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

users.cpp

Go to the documentation of this file.
00001 /*
-00002 
+00002 Manages userrec objects
 00003 */
 00004 
 00005 #include "inspircd_config.h" 
@@ -16,90 +16,150 @@
 00008 #include "inspircd.h"
 00009 #include <stdio.h>
 00010 
-00011 userrec::userrec()
-00012 {
-00013         // the PROPER way to do it, AVOID bzero at *ALL* costs
-00014         strcpy(nick,"");
-00015         strcpy(ip,"127.0.0.1");
-00016         timeout = 0;
-00017         strcpy(ident,"");
-00018         strcpy(host,"");
-00019         strcpy(dhost,"");
-00020         strcpy(fullname,"");
-00021         strcpy(modes,"");
-00022         strcpy(inbuf,"");
-00023         strcpy(server,"");
-00024         strcpy(awaymsg,"");
-00025         fd = lastping = signon = idle_lastmsg = nping = registered = 0;
-00026         flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
-00027         haspassed = false;
-00028         strcpy(result,"");
-00029         for (int i = 0; i < MAXCHANS; i++)
-00030         {
-00031                 this->chans[i].channel = NULL;
-00032                 this->chans[i].uc_modes = 0;
-00033         }
-00034         invites.clear();
-00035 }
-00036 
-00037 
-00038  
-00039 char* userrec::GetFullHost()
-00040 {
-00041         sprintf(result,"%s!%s@%s",nick,ident,dhost);
-00042         return result;
-00043 }
-00044 
-00045 
-00046 char* userrec::GetFullRealHost()
-00047 {
-00048         sprintf(result,"%s!%s@%s",nick,ident,host);
-00049         return result;
-00050 }
-00051 
-00052 bool userrec::IsInvited(char* channel)
-00053 {
-00054         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
-00055         {
-00056                 if (i->channel) {
-00057                         if (!strcasecmp(i->channel,channel))
-00058                         {
-00059                                 return true;
-00060                         }
-00061                 }
-00062         }
-00063         return false;
-00064 }
-00065 
-00066 void userrec::InviteTo(char* channel)
-00067 {
-00068         Invited i;
-00069         strcpy(i.channel,channel);
-00070         invites.push_back(i);
-00071 }
-00072 
-00073 void userrec::RemoveInvite(char* channel)
-00074 {
-00075         log(DEBUG,"Removing invites");
-00076         if (channel)
-00077         {
-00078                 if (invites.size())
-00079                 {
-00080                         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
-00081                         {
-00082                                 if (i->channel)
-00083                                 {
-00084                                         if (!strcasecmp(i->channel,channel))
-00085                                         {
-00086                                                 invites.erase(i);
-00087                                                 return;
-00088                                         }
-00089                                 }
-00090                         }
-00091                 }
-00092         }
-00093 }
-

Generated on Fri Apr 30 13:23:14 2004 for InspIRCd by +00011 extern std::stringstream config_f; +00012 +00013 userrec::userrec() +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 } +00038 +00039 +00040 +00041 char* userrec::GetFullHost() +00042 { +00043 sprintf(result,"%s!%s@%s",nick,ident,dhost); +00044 return result; +00045 } +00046 +00047 +00048 char* userrec::GetFullRealHost() +00049 { +00050 sprintf(result,"%s!%s@%s",nick,ident,host); +00051 return result; +00052 } +00053 +00054 bool userrec::IsInvited(char* channel) +00055 { +00056 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) +00057 { +00058 if (i->channel) { +00059 if (!strcasecmp(i->channel,channel)) +00060 { +00061 return true; +00062 } +00063 } +00064 } +00065 return false; +00066 } +00067 +00068 void userrec::InviteTo(char* channel) +00069 { +00070 Invited i; +00071 strcpy(i.channel,channel); +00072 invites.push_back(i); +00073 } +00074 +00075 void userrec::RemoveInvite(char* channel) +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 } +00096 +00097 bool userrec::HasPermission(char* command) +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 } +00152 +00153 +
Generated on Fri Apr 30 15:46:22 2004 for InspIRCd by doxygen1.3-rc3
-- cgit v1.2.3