mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-12 03:59:03 -04:00
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@776 e03df62e-2008-0410-955e-edbf42e46eb7
200 lines
19 KiB
HTML
200 lines
19 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>channels.cpp Source File</title>
|
|
<link href="inspircd.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.3-rc3 -->
|
|
<center>
|
|
<a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center>
|
|
<hr><h1>channels.cpp</h1><a href="channels_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#include "inspircd.h"</span>
|
|
00002 <span class="preprocessor">#include "inspircd_io.h"</span>
|
|
00003 <span class="preprocessor">#include "inspircd_util.h"</span>
|
|
00004 <span class="preprocessor">#include "inspircd_config.h"</span>
|
|
00005 <span class="preprocessor">#include <unistd.h></span>
|
|
00006 <span class="preprocessor">#include <fcntl.h></span>
|
|
00007 <span class="preprocessor">#include <sys/errno.h></span>
|
|
00008 <span class="preprocessor">#include <sys/ioctl.h></span>
|
|
00009 <span class="preprocessor">#include <sys/utsname.h></span>
|
|
00010 <span class="preprocessor">#include <cstdio></span>
|
|
00011 <span class="preprocessor">#include <time.h></span>
|
|
00012 <span class="preprocessor">#include <string></span>
|
|
00013 <span class="preprocessor">#ifdef GCC3</span>
|
|
00014 <span class="preprocessor"></span><span class="preprocessor">#include <ext/hash_map></span>
|
|
00015 <span class="preprocessor">#else</span>
|
|
00016 <span class="preprocessor"></span><span class="preprocessor">#include <hash_map></span>
|
|
00017 <span class="preprocessor">#endif</span>
|
|
00018 <span class="preprocessor"></span><span class="preprocessor">#include <map></span>
|
|
00019 <span class="preprocessor">#include <sstream></span>
|
|
00020 <span class="preprocessor">#include <vector></span>
|
|
00021 <span class="preprocessor">#include <errno.h></span>
|
|
00022 <span class="preprocessor">#include <deque></span>
|
|
00023 <span class="preprocessor">#include <errno.h></span>
|
|
00024 <span class="preprocessor">#include <unistd.h></span>
|
|
00025 <span class="preprocessor">#include <sched.h></span>
|
|
00026 <span class="preprocessor">#include "<a class="code" href="connection_8h.html">connection.h</a>"</span>
|
|
00027 <span class="preprocessor">#include "<a class="code" href="users_8h.html">users.h</a>"</span>
|
|
00028 <span class="preprocessor">#include "<a class="code" href="servers_8h.html">servers.h</a>"</span>
|
|
00029 <span class="preprocessor">#include "<a class="code" href="ctables_8h.html">ctables.h</a>"</span>
|
|
00030 <span class="preprocessor">#include "globals.h"</span>
|
|
00031 <span class="preprocessor">#include "<a class="code" href="modules_8h.html">modules.h</a>"</span>
|
|
00032 <span class="preprocessor">#include "dynamic.h"</span>
|
|
00033 <span class="preprocessor">#include "wildcard.h"</span>
|
|
00034 <span class="preprocessor">#include "<a class="code" href="message_8h.html">message.h</a>"</span>
|
|
00035 <span class="preprocessor">#include "<a class="code" href="mode_8h.html">mode.h</a>"</span>
|
|
00036 <span class="preprocessor">#include "<a class="code" href="xline_8h.html">xline.h</a>"</span>
|
|
00037
|
|
00038 <span class="preprocessor">#ifdef GCC3</span>
|
|
00039 <span class="preprocessor"></span><span class="preprocessor">#define nspace __gnu_cxx</span>
|
|
00040 <span class="preprocessor"></span><span class="preprocessor">#else</span>
|
|
<a name="l00041"></a><a class="code" href="channels_8cpp.html#a0">00041</a> <span class="preprocessor"></span><span class="preprocessor">#define nspace std</span>
|
|
00042 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
|
00043 <span class="preprocessor"></span>
|
|
00044 <span class="keyword">using</span> <span class="keyword">namespace </span>std;
|
|
00045
|
|
00046 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a>;
|
|
<a name="l00047"></a><a class="code" href="channels_8cpp.html#a2">00047</a> <span class="keyword">extern</span> vector<Module*> <a class="code" href="channels_8cpp.html#a2">modules</a>;
|
|
<a name="l00048"></a><a class="code" href="channels_8cpp.html#a3">00048</a> <span class="keyword">extern</span> vector<ircd_module*> <a class="code" href="channels_8cpp.html#a3">factory</a>;
|
|
00049
|
|
<a name="l00050"></a><a class="code" href="channels_8cpp.html#a4">00050</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a4">LogLevel</a>;
|
|
<a name="l00051"></a><a class="code" href="channels_8cpp.html#a5">00051</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a5">ServerName</a>[MAXBUF];
|
|
<a name="l00052"></a><a class="code" href="channels_8cpp.html#a6">00052</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a6">Network</a>[MAXBUF];
|
|
<a name="l00053"></a><a class="code" href="channels_8cpp.html#a7">00053</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a7">ServerDesc</a>[MAXBUF];
|
|
<a name="l00054"></a><a class="code" href="channels_8cpp.html#a8">00054</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a8">AdminName</a>[MAXBUF];
|
|
<a name="l00055"></a><a class="code" href="channels_8cpp.html#a9">00055</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a9">AdminEmail</a>[MAXBUF];
|
|
<a name="l00056"></a><a class="code" href="channels_8cpp.html#a10">00056</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a10">AdminNick</a>[MAXBUF];
|
|
<a name="l00057"></a><a class="code" href="channels_8cpp.html#a11">00057</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a11">diepass</a>[MAXBUF];
|
|
<a name="l00058"></a><a class="code" href="channels_8cpp.html#a12">00058</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a12">restartpass</a>[MAXBUF];
|
|
<a name="l00059"></a><a class="code" href="channels_8cpp.html#a13">00059</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a13">motd</a>[MAXBUF];
|
|
<a name="l00060"></a><a class="code" href="channels_8cpp.html#a14">00060</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a14">rules</a>[MAXBUF];
|
|
<a name="l00061"></a><a class="code" href="channels_8cpp.html#a15">00061</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a15">list</a>[MAXBUF];
|
|
<a name="l00062"></a><a class="code" href="channels_8cpp.html#a16">00062</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a16">PrefixQuit</a>[MAXBUF];
|
|
<a name="l00063"></a><a class="code" href="channels_8cpp.html#a17">00063</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a17">DieValue</a>[MAXBUF];
|
|
00064
|
|
<a name="l00065"></a><a class="code" href="channels_8cpp.html#a18">00065</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a18">debugging</a>;
|
|
<a name="l00066"></a><a class="code" href="channels_8cpp.html#a19">00066</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a19">WHOWAS_STALE</a>;
|
|
<a name="l00067"></a><a class="code" href="channels_8cpp.html#a20">00067</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a20">WHOWAS_MAX</a>;
|
|
<a name="l00068"></a><a class="code" href="channels_8cpp.html#a21">00068</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a21">DieDelay</a>;
|
|
<a name="l00069"></a><a class="code" href="channels_8cpp.html#a22">00069</a> <span class="keyword">extern</span> time_t <a class="code" href="channels_8cpp.html#a22">startup_time</a>;
|
|
<a name="l00070"></a><a class="code" href="channels_8cpp.html#a23">00070</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a23">NetBufferSize</a>;
|
|
<a name="l00071"></a><a class="code" href="channels_8cpp.html#a24">00071</a> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a24">MaxWhoResults</a>;
|
|
<a name="l00072"></a><a class="code" href="channels_8cpp.html#a25">00072</a> <span class="keyword">extern</span> time_t <a class="code" href="channels_8cpp.html#a25">nb_start</a>;
|
|
00073
|
|
<a name="l00074"></a><a class="code" href="channels_8cpp.html#a26">00074</a> <span class="keyword">extern</span> std::vector<int> <a class="code" href="channels_8cpp.html#a26">fd_reap</a>;
|
|
<a name="l00075"></a><a class="code" href="channels_8cpp.html#a27">00075</a> <span class="keyword">extern</span> std::vector<std::string> <a class="code" href="channels_8cpp.html#a27">module_names</a>;
|
|
00076
|
|
<a name="l00077"></a><a class="code" href="channels_8cpp.html#a28">00077</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a28">bannerBuffer</a>[MAXBUF];
|
|
<a name="l00078"></a><a class="code" href="channels_8cpp.html#a29">00078</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a29">boundPortCount</a>;
|
|
<a name="l00079"></a><a class="code" href="channels_8cpp.html#a30">00079</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a30">portCount</a>;
|
|
<a name="l00080"></a><a class="code" href="channels_8cpp.html#a31">00080</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a31">UDPportCount</a>;
|
|
<a name="l00081"></a><a class="code" href="channels_8cpp.html#a32">00081</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a32">ports</a>[MAXSOCKS];
|
|
<a name="l00082"></a><a class="code" href="channels_8cpp.html#a33">00082</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a33">defaultRoute</a>;
|
|
00083
|
|
<a name="l00084"></a><a class="code" href="channels_8cpp.html#a34">00084</a> <span class="keyword">extern</span> std::vector<long> <a class="code" href="channels_8cpp.html#a34">auth_cookies</a>;
|
|
<a name="l00085"></a><a class="code" href="channels_8cpp.html#a35">00085</a> <span class="keyword">extern</span> std::stringstream <a class="code" href="channels_8cpp.html#a35">config_f</a>;
|
|
00086
|
|
<a name="l00087"></a><a class="code" href="channels_8cpp.html#a36">00087</a> <span class="keyword">extern</span> <a class="code" href="classserverrec.html">serverrec</a>* <a class="code" href="channels_8cpp.html#a36">me</a>[32];
|
|
00088
|
|
<a name="l00089"></a><a class="code" href="channels_8cpp.html#a37">00089</a> <span class="keyword">extern</span> FILE *<a class="code" href="channels_8cpp.html#a37">log_file</a>;
|
|
00090
|
|
00091
|
|
00092 <span class="keyword">using</span> <span class="keyword">namespace </span>std;
|
|
00093
|
|
<a name="l00094"></a><a class="code" href="channels_8cpp.html#a38">00094</a> std::vector<ModeParameter> <a class="code" href="channels_8cpp.html#a38">custom_mode_params</a>;
|
|
00095
|
|
<a name="l00096"></a><a class="code" href="classchanrec.html#a4">00096</a> <a class="code" href="classchanrec.html#a4">chanrec::chanrec</a>()
|
|
00097 {
|
|
00098 strcpy(name,<span class="stringliteral">""</span>);
|
|
00099 strcpy(custom_modes,<span class="stringliteral">""</span>);
|
|
00100 strcpy(topic,<span class="stringliteral">""</span>);
|
|
00101 strcpy(setby,<span class="stringliteral">""</span>);
|
|
00102 strcpy(key,<span class="stringliteral">""</span>);
|
|
00103 <a class="code" href="classchanrec.html#m3">created</a> = <a class="code" href="classchanrec.html#m4">topicset</a> = <a class="code" href="classchanrec.html#m6">limit</a> = 0;
|
|
00104 <a class="code" href="classchanrec.html#m8">topiclock</a> = <a class="code" href="classchanrec.html#m9">noexternal</a> = <a class="code" href="classchanrec.html#m10">inviteonly</a> = <a class="code" href="classchanrec.html#m11">moderated</a> = <a class="code" href="classchanrec.html#m12">secret</a> = <a class="code" href="classchanrec.html#m13">c_private</a> = <span class="keyword">false</span>;
|
|
00105 }
|
|
00106
|
|
<a name="l00107"></a><a class="code" href="classchanrec.html#a0">00107</a> <span class="keywordtype">void</span> <a class="code" href="classchanrec.html#a0">chanrec::SetCustomMode</a>(<span class="keywordtype">char</span> mode,<span class="keywordtype">bool</span> mode_on)
|
|
00108 {
|
|
00109 <span class="keywordflow">if</span> (mode_on) {
|
|
00110 <span class="keywordtype">char</span> m[3];
|
|
00111 m[0] = mode;
|
|
00112 m[1] = <span class="charliteral">'\0'</span>;
|
|
00113 <span class="keywordflow">if</span> (!strchr(this->custom_modes,mode))
|
|
00114 {
|
|
00115 strncat(custom_modes,m,MAXMODES);
|
|
00116 }
|
|
00117 log(DEBUG,<span class="stringliteral">"Custom mode %c set"</span>,mode);
|
|
00118 }
|
|
00119 <span class="keywordflow">else</span> {
|
|
00120 <span class="keywordtype">char</span> temp[MAXBUF];
|
|
00121 <span class="keywordtype">int</span> count = 0;
|
|
00122 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> q = 0; q < strlen(custom_modes); q++) {
|
|
00123 <span class="keywordflow">if</span> (<a class="code" href="classchanrec.html#m1">custom_modes</a>[q] != mode) {
|
|
00124 temp[count++] = mode;
|
|
00125 }
|
|
00126 }
|
|
00127 temp[count] = <span class="charliteral">'\0'</span>;
|
|
00128 strncpy(custom_modes,temp,MAXMODES);
|
|
00129 log(DEBUG,<span class="stringliteral">"Custom mode %c removed"</span>,mode);
|
|
00130 this-><a class="code" href="classchanrec.html#a1">SetCustomModeParam</a>(mode,<span class="stringliteral">""</span>,<span class="keyword">false</span>);
|
|
00131 }
|
|
00132 }
|
|
00133
|
|
00134
|
|
<a name="l00135"></a><a class="code" href="classchanrec.html#a1">00135</a> <span class="keywordtype">void</span> <a class="code" href="classchanrec.html#a1">chanrec::SetCustomModeParam</a>(<span class="keywordtype">char</span> mode,<span class="keywordtype">char</span>* parameter,<span class="keywordtype">bool</span> mode_on)
|
|
00136 {
|
|
00137
|
|
00138 log(DEBUG,<span class="stringliteral">"SetCustomModeParam called"</span>);
|
|
00139 <a class="code" href="classModeParameter.html">ModeParameter</a> M;
|
|
00140 M.<a class="code" href="classModeParameter.html#m0">mode</a> = mode;
|
|
00141 strcpy(M.<a class="code" href="classModeParameter.html#m2">channel</a>,this->name);
|
|
00142 strcpy(M.<a class="code" href="classModeParameter.html#m1">parameter</a>,parameter);
|
|
00143 <span class="keywordflow">if</span> (mode_on)
|
|
00144 {
|
|
00145 log(DEBUG,<span class="stringliteral">"Custom mode parameter %c %s added"</span>,mode,parameter);
|
|
00146 <a class="code" href="channels_8cpp.html#a38">custom_mode_params</a>.push_back(M);
|
|
00147 }
|
|
00148 <span class="keywordflow">else</span>
|
|
00149 {
|
|
00150 <span class="keywordflow">if</span> (<a class="code" href="channels_8cpp.html#a38">custom_mode_params</a>.size())
|
|
00151 {
|
|
00152 <span class="keywordflow">for</span> (vector<ModeParameter>::iterator i = <a class="code" href="channels_8cpp.html#a38">custom_mode_params</a>.begin(); i < <a class="code" href="channels_8cpp.html#a38">custom_mode_params</a>.end(); i++)
|
|
00153 {
|
|
00154 <span class="keywordflow">if</span> ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
|
|
00155 {
|
|
00156 log(DEBUG,<span class="stringliteral">"Custom mode parameter %c %s removed"</span>,mode,parameter);
|
|
00157 <a class="code" href="channels_8cpp.html#a38">custom_mode_params</a>.erase(i);
|
|
00158 <span class="keywordflow">return</span>;
|
|
00159 }
|
|
00160 }
|
|
00161 }
|
|
00162 log(DEBUG,<span class="stringliteral">"*** BUG *** Attempt to remove non-existent mode parameter!"</span>);
|
|
00163 }
|
|
00164 }
|
|
00165
|
|
<a name="l00166"></a><a class="code" href="classchanrec.html#a2">00166</a> <span class="keywordtype">bool</span> <a class="code" href="classchanrec.html#a2">chanrec::IsCustomModeSet</a>(<span class="keywordtype">char</span> mode)
|
|
00167 {
|
|
00168 log(DEBUG,<span class="stringliteral">"Checking ISCustomModeSet: %c %s"</span>,mode,this->custom_modes);
|
|
00169 <span class="keywordflow">return</span> (strchr(this->custom_modes,mode) != 0);
|
|
00170 }
|
|
00171
|
|
<a name="l00172"></a><a class="code" href="classchanrec.html#a3">00172</a> std::string <a class="code" href="classchanrec.html#a3">chanrec::GetModeParameter</a>(<span class="keywordtype">char</span> mode)
|
|
00173 {
|
|
00174 <span class="keywordflow">if</span> (<a class="code" href="channels_8cpp.html#a38">custom_mode_params</a>.size())
|
|
00175 {
|
|
00176 <span class="keywordflow">for</span> (vector<ModeParameter>::iterator i = <a class="code" href="channels_8cpp.html#a38">custom_mode_params</a>.begin(); i < <a class="code" href="channels_8cpp.html#a38">custom_mode_params</a>.end(); i++)
|
|
00177 {
|
|
00178 <span class="keywordflow">if</span> ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
|
|
00179 {
|
|
00180 <span class="keywordflow">return</span> std::string(i->parameter);
|
|
00181 }
|
|
00182 }
|
|
00183 }
|
|
00184 <span class="keywordflow">return</span> std::string(<span class="stringliteral">""</span>);
|
|
00185 }
|
|
</pre></div><hr><address style="align: right;"><small>Generated on Sun May 2 00:09:18 2004 for InspIRCd by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border=0
|
|
width=110 height=53></a>1.3-rc3 </small></address>
|
|
</body>
|
|
</html>
|