]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/users.cpp
a6ced823117bb34a2f56dc8dc9a500b86bc934d0
[user/henk/code/inspircd.git] / src / users.cpp
1 /*
2
3 $Log$
4 Revision 1.1  2003/01/23 19:45:58  brain
5 Initial revision
6
7 Revision 1.3  2003/01/17 13:21:38  brain
8 Added CONNECT ALLOW and CONNECT DENY config tags
9 Added PASS command
10
11 Revision 1.2  2003/01/17 10:37:55  brain
12 Added /INVITE command and relevent structures
13
14 Revision 1.1  2003/01/16 01:10:04  brain
15 forgot to add this
16
17
18 */
19
20 #include "inspircd_config.h" 
21 #include "channels.h"
22 #include "users.h"
23 #include "inspircd.h"
24 #include <stdio.h>
25
26 userrec::userrec()
27 {
28         // the PROPER way to do it, AVOID bzero at *ALL* costs
29         strcpy(nick,"");
30         ip = 0;
31         strcpy(ident,"");
32         strcpy(host,"");
33         strcpy(dhost,"");
34         strcpy(fullname,"");
35         strcpy(modes,"");
36         strcpy(inbuf,"");
37         strcpy(server,"");
38         strcpy(awaymsg,"");
39         fd = lastping = signon = idle_lastmsg = nping = registered = 0;
40         port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
41         haspassed = false;
42         strcpy(result,"");
43         for (int i = 0; i < MAXCHANS; i++)
44         {
45                 chans[i].channel = NULL;
46         }
47         invites.clear();
48 }
49
50  
51 char* userrec::GetFullHost()
52 {
53         sprintf(result,"%s!%s@%s",nick,ident,dhost);
54         return result;
55 }
56
57
58 char* userrec::GetFullRealHost()
59 {
60         sprintf(result,"%s!%s@%s",nick,ident,host);
61         return result;
62 }
63
64 bool userrec::IsInvited(char* channel)
65 {
66         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
67         {
68                 if (!strcasecmp(i->channel,channel))
69                 {
70                         return true;
71                 }
72         }
73 }
74
75 void userrec::InviteTo(char* channel)
76 {
77         Invited i;
78         strcpy(i.channel,channel);
79         invites.push_back(i);
80 }
81
82 void userrec::RemoveInvite(char* channel)
83 {
84         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
85         {
86                 if (!strcasecmp(i->channel,channel))
87                 {
88                         invites.erase(i);
89                         return;
90                 }
91         }
92 }