diff options
Diffstat (limited to 'docs/module-doc/modules_8cpp-source.html')
-rw-r--r-- | docs/module-doc/modules_8cpp-source.html | 503 |
1 files changed, 299 insertions, 204 deletions
diff --git a/docs/module-doc/modules_8cpp-source.html b/docs/module-doc/modules_8cpp-source.html index fd9f62d41..29bf17884 100644 --- a/docs/module-doc/modules_8cpp-source.html +++ b/docs/module-doc/modules_8cpp-source.html @@ -187,8 +187,8 @@ <a name="l00180"></a><a class="code" href="modules_8cpp.html#a43">00180</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a39">chan_hash</a> <a class="code" href="modules_8cpp.html#a43">chanlist</a>; <a name="l00181"></a><a class="code" href="modules_8cpp.html#a44">00181</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a38">user_hash</a> <a class="code" href="modules_8cpp.html#a44">whowas</a>; <a name="l00182"></a><a class="code" href="modules_8cpp.html#a45">00182</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a41">command_table</a> <a class="code" href="modules_8cpp.html#a45">cmdlist</a>; -<a name="l00183"></a><a class="code" href="modules_8cpp.html#a46">00183</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a30">file_cache</a> <a class="code" href="modules_8cpp.html#a46">MOTD</a>; -<a name="l00184"></a><a class="code" href="modules_8cpp.html#a47">00184</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a30">file_cache</a> <a class="code" href="modules_8cpp.html#a47">RULES</a>; +<a name="l00183"></a><a class="code" href="modules_8cpp.html#a46">00183</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a31">file_cache</a> <a class="code" href="modules_8cpp.html#a46">MOTD</a>; +<a name="l00184"></a><a class="code" href="modules_8cpp.html#a47">00184</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a31">file_cache</a> <a class="code" href="modules_8cpp.html#a47">RULES</a>; <a name="l00185"></a><a class="code" href="modules_8cpp.html#a48">00185</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a40">address_cache</a> <a class="code" href="modules_8cpp.html#a48">IP</a>; 00186 00187 @@ -332,12 +332,12 @@ <a name="l00325"></a><a class="code" href="classModule.html#a19">00325</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a19">Module::OnUserPreNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newnick) { <span class="keywordflow">return</span> 0; }; <a name="l00326"></a><a class="code" href="classModule.html#a20">00326</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a20">Module::OnUserPostNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string oldnick) { }; <a name="l00327"></a><a class="code" href="classModule.html#a21">00327</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a21">Module::OnAccessCheck</a>(<a class="code" href="classuserrec.html">userrec</a>* source,<a class="code" href="classuserrec.html">userrec</a>* dest,<a class="code" href="classchanrec.html">chanrec</a>* channel,<span class="keywordtype">int</span> access_type) { <span class="keywordflow">return</span> <a class="code" href="modules_8h.html#a8">ACR_DEFAULT</a>; }; -<a name="l00328"></a><a class="code" href="classModule.html#a22">00328</a> <a class="code" href="modules_8h.html#a31">string_list</a> <a class="code" href="classModule.html#a22">Module::OnUserSync</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <a class="code" href="modules_8h.html#a31">string_list</a> empty; <span class="keywordflow">return</span> empty; } -<a name="l00329"></a><a class="code" href="classModule.html#a23">00329</a> <a class="code" href="modules_8h.html#a31">string_list</a> <a class="code" href="classModule.html#a23">Module::OnChannelSync</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) { <a class="code" href="modules_8h.html#a31">string_list</a> empty; <span class="keywordflow">return</span> empty; } +<a name="l00328"></a><a class="code" href="classModule.html#a22">00328</a> <a class="code" href="modules_8h.html#a32">string_list</a> <a class="code" href="classModule.html#a22">Module::OnUserSync</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <a class="code" href="modules_8h.html#a32">string_list</a> empty; <span class="keywordflow">return</span> empty; } +<a name="l00329"></a><a class="code" href="classModule.html#a23">00329</a> <a class="code" href="modules_8h.html#a32">string_list</a> <a class="code" href="classModule.html#a23">Module::OnChannelSync</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) { <a class="code" href="modules_8h.html#a32">string_list</a> empty; <span class="keywordflow">return</span> empty; } <a name="l00330"></a><a class="code" href="classModule.html#a24">00330</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a24">Module::On005Numeric</a>(std::string &output) { }; <a name="l00331"></a><a class="code" href="classModule.html#a25">00331</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a25">Module::OnKill</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest, std::string reason) { <span class="keywordflow">return</span> 0; }; <a name="l00332"></a><a class="code" href="classModule.html#a26">00332</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a26">Module::OnLoadModule</a>(<a class="code" href="classModule.html">Module</a>* mod,std::string name) { }; -00333 +<a name="l00333"></a><a class="code" href="classModule.html#a27">00333</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a27">Module::OnBackgroundTimer</a>(time_t curtime) { }; 00334 00335 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span> 00336 <span class="comment">// exports in the core</span> @@ -379,9 +379,9 @@ 00372 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>); 00373 } 00374 -<a name="l00375"></a><a class="code" href="classServer.html#a35">00375</a> <a class="code" href="modules_8h.html#a32">chanuserlist</a> <a class="code" href="classServer.html#a35">Server::GetUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) +<a name="l00375"></a><a class="code" href="classServer.html#a35">00375</a> <a class="code" href="modules_8h.html#a33">chanuserlist</a> <a class="code" href="classServer.html#a35">Server::GetUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) 00376 { -00377 <a class="code" href="modules_8h.html#a32">chanuserlist</a> userl; +00377 <a class="code" href="modules_8h.html#a33">chanuserlist</a> userl; 00378 userl.clear(); 00379 <span class="keywordflow">for</span> (user_hash::const_iterator i = <a class="code" href="modules_8cpp.html#a42">clientlist</a>.begin(); i != <a class="code" href="modules_8cpp.html#a42">clientlist</a>.end(); i++) 00380 { @@ -426,12 +426,12 @@ 00419 <a name="l00420"></a><a class="code" href="classServer.html#a23">00420</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a23">Server::AddCommand</a>(<span class="keywordtype">char</span>* cmd, handlerfunc f, <span class="keywordtype">char</span> flags, <span class="keywordtype">int</span> minparams, <span class="keywordtype">char</span>* source) 00421 { -00422 <a class="code" href="modules_8h.html#a34">createcommand</a>(cmd,f,flags,minparams,source); +00422 <a class="code" href="modules_8h.html#a35">createcommand</a>(cmd,f,flags,minparams,source); 00423 } 00424 <a name="l00425"></a><a class="code" href="classServer.html#a24">00425</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a24">Server::SendMode</a>(<span class="keywordtype">char</span> **parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a> *user) 00426 { -00427 <a class="code" href="modules_8h.html#a35">server_mode</a>(parameters,pcnt,user); +00427 <a class="code" href="modules_8h.html#a36">server_mode</a>(parameters,pcnt,user); 00428 } 00429 <a name="l00430"></a><a class="code" href="classServer.html#a4">00430</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a4">Server::Send</a>(<span class="keywordtype">int</span> Socket, std::string s) @@ -583,207 +583,302 @@ 00576 } 00577 00578 -<a name="l00579"></a><a class="code" href="classConfigReader.html#a0">00579</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() +<a name="l00579"></a><a class="code" href="classServer.html#a36">00579</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a36">Server::UserToPseudo</a>(<a class="code" href="classuserrec.html">userrec</a>* user,std::string message) 00580 { -00581 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00582 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00583 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this->cache,this->errorlog); -00584 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) -00585 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_FILE_NOT_FOUND</a>; +00581 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> old_fd = user-><a class="code" href="classconnection.html#o0">fd</a>; +00582 user-><a class="code" href="classconnection.html#o0">fd</a> = <a class="code" href="modules_8h.html#a26">FD_MAGIC_NUMBER</a>; +00583 Write(old_fd,<span class="stringliteral">"ERROR :Closing link (%s@%s) [%s]"</span>,user-><a class="code" href="classuserrec.html#o1">ident</a>,user-><a class="code" href="classconnection.html#o1">host</a>,message.c_str()); +00584 close(old_fd); +00585 shutdown (old_fd,2); 00586 } 00587 -00588 -<a name="l00589"></a><a class="code" href="classConfigReader.html#a2">00589</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() -00590 { -00591 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p0">cache</a>) -00592 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p0">cache</a>; -00593 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p1">errorlog</a>) -00594 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p1">errorlog</a>; -00595 } -00596 -00597 -<a name="l00598"></a><a class="code" href="classConfigReader.html#a1">00598</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) -00599 { -00600 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00601 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00602 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(filename.c_str(),this-><a class="code" href="classConfigReader.html#p0">cache</a>,this-><a class="code" href="classConfigReader.html#p1">errorlog</a>); -00603 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) -00604 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_FILE_NOT_FOUND</a>; -00605 }; -00606 -<a name="l00607"></a><a class="code" href="classConfigReader.html#a3">00607</a> std::string <a class="code" href="classConfigReader.html#a3">ConfigReader::ReadValue</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) -00608 { -00609 <span class="keywordtype">char</span> val[MAXBUF]; -00610 <span class="keywordtype">char</span> t[MAXBUF]; -00611 <span class="keywordtype">char</span> n[MAXBUF]; -00612 strlcpy(t,tag.c_str(),MAXBUF); -00613 strlcpy(n,name.c_str(),MAXBUF); -00614 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00615 <span class="keywordflow">if</span> (!res) -00616 { -00617 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_VALUE_NOT_FOUND</a>; -00618 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; -00619 } -00620 <span class="keywordflow">return</span> std::string(val); +<a name="l00588"></a><a class="code" href="classServer.html#a37">00588</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a37">Server::PseudoToUser</a>(<a class="code" href="classuserrec.html">userrec</a>* alive,<a class="code" href="classuserrec.html">userrec</a>* zombie,std::string message) +00589 { +00590 zombie-><a class="code" href="classconnection.html#o0">fd</a> = alive-><a class="code" href="classconnection.html#o0">fd</a>; +00591 alive-><a class="code" href="classconnection.html#o0">fd</a> = <a class="code" href="modules_8h.html#a26">FD_MAGIC_NUMBER</a>; +00592 Write(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s!%s@%s NICK %s"</span>,alive-><a class="code" href="classuserrec.html#o0">nick</a>,alive-><a class="code" href="classuserrec.html#o1">ident</a>,alive-><a class="code" href="classconnection.html#o1">host</a>,zombie-><a class="code" href="classuserrec.html#o0">nick</a>); +00593 kill_link(alive,message.c_str()); +00594 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i != MAXCHANS; i++) +00595 { +00596 <span class="keywordflow">if</span> (zombie-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a> != NULL) +00597 { +00598 <span class="keywordflow">if</span> (zombie-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a>-><a class="code" href="classchanrec.html#o0">name</a>) +00599 { +00600 <a class="code" href="classchanrec.html">chanrec</a>* Ptr = zombie-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a>; +00601 WriteFrom(zombie-><a class="code" href="classconnection.html#o0">fd</a>,zombie,<span class="stringliteral">"JOIN %s"</span>,Ptr-><a class="code" href="classchanrec.html#o0">name</a>); +00602 <span class="keywordflow">if</span> (Ptr-><a class="code" href="classchanrec.html#o4">topicset</a>) +00603 { +00604 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"332 %s %s :%s"</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>, Ptr-><a class="code" href="classchanrec.html#o2">topic</a>); +00605 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"333 %s %s %s %d"</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>, Ptr-><a class="code" href="classchanrec.html#o5">setby</a>, Ptr-><a class="code" href="classchanrec.html#o4">topicset</a>); +00606 } +00607 userlist(zombie,Ptr); +00608 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"366 %s %s :End of /NAMES list."</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>); +00609 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"324 %s %s +%s"</span>,zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>,chanmodes(Ptr)); +00610 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"329 %s %s %d"</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>, Ptr-><a class="code" href="classchanrec.html#o3">created</a>); +00611 +00612 } +00613 } +00614 } +00615 +00616 } +00617 +<a name="l00618"></a><a class="code" href="classServer.html#a38">00618</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a38">Server::AddGLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string hostmask) +00619 { +00620 <a class="code" href="xline_8h.html#a1">add_gline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), hostmask.c_str()); 00621 } 00622 -<a name="l00623"></a><a class="code" href="classConfigReader.html#a4">00623</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a4">ConfigReader::ReadFlag</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) +<a name="l00623"></a><a class="code" href="classServer.html#a39">00623</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a39">Server::AddQLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string nickname) 00624 { -00625 <span class="keywordtype">char</span> val[MAXBUF]; -00626 <span class="keywordtype">char</span> t[MAXBUF]; -00627 <span class="keywordtype">char</span> n[MAXBUF]; -00628 strlcpy(t,tag.c_str(),MAXBUF); -00629 strlcpy(n,name.c_str(),MAXBUF); -00630 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00631 <span class="keywordflow">if</span> (!res) -00632 { -00633 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_VALUE_NOT_FOUND</a>; -00634 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00635 } -00636 std::string s = val; -00637 <span class="keywordflow">return</span> ((s == <span class="stringliteral">"yes"</span>) || (s == <span class="stringliteral">"YES"</span>) || (s == <span class="stringliteral">"true"</span>) || (s == <span class="stringliteral">"TRUE"</span>) || (s == <span class="stringliteral">"1"</span>)); -00638 } -00639 -<a name="l00640"></a><a class="code" href="classConfigReader.html#a5">00640</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a5">ConfigReader::ReadInteger</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index, <span class="keywordtype">bool</span> needs_unsigned) -00641 { -00642 <span class="keywordtype">char</span> val[MAXBUF]; -00643 <span class="keywordtype">char</span> t[MAXBUF]; -00644 <span class="keywordtype">char</span> n[MAXBUF]; -00645 strlcpy(t,tag.c_str(),MAXBUF); -00646 strlcpy(n,name.c_str(),MAXBUF); -00647 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00648 <span class="keywordflow">if</span> (!res) -00649 { -00650 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_VALUE_NOT_FOUND</a>; -00651 <span class="keywordflow">return</span> 0; -00652 } -00653 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(val); i++) -00654 { -00655 <span class="keywordflow">if</span> (!isdigit(val[i])) -00656 { -00657 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a26">CONF_NOT_A_NUMBER</a>; -00658 <span class="keywordflow">return</span> 0; -00659 } -00660 } -00661 <span class="keywordflow">if</span> ((needs_unsigned) && (atoi(val)<0)) -00662 { -00663 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a27">CONF_NOT_UNSIGNED</a>; -00664 <span class="keywordflow">return</span> 0; -00665 } -00666 <span class="keywordflow">return</span> atoi(val); -00667 } -00668 -<a name="l00669"></a><a class="code" href="classConfigReader.html#a6">00669</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::GetError</a>() -00670 { -00671 <span class="keywordtype">long</span> olderr = this-><a class="code" href="classConfigReader.html#p3">error</a>; -00672 this->error = 0; -00673 <span class="keywordflow">return</span> olderr; -00674 } -00675 -<a name="l00676"></a><a class="code" href="classConfigReader.html#a9">00676</a> <span class="keywordtype">void</span> <a class="code" href="classConfigReader.html#a9">ConfigReader::DumpErrors</a>(<span class="keywordtype">bool</span> bail, <a class="code" href="classuserrec.html">userrec</a>* user) -00677 { -00678 <span class="keywordflow">if</span> (bail) -00679 { -00680 printf(<span class="stringliteral">"There were errors in your configuration:\n%s"</span>,<a class="code" href="classConfigReader.html#p1">errorlog</a>->str().c_str()); -00681 exit(0); -00682 } -00683 <span class="keywordflow">else</span> -00684 { -00685 <span class="keywordtype">char</span> dataline[1024]; -00686 <span class="keywordflow">if</span> (user) -00687 { -00688 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); -00689 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) -00690 { -00691 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); -00692 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :%s"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>,dataline); -00693 } -00694 } -00695 <span class="keywordflow">else</span> -00696 { -00697 WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); -00698 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) -00699 { -00700 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); -00701 WriteOpers(dataline); -00702 } -00703 } -00704 <span class="keywordflow">return</span>; -00705 } -00706 } -00707 -00708 -<a name="l00709"></a><a class="code" href="classConfigReader.html#a7">00709</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a7">ConfigReader::Enumerate</a>(std::string tag) -00710 { -00711 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#p0">cache</a>,tag.c_str()); -00712 } -00713 -<a name="l00714"></a><a class="code" href="classConfigReader.html#a10">00714</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a10">ConfigReader::EnumerateValues</a>(std::string tag, <span class="keywordtype">int</span> index) -00715 { -00716 <span class="keywordflow">return</span> EnumValues(<a class="code" href="classConfigReader.html#p0">cache</a>, tag.c_str(), index); -00717 } -00718 -<a name="l00719"></a><a class="code" href="classConfigReader.html#a8">00719</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a8">ConfigReader::Verify</a>() -00720 { -00721 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#p2">readerror</a>; -00722 } -00723 -00724 -<a name="l00725"></a><a class="code" href="classFileReader.html#a1">00725</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) -00726 { -00727 <a class="code" href="modules_8h.html#a30">file_cache</a> c; -00728 readfile(c,filename.c_str()); -00729 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; -00730 } -00731 -<a name="l00732"></a><a class="code" href="classFileReader.html#a0">00732</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() -00733 { -00734 } -00735 -<a name="l00736"></a><a class="code" href="classFileReader.html#a3">00736</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) -00737 { -00738 <a class="code" href="modules_8h.html#a30">file_cache</a> c; -00739 readfile(c,filename.c_str()); -00740 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; -00741 } -00742 -00743 -<a name="l00744"></a><a class="code" href="classFileReader.html#a2">00744</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() -00745 { -00746 } -00747 -<a name="l00748"></a><a class="code" href="classFileReader.html#a4">00748</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() -00749 { -00750 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#r0">fc</a>.size() == 0) -00751 { -00752 <span class="keywordflow">return</span>(<span class="keyword">false</span>); -00753 } -00754 <span class="keywordflow">else</span> -00755 { -00756 <span class="keywordflow">return</span>(<span class="keyword">true</span>); -00757 } -00758 } -00759 -<a name="l00760"></a><a class="code" href="classFileReader.html#a5">00760</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) -00761 { -00762 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#r0">fc</a>.size())) -00763 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; -00764 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>[x]; -00765 } -00766 -<a name="l00767"></a><a class="code" href="classFileReader.html#a6">00767</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() -00768 { -00769 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>.size(); -00770 } -00771 -00772 -00773 std::vector<Module*> <a class="code" href="modules_8cpp.html#a59">modules</a>(255); -00774 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a60">factory</a>(255); -00775 -<a name="l00776"></a><a class="code" href="modules_8cpp.html#a1">00776</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a> = -1; -00777 -00778 -</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sat Apr 9 14:38:25 2005 for InspIRCd by +00625 <a class="code" href="xline_8h.html#a2">add_qline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), nickname.c_str()); +00626 } +00627 +<a name="l00628"></a><a class="code" href="classServer.html#a40">00628</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a40">Server::AddZLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string ipaddr) +00629 { +00630 <a class="code" href="xline_8h.html#a3">add_zline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), ipaddr.c_str()); +00631 } +00632 +<a name="l00633"></a><a class="code" href="classServer.html#a41">00633</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a41">Server::AddKLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string hostmask) +00634 { +00635 <a class="code" href="xline_8h.html#a4">add_kline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), hostmask.c_str()); +00636 } +00637 +<a name="l00638"></a><a class="code" href="classServer.html#a42">00638</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a42">Server::AddELine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string hostmask) +00639 { +00640 <a class="code" href="xline_8h.html#a5">add_eline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), hostmask.c_str()); +00641 } +00642 +<a name="l00643"></a><a class="code" href="classServer.html#a43">00643</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a43">Server::DelGLine</a>(std::string hostmask) +00644 { +00645 <a class="code" href="xline_8h.html#a6">del_gline</a>(hostmask.c_str()); +00646 } +00647 +<a name="l00648"></a><a class="code" href="classServer.html#a44">00648</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a44">Server::DelQLine</a>(std::string nickname) +00649 { +00650 <a class="code" href="xline_8h.html#a7">del_qline</a>(nickname.c_str()); +00651 } +00652 +<a name="l00653"></a><a class="code" href="classServer.html#a45">00653</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a45">Server::DelZLine</a>(std::string ipaddr) +00654 { +00655 <a class="code" href="xline_8h.html#a8">del_zline</a>(ipaddr.c_str()); +00656 } +00657 +<a name="l00658"></a><a class="code" href="classServer.html#a46">00658</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a46">Server::DelKLine</a>(std::string hostmask) +00659 { +00660 <a class="code" href="xline_8h.html#a9">del_kline</a>(hostmask.c_str()); +00661 } +00662 +<a name="l00663"></a><a class="code" href="classServer.html#a47">00663</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a47">Server::DelELine</a>(std::string hostmask) +00664 { +00665 <a class="code" href="xline_8h.html#a10">del_eline</a>(hostmask.c_str()); +00666 } +00667 +<a name="l00668"></a><a class="code" href="classServer.html#a48">00668</a> <span class="keywordtype">long</span> <a class="code" href="classServer.html#a48">Server::CalcDuration</a>(std::string delta) +00669 { +00670 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a75">duration</a>(delta.c_str()); +00671 } +00672 +00673 +<a name="l00674"></a><a class="code" href="classConfigReader.html#a0">00674</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() +00675 { +00676 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00677 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00678 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this->cache,this->errorlog); +00679 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) +00680 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a30">CONF_FILE_NOT_FOUND</a>; +00681 } +00682 +00683 +<a name="l00684"></a><a class="code" href="classConfigReader.html#a2">00684</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() +00685 { +00686 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p0">cache</a>) +00687 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p0">cache</a>; +00688 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p1">errorlog</a>) +00689 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p1">errorlog</a>; +00690 } +00691 +00692 +<a name="l00693"></a><a class="code" href="classConfigReader.html#a1">00693</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) +00694 { +00695 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00696 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00697 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(filename.c_str(),this-><a class="code" href="classConfigReader.html#p0">cache</a>,this-><a class="code" href="classConfigReader.html#p1">errorlog</a>); +00698 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) +00699 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a30">CONF_FILE_NOT_FOUND</a>; +00700 }; +00701 +<a name="l00702"></a><a class="code" href="classConfigReader.html#a3">00702</a> std::string <a class="code" href="classConfigReader.html#a3">ConfigReader::ReadValue</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) +00703 { +00704 <span class="keywordtype">char</span> val[MAXBUF]; +00705 <span class="keywordtype">char</span> t[MAXBUF]; +00706 <span class="keywordtype">char</span> n[MAXBUF]; +00707 strlcpy(t,tag.c_str(),MAXBUF); +00708 strlcpy(n,name.c_str(),MAXBUF); +00709 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00710 <span class="keywordflow">if</span> (!res) +00711 { +00712 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>; +00713 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +00714 } +00715 <span class="keywordflow">return</span> std::string(val); +00716 } +00717 +<a name="l00718"></a><a class="code" href="classConfigReader.html#a4">00718</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a4">ConfigReader::ReadFlag</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) +00719 { +00720 <span class="keywordtype">char</span> val[MAXBUF]; +00721 <span class="keywordtype">char</span> t[MAXBUF]; +00722 <span class="keywordtype">char</span> n[MAXBUF]; +00723 strlcpy(t,tag.c_str(),MAXBUF); +00724 strlcpy(n,name.c_str(),MAXBUF); +00725 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00726 <span class="keywordflow">if</span> (!res) +00727 { +00728 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>; +00729 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00730 } +00731 std::string s = val; +00732 <span class="keywordflow">return</span> ((s == <span class="stringliteral">"yes"</span>) || (s == <span class="stringliteral">"YES"</span>) || (s == <span class="stringliteral">"true"</span>) || (s == <span class="stringliteral">"TRUE"</span>) || (s == <span class="stringliteral">"1"</span>)); +00733 } +00734 +<a name="l00735"></a><a class="code" href="classConfigReader.html#a5">00735</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a5">ConfigReader::ReadInteger</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index, <span class="keywordtype">bool</span> needs_unsigned) +00736 { +00737 <span class="keywordtype">char</span> val[MAXBUF]; +00738 <span class="keywordtype">char</span> t[MAXBUF]; +00739 <span class="keywordtype">char</span> n[MAXBUF]; +00740 strlcpy(t,tag.c_str(),MAXBUF); +00741 strlcpy(n,name.c_str(),MAXBUF); +00742 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00743 <span class="keywordflow">if</span> (!res) +00744 { +00745 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>; +00746 <span class="keywordflow">return</span> 0; +00747 } +00748 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(val); i++) +00749 { +00750 <span class="keywordflow">if</span> (!isdigit(val[i])) +00751 { +00752 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a27">CONF_NOT_A_NUMBER</a>; +00753 <span class="keywordflow">return</span> 0; +00754 } +00755 } +00756 <span class="keywordflow">if</span> ((needs_unsigned) && (atoi(val)<0)) +00757 { +00758 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_NOT_UNSIGNED</a>; +00759 <span class="keywordflow">return</span> 0; +00760 } +00761 <span class="keywordflow">return</span> atoi(val); +00762 } +00763 +<a name="l00764"></a><a class="code" href="classConfigReader.html#a6">00764</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::GetError</a>() +00765 { +00766 <span class="keywordtype">long</span> olderr = this-><a class="code" href="classConfigReader.html#p3">error</a>; +00767 this->error = 0; +00768 <span class="keywordflow">return</span> olderr; +00769 } +00770 +<a name="l00771"></a><a class="code" href="classConfigReader.html#a9">00771</a> <span class="keywordtype">void</span> <a class="code" href="classConfigReader.html#a9">ConfigReader::DumpErrors</a>(<span class="keywordtype">bool</span> bail, <a class="code" href="classuserrec.html">userrec</a>* user) +00772 { +00773 <span class="keywordflow">if</span> (bail) +00774 { +00775 printf(<span class="stringliteral">"There were errors in your configuration:\n%s"</span>,<a class="code" href="classConfigReader.html#p1">errorlog</a>->str().c_str()); +00776 exit(0); +00777 } +00778 <span class="keywordflow">else</span> +00779 { +00780 <span class="keywordtype">char</span> dataline[1024]; +00781 <span class="keywordflow">if</span> (user) +00782 { +00783 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); +00784 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) +00785 { +00786 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); +00787 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :%s"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>,dataline); +00788 } +00789 } +00790 <span class="keywordflow">else</span> +00791 { +00792 WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); +00793 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) +00794 { +00795 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); +00796 WriteOpers(dataline); +00797 } +00798 } +00799 <span class="keywordflow">return</span>; +00800 } +00801 } +00802 +00803 +<a name="l00804"></a><a class="code" href="classConfigReader.html#a7">00804</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a7">ConfigReader::Enumerate</a>(std::string tag) +00805 { +00806 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#p0">cache</a>,tag.c_str()); +00807 } +00808 +<a name="l00809"></a><a class="code" href="classConfigReader.html#a10">00809</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a10">ConfigReader::EnumerateValues</a>(std::string tag, <span class="keywordtype">int</span> index) +00810 { +00811 <span class="keywordflow">return</span> EnumValues(<a class="code" href="classConfigReader.html#p0">cache</a>, tag.c_str(), index); +00812 } +00813 +<a name="l00814"></a><a class="code" href="classConfigReader.html#a8">00814</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a8">ConfigReader::Verify</a>() +00815 { +00816 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#p2">readerror</a>; +00817 } +00818 +00819 +<a name="l00820"></a><a class="code" href="classFileReader.html#a1">00820</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) +00821 { +00822 <a class="code" href="modules_8h.html#a31">file_cache</a> c; +00823 readfile(c,filename.c_str()); +00824 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; +00825 } +00826 +<a name="l00827"></a><a class="code" href="classFileReader.html#a0">00827</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() +00828 { +00829 } +00830 +<a name="l00831"></a><a class="code" href="classFileReader.html#a3">00831</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) +00832 { +00833 <a class="code" href="modules_8h.html#a31">file_cache</a> c; +00834 readfile(c,filename.c_str()); +00835 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; +00836 } +00837 +00838 +<a name="l00839"></a><a class="code" href="classFileReader.html#a2">00839</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() +00840 { +00841 } +00842 +<a name="l00843"></a><a class="code" href="classFileReader.html#a4">00843</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() +00844 { +00845 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#r0">fc</a>.size() == 0) +00846 { +00847 <span class="keywordflow">return</span>(<span class="keyword">false</span>); +00848 } +00849 <span class="keywordflow">else</span> +00850 { +00851 <span class="keywordflow">return</span>(<span class="keyword">true</span>); +00852 } +00853 } +00854 +<a name="l00855"></a><a class="code" href="classFileReader.html#a5">00855</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) +00856 { +00857 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#r0">fc</a>.size())) +00858 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +00859 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>[x]; +00860 } +00861 +<a name="l00862"></a><a class="code" href="classFileReader.html#a6">00862</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() +00863 { +00864 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>.size(); +00865 } +00866 +00867 +00868 std::vector<Module*> <a class="code" href="modules_8cpp.html#a59">modules</a>(255); +00869 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a60">factory</a>(255); +00870 +<a name="l00871"></a><a class="code" href="modules_8cpp.html#a1">00871</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a> = -1; +00872 +00873 +</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Apr 13 12:32:16 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> |