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         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                 chans[i].channel = NULL;
00032         }
00033         invites.clear();
00034 }
00035 
00036  
00037 char* userrec::GetFullHost()
00038 {
00039         sprintf(result,"%s!%s@%s",nick,ident,dhost);
00040         return result;
00041 }
00042 
00043 
00044 char* userrec::GetFullRealHost()
00045 {
00046         sprintf(result,"%s!%s@%s",nick,ident,host);
00047         return result;
00048 }
00049 
00050 bool userrec::IsInvited(char* channel)
00051 {
00052         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00053         {
00054                 if (i->channel) {
00055                         if (!strcasecmp(i->channel,channel))
00056                         {
00057                                 return true;
00058                         }
00059                 }
00060         }
00061         return false;
00062 }
00063 
00064 void userrec::InviteTo(char* channel)
00065 {
00066         Invited i;
00067         strcpy(i.channel,channel);
00068         invites.push_back(i);
00069 }
00070 
00071 void userrec::RemoveInvite(char* channel)
00072 {
00073         log(DEBUG,"Removing invites");
00074         if (invites.size())
00075         {
00076                 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00077                 {
00078                         if (i->channel) {
00079                                 if (!strcasecmp(i->channel,channel))
00080                                 {
00081                                         invites.erase(i);
00082                                         return;
00083                                 }
00084                         }
00085                 }
00086         }
00087 }

Generated on Wed Apr 7 19:20:14 2004 for InspIRCd by doxygen1.3-rc3