From 52899de0ff2d62ca0542b243c41626010bf62083 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 25 Mar 2005 03:51:56 +0000 Subject: Documentation update git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@899 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/users_8cpp-source.html | 323 +++++++++++++++++---------------- 1 file changed, 167 insertions(+), 156 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 8695c11a4..905a59892 100644 --- a/docs/module-doc/users_8cpp-source.html +++ b/docs/module-doc/users_8cpp-source.html @@ -1,163 +1,174 @@
-00001 /* -00002 Manages userrec objects -00003 */ -00004 -00005 #include "inspircd_config.h" -00006 #include "channels.h" -00007 #include "users.h" -00008 #include "inspircd.h" -00009 #include <stdio.h> -00010 -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 while (myclass) -00118 { -00119 log(DEBUG,"*** HasPermission: checking classtype '%s'",myclass); -00120 for (int k =0; k < ConfValueEnum("class",&config_f); k++) -00121 { -00122 ConfValue("class","name",k,ClassName,&config_f); -00123 if (!strcmp(ClassName,myclass)) -00124 { -00125 ConfValue("class","commands",k,CommandList,&config_f); -00126 log(DEBUG,"*** HasPermission: found class named %s with commands: '%s'",ClassName,CommandList); -00127 -00128 -00129 mycmd = strtok_r(CommandList," ",&savept2); -00130 while (mycmd) -00131 { -00132 if (!strcasecmp(mycmd,command)) -00133 { -00134 log(DEBUG,"*** Command %s found, returning true",command); -00135 return true; -00136 } -00137 mycmd = strtok_r(NULL," ",&savept2); -00138 } -00139 } -00140 } -00141 myclass = strtok_r(NULL," ",&savept); -00142 } -00143 } -00144 } -00145 } -00146 return false; -00147 } -00148 -00149 -
00001 /* +------------------------------------+ +00002 * | Inspire Internet Relay Chat Daemon | +00003 * +------------------------------------+ +00004 * +00005 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. +00006 * E-mail: +00007 * <brain@chatspike.net> +00008 * <Craig@chatspike.net> +00009 * +00010 * Written by Craig Edwards, Craig McLure, and others. +00011 * This program is free but copyrighted software; see +00012 * the file COPYING for details. +00013 * +00014 * --------------------------------------------------- +00015 */ +00016 +00017 #include "inspircd_config.h" +00018 #include "channels.h" +00019 #include "users.h" +00020 #include "inspircd.h" +00021 #include <stdio.h> +00022 +00023 extern std::stringstream config_f; +00024 +00025 userrec::userrec() +00026 { +00027 // the PROPER way to do it, AVOID bzero at *ALL* costs +00028 strcpy(nick,""); +00029 strcpy(ip,"127.0.0.1"); +00030 timeout = 0; +00031 strcpy(ident,""); +00032 strcpy(host,""); +00033 strcpy(dhost,""); +00034 strcpy(fullname,""); +00035 strcpy(modes,""); +00036 strcpy(inbuf,""); +00037 strcpy(server,""); +00038 strcpy(awaymsg,""); +00039 fd = lastping = signon = idle_lastmsg = nping = registered = 0; +00040 flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0; +00041 haspassed = false; +00042 strcpy(result,""); +00043 for (int i = 0; i < MAXCHANS; i++) +00044 { +00045 this->chans[i].channel = NULL; +00046 this->chans[i].uc_modes = 0; +00047 } +00048 invites.clear(); +00049 } +00050 +00051 +00052 +00053 char* userrec::GetFullHost() +00054 { +00055 snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,dhost); +00056 return result; +00057 } +00058 +00059 +00060 char* userrec::GetFullRealHost() +00061 { +00062 snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,host); +00063 return result; +00064 } +00065 +00066 bool userrec::IsInvited(char* channel) +00067 { +00068 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) +00069 { +00070 if (i->channel) { +00071 if (!strcasecmp(i->channel,channel)) +00072 { +00073 return true; +00074 } +00075 } +00076 } +00077 return false; +00078 } +00079 +00080 void userrec::InviteTo(char* channel) +00081 { +00082 Invited i; +00083 strlcpy(i.channel,channel,CHANMAX); +00084 invites.push_back(i); +00085 } +00086 +00087 void userrec::RemoveInvite(char* channel) +00088 { +00089 log(DEBUG,"Removing invites"); +00090 if (channel) +00091 { +00092 if (invites.size()) +00093 { +00094 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) +00095 { +00096 if (i->channel) +00097 { +00098 if (!strcasecmp(i->channel,channel)) +00099 { +00100 invites.erase(i); +00101 return; +00102 } +00103 } +00104 } +00105 } +00106 } +00107 } +00108 +00109 bool userrec::HasPermission(char* command) +00110 { +00111 char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF]; +00112 char* myclass; +00113 char* mycmd; +00114 char* savept; +00115 char* savept2; +00116 +00117 // are they even an oper at all? +00118 if (strchr(this->modes,'o')) +00119 { +00120 log(DEBUG,"*** HasPermission: %s is an oper",this->nick); +00121 for (int j =0; j < ConfValueEnum("type",&config_f); j++) +00122 { +00123 ConfValue("type","name",j,TypeName,&config_f); +00124 if (!strcmp(TypeName,this->oper)) +00125 { +00126 log(DEBUG,"*** HasPermission: %s is an oper of type '%s'",this->nick,this->oper); +00127 ConfValue("type","classes",j,Classes,&config_f); +00128 char* myclass = strtok_r(Classes," ",&savept); +00129 while (myclass) +00130 { +00131 log(DEBUG,"*** HasPermission: checking classtype '%s'",myclass); +00132 for (int k =0; k < ConfValueEnum("class",&config_f); k++) +00133 { +00134 ConfValue("class","name",k,ClassName,&config_f); +00135 if (!strcmp(ClassName,myclass)) +00136 { +00137 ConfValue("class","commands",k,CommandList,&config_f); +00138 log(DEBUG,"*** HasPermission: found class named %s with commands: '%s'",ClassName,CommandList); +00139 +00140 +00141 mycmd = strtok_r(CommandList," ",&savept2); +00142 while (mycmd) +00143 { +00144 if (!strcasecmp(mycmd,command)) +00145 { +00146 log(DEBUG,"*** Command %s found, returning true",command); +00147 return true; +00148 } +00149 mycmd = strtok_r(NULL," ",&savept2); +00150 } +00151 } +00152 } +00153 myclass = strtok_r(NULL," ",&savept); +00154 } +00155 } +00156 } +00157 } +00158 return false; +00159 } +00160 +00161 +
1.3-rc3
+
+1.3.3
--
cgit v1.3.1-10-gc9f91