00001 /* 00002 00003 $Log$ 00003 Revision 1.1 2003/01/23 19:45:58 brain 00003 Initial revision 00003 00003 Revision 1.6 2003/01/22 20:59:12 brain 00003 Added FileReader class documentation 00003 00004 Revision 1.3 2003/01/17 13:21:38 brain 00005 Added CONNECT ALLOW and CONNECT DENY config tags 00006 Added PASS command 00007 00008 Revision 1.2 2003/01/17 10:37:55 brain 00009 Added /INVITE command and relevent structures 00010 00011 Revision 1.1 2003/01/16 01:10:04 brain 00012 forgot to add this 00013 00014 00015 */ 00016 00017 #include "inspircd_config.h" 00018 #include "channels.h" 00019 #include "users.h" 00020 #include "inspircd.h" 00021 #include <stdio.h> 00022 00023 userrec::userrec() 00024 { 00025 // the PROPER way to do it, AVOID bzero at *ALL* costs 00026 strcpy(nick,""); 00027 ip = 0; 00028 strcpy(ident,""); 00029 strcpy(host,""); 00030 strcpy(dhost,""); 00031 strcpy(fullname,""); 00032 strcpy(modes,""); 00033 strcpy(inbuf,""); 00034 strcpy(server,""); 00035 strcpy(awaymsg,""); 00036 fd = lastping = signon = idle_lastmsg = nping = registered = 0; 00037 port = bytes_in = bytes_out = cmds_in = cmds_out = 0; 00038 haspassed = false; 00039 strcpy(result,""); 00040 for (int i = 0; i < MAXCHANS; i++) 00041 { 00042 chans[i].channel = NULL; 00043 } 00044 invites.clear(); 00045 } 00046 00047 00048 char* userrec::GetFullHost() 00049 { 00050 sprintf(result,"%s!%s@%s",nick,ident,dhost); 00051 return result; 00052 } 00053 00054 00055 char* userrec::GetFullRealHost() 00056 { 00057 sprintf(result,"%s!%s@%s",nick,ident,host); 00058 return result; 00059 } 00060 00061 bool userrec::IsInvited(char* channel) 00062 { 00063 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) 00064 { 00065 if (!strcasecmp(i->channel,channel)) 00066 { 00067 return true; 00068 } 00069 } 00070 } 00071 00072 void userrec::InviteTo(char* channel) 00073 { 00074 Invited i; 00075 strcpy(i.channel,channel); 00076 invites.push_back(i); 00077 } 00078 00079 void userrec::RemoveInvite(char* channel) 00080 { 00081 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) 00082 { 00083 if (!strcasecmp(i->channel,channel)) 00084 { 00085 invites.erase(i); 00086 return; 00087 } 00088 } 00089 }