From bc0d192a35489b8f5c42aa381ab2b120957ef770 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 7 May 2005 15:35:21 +0000 Subject: Added final documentation for inspircd Beta 4 git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1322 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/users_8cpp-source.html | 302 +++++++++++++++++++-------------- 1 file changed, 178 insertions(+), 124 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 1d43fea60..7d30e3413 100644 --- a/docs/module-doc/users_8cpp-source.html +++ b/docs/module-doc/users_8cpp-source.html @@ -47,130 +47,184 @@ 00040 strcpy(server,""); 00041 strcpy(awaymsg,""); 00042 strcpy(oper,""); -00043 fd = lastping = signon = idle_lastmsg = nping = registered = 0; -00044 flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0; -00045 haspassed = false; -00046 dns_done = false; -00047 strcpy(result,""); -00048 for (int i = 0; i < MAXCHANS; i++) -00049 { -00050 this->chans[i].channel = NULL; -00051 this->chans[i].uc_modes = 0; -00052 } -00053 invites.clear(); -00054 } -00055 -00056 -00057 -00058 char* userrec::GetFullHost() -00059 { -00060 snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,dhost); -00061 return result; -00062 } -00063 -00064 -00065 char* userrec::GetFullRealHost() -00066 { -00067 snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,host); -00068 return result; -00069 } -00070 -00071 bool userrec::IsInvited(char* channel) -00072 { -00073 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) -00074 { -00075 if (i->channel) { -00076 if (!strcasecmp(i->channel,channel)) -00077 { -00078 return true; -00079 } -00080 } -00081 } -00082 return false; -00083 } -00084 -00085 void userrec::InviteTo(char* channel) -00086 { -00087 Invited i; -00088 strlcpy(i.channel,channel,CHANMAX); -00089 invites.push_back(i); -00090 } -00091 -00092 void userrec::RemoveInvite(char* channel) -00093 { -00094 log(DEBUG,"Removing invites"); -00095 if (channel) -00096 { -00097 if (invites.size()) -00098 { -00099 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) -00100 { -00101 if (i->channel) -00102 { -00103 if (!strcasecmp(i->channel,channel)) -00104 { -00105 invites.erase(i); -00106 return; -00107 } -00108 } -00109 } -00110 } -00111 } -00112 } -00113 -00114 bool userrec::HasPermission(char* command) -00115 { -00116 char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF]; -00117 char* mycmd; -00118 char* savept; -00119 char* savept2; -00120 -00121 // are they even an oper at all? -00122 if (strchr(this->modes,'o')) -00123 { -00124 log(DEBUG,"*** HasPermission: %s is an oper",this->nick); -00125 for (int j =0; j < ConfValueEnum("type",&config_f); j++) -00126 { -00127 ConfValue("type","name",j,TypeName,&config_f); -00128 if (!strcmp(TypeName,this->oper)) -00129 { -00130 log(DEBUG,"*** HasPermission: %s is an oper of type '%s'",this->nick,this->oper); -00131 ConfValue("type","classes",j,Classes,&config_f); -00132 char* myclass = strtok_r(Classes," ",&savept); -00133 while (myclass) -00134 { -00135 log(DEBUG,"*** HasPermission: checking classtype '%s'",myclass); -00136 for (int k =0; k < ConfValueEnum("class",&config_f); k++) -00137 { -00138 ConfValue("class","name",k,ClassName,&config_f); -00139 if (!strcmp(ClassName,myclass)) -00140 { -00141 ConfValue("class","commands",k,CommandList,&config_f); -00142 log(DEBUG,"*** HasPermission: found class named %s with commands: '%s'",ClassName,CommandList); -00143 -00144 -00145 mycmd = strtok_r(CommandList," ",&savept2); -00146 while (mycmd) -00147 { -00148 if (!strcasecmp(mycmd,command)) -00149 { -00150 log(DEBUG,"*** Command %s found, returning true",command); -00151 return true; -00152 } -00153 mycmd = strtok_r(NULL," ",&savept2); -00154 } -00155 } -00156 } -00157 myclass = strtok_r(NULL," ",&savept); -00158 } -00159 } -00160 } -00161 } -00162 return false; -00163 } -00164 -00165 -
Generated on Tue Apr 26 17:11:44 2005 for InspIRCd by +00043 reset_due = TIME; +00044 lines_in = 0; +00045 fd = lastping = signon = idle_lastmsg = nping = registered = 0; +00046 flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0; +00047 haspassed = false; +00048 dns_done = false; +00049 recvq = ""; +00050 strcpy(result,""); +00051 for (int i = 0; i < MAXCHANS; i++) +00052 { +00053 this->chans[i].channel = NULL; +00054 this->chans[i].uc_modes = 0; +00055 } +00056 invites.clear(); +00057 } +00058 +00059 +00060 +00061 char* userrec::GetFullHost() +00062 { +00063 snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,dhost); +00064 return result; +00065 } +00066 +00067 +00068 char* userrec::GetFullRealHost() +00069 { +00070 snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,host); +00071 return result; +00072 } +00073 +00074 bool userrec::IsInvited(char* channel) +00075 { +00076 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) +00077 { +00078 if (i->channel) { +00079 if (!strcasecmp(i->channel,channel)) +00080 { +00081 return true; +00082 } +00083 } +00084 } +00085 return false; +00086 } +00087 +00088 void userrec::InviteTo(char* channel) +00089 { +00090 Invited i; +00091 strlcpy(i.channel,channel,CHANMAX); +00092 invites.push_back(i); +00093 } +00094 +00095 void userrec::RemoveInvite(char* channel) +00096 { +00097 log(DEBUG,"Removing invites"); +00098 if (channel) +00099 { +00100 if (invites.size()) +00101 { +00102 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) +00103 { +00104 if (i->channel) +00105 { +00106 if (!strcasecmp(i->channel,channel)) +00107 { +00108 invites.erase(i); +00109 return; +00110 } +00111 } +00112 } +00113 } +00114 } +00115 } +00116 +00117 bool userrec::HasPermission(char* command) +00118 { +00119 char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF]; +00120 char* mycmd; +00121 char* savept; +00122 char* savept2; +00123 +00124 // are they even an oper at all? +00125 if (strchr(this->modes,'o')) +00126 { +00127 log(DEBUG,"*** HasPermission: %s is an oper",this->nick); +00128 for (int j =0; j < ConfValueEnum("type",&config_f); j++) +00129 { +00130 ConfValue("type","name",j,TypeName,&config_f); +00131 if (!strcmp(TypeName,this->oper)) +00132 { +00133 log(DEBUG,"*** HasPermission: %s is an oper of type '%s'",this->nick,this->oper); +00134 ConfValue("type","classes",j,Classes,&config_f); +00135 char* myclass = strtok_r(Classes," ",&savept); +00136 while (myclass) +00137 { +00138 log(DEBUG,"*** HasPermission: checking classtype '%s'",myclass); +00139 for (int k =0; k < ConfValueEnum("class",&config_f); k++) +00140 { +00141 ConfValue("class","name",k,ClassName,&config_f); +00142 if (!strcmp(ClassName,myclass)) +00143 { +00144 ConfValue("class","commands",k,CommandList,&config_f); +00145 log(DEBUG,"*** HasPermission: found class named %s with commands: '%s'",ClassName,CommandList); +00146 +00147 +00148 mycmd = strtok_r(CommandList," ",&savept2); +00149 while (mycmd) +00150 { +00151 if (!strcasecmp(mycmd,command)) +00152 { +00153 log(DEBUG,"*** Command %s found, returning true",command); +00154 return true; +00155 } +00156 mycmd = strtok_r(NULL," ",&savept2); +00157 } +00158 } +00159 } +00160 myclass = strtok_r(NULL," ",&savept); +00161 } +00162 } +00163 } +00164 } +00165 return false; +00166 } +00167 +00168 +00169 bool userrec::AddBuffer(std::string a) +00170 { +00171 std::string b = ""; +00172 for (int i = 0; i < a.length(); i++) +00173 if ((a[i] != '\r') && (a[i] != '\0') && (a[i] != 7)) +00174 b = b + a[i]; +00175 std::stringstream stream(recvq); +00176 stream << b; +00177 recvq = stream.str(); +00178 int i = 0; +00179 // count the size of the first line in the buffer. +00180 while (i < recvq.length()) +00181 { +00182 if (recvq[i++] == '\n') +00183 break; +00184 } +00185 // return false if we've had more than 600 characters WITHOUT +00186 // a carriage return (this is BAD, drop the socket) +00187 return (i < 600); +00188 } +00189 +00190 bool userrec::BufferIsReady() +00191 { +00192 for (int i = 0; i < recvq.length(); i++) +00193 if (recvq[i] == '\n') +00194 return true; +00195 return false; +00196 } +00197 +00198 void userrec::ClearBuffer() +00199 { +00200 recvq = ""; +00201 } +00202 +00203 std::string userrec::GetBuffer() +00204 { +00205 if (recvq == "") +00206 return ""; +00207 char* line = (char*)recvq.c_str(); +00208 std::string ret = ""; +00209 while ((*line != '\n') && (strlen(line))) +00210 { +00211 ret = ret + *line; +00212 line++; +00213 } +00214 if ((*line == '\n') || (*line == '\r')) +00215 line++; +00216 recvq = line; +00217 return ret; +00218 } +00219 +
Generated on Sat May 7 15:34:21 2005 for InspIRCd by doxygen 1.3.3
-- cgit v1.2.3