Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

users.cpp

Go to the documentation of this file.
00001 /*
00002 
00003 */
00004 
00005 #include "inspircd_config.h" 
00006 #include "channels.h"
00007 #include "users.h"
00008 #include "inspircd.h"
00009 #include <stdio.h>
00010 
00011 userrec::userrec()
00012 {
00013         // the PROPER way to do it, AVOID bzero at *ALL* costs
00014         strcpy(nick,"");
00015         ip = 0;
00016         timeout = 0;
00017         strcpy(ident,"");
00018         strcpy(host,"");
00019         strcpy(dhost,"");
00020         strcpy(fullname,"");
00021         strcpy(modes,"");
00022         strcpy(inbuf,"");
00023         strcpy(server,"");
00024         strcpy(awaymsg,"");
00025         fd = lastping = signon = idle_lastmsg = nping = registered = 0;
00026         flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
00027         haspassed = false;
00028         strcpy(result,"");
00029         for (int i = 0; i < MAXCHANS; i++)
00030         {
00031                 this->chans[i].channel = NULL;
00032                 this->chans[i].uc_modes = 0;
00033         }
00034         invites.clear();
00035 }
00036 
00037 
00038  
00039 char* userrec::GetFullHost()
00040 {
00041         sprintf(result,"%s!%s@%s",nick,ident,dhost);
00042         return result;
00043 }
00044 
00045 
00046 char* userrec::GetFullRealHost()
00047 {
00048         sprintf(result,"%s!%s@%s",nick,ident,host);
00049         return result;
00050 }
00051 
00052 bool userrec::IsInvited(char* channel)
00053 {
00054         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00055         {
00056                 if (i->channel) {
00057                         if (!strcasecmp(i->channel,channel))
00058                         {
00059                                 return true;
00060                         }
00061                 }
00062         }
00063         return false;
00064 }
00065 
00066 void userrec::InviteTo(char* channel)
00067 {
00068         Invited i;
00069         strcpy(i.channel,channel);
00070         invites.push_back(i);
00071 }
00072 
00073 void userrec::RemoveInvite(char* channel)
00074 {
00075         log(DEBUG,"Removing invites");
00076         if (channel)
00077         {
00078                 if (invites.size())
00079                 {
00080                         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00081                         {
00082                                 if (i->channel)
00083                                 {
00084                                         if (!strcasecmp(i->channel,channel))
00085                                         {
00086                                                 invites.erase(i);
00087                                                 return;
00088                                         }
00089                                 }
00090                         }
00091                 }
00092         }
00093 }

Generated on Mon Apr 19 02:34:32 2004 for InspIRCd by doxygen1.3-rc3