diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-04 18:13:55 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-04 18:13:55 +0000 |
commit | 9c8b44176b47d2186c88743dc1f68023c26d780b (patch) | |
tree | b5ea400fcc976129e466dc212a0f326960618dbd /docs/module-doc/modules_8cpp-source.html | |
parent | d68dcc665827575df74156f08b22451f98aaaef6 (diff) |
Added new documentation for ELine class and OnUserPostNick method
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@977 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'docs/module-doc/modules_8cpp-source.html')
-rw-r--r-- | docs/module-doc/modules_8cpp-source.html | 885 |
1 files changed, 443 insertions, 442 deletions
diff --git a/docs/module-doc/modules_8cpp-source.html b/docs/module-doc/modules_8cpp-source.html index a2703b95e..8b4297c73 100644 --- a/docs/module-doc/modules_8cpp-source.html +++ b/docs/module-doc/modules_8cpp-source.html @@ -328,459 +328,460 @@ <a name="l00321"></a><a class="code" href="classModule.html#a17">00321</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a17">Module::OnUserPreMessage</a>(<a class="code" href="classuserrec.html">userrec</a>* user,<span class="keywordtype">void</span>* dest,<span class="keywordtype">int</span> target_type, std::string &text) { <span class="keywordflow">return</span> 0; }; <a name="l00322"></a><a class="code" href="classModule.html#a18">00322</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a18">Module::OnUserPreNotice</a>(<a class="code" href="classuserrec.html">userrec</a>* user,<span class="keywordtype">void</span>* dest,<span class="keywordtype">int</span> target_type, std::string &text) { <span class="keywordflow">return</span> 0; }; <a name="l00323"></a><a class="code" href="classModule.html#a19">00323</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="l00324"></a><a class="code" href="classModule.html#a20">00324</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a20">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="l00325"></a><a class="code" href="classModule.html#a21">00325</a> <a class="code" href="modules_8h.html#a27">string_list</a> <a class="code" href="classModule.html#a21">Module::OnUserSync</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <a class="code" href="modules_8h.html#a27">string_list</a> empty; <span class="keywordflow">return</span> empty; } -<a name="l00326"></a><a class="code" href="classModule.html#a22">00326</a> <a class="code" href="modules_8h.html#a27">string_list</a> <a class="code" href="classModule.html#a22">Module::OnChannelSync</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) { <a class="code" href="modules_8h.html#a27">string_list</a> empty; <span class="keywordflow">return</span> empty; } -<a name="l00327"></a><a class="code" href="classModule.html#a23">00327</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a23">Module::On005Numeric</a>(std::string &output) { }; -<a name="l00328"></a><a class="code" href="classModule.html#a24">00328</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a24">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="l00329"></a><a class="code" href="classModule.html#a25">00329</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a25">Module::OnLoadModule</a>(<a class="code" href="classModule.html">Module</a>* mod,std::string name) { }; -00330 +<a name="l00324"></a><a class="code" href="classModule.html#a20">00324</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="l00325"></a><a class="code" href="classModule.html#a21">00325</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="l00326"></a><a class="code" href="classModule.html#a22">00326</a> <a class="code" href="modules_8h.html#a27">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#a27">string_list</a> empty; <span class="keywordflow">return</span> empty; } +<a name="l00327"></a><a class="code" href="classModule.html#a23">00327</a> <a class="code" href="modules_8h.html#a27">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#a27">string_list</a> empty; <span class="keywordflow">return</span> empty; } +<a name="l00328"></a><a class="code" href="classModule.html#a24">00328</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a24">Module::On005Numeric</a>(std::string &output) { }; +<a name="l00329"></a><a class="code" href="classModule.html#a25">00329</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="l00330"></a><a class="code" href="classModule.html#a26">00330</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) { }; 00331 -00332 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span> -00333 <span class="comment">// exports in the core</span> -00334 <span class="comment">//</span> -00335 -<a name="l00336"></a><a class="code" href="classServer.html#a0">00336</a> <a class="code" href="classServer.html#a0">Server::Server</a>() -00337 { -00338 } -00339 -<a name="l00340"></a><a class="code" href="classServer.html#a1">00340</a> <a class="code" href="classServer.html#a1">Server::~Server</a>() -00341 { -00342 } -00343 -<a name="l00344"></a><a class="code" href="classServer.html#a2">00344</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">Server::SendOpers</a>(std::string s) -00345 { -00346 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str()); -00347 } -00348 -<a name="l00349"></a><a class="code" href="classServer.html#a30">00349</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a30">Server::MatchText</a>(std::string sliteral, std::string spattern) -00350 { -00351 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF]; -00352 strlcpy(literal,sliteral.c_str(),MAXBUF); -00353 strlcpy(pattern,spattern.c_str(),MAXBUF); -00354 <span class="keywordflow">return</span> match(literal,pattern); -00355 } -00356 -<a name="l00357"></a><a class="code" href="classServer.html#a25">00357</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a25">Server::SendToModeMask</a>(std::string modes, <span class="keywordtype">int</span> flags, std::string text) -00358 { -00359 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str()); -00360 } -00361 -<a name="l00362"></a><a class="code" href="classServer.html#a26">00362</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a26">Server::JoinUserToChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string key) -00363 { -00364 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>); -00365 } -00366 -<a name="l00367"></a><a class="code" href="classServer.html#a27">00367</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a27">Server::PartUserFromChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string reason) -00368 { -00369 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>); -00370 } -00371 -<a name="l00372"></a><a class="code" href="classServer.html#a35">00372</a> <a class="code" href="modules_8h.html#a28">chanuserlist</a> <a class="code" href="classServer.html#a35">Server::GetUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) -00373 { -00374 <a class="code" href="modules_8h.html#a28">chanuserlist</a> userl; -00375 userl.clear(); -00376 <span class="keywordflow">for</span> (user_hash::const_iterator i = <a class="code" href="modules_8cpp.html#a41">clientlist</a>.begin(); i != <a class="code" href="modules_8cpp.html#a41">clientlist</a>.end(); i++) -00377 { -00378 <span class="keywordflow">if</span> (i->second) -00379 { -00380 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a16">has_channel</a>(i->second,chan)) -00381 { -00382 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a13">isnick</a>(i->second->nick)) -00383 { -00384 userl.push_back(i->second); -00385 } -00386 } -00387 } -00388 } -00389 <span class="keywordflow">return</span> userl; -00390 } -<a name="l00391"></a><a class="code" href="classServer.html#a28">00391</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a28">Server::ChangeUserNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string nickname) -00392 { -00393 force_nickchange(user,nickname.c_str()); -00394 } -00395 -<a name="l00396"></a><a class="code" href="classServer.html#a29">00396</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a29">Server::QuitUser</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string reason) -00397 { -00398 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#o0">nick</a>,reason.c_str()); -00399 kill_link(user,reason.c_str()); -00400 } -00401 -<a name="l00402"></a><a class="code" href="classServer.html#a34">00402</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a34">Server::IsUlined</a>(std::string server) -00403 { -00404 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a71">is_uline</a>(server.c_str()); -00405 } -00406 -<a name="l00407"></a><a class="code" href="classServer.html#a31">00407</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a31">Server::CallCommandHandler</a>(std::string commandname, <span class="keywordtype">char</span>** parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a>* user) -00408 { -00409 call_handler(commandname.c_str(),parameters,pcnt,user); -00410 } -00411 -<a name="l00412"></a><a class="code" href="classServer.html#a3">00412</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a3">Server::Log</a>(<span class="keywordtype">int</span> level, std::string s) -00413 { -00414 log(level,<span class="stringliteral">"%s"</span>,s.c_str()); -00415 } -00416 -<a name="l00417"></a><a class="code" href="classServer.html#a23">00417</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) -00418 { -00419 <a class="code" href="modules_8h.html#a30">createcommand</a>(cmd,f,flags,minparams); -00420 } -00421 -<a name="l00422"></a><a class="code" href="classServer.html#a24">00422</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) -00423 { -00424 <a class="code" href="modules_8h.html#a31">server_mode</a>(parameters,pcnt,user); -00425 } -00426 -<a name="l00427"></a><a class="code" href="classServer.html#a4">00427</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) -00428 { -00429 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); -00430 } -00431 -<a name="l00432"></a><a class="code" href="classServer.html#a5">00432</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a5">Server::SendServ</a>(<span class="keywordtype">int</span> Socket, std::string s) -00433 { -00434 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); -00435 } -00436 -<a name="l00437"></a><a class="code" href="classServer.html#a6">00437</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a6">Server::SendFrom</a>(<span class="keywordtype">int</span> Socket, <a class="code" href="classuserrec.html">userrec</a>* User, std::string s) -00438 { -00439 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00440 } -00441 -<a name="l00442"></a><a class="code" href="classServer.html#a7">00442</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a7">Server::SendTo</a>(<a class="code" href="classuserrec.html">userrec</a>* Source, <a class="code" href="classuserrec.html">userrec</a>* Dest, std::string s) -00443 { -00444 <span class="keywordflow">if</span> (!Source) -00445 { -00446 <span class="comment">// if source is NULL, then the message originates from the local server</span> -00447 Write(Dest-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str()); -00448 } -00449 <span class="keywordflow">else</span> -00450 { -00451 <span class="comment">// otherwise it comes from the user specified</span> -00452 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str()); -00453 } -00454 } -00455 -<a name="l00456"></a><a class="code" href="classServer.html#a8">00456</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a8">Server::SendChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Channel, std::string s,<span class="keywordtype">bool</span> IncludeSender) -00457 { -00458 <span class="keywordflow">if</span> (IncludeSender) -00459 { -00460 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00461 } -00462 <span class="keywordflow">else</span> -00463 { -00464 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00465 } -00466 } -00467 -<a name="l00468"></a><a class="code" href="classServer.html#a9">00468</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a9">Server::CommonChannels</a>(<a class="code" href="classuserrec.html">userrec</a>* u1, <a class="code" href="classuserrec.html">userrec</a>* u2) -00469 { -00470 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0); -00471 } -00472 -<a name="l00473"></a><a class="code" href="classServer.html#a10">00473</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a10">Server::SendCommon</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text,<span class="keywordtype">bool</span> IncludeSender) -00474 { -00475 <span class="keywordflow">if</span> (IncludeSender) -00476 { -00477 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str()); -00478 } -00479 <span class="keywordflow">else</span> -00480 { -00481 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str()); -00482 } -00483 } -00484 -<a name="l00485"></a><a class="code" href="classServer.html#a11">00485</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a11">Server::SendWallops</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text) -00486 { -00487 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str()); -00488 } -00489 -<a name="l00490"></a><a class="code" href="classServer.html#a32">00490</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a32">Server::ChangeHost</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string host) -00491 { -00492 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str()); -00493 } -00494 -<a name="l00495"></a><a class="code" href="classServer.html#a33">00495</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a33">Server::ChangeGECOS</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string gecos) -00496 { -00497 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str()); -00498 } -00499 -<a name="l00500"></a><a class="code" href="classServer.html#a12">00500</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">Server::IsNick</a>(std::string nick) -00501 { -00502 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0); -00503 } -00504 -<a name="l00505"></a><a class="code" href="classServer.html#a14">00505</a> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a14">Server::FindNick</a>(std::string nick) -00506 { -00507 <span class="keywordflow">return</span> Find(nick); -00508 } -00509 -<a name="l00510"></a><a class="code" href="classServer.html#a15">00510</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a15">Server::FindChannel</a>(std::string channel) -00511 { -00512 <span class="keywordflow">return</span> FindChan(channel.c_str()); -00513 } -00514 -<a name="l00515"></a><a class="code" href="classServer.html#a16">00515</a> std::string <a class="code" href="classServer.html#a16">Server::ChanMode</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan) -00516 { -00517 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan); -00518 } -00519 -<a name="l00520"></a><a class="code" href="classServer.html#a17">00520</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a17">Server::IsOnChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan) -00521 { -00522 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan); -00523 } -00524 -<a name="l00525"></a><a class="code" href="classServer.html#a18">00525</a> std::string <a class="code" href="classServer.html#a18">Server::GetServerName</a>() -00526 { -00527 <span class="keywordflow">return</span> getservername(); -00528 } -00529 -<a name="l00530"></a><a class="code" href="classServer.html#a19">00530</a> std::string <a class="code" href="classServer.html#a19">Server::GetNetworkName</a>() -00531 { -00532 <span class="keywordflow">return</span> getnetworkname(); -00533 } -00534 -<a name="l00535"></a><a class="code" href="classServer.html#a20">00535</a> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a20">Server::GetAdmin</a>() -00536 { -00537 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick()); -00538 } -00539 +00332 +00333 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span> +00334 <span class="comment">// exports in the core</span> +00335 <span class="comment">//</span> +00336 +<a name="l00337"></a><a class="code" href="classServer.html#a0">00337</a> <a class="code" href="classServer.html#a0">Server::Server</a>() +00338 { +00339 } +00340 +<a name="l00341"></a><a class="code" href="classServer.html#a1">00341</a> <a class="code" href="classServer.html#a1">Server::~Server</a>() +00342 { +00343 } +00344 +<a name="l00345"></a><a class="code" href="classServer.html#a2">00345</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">Server::SendOpers</a>(std::string s) +00346 { +00347 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str()); +00348 } +00349 +<a name="l00350"></a><a class="code" href="classServer.html#a30">00350</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a30">Server::MatchText</a>(std::string sliteral, std::string spattern) +00351 { +00352 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF]; +00353 strlcpy(literal,sliteral.c_str(),MAXBUF); +00354 strlcpy(pattern,spattern.c_str(),MAXBUF); +00355 <span class="keywordflow">return</span> match(literal,pattern); +00356 } +00357 +<a name="l00358"></a><a class="code" href="classServer.html#a25">00358</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a25">Server::SendToModeMask</a>(std::string modes, <span class="keywordtype">int</span> flags, std::string text) +00359 { +00360 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str()); +00361 } +00362 +<a name="l00363"></a><a class="code" href="classServer.html#a26">00363</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a26">Server::JoinUserToChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string key) +00364 { +00365 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>); +00366 } +00367 +<a name="l00368"></a><a class="code" href="classServer.html#a27">00368</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a27">Server::PartUserFromChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string reason) +00369 { +00370 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>); +00371 } +00372 +<a name="l00373"></a><a class="code" href="classServer.html#a35">00373</a> <a class="code" href="modules_8h.html#a28">chanuserlist</a> <a class="code" href="classServer.html#a35">Server::GetUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) +00374 { +00375 <a class="code" href="modules_8h.html#a28">chanuserlist</a> userl; +00376 userl.clear(); +00377 <span class="keywordflow">for</span> (user_hash::const_iterator i = <a class="code" href="modules_8cpp.html#a41">clientlist</a>.begin(); i != <a class="code" href="modules_8cpp.html#a41">clientlist</a>.end(); i++) +00378 { +00379 <span class="keywordflow">if</span> (i->second) +00380 { +00381 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a16">has_channel</a>(i->second,chan)) +00382 { +00383 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a13">isnick</a>(i->second->nick)) +00384 { +00385 userl.push_back(i->second); +00386 } +00387 } +00388 } +00389 } +00390 <span class="keywordflow">return</span> userl; +00391 } +<a name="l00392"></a><a class="code" href="classServer.html#a28">00392</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a28">Server::ChangeUserNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string nickname) +00393 { +00394 force_nickchange(user,nickname.c_str()); +00395 } +00396 +<a name="l00397"></a><a class="code" href="classServer.html#a29">00397</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a29">Server::QuitUser</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string reason) +00398 { +00399 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#o0">nick</a>,reason.c_str()); +00400 kill_link(user,reason.c_str()); +00401 } +00402 +<a name="l00403"></a><a class="code" href="classServer.html#a34">00403</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a34">Server::IsUlined</a>(std::string server) +00404 { +00405 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a72">is_uline</a>(server.c_str()); +00406 } +00407 +<a name="l00408"></a><a class="code" href="classServer.html#a31">00408</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a31">Server::CallCommandHandler</a>(std::string commandname, <span class="keywordtype">char</span>** parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a>* user) +00409 { +00410 call_handler(commandname.c_str(),parameters,pcnt,user); +00411 } +00412 +<a name="l00413"></a><a class="code" href="classServer.html#a3">00413</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a3">Server::Log</a>(<span class="keywordtype">int</span> level, std::string s) +00414 { +00415 log(level,<span class="stringliteral">"%s"</span>,s.c_str()); +00416 } +00417 +<a name="l00418"></a><a class="code" href="classServer.html#a23">00418</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) +00419 { +00420 <a class="code" href="modules_8h.html#a30">createcommand</a>(cmd,f,flags,minparams); +00421 } +00422 +<a name="l00423"></a><a class="code" href="classServer.html#a24">00423</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) +00424 { +00425 <a class="code" href="modules_8h.html#a31">server_mode</a>(parameters,pcnt,user); +00426 } +00427 +<a name="l00428"></a><a class="code" href="classServer.html#a4">00428</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) +00429 { +00430 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); +00431 } +00432 +<a name="l00433"></a><a class="code" href="classServer.html#a5">00433</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a5">Server::SendServ</a>(<span class="keywordtype">int</span> Socket, std::string s) +00434 { +00435 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); +00436 } +00437 +<a name="l00438"></a><a class="code" href="classServer.html#a6">00438</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a6">Server::SendFrom</a>(<span class="keywordtype">int</span> Socket, <a class="code" href="classuserrec.html">userrec</a>* User, std::string s) +00439 { +00440 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00441 } +00442 +<a name="l00443"></a><a class="code" href="classServer.html#a7">00443</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a7">Server::SendTo</a>(<a class="code" href="classuserrec.html">userrec</a>* Source, <a class="code" href="classuserrec.html">userrec</a>* Dest, std::string s) +00444 { +00445 <span class="keywordflow">if</span> (!Source) +00446 { +00447 <span class="comment">// if source is NULL, then the message originates from the local server</span> +00448 Write(Dest-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str()); +00449 } +00450 <span class="keywordflow">else</span> +00451 { +00452 <span class="comment">// otherwise it comes from the user specified</span> +00453 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str()); +00454 } +00455 } +00456 +<a name="l00457"></a><a class="code" href="classServer.html#a8">00457</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a8">Server::SendChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Channel, std::string s,<span class="keywordtype">bool</span> IncludeSender) +00458 { +00459 <span class="keywordflow">if</span> (IncludeSender) +00460 { +00461 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00462 } +00463 <span class="keywordflow">else</span> +00464 { +00465 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00466 } +00467 } +00468 +<a name="l00469"></a><a class="code" href="classServer.html#a9">00469</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a9">Server::CommonChannels</a>(<a class="code" href="classuserrec.html">userrec</a>* u1, <a class="code" href="classuserrec.html">userrec</a>* u2) +00470 { +00471 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0); +00472 } +00473 +<a name="l00474"></a><a class="code" href="classServer.html#a10">00474</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a10">Server::SendCommon</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text,<span class="keywordtype">bool</span> IncludeSender) +00475 { +00476 <span class="keywordflow">if</span> (IncludeSender) +00477 { +00478 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str()); +00479 } +00480 <span class="keywordflow">else</span> +00481 { +00482 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str()); +00483 } +00484 } +00485 +<a name="l00486"></a><a class="code" href="classServer.html#a11">00486</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a11">Server::SendWallops</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text) +00487 { +00488 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str()); +00489 } +00490 +<a name="l00491"></a><a class="code" href="classServer.html#a32">00491</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a32">Server::ChangeHost</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string host) +00492 { +00493 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str()); +00494 } +00495 +<a name="l00496"></a><a class="code" href="classServer.html#a33">00496</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a33">Server::ChangeGECOS</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string gecos) +00497 { +00498 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str()); +00499 } +00500 +<a name="l00501"></a><a class="code" href="classServer.html#a12">00501</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">Server::IsNick</a>(std::string nick) +00502 { +00503 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0); +00504 } +00505 +<a name="l00506"></a><a class="code" href="classServer.html#a14">00506</a> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a14">Server::FindNick</a>(std::string nick) +00507 { +00508 <span class="keywordflow">return</span> Find(nick); +00509 } +00510 +<a name="l00511"></a><a class="code" href="classServer.html#a15">00511</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a15">Server::FindChannel</a>(std::string channel) +00512 { +00513 <span class="keywordflow">return</span> FindChan(channel.c_str()); +00514 } +00515 +<a name="l00516"></a><a class="code" href="classServer.html#a16">00516</a> std::string <a class="code" href="classServer.html#a16">Server::ChanMode</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan) +00517 { +00518 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan); +00519 } +00520 +<a name="l00521"></a><a class="code" href="classServer.html#a17">00521</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a17">Server::IsOnChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan) +00522 { +00523 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan); +00524 } +00525 +<a name="l00526"></a><a class="code" href="classServer.html#a18">00526</a> std::string <a class="code" href="classServer.html#a18">Server::GetServerName</a>() +00527 { +00528 <span class="keywordflow">return</span> getservername(); +00529 } +00530 +<a name="l00531"></a><a class="code" href="classServer.html#a19">00531</a> std::string <a class="code" href="classServer.html#a19">Server::GetNetworkName</a>() +00532 { +00533 <span class="keywordflow">return</span> getnetworkname(); +00534 } +00535 +<a name="l00536"></a><a class="code" href="classServer.html#a20">00536</a> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a20">Server::GetAdmin</a>() +00537 { +00538 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick()); +00539 } 00540 00541 -<a name="l00542"></a><a class="code" href="classServer.html#a21">00542</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a21">Server::AddExtendedMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> requires_oper, <span class="keywordtype">int</span> params_when_on, <span class="keywordtype">int</span> params_when_off) -00543 { -00544 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>) -00545 { -00546 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>); -00547 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00548 } -00549 <span class="keywordflow">if</span> (((params_when_on>0) || (params_when_off>0)) && (type == <a class="code" href="modules_8h.html#a6">MT_CLIENT</a>)) -00550 { -00551 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>); -00552 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00553 } -00554 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1)) -00555 { -00556 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>); -00557 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00558 } -00559 <span class="keywordflow">return</span> <a class="code" href="modules_8cpp.html#a56">DoAddExtendedMode</a>(modechar,type,requires_oper,params_when_on,params_when_off); -00560 } -00561 -<a name="l00562"></a><a class="code" href="classServer.html#a22">00562</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a22">Server::AddExtendedListMode</a>(<span class="keywordtype">char</span> modechar) -00563 { -00564 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a56">DoAddExtendedMode</a>(modechar,<a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>,<span class="keyword">false</span>,1,1); -00565 <span class="keywordflow">if</span> (res) -00566 <a class="code" href="modules_8cpp.html#a57">ModeMakeList</a>(modechar); -00567 <span class="keywordflow">return</span> res; -00568 } -00569 -<a name="l00570"></a><a class="code" href="classServer.html#a13">00570</a> <span class="keywordtype">int</span> <a class="code" href="classServer.html#a13">Server::CountUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* c) -00571 { -00572 <span class="keywordflow">return</span> usercount(c); -00573 } -00574 +00542 +<a name="l00543"></a><a class="code" href="classServer.html#a21">00543</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a21">Server::AddExtendedMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> requires_oper, <span class="keywordtype">int</span> params_when_on, <span class="keywordtype">int</span> params_when_off) +00544 { +00545 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>) +00546 { +00547 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>); +00548 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00549 } +00550 <span class="keywordflow">if</span> (((params_when_on>0) || (params_when_off>0)) && (type == <a class="code" href="modules_8h.html#a6">MT_CLIENT</a>)) +00551 { +00552 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>); +00553 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00554 } +00555 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1)) +00556 { +00557 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>); +00558 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00559 } +00560 <span class="keywordflow">return</span> <a class="code" href="modules_8cpp.html#a56">DoAddExtendedMode</a>(modechar,type,requires_oper,params_when_on,params_when_off); +00561 } +00562 +<a name="l00563"></a><a class="code" href="classServer.html#a22">00563</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a22">Server::AddExtendedListMode</a>(<span class="keywordtype">char</span> modechar) +00564 { +00565 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a56">DoAddExtendedMode</a>(modechar,<a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>,<span class="keyword">false</span>,1,1); +00566 <span class="keywordflow">if</span> (res) +00567 <a class="code" href="modules_8cpp.html#a57">ModeMakeList</a>(modechar); +00568 <span class="keywordflow">return</span> res; +00569 } +00570 +<a name="l00571"></a><a class="code" href="classServer.html#a13">00571</a> <span class="keywordtype">int</span> <a class="code" href="classServer.html#a13">Server::CountUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* c) +00572 { +00573 <span class="keywordflow">return</span> usercount(c); +00574 } 00575 -<a name="l00576"></a><a class="code" href="classConfigReader.html#a0">00576</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() -00577 { -00578 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00579 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00580 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this->cache,this->errorlog); -00581 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) -00582 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a25">CONF_FILE_NOT_FOUND</a>; -00583 } -00584 +00576 +<a name="l00577"></a><a class="code" href="classConfigReader.html#a0">00577</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() +00578 { +00579 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00580 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00581 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this->cache,this->errorlog); +00582 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) +00583 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a25">CONF_FILE_NOT_FOUND</a>; +00584 } 00585 -<a name="l00586"></a><a class="code" href="classConfigReader.html#a2">00586</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() -00587 { -00588 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p0">cache</a>) -00589 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p0">cache</a>; -00590 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p1">errorlog</a>) -00591 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p1">errorlog</a>; -00592 } -00593 +00586 +<a name="l00587"></a><a class="code" href="classConfigReader.html#a2">00587</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() +00588 { +00589 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p0">cache</a>) +00590 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p0">cache</a>; +00591 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p1">errorlog</a>) +00592 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p1">errorlog</a>; +00593 } 00594 -<a name="l00595"></a><a class="code" href="classConfigReader.html#a1">00595</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) -00596 { -00597 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00598 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00599 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>); -00600 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) -00601 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a25">CONF_FILE_NOT_FOUND</a>; -00602 }; -00603 -<a name="l00604"></a><a class="code" href="classConfigReader.html#a3">00604</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) -00605 { -00606 <span class="keywordtype">char</span> val[MAXBUF]; -00607 <span class="keywordtype">char</span> t[MAXBUF]; -00608 <span class="keywordtype">char</span> n[MAXBUF]; -00609 strlcpy(t,tag.c_str(),MAXBUF); -00610 strlcpy(n,name.c_str(),MAXBUF); -00611 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00612 <span class="keywordflow">if</span> (!res) -00613 { -00614 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>; -00615 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; -00616 } -00617 <span class="keywordflow">return</span> std::string(val); -00618 } -00619 -<a name="l00620"></a><a class="code" href="classConfigReader.html#a4">00620</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) -00621 { -00622 <span class="keywordtype">char</span> val[MAXBUF]; -00623 <span class="keywordtype">char</span> t[MAXBUF]; -00624 <span class="keywordtype">char</span> n[MAXBUF]; -00625 strlcpy(t,tag.c_str(),MAXBUF); -00626 strlcpy(n,name.c_str(),MAXBUF); -00627 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00628 <span class="keywordflow">if</span> (!res) -00629 { -00630 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>; -00631 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00632 } -00633 std::string s = val; -00634 <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>)); -00635 } -00636 -<a name="l00637"></a><a class="code" href="classConfigReader.html#a5">00637</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) -00638 { -00639 <span class="keywordtype">char</span> val[MAXBUF]; -00640 <span class="keywordtype">char</span> t[MAXBUF]; -00641 <span class="keywordtype">char</span> n[MAXBUF]; -00642 strlcpy(t,tag.c_str(),MAXBUF); -00643 strlcpy(n,name.c_str(),MAXBUF); -00644 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00645 <span class="keywordflow">if</span> (!res) -00646 { -00647 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>; -00648 <span class="keywordflow">return</span> 0; -00649 } -00650 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(val); i++) -00651 { -00652 <span class="keywordflow">if</span> (!isdigit(val[i])) -00653 { -00654 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a22">CONF_NOT_A_NUMBER</a>; -00655 <span class="keywordflow">return</span> 0; -00656 } -00657 } -00658 <span class="keywordflow">if</span> ((needs_unsigned) && (atoi(val)<0)) -00659 { -00660 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a23">CONF_NOT_UNSIGNED</a>; -00661 <span class="keywordflow">return</span> 0; -00662 } -00663 <span class="keywordflow">return</span> atoi(val); -00664 } -00665 -<a name="l00666"></a><a class="code" href="classConfigReader.html#a6">00666</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::GetError</a>() -00667 { -00668 <span class="keywordtype">long</span> olderr = this-><a class="code" href="classConfigReader.html#p3">error</a>; -00669 this->error = 0; -00670 <span class="keywordflow">return</span> olderr; -00671 } -00672 -<a name="l00673"></a><a class="code" href="classConfigReader.html#a9">00673</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) -00674 { -00675 <span class="keywordflow">if</span> (bail) -00676 { -00677 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()); -00678 exit(0); -00679 } -00680 <span class="keywordflow">else</span> -00681 { -00682 <span class="keywordtype">char</span> dataline[1024]; -00683 <span class="keywordflow">if</span> (user) -00684 { -00685 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>); -00686 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) -00687 { -00688 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); -00689 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); -00690 } -00691 } -00692 <span class="keywordflow">else</span> -00693 { -00694 WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); -00695 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) -00696 { -00697 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); -00698 WriteOpers(dataline); -00699 } -00700 } -00701 <span class="keywordflow">return</span>; -00702 } -00703 } -00704 +00595 +<a name="l00596"></a><a class="code" href="classConfigReader.html#a1">00596</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) +00597 { +00598 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00599 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00600 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>); +00601 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) +00602 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a25">CONF_FILE_NOT_FOUND</a>; +00603 }; +00604 +<a name="l00605"></a><a class="code" href="classConfigReader.html#a3">00605</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) +00606 { +00607 <span class="keywordtype">char</span> val[MAXBUF]; +00608 <span class="keywordtype">char</span> t[MAXBUF]; +00609 <span class="keywordtype">char</span> n[MAXBUF]; +00610 strlcpy(t,tag.c_str(),MAXBUF); +00611 strlcpy(n,name.c_str(),MAXBUF); +00612 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00613 <span class="keywordflow">if</span> (!res) +00614 { +00615 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>; +00616 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +00617 } +00618 <span class="keywordflow">return</span> std::string(val); +00619 } +00620 +<a name="l00621"></a><a class="code" href="classConfigReader.html#a4">00621</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) +00622 { +00623 <span class="keywordtype">char</span> val[MAXBUF]; +00624 <span class="keywordtype">char</span> t[MAXBUF]; +00625 <span class="keywordtype">char</span> n[MAXBUF]; +00626 strlcpy(t,tag.c_str(),MAXBUF); +00627 strlcpy(n,name.c_str(),MAXBUF); +00628 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00629 <span class="keywordflow">if</span> (!res) +00630 { +00631 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>; +00632 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00633 } +00634 std::string s = val; +00635 <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>)); +00636 } +00637 +<a name="l00638"></a><a class="code" href="classConfigReader.html#a5">00638</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) +00639 { +00640 <span class="keywordtype">char</span> val[MAXBUF]; +00641 <span class="keywordtype">char</span> t[MAXBUF]; +00642 <span class="keywordtype">char</span> n[MAXBUF]; +00643 strlcpy(t,tag.c_str(),MAXBUF); +00644 strlcpy(n,name.c_str(),MAXBUF); +00645 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00646 <span class="keywordflow">if</span> (!res) +00647 { +00648 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>; +00649 <span class="keywordflow">return</span> 0; +00650 } +00651 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(val); i++) +00652 { +00653 <span class="keywordflow">if</span> (!isdigit(val[i])) +00654 { +00655 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a22">CONF_NOT_A_NUMBER</a>; +00656 <span class="keywordflow">return</span> 0; +00657 } +00658 } +00659 <span class="keywordflow">if</span> ((needs_unsigned) && (atoi(val)<0)) +00660 { +00661 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a23">CONF_NOT_UNSIGNED</a>; +00662 <span class="keywordflow">return</span> 0; +00663 } +00664 <span class="keywordflow">return</span> atoi(val); +00665 } +00666 +<a name="l00667"></a><a class="code" href="classConfigReader.html#a6">00667</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::GetError</a>() +00668 { +00669 <span class="keywordtype">long</span> olderr = this-><a class="code" href="classConfigReader.html#p3">error</a>; +00670 this->error = 0; +00671 <span class="keywordflow">return</span> olderr; +00672 } +00673 +<a name="l00674"></a><a class="code" href="classConfigReader.html#a9">00674</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) +00675 { +00676 <span class="keywordflow">if</span> (bail) +00677 { +00678 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()); +00679 exit(0); +00680 } +00681 <span class="keywordflow">else</span> +00682 { +00683 <span class="keywordtype">char</span> dataline[1024]; +00684 <span class="keywordflow">if</span> (user) +00685 { +00686 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>); +00687 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) +00688 { +00689 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); +00690 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); +00691 } +00692 } +00693 <span class="keywordflow">else</span> +00694 { +00695 WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); +00696 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) +00697 { +00698 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); +00699 WriteOpers(dataline); +00700 } +00701 } +00702 <span class="keywordflow">return</span>; +00703 } +00704 } 00705 -<a name="l00706"></a><a class="code" href="classConfigReader.html#a7">00706</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a7">ConfigReader::Enumerate</a>(std::string tag) -00707 { -00708 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#p0">cache</a>,tag.c_str()); -00709 } -00710 -<a name="l00711"></a><a class="code" href="classConfigReader.html#a10">00711</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) -00712 { -00713 <span class="keywordflow">return</span> EnumValues(<a class="code" href="classConfigReader.html#p0">cache</a>, tag.c_str(), index); -00714 } -00715 -<a name="l00716"></a><a class="code" href="classConfigReader.html#a8">00716</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a8">ConfigReader::Verify</a>() -00717 { -00718 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#p2">readerror</a>; -00719 } -00720 +00706 +<a name="l00707"></a><a class="code" href="classConfigReader.html#a7">00707</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a7">ConfigReader::Enumerate</a>(std::string tag) +00708 { +00709 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#p0">cache</a>,tag.c_str()); +00710 } +00711 +<a name="l00712"></a><a class="code" href="classConfigReader.html#a10">00712</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) +00713 { +00714 <span class="keywordflow">return</span> EnumValues(<a class="code" href="classConfigReader.html#p0">cache</a>, tag.c_str(), index); +00715 } +00716 +<a name="l00717"></a><a class="code" href="classConfigReader.html#a8">00717</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a8">ConfigReader::Verify</a>() +00718 { +00719 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#p2">readerror</a>; +00720 } 00721 -<a name="l00722"></a><a class="code" href="classFileReader.html#a1">00722</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) -00723 { -00724 <a class="code" href="modules_8h.html#a26">file_cache</a> c; -00725 readfile(c,filename.c_str()); -00726 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; -00727 } -00728 -<a name="l00729"></a><a class="code" href="classFileReader.html#a0">00729</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() -00730 { -00731 } -00732 -<a name="l00733"></a><a class="code" href="classFileReader.html#a3">00733</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) -00734 { -00735 <a class="code" href="modules_8h.html#a26">file_cache</a> c; -00736 readfile(c,filename.c_str()); -00737 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; -00738 } -00739 +00722 +<a name="l00723"></a><a class="code" href="classFileReader.html#a1">00723</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) +00724 { +00725 <a class="code" href="modules_8h.html#a26">file_cache</a> c; +00726 readfile(c,filename.c_str()); +00727 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; +00728 } +00729 +<a name="l00730"></a><a class="code" href="classFileReader.html#a0">00730</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() +00731 { +00732 } +00733 +<a name="l00734"></a><a class="code" href="classFileReader.html#a3">00734</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) +00735 { +00736 <a class="code" href="modules_8h.html#a26">file_cache</a> c; +00737 readfile(c,filename.c_str()); +00738 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; +00739 } 00740 -<a name="l00741"></a><a class="code" href="classFileReader.html#a2">00741</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() -00742 { -00743 } -00744 -<a name="l00745"></a><a class="code" href="classFileReader.html#a4">00745</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() -00746 { -00747 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#r0">fc</a>.size() == 0) -00748 { -00749 <span class="keywordflow">return</span>(<span class="keyword">false</span>); -00750 } -00751 <span class="keywordflow">else</span> -00752 { -00753 <span class="keywordflow">return</span>(<span class="keyword">true</span>); -00754 } -00755 } -00756 -<a name="l00757"></a><a class="code" href="classFileReader.html#a5">00757</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) -00758 { -00759 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#r0">fc</a>.size())) -00760 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; -00761 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>[x]; -00762 } -00763 -<a name="l00764"></a><a class="code" href="classFileReader.html#a6">00764</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() -00765 { -00766 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>.size(); -00767 } -00768 +00741 +<a name="l00742"></a><a class="code" href="classFileReader.html#a2">00742</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() +00743 { +00744 } +00745 +<a name="l00746"></a><a class="code" href="classFileReader.html#a4">00746</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() +00747 { +00748 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#r0">fc</a>.size() == 0) +00749 { +00750 <span class="keywordflow">return</span>(<span class="keyword">false</span>); +00751 } +00752 <span class="keywordflow">else</span> +00753 { +00754 <span class="keywordflow">return</span>(<span class="keyword">true</span>); +00755 } +00756 } +00757 +<a name="l00758"></a><a class="code" href="classFileReader.html#a5">00758</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) +00759 { +00760 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#r0">fc</a>.size())) +00761 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +00762 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>[x]; +00763 } +00764 +<a name="l00765"></a><a class="code" href="classFileReader.html#a6">00765</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() +00766 { +00767 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>.size(); +00768 } 00769 -00770 std::vector<Module*> <a class="code" href="modules_8cpp.html#a58">modules</a>(255); -00771 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a59">factory</a>(255); -00772 -<a name="l00773"></a><a class="code" href="modules_8cpp.html#a1">00773</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a> = -1; -00774 +00770 +00771 std::vector<Module*> <a class="code" href="modules_8cpp.html#a58">modules</a>(255); +00772 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a59">factory</a>(255); +00773 +<a name="l00774"></a><a class="code" href="modules_8cpp.html#a1">00774</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a> = -1; 00775 -</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sat Apr 2 19:27:01 2005 for InspIRCd by +00776 +</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Apr 4 18:12:48 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> |