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