]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/module-doc/users_8cpp-source.html
088c5ffe4b4b37e6520297a229177dde9fdfed26
[user/henk/code/inspircd.git] / docs / module-doc / users_8cpp-source.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>users.cpp Source File</title>
4 <link href="inspircd.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.3-rc3 -->
7 <center>
8 <a class="qindex" href="main.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
9 <hr><h1>users.cpp</h1><a href="users_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>
10 00002 <span class="comment"></span>
11 00003 <span class="comment">*/</span>
12 00004 
13 00005 <span class="preprocessor">#include "inspircd_config.h"</span> 
14 00006 <span class="preprocessor">#include "<a class="code" href="channels_8h.html">channels.h</a>"</span>
15 00007 <span class="preprocessor">#include "<a class="code" href="users_8h.html">users.h</a>"</span>
16 00008 <span class="preprocessor">#include "inspircd.h"</span>
17 00009 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
18 00010 
19 <a name="l00011"></a><a class="code" href="classuserrec.html#a0">00011</a> <a class="code" href="classuserrec.html#a0">userrec::userrec</a>()
20 00012 {
21 00013         <span class="comment">// the PROPER way to do it, AVOID bzero at *ALL* costs</span>
22 00014         strcpy(nick,<span class="stringliteral">""</span>);
23 00015         strcpy(ip,<span class="stringliteral">"127.0.0.1"</span>);
24 00016         <a class="code" href="classuserrec.html#m10">timeout</a> = 0;
25 00017         strcpy(ident,<span class="stringliteral">""</span>);
26 00018         strcpy(host,<span class="stringliteral">""</span>);
27 00019         strcpy(dhost,<span class="stringliteral">""</span>);
28 00020         strcpy(fullname,<span class="stringliteral">""</span>);
29 00021         strcpy(modes,<span class="stringliteral">""</span>);
30 00022         strcpy(inbuf,<span class="stringliteral">""</span>);
31 00023         strcpy(server,<span class="stringliteral">""</span>);
32 00024         strcpy(awaymsg,<span class="stringliteral">""</span>);
33 00025         <a class="code" href="classconnection.html#m0">fd</a> = <a class="code" href="classconnection.html#m12">lastping</a> = <a class="code" href="classconnection.html#m13">signon</a> = <a class="code" href="classconnection.html#m14">idle_lastmsg</a> = <a class="code" href="classconnection.html#m15">nping</a> = <a class="code" href="classconnection.html#m10">registered</a> = 0;
34 00026         <a class="code" href="classuserrec.html#m9">flood</a> = <a class="code" href="classconnection.html#m9">port</a> = <a class="code" href="classconnection.html#m4">bytes_in</a> = <a class="code" href="classconnection.html#m5">bytes_out</a> = <a class="code" href="classconnection.html#m6">cmds_in</a> = <a class="code" href="classconnection.html#m7">cmds_out</a> = 0;
35 00027         <a class="code" href="classconnection.html#m8">haspassed</a> = <span class="keyword">false</span>;
36 00028         strcpy(result,<span class="stringliteral">""</span>);
37 00029         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; MAXCHANS; i++)
38 00030         {
39 00031                 this-&gt;<a class="code" href="classuserrec.html#m5">chans</a>[i].<a class="code" href="classucrec.html#m1">channel</a> = NULL;
40 00032                 this-&gt;<a class="code" href="classuserrec.html#m5">chans</a>[i].<a class="code" href="classucrec.html#m0">uc_modes</a> = 0;
41 00033         }
42 00034         <a class="code" href="classuserrec.html#o0">invites</a>.clear();
43 00035 }
44 00036 
45 00037 
46 00038  
47 <a name="l00039"></a><a class="code" href="classuserrec.html#a2">00039</a> <span class="keywordtype">char</span>* <a class="code" href="classuserrec.html#a2">userrec::GetFullHost</a>()
48 00040 {
49 00041         sprintf(result,<span class="stringliteral">"%s!%s@%s"</span>,nick,ident,dhost);
50 00042         <span class="keywordflow">return</span> <a class="code" href="classuserrec.html#m8">result</a>;
51 00043 }
52 00044 
53 00045 
54 <a name="l00046"></a><a class="code" href="classuserrec.html#a3">00046</a> <span class="keywordtype">char</span>* <a class="code" href="classuserrec.html#a3">userrec::GetFullRealHost</a>()
55 00047 {
56 00048         sprintf(result,<span class="stringliteral">"%s!%s@%s"</span>,nick,ident,host);
57 00049         <span class="keywordflow">return</span> <a class="code" href="classuserrec.html#m8">result</a>;
58 00050 }
59 00051 
60 <a name="l00052"></a><a class="code" href="classuserrec.html#a4">00052</a> <span class="keywordtype">bool</span> <a class="code" href="classuserrec.html#a4">userrec::IsInvited</a>(<span class="keywordtype">char</span>* channel)
61 00053 {
62 00054         <span class="keywordflow">for</span> (InvitedList::iterator i = <a class="code" href="classuserrec.html#o0">invites</a>.begin(); i != <a class="code" href="classuserrec.html#o0">invites</a>.end(); i++)
63 00055         {
64 00056                 <span class="keywordflow">if</span> (i-&gt;channel) {
65 00057                         <span class="keywordflow">if</span> (!strcasecmp(i-&gt;channel,channel))
66 00058                         {
67 00059                                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
68 00060                         }
69 00061                 }
70 00062         }
71 00063         <span class="keywordflow">return</span> <span class="keyword">false</span>;
72 00064 }
73 00065 
74 <a name="l00066"></a><a class="code" href="classuserrec.html#a5">00066</a> <span class="keywordtype">void</span> <a class="code" href="classuserrec.html#a5">userrec::InviteTo</a>(<span class="keywordtype">char</span>* channel)
75 00067 {
76 00068         <a class="code" href="classInvited.html">Invited</a> i;
77 00069         strcpy(i.<a class="code" href="classInvited.html#m0">channel</a>,channel);
78 00070         <a class="code" href="classuserrec.html#o0">invites</a>.push_back(i);
79 00071 }
80 00072 
81 <a name="l00073"></a><a class="code" href="classuserrec.html#a6">00073</a> <span class="keywordtype">void</span> <a class="code" href="classuserrec.html#a6">userrec::RemoveInvite</a>(<span class="keywordtype">char</span>* channel)
82 00074 {
83 00075         log(DEBUG,<span class="stringliteral">"Removing invites"</span>);
84 00076         <span class="keywordflow">if</span> (channel)
85 00077         {
86 00078                 <span class="keywordflow">if</span> (<a class="code" href="classuserrec.html#o0">invites</a>.size())
87 00079                 {
88 00080                         <span class="keywordflow">for</span> (InvitedList::iterator i = <a class="code" href="classuserrec.html#o0">invites</a>.begin(); i != <a class="code" href="classuserrec.html#o0">invites</a>.end(); i++)
89 00081                         {
90 00082                                 <span class="keywordflow">if</span> (i-&gt;channel)
91 00083                                 {
92 00084                                         <span class="keywordflow">if</span> (!strcasecmp(i-&gt;channel,channel))
93 00085                                         {
94 00086                                                 <a class="code" href="classuserrec.html#o0">invites</a>.erase(i);
95 00087                                                 <span class="keywordflow">return</span>;
96 00088                                         }
97 00089                                 }
98 00090                         }
99 00091                 }
100 00092         }
101 00093 }
102 </pre></div><hr><address style="align: right;"><small>Generated on Fri Apr 30 13:23:14 2004 for InspIRCd by
103 <a href="http://www.doxygen.org/index.html">
104 <img src="doxygen.png" alt="doxygen" align="middle" border=0 
105 width=110 height=53></a>1.3-rc3 </small></address>
106 </body>
107 </html>