diff options
Diffstat (limited to 'docs/module-doc/users_8cpp-source.html')
-rw-r--r-- | docs/module-doc/users_8cpp-source.html | 302 |
1 files changed, 178 insertions, 124 deletions
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(<a class="code" href="classuserrec.html#o6">server</a>,<span class="stringliteral">""</span>); 00041 strcpy(<a class="code" href="classuserrec.html#o7">awaymsg</a>,<span class="stringliteral">""</span>); 00042 strcpy(<a class="code" href="classuserrec.html#o11">oper</a>,<span class="stringliteral">""</span>); -00043 <a class="code" href="classconnection.html#o0">fd</a> = <a class="code" href="classconnection.html#o12">lastping</a> = <a class="code" href="classconnection.html#o13">signon</a> = <a class="code" href="classconnection.html#o14">idle_lastmsg</a> = <a class="code" href="classconnection.html#o15">nping</a> = <a class="code" href="classconnection.html#o10">registered</a> = 0; -00044 <a class="code" href="classuserrec.html#o9">flood</a> = <a class="code" href="classconnection.html#o9">port</a> = <a class="code" href="classconnection.html#o4">bytes_in</a> = <a class="code" href="classconnection.html#o5">bytes_out</a> = <a class="code" href="classconnection.html#o6">cmds_in</a> = <a class="code" href="classconnection.html#o7">cmds_out</a> = 0; -00045 <a class="code" href="classconnection.html#o8">haspassed</a> = <span class="keyword">false</span>; -00046 <a class="code" href="classuserrec.html#o12">dns_done</a> = <span class="keyword">false</span>; -00047 strcpy(<a class="code" href="classuserrec.html#o8">result</a>,<span class="stringliteral">""</span>); -00048 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < MAXCHANS; i++) -00049 { -00050 this-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a> = NULL; -00051 this-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o0">uc_modes</a> = 0; -00052 } -00053 <a class="code" href="classuserrec.html#r0">invites</a>.clear(); -00054 } -00055 -00056 -00057 -<a name="l00058"></a><a class="code" href="classuserrec.html#a2">00058</a> <span class="keywordtype">char</span>* <a class="code" href="classuserrec.html#a2">userrec::GetFullHost</a>() -00059 { -00060 snprintf(<a class="code" href="classuserrec.html#o8">result</a>,MAXBUF,<span class="stringliteral">"%s!%s@%s"</span>,<a class="code" href="classuserrec.html#o0">nick</a>,<a class="code" href="classuserrec.html#o1">ident</a>,<a class="code" href="classuserrec.html#o2">dhost</a>); -00061 <span class="keywordflow">return</span> <a class="code" href="classuserrec.html#o8">result</a>; -00062 } -00063 -00064 -<a name="l00065"></a><a class="code" href="classuserrec.html#a3">00065</a> <span class="keywordtype">char</span>* <a class="code" href="classuserrec.html#a3">userrec::GetFullRealHost</a>() -00066 { -00067 snprintf(<a class="code" href="classuserrec.html#o8">result</a>,MAXBUF,<span class="stringliteral">"%s!%s@%s"</span>,<a class="code" href="classuserrec.html#o0">nick</a>,<a class="code" href="classuserrec.html#o1">ident</a>,<a class="code" href="classconnection.html#o1">host</a>); -00068 <span class="keywordflow">return</span> <a class="code" href="classuserrec.html#o8">result</a>; -00069 } -00070 -<a name="l00071"></a><a class="code" href="classuserrec.html#a4">00071</a> <span class="keywordtype">bool</span> <a class="code" href="classuserrec.html#a4">userrec::IsInvited</a>(<span class="keywordtype">char</span>* channel) -00072 { -00073 <span class="keywordflow">for</span> (InvitedList::iterator i = <a class="code" href="classuserrec.html#r0">invites</a>.begin(); i != <a class="code" href="classuserrec.html#r0">invites</a>.end(); i++) -00074 { -00075 <span class="keywordflow">if</span> (i->channel) { -00076 <span class="keywordflow">if</span> (!strcasecmp(i->channel,channel)) -00077 { -00078 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00079 } -00080 } -00081 } -00082 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00083 } -00084 -<a name="l00085"></a><a class="code" href="classuserrec.html#a5">00085</a> <span class="keywordtype">void</span> <a class="code" href="classuserrec.html#a5">userrec::InviteTo</a>(<span class="keywordtype">char</span>* channel) -00086 { -00087 <a class="code" href="classInvited.html">Invited</a> i; -00088 strlcpy(i.<a class="code" href="classInvited.html#o0">channel</a>,channel,CHANMAX); -00089 <a class="code" href="classuserrec.html#r0">invites</a>.push_back(i); -00090 } -00091 -<a name="l00092"></a><a class="code" href="classuserrec.html#a6">00092</a> <span class="keywordtype">void</span> <a class="code" href="classuserrec.html#a6">userrec::RemoveInvite</a>(<span class="keywordtype">char</span>* channel) -00093 { -00094 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Removing invites"</span>); -00095 <span class="keywordflow">if</span> (channel) -00096 { -00097 <span class="keywordflow">if</span> (<a class="code" href="classuserrec.html#r0">invites</a>.size()) -00098 { -00099 <span class="keywordflow">for</span> (InvitedList::iterator i = <a class="code" href="classuserrec.html#r0">invites</a>.begin(); i != <a class="code" href="classuserrec.html#r0">invites</a>.end(); i++) -00100 { -00101 <span class="keywordflow">if</span> (i->channel) -00102 { -00103 <span class="keywordflow">if</span> (!strcasecmp(i->channel,channel)) -00104 { -00105 <a class="code" href="classuserrec.html#r0">invites</a>.erase(i); -00106 <span class="keywordflow">return</span>; -00107 } -00108 } -00109 } -00110 } -00111 } -00112 } -00113 -<a name="l00114"></a><a class="code" href="classuserrec.html#a7">00114</a> <span class="keywordtype">bool</span> <a class="code" href="classuserrec.html#a7">userrec::HasPermission</a>(<span class="keywordtype">char</span>* command) -00115 { -00116 <span class="keywordtype">char</span> TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF]; -00117 <span class="keywordtype">char</span>* mycmd; -00118 <span class="keywordtype">char</span>* savept; -00119 <span class="keywordtype">char</span>* savept2; -00120 -00121 <span class="comment">// are they even an oper at all?</span> -00122 <span class="keywordflow">if</span> (strchr(this->modes,<span class="charliteral">'o'</span>)) -00123 { -00124 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** HasPermission: %s is an oper"</span>,this->nick); -00125 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j =0; j < ConfValueEnum(<span class="stringliteral">"type"</span>,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); j++) -00126 { -00127 ConfValue(<span class="stringliteral">"type"</span>,<span class="stringliteral">"name"</span>,j,TypeName,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); -00128 <span class="keywordflow">if</span> (!strcmp(TypeName,this->oper)) -00129 { -00130 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** HasPermission: %s is an oper of type '%s'"</span>,this->nick,this->oper); -00131 ConfValue(<span class="stringliteral">"type"</span>,<span class="stringliteral">"classes"</span>,j,Classes,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); -00132 <span class="keywordtype">char</span>* myclass = strtok_r(Classes,<span class="stringliteral">" "</span>,&savept); -00133 <span class="keywordflow">while</span> (myclass) -00134 { -00135 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** HasPermission: checking classtype '%s'"</span>,myclass); -00136 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k =0; k < ConfValueEnum(<span class="stringliteral">"class"</span>,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); k++) -00137 { -00138 ConfValue(<span class="stringliteral">"class"</span>,<span class="stringliteral">"name"</span>,k,ClassName,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); -00139 <span class="keywordflow">if</span> (!strcmp(ClassName,myclass)) -00140 { -00141 ConfValue(<span class="stringliteral">"class"</span>,<span class="stringliteral">"commands"</span>,k,CommandList,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); -00142 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** HasPermission: found class named %s with commands: '%s'"</span>,ClassName,CommandList); -00143 -00144 -00145 mycmd = strtok_r(CommandList,<span class="stringliteral">" "</span>,&savept2); -00146 <span class="keywordflow">while</span> (mycmd) -00147 { -00148 <span class="keywordflow">if</span> (!strcasecmp(mycmd,command)) -00149 { -00150 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** Command %s found, returning true"</span>,command); -00151 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00152 } -00153 mycmd = strtok_r(NULL,<span class="stringliteral">" "</span>,&savept2); -00154 } -00155 } -00156 } -00157 myclass = strtok_r(NULL,<span class="stringliteral">" "</span>,&savept); -00158 } -00159 } -00160 } -00161 } -00162 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00163 } -00164 -00165 -</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Apr 26 17:11:44 2005 for InspIRCd by +00043 <a class="code" href="classuserrec.html#o17">reset_due</a> = <a class="code" href="channels_8cpp.html#a37">TIME</a>; +00044 <a class="code" href="classuserrec.html#o16">lines_in</a> = 0; +00045 <a class="code" href="classconnection.html#o0">fd</a> = <a class="code" href="classconnection.html#o12">lastping</a> = <a class="code" href="classconnection.html#o13">signon</a> = <a class="code" href="classconnection.html#o14">idle_lastmsg</a> = <a class="code" href="classconnection.html#o15">nping</a> = <a class="code" href="classconnection.html#o10">registered</a> = 0; +00046 <a class="code" href="classuserrec.html#o9">flood</a> = <a class="code" href="classconnection.html#o9">port</a> = <a class="code" href="classconnection.html#o4">bytes_in</a> = <a class="code" href="classconnection.html#o5">bytes_out</a> = <a class="code" href="classconnection.html#o6">cmds_in</a> = <a class="code" href="classconnection.html#o7">cmds_out</a> = 0; +00047 <a class="code" href="classconnection.html#o8">haspassed</a> = <span class="keyword">false</span>; +00048 <a class="code" href="classuserrec.html#o12">dns_done</a> = <span class="keyword">false</span>; +00049 <a class="code" href="classuserrec.html#o15">recvq</a> = <span class="stringliteral">""</span>; +00050 strcpy(<a class="code" href="classuserrec.html#o8">result</a>,<span class="stringliteral">""</span>); +00051 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < MAXCHANS; i++) +00052 { +00053 this-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a> = NULL; +00054 this-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o0">uc_modes</a> = 0; +00055 } +00056 <a class="code" href="classuserrec.html#r0">invites</a>.clear(); +00057 } +00058 +00059 +00060 +<a name="l00061"></a><a class="code" href="classuserrec.html#a2">00061</a> <span class="keywordtype">char</span>* <a class="code" href="classuserrec.html#a2">userrec::GetFullHost</a>() +00062 { +00063 snprintf(<a class="code" href="classuserrec.html#o8">result</a>,MAXBUF,<span class="stringliteral">"%s!%s@%s"</span>,<a class="code" href="classuserrec.html#o0">nick</a>,<a class="code" href="classuserrec.html#o1">ident</a>,<a class="code" href="classuserrec.html#o2">dhost</a>); +00064 <span class="keywordflow">return</span> <a class="code" href="classuserrec.html#o8">result</a>; +00065 } +00066 +00067 +<a name="l00068"></a><a class="code" href="classuserrec.html#a3">00068</a> <span class="keywordtype">char</span>* <a class="code" href="classuserrec.html#a3">userrec::GetFullRealHost</a>() +00069 { +00070 snprintf(<a class="code" href="classuserrec.html#o8">result</a>,MAXBUF,<span class="stringliteral">"%s!%s@%s"</span>,<a class="code" href="classuserrec.html#o0">nick</a>,<a class="code" href="classuserrec.html#o1">ident</a>,<a class="code" href="classconnection.html#o1">host</a>); +00071 <span class="keywordflow">return</span> <a class="code" href="classuserrec.html#o8">result</a>; +00072 } +00073 +<a name="l00074"></a><a class="code" href="classuserrec.html#a4">00074</a> <span class="keywordtype">bool</span> <a class="code" href="classuserrec.html#a4">userrec::IsInvited</a>(<span class="keywordtype">char</span>* channel) +00075 { +00076 <span class="keywordflow">for</span> (InvitedList::iterator i = <a class="code" href="classuserrec.html#r0">invites</a>.begin(); i != <a class="code" href="classuserrec.html#r0">invites</a>.end(); i++) +00077 { +00078 <span class="keywordflow">if</span> (i->channel) { +00079 <span class="keywordflow">if</span> (!strcasecmp(i->channel,channel)) +00080 { +00081 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00082 } +00083 } +00084 } +00085 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00086 } +00087 +<a name="l00088"></a><a class="code" href="classuserrec.html#a5">00088</a> <span class="keywordtype">void</span> <a class="code" href="classuserrec.html#a5">userrec::InviteTo</a>(<span class="keywordtype">char</span>* channel) +00089 { +00090 <a class="code" href="classInvited.html">Invited</a> i; +00091 strlcpy(i.<a class="code" href="classInvited.html#o0">channel</a>,channel,CHANMAX); +00092 <a class="code" href="classuserrec.html#r0">invites</a>.push_back(i); +00093 } +00094 +<a name="l00095"></a><a class="code" href="classuserrec.html#a6">00095</a> <span class="keywordtype">void</span> <a class="code" href="classuserrec.html#a6">userrec::RemoveInvite</a>(<span class="keywordtype">char</span>* channel) +00096 { +00097 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Removing invites"</span>); +00098 <span class="keywordflow">if</span> (channel) +00099 { +00100 <span class="keywordflow">if</span> (<a class="code" href="classuserrec.html#r0">invites</a>.size()) +00101 { +00102 <span class="keywordflow">for</span> (InvitedList::iterator i = <a class="code" href="classuserrec.html#r0">invites</a>.begin(); i != <a class="code" href="classuserrec.html#r0">invites</a>.end(); i++) +00103 { +00104 <span class="keywordflow">if</span> (i->channel) +00105 { +00106 <span class="keywordflow">if</span> (!strcasecmp(i->channel,channel)) +00107 { +00108 <a class="code" href="classuserrec.html#r0">invites</a>.erase(i); +00109 <span class="keywordflow">return</span>; +00110 } +00111 } +00112 } +00113 } +00114 } +00115 } +00116 +<a name="l00117"></a><a class="code" href="classuserrec.html#a7">00117</a> <span class="keywordtype">bool</span> <a class="code" href="classuserrec.html#a7">userrec::HasPermission</a>(<span class="keywordtype">char</span>* command) +00118 { +00119 <span class="keywordtype">char</span> TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF]; +00120 <span class="keywordtype">char</span>* mycmd; +00121 <span class="keywordtype">char</span>* savept; +00122 <span class="keywordtype">char</span>* savept2; +00123 +00124 <span class="comment">// are they even an oper at all?</span> +00125 <span class="keywordflow">if</span> (strchr(this->modes,<span class="charliteral">'o'</span>)) +00126 { +00127 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** HasPermission: %s is an oper"</span>,this->nick); +00128 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j =0; j < ConfValueEnum(<span class="stringliteral">"type"</span>,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); j++) +00129 { +00130 ConfValue(<span class="stringliteral">"type"</span>,<span class="stringliteral">"name"</span>,j,TypeName,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); +00131 <span class="keywordflow">if</span> (!strcmp(TypeName,this->oper)) +00132 { +00133 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** HasPermission: %s is an oper of type '%s'"</span>,this->nick,this->oper); +00134 ConfValue(<span class="stringliteral">"type"</span>,<span class="stringliteral">"classes"</span>,j,Classes,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); +00135 <span class="keywordtype">char</span>* myclass = strtok_r(Classes,<span class="stringliteral">" "</span>,&savept); +00136 <span class="keywordflow">while</span> (myclass) +00137 { +00138 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** HasPermission: checking classtype '%s'"</span>,myclass); +00139 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k =0; k < ConfValueEnum(<span class="stringliteral">"class"</span>,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); k++) +00140 { +00141 ConfValue(<span class="stringliteral">"class"</span>,<span class="stringliteral">"name"</span>,k,ClassName,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); +00142 <span class="keywordflow">if</span> (!strcmp(ClassName,myclass)) +00143 { +00144 ConfValue(<span class="stringliteral">"class"</span>,<span class="stringliteral">"commands"</span>,k,CommandList,&<a class="code" href="channels_8cpp.html#a34">config_f</a>); +00145 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** HasPermission: found class named %s with commands: '%s'"</span>,ClassName,CommandList); +00146 +00147 +00148 mycmd = strtok_r(CommandList,<span class="stringliteral">" "</span>,&savept2); +00149 <span class="keywordflow">while</span> (mycmd) +00150 { +00151 <span class="keywordflow">if</span> (!strcasecmp(mycmd,command)) +00152 { +00153 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** Command %s found, returning true"</span>,command); +00154 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00155 } +00156 mycmd = strtok_r(NULL,<span class="stringliteral">" "</span>,&savept2); +00157 } +00158 } +00159 } +00160 myclass = strtok_r(NULL,<span class="stringliteral">" "</span>,&savept); +00161 } +00162 } +00163 } +00164 } +00165 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00166 } +00167 +00168 +<a name="l00169"></a><a class="code" href="classuserrec.html#a8">00169</a> <span class="keywordtype">bool</span> <a class="code" href="classuserrec.html#a8">userrec::AddBuffer</a>(std::string a) +00170 { +00171 std::string b = <span class="stringliteral">""</span>; +00172 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < a.length(); i++) +00173 <span class="keywordflow">if</span> ((a[i] != <span class="charliteral">'\r'</span>) && (a[i] != <span class="charliteral">'\0'</span>) && (a[i] != 7)) +00174 b = b + a[i]; +00175 std::stringstream stream(<a class="code" href="classuserrec.html#o15">recvq</a>); +00176 stream << b; +00177 <a class="code" href="classuserrec.html#o15">recvq</a> = stream.str(); +00178 <span class="keywordtype">int</span> i = 0; +00179 <span class="comment">// count the size of the first line in the buffer.</span> +00180 <span class="keywordflow">while</span> (i < <a class="code" href="classuserrec.html#o15">recvq</a>.length()) +00181 { +00182 <span class="keywordflow">if</span> (<a class="code" href="classuserrec.html#o15">recvq</a>[i++] == <span class="charliteral">'\n'</span>) +00183 <span class="keywordflow">break</span>; +00184 } +00185 <span class="comment">// return false if we've had more than 600 characters WITHOUT</span> +00186 <span class="comment">// a carriage return (this is BAD, drop the socket)</span> +00187 <span class="keywordflow">return</span> (i < 600); +00188 } +00189 +<a name="l00190"></a><a class="code" href="classuserrec.html#a9">00190</a> <span class="keywordtype">bool</span> <a class="code" href="classuserrec.html#a9">userrec::BufferIsReady</a>() +00191 { +00192 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="classuserrec.html#o15">recvq</a>.length(); i++) +00193 <span class="keywordflow">if</span> (<a class="code" href="classuserrec.html#o15">recvq</a>[i] == <span class="charliteral">'\n'</span>) +00194 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00195 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00196 } +00197 +<a name="l00198"></a><a class="code" href="classuserrec.html#a10">00198</a> <span class="keywordtype">void</span> <a class="code" href="classuserrec.html#a10">userrec::ClearBuffer</a>() +00199 { +00200 <a class="code" href="classuserrec.html#o15">recvq</a> = <span class="stringliteral">""</span>; +00201 } +00202 +<a name="l00203"></a><a class="code" href="classuserrec.html#a11">00203</a> std::string <a class="code" href="classuserrec.html#a11">userrec::GetBuffer</a>() +00204 { +00205 <span class="keywordflow">if</span> (<a class="code" href="classuserrec.html#o15">recvq</a> == <span class="stringliteral">""</span>) +00206 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +00207 <span class="keywordtype">char</span>* line = (<span class="keywordtype">char</span>*)<a class="code" href="classuserrec.html#o15">recvq</a>.c_str(); +00208 std::string ret = <span class="stringliteral">""</span>; +00209 <span class="keywordflow">while</span> ((*line != <span class="charliteral">'\n'</span>) && (strlen(line))) +00210 { +00211 ret = ret + *line; +00212 line++; +00213 } +00214 <span class="keywordflow">if</span> ((*line == <span class="charliteral">'\n'</span>) || (*line == <span class="charliteral">'\r'</span>)) +00215 line++; +00216 <a class="code" href="classuserrec.html#o15">recvq</a> = line; +00217 <span class="keywordflow">return</span> ret; +00218 } +00219 +</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sat May 7 15:34:21 2005 for InspIRCd by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.3 </small></address> |